diff --git a/src/posthog-surveys.ts b/src/posthog-surveys.ts index b6dcdd990..19ea5c282 100644 --- a/src/posthog-surveys.ts +++ b/src/posthog-surveys.ts @@ -265,8 +265,9 @@ export class PostHogSurveys { // this method is lazily loaded onto the window to avoid loading preact and other dependencies if surveys is not enabled private _canActivateRepeatedly(survey: Survey) { - if (isNullish(assignableWindow.__PosthogExtensions__.canActivateRepeatedly)) { + if (isNullish(assignableWindow.__PosthogExtensions__?.canActivateRepeatedly)) { logger.warn(LOGGER_PREFIX, 'canActivateRepeatedly is not defined, must init before calling') + return false // TODO does it make sense to have a default here? } return assignableWindow.__PosthogExtensions__.canActivateRepeatedly(survey) }