Skip to main content
Glama
surveys.jsx.map69.9 kB
{"version":3,"file":"surveys.jsx","sourceRoot":"","sources":["../../../src/extensions/surveys.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAIH,2BAA2B,EAC3B,kBAAkB,EAElB,UAAU,GACb,MAAM,0BAA0B,CAAA;AAEjC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAA;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAA;AAC5D,OAAO,EACH,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,GACjB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACH,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,KAAK,EACL,sBAAsB,EACtB,aAAa,GAChB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,IAAM,MAAM,GAAG,YAAY,CAAC,WAAW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AAM,kBAAkB;QACpB,GAAC,kBAAkB,CAAC,IAAI,IAAG,gBAAgB;QAC3C,GAAC,kBAAkB,CAAC,IAAI,IAAG,YAAY;QACvC,GAAC,kBAAkB,CAAC,MAAM,IAAG,cAAc;QAC3C,GAAC,kBAAkB,CAAC,YAAY,IAAG,sBAAsB;QACzD,GAAC,kBAAkB,CAAC,cAAc,IAAG,sBAAsB;WAC9D,CAAA;IAED,IAAM,WAAW,GAAG;QAChB,QAAQ,UAAA;QACR,gBAAgB,kBAAA;QAChB,UAAU,YAAA;QACV,eAAe,EAAE,UAAC,GAAsC;YACpD,eAAe,CAAC,GAAG,CAAC,CAAA;QACxB,CAAC;QACD,QAAQ,EAAE,UAAC,GAAsC;YAC7C,QAAQ,CAAC,GAAG,CAAC,CAAA;QACjB,CAAC;KACJ,CAAA;IAED,IAAM,eAAe;QACjB,GAAC,kBAAkB,CAAC,IAAI,IAAG,EAAE;QAC7B,GAAC,kBAAkB,CAAC,IAAI,IAAG,EAAE;QAC7B,GAAC,kBAAkB,CAAC,MAAM,IAAG,EAAE,oBAAoB,sBAAA,EAAE;QACrD,GAAC,kBAAkB,CAAC,YAAY,IAAG,EAAE,oBAAoB,sBAAA,EAAE;QAC3D,GAAC,kBAAkB,CAAC,cAAc,IAAG,EAAE,oBAAoB,sBAAA,EAAE;WAChE,CAAA;IAED,IAAM,SAAS,GAAG,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACnD,IAAM,cAAc,yBAAQ,WAAW,GAAK,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAE,CAAA;IAE5E,OAAO,CAAC,SAAS,CAAC,IAAI,cAAc,CAAC,EAAG,CAAA;AAC5C,CAAC,CAAA","sourcesContent":["import { PostHog } from '../posthog-core'\nimport { doesSurveyUrlMatch } from '../posthog-surveys'\nimport {\n Survey,\n SurveyAppearance,\n SurveyQuestion,\n SurveyQuestionBranchingType,\n SurveyQuestionType,\n SurveyRenderReason,\n SurveyType,\n} from '../posthog-surveys-types'\n\nimport * as Preact from 'preact'\nimport { useContext, useEffect, useMemo, useRef, useState } from 'preact/hooks'\nimport { addEventListener } from '../utils'\nimport { document as _document, window as _window } from '../utils/globals'\nimport { createLogger } from '../utils/logger'\nimport { isNull, isNumber } from '../utils/type-utils'\nimport { createWidgetShadow, createWidgetStyle } from './surveys-widget'\nimport { ConfirmationMessage } from './surveys/components/ConfirmationMessage'\nimport { Cancel } from './surveys/components/QuestionHeader'\nimport {\n LinkQuestion,\n MultipleChoiceQuestion,\n OpenTextQuestion,\n RatingQuestion,\n} from './surveys/components/QuestionTypes'\nimport {\n createShadow,\n defaultSurveyAppearance,\n dismissedSurveyEvent,\n getContrastingTextColor,\n getDisplayOrderQuestions,\n getSurveyResponseKey,\n getSurveySeen,\n hasWaitPeriodPassed,\n sendSurveyEvent,\n style,\n SURVEY_DEFAULT_Z_INDEX,\n SurveyContext,\n} from './surveys/surveys-utils'\nimport { prepareStylesheet } from './utils/stylesheet-loader'\nconst logger = createLogger('[Surveys]')\n\n// We cast the types here which is dangerous but protected by the top level generateSurveys call\nconst window = _window as Window & typeof globalThis\nconst document = _document as Document\n\nfunction getPosthogWidgetClass(surveyId: string) {\n return `.PostHogWidget${surveyId}`\n}\n\nfunction getRatingBucketForResponseValue(responseValue: number, scale: number) {\n if (scale === 3) {\n if (responseValue < 1 || responseValue > 3) {\n throw new Error('The response must be in range 1-3')\n }\n\n return responseValue === 1 ? 'negative' : responseValue === 2 ? 'neutral' : 'positive'\n } else if (scale === 5) {\n if (responseValue < 1 || responseValue > 5) {\n throw new Error('The response must be in range 1-5')\n }\n\n return responseValue <= 2 ? 'negative' : responseValue === 3 ? 'neutral' : 'positive'\n } else if (scale === 7) {\n if (responseValue < 1 || responseValue > 7) {\n throw new Error('The response must be in range 1-7')\n }\n\n return responseValue <= 3 ? 'negative' : responseValue === 4 ? 'neutral' : 'positive'\n } else if (scale === 10) {\n if (responseValue < 0 || responseValue > 10) {\n throw new Error('The response must be in range 0-10')\n }\n\n return responseValue <= 6 ? 'detractors' : responseValue <= 8 ? 'passives' : 'promoters'\n }\n\n throw new Error('The scale must be one of: 3, 5, 7, 10')\n}\n\nexport function getNextSurveyStep(\n survey: Survey,\n currentQuestionIndex: number,\n response: string | string[] | number | null\n) {\n const question = survey.questions[currentQuestionIndex]\n const nextQuestionIndex = currentQuestionIndex + 1\n\n if (!question.branching?.type) {\n if (currentQuestionIndex === survey.questions.length - 1) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n\n if (question.branching.type === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n } else if (question.branching.type === SurveyQuestionBranchingType.SpecificQuestion) {\n if (Number.isInteger(question.branching.index)) {\n return question.branching.index\n }\n } else if (question.branching.type === SurveyQuestionBranchingType.ResponseBased) {\n // Single choice\n if (question.type === SurveyQuestionType.SingleChoice) {\n // :KLUDGE: for now, look up the choiceIndex based on the response\n // TODO: once QuestionTypes.MultipleChoiceQuestion is refactored, pass the selected choiceIndex into this method\n const selectedChoiceIndex = question.choices.indexOf(`${response}`)\n\n if (question.branching?.responseValues?.hasOwnProperty(selectedChoiceIndex)) {\n const nextStep = question.branching.responseValues[selectedChoiceIndex]\n\n // Specific question\n if (Number.isInteger(nextStep)) {\n return nextStep\n }\n\n if (nextStep === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n } else if (question.type === SurveyQuestionType.Rating) {\n if (typeof response !== 'number' || !Number.isInteger(response)) {\n throw new Error('The response type must be an integer')\n }\n\n const ratingBucket = getRatingBucketForResponseValue(response, question.scale)\n\n if (question.branching?.responseValues?.hasOwnProperty(ratingBucket)) {\n const nextStep = question.branching.responseValues[ratingBucket]\n\n // Specific question\n if (Number.isInteger(nextStep)) {\n return nextStep\n }\n\n if (nextStep === SurveyQuestionBranchingType.End) {\n return SurveyQuestionBranchingType.End\n }\n\n return nextQuestionIndex\n }\n }\n\n return nextQuestionIndex\n }\n\n logger.warn('Falling back to next question index due to unexpected branching type')\n return nextQuestionIndex\n}\n\nexport class SurveyManager {\n private posthog: PostHog\n private surveyInFocus: string | null\n private surveyTimeouts: Map<string, NodeJS.Timeout> = new Map()\n\n constructor(posthog: PostHog) {\n this.posthog = posthog\n // This is used to track the survey that is currently in focus. We only show one survey at a time.\n this.surveyInFocus = null\n }\n\n private canShowNextEventBasedSurvey = (): boolean => {\n // with event based surveys, we need to show the next survey without reloading the page.\n // A simple check for div elements with the class name pattern of PostHogSurvey_xyz doesn't work here\n // because preact leaves behind the div element for any surveys responded/dismissed with a <style> node.\n // To alleviate this, we check the last div in the dom and see if it has any elements other than a Style node.\n // if the last PostHogSurvey_xyz div has only one style node, we can show the next survey in the queue\n // without reloading the page.\n const surveyPopups = document.querySelectorAll(`div[class^=PostHogSurvey]`)\n if (surveyPopups.length > 0) {\n return surveyPopups[surveyPopups.length - 1].shadowRoot?.childElementCount === 1\n }\n return true\n }\n\n private clearSurveyTimeout(surveyId: string) {\n const timeout = this.surveyTimeouts.get(surveyId)\n if (timeout) {\n clearTimeout(timeout)\n this.surveyTimeouts.delete(surveyId)\n }\n }\n\n private handlePopoverSurvey = (survey: Survey): void => {\n const surveyWaitPeriodInDays = survey.conditions?.seenSurveyWaitPeriodInDays\n const lastSeenSurveyDate = localStorage.getItem(`lastSeenSurveyDate`)\n\n if (!hasWaitPeriodPassed(lastSeenSurveyDate, surveyWaitPeriodInDays)) {\n return\n }\n\n const surveySeen = getSurveySeen(survey)\n if (!surveySeen) {\n this.clearSurveyTimeout(survey.id)\n this.addSurveyToFocus(survey.id)\n const delaySeconds = survey.appearance?.surveyPopupDelaySeconds || 0\n const shadow = createShadow(style(survey?.appearance), survey.id, undefined, this.posthog)\n if (delaySeconds <= 0) {\n return Preact.render(\n <SurveyPopup\n key={'popover-survey'}\n posthog={this.posthog}\n survey={survey}\n removeSurveyFromFocus={this.removeSurveyFromFocus}\n isPopup={true}\n />,\n shadow\n )\n }\n const timeoutId = setTimeout(() => {\n if (!doesSurveyUrlMatch(survey)) {\n return this.removeSurveyFromFocus(survey.id)\n }\n // rendering with surveyPopupDelaySeconds = 0 because we're already handling the timeout here\n Preact.render(\n <SurveyPopup\n key={'popover-survey'}\n posthog={this.posthog}\n survey={{ ...survey, appearance: { ...survey.appearance, surveyPopupDelaySeconds: 0 } }}\n removeSurveyFromFocus={this.removeSurveyFromFocus}\n isPopup={true}\n />,\n shadow\n )\n }, delaySeconds * 1000)\n this.surveyTimeouts.set(survey.id, timeoutId)\n }\n }\n\n private handleWidget = (survey: Survey): void => {\n const shadow = createWidgetShadow(survey, this.posthog)\n\n const stylesheetContent = style(survey.appearance)\n const stylesheet = prepareStylesheet(document, stylesheetContent, this.posthog)\n\n if (stylesheet) {\n shadow.appendChild(stylesheet)\n }\n\n Preact.render(\n <FeedbackWidget\n key={'feedback-survey'}\n posthog={this.posthog}\n survey={survey}\n removeSurveyFromFocus={this.removeSurveyFromFocus}\n />,\n shadow\n )\n }\n\n private handleWidgetSelector = (survey: Survey): void => {\n const selectorOnPage =\n survey.appearance?.widgetSelector && document.querySelector(survey.appearance.widgetSelector)\n if (selectorOnPage) {\n if (document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 0) {\n this.handleWidget(survey)\n } else if (document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 1) {\n // we have to check if user selector already has a survey listener attached to it because we always have to check if it's on the page or not\n if (!selectorOnPage.getAttribute('PHWidgetSurveyClickListener')) {\n const surveyPopup = document\n .querySelector(getPosthogWidgetClass(survey.id))\n ?.shadowRoot?.querySelector(`.survey-form`) as HTMLFormElement\n\n addEventListener(selectorOnPage, 'click', () => {\n if (surveyPopup) {\n surveyPopup.style.display = surveyPopup.style.display === 'none' ? 'block' : 'none'\n addEventListener(surveyPopup, 'PHSurveyClosed', () => {\n this.removeSurveyFromFocus(survey.id)\n surveyPopup.style.display = 'none'\n })\n }\n })\n\n selectorOnPage.setAttribute('PHWidgetSurveyClickListener', 'true')\n }\n }\n }\n }\n\n /**\n * Sorts surveys by their appearance delay in ascending order. If a survey does not have an appearance delay,\n * it is considered to have a delay of 0.\n * @param surveys\n * @returns The surveys sorted by their appearance delay\n */\n private sortSurveysByAppearanceDelay(surveys: Survey[]): Survey[] {\n return surveys.sort(\n (a, b) => (a.appearance?.surveyPopupDelaySeconds || 0) - (b.appearance?.surveyPopupDelaySeconds || 0)\n )\n }\n\n /**\n * Checks the feature flags associated with this Survey to see if the survey can be rendered.\n * @param survey\n * @param instance\n */\n public canRenderSurvey = (survey: Survey): SurveyRenderReason => {\n const renderReason: SurveyRenderReason = {\n visible: false,\n }\n\n if (survey.end_date) {\n renderReason.disabledReason = `survey was completed on ${survey.end_date}`\n return renderReason\n }\n\n if (survey.type != SurveyType.Popover) {\n renderReason.disabledReason = `Only Popover survey types can be rendered`\n return renderReason\n }\n\n const linkedFlagCheck = survey.linked_flag_key\n ? this.posthog.featureFlags.isFeatureEnabled(survey.linked_flag_key)\n : true\n\n if (!linkedFlagCheck) {\n renderReason.disabledReason = `linked feature flag ${survey.linked_flag_key} is false`\n return renderReason\n }\n\n const targetingFlagCheck = survey.targeting_flag_key\n ? this.posthog.featureFlags.isFeatureEnabled(survey.targeting_flag_key)\n : true\n\n if (!targetingFlagCheck) {\n renderReason.disabledReason = `targeting feature flag ${survey.targeting_flag_key} is false`\n return renderReason\n }\n\n const internalTargetingFlagCheck = survey.internal_targeting_flag_key\n ? this.posthog.featureFlags.isFeatureEnabled(survey.internal_targeting_flag_key)\n : true\n\n if (!internalTargetingFlagCheck) {\n renderReason.disabledReason = `internal targeting feature flag ${survey.internal_targeting_flag_key} is false`\n return renderReason\n }\n\n renderReason.visible = true\n return renderReason\n }\n\n public renderSurvey = (survey: Survey, selector: Element): void => {\n Preact.render(\n <SurveyPopup\n key={'popover-survey'}\n posthog={this.posthog}\n survey={survey}\n removeSurveyFromFocus={this.removeSurveyFromFocus}\n isPopup={false}\n />,\n selector\n )\n }\n\n public callSurveysAndEvaluateDisplayLogic = (forceReload: boolean = false): void => {\n this.posthog?.getActiveMatchingSurveys((surveys) => {\n const nonAPISurveys = surveys.filter((survey) => survey.type !== 'api')\n\n // Create a queue of surveys sorted by their appearance delay. We will evaluate the display logic\n // for each survey in the queue in order, and only display one survey at a time.\n const nonAPISurveyQueue = this.sortSurveysByAppearanceDelay(nonAPISurveys)\n\n nonAPISurveyQueue.forEach((survey) => {\n // We only evaluate the display logic for one survey at a time\n if (!isNull(this.surveyInFocus)) {\n return\n }\n if (survey.type === SurveyType.Widget) {\n if (\n survey.appearance?.widgetType === 'tab' &&\n document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 0\n ) {\n this.handleWidget(survey)\n }\n if (survey.appearance?.widgetType === 'selector' && survey.appearance?.widgetSelector) {\n this.handleWidgetSelector(survey)\n }\n }\n\n if (survey.type === SurveyType.Popover && this.canShowNextEventBasedSurvey()) {\n this.handlePopoverSurvey(survey)\n }\n })\n }, forceReload)\n }\n\n private addSurveyToFocus = (id: string): void => {\n if (!isNull(this.surveyInFocus)) {\n logger.error(`Survey ${[...this.surveyInFocus]} already in focus. Cannot add survey ${id}.`)\n }\n this.surveyInFocus = id\n }\n\n private removeSurveyFromFocus = (id: string): void => {\n if (this.surveyInFocus !== id) {\n logger.error(`Survey ${id} is not in focus. Cannot remove survey ${id}.`)\n }\n this.clearSurveyTimeout(id)\n this.surveyInFocus = null\n }\n\n // Expose internal state and methods for testing\n public getTestAPI() {\n return {\n addSurveyToFocus: this.addSurveyToFocus,\n removeSurveyFromFocus: this.removeSurveyFromFocus,\n surveyInFocus: this.surveyInFocus,\n surveyTimeouts: this.surveyTimeouts,\n canShowNextEventBasedSurvey: this.canShowNextEventBasedSurvey,\n handleWidget: this.handleWidget,\n handlePopoverSurvey: this.handlePopoverSurvey,\n handleWidgetSelector: this.handleWidgetSelector,\n sortSurveysByAppearanceDelay: this.sortSurveysByAppearanceDelay,\n }\n }\n}\n\nexport const renderSurveysPreview = ({\n survey,\n parentElement,\n previewPageIndex,\n forceDisableHtml,\n onPreviewSubmit,\n posthog,\n}: {\n survey: Survey\n parentElement: HTMLElement\n previewPageIndex: number\n forceDisableHtml?: boolean\n onPreviewSubmit?: (res: string | string[] | number | null) => void\n posthog?: PostHog\n}) => {\n const stylesheetContent = style(survey.appearance)\n const stylesheet = prepareStylesheet(document, stylesheetContent, posthog)\n\n // Remove previously attached <style>\n Array.from(parentElement.children).forEach((child) => {\n if (child instanceof HTMLStyleElement) {\n parentElement.removeChild(child)\n }\n })\n\n if (stylesheet) {\n parentElement.appendChild(stylesheet)\n }\n\n const textColor = getContrastingTextColor(\n survey.appearance?.backgroundColor || defaultSurveyAppearance.backgroundColor || 'white'\n )\n\n Preact.render(\n <SurveyPopup\n key=\"surveys-render-preview\"\n survey={survey}\n forceDisableHtml={forceDisableHtml}\n style={{\n position: 'relative',\n right: 0,\n borderBottom: `1px solid ${survey.appearance?.borderColor}`,\n borderRadius: 10,\n color: textColor,\n }}\n onPreviewSubmit={onPreviewSubmit}\n previewPageIndex={previewPageIndex}\n removeSurveyFromFocus={() => {}}\n isPopup={true}\n />,\n parentElement\n )\n}\n\nexport const renderFeedbackWidgetPreview = ({\n survey,\n root,\n forceDisableHtml,\n posthog,\n}: {\n survey: Survey\n root: HTMLElement\n forceDisableHtml?: boolean\n posthog?: PostHog\n}) => {\n const stylesheetContent = createWidgetStyle(survey.appearance?.widgetColor)\n const stylesheet = prepareStylesheet(document, stylesheetContent, posthog)\n if (stylesheet) {\n root.appendChild(stylesheet)\n }\n\n Preact.render(\n <FeedbackWidget\n key={'feedback-render-preview'}\n forceDisableHtml={forceDisableHtml}\n survey={survey}\n readOnly={true}\n removeSurveyFromFocus={() => {}}\n />,\n root\n )\n}\n\n// This is the main exported function\nexport function generateSurveys(posthog: PostHog) {\n // NOTE: Important to ensure we never try and run surveys without a window environment\n if (!document || !window) {\n return\n }\n\n const surveyManager = new SurveyManager(posthog)\n surveyManager.callSurveysAndEvaluateDisplayLogic(true)\n\n // recalculate surveys every second to check if URL or selectors have changed\n setInterval(() => {\n surveyManager.callSurveysAndEvaluateDisplayLogic(false)\n }, 1000)\n return surveyManager\n}\n\ntype UseHideSurveyOnURLChangeProps = {\n survey: Pick<Survey, 'id' | 'conditions'>\n removeSurveyFromFocus: (id: string) => void\n setSurveyVisible: (visible: boolean) => void\n isPreviewMode?: boolean\n}\n\n/**\n * This hook handles URL-based survey visibility after the initial mount.\n * The initial URL check is handled by the `getActiveMatchingSurveys` method in the `PostHogSurveys` class,\n * which ensures the URL matches before displaying a survey for the first time.\n * That is the method that is called every second to see if there's a matching survey.\n *\n * This separation of concerns means:\n * 1. Initial URL matching is done by `getActiveMatchingSurveys` before displaying the survey\n * 2. Subsequent URL changes are handled here to hide the survey as the user navigates\n */\nexport function useHideSurveyOnURLChange({\n survey,\n removeSurveyFromFocus,\n setSurveyVisible,\n isPreviewMode = false,\n}: UseHideSurveyOnURLChangeProps) {\n useEffect(() => {\n if (isPreviewMode || !survey.conditions?.url) {\n return\n }\n\n const checkUrlMatch = () => {\n const urlCheck = doesSurveyUrlMatch(survey)\n if (!urlCheck) {\n setSurveyVisible(false)\n return removeSurveyFromFocus(survey.id)\n }\n }\n\n // Listen for browser back/forward browser history changes\n addEventListener(window, 'popstate', checkUrlMatch)\n // Listen for hash changes, for SPA frameworks that use hash-based routing\n // The hashchange event is fired when the fragment identifier of the URL has changed (the part of the URL beginning with and following the # symbol).\n addEventListener(window, 'hashchange', checkUrlMatch)\n\n // Listen for SPA navigation\n const originalPushState = window.history.pushState\n const originalReplaceState = window.history.replaceState\n\n window.history.pushState = function (...args) {\n originalPushState.apply(this, args)\n checkUrlMatch()\n }\n\n window.history.replaceState = function (...args) {\n originalReplaceState.apply(this, args)\n checkUrlMatch()\n }\n\n return () => {\n window.removeEventListener('popstate', checkUrlMatch)\n window.removeEventListener('hashchange', checkUrlMatch)\n window.history.pushState = originalPushState\n window.history.replaceState = originalReplaceState\n }\n }, [isPreviewMode, survey, removeSurveyFromFocus, setSurveyVisible])\n}\n\nexport function usePopupVisibility(\n survey: Survey,\n posthog: PostHog | undefined,\n millisecondDelay: number,\n isPreviewMode: boolean,\n removeSurveyFromFocus: (id: string) => void\n) {\n const [isPopupVisible, setIsPopupVisible] = useState(isPreviewMode || millisecondDelay === 0)\n const [isSurveySent, setIsSurveySent] = useState(false)\n\n useEffect(() => {\n if (!posthog) {\n logger.error('usePopupVisibility hook called without a PostHog instance.')\n return\n }\n if (isPreviewMode) {\n return\n }\n\n const handleSurveyClosed = () => {\n removeSurveyFromFocus(survey.id)\n setIsPopupVisible(false)\n }\n\n const handleSurveySent = () => {\n if (!survey.appearance?.displayThankYouMessage) {\n removeSurveyFromFocus(survey.id)\n setIsPopupVisible(false)\n } else {\n setIsSurveySent(true)\n removeSurveyFromFocus(survey.id)\n if (survey.appearance?.autoDisappear) {\n setTimeout(() => {\n setIsPopupVisible(false)\n }, 5000)\n }\n }\n }\n\n const showSurvey = () => {\n // check if the url is still matching, necessary for delayed surveys, as the URL may have changed\n if (!doesSurveyUrlMatch(survey)) {\n return\n }\n\n setIsPopupVisible(true)\n window.dispatchEvent(new Event('PHSurveyShown'))\n posthog.capture('survey shown', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n $survey_iteration: survey.current_iteration,\n $survey_iteration_start_date: survey.current_iteration_start_date,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n })\n localStorage.setItem('lastSeenSurveyDate', new Date().toISOString())\n setTimeout(() => {\n const inputField = document\n .querySelector(getPosthogWidgetClass(survey.id))\n ?.shadowRoot?.querySelector('textarea, input[type=\"text\"]') as HTMLElement\n if (inputField) {\n inputField.focus()\n }\n }, 100)\n }\n\n addEventListener(window, 'PHSurveyClosed', handleSurveyClosed)\n addEventListener(window, 'PHSurveySent', handleSurveySent)\n\n if (millisecondDelay > 0) {\n // This path is only used for direct usage of SurveyPopup,\n // not for surveys managed by SurveyManager\n const timeoutId = setTimeout(showSurvey, millisecondDelay)\n return () => {\n clearTimeout(timeoutId)\n window.removeEventListener('PHSurveyClosed', handleSurveyClosed)\n window.removeEventListener('PHSurveySent', handleSurveySent)\n }\n } else {\n // This is the path used for surveys managed by SurveyManager\n showSurvey()\n return () => {\n window.removeEventListener('PHSurveyClosed', handleSurveyClosed)\n window.removeEventListener('PHSurveySent', handleSurveySent)\n }\n }\n }, [])\n\n useHideSurveyOnURLChange({\n survey,\n removeSurveyFromFocus,\n setSurveyVisible: setIsPopupVisible,\n isPreviewMode,\n })\n\n return { isPopupVisible, isSurveySent, setIsPopupVisible }\n}\n\ninterface SurveyPopupProps {\n survey: Survey\n forceDisableHtml?: boolean\n posthog?: PostHog\n style?: React.CSSProperties\n previewPageIndex?: number | undefined\n removeSurveyFromFocus: (id: string) => void\n isPopup?: boolean\n onPreviewSubmit?: (res: string | string[] | number | null) => void\n onPopupSurveyDismissed?: () => void\n onPopupSurveySent?: () => void\n}\n\nexport function SurveyPopup({\n survey,\n forceDisableHtml,\n posthog,\n style,\n previewPageIndex,\n removeSurveyFromFocus,\n isPopup,\n onPreviewSubmit = () => {},\n onPopupSurveyDismissed = () => {},\n onPopupSurveySent = () => {},\n}: SurveyPopupProps) {\n const isPreviewMode = Number.isInteger(previewPageIndex)\n // NB: The client-side code passes the millisecondDelay in seconds, but setTimeout expects milliseconds, so we multiply by 1000\n const surveyPopupDelayMilliseconds = survey.appearance?.surveyPopupDelaySeconds\n ? survey.appearance.surveyPopupDelaySeconds * 1000\n : 0\n const { isPopupVisible, isSurveySent, setIsPopupVisible } = usePopupVisibility(\n survey,\n posthog,\n surveyPopupDelayMilliseconds,\n isPreviewMode,\n removeSurveyFromFocus\n )\n const shouldShowConfirmation = isSurveySent || previewPageIndex === survey.questions.length\n const confirmationBoxLeftStyle = style?.left && isNumber(style?.left) ? { left: style.left - 40 } : {}\n\n if (isPreviewMode) {\n style = style || {}\n style.left = 'unset'\n style.right = 'unset'\n style.transform = 'unset'\n }\n\n return isPopupVisible ? (\n <SurveyContext.Provider\n value={{\n isPreviewMode,\n previewPageIndex: previewPageIndex,\n onPopupSurveyDismissed: () => {\n dismissedSurveyEvent(survey, posthog, isPreviewMode)\n onPopupSurveyDismissed()\n },\n isPopup: isPopup || false,\n onPreviewSubmit,\n onPopupSurveySent: () => {\n onPopupSurveySent()\n },\n }}\n >\n {!shouldShowConfirmation ? (\n <Questions\n survey={survey}\n forceDisableHtml={!!forceDisableHtml}\n posthog={posthog}\n styleOverrides={style}\n />\n ) : (\n <ConfirmationMessage\n header={survey.appearance?.thankYouMessageHeader || 'Thank you!'}\n description={survey.appearance?.thankYouMessageDescription || ''}\n forceDisableHtml={!!forceDisableHtml}\n contentType={survey.appearance?.thankYouMessageDescriptionContentType}\n appearance={survey.appearance || defaultSurveyAppearance}\n styleOverrides={{ ...style, ...confirmationBoxLeftStyle }}\n onClose={() => setIsPopupVisible(false)}\n />\n )}\n </SurveyContext.Provider>\n ) : null\n}\n\nexport function Questions({\n survey,\n forceDisableHtml,\n posthog,\n styleOverrides,\n}: {\n survey: Survey\n forceDisableHtml: boolean\n posthog?: PostHog\n styleOverrides?: React.CSSProperties\n}) {\n const textColor = getContrastingTextColor(\n survey.appearance?.backgroundColor || defaultSurveyAppearance.backgroundColor\n )\n const [questionsResponses, setQuestionsResponses] = useState({})\n const { previewPageIndex, onPopupSurveyDismissed, isPopup, onPreviewSubmit, onPopupSurveySent } =\n useContext(SurveyContext)\n const [currentQuestionIndex, setCurrentQuestionIndex] = useState(previewPageIndex || 0)\n const surveyQuestions = useMemo(() => getDisplayOrderQuestions(survey), [survey])\n\n // Sync preview state\n useEffect(() => {\n setCurrentQuestionIndex(previewPageIndex ?? 0)\n }, [previewPageIndex])\n\n const onNextButtonClick = ({\n res,\n displayQuestionIndex,\n questionId,\n }: {\n res: string | string[] | number | null\n displayQuestionIndex: number\n questionId?: string\n }) => {\n if (!posthog) {\n logger.error('onNextButtonClick called without a PostHog instance.')\n return\n }\n\n if (!questionId) {\n logger.error('onNextButtonClick called without a questionId.')\n return\n }\n\n const responseKey = getSurveyResponseKey(questionId)\n\n setQuestionsResponses({ ...questionsResponses, [responseKey]: res })\n\n const nextStep = getNextSurveyStep(survey, displayQuestionIndex, res)\n if (nextStep === SurveyQuestionBranchingType.End) {\n sendSurveyEvent({ ...questionsResponses, [responseKey]: res }, survey, posthog)\n onPopupSurveySent()\n } else {\n setCurrentQuestionIndex(nextStep)\n }\n }\n\n return (\n <form\n className=\"survey-form\"\n style={\n isPopup\n ? {\n color: textColor,\n borderColor: survey.appearance?.borderColor,\n ...styleOverrides,\n }\n : {}\n }\n >\n {surveyQuestions.map((question, displayQuestionIndex) => {\n const isVisible = currentQuestionIndex === displayQuestionIndex\n return (\n isVisible && (\n <div\n className=\"survey-box\"\n style={\n isPopup\n ? {\n backgroundColor:\n survey.appearance?.backgroundColor ||\n defaultSurveyAppearance.backgroundColor,\n }\n : {}\n }\n >\n {isPopup && (\n <Cancel\n onClick={() => {\n onPopupSurveyDismissed()\n }}\n />\n )}\n {getQuestionComponent({\n question,\n forceDisableHtml,\n displayQuestionIndex,\n appearance: survey.appearance || defaultSurveyAppearance,\n onSubmit: (res) =>\n onNextButtonClick({\n res,\n displayQuestionIndex,\n questionId: question.id,\n }),\n onPreviewSubmit,\n })}\n </div>\n )\n )\n })}\n </form>\n )\n}\n\nexport function FeedbackWidget({\n survey,\n forceDisableHtml,\n posthog,\n readOnly,\n removeSurveyFromFocus,\n}: {\n survey: Survey\n forceDisableHtml?: boolean\n posthog?: PostHog\n readOnly?: boolean\n removeSurveyFromFocus: (id: string) => void\n}): JSX.Element | null {\n const [isFeedbackButtonVisible, setIsFeedbackButtonVisible] = useState(true)\n const [showSurvey, setShowSurvey] = useState(false)\n const [styleOverrides, setStyle] = useState({})\n const widgetRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!posthog) {\n logger.error('FeedbackWidget called without a PostHog instance.')\n return\n }\n if (readOnly) {\n return\n }\n\n if (survey.appearance?.widgetType === 'tab') {\n if (widgetRef.current) {\n const widgetPos = widgetRef.current.getBoundingClientRect()\n const style = {\n top: '50%',\n left: parseInt(`${widgetPos.right - 360}`),\n bottom: 'auto',\n borderRadius: 10,\n borderBottom: `1.5px solid ${survey.appearance?.borderColor || '#c9c6c6'}`,\n }\n setStyle(style)\n }\n }\n if (survey.appearance?.widgetType === 'selector') {\n const widget = document.querySelector(survey.appearance.widgetSelector || '') ?? undefined\n\n addEventListener(widget, 'click', (event) => {\n // Calculate position based on the selector button\n const buttonRect = (event.currentTarget as HTMLElement).getBoundingClientRect()\n const viewportHeight = window.innerHeight\n\n // Get survey width from maxWidth or default to 300px\n const surveyWidth = parseInt(survey.appearance?.maxWidth || '300')\n\n // Calculate horizontal center position of the button\n const buttonCenterX = buttonRect.left + buttonRect.width / 2\n\n // Calculate horizontal center position\n let left = buttonCenterX - surveyWidth / 2\n\n // Ensure the survey doesn't go off-screen horizontally\n const rightEdge = left + surveyWidth\n if (rightEdge > window.innerWidth) {\n left = window.innerWidth - surveyWidth - 20 // 20px padding from right edge\n }\n if (left < 20) {\n left = 20 // 20px padding from left edge\n }\n\n // Determine if we should show above or below\n let showAbove = false\n\n // Check if there's enough space below (need at least 300px)\n // If not enough space below, show above\n if (buttonRect.bottom + 300 > viewportHeight) {\n showAbove = true\n }\n\n // Simple spacing between button and survey\n const spacing = 12\n\n // Calculate positions\n let topPosition\n\n if (showAbove) {\n // Problem: When showing above, we're trying to position based on an estimated height,\n // but we don't know the actual height of the survey yet.\n // Solution: Instead of using top positioning for above, use bottom positioning\n // This will anchor the survey to the bottom edge at the button's top position\n topPosition = null // We'll use bottom positioning instead\n } else {\n // When showing below, position the top of the survey below the button plus spacing\n topPosition = buttonRect.bottom + window.scrollY + spacing\n }\n\n // Set style overrides for positioning\n setStyle({\n position: 'fixed',\n top: showAbove ? 'auto' : topPosition + 'px',\n left: left + 'px',\n right: 'auto',\n bottom: showAbove ? window.innerHeight - buttonRect.top + spacing + 'px' : 'auto',\n transform: 'none',\n border: `1.5px solid ${survey.appearance?.borderColor || '#c9c6c6'}`,\n borderRadius: '10px',\n width: `${surveyWidth}px`,\n zIndex: SURVEY_DEFAULT_Z_INDEX,\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n maxHeight: showAbove\n ? `calc(100vh - 40px - ${spacing * 2}px)`\n : `calc(100vh - ${topPosition}px - 20px)`,\n })\n\n setShowSurvey(!showSurvey)\n })\n\n widget?.setAttribute('PHWidgetSurveyClickListener', 'true')\n }\n }, [])\n\n useHideSurveyOnURLChange({\n survey,\n removeSurveyFromFocus,\n setSurveyVisible: setIsFeedbackButtonVisible,\n })\n\n if (!isFeedbackButtonVisible) {\n return null\n }\n\n const resetShowSurvey = () => {\n setShowSurvey(false)\n }\n\n return (\n <Preact.Fragment>\n {survey.appearance?.widgetType === 'tab' && (\n <div\n className=\"ph-survey-widget-tab\"\n ref={widgetRef}\n onClick={() => !readOnly && setShowSurvey(!showSurvey)}\n style={{ color: getContrastingTextColor(survey.appearance.widgetColor) }}\n >\n <div className=\"ph-survey-widget-tab-icon\"></div>\n {survey.appearance?.widgetLabel || ''}\n </div>\n )}\n {showSurvey && (\n <SurveyPopup\n key={'feedback-widget-survey'}\n posthog={posthog}\n survey={survey}\n forceDisableHtml={forceDisableHtml}\n style={styleOverrides}\n removeSurveyFromFocus={removeSurveyFromFocus}\n isPopup={true}\n onPopupSurveyDismissed={resetShowSurvey}\n onPopupSurveySent={resetShowSurvey}\n />\n )}\n </Preact.Fragment>\n )\n}\n\ninterface GetQuestionComponentProps {\n question: SurveyQuestion\n forceDisableHtml: boolean\n displayQuestionIndex: number\n appearance: SurveyAppearance\n onSubmit: (res: string | string[] | number | null) => void\n onPreviewSubmit: (res: string | string[] | number | null) => void\n}\n\nconst getQuestionComponent = ({\n question,\n forceDisableHtml,\n displayQuestionIndex,\n appearance,\n onSubmit,\n onPreviewSubmit,\n}: GetQuestionComponentProps): JSX.Element => {\n const questionComponents = {\n [SurveyQuestionType.Open]: OpenTextQuestion,\n [SurveyQuestionType.Link]: LinkQuestion,\n [SurveyQuestionType.Rating]: RatingQuestion,\n [SurveyQuestionType.SingleChoice]: MultipleChoiceQuestion,\n [SurveyQuestionType.MultipleChoice]: MultipleChoiceQuestion,\n }\n\n const commonProps = {\n question,\n forceDisableHtml,\n appearance,\n onPreviewSubmit: (res: string | string[] | number | null) => {\n onPreviewSubmit(res)\n },\n onSubmit: (res: string | string[] | number | null) => {\n onSubmit(res)\n },\n }\n\n const additionalProps: Record<SurveyQuestionType, any> = {\n [SurveyQuestionType.Open]: {},\n [SurveyQuestionType.Link]: {},\n [SurveyQuestionType.Rating]: { displayQuestionIndex },\n [SurveyQuestionType.SingleChoice]: { displayQuestionIndex },\n [SurveyQuestionType.MultipleChoice]: { displayQuestionIndex },\n }\n\n const Component = questionComponents[question.type]\n const componentProps = { ...commonProps, ...additionalProps[question.type] }\n\n return <Component {...componentProps} />\n}\n"]}

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sadiuysal/mem0-mcp-server-ts'

If you have feedback or need assistance with the MCP directory API, please join our Discord server