@posthog/browser-common 0.9.5 → 0.9.7

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 (89) hide show
  1. package/dist/client.d.ts +6 -0
  2. package/dist/config.js +1 -1
  3. package/dist/config.mjs +1 -1
  4. package/dist/feature-flags.d.ts +1 -0
  5. package/dist/feature-flags.js +5 -0
  6. package/dist/feature-flags.mjs +5 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +58 -10
  9. package/dist/index.mjs +1 -0
  10. package/dist/survey-action-matcher.d.ts +27 -0
  11. package/dist/survey-action-matcher.js +169 -0
  12. package/dist/survey-action-matcher.mjs +131 -0
  13. package/dist/survey-constants.d.ts +86 -0
  14. package/dist/survey-constants.js +144 -0
  15. package/dist/survey-constants.mjs +76 -0
  16. package/dist/survey-event-host.d.ts +15 -0
  17. package/dist/survey-event-host.js +18 -0
  18. package/dist/survey-event-host.mjs +1 -0
  19. package/dist/survey-event-receiver-base.d.ts +180 -0
  20. package/dist/survey-event-receiver-base.js +354 -0
  21. package/dist/survey-event-receiver-base.mjs +316 -0
  22. package/dist/survey-event-receiver.d.ts +36 -0
  23. package/dist/survey-event-receiver.js +133 -0
  24. package/dist/survey-event-receiver.mjs +95 -0
  25. package/dist/survey-render-context.d.ts +13 -0
  26. package/dist/survey-render-context.js +45 -0
  27. package/dist/survey-render-context.mjs +7 -0
  28. package/dist/surveys/components/BottomSection.d.ts +12 -0
  29. package/dist/surveys/components/BottomSection.js +82 -0
  30. package/dist/surveys/components/BottomSection.mjs +44 -0
  31. package/dist/surveys/components/ConfirmationMessage.d.ts +10 -0
  32. package/dist/surveys/components/ConfirmationMessage.js +92 -0
  33. package/dist/surveys/components/ConfirmationMessage.mjs +54 -0
  34. package/dist/surveys/components/IntroScreen.d.ts +10 -0
  35. package/dist/surveys/components/IntroScreen.js +78 -0
  36. package/dist/surveys/components/IntroScreen.mjs +40 -0
  37. package/dist/surveys/components/PostHogLogo.d.ts +5 -0
  38. package/dist/surveys/components/PostHogLogo.js +54 -0
  39. package/dist/surveys/components/PostHogLogo.mjs +16 -0
  40. package/dist/surveys/components/QuestionHeader.d.ts +10 -0
  41. package/dist/surveys/components/QuestionHeader.js +82 -0
  42. package/dist/surveys/components/QuestionHeader.mjs +41 -0
  43. package/dist/surveys/components/QuestionTypes.d.ts +31 -0
  44. package/dist/surveys/components/QuestionTypes.js +519 -0
  45. package/dist/surveys/components/QuestionTypes.mjs +469 -0
  46. package/dist/surveys/icons.d.ts +12 -0
  47. package/dist/surveys/icons.js +212 -0
  48. package/dist/surveys/icons.mjs +147 -0
  49. package/dist/surveys/survey-branching.d.ts +12 -0
  50. package/dist/surveys/survey-branching.js +101 -0
  51. package/dist/surveys/survey-branching.mjs +60 -0
  52. package/dist/surveys/survey-styles.d.ts +1 -0
  53. package/dist/surveys/survey-styles.js +40 -0
  54. package/dist/surveys/survey-styles.mjs +2 -0
  55. package/dist/surveys/survey-translations.d.ts +22 -0
  56. package/dist/surveys/survey-translations.js +68 -0
  57. package/dist/surveys/survey-translations.mjs +27 -0
  58. package/dist/surveys/survey-url-prefill.d.ts +36 -0
  59. package/dist/surveys/survey-url-prefill.js +162 -0
  60. package/dist/surveys/survey-url-prefill.mjs +118 -0
  61. package/dist/surveys/surveys-extension-utils.d.ts +133 -0
  62. package/dist/surveys/surveys-extension-utils.js +739 -0
  63. package/dist/surveys/surveys-extension-utils.mjs +608 -0
  64. package/dist/surveys-config.d.ts +60 -0
  65. package/dist/surveys-config.js +68 -0
  66. package/dist/surveys-config.mjs +9 -0
  67. package/dist/surveys-renderer.d.ts +248 -0
  68. package/dist/surveys-renderer.js +1299 -0
  69. package/dist/surveys-renderer.mjs +1230 -0
  70. package/dist/surveys.d.ts +117 -0
  71. package/dist/surveys.js +566 -0
  72. package/dist/surveys.mjs +495 -0
  73. package/dist/types/surveys.d.ts +83 -86
  74. package/dist/types/surveys.js +1 -127
  75. package/dist/types/surveys.mjs +1 -76
  76. package/dist/utils/autocapture-utils.js +8 -9
  77. package/dist/utils/autocapture-utils.mjs +8 -9
  78. package/dist/utils/matcher-utils.d.ts +1 -1
  79. package/dist/utils/matcher-utils.js +13 -10
  80. package/dist/utils/matcher-utils.mjs +10 -7
  81. package/dist/utils/survey-utils.d.ts +16 -0
  82. package/dist/utils/survey-utils.js +121 -0
  83. package/dist/utils/survey-utils.mjs +38 -0
  84. package/dist/utils/url-targeting-utils.d.ts +3 -1
  85. package/dist/utils/url-targeting-utils.js +1 -2
  86. package/dist/utils/url-targeting-utils.mjs +1 -2
  87. package/dist/utils/uuidv7.js +4 -4
  88. package/dist/utils/uuidv7.mjs +4 -4
  89. package/package.json +96 -2
@@ -0,0 +1,469 @@
1
+ import { jsx, jsxs } from "preact/jsx-runtime";
2
+ import { Fragment } from "preact";
3
+ import { useEffect, useMemo, useRef, useState } from "preact/hooks";
4
+ import { SurveyQuestionType } from "../../survey-constants.mjs";
5
+ import { SurveyValidationType, isArray, isNull, isNumber, isString } from "@posthog/core";
6
+ import { getLengthFromRules, getRequirementsHint, getValidationError } from "@posthog/core/surveys";
7
+ import { dissatisfiedEmoji, neutralEmoji, satisfiedEmoji, thumbsDownEmoji, thumbsUpEmoji, veryDissatisfiedEmoji, verySatisfiedEmoji } from "../icons.mjs";
8
+ import { getDisplayOrderChoices, useSurveyContext } from "../surveys-extension-utils.mjs";
9
+ import { BottomSection } from "./BottomSection.mjs";
10
+ import { QuestionHeader } from "./QuestionHeader.mjs";
11
+ const isValidStringArray = (value)=>isArray(value) && value.every((item)=>isString(item));
12
+ const initializeSelectedChoices = (initialValue, questionType)=>{
13
+ if (isString(initialValue)) return initialValue;
14
+ if (isValidStringArray(initialValue)) return initialValue;
15
+ return questionType === SurveyQuestionType.SingleChoice ? null : [];
16
+ };
17
+ const initializeOpenEndedState = (initialValue, choices)=>{
18
+ if (isString(initialValue) && !choices.includes(initialValue)) return {
19
+ isSelected: true,
20
+ inputValue: initialValue
21
+ };
22
+ if (isValidStringArray(initialValue)) {
23
+ const openEndedValue = initialValue.find((choice)=>!choices.includes(choice));
24
+ if (openEndedValue) return {
25
+ isSelected: true,
26
+ inputValue: openEndedValue
27
+ };
28
+ }
29
+ return {
30
+ isSelected: false,
31
+ inputValue: ''
32
+ };
33
+ };
34
+ function OpenTextQuestion({ question, forceDisableHtml, appearance, onSubmit, onPreviewSubmit, displayQuestionIndex, initialValue, canGoBack, onBack }) {
35
+ const { isPreviewMode } = useSurveyContext();
36
+ const inputRef = useRef(null);
37
+ const [text, setText] = useState(()=>{
38
+ if (isString(initialValue)) return initialValue;
39
+ return '';
40
+ });
41
+ const disableAutofocus = appearance?.disableAutofocus;
42
+ useEffect(()=>{
43
+ if (disableAutofocus) return;
44
+ setTimeout(()=>{
45
+ if (!isPreviewMode) inputRef.current?.focus();
46
+ }, 100);
47
+ }, [
48
+ isPreviewMode,
49
+ disableAutofocus
50
+ ]);
51
+ const htmlFor = `surveyQuestion${displayQuestionIndex}`;
52
+ const validationError = useMemo(()=>getValidationError(text, question.validation, question.optional), [
53
+ text,
54
+ question.validation,
55
+ question.optional
56
+ ]);
57
+ const minLength = getLengthFromRules(question.validation, SurveyValidationType.MinLength);
58
+ const maxLength = getLengthFromRules(question.validation, SurveyValidationType.MaxLength);
59
+ const requirementsHint = useMemo(()=>getRequirementsHint(minLength, maxLength), [
60
+ minLength,
61
+ maxLength
62
+ ]);
63
+ const handleSubmit = ()=>{
64
+ if (validationError) return;
65
+ onSubmit(text.trim());
66
+ };
67
+ const handlePreviewSubmit = ()=>{
68
+ if (validationError) return;
69
+ onPreviewSubmit(text.trim());
70
+ };
71
+ return /*#__PURE__*/ jsxs(Fragment, {
72
+ children: [
73
+ /*#__PURE__*/ jsxs("div", {
74
+ className: "question-container",
75
+ children: [
76
+ /*#__PURE__*/ jsx(QuestionHeader, {
77
+ question: question,
78
+ forceDisableHtml: forceDisableHtml,
79
+ htmlFor: htmlFor
80
+ }),
81
+ /*#__PURE__*/ jsx("textarea", {
82
+ ref: inputRef,
83
+ id: htmlFor,
84
+ rows: 4,
85
+ placeholder: appearance?.placeholder,
86
+ minLength: minLength,
87
+ maxLength: maxLength,
88
+ onInput: (e)=>{
89
+ setText(e.currentTarget.value);
90
+ e.stopPropagation();
91
+ },
92
+ onKeyDown: (e)=>{
93
+ e.stopPropagation();
94
+ if ('Enter' === e.key && (e.metaKey || e.ctrlKey) && !validationError) {
95
+ e.preventDefault();
96
+ isPreviewMode ? handlePreviewSubmit() : handleSubmit();
97
+ }
98
+ },
99
+ value: text
100
+ }),
101
+ requirementsHint && /*#__PURE__*/ jsx("div", {
102
+ className: "validation-hint",
103
+ children: requirementsHint
104
+ })
105
+ ]
106
+ }),
107
+ /*#__PURE__*/ jsx(BottomSection, {
108
+ text: question.buttonText || 'Submit',
109
+ submitDisabled: !!validationError,
110
+ appearance: appearance,
111
+ onSubmit: handleSubmit,
112
+ onPreviewSubmit: handlePreviewSubmit,
113
+ canGoBack: canGoBack,
114
+ onBack: onBack
115
+ })
116
+ ]
117
+ });
118
+ }
119
+ function LinkQuestion({ question, forceDisableHtml, appearance, onSubmit, onPreviewSubmit, canGoBack, onBack }) {
120
+ return /*#__PURE__*/ jsxs(Fragment, {
121
+ children: [
122
+ /*#__PURE__*/ jsx("div", {
123
+ className: "question-container",
124
+ children: /*#__PURE__*/ jsx(QuestionHeader, {
125
+ question: question,
126
+ forceDisableHtml: forceDisableHtml
127
+ })
128
+ }),
129
+ /*#__PURE__*/ jsx(BottomSection, {
130
+ text: question.buttonText || 'Submit',
131
+ submitDisabled: false,
132
+ link: question.link,
133
+ appearance: appearance,
134
+ onSubmit: ()=>onSubmit('link clicked'),
135
+ onPreviewSubmit: ()=>onPreviewSubmit('link clicked'),
136
+ canGoBack: canGoBack,
137
+ onBack: onBack
138
+ })
139
+ ]
140
+ });
141
+ }
142
+ function RatingQuestion({ question, forceDisableHtml, displayQuestionIndex, appearance, onSubmit, onPreviewSubmit, initialValue, canGoBack, onBack }) {
143
+ const scale = question.scale;
144
+ const starting = 10 === question.scale ? 0 : 1;
145
+ const [rating, setRating] = useState(()=>{
146
+ if (isNumber(initialValue)) return initialValue;
147
+ if (isArray(initialValue) && initialValue.length > 0 && isNumber(parseInt(initialValue[0]))) return parseInt(initialValue[0]);
148
+ if (isString(initialValue) && isNumber(parseInt(initialValue))) return parseInt(initialValue);
149
+ return null;
150
+ });
151
+ const isThumbSurvey = 'emoji' === question.display && 2 === question.scale;
152
+ const { isPreviewMode } = useSurveyContext();
153
+ const handleSubmit = (num)=>{
154
+ if (isPreviewMode) return onPreviewSubmit(num);
155
+ return onSubmit(num);
156
+ };
157
+ return /*#__PURE__*/ jsxs(Fragment, {
158
+ children: [
159
+ /*#__PURE__*/ jsxs("div", {
160
+ className: "question-container",
161
+ children: [
162
+ /*#__PURE__*/ jsx(QuestionHeader, {
163
+ question: question,
164
+ forceDisableHtml: forceDisableHtml
165
+ }),
166
+ /*#__PURE__*/ jsxs("div", {
167
+ className: "rating-section",
168
+ children: [
169
+ /*#__PURE__*/ jsxs("div", {
170
+ className: "rating-options",
171
+ children: [
172
+ 'emoji' === question.display && /*#__PURE__*/ jsx("div", {
173
+ className: `rating-options-emoji${isThumbSurvey ? ' rating-options-emoji-2' : ''}`,
174
+ children: emojiScaleLists[question.scale]?.map((emoji, idx)=>{
175
+ const active = idx + 1 === rating;
176
+ return /*#__PURE__*/ jsx("button", {
177
+ "aria-label": `Rate ${idx + 1}`,
178
+ className: `ratings-emoji question-${displayQuestionIndex}-rating-${idx} ${active ? 'rating-active' : ''}`,
179
+ value: idx + 1,
180
+ type: "button",
181
+ onClick: ()=>{
182
+ const response = idx + 1;
183
+ setRating(response);
184
+ if (question.skipSubmitButton) handleSubmit(response);
185
+ },
186
+ children: emoji
187
+ }, idx);
188
+ })
189
+ }),
190
+ 'number' === question.display && /*#__PURE__*/ jsx("div", {
191
+ className: "rating-options-number",
192
+ style: {
193
+ gridTemplateColumns: `repeat(${scale - starting + 1}, minmax(0, 1fr))`
194
+ },
195
+ children: getScaleNumbers(question.scale).map((number, idx)=>{
196
+ const active = rating === number;
197
+ return /*#__PURE__*/ jsx(RatingButton, {
198
+ displayQuestionIndex: displayQuestionIndex,
199
+ active: active,
200
+ appearance: appearance,
201
+ num: number,
202
+ setActiveNumber: (response)=>{
203
+ setRating(response);
204
+ if (question.skipSubmitButton) handleSubmit(response);
205
+ }
206
+ }, idx);
207
+ })
208
+ })
209
+ ]
210
+ }),
211
+ !isThumbSurvey && /*#__PURE__*/ jsxs("div", {
212
+ className: "rating-text",
213
+ children: [
214
+ /*#__PURE__*/ jsx("div", {
215
+ children: question.lowerBoundLabel
216
+ }),
217
+ /*#__PURE__*/ jsx("div", {
218
+ children: question.upperBoundLabel
219
+ })
220
+ ]
221
+ })
222
+ ]
223
+ })
224
+ ]
225
+ }),
226
+ /*#__PURE__*/ jsx(BottomSection, {
227
+ text: question.buttonText || appearance?.submitButtonText || 'Submit',
228
+ submitDisabled: isNull(rating) && !question.optional,
229
+ appearance: appearance,
230
+ onSubmit: ()=>onSubmit(rating),
231
+ onPreviewSubmit: ()=>onPreviewSubmit(rating),
232
+ skipSubmitButton: question.skipSubmitButton,
233
+ canGoBack: canGoBack,
234
+ onBack: onBack
235
+ })
236
+ ]
237
+ });
238
+ }
239
+ function RatingButton({ num, active, displayQuestionIndex, setActiveNumber }) {
240
+ return /*#__PURE__*/ jsx("button", {
241
+ "aria-label": `Rate ${num}`,
242
+ className: `ratings-number question-${displayQuestionIndex}-rating-${num} ${active ? 'rating-active' : ''}`,
243
+ type: "button",
244
+ onClick: ()=>{
245
+ setActiveNumber(num);
246
+ },
247
+ children: num
248
+ });
249
+ }
250
+ function MultipleChoiceQuestion({ question, forceDisableHtml, displayQuestionIndex, appearance, onSubmit, onPreviewSubmit, initialValue, canGoBack, onBack }) {
251
+ const openChoiceInputRef = useRef(null);
252
+ const choices = useMemo(()=>getDisplayOrderChoices(question), [
253
+ question
254
+ ]);
255
+ const [selectedChoices, setSelectedChoices] = useState(()=>initializeSelectedChoices(initialValue, question.type));
256
+ const [openEndedState, setOpenEndedState] = useState(()=>initializeOpenEndedState(initialValue, choices));
257
+ const { isPreviewMode } = useSurveyContext();
258
+ const isSingleChoiceQuestion = question.type === SurveyQuestionType.SingleChoice;
259
+ const isMultipleChoiceQuestion = question.type === SurveyQuestionType.MultipleChoice;
260
+ const shouldSkipSubmit = question.skipSubmitButton && isSingleChoiceQuestion && !question.hasOpenChoice;
261
+ const handleChoiceChange = (val, isOpenChoice)=>{
262
+ if (isOpenChoice) {
263
+ const newOpenSelected = !openEndedState.isSelected;
264
+ setOpenEndedState((prev)=>({
265
+ ...prev,
266
+ isSelected: newOpenSelected,
267
+ inputValue: newOpenSelected ? prev.inputValue : ''
268
+ }));
269
+ if (isSingleChoiceQuestion) setSelectedChoices('');
270
+ if (newOpenSelected) setTimeout(()=>openChoiceInputRef.current?.focus(), 75);
271
+ return;
272
+ }
273
+ if (isSingleChoiceQuestion) {
274
+ setSelectedChoices(val);
275
+ setOpenEndedState((prev)=>({
276
+ ...prev,
277
+ isSelected: false,
278
+ inputValue: ''
279
+ }));
280
+ if (shouldSkipSubmit) {
281
+ onSubmit(val);
282
+ if (isPreviewMode) onPreviewSubmit(val);
283
+ }
284
+ return;
285
+ }
286
+ if (isMultipleChoiceQuestion && isArray(selectedChoices)) selectedChoices.includes(val) ? setSelectedChoices(selectedChoices.filter((choice)=>choice !== val)) : setSelectedChoices([
287
+ ...selectedChoices,
288
+ val
289
+ ]);
290
+ };
291
+ const handleOpenEndedInputChange = (e)=>{
292
+ e.stopPropagation();
293
+ const newValue = e.currentTarget.value;
294
+ setOpenEndedState((prev)=>({
295
+ ...prev,
296
+ inputValue: newValue
297
+ }));
298
+ if (isSingleChoiceQuestion) setSelectedChoices(newValue);
299
+ };
300
+ const handleOpenEndedKeyDown = (e)=>{
301
+ e.stopPropagation();
302
+ if ('Enter' === e.key && !isSubmitDisabled()) {
303
+ e.preventDefault();
304
+ handleSubmit();
305
+ }
306
+ if ('Escape' === e.key) {
307
+ e.preventDefault();
308
+ setOpenEndedState((prev)=>({
309
+ ...prev,
310
+ isSelected: false,
311
+ inputValue: ''
312
+ }));
313
+ if (isSingleChoiceQuestion) setSelectedChoices(null);
314
+ }
315
+ };
316
+ const isSubmitDisabled = ()=>{
317
+ if (question.optional) return false;
318
+ if (isNull(selectedChoices)) return true;
319
+ if (isArray(selectedChoices)) {
320
+ if (!openEndedState.isSelected && 0 === selectedChoices.length) return true;
321
+ }
322
+ if (openEndedState.isSelected && '' === openEndedState.inputValue.trim()) return true;
323
+ return false;
324
+ };
325
+ const handleSubmit = ()=>{
326
+ if (openEndedState.isSelected && isMultipleChoiceQuestion) {
327
+ if (isArray(selectedChoices)) isPreviewMode ? onPreviewSubmit([
328
+ ...selectedChoices,
329
+ openEndedState.inputValue
330
+ ]) : onSubmit([
331
+ ...selectedChoices,
332
+ openEndedState.inputValue
333
+ ]);
334
+ } else isPreviewMode ? onPreviewSubmit(selectedChoices) : onSubmit(selectedChoices);
335
+ };
336
+ return /*#__PURE__*/ jsxs(Fragment, {
337
+ children: [
338
+ /*#__PURE__*/ jsxs("div", {
339
+ className: "question-container",
340
+ children: [
341
+ /*#__PURE__*/ jsx(QuestionHeader, {
342
+ question: question,
343
+ forceDisableHtml: forceDisableHtml
344
+ }),
345
+ /*#__PURE__*/ jsxs("fieldset", {
346
+ className: "multiple-choice-options limit-height",
347
+ children: [
348
+ /*#__PURE__*/ jsx("legend", {
349
+ className: "sr-only",
350
+ children: isMultipleChoiceQuestion ? ' Select all that apply' : ' Select one'
351
+ }),
352
+ choices.map((choice, idx)=>{
353
+ const isOpenChoice = !!question.hasOpenChoice && idx === question.choices.length - 1;
354
+ const inputId = `surveyQuestion${displayQuestionIndex}Choice${idx}`;
355
+ const openInputId = `${inputId}Open`;
356
+ const isChecked = isOpenChoice ? openEndedState.isSelected : isSingleChoiceQuestion ? selectedChoices === choice : isArray(selectedChoices) && selectedChoices.includes(choice);
357
+ return /*#__PURE__*/ jsxs("label", {
358
+ className: isOpenChoice ? 'choice-option-open' : '',
359
+ children: [
360
+ /*#__PURE__*/ jsxs("div", {
361
+ className: "response-choice",
362
+ children: [
363
+ /*#__PURE__*/ jsx("input", {
364
+ type: isSingleChoiceQuestion ? 'radio' : 'checkbox',
365
+ name: inputId,
366
+ checked: isChecked,
367
+ onChange: ()=>handleChoiceChange(choice, isOpenChoice),
368
+ id: inputId,
369
+ "aria-controls": openInputId
370
+ }),
371
+ /*#__PURE__*/ jsx("span", {
372
+ children: isOpenChoice ? `${choice}:` : choice
373
+ })
374
+ ]
375
+ }),
376
+ isOpenChoice && /*#__PURE__*/ jsx("input", {
377
+ type: "text",
378
+ ref: openChoiceInputRef,
379
+ id: openInputId,
380
+ name: `question${displayQuestionIndex}Open`,
381
+ value: openEndedState.inputValue,
382
+ onKeyDown: handleOpenEndedKeyDown,
383
+ onInput: handleOpenEndedInputChange,
384
+ onClick: (e)=>{
385
+ if (!openEndedState.isSelected) handleChoiceChange(choice, true);
386
+ e.stopPropagation();
387
+ },
388
+ "aria-label": `${choice} - please specify`
389
+ })
390
+ ]
391
+ }, idx);
392
+ })
393
+ ]
394
+ })
395
+ ]
396
+ }),
397
+ /*#__PURE__*/ jsx(BottomSection, {
398
+ text: question.buttonText || 'Submit',
399
+ submitDisabled: isSubmitDisabled(),
400
+ appearance: appearance,
401
+ onSubmit: handleSubmit,
402
+ onPreviewSubmit: handleSubmit,
403
+ skipSubmitButton: shouldSkipSubmit,
404
+ canGoBack: canGoBack,
405
+ onBack: onBack
406
+ })
407
+ ]
408
+ });
409
+ }
410
+ const fiveScaleNumbers = [
411
+ 1,
412
+ 2,
413
+ 3,
414
+ 4,
415
+ 5
416
+ ];
417
+ const sevenScaleNumbers = [
418
+ 1,
419
+ 2,
420
+ 3,
421
+ 4,
422
+ 5,
423
+ 6,
424
+ 7
425
+ ];
426
+ const tenScaleNumbers = [
427
+ 0,
428
+ 1,
429
+ 2,
430
+ 3,
431
+ 4,
432
+ 5,
433
+ 6,
434
+ 7,
435
+ 8,
436
+ 9,
437
+ 10
438
+ ];
439
+ const emojiScaleLists = {
440
+ 2: [
441
+ thumbsUpEmoji,
442
+ thumbsDownEmoji
443
+ ],
444
+ 3: [
445
+ dissatisfiedEmoji,
446
+ neutralEmoji,
447
+ satisfiedEmoji
448
+ ],
449
+ 5: [
450
+ veryDissatisfiedEmoji,
451
+ dissatisfiedEmoji,
452
+ neutralEmoji,
453
+ satisfiedEmoji,
454
+ verySatisfiedEmoji
455
+ ]
456
+ };
457
+ function getScaleNumbers(scale) {
458
+ switch(scale){
459
+ case 5:
460
+ return fiveScaleNumbers;
461
+ case 7:
462
+ return sevenScaleNumbers;
463
+ case 10:
464
+ return tenScaleNumbers;
465
+ default:
466
+ return fiveScaleNumbers;
467
+ }
468
+ }
469
+ export { LinkQuestion, MultipleChoiceQuestion, OpenTextQuestion, RatingButton, RatingQuestion };
@@ -0,0 +1,12 @@
1
+ export declare const satisfiedEmoji: import("preact").JSX.Element;
2
+ export declare const neutralEmoji: import("preact").JSX.Element;
3
+ export declare const dissatisfiedEmoji: import("preact").JSX.Element;
4
+ export declare const veryDissatisfiedEmoji: import("preact").JSX.Element;
5
+ export declare const verySatisfiedEmoji: import("preact").JSX.Element;
6
+ export declare const thumbsUpEmoji: import("preact").JSX.Element;
7
+ export declare const thumbsDownEmoji: import("preact").JSX.Element;
8
+ export declare const cancelSVG: ({ fill }?: {
9
+ fill?: string;
10
+ }) => import("preact").JSX.Element;
11
+ export declare const IconPosthogLogo: import("preact").JSX.Element;
12
+ export declare const checkSVG: import("preact").JSX.Element;