posthog-js 1.136.4 → 1.136.6

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.
Files changed (42) hide show
  1. package/dist/array.full.js +2 -2
  2. package/dist/array.full.js.map +1 -1
  3. package/dist/array.js +1 -1
  4. package/dist/array.js.map +1 -1
  5. package/dist/es.js +1 -1
  6. package/dist/es.js.map +1 -1
  7. package/dist/lib/src/extensions/replay/sessionrecording.d.ts +2 -2
  8. package/dist/lib/src/extensions/surveys/components/ConfirmationMessage.d.ts +3 -3
  9. package/dist/lib/src/extensions/surveys/components/QuestionTypes.d.ts +8 -12
  10. package/dist/lib/src/extensions/surveys/surveys-utils.d.ts +3 -3
  11. package/dist/lib/src/extensions/surveys.d.ts +3 -5
  12. package/dist/lib/src/posthog-surveys-types.d.ts +1 -1
  13. package/dist/module.d.ts +3 -3
  14. package/dist/module.js +1 -1
  15. package/dist/module.js.map +1 -1
  16. package/dist/surveys-module-previews.js +1 -1
  17. package/dist/surveys-module-previews.js.map +1 -1
  18. package/dist/surveys.js +1 -1
  19. package/dist/surveys.js.map +1 -1
  20. package/lib/package.json +1 -1
  21. package/lib/src/extensions/replay/sessionrecording.d.ts +2 -2
  22. package/lib/src/extensions/replay/sessionrecording.js +33 -37
  23. package/lib/src/extensions/replay/sessionrecording.js.map +1 -1
  24. package/lib/src/extensions/surveys/components/BottomSection.jsx +3 -3
  25. package/lib/src/extensions/surveys/components/BottomSection.jsx.map +1 -1
  26. package/lib/src/extensions/surveys/components/ConfirmationMessage.d.ts +3 -3
  27. package/lib/src/extensions/surveys/components/ConfirmationMessage.jsx +3 -3
  28. package/lib/src/extensions/surveys/components/ConfirmationMessage.jsx.map +1 -1
  29. package/lib/src/extensions/surveys/components/QuestionHeader.jsx +2 -2
  30. package/lib/src/extensions/surveys/components/QuestionHeader.jsx.map +1 -1
  31. package/lib/src/extensions/surveys/components/QuestionTypes.d.ts +8 -12
  32. package/lib/src/extensions/surveys/components/QuestionTypes.jsx +21 -17
  33. package/lib/src/extensions/surveys/components/QuestionTypes.jsx.map +1 -1
  34. package/lib/src/extensions/surveys/surveys-utils.d.ts +3 -3
  35. package/lib/src/extensions/surveys/surveys-utils.jsx +7 -7
  36. package/lib/src/extensions/surveys/surveys-utils.jsx.map +1 -1
  37. package/lib/src/extensions/surveys.d.ts +3 -5
  38. package/lib/src/extensions/surveys.jsx +104 -68
  39. package/lib/src/extensions/surveys.jsx.map +1 -1
  40. package/lib/src/posthog-surveys-types.d.ts +1 -1
  41. package/lib/src/posthog-surveys-types.js.map +1 -1
  42. package/package.json +1 -1
@@ -25,7 +25,7 @@ var __read = (this && this.__read) || function (o, n) {
25
25
  }
26
26
  return ar;
27
27
  };
28
- import { SurveyQuestionType, SurveyType, } from '../posthog-surveys-types';
28
+ import { SurveyQuestionType, SurveyType } from '../posthog-surveys-types';
29
29
  import { window as _window, document as _document } from '../utils/globals';
30
30
  import { style, defaultSurveyAppearance, sendSurveyEvent, createShadow, getContrastingTextColor, SurveyContext, getDisplayOrderQuestions, } from './surveys/surveys-utils';
31
31
  import * as Preact from 'preact';
@@ -92,25 +92,31 @@ export var callSurveys = function (posthog, forceReload) {
92
92
  }
93
93
  if (!localStorage.getItem("seenSurvey_".concat(survey.id))) {
94
94
  var shadow = createShadow(style(survey === null || survey === void 0 ? void 0 : survey.appearance), survey.id);
95
- Preact.render(<Surveys key={'popover-survey'} posthog={posthog} survey={survey}/>, shadow);
95
+ Preact.render(<SurveyPopup key={'popover-survey'} posthog={posthog} survey={survey}/>, shadow);
96
96
  }
97
97
  }
98
98
  });
99
99
  }, forceReload);
100
100
  };
101
- export var renderSurveysPreview = function (survey, root, displayState, previewQuestionIndex) {
101
+ export var renderSurveysPreview = function (survey, parentElement, previewPageIndex) {
102
102
  var _a, _b;
103
103
  var surveyStyleSheet = style(survey.appearance);
104
104
  var styleElement = Object.assign(document.createElement('style'), { innerText: surveyStyleSheet });
105
- root.appendChild(styleElement);
105
+ // Remove previously attached <style>
106
+ Array.from(parentElement.children).forEach(function (child) {
107
+ if (child instanceof HTMLStyleElement) {
108
+ parentElement.removeChild(child);
109
+ }
110
+ });
111
+ parentElement.appendChild(styleElement);
106
112
  var textColor = getContrastingTextColor(((_a = survey.appearance) === null || _a === void 0 ? void 0 : _a.backgroundColor) || defaultSurveyAppearance.backgroundColor || 'white');
107
- Preact.render(<Surveys key={'surveys-render-preview'} survey={survey} readOnly={true} initialDisplayState={displayState} previewQuestionIndex={previewQuestionIndex} style={{
113
+ Preact.render(<SurveyPopup key="surveys-render-preview" survey={survey} style={{
108
114
  position: 'relative',
109
115
  right: 0,
110
116
  borderBottom: "1px solid ".concat((_b = survey.appearance) === null || _b === void 0 ? void 0 : _b.borderColor),
111
117
  borderRadius: 10,
112
118
  color: textColor,
113
- }}/>, root);
119
+ }} previewPageIndex={previewPageIndex}/>, parentElement);
114
120
  };
115
121
  export var renderFeedbackWidgetPreview = function (survey, root) {
116
122
  var _a;
@@ -131,13 +137,24 @@ export function generateSurveys(posthog) {
131
137
  callSurveys(posthog, false);
132
138
  }, 3000);
133
139
  }
134
- export function Surveys(_a) {
135
- var _b, _c, _d;
136
- var survey = _a.survey, posthog = _a.posthog, readOnly = _a.readOnly, style = _a.style, initialDisplayState = _a.initialDisplayState, previewQuestionIndex = _a.previewQuestionIndex;
137
- var _e = __read(useState(initialDisplayState || 'survey'), 2), displayState = _e[0], setDisplayState = _e[1];
140
+ export function SurveyPopup(_a) {
141
+ var _b, _c;
142
+ var survey = _a.survey, posthog = _a.posthog, style = _a.style, previewPageIndex = _a.previewPageIndex;
143
+ var _d = __read(useState(true), 2), isPopupVisible = _d[0], setIsPopupVisible = _d[1];
144
+ var _e = __read(useState(false), 2), isSurveySent = _e[0], setIsSurveySent = _e[1];
145
+ var shouldShowConfirmation = isSurveySent || previewPageIndex === survey.questions.length;
146
+ var isPreviewMode = Number.isInteger(previewPageIndex);
147
+ var confirmationBoxLeftStyle = (style === null || style === void 0 ? void 0 : style.left) && isNumber(style === null || style === void 0 ? void 0 : style.left) ? { left: style.left - 40 } : {};
148
+ // Ensure the popup stays in the same position for the preview
149
+ if (isPreviewMode) {
150
+ style = style || {};
151
+ style.left = 'unset';
152
+ style.right = 'unset';
153
+ style.transform = 'unset';
154
+ }
138
155
  useEffect(function () {
139
156
  var _a;
140
- if (readOnly || !posthog) {
157
+ if (isPreviewMode || !posthog) {
141
158
  return;
142
159
  }
143
160
  window.dispatchEvent(new Event('PHSurveyShown'));
@@ -148,88 +165,107 @@ export function Surveys(_a) {
148
165
  });
149
166
  localStorage.setItem("lastSeenSurveyDate", new Date().toISOString());
150
167
  window.addEventListener('PHSurveyClosed', function () {
151
- setDisplayState('closed');
168
+ setIsPopupVisible(false);
152
169
  });
153
170
  window.addEventListener('PHSurveySent', function () {
154
171
  var _a, _b;
155
172
  if (!((_a = survey.appearance) === null || _a === void 0 ? void 0 : _a.displayThankYouMessage)) {
156
- return setDisplayState('closed');
173
+ return setIsPopupVisible(false);
157
174
  }
158
- setDisplayState('confirmation');
175
+ setIsSurveySent(true);
159
176
  if ((_b = survey.appearance) === null || _b === void 0 ? void 0 : _b.autoDisappear) {
160
177
  setTimeout(function () {
161
- setDisplayState('closed');
178
+ setIsPopupVisible(false);
162
179
  }, 5000);
163
180
  }
164
181
  });
165
182
  }, []);
166
- var confirmationBoxLeftStyle = (style === null || style === void 0 ? void 0 : style.left) && isNumber(style === null || style === void 0 ? void 0 : style.left) ? { left: style.left - 40 } : {};
167
- return (<>
168
- <SurveyContext.Provider value={{
169
- readOnly: !!readOnly,
170
- previewQuestionIndex: previewQuestionIndex !== null && previewQuestionIndex !== void 0 ? previewQuestionIndex : 0,
171
- textColor: getContrastingTextColor(((_b = survey.appearance) === null || _b === void 0 ? void 0 : _b.backgroundColor) || defaultSurveyAppearance.backgroundColor),
183
+ return isPopupVisible ? (<SurveyContext.Provider value={{
184
+ isPreviewMode: isPreviewMode,
185
+ previewPageIndex: previewPageIndex,
186
+ handleCloseSurveyPopup: function () { return closeSurveyPopup(survey, posthog, isPreviewMode); },
172
187
  }}>
173
- {displayState === 'survey' && <Questions survey={survey} posthog={posthog} styleOverrides={style}/>}
174
- {displayState === 'confirmation' && (<ConfirmationMessage confirmationHeader={((_c = survey.appearance) === null || _c === void 0 ? void 0 : _c.thankYouMessageHeader) || 'Thank you!'} confirmationDescription={((_d = survey.appearance) === null || _d === void 0 ? void 0 : _d.thankYouMessageDescription) || ''} appearance={survey.appearance || defaultSurveyAppearance} styleOverrides={__assign(__assign({}, style), confirmationBoxLeftStyle)} onClose={function () { return setDisplayState('closed'); }}/>)}
175
- </SurveyContext.Provider>
176
- </>);
188
+ {!shouldShowConfirmation ? (<Questions survey={survey} posthog={posthog} styleOverrides={style}/>) : (<ConfirmationMessage header={((_b = survey.appearance) === null || _b === void 0 ? void 0 : _b.thankYouMessageHeader) || 'Thank you!'} description={((_c = survey.appearance) === null || _c === void 0 ? void 0 : _c.thankYouMessageDescription) || ''} appearance={survey.appearance || defaultSurveyAppearance} styleOverrides={__assign(__assign({}, style), confirmationBoxLeftStyle)} onClose={function () { return setIsPopupVisible(false); }}/>)}
189
+ </SurveyContext.Provider>) : (<></>);
177
190
  }
178
- var questionTypeMap = function (question, questionIndex, appearance, onSubmit, closeSurveyPopup) {
179
- var _a;
180
- var mapping = (_a = {},
181
- _a[SurveyQuestionType.Open] = (<OpenTextQuestion question={question} appearance={appearance} onSubmit={onSubmit} closeSurveyPopup={closeSurveyPopup}/>),
182
- _a[SurveyQuestionType.Link] = (<LinkQuestion question={question} appearance={appearance} onSubmit={onSubmit} closeSurveyPopup={closeSurveyPopup}/>),
183
- _a[SurveyQuestionType.Rating] = (<RatingQuestion question={question} appearance={appearance} questionIndex={questionIndex} onSubmit={onSubmit} closeSurveyPopup={closeSurveyPopup}/>),
184
- _a[SurveyQuestionType.SingleChoice] = (<MultipleChoiceQuestion question={question} appearance={appearance} questionIndex={questionIndex} onSubmit={onSubmit} closeSurveyPopup={closeSurveyPopup}/>),
185
- _a[SurveyQuestionType.MultipleChoice] = (<MultipleChoiceQuestion question={question} appearance={appearance} questionIndex={questionIndex} onSubmit={onSubmit} closeSurveyPopup={closeSurveyPopup}/>),
186
- _a);
187
- return mapping[question.type];
191
+ var getQuestionComponent = function (_a) {
192
+ var _b, _c;
193
+ var question = _a.question, displayQuestionIndex = _a.displayQuestionIndex, appearance = _a.appearance, onSubmit = _a.onSubmit;
194
+ var questionComponents = (_b = {},
195
+ _b[SurveyQuestionType.Open] = OpenTextQuestion,
196
+ _b[SurveyQuestionType.Link] = LinkQuestion,
197
+ _b[SurveyQuestionType.Rating] = RatingQuestion,
198
+ _b[SurveyQuestionType.SingleChoice] = MultipleChoiceQuestion,
199
+ _b[SurveyQuestionType.MultipleChoice] = MultipleChoiceQuestion,
200
+ _b);
201
+ var commonProps = {
202
+ question: question,
203
+ appearance: appearance,
204
+ onSubmit: onSubmit,
205
+ };
206
+ var additionalProps = (_c = {},
207
+ _c[SurveyQuestionType.Open] = {},
208
+ _c[SurveyQuestionType.Link] = {},
209
+ _c[SurveyQuestionType.Rating] = { displayQuestionIndex: displayQuestionIndex },
210
+ _c[SurveyQuestionType.SingleChoice] = { displayQuestionIndex: displayQuestionIndex },
211
+ _c[SurveyQuestionType.MultipleChoice] = { displayQuestionIndex: displayQuestionIndex },
212
+ _c);
213
+ var Component = questionComponents[question.type];
214
+ var componentProps = __assign(__assign({}, commonProps), additionalProps[question.type]);
215
+ return <Component {...componentProps}/>;
188
216
  };
189
217
  export function Questions(_a) {
190
- var _b, _c, _d, _e;
218
+ var _b, _c;
191
219
  var survey = _a.survey, posthog = _a.posthog, styleOverrides = _a.styleOverrides;
192
220
  var textColor = getContrastingTextColor(((_b = survey.appearance) === null || _b === void 0 ? void 0 : _b.backgroundColor) || defaultSurveyAppearance.backgroundColor);
193
- var _f = __read(useState({}), 2), questionsResponses = _f[0], setQuestionsResponses = _f[1];
194
- var _g = useContext(SurveyContext), readOnly = _g.readOnly, previewQuestionIndex = _g.previewQuestionIndex;
195
- var _h = __read(useState(readOnly ? previewQuestionIndex : 0), 2), currentQuestion = _h[0], setCurrentQuestion = _h[1];
221
+ var _d = __read(useState({}), 2), questionsResponses = _d[0], setQuestionsResponses = _d[1];
222
+ var _e = useContext(SurveyContext), isPreviewMode = _e.isPreviewMode, previewPageIndex = _e.previewPageIndex;
223
+ var _f = __read(useState(previewPageIndex || 0), 2), currentQuestionIndex = _f[0], setCurrentQuestionIndex = _f[1];
196
224
  var surveyQuestions = useMemo(function () { return getDisplayOrderQuestions(survey); }, [survey]);
197
- var onNextClick = function (res, idx) {
198
- var _a, _b;
199
- var responseKey = idx === 0 ? "$survey_response" : "$survey_response_".concat(idx);
200
- if (idx === survey.questions.length - 1) {
201
- return sendSurveyEvent(__assign(__assign({}, questionsResponses), (_a = {}, _a[responseKey] = res, _a)), survey, posthog);
225
+ // Sync preview state
226
+ useEffect(function () {
227
+ setCurrentQuestionIndex(previewPageIndex !== null && previewPageIndex !== void 0 ? previewPageIndex : 0);
228
+ }, [previewPageIndex]);
229
+ var onNextButtonClick = function (_a) {
230
+ var _b, _c;
231
+ var res = _a.res, originalQuestionIndex = _a.originalQuestionIndex, displayQuestionIndex = _a.displayQuestionIndex;
232
+ var isLastDisplayedQuestion = displayQuestionIndex === survey.questions.length - 1;
233
+ var responseKey = originalQuestionIndex === 0 ? "$survey_response" : "$survey_response_".concat(originalQuestionIndex);
234
+ if (isLastDisplayedQuestion) {
235
+ return sendSurveyEvent(__assign(__assign({}, questionsResponses), (_b = {}, _b[responseKey] = res, _b)), survey, posthog);
202
236
  }
203
237
  else {
204
- setQuestionsResponses(__assign(__assign({}, questionsResponses), (_b = {}, _b[responseKey] = res, _b)));
205
- setCurrentQuestion(idx + 1);
238
+ setQuestionsResponses(__assign(__assign({}, questionsResponses), (_c = {}, _c[responseKey] = res, _c)));
239
+ setCurrentQuestionIndex(displayQuestionIndex + 1);
206
240
  }
207
241
  };
208
- var questionToDisplay = readOnly ? previewQuestionIndex : currentQuestion;
209
- var hasMultipleQuestions = survey.questions.length > 1;
210
- var isPreviewThankYouMessage = readOnly && questionToDisplay === survey.questions.length;
211
- return (<form
212
- // TODO: BEMify classes
213
- className="survey-form" style={__assign(__assign({ color: textColor, borderColor: (_c = survey.appearance) === null || _c === void 0 ? void 0 : _c.borderColor }, styleOverrides), (isPreviewThankYouMessage ? { border: 'none', borderBottom: 'solid 1px rgb(201, 198, 198)' } : {}))}>
214
- {isPreviewThankYouMessage ? (<ConfirmationMessage confirmationHeader={((_d = survey.appearance) === null || _d === void 0 ? void 0 : _d.thankYouMessageHeader) || 'Thank you!'} confirmationDescription={((_e = survey.appearance) === null || _e === void 0 ? void 0 : _e.thankYouMessageDescription) || ''} appearance={survey.appearance || defaultSurveyAppearance} styleOverrides={__assign(__assign({}, style), { position: 'relative', right: '0px', borderRadius: '10px', border: 'solid 1px rgb(201, 198, 198)' })} onClose={function () { }}/>) : (<>
215
- {surveyQuestions.map(function (question, idx) {
216
- if (hasMultipleQuestions) {
217
- return (<>
218
- {questionToDisplay === idx && (<div className={"tab question-".concat(idx, " ").concat(question.type)}>
219
- {questionTypeMap(question, idx, survey.appearance || defaultSurveyAppearance, function (res) { return onNextClick(res, question.questionIndex || idx); }, function () { return closeSurveyPopup(survey, posthog, readOnly); })}
220
- </div>)}
221
- </>);
222
- }
223
- return questionTypeMap(surveyQuestions[idx], idx, survey.appearance || defaultSurveyAppearance, function (res) { return onNextClick(res, idx); }, function () { return closeSurveyPopup(survey, posthog, readOnly); });
224
- })}
225
- </>)}
242
+ return (<form className="survey-form" style={__assign({ color: textColor, borderColor: (_c = survey.appearance) === null || _c === void 0 ? void 0 : _c.borderColor }, styleOverrides)}>
243
+ {surveyQuestions.map(function (question, displayQuestionIndex) {
244
+ var originalQuestionIndex = question.originalQuestionIndex;
245
+ var isVisible = isPreviewMode
246
+ ? currentQuestionIndex === originalQuestionIndex
247
+ : currentQuestionIndex === displayQuestionIndex;
248
+ return (isVisible && (<div>
249
+ {getQuestionComponent({
250
+ question: question,
251
+ displayQuestionIndex: displayQuestionIndex,
252
+ appearance: survey.appearance || defaultSurveyAppearance,
253
+ onSubmit: function (res) {
254
+ return onNextButtonClick({
255
+ res: res,
256
+ originalQuestionIndex: originalQuestionIndex,
257
+ displayQuestionIndex: displayQuestionIndex,
258
+ });
259
+ },
260
+ })}
261
+ </div>));
262
+ })}
226
263
  </form>);
227
264
  }
228
- var closeSurveyPopup = function (survey, posthog, readOnly) {
265
+ var closeSurveyPopup = function (survey, posthog, isPreviewMode) {
229
266
  var _a;
230
267
  var _b;
231
- // TODO: state management and unit tests for this would be nice
232
- if (readOnly || !posthog) {
268
+ if (isPreviewMode || !posthog) {
233
269
  return;
234
270
  }
235
271
  posthog.capture('survey dismissed', {
@@ -280,7 +316,7 @@ export function FeedbackWidget(_a) {
280
316
  <div className="ph-survey-widget-tab-icon"></div>
281
317
  {((_c = survey.appearance) === null || _c === void 0 ? void 0 : _c.widgetLabel) || ''}
282
318
  </div>)}
283
- {showSurvey && (<Surveys key={'feedback-widget-survey'} posthog={posthog} survey={survey} style={styleOverrides}/>)}
319
+ {showSurvey && (<SurveyPopup key={'feedback-widget-survey'} posthog={posthog} survey={survey} style={styleOverrides}/>)}
284
320
  </>);
285
321
  }
286
322
  //# sourceMappingURL=surveys.jsx.map
@@ -1 +1 @@
1
- {"version":3,"file":"surveys.jsx","sourceRoot":"","sources":["../../../src/extensions/surveys.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAQH,kBAAkB,EAClB,UAAU,GACb,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC3E,OAAO,EACH,KAAK,EACL,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,uBAAuB,EACvB,aAAa,EACb,wBAAwB,GAC3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,MAAM,MAAM,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,UAAU,CAAC,CAAA;YAC9B,CAAC,CAAC,CAAA;YACF,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAA;SAC9D;IACL,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CACH,EACI;YAAA,CAAC,CAAA,MAAA,MAAM,CAAC,UAAU,0CAAE,UAAU,MAAK,KAAK,IAAI,CACxC,CAAC,GAAG,CACA,SAAS,CAAC,sBAAsB,CAChC,GAAG,CAAC,CAAC,SAAS,CAAC,CACf,OAAO,CAAC,CAAC,cAAM,OAAA,CAAC,QAAQ,IAAI,aAAa,CAAC,CAAC,UAAU,CAAC,EAAvC,CAAuC,CAAC,CACvD,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,uBAAuB,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAEzE;oBAAA,CAAC,GAAG,CAAC,SAAS,CAAC,2BAA2B,CAAC,EAAE,GAAG,CAChD;oBAAA,CAAC,CAAA,MAAA,MAAM,CAAC,UAAU,0CAAE,WAAW,KAAI,EAAE,CACzC;gBAAA,EAAE,GAAG,CAAC,CACT,CACD;YAAA,CAAC,UAAU,IAAI,CACX,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,EAAG,CACtG,CACL;QAAA,GAAG,CACN,CAAA;AACL,CAAC","sourcesContent":["import { PostHog } from '../posthog-core'\nimport {\n BasicSurveyQuestion,\n LinkSurveyQuestion,\n MultipleSurveyQuestion,\n RatingSurveyQuestion,\n Survey,\n SurveyAppearance,\n SurveyQuestion,\n SurveyQuestionType,\n SurveyType,\n} from '../posthog-surveys-types'\n\nimport { window as _window, document as _document } from '../utils/globals'\nimport {\n style,\n defaultSurveyAppearance,\n sendSurveyEvent,\n createShadow,\n getContrastingTextColor,\n SurveyContext,\n getDisplayOrderQuestions,\n} from './surveys/surveys-utils'\nimport * as Preact from 'preact'\nimport { createWidgetShadow, createWidgetStyle } from './surveys-widget'\nimport { useState, useEffect, useRef, useContext, useMemo } from 'preact/hooks'\nimport { isNumber } from '../utils/type-utils'\nimport { ConfirmationMessage } from './surveys/components/ConfirmationMessage'\nimport {\n OpenTextQuestion,\n LinkQuestion,\n RatingQuestion,\n MultipleChoiceQuestion,\n} from './surveys/components/QuestionTypes'\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\nconst handleWidget = (posthog: PostHog, survey: Survey) => {\n const shadow = createWidgetShadow(survey)\n const surveyStyleSheet = style(survey.appearance)\n shadow.appendChild(Object.assign(document.createElement('style'), { innerText: surveyStyleSheet }))\n Preact.render(<FeedbackWidget key={'feedback-survey'} posthog={posthog} survey={survey} />, shadow)\n}\n\nexport const callSurveys = (posthog: PostHog, forceReload: boolean = false) => {\n posthog?.getActiveMatchingSurveys((surveys) => {\n const nonAPISurveys = surveys.filter((survey) => survey.type !== 'api')\n nonAPISurveys.forEach((survey) => {\n if (survey.type === SurveyType.Widget) {\n if (\n survey.appearance?.widgetType === 'tab' &&\n document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 0\n ) {\n handleWidget(posthog, survey)\n }\n if (survey.appearance?.widgetType === 'selector' && survey.appearance?.widgetSelector) {\n const selectorOnPage = document.querySelector(survey.appearance.widgetSelector)\n if (selectorOnPage) {\n if (document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 0) {\n handleWidget(posthog, 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(`.PostHogWidget${survey.id}`)\n ?.shadowRoot?.querySelector(`.survey-form`) as HTMLFormElement\n selectorOnPage.addEventListener('click', () => {\n if (surveyPopup) {\n surveyPopup.style.display =\n surveyPopup.style.display === 'none' ? 'block' : 'none'\n surveyPopup.addEventListener(\n 'PHSurveyClosed',\n () => (surveyPopup.style.display = 'none')\n )\n }\n })\n selectorOnPage.setAttribute('PHWidgetSurveyClickListener', 'true')\n }\n }\n }\n }\n }\n if (\n survey.type === SurveyType.Popover &&\n document.querySelectorAll(\"div[class^='PostHogSurvey']\").length === 0\n ) {\n const surveyWaitPeriodInDays = survey.conditions?.seenSurveyWaitPeriodInDays\n const lastSeenSurveyDate = localStorage.getItem(`lastSeenSurveyDate`)\n if (surveyWaitPeriodInDays && lastSeenSurveyDate) {\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 if (diffDaysFromToday < surveyWaitPeriodInDays) {\n return\n }\n }\n\n if (!localStorage.getItem(`seenSurvey_${survey.id}`)) {\n const shadow = createShadow(style(survey?.appearance), survey.id)\n Preact.render(<Surveys key={'popover-survey'} posthog={posthog} survey={survey} />, shadow)\n }\n }\n })\n }, forceReload)\n}\n\nexport const renderSurveysPreview = (\n survey: Survey,\n root: HTMLElement,\n displayState: 'survey' | 'confirmation',\n previewQuestionIndex: number\n) => {\n const surveyStyleSheet = style(survey.appearance)\n const styleElement = Object.assign(document.createElement('style'), { innerText: surveyStyleSheet })\n root.appendChild(styleElement)\n const textColor = getContrastingTextColor(\n survey.appearance?.backgroundColor || defaultSurveyAppearance.backgroundColor || 'white'\n )\n\n Preact.render(\n <Surveys\n key={'surveys-render-preview'}\n survey={survey}\n readOnly={true}\n initialDisplayState={displayState}\n previewQuestionIndex={previewQuestionIndex}\n style={{\n position: 'relative',\n right: 0,\n borderBottom: `1px solid ${survey.appearance?.borderColor}`,\n borderRadius: 10,\n color: textColor,\n }}\n />,\n root\n )\n}\n\nexport const renderFeedbackWidgetPreview = (survey: Survey, root: HTMLElement) => {\n const widgetStyleSheet = createWidgetStyle(survey.appearance?.widgetColor)\n const styleElement = Object.assign(document.createElement('style'), { innerText: widgetStyleSheet })\n root.appendChild(styleElement)\n Preact.render(<FeedbackWidget key={'feedback-render-preview'} survey={survey} readOnly={true} />, root)\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 callSurveys(posthog, true)\n\n // recalculate surveys every 3 seconds to check if URL or selectors have changed\n setInterval(() => {\n callSurveys(posthog, false)\n }, 3000)\n}\n\nexport function Surveys({\n survey,\n posthog,\n readOnly,\n style,\n initialDisplayState,\n previewQuestionIndex,\n}: {\n survey: Survey\n posthog?: PostHog\n readOnly?: boolean\n style?: React.CSSProperties\n initialDisplayState?: 'survey' | 'confirmation' | 'closed'\n previewQuestionIndex?: number\n}) {\n const [displayState, setDisplayState] = useState<'survey' | 'confirmation' | 'closed'>(\n initialDisplayState || 'survey'\n )\n\n useEffect(() => {\n if (readOnly || !posthog) {\n return\n }\n\n window.dispatchEvent(new Event('PHSurveyShown'))\n\n posthog.capture('survey shown', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n })\n localStorage.setItem(`lastSeenSurveyDate`, new Date().toISOString())\n\n window.addEventListener('PHSurveyClosed', () => {\n setDisplayState('closed')\n })\n\n window.addEventListener('PHSurveySent', () => {\n if (!survey.appearance?.displayThankYouMessage) {\n return setDisplayState('closed')\n }\n setDisplayState('confirmation')\n if (survey.appearance?.autoDisappear) {\n setTimeout(() => {\n setDisplayState('closed')\n }, 5000)\n }\n })\n }, [])\n const confirmationBoxLeftStyle = style?.left && isNumber(style?.left) ? { left: style.left - 40 } : {}\n\n return (\n <>\n <SurveyContext.Provider\n value={{\n readOnly: !!readOnly,\n previewQuestionIndex: previewQuestionIndex ?? 0,\n textColor: getContrastingTextColor(\n survey.appearance?.backgroundColor || defaultSurveyAppearance.backgroundColor\n ),\n }}\n >\n {displayState === 'survey' && <Questions survey={survey} posthog={posthog} styleOverrides={style} />}\n {displayState === 'confirmation' && (\n <ConfirmationMessage\n confirmationHeader={survey.appearance?.thankYouMessageHeader || 'Thank you!'}\n confirmationDescription={survey.appearance?.thankYouMessageDescription || ''}\n appearance={survey.appearance || defaultSurveyAppearance}\n styleOverrides={{ ...style, ...confirmationBoxLeftStyle }}\n onClose={() => setDisplayState('closed')}\n />\n )}\n </SurveyContext.Provider>\n </>\n )\n}\n\nconst questionTypeMap = (\n question: SurveyQuestion,\n questionIndex: number,\n appearance: SurveyAppearance,\n onSubmit: (res: string | string[] | number | null) => void,\n closeSurveyPopup: () => void\n): JSX.Element => {\n const mapping = {\n [SurveyQuestionType.Open]: (\n <OpenTextQuestion\n question={question as BasicSurveyQuestion}\n appearance={appearance}\n onSubmit={onSubmit}\n closeSurveyPopup={closeSurveyPopup}\n />\n ),\n [SurveyQuestionType.Link]: (\n <LinkQuestion\n question={question as LinkSurveyQuestion}\n appearance={appearance}\n onSubmit={onSubmit}\n closeSurveyPopup={closeSurveyPopup}\n />\n ),\n [SurveyQuestionType.Rating]: (\n <RatingQuestion\n question={question as RatingSurveyQuestion}\n appearance={appearance}\n questionIndex={questionIndex}\n onSubmit={onSubmit}\n closeSurveyPopup={closeSurveyPopup}\n />\n ),\n [SurveyQuestionType.SingleChoice]: (\n <MultipleChoiceQuestion\n question={question as MultipleSurveyQuestion}\n appearance={appearance}\n questionIndex={questionIndex}\n onSubmit={onSubmit}\n closeSurveyPopup={closeSurveyPopup}\n />\n ),\n [SurveyQuestionType.MultipleChoice]: (\n <MultipleChoiceQuestion\n question={question as MultipleSurveyQuestion}\n appearance={appearance}\n questionIndex={questionIndex}\n onSubmit={onSubmit}\n closeSurveyPopup={closeSurveyPopup}\n />\n ),\n }\n return mapping[question.type]\n}\n\nexport function Questions({\n survey,\n posthog,\n styleOverrides,\n}: {\n survey: Survey\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 { readOnly, previewQuestionIndex } = useContext(SurveyContext)\n const [currentQuestion, setCurrentQuestion] = useState(readOnly ? previewQuestionIndex : 0)\n const surveyQuestions = useMemo(() => getDisplayOrderQuestions(survey), [survey])\n\n const onNextClick = (res: string | string[] | number | null, idx: number) => {\n const responseKey = idx === 0 ? `$survey_response` : `$survey_response_${idx}`\n if (idx === survey.questions.length - 1) {\n return sendSurveyEvent({ ...questionsResponses, [responseKey]: res }, survey, posthog)\n } else {\n setQuestionsResponses({ ...questionsResponses, [responseKey]: res })\n setCurrentQuestion(idx + 1)\n }\n }\n\n const questionToDisplay = readOnly ? previewQuestionIndex : currentQuestion\n const hasMultipleQuestions = survey.questions.length > 1\n const isPreviewThankYouMessage = readOnly && questionToDisplay === survey.questions.length\n\n return (\n <form\n // TODO: BEMify classes\n className=\"survey-form\"\n style={{\n color: textColor,\n borderColor: survey.appearance?.borderColor,\n ...styleOverrides,\n ...(isPreviewThankYouMessage ? { border: 'none', borderBottom: 'solid 1px rgb(201, 198, 198)' } : {}),\n }}\n >\n {isPreviewThankYouMessage ? (\n <ConfirmationMessage\n confirmationHeader={survey.appearance?.thankYouMessageHeader || 'Thank you!'}\n confirmationDescription={survey.appearance?.thankYouMessageDescription || ''}\n appearance={survey.appearance || defaultSurveyAppearance}\n styleOverrides={{\n ...style,\n position: 'relative',\n right: '0px',\n borderRadius: '10px',\n border: 'solid 1px rgb(201, 198, 198)',\n }}\n onClose={() => {}}\n />\n ) : (\n <>\n {surveyQuestions.map((question, idx) => {\n if (hasMultipleQuestions) {\n return (\n <>\n {questionToDisplay === idx && (\n <div className={`tab question-${idx} ${question.type}`}>\n {questionTypeMap(\n question,\n idx,\n survey.appearance || defaultSurveyAppearance,\n (res) => onNextClick(res, question.questionIndex || idx),\n () => closeSurveyPopup(survey, posthog, readOnly)\n )}\n </div>\n )}\n </>\n )\n }\n return questionTypeMap(\n surveyQuestions[idx],\n idx,\n survey.appearance || defaultSurveyAppearance,\n (res) => onNextClick(res, idx),\n () => closeSurveyPopup(survey, posthog, readOnly)\n )\n })}\n </>\n )}\n </form>\n )\n}\n\nconst closeSurveyPopup = (survey: Survey, posthog?: PostHog, readOnly?: boolean) => {\n // TODO: state management and unit tests for this would be nice\n if (readOnly || !posthog) {\n return\n }\n posthog.capture('survey dismissed', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n $set: {\n [`$survey_dismissed/${survey.id}`]: true,\n },\n })\n localStorage.setItem(`seenSurvey_${survey.id}`, 'true')\n window.dispatchEvent(new Event('PHSurveyClosed'))\n}\n\nexport function FeedbackWidget({\n survey,\n posthog,\n readOnly,\n}: {\n survey: Survey\n posthog?: PostHog\n readOnly?: boolean\n}): JSX.Element {\n const [showSurvey, setShowSurvey] = useState(false)\n const [styleOverrides, setStyle] = useState({})\n const widgetRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (readOnly || !posthog) {\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 || '')\n widget?.addEventListener('click', () => {\n setShowSurvey(!showSurvey)\n })\n widget?.setAttribute('PHWidgetSurveyClickListener', 'true')\n }\n }, [])\n\n return (\n <>\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 <Surveys key={'feedback-widget-survey'} posthog={posthog} survey={survey} style={styleOverrides} />\n )}\n </>\n )\n}\n"]}
1
+ {"version":3,"file":"surveys.jsx","sourceRoot":"","sources":["../../../src/extensions/surveys.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAA4C,kBAAkB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAEnH,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC3E,OAAO,EACH,KAAK,EACL,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,uBAAuB,EACvB,aAAa,EACb,wBAAwB,GAC3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAA;AAC9E,OAAO,EACH,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,sBAAsB,GACzB,MAAM,oCAAoC,CAAA;AAE3C,gGAAgG;AAChG,IAAM,MAAM,GAAG,OAAqC,CAAA;AACpD,IAAM,QAAQ,GAAG,SAAqB,CAAA;AAEtC,IAAM,YAAY,GAAG,UAAC,OAAgB,EAAE,MAAc;IAClD,IAAM,MAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACzC,IAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IACjD,MAA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ChC,GAAG,CAAC,CAAC,SAAS,CAAC,CACf,OAAO,CAAC,CAAC,cAAM,OAAA,CAAC,QAAQ,IAAI,aAAa,CAAC,CAAC,UAAU,CAAC,EAAvC,CAAuC,CAAC,CACvD,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,uBAAuB,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAEzE;oBAAA,CAAC,GAAG,CAAC,SAAS,CAAC,2BAA2B,CAAC,EAAE,GAAG,CAChD;oBAAA,CAAC,CAAA,MAAA,MAAM,CAAC,UAAU,0CAAE,WAAW,KAAI,EAAE,CACzC;gBAAA,EAAE,GAAG,CAAC,CACT,CACD;YAAA,CAAC,UAAU,IAAI,CACX,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,EAAG,CAC1G,CACL;QAAA,GAAG,CACN,CAAA;AACL,CAAC","sourcesContent":["import { PostHog } from '../posthog-core'\nimport { Survey, SurveyAppearance, SurveyQuestion, SurveyQuestionType, SurveyType } from '../posthog-surveys-types'\n\nimport { window as _window, document as _document } from '../utils/globals'\nimport {\n style,\n defaultSurveyAppearance,\n sendSurveyEvent,\n createShadow,\n getContrastingTextColor,\n SurveyContext,\n getDisplayOrderQuestions,\n} from './surveys/surveys-utils'\nimport * as Preact from 'preact'\nimport { createWidgetShadow, createWidgetStyle } from './surveys-widget'\nimport { useState, useEffect, useRef, useContext, useMemo } from 'preact/hooks'\nimport { isNumber } from '../utils/type-utils'\nimport { ConfirmationMessage } from './surveys/components/ConfirmationMessage'\nimport {\n OpenTextQuestion,\n LinkQuestion,\n RatingQuestion,\n MultipleChoiceQuestion,\n} from './surveys/components/QuestionTypes'\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\nconst handleWidget = (posthog: PostHog, survey: Survey) => {\n const shadow = createWidgetShadow(survey)\n const surveyStyleSheet = style(survey.appearance)\n shadow.appendChild(Object.assign(document.createElement('style'), { innerText: surveyStyleSheet }))\n Preact.render(<FeedbackWidget key={'feedback-survey'} posthog={posthog} survey={survey} />, shadow)\n}\n\nexport const callSurveys = (posthog: PostHog, forceReload: boolean = false) => {\n posthog?.getActiveMatchingSurveys((surveys) => {\n const nonAPISurveys = surveys.filter((survey) => survey.type !== 'api')\n nonAPISurveys.forEach((survey) => {\n if (survey.type === SurveyType.Widget) {\n if (\n survey.appearance?.widgetType === 'tab' &&\n document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 0\n ) {\n handleWidget(posthog, survey)\n }\n if (survey.appearance?.widgetType === 'selector' && survey.appearance?.widgetSelector) {\n const selectorOnPage = document.querySelector(survey.appearance.widgetSelector)\n if (selectorOnPage) {\n if (document.querySelectorAll(`.PostHogWidget${survey.id}`).length === 0) {\n handleWidget(posthog, 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(`.PostHogWidget${survey.id}`)\n ?.shadowRoot?.querySelector(`.survey-form`) as HTMLFormElement\n selectorOnPage.addEventListener('click', () => {\n if (surveyPopup) {\n surveyPopup.style.display =\n surveyPopup.style.display === 'none' ? 'block' : 'none'\n surveyPopup.addEventListener(\n 'PHSurveyClosed',\n () => (surveyPopup.style.display = 'none')\n )\n }\n })\n selectorOnPage.setAttribute('PHWidgetSurveyClickListener', 'true')\n }\n }\n }\n }\n }\n if (\n survey.type === SurveyType.Popover &&\n document.querySelectorAll(\"div[class^='PostHogSurvey']\").length === 0\n ) {\n const surveyWaitPeriodInDays = survey.conditions?.seenSurveyWaitPeriodInDays\n const lastSeenSurveyDate = localStorage.getItem(`lastSeenSurveyDate`)\n if (surveyWaitPeriodInDays && lastSeenSurveyDate) {\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 if (diffDaysFromToday < surveyWaitPeriodInDays) {\n return\n }\n }\n\n if (!localStorage.getItem(`seenSurvey_${survey.id}`)) {\n const shadow = createShadow(style(survey?.appearance), survey.id)\n Preact.render(<SurveyPopup key={'popover-survey'} posthog={posthog} survey={survey} />, shadow)\n }\n }\n })\n }, forceReload)\n}\n\nexport const renderSurveysPreview = (survey: Survey, parentElement: HTMLElement, previewPageIndex: number) => {\n const surveyStyleSheet = style(survey.appearance)\n const styleElement = Object.assign(document.createElement('style'), { innerText: surveyStyleSheet })\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 parentElement.appendChild(styleElement)\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 style={{\n position: 'relative',\n right: 0,\n borderBottom: `1px solid ${survey.appearance?.borderColor}`,\n borderRadius: 10,\n color: textColor,\n }}\n previewPageIndex={previewPageIndex}\n />,\n parentElement\n )\n}\n\nexport const renderFeedbackWidgetPreview = (survey: Survey, root: HTMLElement) => {\n const widgetStyleSheet = createWidgetStyle(survey.appearance?.widgetColor)\n const styleElement = Object.assign(document.createElement('style'), { innerText: widgetStyleSheet })\n root.appendChild(styleElement)\n Preact.render(<FeedbackWidget key={'feedback-render-preview'} survey={survey} readOnly={true} />, root)\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 callSurveys(posthog, true)\n\n // recalculate surveys every 3 seconds to check if URL or selectors have changed\n setInterval(() => {\n callSurveys(posthog, false)\n }, 3000)\n}\n\nexport function SurveyPopup({\n survey,\n posthog,\n style,\n previewPageIndex,\n}: {\n survey: Survey\n posthog?: PostHog\n style?: React.CSSProperties\n previewPageIndex?: number | undefined\n}) {\n const [isPopupVisible, setIsPopupVisible] = useState(true)\n const [isSurveySent, setIsSurveySent] = useState(false)\n const shouldShowConfirmation = isSurveySent || previewPageIndex === survey.questions.length\n const isPreviewMode = Number.isInteger(previewPageIndex)\n const confirmationBoxLeftStyle = style?.left && isNumber(style?.left) ? { left: style.left - 40 } : {}\n\n // Ensure the popup stays in the same position for the preview\n if (isPreviewMode) {\n style = style || {}\n style.left = 'unset'\n style.right = 'unset'\n style.transform = 'unset'\n }\n\n useEffect(() => {\n if (isPreviewMode || !posthog) {\n return\n }\n\n window.dispatchEvent(new Event('PHSurveyShown'))\n posthog.capture('survey shown', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n })\n localStorage.setItem(`lastSeenSurveyDate`, new Date().toISOString())\n\n window.addEventListener('PHSurveyClosed', () => {\n setIsPopupVisible(false)\n })\n window.addEventListener('PHSurveySent', () => {\n if (!survey.appearance?.displayThankYouMessage) {\n return setIsPopupVisible(false)\n }\n\n setIsSurveySent(true)\n\n if (survey.appearance?.autoDisappear) {\n setTimeout(() => {\n setIsPopupVisible(false)\n }, 5000)\n }\n })\n }, [])\n\n return isPopupVisible ? (\n <SurveyContext.Provider\n value={{\n isPreviewMode,\n previewPageIndex: previewPageIndex,\n handleCloseSurveyPopup: () => closeSurveyPopup(survey, posthog, isPreviewMode),\n }}\n >\n {!shouldShowConfirmation ? (\n <Questions survey={survey} posthog={posthog} styleOverrides={style} />\n ) : (\n <ConfirmationMessage\n header={survey.appearance?.thankYouMessageHeader || 'Thank you!'}\n description={survey.appearance?.thankYouMessageDescription || ''}\n appearance={survey.appearance || defaultSurveyAppearance}\n styleOverrides={{ ...style, ...confirmationBoxLeftStyle }}\n onClose={() => setIsPopupVisible(false)}\n />\n )}\n </SurveyContext.Provider>\n ) : (\n <></>\n )\n}\n\ninterface GetQuestionComponentProps {\n question: SurveyQuestion\n displayQuestionIndex: number\n appearance: SurveyAppearance\n onSubmit: (res: string | string[] | number | null) => void\n}\n\nconst getQuestionComponent = ({\n question,\n displayQuestionIndex,\n appearance,\n onSubmit,\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 appearance,\n onSubmit,\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\nexport function Questions({\n survey,\n posthog,\n styleOverrides,\n}: {\n survey: Survey\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 { isPreviewMode, previewPageIndex } = 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 originalQuestionIndex,\n displayQuestionIndex,\n }: {\n res: string | string[] | number | null\n originalQuestionIndex: number\n displayQuestionIndex: number\n }) => {\n const isLastDisplayedQuestion = displayQuestionIndex === survey.questions.length - 1\n\n const responseKey =\n originalQuestionIndex === 0 ? `$survey_response` : `$survey_response_${originalQuestionIndex}`\n\n if (isLastDisplayedQuestion) {\n return sendSurveyEvent({ ...questionsResponses, [responseKey]: res }, survey, posthog)\n } else {\n setQuestionsResponses({ ...questionsResponses, [responseKey]: res })\n setCurrentQuestionIndex(displayQuestionIndex + 1)\n }\n }\n\n return (\n <form\n className=\"survey-form\"\n style={{\n color: textColor,\n borderColor: survey.appearance?.borderColor,\n ...styleOverrides,\n }}\n >\n {surveyQuestions.map((question, displayQuestionIndex) => {\n const { originalQuestionIndex } = question\n\n const isVisible = isPreviewMode\n ? currentQuestionIndex === originalQuestionIndex\n : currentQuestionIndex === displayQuestionIndex\n return (\n isVisible && (\n <div>\n {getQuestionComponent({\n question,\n displayQuestionIndex,\n appearance: survey.appearance || defaultSurveyAppearance,\n onSubmit: (res) =>\n onNextButtonClick({\n res,\n originalQuestionIndex,\n displayQuestionIndex,\n }),\n })}\n </div>\n )\n )\n })}\n </form>\n )\n}\n\nconst closeSurveyPopup = (survey: Survey, posthog?: PostHog, isPreviewMode?: boolean) => {\n if (isPreviewMode || !posthog) {\n return\n }\n posthog.capture('survey dismissed', {\n $survey_name: survey.name,\n $survey_id: survey.id,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n $set: {\n [`$survey_dismissed/${survey.id}`]: true,\n },\n })\n localStorage.setItem(`seenSurvey_${survey.id}`, 'true')\n window.dispatchEvent(new Event('PHSurveyClosed'))\n}\n\nexport function FeedbackWidget({\n survey,\n posthog,\n readOnly,\n}: {\n survey: Survey\n posthog?: PostHog\n readOnly?: boolean\n}): JSX.Element {\n const [showSurvey, setShowSurvey] = useState(false)\n const [styleOverrides, setStyle] = useState({})\n const widgetRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (readOnly || !posthog) {\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 || '')\n widget?.addEventListener('click', () => {\n setShowSurvey(!showSurvey)\n })\n widget?.setAttribute('PHWidgetSurveyClickListener', 'true')\n }\n }, [])\n\n return (\n <>\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 key={'feedback-widget-survey'} posthog={posthog} survey={survey} style={styleOverrides} />\n )}\n </>\n )\n}\n"]}
@@ -39,7 +39,7 @@ interface SurveyQuestionBase {
39
39
  description?: string | null;
40
40
  optional?: boolean;
41
41
  buttonText?: string;
42
- questionIndex?: number;
42
+ originalQuestionIndex: number;
43
43
  }
44
44
  export interface BasicSurveyQuestion extends SurveyQuestionBase {
45
45
  type: SurveyQuestionType.Open;
@@ -1 +1 @@
1
- {"version":3,"file":"posthog-surveys-types.js","sourceRoot":"","sources":["../../src/posthog-surveys-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiCH,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,iCAAmB,CAAA;IACnB,yBAAW,CAAA;IACX,+BAAiB,CAAA;AACrB,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAoCD,MAAM,CAAN,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC1B,mCAAa,CAAA;IACb,wDAAkC,CAAA;IAClC,oDAA8B,CAAA;IAC9B,uCAAiB,CAAA;IACjB,mCAAa,CAAA;AACjB,CAAC,EANW,kBAAkB,KAAlB,kBAAkB,QAM7B","sourcesContent":["/**\n * Having Survey types in types.ts was confusing tsc\n * and generating an invalid module.d.ts\n * See https://github.com/PostHog/posthog-js/issues/698\n */\n\nexport interface SurveyAppearance {\n // keep in sync with frontend/src/types.ts -> SurveyAppearance\n backgroundColor?: string\n submitButtonColor?: string\n // text color is deprecated, use auto contrast text color instead\n textColor?: string\n // deprecate submit button text eventually\n submitButtonText?: string\n descriptionTextColor?: string\n ratingButtonColor?: string\n ratingButtonActiveColor?: string\n ratingButtonHoverColor?: string\n whiteLabel?: boolean\n autoDisappear?: boolean\n displayThankYouMessage?: boolean\n thankYouMessageHeader?: string\n thankYouMessageDescription?: string\n borderColor?: string\n position?: 'left' | 'right' | 'center'\n placeholder?: string\n // widget options\n widgetType?: 'button' | 'tab' | 'selector'\n widgetSelector?: string\n widgetLabel?: string\n widgetColor?: string\n // questionable: Not in frontend/src/types.ts -> SurveyAppearance, but used in site app\n maxWidth?: string\n zIndex?: string\n shuffleQuestions?: boolean\n}\n\nexport enum SurveyType {\n Popover = 'popover',\n API = 'api',\n Widget = 'widget',\n}\n\nexport type SurveyQuestion = BasicSurveyQuestion | LinkSurveyQuestion | RatingSurveyQuestion | MultipleSurveyQuestion\n\ninterface SurveyQuestionBase {\n question: string\n description?: string | null\n optional?: boolean\n buttonText?: string\n questionIndex?: number\n}\n\nexport interface BasicSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.Open\n}\n\nexport interface LinkSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.Link\n link?: string | null\n}\n\nexport interface RatingSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.Rating\n display: 'number' | 'emoji'\n scale: number\n lowerBoundLabel: string\n upperBoundLabel: string\n}\n\nexport interface MultipleSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.SingleChoice | SurveyQuestionType.MultipleChoice\n choices: string[]\n hasOpenChoice?: boolean\n shuffleOptions?: boolean\n}\n\nexport enum SurveyQuestionType {\n Open = 'open',\n MultipleChoice = 'multiple_choice',\n SingleChoice = 'single_choice',\n Rating = 'rating',\n Link = 'link',\n}\n\nexport interface SurveyResponse {\n surveys: Survey[]\n}\n\nexport type SurveyCallback = (surveys: Survey[]) => void\n\nexport type SurveyUrlMatchType = 'regex' | 'exact' | 'icontains'\n\nexport interface Survey {\n // Sync this with the backend's SurveyAPISerializer!\n id: string\n name: string\n description: string\n type: SurveyType\n linked_flag_key: string | null\n targeting_flag_key: string | null\n internal_targeting_flag_key: string | null\n questions: SurveyQuestion[]\n appearance: SurveyAppearance | null\n conditions: {\n url?: string\n selector?: string\n seenSurveyWaitPeriodInDays?: number\n urlMatchType?: SurveyUrlMatchType\n } | null\n start_date: string | null\n end_date: string | null\n}\n"]}
1
+ {"version":3,"file":"posthog-surveys-types.js","sourceRoot":"","sources":["../../src/posthog-surveys-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiCH,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,iCAAmB,CAAA;IACnB,yBAAW,CAAA;IACX,+BAAiB,CAAA;AACrB,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAoCD,MAAM,CAAN,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC1B,mCAAa,CAAA;IACb,wDAAkC,CAAA;IAClC,oDAA8B,CAAA;IAC9B,uCAAiB,CAAA;IACjB,mCAAa,CAAA;AACjB,CAAC,EANW,kBAAkB,KAAlB,kBAAkB,QAM7B","sourcesContent":["/**\n * Having Survey types in types.ts was confusing tsc\n * and generating an invalid module.d.ts\n * See https://github.com/PostHog/posthog-js/issues/698\n */\n\nexport interface SurveyAppearance {\n // keep in sync with frontend/src/types.ts -> SurveyAppearance\n backgroundColor?: string\n submitButtonColor?: string\n // text color is deprecated, use auto contrast text color instead\n textColor?: string\n // deprecate submit button text eventually\n submitButtonText?: string\n descriptionTextColor?: string\n ratingButtonColor?: string\n ratingButtonActiveColor?: string\n ratingButtonHoverColor?: string\n whiteLabel?: boolean\n autoDisappear?: boolean\n displayThankYouMessage?: boolean\n thankYouMessageHeader?: string\n thankYouMessageDescription?: string\n borderColor?: string\n position?: 'left' | 'right' | 'center'\n placeholder?: string\n // widget options\n widgetType?: 'button' | 'tab' | 'selector'\n widgetSelector?: string\n widgetLabel?: string\n widgetColor?: string\n // questionable: Not in frontend/src/types.ts -> SurveyAppearance, but used in site app\n maxWidth?: string\n zIndex?: string\n shuffleQuestions?: boolean\n}\n\nexport enum SurveyType {\n Popover = 'popover',\n API = 'api',\n Widget = 'widget',\n}\n\nexport type SurveyQuestion = BasicSurveyQuestion | LinkSurveyQuestion | RatingSurveyQuestion | MultipleSurveyQuestion\n\ninterface SurveyQuestionBase {\n question: string\n description?: string | null\n optional?: boolean\n buttonText?: string\n originalQuestionIndex: number\n}\n\nexport interface BasicSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.Open\n}\n\nexport interface LinkSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.Link\n link?: string | null\n}\n\nexport interface RatingSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.Rating\n display: 'number' | 'emoji'\n scale: number\n lowerBoundLabel: string\n upperBoundLabel: string\n}\n\nexport interface MultipleSurveyQuestion extends SurveyQuestionBase {\n type: SurveyQuestionType.SingleChoice | SurveyQuestionType.MultipleChoice\n choices: string[]\n hasOpenChoice?: boolean\n shuffleOptions?: boolean\n}\n\nexport enum SurveyQuestionType {\n Open = 'open',\n MultipleChoice = 'multiple_choice',\n SingleChoice = 'single_choice',\n Rating = 'rating',\n Link = 'link',\n}\n\nexport interface SurveyResponse {\n surveys: Survey[]\n}\n\nexport type SurveyCallback = (surveys: Survey[]) => void\n\nexport type SurveyUrlMatchType = 'regex' | 'exact' | 'icontains'\n\nexport interface Survey {\n // Sync this with the backend's SurveyAPISerializer!\n id: string\n name: string\n description: string\n type: SurveyType\n linked_flag_key: string | null\n targeting_flag_key: string | null\n internal_targeting_flag_key: string | null\n questions: SurveyQuestion[]\n appearance: SurveyAppearance | null\n conditions: {\n url?: string\n selector?: string\n seenSurveyWaitPeriodInDays?: number\n urlMatchType?: SurveyUrlMatchType\n } | null\n start_date: string | null\n end_date: string | null\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-js",
3
- "version": "1.136.4",
3
+ "version": "1.136.6",
4
4
  "description": "Posthog-js allows you to automatically capture usage and send events to PostHog.",
5
5
  "repository": "https://github.com/PostHog/posthog-js",
6
6
  "author": "hey@posthog.com",