posthog-js 1.310.0 → 1.310.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +7 -2
- package/dist/module.full.d.ts +7 -2
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +7 -2
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +7 -2
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/product-tours-preview.d.ts +63 -0
- package/dist/product-tours-preview.js +2 -0
- package/dist/product-tours-preview.js.map +1 -0
- package/dist/product-tours.js +1 -1
- package/dist/product-tours.js.map +1 -1
- package/dist/src/entrypoints/product-tours-preview.es.d.ts +1 -0
- package/dist/src/extensions/product-tours/components/ProductTourSurveyStepInner.d.ts +12 -0
- package/dist/src/extensions/product-tours/components/ProductTourTooltip.d.ts +2 -1
- package/dist/src/extensions/product-tours/components/ProductTourTooltipInner.d.ts +12 -0
- package/dist/src/extensions/product-tours/preview.d.ts +11 -0
- package/dist/src/extensions/product-tours/product-tours-utils.d.ts +1 -2
- package/dist/src/extensions/surveys/surveys-extension-utils.d.ts +3 -0
- package/dist/src/posthog-product-tours-types.d.ts +6 -1
- package/dist/surveys-preview.d.ts +6 -1
- package/dist/surveys-preview.js +1 -1
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.js +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/entrypoints/product-tours-preview.es.d.ts +1 -0
- package/lib/src/entrypoints/product-tours-preview.es.js +6 -0
- package/lib/src/entrypoints/product-tours-preview.es.js.map +1 -0
- package/lib/src/extensions/product-tours/components/ProductTourSurveyStepInner.d.ts +12 -0
- package/lib/src/extensions/product-tours/components/{ProductTourSurveyStep.js → ProductTourSurveyStepInner.js} +26 -34
- package/lib/src/extensions/product-tours/components/ProductTourSurveyStepInner.js.map +1 -0
- package/lib/src/extensions/product-tours/components/ProductTourTooltip.d.ts +2 -1
- package/lib/src/extensions/product-tours/components/ProductTourTooltip.js +71 -99
- package/lib/src/extensions/product-tours/components/ProductTourTooltip.js.map +1 -1
- package/lib/src/extensions/product-tours/components/ProductTourTooltipInner.d.ts +12 -0
- package/lib/src/extensions/product-tours/components/ProductTourTooltipInner.js +18 -0
- package/lib/src/extensions/product-tours/components/ProductTourTooltipInner.js.map +1 -0
- package/lib/src/extensions/product-tours/preview.d.ts +11 -0
- package/lib/src/extensions/product-tours/preview.js +39 -0
- package/lib/src/extensions/product-tours/preview.js.map +1 -0
- package/lib/src/extensions/product-tours/product-tours-utils.d.ts +1 -2
- package/lib/src/extensions/product-tours/product-tours-utils.js +24 -16
- package/lib/src/extensions/product-tours/product-tours-utils.js.map +1 -1
- package/lib/src/extensions/product-tours/product-tours.js +19 -11
- package/lib/src/extensions/product-tours/product-tours.js.map +1 -1
- package/lib/src/extensions/surveys/surveys-extension-utils.d.ts +3 -0
- package/lib/src/extensions/surveys/surveys-extension-utils.js +20 -2
- package/lib/src/extensions/surveys/surveys-extension-utils.js.map +1 -1
- package/lib/src/posthog-product-tours-types.d.ts +6 -1
- package/lib/src/posthog-product-tours-types.js +4 -1
- package/lib/src/posthog-product-tours-types.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/extensions/product-tours/components/ProductTourSurveyStep.d.ts +0 -12
- package/lib/src/extensions/product-tours/components/ProductTourSurveyStep.d.ts +0 -12
- package/lib/src/extensions/product-tours/components/ProductTourSurveyStep.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surveys-extension-utils.js","sourceRoot":"","sources":["../../../../src/extensions/surveys/surveys-extension-utils.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,sCAQC;AAED,oDAEC;AAmSD,kDAIC;AAmTD,gDAYC;AAED,gEAcC;AAED,0DAKC;AAsDD,0DAGC;AAruBD,iCAAqE;AAErE,qEAWoC;AACpC,+CAAyF;AACzF,yDAOiC;AACjC,sCAAkD;AAElD,sCAAgD;AAChD,6DAAgE;AAEhE,gEAA8D;AAC9D,gGAAgG;AAChG,IAAM,MAAM,GAAG,gBAAqC,CAAA;AACpD,IAAM,QAAQ,GAAG,kBAAqB,CAAA;AACtC,4DAAuC;AACvC,sCAAyC;AAEzC,SAAgB,aAAa,CAAC,UAAmB;IAC7C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,IAAM,gBAAgB,GAClB,2IAA2I,CAAA;IAC/I,OAAO,UAAU,CAAC,CAAC,CAAC,UAAG,UAAU,eAAK,gBAAgB,CAAE,CAAC,CAAC,CAAC,yBAAkB,gBAAgB,CAAE,CAAA;AACnG,CAAC;AAED,SAAgB,oBAAoB,CAAC,UAAkB;IACnD,OAAO,2BAAoB,UAAU,CAAE,CAAA;AAC3C,CAAC;AAED,IAAM,gBAAgB,GAAG,SAAS,CAAA,CAAC,mHAAmH;AAEtJ,4DAA4D;AAC/C,QAAA,uBAAuB,GAAG;IACnC,UAAU,EAAE,SAAS;IACrB,eAAe,EAAE,SAAS;IAC1B,iBAAiB,EAAE,OAAO;IAC1B,qBA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preact'\nimport { PostHog } from '../../posthog-core'\nimport {\n MultipleSurveyQuestion,\n Survey,\n SurveyAppearance,\n SurveyEventName,\n SurveyEventProperties,\n SurveyPosition,\n SurveyQuestion,\n SurveySchedule,\n SurveyType,\n SurveyWidgetType,\n} from '../../posthog-surveys-types'\nimport { document as _document, window as _window, userAgent } from '../../utils/globals'\nimport {\n getSurveyInteractionProperty,\n getSurveySeenKey,\n getSurveyAbandonedKey,\n SURVEY_LOGGER as logger,\n setSurveySeenOnLocalStorage,\n SURVEY_IN_PROGRESS_PREFIX,\n} from '../../utils/survey-utils'\nimport { isArray, isNullish } from '@posthog/core'\n\nimport { detectDeviceType } from '@posthog/core'\nimport { propertyComparisons } from '../../utils/property-utils'\nimport { PropertyMatchType } from '../../types'\nimport { prepareStylesheet } from '../utils/stylesheet-loader'\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\nimport surveyStyles from './survey.css'\nimport { useContext } from 'preact/hooks'\n\nexport function getFontFamily(fontFamily?: string): string {\n if (fontFamily === 'inherit') {\n return 'inherit'\n }\n\n const defaultFontStack =\n 'BlinkMacSystemFont, \"Inter\", \"Segoe UI\", \"Roboto\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"'\n return fontFamily ? `${fontFamily}, ${defaultFontStack}` : `-apple-system, ${defaultFontStack}`\n}\n\nexport function getSurveyResponseKey(questionId: string) {\n return `$survey_response_${questionId}`\n}\n\nconst BLACK_TEXT_COLOR = '#020617' // Maps out to text-slate-950 from tailwind colors. Intended for text use outside interactive elements like buttons\n\n// Keep in sync with defaultSurveyAppearance on the main app\nexport const defaultSurveyAppearance = {\n fontFamily: 'inherit',\n backgroundColor: '#eeeded',\n submitButtonColor: 'black',\n submitButtonTextColor: 'white',\n ratingButtonColor: 'white',\n ratingButtonActiveColor: 'black',\n borderColor: '#c9c6c6',\n placeholder: 'Start typing...',\n whiteLabel: false,\n displayThankYouMessage: true,\n thankYouMessageHeader: 'Thank you for your feedback!',\n position: SurveyPosition.Right,\n widgetType: SurveyWidgetType.Tab,\n widgetLabel: 'Feedback',\n widgetColor: 'black',\n zIndex: '2147483647',\n disabledButtonOpacity: '0.6',\n maxWidth: '300px',\n textSubtleColor: '#939393',\n boxPadding: '20px 24px',\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n borderRadius: '10px',\n shuffleQuestions: false,\n surveyPopupDelaySeconds: undefined,\n // Not customizable atm\n outlineColor: 'rgba(59, 130, 246, 0.8)',\n inputBackground: 'white',\n inputTextColor: BLACK_TEXT_COLOR,\n scrollbarThumbColor: 'var(--ph-survey-border-color)',\n scrollbarTrackColor: 'var(--ph-survey-background-color)',\n} as const\n\nexport const addSurveyCSSVariablesToElement = (\n element: HTMLElement,\n type: SurveyType,\n appearance?: SurveyAppearance | null\n) => {\n const effectiveAppearance = { ...defaultSurveyAppearance, ...appearance }\n const hostStyle = element.style\n\n const surveyHasBottomBorder =\n ![SurveyPosition.Center, SurveyPosition.Left, SurveyPosition.Right].includes(effectiveAppearance.position) ||\n (type === SurveyType.Widget && appearance?.widgetType === SurveyWidgetType.Tab)\n\n hostStyle.setProperty('--ph-survey-font-family', getFontFamily(effectiveAppearance.fontFamily))\n hostStyle.setProperty('--ph-survey-box-padding', effectiveAppearance.boxPadding)\n hostStyle.setProperty('--ph-survey-max-width', effectiveAppearance.maxWidth)\n hostStyle.setProperty('--ph-survey-z-index', effectiveAppearance.zIndex)\n hostStyle.setProperty('--ph-survey-border-color', effectiveAppearance.borderColor)\n // Non-bottom surveys or tab surveys have the border bottom\n if (surveyHasBottomBorder) {\n hostStyle.setProperty('--ph-survey-border-radius', effectiveAppearance.borderRadius)\n hostStyle.setProperty('--ph-survey-border-bottom', '1.5px solid var(--ph-survey-border-color)')\n } else {\n hostStyle.setProperty('--ph-survey-border-bottom', 'none')\n hostStyle.setProperty(\n '--ph-survey-border-radius',\n `${effectiveAppearance.borderRadius} ${effectiveAppearance.borderRadius} 0 0`\n )\n }\n hostStyle.setProperty('--ph-survey-background-color', effectiveAppearance.backgroundColor)\n hostStyle.setProperty('--ph-survey-box-shadow', effectiveAppearance.boxShadow)\n hostStyle.setProperty('--ph-survey-disabled-button-opacity', effectiveAppearance.disabledButtonOpacity)\n hostStyle.setProperty('--ph-survey-submit-button-color', effectiveAppearance.submitButtonColor)\n hostStyle.setProperty(\n '--ph-survey-submit-button-text-color',\n appearance?.submitButtonTextColor || getContrastingTextColor(effectiveAppearance.submitButtonColor)\n )\n hostStyle.setProperty('--ph-survey-rating-bg-color', effectiveAppearance.ratingButtonColor)\n hostStyle.setProperty('--ph-survey-rating-active-bg-color', effectiveAppearance.ratingButtonActiveColor)\n // Active rating text is always auto-calculated for contrast with active background\n hostStyle.setProperty(\n '--ph-survey-rating-active-text-color',\n getContrastingTextColor(effectiveAppearance.ratingButtonActiveColor)\n )\n // Primary text color: use override if provided, otherwise auto-calculate from background\n hostStyle.setProperty(\n '--ph-survey-text-primary-color',\n appearance?.textColor || getContrastingTextColor(effectiveAppearance.backgroundColor)\n )\n hostStyle.setProperty('--ph-survey-text-subtle-color', effectiveAppearance.textSubtleColor)\n hostStyle.setProperty('--ph-widget-color', effectiveAppearance.widgetColor)\n hostStyle.setProperty('--ph-widget-text-color', getContrastingTextColor(effectiveAppearance.widgetColor))\n hostStyle.setProperty('--ph-widget-z-index', effectiveAppearance.zIndex)\n\n // Use user-provided inputBackground (or deprecated inputBackgroundColor for backwards compat)\n // Fallback to internal default, with slight adjustment for white backgrounds\n const userInputBg = appearance?.inputBackground || appearance?.inputBackgroundColor\n let inputBgColor = userInputBg || effectiveAppearance.inputBackground\n if (!userInputBg && effectiveAppearance.backgroundColor === 'white') {\n inputBgColor = '#f8f8f8'\n }\n hostStyle.setProperty('--ph-survey-input-background', inputBgColor)\n // Input text color applies to both text inputs and inactive rating buttons\n const inputTextColor = appearance?.inputTextColor || getContrastingTextColor(inputBgColor)\n hostStyle.setProperty('--ph-survey-input-text-color', inputTextColor)\n hostStyle.setProperty('--ph-survey-rating-text-color', inputTextColor)\n hostStyle.setProperty('--ph-survey-scrollbar-thumb-color', effectiveAppearance.scrollbarThumbColor)\n hostStyle.setProperty('--ph-survey-scrollbar-track-color', effectiveAppearance.scrollbarTrackColor)\n hostStyle.setProperty('--ph-survey-outline-color', effectiveAppearance.outlineColor)\n}\n\nfunction nameToHex(name: string) {\n return {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n 'indianred ': '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgrey: '#d3d3d3',\n lightgreen: '#90ee90',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370d8',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#d87093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32',\n }[name.toLowerCase()]\n}\n\nfunction hex2rgb(c: string) {\n if (c[0] === '#') {\n const hexColor = c.replace(/^#/, '')\n const r = parseInt(hexColor.slice(0, 2), 16)\n const g = parseInt(hexColor.slice(2, 4), 16)\n const b = parseInt(hexColor.slice(4, 6), 16)\n return 'rgb(' + r + ',' + g + ',' + b + ')'\n }\n return 'rgb(255, 255, 255)'\n}\n\nfunction getContrastingTextColor(color: string = defaultSurveyAppearance.backgroundColor) {\n let rgb\n if (color[0] === '#') {\n rgb = hex2rgb(color)\n }\n if (color.startsWith('rgb')) {\n rgb = color\n }\n // otherwise it's a color name\n const nameColorToHex = nameToHex(color)\n if (nameColorToHex) {\n rgb = hex2rgb(nameColorToHex)\n }\n if (!rgb) {\n return BLACK_TEXT_COLOR\n }\n const colorMatch = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/)\n if (colorMatch) {\n const r = parseInt(colorMatch[1])\n const g = parseInt(colorMatch[2])\n const b = parseInt(colorMatch[3])\n const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))\n return hsp > 127.5 ? BLACK_TEXT_COLOR : 'white'\n }\n return BLACK_TEXT_COLOR\n}\n\nexport function getSurveyStylesheet(posthog?: PostHog) {\n const stylesheet = prepareStylesheet(document, typeof surveyStyles === 'string' ? surveyStyles : '', posthog)\n stylesheet?.setAttribute('data-ph-survey-style', 'true')\n return stylesheet\n}\n\nexport const retrieveSurveyShadow = (\n survey: Pick<Survey, 'id' | 'appearance' | 'type'>,\n posthog?: PostHog,\n element?: Element\n) => {\n const widgetClassName = getSurveyContainerClass(survey)\n const existingDiv = document.querySelector(`.${widgetClassName}`)\n\n if (existingDiv && existingDiv.shadowRoot) {\n return {\n shadow: existingDiv.shadowRoot,\n isNewlyCreated: false,\n }\n }\n\n // If it doesn't exist, create it\n const div = document.createElement('div')\n addSurveyCSSVariablesToElement(div, survey.type, survey.appearance)\n div.className = widgetClassName\n const shadow = div.attachShadow({ mode: 'open' })\n const stylesheet = getSurveyStylesheet(posthog)\n if (stylesheet) {\n const existingStylesheet = shadow.querySelector('style')\n if (existingStylesheet) {\n shadow.removeChild(existingStylesheet)\n }\n shadow.appendChild(stylesheet)\n }\n ;(element ? element : document.body).appendChild(div)\n return {\n shadow,\n isNewlyCreated: true,\n }\n}\n\ninterface SendSurveyEventArgs {\n responses: Record<string, string | number | string[] | null>\n survey: Survey\n surveySubmissionId: string\n isSurveyCompleted: boolean\n posthog?: PostHog\n}\n\nconst getSurveyResponseValue = (responses: Record<string, string | number | string[] | null>, questionId?: string) => {\n if (!questionId) {\n return null\n }\n const response = responses[getSurveyResponseKey(questionId)]\n if (isArray(response)) {\n return [...response]\n }\n return response\n}\n\nexport const sendSurveyEvent = ({\n responses,\n survey,\n surveySubmissionId,\n posthog,\n isSurveyCompleted,\n}: SendSurveyEventArgs) => {\n if (!posthog) {\n logger.error('[survey sent] event not captured, PostHog instance not found.')\n return\n }\n setSurveySeenOnLocalStorage(survey)\n posthog.capture(SurveyEventName.SENT, {\n [SurveyEventProperties.SURVEY_NAME]: survey.name,\n [SurveyEventProperties.SURVEY_ID]: survey.id,\n [SurveyEventProperties.SURVEY_ITERATION]: survey.current_iteration,\n [SurveyEventProperties.SURVEY_ITERATION_START_DATE]: survey.current_iteration_start_date,\n [SurveyEventProperties.SURVEY_QUESTIONS]: survey.questions.map((question) => ({\n id: question.id,\n question: question.question,\n response: getSurveyResponseValue(responses, question.id),\n })),\n [SurveyEventProperties.SURVEY_SUBMISSION_ID]: surveySubmissionId,\n [SurveyEventProperties.SURVEY_COMPLETED]: isSurveyCompleted,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...responses,\n $set: {\n [getSurveyInteractionProperty(survey, 'responded')]: true,\n },\n })\n if (isSurveyCompleted) {\n // Only dispatch PHSurveySent if the survey is completed, as that removes the survey from focus\n window.dispatchEvent(new CustomEvent('PHSurveySent', { detail: { surveyId: survey.id } }))\n clearInProgressSurveyState(survey)\n }\n}\n\nconst _surveyHasResponses = (inProgressSurvey: InProgressSurveyState | null) => {\n return Object.values(inProgressSurvey?.responses || {}).filter((resp) => !isNullish(resp)).length > 0\n}\n\nconst _buildSurveyEventProperties = (\n survey: Survey,\n inProgressSurvey: InProgressSurveyState | null,\n posthog: PostHog\n) => ({\n [SurveyEventProperties.SURVEY_NAME]: survey.name,\n [SurveyEventProperties.SURVEY_ID]: survey.id,\n [SurveyEventProperties.SURVEY_ITERATION]: survey.current_iteration,\n [SurveyEventProperties.SURVEY_ITERATION_START_DATE]: survey.current_iteration_start_date,\n [SurveyEventProperties.SURVEY_PARTIALLY_COMPLETED]: _surveyHasResponses(inProgressSurvey),\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...inProgressSurvey?.responses,\n [SurveyEventProperties.SURVEY_SUBMISSION_ID]: inProgressSurvey?.surveySubmissionId,\n [SurveyEventProperties.SURVEY_QUESTIONS]: survey.questions.map((question) => ({\n id: question.id,\n question: question.question,\n response: getSurveyResponseValue(inProgressSurvey?.responses || {}, question.id),\n })),\n})\n\nexport const dismissedSurveyEvent = (survey: Survey, posthog?: PostHog, readOnly?: boolean) => {\n if (!posthog) {\n logger.error('[survey dismissed] event not captured, PostHog instance not found.')\n return\n }\n if (readOnly) {\n return\n }\n\n const inProgressSurvey = getInProgressSurveyState(survey)\n posthog.capture(SurveyEventName.DISMISSED, {\n ..._buildSurveyEventProperties(survey, inProgressSurvey, posthog),\n $set: {\n [getSurveyInteractionProperty(survey, 'dismissed')]: true,\n },\n })\n clearInProgressSurveyState(survey)\n setSurveySeenOnLocalStorage(survey)\n window.dispatchEvent(new CustomEvent('PHSurveyClosed', { detail: { surveyId: survey.id } }))\n}\n\nexport const sendSurveyAbandonedEvent = (survey: Survey, posthog?: PostHog) => {\n if (!posthog) {\n logger.error('[survey abandoned] event not captured, PostHog instance not found.')\n return\n }\n\n const abandonedKey = getSurveyAbandonedKey(survey)\n try {\n if (localStorage.getItem(abandonedKey) === 'true') {\n return\n }\n } catch {\n // localStorage not available\n return\n }\n\n const inProgressSurvey = getInProgressSurveyState(survey)\n if (!inProgressSurvey) {\n return\n }\n\n try {\n localStorage.setItem(abandonedKey, 'true')\n } catch {\n // localStorage not available\n }\n\n posthog.capture(SurveyEventName.ABANDONED, _buildSurveyEventProperties(survey, inProgressSurvey, posthog), {\n transport: 'sendBeacon',\n })\n}\n\n// Use the Fisher-yates algorithm to shuffle this array\n// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\nexport const shuffle = (array: any[]) => {\n return array\n .map((a) => ({ sort: Math.floor(Math.random() * 10), value: a }))\n .sort((a, b) => a.sort - b.sort)\n .map((a) => a.value)\n}\n\nconst reverseIfUnshuffled = (unshuffled: any[], shuffled: any[]): any[] => {\n if (unshuffled.length === shuffled.length && unshuffled.every((val, index) => val === shuffled[index])) {\n return shuffled.reverse()\n }\n\n return shuffled\n}\n\nexport const getDisplayOrderChoices = (question: MultipleSurveyQuestion): string[] => {\n if (!question.shuffleOptions) {\n return question.choices\n }\n\n const displayOrderChoices = question.choices\n let openEndedChoice = ''\n if (question.hasOpenChoice) {\n // if the question has an open-ended choice, its always the last element in the choices array.\n openEndedChoice = displayOrderChoices.pop()!\n }\n\n const shuffledOptions = reverseIfUnshuffled(displayOrderChoices, shuffle(displayOrderChoices))\n\n if (question.hasOpenChoice) {\n question.choices.push(openEndedChoice)\n shuffledOptions.push(openEndedChoice)\n }\n\n return shuffledOptions\n}\n\nexport const getDisplayOrderQuestions = (survey: Survey): SurveyQuestion[] => {\n if (!survey.appearance || !survey.appearance.shuffleQuestions || survey.enable_partial_responses) {\n return survey.questions\n }\n\n return reverseIfUnshuffled(survey.questions, shuffle(survey.questions))\n}\n\nexport const hasEvents = (survey: Pick<Survey, 'conditions'>): boolean => {\n return survey.conditions?.events?.values?.length != undefined && survey.conditions?.events?.values?.length > 0\n}\n\nexport const canActivateRepeatedly = (\n survey: Pick<Survey, 'schedule' | 'conditions' | 'id' | 'current_iteration'>\n): boolean => {\n return (\n !!(survey.conditions?.events?.repeatedActivation && hasEvents(survey)) ||\n survey.schedule === SurveySchedule.Always ||\n isSurveyInProgress(survey)\n )\n}\n\n/**\n * getSurveySeen checks local storage for the surveySeen Key a\n * and overrides this value if the survey can be repeatedly activated by its events.\n * @param survey\n */\nexport const getSurveySeen = (survey: Survey): boolean => {\n const surveySeen = localStorage.getItem(getSurveySeenKey(survey))\n if (surveySeen) {\n // if a survey has already been seen,\n // we will override it with the event repeated activation value.\n return !canActivateRepeatedly(survey)\n }\n\n return false\n}\n\nconst LAST_SEEN_SURVEY_DATE_KEY = 'lastSeenSurveyDate'\n\nexport const hasWaitPeriodPassed = (waitPeriodInDays: number | undefined): boolean => {\n const lastSeenSurveyDate = localStorage.getItem(LAST_SEEN_SURVEY_DATE_KEY)\n if (!waitPeriodInDays || !lastSeenSurveyDate) {\n return true\n }\n\n const today = new Date()\n const diff = Math.abs(today.getTime() - new Date(lastSeenSurveyDate).getTime())\n const diffDaysFromToday = Math.ceil(diff / (1000 * 3600 * 24))\n return diffDaysFromToday > waitPeriodInDays\n}\n\ninterface SurveyContextProps {\n isPreviewMode: boolean\n previewPageIndex: number | undefined\n onPopupSurveyDismissed: () => void\n isPopup: boolean\n onPreviewSubmit: (res: string | string[] | number | null) => void\n surveySubmissionId: string\n}\n\nexport const SurveyContext = createContext<SurveyContextProps>({\n isPreviewMode: false,\n previewPageIndex: 0,\n onPopupSurveyDismissed: () => {},\n isPopup: true,\n onPreviewSubmit: () => {},\n surveySubmissionId: '',\n})\n\nexport const useSurveyContext = () => {\n return useContext(SurveyContext)\n}\n\ninterface RenderProps {\n component: VNode<{ className: string }>\n children: string\n renderAsHtml?: boolean\n style?: JSX.CSSProperties\n}\n\nexport const renderChildrenAsTextOrHtml = ({ component, children, renderAsHtml, style }: RenderProps) => {\n return renderAsHtml\n ? cloneElement(component, {\n dangerouslySetInnerHTML: { __html: children },\n style,\n })\n : cloneElement(component, {\n children,\n style,\n })\n}\n\nfunction defaultMatchType(matchType?: PropertyMatchType): PropertyMatchType {\n return matchType ?? 'icontains'\n}\n\n// use urlMatchType to validate url condition, fallback to contains for backwards compatibility\nexport function doesSurveyUrlMatch(survey: Pick<Survey, 'conditions'>): boolean {\n if (!survey.conditions?.url) {\n return true\n }\n // if we dont know the url, assume it is not a match\n const href = window?.location?.href\n if (!href) {\n return false\n }\n const targets = [survey.conditions.url]\n const matchType = defaultMatchType(survey.conditions?.urlMatchType)\n return propertyComparisons[matchType](targets, [href])\n}\n\nexport function doesSurveyDeviceTypesMatch(survey: Survey): boolean {\n if (!survey.conditions?.deviceTypes || survey.conditions?.deviceTypes.length === 0) {\n return true\n }\n // if we dont know the device type, assume it is not a match\n if (!userAgent) {\n return false\n }\n\n const deviceType = detectDeviceType(userAgent)\n return propertyComparisons[defaultMatchType(survey.conditions?.deviceTypesMatchType)](\n survey.conditions.deviceTypes,\n [deviceType]\n )\n}\n\nexport function doesSurveyMatchSelector(survey: Survey): boolean {\n if (!survey.conditions?.selector) {\n return true\n }\n return !!document?.querySelector(survey.conditions.selector)\n}\n\ninterface InProgressSurveyState {\n surveySubmissionId: string\n lastQuestionIndex: number\n responses: Record<string, string | number | string[] | null>\n}\n\nconst getInProgressSurveyStateKey = (survey: Pick<Survey, 'id' | 'current_iteration'>): string => {\n let key = `${SURVEY_IN_PROGRESS_PREFIX}${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n key = `${SURVEY_IN_PROGRESS_PREFIX}${survey.id}_${survey.current_iteration}`\n }\n return key\n}\n\nexport const setInProgressSurveyState = (\n survey: Pick<Survey, 'id' | 'current_iteration'>,\n state: InProgressSurveyState\n): void => {\n try {\n localStorage.setItem(getInProgressSurveyStateKey(survey), JSON.stringify(state))\n } catch (e) {\n logger.error('Error setting in-progress survey state in localStorage', e)\n }\n}\n\nexport const getInProgressSurveyState = (\n survey: Pick<Survey, 'id' | 'current_iteration'>\n): InProgressSurveyState | null => {\n try {\n const stateString = localStorage.getItem(getInProgressSurveyStateKey(survey))\n if (stateString) {\n return JSON.parse(stateString) as InProgressSurveyState\n }\n } catch (e) {\n logger.error('Error getting in-progress survey state from localStorage', e)\n }\n return null\n}\n\nexport const isSurveyInProgress = (survey: Pick<Survey, 'id' | 'current_iteration'>): boolean => {\n const state = getInProgressSurveyState(survey)\n return !isNullish(state?.surveySubmissionId)\n}\n\nexport const clearInProgressSurveyState = (survey: Pick<Survey, 'id' | 'current_iteration'>): void => {\n try {\n localStorage.removeItem(getInProgressSurveyStateKey(survey))\n } catch (e) {\n logger.error('Error clearing in-progress survey state from localStorage', e)\n }\n}\n\nexport function getSurveyContainerClass(survey: Pick<Survey, 'id'>, asSelector = false): string {\n const className = `PostHogSurvey-${survey.id}`\n return asSelector ? `.${className}` : className\n}\n"]}
|
|
1
|
+
{"version":3,"file":"surveys-extension-utils.js","sourceRoot":"","sources":["../../../../src/extensions/surveys/surveys-extension-utils.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,sCAQC;AAED,oDAEC;AA6PD,0BAgBC;AAED,8BAOC;AAED,0DAyBC;AAED,kDAIC;AAmTD,gDAYC;AAED,gEAcC;AAED,0DAKC;AAsDD,0DAGC;AArvBD,iCAAqE;AAErE,qEAWoC;AACpC,+CAAyF;AACzF,yDAOiC;AACjC,sCAAkD;AAElD,sCAAgD;AAChD,6DAAgE;AAEhE,gEAA8D;AAC9D,gGAAgG;AAChG,IAAM,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CAAC,EAAE,CAAE,CAAA;IAC9C,OAAO,UAAU,CAAC,CAAC,CAAC,WAAI,SAAS,CAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC","sourcesContent":["import { VNode, cloneElement, createContext, type JSX } from 'preact'\nimport { PostHog } from '../../posthog-core'\nimport {\n MultipleSurveyQuestion,\n Survey,\n SurveyAppearance,\n SurveyEventName,\n SurveyEventProperties,\n SurveyPosition,\n SurveyQuestion,\n SurveySchedule,\n SurveyType,\n SurveyWidgetType,\n} from '../../posthog-surveys-types'\nimport { document as _document, window as _window, userAgent } from '../../utils/globals'\nimport {\n getSurveyInteractionProperty,\n getSurveySeenKey,\n getSurveyAbandonedKey,\n SURVEY_LOGGER as logger,\n setSurveySeenOnLocalStorage,\n SURVEY_IN_PROGRESS_PREFIX,\n} from '../../utils/survey-utils'\nimport { isArray, isNullish } from '@posthog/core'\n\nimport { detectDeviceType } from '@posthog/core'\nimport { propertyComparisons } from '../../utils/property-utils'\nimport { PropertyMatchType } from '../../types'\nimport { prepareStylesheet } from '../utils/stylesheet-loader'\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\nimport surveyStyles from './survey.css'\nimport { useContext } from 'preact/hooks'\n\nexport function getFontFamily(fontFamily?: string): string {\n if (fontFamily === 'inherit') {\n return 'inherit'\n }\n\n const defaultFontStack =\n 'BlinkMacSystemFont, \"Inter\", \"Segoe UI\", \"Roboto\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"'\n return fontFamily ? `${fontFamily}, ${defaultFontStack}` : `-apple-system, ${defaultFontStack}`\n}\n\nexport function getSurveyResponseKey(questionId: string) {\n return `$survey_response_${questionId}`\n}\n\nconst BLACK_TEXT_COLOR = '#020617' // Maps out to text-slate-950 from tailwind colors. Intended for text use outside interactive elements like buttons\n\n// Keep in sync with defaultSurveyAppearance on the main app\nexport const defaultSurveyAppearance = {\n fontFamily: 'inherit',\n backgroundColor: '#eeeded',\n submitButtonColor: 'black',\n submitButtonTextColor: 'white',\n ratingButtonColor: 'white',\n ratingButtonActiveColor: 'black',\n borderColor: '#c9c6c6',\n placeholder: 'Start typing...',\n whiteLabel: false,\n displayThankYouMessage: true,\n thankYouMessageHeader: 'Thank you for your feedback!',\n position: SurveyPosition.Right,\n widgetType: SurveyWidgetType.Tab,\n widgetLabel: 'Feedback',\n widgetColor: 'black',\n zIndex: '2147483647',\n disabledButtonOpacity: '0.6',\n maxWidth: '300px',\n textSubtleColor: '#939393',\n boxPadding: '20px 24px',\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n borderRadius: '10px',\n shuffleQuestions: false,\n surveyPopupDelaySeconds: undefined,\n // Not customizable atm\n outlineColor: 'rgba(59, 130, 246, 0.8)',\n inputBackground: 'white',\n inputTextColor: BLACK_TEXT_COLOR,\n scrollbarThumbColor: 'var(--ph-survey-border-color)',\n scrollbarTrackColor: 'var(--ph-survey-background-color)',\n} as const\n\nexport const addSurveyCSSVariablesToElement = (\n element: HTMLElement,\n type: SurveyType,\n appearance?: SurveyAppearance | null\n) => {\n const effectiveAppearance = { ...defaultSurveyAppearance, ...appearance }\n const hostStyle = element.style\n\n const surveyHasBottomBorder =\n ![SurveyPosition.Center, SurveyPosition.Left, SurveyPosition.Right].includes(effectiveAppearance.position) ||\n (type === SurveyType.Widget && appearance?.widgetType === SurveyWidgetType.Tab)\n\n hostStyle.setProperty('--ph-survey-font-family', getFontFamily(effectiveAppearance.fontFamily))\n hostStyle.setProperty('--ph-survey-box-padding', effectiveAppearance.boxPadding)\n hostStyle.setProperty('--ph-survey-max-width', effectiveAppearance.maxWidth)\n hostStyle.setProperty('--ph-survey-z-index', effectiveAppearance.zIndex)\n hostStyle.setProperty('--ph-survey-border-color', effectiveAppearance.borderColor)\n // Non-bottom surveys or tab surveys have the border bottom\n if (surveyHasBottomBorder) {\n hostStyle.setProperty('--ph-survey-border-radius', effectiveAppearance.borderRadius)\n hostStyle.setProperty('--ph-survey-border-bottom', '1.5px solid var(--ph-survey-border-color)')\n } else {\n hostStyle.setProperty('--ph-survey-border-bottom', 'none')\n hostStyle.setProperty(\n '--ph-survey-border-radius',\n `${effectiveAppearance.borderRadius} ${effectiveAppearance.borderRadius} 0 0`\n )\n }\n hostStyle.setProperty('--ph-survey-background-color', effectiveAppearance.backgroundColor)\n hostStyle.setProperty('--ph-survey-box-shadow', effectiveAppearance.boxShadow)\n hostStyle.setProperty('--ph-survey-disabled-button-opacity', effectiveAppearance.disabledButtonOpacity)\n hostStyle.setProperty('--ph-survey-submit-button-color', effectiveAppearance.submitButtonColor)\n hostStyle.setProperty(\n '--ph-survey-submit-button-text-color',\n appearance?.submitButtonTextColor || getContrastingTextColor(effectiveAppearance.submitButtonColor)\n )\n hostStyle.setProperty('--ph-survey-rating-bg-color', effectiveAppearance.ratingButtonColor)\n hostStyle.setProperty('--ph-survey-rating-active-bg-color', effectiveAppearance.ratingButtonActiveColor)\n // Active rating text is always auto-calculated for contrast with active background\n hostStyle.setProperty(\n '--ph-survey-rating-active-text-color',\n getContrastingTextColor(effectiveAppearance.ratingButtonActiveColor)\n )\n // Primary text color: use override if provided, otherwise auto-calculate from background\n hostStyle.setProperty(\n '--ph-survey-text-primary-color',\n appearance?.textColor || getContrastingTextColor(effectiveAppearance.backgroundColor)\n )\n hostStyle.setProperty('--ph-survey-text-subtle-color', effectiveAppearance.textSubtleColor)\n hostStyle.setProperty('--ph-widget-color', effectiveAppearance.widgetColor)\n hostStyle.setProperty('--ph-widget-text-color', getContrastingTextColor(effectiveAppearance.widgetColor))\n hostStyle.setProperty('--ph-widget-z-index', effectiveAppearance.zIndex)\n\n // Use user-provided inputBackground (or deprecated inputBackgroundColor for backwards compat)\n // Fallback to internal default, with slight adjustment for white backgrounds\n const userInputBg = appearance?.inputBackground || appearance?.inputBackgroundColor\n let inputBgColor = userInputBg || effectiveAppearance.inputBackground\n if (!userInputBg && effectiveAppearance.backgroundColor === 'white') {\n inputBgColor = '#f8f8f8'\n }\n hostStyle.setProperty('--ph-survey-input-background', inputBgColor)\n // Input text color applies to both text inputs and inactive rating buttons\n const inputTextColor = appearance?.inputTextColor || getContrastingTextColor(inputBgColor)\n hostStyle.setProperty('--ph-survey-input-text-color', inputTextColor)\n hostStyle.setProperty('--ph-survey-rating-text-color', inputTextColor)\n hostStyle.setProperty('--ph-survey-scrollbar-thumb-color', effectiveAppearance.scrollbarThumbColor)\n hostStyle.setProperty('--ph-survey-scrollbar-track-color', effectiveAppearance.scrollbarTrackColor)\n hostStyle.setProperty('--ph-survey-outline-color', effectiveAppearance.outlineColor)\n}\n\nfunction nameToHex(name: string) {\n return {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n 'indianred ': '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgrey: '#d3d3d3',\n lightgreen: '#90ee90',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370d8',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#d87093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32',\n }[name.toLowerCase()]\n}\n\nexport function hex2rgb(c: string): string {\n if (c.startsWith('#')) {\n let hexColor = c.replace(/^#/, '')\n // Handle 3-character shorthand (e.g., #111 -> #111111, #abc -> #aabbcc)\n if (/^[0-9A-Fa-f]{3}$/.test(hexColor)) {\n hexColor = hexColor[0] + hexColor[0] + hexColor[1] + hexColor[1] + hexColor[2] + hexColor[2]\n }\n if (!/^[0-9A-Fa-f]{6}$/.test(hexColor)) {\n return 'rgb(255, 255, 255)'\n }\n const r = parseInt(hexColor.slice(0, 2), 16)\n const g = parseInt(hexColor.slice(2, 4), 16)\n const b = parseInt(hexColor.slice(4, 6), 16)\n return `rgb(${r},${g},${b})`\n }\n return 'rgb(255, 255, 255)'\n}\n\nexport function hexToRgba(hex: string, opacity: number): string {\n const rgb = hex2rgb(hex)\n const match = rgb.match(/^rgb\\((\\d+),(\\d+),(\\d+)\\)$/)\n if (!match) {\n return hex\n }\n return `rgba(${match[1]}, ${match[2]}, ${match[3]}, ${opacity})`\n}\n\nexport function getContrastingTextColor(color: string = defaultSurveyAppearance.backgroundColor) {\n let rgb\n if (color[0] === '#') {\n rgb = hex2rgb(color)\n }\n if (color.startsWith('rgb')) {\n rgb = color\n }\n // otherwise it's a color name\n const nameColorToHex = nameToHex(color)\n if (nameColorToHex) {\n rgb = hex2rgb(nameColorToHex)\n }\n if (!rgb) {\n return BLACK_TEXT_COLOR\n }\n const colorMatch = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/)\n if (colorMatch) {\n const r = parseInt(colorMatch[1])\n const g = parseInt(colorMatch[2])\n const b = parseInt(colorMatch[3])\n const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))\n return hsp > 127.5 ? BLACK_TEXT_COLOR : 'white'\n }\n return BLACK_TEXT_COLOR\n}\n\nexport function getSurveyStylesheet(posthog?: PostHog) {\n const stylesheet = prepareStylesheet(document, typeof surveyStyles === 'string' ? surveyStyles : '', posthog)\n stylesheet?.setAttribute('data-ph-survey-style', 'true')\n return stylesheet\n}\n\nexport const retrieveSurveyShadow = (\n survey: Pick<Survey, 'id' | 'appearance' | 'type'>,\n posthog?: PostHog,\n element?: Element\n) => {\n const widgetClassName = getSurveyContainerClass(survey)\n const existingDiv = document.querySelector(`.${widgetClassName}`)\n\n if (existingDiv && existingDiv.shadowRoot) {\n return {\n shadow: existingDiv.shadowRoot,\n isNewlyCreated: false,\n }\n }\n\n // If it doesn't exist, create it\n const div = document.createElement('div')\n addSurveyCSSVariablesToElement(div, survey.type, survey.appearance)\n div.className = widgetClassName\n const shadow = div.attachShadow({ mode: 'open' })\n const stylesheet = getSurveyStylesheet(posthog)\n if (stylesheet) {\n const existingStylesheet = shadow.querySelector('style')\n if (existingStylesheet) {\n shadow.removeChild(existingStylesheet)\n }\n shadow.appendChild(stylesheet)\n }\n ;(element ? element : document.body).appendChild(div)\n return {\n shadow,\n isNewlyCreated: true,\n }\n}\n\ninterface SendSurveyEventArgs {\n responses: Record<string, string | number | string[] | null>\n survey: Survey\n surveySubmissionId: string\n isSurveyCompleted: boolean\n posthog?: PostHog\n}\n\nconst getSurveyResponseValue = (responses: Record<string, string | number | string[] | null>, questionId?: string) => {\n if (!questionId) {\n return null\n }\n const response = responses[getSurveyResponseKey(questionId)]\n if (isArray(response)) {\n return [...response]\n }\n return response\n}\n\nexport const sendSurveyEvent = ({\n responses,\n survey,\n surveySubmissionId,\n posthog,\n isSurveyCompleted,\n}: SendSurveyEventArgs) => {\n if (!posthog) {\n logger.error('[survey sent] event not captured, PostHog instance not found.')\n return\n }\n setSurveySeenOnLocalStorage(survey)\n posthog.capture(SurveyEventName.SENT, {\n [SurveyEventProperties.SURVEY_NAME]: survey.name,\n [SurveyEventProperties.SURVEY_ID]: survey.id,\n [SurveyEventProperties.SURVEY_ITERATION]: survey.current_iteration,\n [SurveyEventProperties.SURVEY_ITERATION_START_DATE]: survey.current_iteration_start_date,\n [SurveyEventProperties.SURVEY_QUESTIONS]: survey.questions.map((question) => ({\n id: question.id,\n question: question.question,\n response: getSurveyResponseValue(responses, question.id),\n })),\n [SurveyEventProperties.SURVEY_SUBMISSION_ID]: surveySubmissionId,\n [SurveyEventProperties.SURVEY_COMPLETED]: isSurveyCompleted,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...responses,\n $set: {\n [getSurveyInteractionProperty(survey, 'responded')]: true,\n },\n })\n if (isSurveyCompleted) {\n // Only dispatch PHSurveySent if the survey is completed, as that removes the survey from focus\n window.dispatchEvent(new CustomEvent('PHSurveySent', { detail: { surveyId: survey.id } }))\n clearInProgressSurveyState(survey)\n }\n}\n\nconst _surveyHasResponses = (inProgressSurvey: InProgressSurveyState | null) => {\n return Object.values(inProgressSurvey?.responses || {}).filter((resp) => !isNullish(resp)).length > 0\n}\n\nconst _buildSurveyEventProperties = (\n survey: Survey,\n inProgressSurvey: InProgressSurveyState | null,\n posthog: PostHog\n) => ({\n [SurveyEventProperties.SURVEY_NAME]: survey.name,\n [SurveyEventProperties.SURVEY_ID]: survey.id,\n [SurveyEventProperties.SURVEY_ITERATION]: survey.current_iteration,\n [SurveyEventProperties.SURVEY_ITERATION_START_DATE]: survey.current_iteration_start_date,\n [SurveyEventProperties.SURVEY_PARTIALLY_COMPLETED]: _surveyHasResponses(inProgressSurvey),\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...inProgressSurvey?.responses,\n [SurveyEventProperties.SURVEY_SUBMISSION_ID]: inProgressSurvey?.surveySubmissionId,\n [SurveyEventProperties.SURVEY_QUESTIONS]: survey.questions.map((question) => ({\n id: question.id,\n question: question.question,\n response: getSurveyResponseValue(inProgressSurvey?.responses || {}, question.id),\n })),\n})\n\nexport const dismissedSurveyEvent = (survey: Survey, posthog?: PostHog, readOnly?: boolean) => {\n if (!posthog) {\n logger.error('[survey dismissed] event not captured, PostHog instance not found.')\n return\n }\n if (readOnly) {\n return\n }\n\n const inProgressSurvey = getInProgressSurveyState(survey)\n posthog.capture(SurveyEventName.DISMISSED, {\n ..._buildSurveyEventProperties(survey, inProgressSurvey, posthog),\n $set: {\n [getSurveyInteractionProperty(survey, 'dismissed')]: true,\n },\n })\n clearInProgressSurveyState(survey)\n setSurveySeenOnLocalStorage(survey)\n window.dispatchEvent(new CustomEvent('PHSurveyClosed', { detail: { surveyId: survey.id } }))\n}\n\nexport const sendSurveyAbandonedEvent = (survey: Survey, posthog?: PostHog) => {\n if (!posthog) {\n logger.error('[survey abandoned] event not captured, PostHog instance not found.')\n return\n }\n\n const abandonedKey = getSurveyAbandonedKey(survey)\n try {\n if (localStorage.getItem(abandonedKey) === 'true') {\n return\n }\n } catch {\n // localStorage not available\n return\n }\n\n const inProgressSurvey = getInProgressSurveyState(survey)\n if (!inProgressSurvey) {\n return\n }\n\n try {\n localStorage.setItem(abandonedKey, 'true')\n } catch {\n // localStorage not available\n }\n\n posthog.capture(SurveyEventName.ABANDONED, _buildSurveyEventProperties(survey, inProgressSurvey, posthog), {\n transport: 'sendBeacon',\n })\n}\n\n// Use the Fisher-yates algorithm to shuffle this array\n// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\nexport const shuffle = (array: any[]) => {\n return array\n .map((a) => ({ sort: Math.floor(Math.random() * 10), value: a }))\n .sort((a, b) => a.sort - b.sort)\n .map((a) => a.value)\n}\n\nconst reverseIfUnshuffled = (unshuffled: any[], shuffled: any[]): any[] => {\n if (unshuffled.length === shuffled.length && unshuffled.every((val, index) => val === shuffled[index])) {\n return shuffled.reverse()\n }\n\n return shuffled\n}\n\nexport const getDisplayOrderChoices = (question: MultipleSurveyQuestion): string[] => {\n if (!question.shuffleOptions) {\n return question.choices\n }\n\n const displayOrderChoices = question.choices\n let openEndedChoice = ''\n if (question.hasOpenChoice) {\n // if the question has an open-ended choice, its always the last element in the choices array.\n openEndedChoice = displayOrderChoices.pop()!\n }\n\n const shuffledOptions = reverseIfUnshuffled(displayOrderChoices, shuffle(displayOrderChoices))\n\n if (question.hasOpenChoice) {\n question.choices.push(openEndedChoice)\n shuffledOptions.push(openEndedChoice)\n }\n\n return shuffledOptions\n}\n\nexport const getDisplayOrderQuestions = (survey: Survey): SurveyQuestion[] => {\n if (!survey.appearance || !survey.appearance.shuffleQuestions || survey.enable_partial_responses) {\n return survey.questions\n }\n\n return reverseIfUnshuffled(survey.questions, shuffle(survey.questions))\n}\n\nexport const hasEvents = (survey: Pick<Survey, 'conditions'>): boolean => {\n return survey.conditions?.events?.values?.length != undefined && survey.conditions?.events?.values?.length > 0\n}\n\nexport const canActivateRepeatedly = (\n survey: Pick<Survey, 'schedule' | 'conditions' | 'id' | 'current_iteration'>\n): boolean => {\n return (\n !!(survey.conditions?.events?.repeatedActivation && hasEvents(survey)) ||\n survey.schedule === SurveySchedule.Always ||\n isSurveyInProgress(survey)\n )\n}\n\n/**\n * getSurveySeen checks local storage for the surveySeen Key a\n * and overrides this value if the survey can be repeatedly activated by its events.\n * @param survey\n */\nexport const getSurveySeen = (survey: Survey): boolean => {\n const surveySeen = localStorage.getItem(getSurveySeenKey(survey))\n if (surveySeen) {\n // if a survey has already been seen,\n // we will override it with the event repeated activation value.\n return !canActivateRepeatedly(survey)\n }\n\n return false\n}\n\nconst LAST_SEEN_SURVEY_DATE_KEY = 'lastSeenSurveyDate'\n\nexport const hasWaitPeriodPassed = (waitPeriodInDays: number | undefined): boolean => {\n const lastSeenSurveyDate = localStorage.getItem(LAST_SEEN_SURVEY_DATE_KEY)\n if (!waitPeriodInDays || !lastSeenSurveyDate) {\n return true\n }\n\n const today = new Date()\n const diff = Math.abs(today.getTime() - new Date(lastSeenSurveyDate).getTime())\n const diffDaysFromToday = Math.ceil(diff / (1000 * 3600 * 24))\n return diffDaysFromToday > waitPeriodInDays\n}\n\ninterface SurveyContextProps {\n isPreviewMode: boolean\n previewPageIndex: number | undefined\n onPopupSurveyDismissed: () => void\n isPopup: boolean\n onPreviewSubmit: (res: string | string[] | number | null) => void\n surveySubmissionId: string\n}\n\nexport const SurveyContext = createContext<SurveyContextProps>({\n isPreviewMode: false,\n previewPageIndex: 0,\n onPopupSurveyDismissed: () => {},\n isPopup: true,\n onPreviewSubmit: () => {},\n surveySubmissionId: '',\n})\n\nexport const useSurveyContext = () => {\n return useContext(SurveyContext)\n}\n\ninterface RenderProps {\n component: VNode<{ className: string }>\n children: string\n renderAsHtml?: boolean\n style?: JSX.CSSProperties\n}\n\nexport const renderChildrenAsTextOrHtml = ({ component, children, renderAsHtml, style }: RenderProps) => {\n return renderAsHtml\n ? cloneElement(component, {\n dangerouslySetInnerHTML: { __html: children },\n style,\n })\n : cloneElement(component, {\n children,\n style,\n })\n}\n\nfunction defaultMatchType(matchType?: PropertyMatchType): PropertyMatchType {\n return matchType ?? 'icontains'\n}\n\n// use urlMatchType to validate url condition, fallback to contains for backwards compatibility\nexport function doesSurveyUrlMatch(survey: Pick<Survey, 'conditions'>): boolean {\n if (!survey.conditions?.url) {\n return true\n }\n // if we dont know the url, assume it is not a match\n const href = window?.location?.href\n if (!href) {\n return false\n }\n const targets = [survey.conditions.url]\n const matchType = defaultMatchType(survey.conditions?.urlMatchType)\n return propertyComparisons[matchType](targets, [href])\n}\n\nexport function doesSurveyDeviceTypesMatch(survey: Survey): boolean {\n if (!survey.conditions?.deviceTypes || survey.conditions?.deviceTypes.length === 0) {\n return true\n }\n // if we dont know the device type, assume it is not a match\n if (!userAgent) {\n return false\n }\n\n const deviceType = detectDeviceType(userAgent)\n return propertyComparisons[defaultMatchType(survey.conditions?.deviceTypesMatchType)](\n survey.conditions.deviceTypes,\n [deviceType]\n )\n}\n\nexport function doesSurveyMatchSelector(survey: Survey): boolean {\n if (!survey.conditions?.selector) {\n return true\n }\n return !!document?.querySelector(survey.conditions.selector)\n}\n\ninterface InProgressSurveyState {\n surveySubmissionId: string\n lastQuestionIndex: number\n responses: Record<string, string | number | string[] | null>\n}\n\nconst getInProgressSurveyStateKey = (survey: Pick<Survey, 'id' | 'current_iteration'>): string => {\n let key = `${SURVEY_IN_PROGRESS_PREFIX}${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n key = `${SURVEY_IN_PROGRESS_PREFIX}${survey.id}_${survey.current_iteration}`\n }\n return key\n}\n\nexport const setInProgressSurveyState = (\n survey: Pick<Survey, 'id' | 'current_iteration'>,\n state: InProgressSurveyState\n): void => {\n try {\n localStorage.setItem(getInProgressSurveyStateKey(survey), JSON.stringify(state))\n } catch (e) {\n logger.error('Error setting in-progress survey state in localStorage', e)\n }\n}\n\nexport const getInProgressSurveyState = (\n survey: Pick<Survey, 'id' | 'current_iteration'>\n): InProgressSurveyState | null => {\n try {\n const stateString = localStorage.getItem(getInProgressSurveyStateKey(survey))\n if (stateString) {\n return JSON.parse(stateString) as InProgressSurveyState\n }\n } catch (e) {\n logger.error('Error getting in-progress survey state from localStorage', e)\n }\n return null\n}\n\nexport const isSurveyInProgress = (survey: Pick<Survey, 'id' | 'current_iteration'>): boolean => {\n const state = getInProgressSurveyState(survey)\n return !isNullish(state?.surveySubmissionId)\n}\n\nexport const clearInProgressSurveyState = (survey: Pick<Survey, 'id' | 'current_iteration'>): void => {\n try {\n localStorage.removeItem(getInProgressSurveyStateKey(survey))\n } catch (e) {\n logger.error('Error clearing in-progress survey state from localStorage', e)\n }\n}\n\nexport function getSurveyContainerClass(survey: Pick<Survey, 'id'>, asSelector = false): string {\n const className = `PostHogSurvey-${survey.id}`\n return asSelector ? `.${className}` : className\n}\n"]}
|
|
@@ -10,6 +10,7 @@ export interface JSONContent {
|
|
|
10
10
|
}[];
|
|
11
11
|
text?: string;
|
|
12
12
|
}
|
|
13
|
+
export type ProductTourStepType = 'element' | 'modal' | 'survey';
|
|
13
14
|
export type ProductTourSurveyQuestionType = 'open' | 'rating';
|
|
14
15
|
export interface ProductTourSurveyQuestion {
|
|
15
16
|
type: ProductTourSurveyQuestionType;
|
|
@@ -25,6 +26,7 @@ export interface ProductTourSurveyQuestion {
|
|
|
25
26
|
}
|
|
26
27
|
export interface ProductTourStep {
|
|
27
28
|
id: string;
|
|
29
|
+
type: ProductTourStepType;
|
|
28
30
|
selector?: string;
|
|
29
31
|
progressionTrigger: 'button' | 'click';
|
|
30
32
|
content: JSONContent | null;
|
|
@@ -54,9 +56,12 @@ export interface ProductTourAppearance {
|
|
|
54
56
|
backgroundColor?: string;
|
|
55
57
|
textColor?: string;
|
|
56
58
|
buttonColor?: string;
|
|
57
|
-
buttonTextColor?: string;
|
|
58
59
|
borderRadius?: number;
|
|
60
|
+
buttonBorderRadius?: number;
|
|
59
61
|
borderColor?: string;
|
|
62
|
+
fontFamily?: string;
|
|
63
|
+
boxShadow?: string;
|
|
64
|
+
showOverlay?: boolean;
|
|
60
65
|
whiteLabel?: boolean;
|
|
61
66
|
}
|
|
62
67
|
export interface ProductTour {
|
|
@@ -5,9 +5,12 @@ exports.DEFAULT_PRODUCT_TOUR_APPEARANCE = {
|
|
|
5
5
|
backgroundColor: '#ffffff',
|
|
6
6
|
textColor: '#1d1f27',
|
|
7
7
|
buttonColor: '#1d1f27',
|
|
8
|
-
buttonTextColor: '#ffffff',
|
|
9
8
|
borderRadius: 8,
|
|
9
|
+
buttonBorderRadius: 6,
|
|
10
10
|
borderColor: '#e5e7eb',
|
|
11
|
+
fontFamily: 'system-ui',
|
|
12
|
+
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
|
|
13
|
+
showOverlay: true,
|
|
11
14
|
whiteLabel: false,
|
|
12
15
|
};
|
|
13
16
|
//# sourceMappingURL=posthog-product-tours-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posthog-product-tours-types.js","sourceRoot":"","sources":["../../src/posthog-product-tours-types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"posthog-product-tours-types.js","sourceRoot":"","sources":["../../src/posthog-product-tours-types.ts"],"names":[],"mappings":";;;AAmGa,QAAA,+BAA+B,GAAoC;IAC5E,eAAe,EAAE,SAAS;IAC1B,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,SAAS;IACtB,YAAY,EAAE,CAAC;IACf,kBAAkB,EAAE,CAAC;IACrB,WAAW,EAAE,SAAS;IACtB,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,gCAAgC;IAC3C,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,KAAK;CACpB,CAAA","sourcesContent":["import { PropertyMatchType } from './types'\nimport { SurveyActionType, SurveyEventWithFilters } from './posthog-surveys-types'\n\nexport interface JSONContent {\n type?: string\n attrs?: Record<string, any>\n content?: JSONContent[]\n marks?: { type: string; attrs?: Record<string, any> }[]\n text?: string\n}\n\nexport type ProductTourStepType = 'element' | 'modal' | 'survey'\n\nexport type ProductTourSurveyQuestionType = 'open' | 'rating'\n\nexport interface ProductTourSurveyQuestion {\n type: ProductTourSurveyQuestionType\n questionText: string\n /** Rating display type - emoji or number */\n display?: 'emoji' | 'number'\n /** Rating scale - 3 or 5 for emoji, 5 or 10 for number */\n scale?: 3 | 5 | 10\n /** Label for low end of rating scale (e.g., \"Not likely\") */\n lowerBoundLabel?: string\n /** Label for high end of rating scale (e.g., \"Very likely\") */\n upperBoundLabel?: string\n}\n\nexport interface ProductTourStep {\n id: string\n type: ProductTourStepType\n selector?: string\n progressionTrigger: 'button' | 'click'\n content: JSONContent | null\n /** Inline survey question config - if present, this is a survey step */\n survey?: ProductTourSurveyQuestion\n /** ID of the auto-created survey for this step (set by backend) */\n linkedSurveyId?: string\n /** ID of the survey question (set by backend, used for event tracking) */\n linkedSurveyQuestionId?: string\n}\n\nexport interface ProductTourConditions {\n url?: string\n urlMatchType?: PropertyMatchType\n selector?: string\n autoShowDelaySeconds?: number\n events?: {\n values: SurveyEventWithFilters[]\n } | null\n cancelEvents?: {\n values: SurveyEventWithFilters[]\n } | null\n actions?: {\n values: SurveyActionType[]\n } | null\n}\n\nexport interface ProductTourAppearance {\n backgroundColor?: string\n textColor?: string\n buttonColor?: string\n borderRadius?: number\n buttonBorderRadius?: number\n borderColor?: string\n fontFamily?: string\n boxShadow?: string\n showOverlay?: boolean\n whiteLabel?: boolean\n}\n\nexport interface ProductTour {\n id: string\n name: string\n description?: string\n type: 'product_tour'\n auto_launch?: boolean\n start_date: string | null\n end_date: string | null\n current_iteration?: number\n conditions?: ProductTourConditions\n appearance?: ProductTourAppearance\n steps: ProductTourStep[]\n internal_targeting_flag_key?: string\n linked_flag_key?: string\n}\n\nexport type ProductTourCallback = (tours: ProductTour[], context?: { isLoaded: boolean; error?: string }) => void\n\nexport type ProductTourSelectorError = 'not_found' | 'multiple_matches' | 'not_visible'\n\nexport type ProductTourDismissReason =\n | 'user_clicked_skip'\n | 'user_clicked_outside'\n | 'escape_key'\n | 'element_unavailable'\n\nexport type ProductTourRenderReason = 'auto' | 'api' | 'trigger' | 'event'\n\nexport const DEFAULT_PRODUCT_TOUR_APPEARANCE: Required<ProductTourAppearance> = {\n backgroundColor: '#ffffff',\n textColor: '#1d1f27',\n buttonColor: '#1d1f27',\n borderRadius: 8,\n buttonBorderRadius: 6,\n borderColor: '#e5e7eb',\n fontFamily: 'system-ui',\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n showOverlay: true,\n whiteLabel: false,\n}\n\nexport interface ShowTourOptions {\n reason?: ProductTourRenderReason\n enableStrictValidation?: boolean\n}\n"]}
|
package/lib/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/autocapture-utils.ts","../src/autocapture.ts","../src/config.ts","../src/consent.ts","../src/constants.ts","../src/declaration.d.ts","../src/heatmaps.ts","../src/page-view.ts","../src/posthog-conversations-types.ts","../src/posthog-core.ts","../src/posthog-exceptions.ts","../src/posthog-featureflags.ts","../src/posthog-persistence.ts","../src/posthog-product-tours-types.ts","../src/posthog-product-tours.ts","../src/posthog-surveys-types.ts","../src/posthog-surveys.ts","../src/rate-limiter.ts","../src/remote-config.ts","../src/request-queue.ts","../src/request.ts","../src/retry-queue.ts","../src/scroll-manager.ts","../src/session-props.ts","../src/sessionid.ts","../src/site-apps.ts","../src/storage.ts","../src/types.ts","../src/uuidv7.ts","../src/web-experiments-types.ts","../src/web-experiments.ts","../src/web-types.d.ts","../src/customizations/before-send.ts","../src/customizations/index.ts","../src/customizations/posthogReduxLogger.ts","../src/customizations/setAllPersonProfilePropertiesAsPersonPropertiesForFlags.ts","../src/entrypoints/all-external-dependencies.ts","../src/entrypoints/array.full.es5.ts","../src/entrypoints/array.full.no-external.ts","../src/entrypoints/array.full.ts","../src/entrypoints/array.no-external.ts","../src/entrypoints/array.ts","../src/entrypoints/conversations.ts","../src/entrypoints/crisp-chat-integration.ts","../src/entrypoints/customizations.full.ts","../src/entrypoints/dead-clicks-autocapture.ts","../src/entrypoints/exception-autocapture.ts","../src/entrypoints/external-scripts-loader.ts","../src/entrypoints/intercom-integration.ts","../src/entrypoints/lazy-recorder.ts","../src/entrypoints/main.cjs.ts","../src/entrypoints/module.es.ts","../src/entrypoints/module.full.es.ts","../src/entrypoints/module.full.no-external.es.ts","../src/entrypoints/module.no-external.es.ts","../src/entrypoints/posthog-recorder.ts","../src/entrypoints/product-tours.ts","../src/entrypoints/recorder-v2.ts","../src/entrypoints/recorder.ts","../src/entrypoints/surveys-preview.es.ts","../src/entrypoints/surveys.ts","../src/entrypoints/tracing-headers.ts","../src/entrypoints/web-vitals.ts","../src/extensions/dead-clicks-autocapture.ts","../src/extensions/external-integration.ts","../src/extensions/history-autocapture.ts","../src/extensions/rageclick.ts","../src/extensions/sampling.ts","../src/extensions/segment-integration.ts","../src/extensions/sentry-integration.ts","../src/extensions/surveys.tsx","../src/extensions/toolbar.ts","../src/extensions/tracing-headers.ts","../src/extensions/conversations/posthog-conversations.ts","../src/extensions/conversations/external/index.tsx","../src/extensions/conversations/external/persistence.ts","../src/extensions/conversations/external/components/CloseChatButton.tsx","../src/extensions/conversations/external/components/ConversationsWidget.tsx","../src/extensions/conversations/external/components/OpenChatButton.tsx","../src/extensions/conversations/external/components/SendMessageButton.tsx","../src/extensions/conversations/external/components/styles.ts","../src/extensions/exception-autocapture/index.ts","../src/extensions/product-tours/constants.ts","../src/extensions/product-tours/index.ts","../src/extensions/product-tours/product-tours-utils.ts","../src/extensions/product-tours/product-tours.tsx","../src/extensions/product-tours/components/
|
|
1
|
+
{"root":["../src/autocapture-utils.ts","../src/autocapture.ts","../src/config.ts","../src/consent.ts","../src/constants.ts","../src/declaration.d.ts","../src/heatmaps.ts","../src/page-view.ts","../src/posthog-conversations-types.ts","../src/posthog-core.ts","../src/posthog-exceptions.ts","../src/posthog-featureflags.ts","../src/posthog-persistence.ts","../src/posthog-product-tours-types.ts","../src/posthog-product-tours.ts","../src/posthog-surveys-types.ts","../src/posthog-surveys.ts","../src/rate-limiter.ts","../src/remote-config.ts","../src/request-queue.ts","../src/request.ts","../src/retry-queue.ts","../src/scroll-manager.ts","../src/session-props.ts","../src/sessionid.ts","../src/site-apps.ts","../src/storage.ts","../src/types.ts","../src/uuidv7.ts","../src/web-experiments-types.ts","../src/web-experiments.ts","../src/web-types.d.ts","../src/customizations/before-send.ts","../src/customizations/index.ts","../src/customizations/posthogReduxLogger.ts","../src/customizations/setAllPersonProfilePropertiesAsPersonPropertiesForFlags.ts","../src/entrypoints/all-external-dependencies.ts","../src/entrypoints/array.full.es5.ts","../src/entrypoints/array.full.no-external.ts","../src/entrypoints/array.full.ts","../src/entrypoints/array.no-external.ts","../src/entrypoints/array.ts","../src/entrypoints/conversations.ts","../src/entrypoints/crisp-chat-integration.ts","../src/entrypoints/customizations.full.ts","../src/entrypoints/dead-clicks-autocapture.ts","../src/entrypoints/exception-autocapture.ts","../src/entrypoints/external-scripts-loader.ts","../src/entrypoints/intercom-integration.ts","../src/entrypoints/lazy-recorder.ts","../src/entrypoints/main.cjs.ts","../src/entrypoints/module.es.ts","../src/entrypoints/module.full.es.ts","../src/entrypoints/module.full.no-external.es.ts","../src/entrypoints/module.no-external.es.ts","../src/entrypoints/posthog-recorder.ts","../src/entrypoints/product-tours-preview.es.ts","../src/entrypoints/product-tours.ts","../src/entrypoints/recorder-v2.ts","../src/entrypoints/recorder.ts","../src/entrypoints/surveys-preview.es.ts","../src/entrypoints/surveys.ts","../src/entrypoints/tracing-headers.ts","../src/entrypoints/web-vitals.ts","../src/extensions/dead-clicks-autocapture.ts","../src/extensions/external-integration.ts","../src/extensions/history-autocapture.ts","../src/extensions/rageclick.ts","../src/extensions/sampling.ts","../src/extensions/segment-integration.ts","../src/extensions/sentry-integration.ts","../src/extensions/surveys.tsx","../src/extensions/toolbar.ts","../src/extensions/tracing-headers.ts","../src/extensions/conversations/posthog-conversations.ts","../src/extensions/conversations/external/index.tsx","../src/extensions/conversations/external/persistence.ts","../src/extensions/conversations/external/components/CloseChatButton.tsx","../src/extensions/conversations/external/components/ConversationsWidget.tsx","../src/extensions/conversations/external/components/OpenChatButton.tsx","../src/extensions/conversations/external/components/SendMessageButton.tsx","../src/extensions/conversations/external/components/styles.ts","../src/extensions/exception-autocapture/index.ts","../src/extensions/product-tours/constants.ts","../src/extensions/product-tours/index.ts","../src/extensions/product-tours/preview.tsx","../src/extensions/product-tours/product-tours-utils.ts","../src/extensions/product-tours/product-tours.tsx","../src/extensions/product-tours/components/ProductTourSurveyStepInner.tsx","../src/extensions/product-tours/components/ProductTourTooltip.tsx","../src/extensions/product-tours/components/ProductTourTooltipInner.tsx","../src/extensions/replay/session-recording.ts","../src/extensions/replay/external/config.ts","../src/extensions/replay/external/denylist.ts","../src/extensions/replay/external/flushed-size-tracker.ts","../src/extensions/replay/external/lazy-loaded-session-recorder.ts","../src/extensions/replay/external/mutation-throttler.ts","../src/extensions/replay/external/network-plugin.ts","../src/extensions/replay/external/sessionrecording-utils.ts","../src/extensions/replay/external/triggerMatching.ts","../src/extensions/replay/rrweb-plugins/patch.ts","../src/extensions/replay/types/rrweb-types.ts","../src/extensions/replay/types/rrweb.ts","../src/extensions/surveys/action-matcher.ts","../src/extensions/surveys/icons.tsx","../src/extensions/surveys/surveys-extension-utils.tsx","../src/extensions/surveys/components/BottomSection.tsx","../src/extensions/surveys/components/ConfirmationMessage.tsx","../src/extensions/surveys/components/PostHogLogo.tsx","../src/extensions/surveys/components/QuestionHeader.tsx","../src/extensions/surveys/components/QuestionTypes.tsx","../src/extensions/utils/stylesheet-loader.ts","../src/extensions/web-vitals/index.ts","../src/utils/blocked-uas.ts","../src/utils/element-utils.ts","../src/utils/elements-chain-utils.ts","../src/utils/encode-utils.ts","../src/utils/event-receiver.ts","../src/utils/event-utils.ts","../src/utils/globals.ts","../src/utils/index.ts","../src/utils/logger.ts","../src/utils/product-tour-event-receiver.ts","../src/utils/product-tour-utils.ts","../src/utils/property-utils.ts","../src/utils/prototype-utils.ts","../src/utils/regex-utils.ts","../src/utils/request-router.ts","../src/utils/request-utils.ts","../src/utils/simple-event-emitter.ts","../src/utils/survey-event-receiver.ts","../src/utils/survey-url-prefill.ts","../src/utils/survey-utils.ts","../src/utils/type-utils.ts"],"version":"5.8.2"}
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { h } from 'preact';
|
|
2
|
-
import { ProductTour, ProductTourStep, ProductTourDismissReason } from '../../../posthog-product-tours-types';
|
|
3
|
-
export interface ProductTourSurveyStepProps {
|
|
4
|
-
tour: ProductTour;
|
|
5
|
-
step: ProductTourStep;
|
|
6
|
-
stepIndex: number;
|
|
7
|
-
totalSteps: number;
|
|
8
|
-
onSubmit: (response: string | number | null) => void;
|
|
9
|
-
onPrevious: () => void;
|
|
10
|
-
onDismiss: (reason: ProductTourDismissReason) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare function ProductTourSurveyStep({ tour, step, stepIndex, totalSteps, onSubmit, onPrevious, onDismiss, }: ProductTourSurveyStepProps): h.JSX.Element;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { h } from 'preact';
|
|
2
|
-
import { ProductTour, ProductTourStep, ProductTourDismissReason } from '../../../posthog-product-tours-types';
|
|
3
|
-
export interface ProductTourSurveyStepProps {
|
|
4
|
-
tour: ProductTour;
|
|
5
|
-
step: ProductTourStep;
|
|
6
|
-
stepIndex: number;
|
|
7
|
-
totalSteps: number;
|
|
8
|
-
onSubmit: (response: string | number | null) => void;
|
|
9
|
-
onPrevious: () => void;
|
|
10
|
-
onDismiss: (reason: ProductTourDismissReason) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare function ProductTourSurveyStep({ tour, step, stepIndex, totalSteps, onSubmit, onPrevious, onDismiss, }: ProductTourSurveyStepProps): h.JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProductTourSurveyStep.js","sourceRoot":"","sources":["../../../../../src/extensions/product-tours/components/ProductTourSurveyStep.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA8JA,sDA+FC;;AA5PD,sCAA0D;AAO1D,8DAAwD;AACxD,6CAAgE;AAChE,6CAM4B;AAY5B,IAAM,gBAAgB,GAAG,CAAC,yBAAiB,EAAE,oBAAY,EAAE,sBAAc,CAAC,CAAA;AAC1E,IAAM,eAAe,GAAG,CAAC,6BAAqB,EAAE,yBAAiB,EAAE,oBAAY,EAAE,sBAAc,EAAE,0BAAkB,CAAC,CAAA;AAEpH,SAAS,eAAe,CAAC,KAAa;IAClC,QAAQ,KAAK,EAAE,CAAC;QACZ,KA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GACL,EAET,gCAAK,KAAK,EAAC,yBAAyB,YAAE,MAAM,CAAC,YAAY,GAAO,EAE/D,UAAU,CAAC,CAAC,CAAC,CACV,uBAAC,aAAa,IAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAI,CAC1F,CAAC,CAAC,CAAC,CACA,uBAAC,WAAW,IAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAI,CACtD,EAED,iCAAK,KAAK,EAAC,gBAAgB,aACvB,kCAAM,KAAK,EAAC,kBAAkB,aACzB,SAAS,GAAG,CAAC,UAAM,UAAU,IAC3B,EAEP,iCAAK,KAAK,EAAC,iBAAiB,aACvB,CAAC,WAAW,IAAI,CACb,mCAAQ,KAAK,EAAC,0CAA0C,EAAC,OAAO,EAAE,UAAU,qBAEnE,CACZ,EACA,UAAU,IAAI,CACX,mCAAQ,KAAK,EAAC,wCAAwC,EAAC,OAAO,EAAE,gBAAgB,uBAEvE,CACZ,IACC,IACJ,EAEL,CAAC,UAAU,CAAC,UAAU,IAAI,CACvB,+BACI,IAAI,EAAC,mCAAmC,EACxC,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,KAAK,EAAC,kBAAkB,2BAEb,uBAAe,IAC1B,CACP,IACC,IACJ,CACT,CAAA;AACL,CAAC","sourcesContent":["import { h } from 'preact'\nimport { useState, useRef, useEffect } from 'preact/hooks'\nimport {\n ProductTour,\n ProductTourStep,\n ProductTourDismissReason,\n ProductTourSurveyQuestion,\n} from '../../../posthog-product-tours-types'\nimport { mergeAppearance } from '../product-tours-utils'\nimport { cancelSVG, IconPosthogLogo } from '../../surveys/icons'\nimport {\n dissatisfiedEmoji,\n neutralEmoji,\n satisfiedEmoji,\n veryDissatisfiedEmoji,\n verySatisfiedEmoji,\n} from '../../surveys/icons'\n\nexport interface ProductTourSurveyStepProps {\n tour: ProductTour\n step: ProductTourStep\n stepIndex: number\n totalSteps: number\n onSubmit: (response: string | number | null) => void\n onPrevious: () => void\n onDismiss: (reason: ProductTourDismissReason) => void\n}\n\nconst threeScaleEmojis = [dissatisfiedEmoji, neutralEmoji, satisfiedEmoji]\nconst fiveScaleEmojis = [veryDissatisfiedEmoji, dissatisfiedEmoji, neutralEmoji, satisfiedEmoji, verySatisfiedEmoji]\n\nfunction getScaleNumbers(scale: number): number[] {\n switch (scale) {\n case 5:\n return [1, 2, 3, 4, 5]\n case 10:\n return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n default:\n return [1, 2, 3, 4, 5]\n }\n}\n\nfunction OpenTextInput({\n value,\n onChange,\n onSubmit,\n}: {\n value: string\n onChange: (text: string) => void\n onSubmit: () => void\n}): h.JSX.Element {\n const inputRef = useRef<HTMLTextAreaElement>(null)\n\n useEffect(() => {\n setTimeout(() => inputRef.current?.focus(), 100)\n }, [])\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Enter' && e.metaKey) {\n e.preventDefault()\n onSubmit()\n }\n }\n\n return (\n <textarea\n ref={inputRef}\n class=\"ph-tour-survey-textarea\"\n rows={3}\n placeholder=\"Your feedback (optional)...\"\n value={value}\n onInput={(e) => onChange((e.target as HTMLTextAreaElement).value)}\n onKeyDown={handleKeyDown}\n />\n )\n}\n\nfunction RatingInput({\n survey,\n onSubmit,\n}: {\n survey: ProductTourSurveyQuestion\n onSubmit: (rating: number) => void\n}): h.JSX.Element {\n const [selectedRating, setSelectedRating] = useState<number | null>(null)\n const display = survey.display || 'emoji'\n const scale = survey.scale || 5\n\n const handleSelect = (rating: number) => {\n setSelectedRating(rating)\n // Auto-submit on selection for ratings\n onSubmit(rating)\n }\n\n if (display === 'emoji') {\n const emojis = scale === 3 ? threeScaleEmojis : fiveScaleEmojis\n return (\n <div class=\"ph-tour-survey-rating-container\">\n <div class=\"ph-tour-survey-rating-emoji\">\n {emojis.map((emoji, idx) => {\n const rating = idx + 1\n const isActive = selectedRating === rating\n return (\n <button\n key={idx}\n type=\"button\"\n class={`ph-tour-survey-emoji-button ${isActive ? 'ph-tour-survey-emoji-button--active' : ''}`}\n onClick={() => handleSelect(rating)}\n aria-label={`Rate ${rating}`}\n >\n {emoji}\n </button>\n )\n })}\n </div>\n {(survey.lowerBoundLabel || survey.upperBoundLabel) && (\n <div class=\"ph-tour-survey-rating-labels\">\n <span>{survey.lowerBoundLabel}</span>\n <span>{survey.upperBoundLabel}</span>\n </div>\n )}\n </div>\n )\n }\n\n // Number display\n const numbers = getScaleNumbers(scale)\n return (\n <div class=\"ph-tour-survey-rating-container\">\n <div\n class=\"ph-tour-survey-rating-numbers\"\n style={{ gridTemplateColumns: `repeat(${numbers.length}, minmax(0, 1fr))` }}\n >\n {numbers.map((num) => {\n const isActive = selectedRating === num\n return (\n <button\n key={num}\n type=\"button\"\n class={`ph-tour-survey-number-button ${isActive ? 'ph-tour-survey-number-button--active' : ''}`}\n onClick={() => handleSelect(num)}\n aria-label={`Rate ${num}`}\n >\n {num}\n </button>\n )\n })}\n </div>\n {(survey.lowerBoundLabel || survey.upperBoundLabel) && (\n <div class=\"ph-tour-survey-rating-labels\">\n <span>{survey.lowerBoundLabel}</span>\n <span>{survey.upperBoundLabel}</span>\n </div>\n )}\n </div>\n )\n}\n\nexport function ProductTourSurveyStep({\n tour,\n step,\n stepIndex,\n totalSteps,\n onSubmit,\n onPrevious,\n onDismiss,\n}: ProductTourSurveyStepProps): h.JSX.Element {\n const [textValue, setTextValue] = useState('')\n const appearance = mergeAppearance(tour.appearance)\n const survey = step.survey\n const isFirstStep = stepIndex === 0\n const isOpenText = survey?.type === 'open'\n\n const handleTextSubmit = () => {\n onSubmit(textValue.trim() || null)\n }\n\n if (!survey) {\n return <div />\n }\n\n const handleOverlayClick = (e: MouseEvent) => {\n e.stopPropagation()\n onDismiss('user_clicked_outside')\n }\n\n const handleCardClick = (e: MouseEvent) => {\n e.stopPropagation()\n }\n\n const containerStyle = {\n '--ph-tour-background-color': appearance.backgroundColor,\n '--ph-tour-text-color': appearance.textColor,\n '--ph-tour-button-color': appearance.buttonColor,\n '--ph-tour-button-text-color': appearance.buttonTextColor,\n '--ph-tour-border-radius': `${appearance.borderRadius}px`,\n '--ph-tour-border-color': appearance.borderColor,\n } as h.JSX.CSSProperties\n\n return (\n <div class=\"ph-tour-container\" style={containerStyle}>\n <div class=\"ph-tour-click-overlay\" onClick={handleOverlayClick} />\n <div class=\"ph-tour-modal-overlay\" />\n\n <div class=\"ph-tour-tooltip ph-tour-tooltip--modal ph-tour-survey-step\" onClick={handleCardClick}>\n <button\n class=\"ph-tour-dismiss\"\n onClick={() => onDismiss('user_clicked_skip')}\n aria-label=\"Close survey\"\n >\n {cancelSVG}\n </button>\n\n <div class=\"ph-tour-survey-question\">{survey.questionText}</div>\n\n {isOpenText ? (\n <OpenTextInput value={textValue} onChange={setTextValue} onSubmit={handleTextSubmit} />\n ) : (\n <RatingInput survey={survey} onSubmit={onSubmit} />\n )}\n\n <div class=\"ph-tour-footer\">\n <span class=\"ph-tour-progress\">\n {stepIndex + 1} of {totalSteps}\n </span>\n\n <div class=\"ph-tour-buttons\">\n {!isFirstStep && (\n <button class=\"ph-tour-button ph-tour-button--secondary\" onClick={onPrevious}>\n Back\n </button>\n )}\n {isOpenText && (\n <button class=\"ph-tour-button ph-tour-button--primary\" onClick={handleTextSubmit}>\n Submit\n </button>\n )}\n </div>\n </div>\n\n {!appearance.whiteLabel && (\n <a\n href=\"https://posthog.com/product-tours\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"ph-tour-branding\"\n >\n Survey by {IconPosthogLogo}\n </a>\n )}\n </div>\n </div>\n )\n}\n"]}
|