core-bundle/src/Security/Authentication/Token/TokenChecker.php
public function isPreviewMode(): bool
    {
        $token = $this->getToken(FrontendUser::SECURITY_SESSION_KEY);

        return $token instanceof FrontendPreviewToken && $token->showUnpublished();
    }
public function isPreviewMode(): bool
    {
        $token = $this->getToken(FrontendUser::SECURITY_SESSION_KEY);

        return $token instanceof FrontendPreviewToken && $token->showUnpublished();
    }
Tells whether the front end preview can show unpublished fragments.