posthog-js 1.81.2 → 1.81.4
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/array.full.js +2 -2
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +2 -2
- package/dist/array.js.map +1 -1
- package/dist/es.js +2 -2
- package/dist/es.js.map +1 -1
- package/dist/module.d.ts +4 -0
- package/dist/module.js +2 -2
- package/dist/module.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/extensions/surveys.d.ts +7 -14
- package/lib/src/extensions/surveys.js +371 -93
- package/lib/src/extensions/surveys.js.map +1 -1
- package/lib/src/posthog-core.js +7 -1
- package/lib/src/posthog-core.js.map +1 -1
- package/lib/src/posthog-surveys-types.d.ts +4 -0
- package/lib/src/posthog-surveys-types.js.map +1 -1
- package/lib/src/posthog-surveys.js +1 -1
- package/lib/src/posthog-surveys.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
var __values = (this && this.__values) || function(o) {
|
|
2
13
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3
14
|
if (m) return m.call(o);
|
|
@@ -34,14 +45,22 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
34
45
|
}
|
|
35
46
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
47
|
};
|
|
37
|
-
var posthogLogo = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="12" viewBox="0 0 50 30" fill="none"><path d="M10.8914 17.2057c-.3685.7371-1.42031.7371-1.78884 0L8.2212 15.443c-.14077-.2815-.14077-.6129 0-.8944l.88136-1.7627c.36853-.7371 1.42034-.7371 1.78884 0l.8814 1.7627c.1407.2815.1407.6129 0 .8944l-.8814 1.7627zM10.8914 27.2028c-.3685.737-1.42031.737-1.78884 0L8.2212 25.44c-.14077-.2815-.14077-.6129 0-.8944l.88136-1.7627c.36853-.7371 1.42034-.7371 1.78884 0l.8814 1.7627c.1407.2815.1407.6129 0 .8944l-.8814 1.7628z" fill="##6A6B69"/><path d="M0 23.4082c0-.8909 1.07714-1.3371 1.70711-.7071l4.58338 4.5834c.62997.63.1838 1.7071-.7071 1.7071H.999999c-.552284 0-.999999-.4477-.999999-1v-4.5834zm0-4.8278c0 .2652.105357.5196.292893.7071l9.411217 9.4112c.18753.1875.44189.2929.70709.2929h5.1692c.8909 0 1.3371-1.0771.7071-1.7071L1.70711 12.7041C1.07714 12.0741 0 12.5203 0 13.4112v5.1692zm0-9.99701c0 .26521.105357.51957.292893.7071L19.7011 28.6987c.1875.1875.4419.2929.7071.2929h5.1692c.8909 0 1.3371-1.0771.7071-1.7071L1.70711 2.70711C1.07715 2.07715 0 2.52331 0 3.41421v5.16918zm9.997 0c0 .26521.1054.51957.2929.7071l17.994 17.99401c.63.63 1.7071.1838 1.7071-.7071v-5.1692c0-.2652-.1054-.5196-.2929-.7071l-17.994-17.994c-.63-.62996-1.7071-.18379-1.7071.70711v5.16918zm11.7041-5.87628c-.63-.62997-1.7071-.1838-1.7071.7071v5.16918c0 .26521.1054.51957.2929.7071l7.997 7.99701c.63.63 1.7071.1838 1.7071-.7071v-5.1692c0-.2652-.1054-.5196-.2929-.7071l-7.997-7.99699z" fill="#6A6B69"/><path d="M42.5248 23.5308l-9.4127-9.4127c-.63-.63-1.7071-.1838-1.7071.7071v13.1664c0 .5523.4477 1 1 1h14.5806c.5523 0 1-.4477 1-1v-1.199c0-.5523-.4496-.9934-.9973-1.0647-1.6807-.2188-3.2528-.9864-4.4635-2.1971zm-6.3213 2.2618c-.8829 0-1.5995-.7166-1.5995-1.5996 0-.8829.7166-1.5995 1.5995-1.5995.883 0 1.5996.7166 1.5996 1.5995 0 .883-.7166 1.5996-1.5996 1.5996z" fill="#6A6B69"/><path d="M0 27.9916c0 .5523.447715 1 1 1h4.58339c.8909 0 1.33707-1.0771.70711-1.7071l-4.58339-4.5834C1.07714 22.0711 0 22.5173 0 23.4082v4.5834zM9.997 10.997L1.70711 2.70711C1.07714 2.07714 0 2.52331 0 3.41421v5.16918c0 .26521.105357.51957.292893.7071L9.997 18.9946V10.997zM1.70711 12.7041C1.07714 12.0741 0 12.5203 0 13.4112v5.1692c0 .2652.105357.5196.292893.7071L9.997 28.9916V20.994l-8.28989-8.2899z" fill="#6A6B69"/><path d="M19.994 11.4112c0-.2652-.1053-.5196-.2929-.7071l-7.997-7.99699c-.6299-.62997-1.70709-.1838-1.70709.7071v5.16918c0 .26521.10539.51957.29289.7071l9.7041 9.70411v-7.5834zM9.99701 28.9916h5.58339c.8909 0 1.3371-1.0771.7071-1.7071L9.99701 20.994v7.9976zM9.99701 10.997v7.5834c0 .2652.10539.5196.29289.7071l9.7041 9.7041v-7.5834c0-.2652-.1053-.5196-.2929-.7071L9.99701 10.997z" fill="#6a6b69"/></svg>';
|
|
38
48
|
var satisfiedEmoji = '<svg class="emoji-svg" xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"/></svg>';
|
|
39
49
|
var neutralEmoji = '<svg class="emoji-svg" xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"/></svg>';
|
|
40
50
|
var dissatisfiedEmoji = '<svg class="emoji-svg" xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"/></svg>';
|
|
41
51
|
var veryDissatisfiedEmoji = '<svg class="emoji-svg" xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z"/></svg>';
|
|
42
52
|
var verySatisfiedEmoji = '<svg class="emoji-svg" xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"/></svg>';
|
|
43
|
-
var cancelSVG = '<svg xmlns="http://www.w3.org/2000/svg"
|
|
44
|
-
var
|
|
53
|
+
var cancelSVG = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z" fill="black"/></svg>';
|
|
54
|
+
var posthogLogo = '<svg width="77" height="14" viewBox="0 0 77 14" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_2415_6911)"><mask id="mask0_2415_6911" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="77" height="14"><path d="M0.5 0H76.5V14H0.5V0Z" fill="white"/></mask><g mask="url(#mask0_2415_6911)"><path d="M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z" fill="#1D4AFF"/><path d="M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z" fill="#F9BD2B"/><path d="M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z" fill="currentColor"/><path d="M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z" fill="#1D4AFF"/><path d="M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z" fill="#F54E00"/><path d="M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z" fill="currentColor"/></g></g><defs><clipPath id="clip0_2415_6911"><rect width="76" height="14" fill="white" transform="translate(0.5)"/></clipPath></defs></svg>';
|
|
55
|
+
var checkSVG = '<svg width="16" height="12" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z" fill="currentColor"/></svg>';
|
|
56
|
+
var style = function (id, appearance) {
|
|
57
|
+
var positions = {
|
|
58
|
+
left: 'left: 30px;',
|
|
59
|
+
right: 'right: 30px;',
|
|
60
|
+
center: "\n left: 50%;\n transform: translateX(-50%);\n ",
|
|
61
|
+
};
|
|
62
|
+
return "\n .survey-".concat(id, "-form {\n position: fixed;\n margin: 0px;\n bottom: 0px;\n color: black;\n font-weight: normal;\n font-family: -apple-system, BlinkMacSystemFont, \"Inter\", \"Segoe UI\", \"Roboto\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n text-align: left;\n max-width: ").concat(parseInt((appearance === null || appearance === void 0 ? void 0 : appearance.maxWidth) || '290'), "px;\n z-index: ").concat(parseInt((appearance === null || appearance === void 0 ? void 0 : appearance.zIndex) || '99999'), ";\n border: 1.5px solid ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.borderColor) || '#c9c6c6', ";\n border-bottom: 0px;\n width: 100%;\n ").concat(positions[(appearance === null || appearance === void 0 ? void 0 : appearance.position) || 'right'] || 'right: 30px;', "\n }\n .survey-").concat(id, "-form .tab {\n display: none;\n }\n .form-submit[disabled] {\n opacity: 0.6;\n filter: grayscale(100%);\n cursor: not-allowed;\n }\n .survey-").concat(id, "-form {\n flex-direction: column;\n background: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.backgroundColor) || '#eeeded', ";\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n box-shadow: -6px 0 16px -8px rgb(0 0 0 / 8%), -9px 0 28px 0 rgb(0 0 0 / 5%), -12px 0 48px 16px rgb(0 0 0 / 3%);\n }\n .survey-").concat(id, "-form textarea {\n color: #2d2d2d;\n font-size: 14px;\n font-family: -apple-system, BlinkMacSystemFont, \"Inter\", \"Segoe UI\", \"Roboto\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n background: white;\n color: black;\n outline: none;\n padding-left: 10px;\n padding-right: 10px;\n padding-top: 10px;\n border-radius: 6px;\n border-color: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.borderColor) || '#c9c6c6', ";\n margin-top: 14px; \n }\n .form-submit {\n box-sizing: border-box;\n margin: 0;\n font-family: inherit;\n overflow: visible;\n text-transform: none;\n position: relative;\n display: inline-block;\n font-weight: 700;\n white-space: nowrap;\n text-align: center;\n border: 1.5px solid transparent;\n cursor: pointer;\n user-select: none;\n touch-action: manipulation;\n padding: 12px;\n font-size: 14px;\n border-radius: 6px;\n outline: 0;\n background: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.submitButtonColor) || 'black', " !important;\n text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);\n box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);\n width: 100%;\n }\n .form-cancel {\n float: right;\n border: none;\n background: none;\n cursor: pointer;\n }\n .cancel-btn-wrapper {\n position: absolute;\n width: 35px;\n height: 35px;\n border-radius: 100%;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n background: white;\n border: 1.5px solid ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.borderColor) || '#c9c6c6', ";\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .bolded { font-weight: 600; }\n .buttons {\n display: flex;\n justify-content: center;\n }\n .footer-branding {\n font-size: 11px;\n margin-top: 10px;\n text-align: center;\n display: flex;\n justify-content: center;\n gap: 4px;\n align-items: center;\n font-weight: 500;\n background: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.backgroundColor) || '#eeeded', ";\n text-decoration: none;\n }\n .survey-").concat(id, "-box {\n padding: 20px 25px 10px;\n display: flex;\n flex-direction: column;\n }\n .survey-question {\n font-weight: 500;\n font-size: 14px;\n background: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.backgroundColor) || '#eeeded', ";\n }\n .question-textarea-wrapper {\n display: flex;\n flex-direction: column;\n }\n .description {\n font-size: 13px;\n margin-top: 5px;\n opacity: .60;\n background: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.backgroundColor) || '#eeeded', ";\n }\n .ratings-number {\n background-color: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.ratingButtonColor) || 'white', ";\n font-size: 14px;\n padding: 8px 0px;\n border: none;\n }\n .ratings-number:hover {\n cursor: pointer;\n }\n .rating-options {\n margin-top: 14px;\n }\n .rating-options-buttons {\n display: grid;\n border-radius: 6px;\n overflow: hidden;\n border: 1.5px solid ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.borderColor) || '#c9c6c6', ";\n }\n .rating-options-buttons > .ratings-number {\n border-right: 1px solid ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.borderColor) || '#c9c6c6', ";\n }\n .rating-options-buttons > .ratings-number:last-of-type {\n border-right: 0px;\n }\n .rating-options-buttons .rating-active {\n background: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.ratingButtonActiveColor) || 'black', ";\n }\n .rating-options-emoji {\n display: flex;\n justify-content: space-between;\n }\n .ratings-emoji {\n font-size: 16px;\n background-color: transparent;\n border: none;\n padding: 0px;\n }\n .ratings-emoji:hover {\n cursor: pointer;\n }\n .ratings-emoji.rating-active svg {\n fill: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.ratingButtonActiveColor) || 'black', ";\n }\n .emoji-svg {\n fill: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.ratingButtonColor) || '#c9c6c6', ";\n }\n .rating-text {\n display: flex;\n flex-direction: row;\n font-size: 11px;\n justify-content: space-between;\n margin-top: 6px;\n background: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.backgroundColor) || '#eeeded', ";\n opacity: .60;\n }\n .multiple-choice-options {\n margin-top: 13px;\n font-size: 14px;\n }\n .multiple-choice-options .choice-option {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 13px;\n cursor: pointer;\n margin-bottom: 5px;\n position: relative;\n }\n .multiple-choice-options > .choice-option:last-of-type {\n margin-bottom: 0px;\n }\n \n .multiple-choice-options input {\n cursor: pointer;\n position: absolute;\n opacity: 0;\n }\n .choice-check {\n position: absolute;\n right: 10px;\n background: white;\n }\n .choice-check svg {\n display: none;\n }\n .multiple-choice-options .choice-option:hover .choice-check svg {\n display: inline-block;\n opacity: .25;\n }\n .multiple-choice-options input:checked + label + .choice-check svg {\n display: inline-block;\n opacity: 100% !important;\n }\n .multiple-choice-options input[type=checkbox]:checked + label {\n font-weight: bold;\n }\n .multiple-choice-options input:checked + label {\n border: 1.5px solid rgba(0,0,0);\n }\n .multiple-choice-options label {\n width: 100%;\n cursor: pointer;\n padding: 10px;\n border: 1.5px solid rgba(0,0,0,.25);\n border-radius: 4px;\n background: white;\n }\n .thank-you-message {\n position: fixed;\n bottom: 0px;\n z-index: ").concat(parseInt((appearance === null || appearance === void 0 ? void 0 : appearance.zIndex) || '99999'), ";\n box-shadow: -6px 0 16px -8px rgb(0 0 0 / 8%), -9px 0 28px 0 rgb(0 0 0 / 5%), -12px 0 48px 16px rgb(0 0 0 / 3%);\n font-family: -apple-system, BlinkMacSystemFont, \"Inter\", \"Segoe UI\", \"Roboto\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n padding: 20px 25px 10px;\n background: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.backgroundColor) || '#eeeded', ";\n border: 1.5px solid ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.borderColor) || '#c9c6c6', ";\n text-align: center;\n max-width: ").concat(parseInt((appearance === null || appearance === void 0 ? void 0 : appearance.maxWidth) || '290'), "px;\n min-width: 150px;\n width: 100%;\n ").concat(positions[(appearance === null || appearance === void 0 ? void 0 : appearance.position) || 'right'] || 'right: 30px;', "\n }\n .thank-you-message {\n color: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.textColor) || 'black', ";\n }\n .thank-you-message-body {\n margin-top: 6px;\n font-size: 14px;\n color: ").concat((appearance === null || appearance === void 0 ? void 0 : appearance.descriptionTextColor) || '#4b4b52', ";\n }\n .thank-you-message-header {\n margin: 10px 0px 0px;\n }\n .thank-you-message-container .form-submit {\n margin-top: 20px;\n margin-bottom: 10px;\n }\n .thank-you-message-countdown {\n margin-left: 6px;\n }\n .bottom-section {\n margin-top: 14px;\n }\n ");
|
|
63
|
+
};
|
|
45
64
|
export var createShadow = function (styleSheet, surveyId) {
|
|
46
65
|
var div = document.createElement('div');
|
|
47
66
|
div.className = "PostHogSurvey".concat(surveyId);
|
|
@@ -63,42 +82,64 @@ export var closeSurveyPopup = function (surveyId, surveyPopup) {
|
|
|
63
82
|
}, 2000);
|
|
64
83
|
surveyPopup.reset();
|
|
65
84
|
};
|
|
66
|
-
export var
|
|
67
|
-
var _a;
|
|
68
|
-
var question = survey.questions[0];
|
|
85
|
+
export var createOpenTextOrLinkPopup = function (posthog, survey, question) {
|
|
86
|
+
var _a, _b;
|
|
69
87
|
var surveyQuestionType = question.type;
|
|
70
88
|
var surveyDescription = question.description;
|
|
71
89
|
var questionText = question.question;
|
|
72
|
-
var form = "\n <div class=\"survey-".concat(survey.id, "-box\">\n <div class=\"cancel-btn-wrapper\">\n <button class=\"form-cancel\" type=\"cancel\">").concat(cancelSVG, "</button>\n </div>\n <div class=\"question-textarea-wrapper\">\n <div class=\"survey-question\">").concat(questionText, "</div>\n ").concat(surveyDescription ? "<span class=\"description\">".concat(surveyDescription, "</span>") : '', "\n ").concat(surveyQuestionType === 'open'
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
var form = "\n <div class=\"survey-".concat(survey.id, "-box\">\n <div class=\"cancel-btn-wrapper\">\n <button class=\"form-cancel\" type=\"cancel\">").concat(cancelSVG, "</button>\n </div>\n <div class=\"question-textarea-wrapper\">\n <div class=\"survey-question auto-text-color\">").concat(questionText, "</div>\n ").concat(surveyDescription ? "<span class=\"description auto-text-color\">".concat(surveyDescription, "</span>") : '', "\n ").concat(surveyQuestionType === 'open'
|
|
91
|
+
? "<textarea class=\"survey-textarea\" name=\"survey\" rows=4 placeholder=\"".concat(((_a = survey.appearance) === null || _a === void 0 ? void 0 : _a.placeholder) || '', "\"></textarea>")
|
|
92
|
+
: '', "\n </div>\n <div class=\"bottom-section\">\n <div class=\"buttons\">\n <button class=\"form-submit auto-text-color\" type=\"submit\" ").concat(surveyQuestionType === 'open' ? 'disabled' : null, ">").concat(((_b = survey.appearance) === null || _b === void 0 ? void 0 : _b.submitButtonText) || 'Submit', "</button>\n </div>\n <a href=\"https://posthog.com\" target=\"_blank\" rel=\"noopener\" class=\"footer-branding auto-text-color\">Survey by ").concat(posthogLogo, "</a>\n </div>\n </div>\n");
|
|
93
|
+
var formElement;
|
|
94
|
+
if (survey.questions.length === 1) {
|
|
95
|
+
formElement = Object.assign(document.createElement('form'), {
|
|
96
|
+
className: "survey-".concat(survey.id, "-form"),
|
|
97
|
+
innerHTML: form,
|
|
98
|
+
onsubmit: function (e) {
|
|
99
|
+
var _a;
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
var surveyQuestionType = question.type;
|
|
102
|
+
posthog.capture('survey sent', {
|
|
103
|
+
$survey_name: survey.name,
|
|
104
|
+
$survey_id: survey.id,
|
|
105
|
+
$survey_question: survey.questions[0].question,
|
|
106
|
+
$survey_response: surveyQuestionType === 'open' ? e.target.survey.value : 'link clicked',
|
|
107
|
+
sessionRecordingUrl: (_a = posthog.get_session_replay_url) === null || _a === void 0 ? void 0 : _a.call(posthog),
|
|
108
|
+
});
|
|
109
|
+
if (surveyQuestionType === 'link') {
|
|
110
|
+
window.open(question.link || undefined);
|
|
111
|
+
}
|
|
112
|
+
window.setTimeout(function () {
|
|
113
|
+
window.dispatchEvent(new Event('PHSurveySent'));
|
|
114
|
+
}, 200);
|
|
115
|
+
closeSurveyPopup(survey.id, formElement);
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
formElement = Object.assign(document.createElement('div'), {
|
|
121
|
+
innerHTML: form,
|
|
122
|
+
});
|
|
123
|
+
var submitButton = formElement.querySelector('.form-submit');
|
|
124
|
+
submitButton.addEventListener('click', function () {
|
|
86
125
|
if (surveyQuestionType === 'link') {
|
|
87
126
|
window.open(question.link || undefined);
|
|
88
127
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
formElement.addEventListener('input', function (e) {
|
|
131
|
+
if (formElement.querySelector('.form-submit')) {
|
|
132
|
+
var submitButton = formElement.querySelector('.form-submit');
|
|
133
|
+
submitButton.disabled = !e.data;
|
|
134
|
+
}
|
|
94
135
|
});
|
|
95
136
|
return formElement;
|
|
96
137
|
};
|
|
97
138
|
export var createThankYouMessage = function (survey) {
|
|
98
139
|
var _a, _b, _c;
|
|
99
|
-
var thankYouHTML = "\n <div class=\"thank-you-message-container\">\n <h3 class=\"thank-you-message-header\">".concat(((_a = survey.appearance) === null || _a === void 0 ? void 0 : _a.thankYouMessageHeader) || 'Thank you!', "</h3>\n <div class=\"thank-you-message-body\">").concat(((_b = survey.appearance) === null || _b === void 0 ? void 0 : _b.thankYouMessageDescription) || '', "</div>\n ").concat(((_c = survey.appearance) === null || _c === void 0 ? void 0 : _c.whiteLabel)
|
|
140
|
+
var thankYouHTML = "\n <div class=\"thank-you-message-container\">\n <div class=\"cancel-btn-wrapper\">\n <button class=\"form-cancel\" type=\"cancel\">".concat(cancelSVG, "</button>\n </div>\n <h3 class=\"thank-you-message-header\">").concat(((_a = survey.appearance) === null || _a === void 0 ? void 0 : _a.thankYouMessageHeader) || 'Thank you!', "</h3>\n <div class=\"thank-you-message-body\">").concat(((_b = survey.appearance) === null || _b === void 0 ? void 0 : _b.thankYouMessageDescription) || '', "</div>\n <button class=\"form-submit auto-text-color\"><span>Close</span><span class=\"thank-you-message-countdown\"></span></button>\n ").concat(((_c = survey.appearance) === null || _c === void 0 ? void 0 : _c.whiteLabel)
|
|
100
141
|
? ''
|
|
101
|
-
: "<
|
|
142
|
+
: "<a href=\"https://posthog.com\" target=\"_blank\" rel=\"noopener\" class=\"footer-branding auto-text-color\">Survey by ".concat(posthogLogo, "</a>"), "\n </div>\n ");
|
|
102
143
|
var thankYouElement = Object.assign(document.createElement('div'), {
|
|
103
144
|
className: "thank-you-message",
|
|
104
145
|
innerHTML: thankYouHTML,
|
|
@@ -120,17 +161,18 @@ export var addCancelListeners = function (posthog, surveyPopup, surveyId, survey
|
|
|
120
161
|
window.dispatchEvent(new Event('PHSurveyClosed'));
|
|
121
162
|
});
|
|
122
163
|
};
|
|
123
|
-
export var createRatingsPopup = function (posthog, survey) {
|
|
164
|
+
export var createRatingsPopup = function (posthog, survey, question) {
|
|
124
165
|
var e_1, _a;
|
|
125
|
-
var
|
|
166
|
+
var _b;
|
|
126
167
|
var scale = question.scale;
|
|
127
168
|
var displayType = question.display;
|
|
128
169
|
var ratingOptionsElement = document.createElement('div');
|
|
129
170
|
if (displayType === 'number') {
|
|
130
|
-
ratingOptionsElement.className =
|
|
171
|
+
ratingOptionsElement.className = 'rating-options-buttons';
|
|
172
|
+
ratingOptionsElement.style.gridTemplateColumns = "repeat(".concat(scale, ", minmax(0, 1fr))");
|
|
131
173
|
for (var i = 1; i <= scale; i++) {
|
|
132
174
|
var buttonElement = document.createElement('button');
|
|
133
|
-
buttonElement.className = "ratings-number rating_".concat(i);
|
|
175
|
+
buttonElement.className = "ratings-number rating_".concat(i, " auto-text-color");
|
|
134
176
|
buttonElement.type = 'submit';
|
|
135
177
|
buttonElement.value = "".concat(i);
|
|
136
178
|
buttonElement.innerHTML = "".concat(i);
|
|
@@ -150,73 +192,140 @@ export var createRatingsPopup = function (posthog, survey) {
|
|
|
150
192
|
ratingOptionsElement.append(emojiElement);
|
|
151
193
|
}
|
|
152
194
|
}
|
|
153
|
-
var ratingsForm = "\n <div class=\"survey-".concat(survey.id, "-box\">\n <div class=\"cancel-btn-wrapper\">\n <button class=\"form-cancel\" type=\"cancel\">").concat(cancelSVG, "</button>\n </div>\n <div class=\"survey-question\">").concat(question.question, "</div>\n ").concat(question.description ? "<span class=\"description\">".concat(question.description, "</span>") : '', "\n <div class=\"rating-section\">\n <div class=\"rating-options\">\n </div>\n
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
formElement.getElementsByClassName("rating_".concat(x + 1))[0].addEventListener('click', function (e) {
|
|
195
|
+
var ratingsForm = "\n <div class=\"survey-".concat(survey.id, "-box\">\n <div class=\"cancel-btn-wrapper\">\n <button class=\"form-cancel\" type=\"cancel\">").concat(cancelSVG, "</button>\n </div>\n <div class=\"survey-question auto-text-color\">").concat(question.question, "</div>\n ").concat(question.description ? "<span class=\"description auto-text-color\">".concat(question.description, "</span>") : '', "\n <div class=\"rating-section\">\n <div class=\"rating-options\">\n </div>\n ").concat(question.lowerBoundLabel || question.upperBoundLabel
|
|
196
|
+
? "<div class=\"rating-text auto-text-color\">\n <div>".concat(question.lowerBoundLabel || '', "</div>\n <div>").concat(question.upperBoundLabel || '', "</div>\n </div>")
|
|
197
|
+
: '', "\n <div class=\"bottom-section\">\n <div class=\"buttons\">\n <button class=\"form-submit auto-text-color\" type=\"submit\" disabled>").concat(((_b = survey.appearance) === null || _b === void 0 ? void 0 : _b.submitButtonText) || 'Submit', "</button>\n </div>\n <a href=\"https://posthog.com\" target=\"_blank\" rel=\"noopener\" class=\"footer-branding auto-text-color\">Survey by ").concat(posthogLogo, "</a>\n </div>\n </div>\n </div>\n ");
|
|
198
|
+
var formElement;
|
|
199
|
+
if (survey.questions.length === 1) {
|
|
200
|
+
formElement = Object.assign(document.createElement('form'), {
|
|
201
|
+
className: "survey-".concat(survey.id, "-form"),
|
|
202
|
+
innerHTML: ratingsForm,
|
|
203
|
+
onsubmit: function (e) {
|
|
163
204
|
var _a;
|
|
164
205
|
e.preventDefault();
|
|
206
|
+
var activeRatingEl = formElement.querySelector('.rating-active');
|
|
165
207
|
posthog.capture('survey sent', {
|
|
166
208
|
$survey_name: survey.name,
|
|
167
209
|
$survey_id: survey.id,
|
|
168
210
|
$survey_question: question.question,
|
|
169
211
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
170
212
|
// @ts-ignore // TODO: Fix this, error because it doesn't know that the target is a button
|
|
171
|
-
$survey_response: parseInt(
|
|
172
|
-
sessionRecordingUrl: posthog.get_session_replay_url(),
|
|
213
|
+
$survey_response: parseInt(activeRatingEl === null || activeRatingEl === void 0 ? void 0 : activeRatingEl.value),
|
|
214
|
+
sessionRecordingUrl: (_a = posthog.get_session_replay_url) === null || _a === void 0 ? void 0 : _a.call(posthog),
|
|
173
215
|
});
|
|
174
216
|
window.setTimeout(function () {
|
|
175
217
|
window.dispatchEvent(new Event('PHSurveySent'));
|
|
176
218
|
}, 200);
|
|
177
219
|
closeSurveyPopup(survey.id, formElement);
|
|
178
|
-
}
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
formElement = Object.assign(document.createElement('div'), {
|
|
225
|
+
innerHTML: ratingsForm,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
formElement.getElementsByClassName('rating-options')[0].insertAdjacentElement('afterbegin', ratingOptionsElement);
|
|
229
|
+
var _loop_1 = function (x) {
|
|
230
|
+
var ratingEl = formElement.getElementsByClassName("rating_".concat(x + 1))[0];
|
|
231
|
+
ratingEl.addEventListener('click', function (e) {
|
|
232
|
+
var e_2, _a;
|
|
233
|
+
e.preventDefault();
|
|
234
|
+
try {
|
|
235
|
+
for (var _b = (e_2 = void 0, __values(formElement.getElementsByClassName('rating-active'))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
236
|
+
var activeRatingEl = _c.value;
|
|
237
|
+
activeRatingEl.classList.remove('rating-active');
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
241
|
+
finally {
|
|
242
|
+
try {
|
|
243
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
244
|
+
}
|
|
245
|
+
finally { if (e_2) throw e_2.error; }
|
|
246
|
+
}
|
|
247
|
+
ratingEl.classList.add('rating-active');
|
|
248
|
+
if (formElement.querySelector('.form-submit')) {
|
|
249
|
+
;
|
|
250
|
+
formElement.querySelector('.form-submit').disabled = false;
|
|
251
|
+
}
|
|
252
|
+
setTextColors(formElement);
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
try {
|
|
256
|
+
for (var _c = __values(Array(question.scale).keys()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
257
|
+
var x = _d.value;
|
|
258
|
+
_loop_1(x);
|
|
179
259
|
}
|
|
180
260
|
}
|
|
181
261
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
182
262
|
finally {
|
|
183
263
|
try {
|
|
184
|
-
if (
|
|
264
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
185
265
|
}
|
|
186
266
|
finally { if (e_1) throw e_1.error; }
|
|
187
267
|
}
|
|
188
268
|
return formElement;
|
|
189
269
|
};
|
|
190
|
-
export var createMultipleChoicePopup = function (posthog, survey) {
|
|
270
|
+
export var createMultipleChoicePopup = function (posthog, survey, question) {
|
|
191
271
|
var _a;
|
|
192
|
-
var surveyQuestion =
|
|
193
|
-
var surveyDescription =
|
|
194
|
-
var surveyQuestionChoices =
|
|
195
|
-
var singleOrMultiSelect =
|
|
196
|
-
var form = "\n <div class=\"survey-".concat(survey.id, "-box\">\n <div class=\"cancel-btn-wrapper\">\n <button class=\"form-cancel\" type=\"cancel\">").concat(cancelSVG, "</button>\n </div>\n <div class=\"survey-question\">").concat(surveyQuestion, "</div>\n ").concat(surveyDescription ? "<span class=\"description\">".concat(surveyDescription, "</span>") : '', "\n <div class=\"multiple-choice-options\">\n ").concat(surveyQuestionChoices
|
|
272
|
+
var surveyQuestion = question.question;
|
|
273
|
+
var surveyDescription = question.description;
|
|
274
|
+
var surveyQuestionChoices = question.choices;
|
|
275
|
+
var singleOrMultiSelect = question.type;
|
|
276
|
+
var form = "\n <div class=\"survey-".concat(survey.id, "-box\">\n <div class=\"cancel-btn-wrapper\">\n <button class=\"form-cancel\" type=\"cancel\">").concat(cancelSVG, "</button>\n </div>\n <div class=\"survey-question auto-text-color\">").concat(surveyQuestion, "</div>\n ").concat(surveyDescription ? "<span class=\"description auto-text-color\">".concat(surveyDescription, "</span>") : '', "\n <div class=\"multiple-choice-options\">\n ").concat(surveyQuestionChoices
|
|
197
277
|
.map(function (option, idx) {
|
|
198
278
|
var inputType = singleOrMultiSelect === 'single_choice' ? 'radio' : 'checkbox';
|
|
199
|
-
var singleOrMultiSelectString = "<div class=\"choice-option\"><input type=".concat(inputType, " id=surveyQuestionMultipleChoice").concat(idx, " name=\"choice\" value=\"").concat(option, "\">\n <label for=surveyQuestionMultipleChoice").concat(idx, ">").concat(option, "</label></div>");
|
|
279
|
+
var singleOrMultiSelectString = "<div class=\"choice-option\"><input type=".concat(inputType, " id=surveyQuestionMultipleChoice").concat(idx, " name=\"choice\" value=\"").concat(option, "\">\n <label class=\"auto-text-color\" for=surveyQuestionMultipleChoice").concat(idx, ">").concat(option, "</label><span class=\"choice-check auto-text-color\">").concat(checkSVG, "</span></div>");
|
|
200
280
|
return singleOrMultiSelectString;
|
|
201
281
|
})
|
|
202
|
-
.join(' '), "\n </div>\n <div class=\"bottom-section\">\n <div class=\"buttons\">\n <button class=\"form-submit\" type=\"submit\">").concat(((_a = survey.appearance) === null || _a === void 0 ? void 0 : _a.submitButtonText) || 'Submit', "</button>\n </div>\n <
|
|
203
|
-
var formElement
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
282
|
+
.join(' '), "\n </div>\n <div class=\"bottom-section\">\n <div class=\"buttons\">\n <button class=\"form-submit auto-text-color\" type=\"submit\" disabled>").concat(((_a = survey.appearance) === null || _a === void 0 ? void 0 : _a.submitButtonText) || 'Submit', "</button>\n </div>\n <a href=\"https://posthog.com\" target=\"_blank\" rel=\"noopener\" class=\"footer-branding auto-text-color\">Survey by ").concat(posthogLogo, "</a>\n </div>\n\n </div>\n ");
|
|
283
|
+
var formElement;
|
|
284
|
+
if (survey.questions.length === 1) {
|
|
285
|
+
formElement = Object.assign(document.createElement('form'), {
|
|
286
|
+
className: "survey-".concat(survey.id, "-form"),
|
|
287
|
+
innerHTML: form,
|
|
288
|
+
onsubmit: function (e) {
|
|
289
|
+
var _a, _b;
|
|
290
|
+
e.preventDefault();
|
|
291
|
+
var targetElement = e.target;
|
|
292
|
+
var selectedChoices = singleOrMultiSelect === 'single_choice'
|
|
293
|
+
? (_a = targetElement.querySelector('input[type=radio]:checked')) === null || _a === void 0 ? void 0 : _a.value
|
|
294
|
+
: __spreadArray([], __read(targetElement.querySelectorAll('input[type=checkbox]:checked')), false).map(function (choice) { return choice.value; });
|
|
295
|
+
posthog.capture('survey sent', {
|
|
296
|
+
$survey_name: survey.name,
|
|
297
|
+
$survey_id: survey.id,
|
|
298
|
+
$survey_question: survey.questions[0].question,
|
|
299
|
+
$survey_response: selectedChoices,
|
|
300
|
+
sessionRecordingUrl: (_b = posthog.get_session_replay_url) === null || _b === void 0 ? void 0 : _b.call(posthog),
|
|
301
|
+
});
|
|
302
|
+
window.setTimeout(function () {
|
|
303
|
+
window.dispatchEvent(new Event('PHSurveySent'));
|
|
304
|
+
}, 200);
|
|
305
|
+
closeSurveyPopup(survey.id, formElement);
|
|
306
|
+
},
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
formElement = Object.assign(document.createElement('div'), {
|
|
311
|
+
innerHTML: form,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
formElement.addEventListener('change', function () {
|
|
315
|
+
var _a;
|
|
316
|
+
var selectedChoices = singleOrMultiSelect === 'single_choice'
|
|
317
|
+
? formElement.querySelector('input[type=radio]:checked')
|
|
318
|
+
: formElement.querySelectorAll('input[type=checkbox]:checked');
|
|
319
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
320
|
+
// @ts-ignore // TODO: Fix this, error because it doesn't recognize node list as an array
|
|
321
|
+
if (selectedChoices && ((_a = selectedChoices.length) !== null && _a !== void 0 ? _a : 0) > 0) {
|
|
322
|
+
;
|
|
323
|
+
formElement.querySelector('.form-submit').disabled = false;
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
;
|
|
327
|
+
formElement.querySelector('.form-submit').disabled = true;
|
|
328
|
+
}
|
|
220
329
|
});
|
|
221
330
|
return formElement;
|
|
222
331
|
};
|
|
@@ -225,7 +334,7 @@ export var callSurveys = function (posthog, forceReload) {
|
|
|
225
334
|
posthog === null || posthog === void 0 ? void 0 : posthog.getActiveMatchingSurveys(function (surveys) {
|
|
226
335
|
var nonAPISurveys = surveys.filter(function (survey) { return survey.type !== 'api'; });
|
|
227
336
|
nonAPISurveys.forEach(function (survey) {
|
|
228
|
-
var _a, _b, _c;
|
|
337
|
+
var _a, _b, _c, _d;
|
|
229
338
|
if (document.querySelectorAll("div[class^='PostHogSurvey']").length === 0) {
|
|
230
339
|
var surveyWaitPeriodInDays = (_a = survey.conditions) === null || _a === void 0 ? void 0 : _a.seenSurveyWaitPeriodInDays;
|
|
231
340
|
var lastSeenSurveyDate = localStorage.getItem("lastSeenSurveyDate");
|
|
@@ -238,42 +347,70 @@ export var callSurveys = function (posthog, forceReload) {
|
|
|
238
347
|
}
|
|
239
348
|
}
|
|
240
349
|
if (!localStorage.getItem("seenSurvey_".concat(survey.id))) {
|
|
350
|
+
var shadow_1 = createShadow(style(survey.id, survey === null || survey === void 0 ? void 0 : survey.appearance), survey.id);
|
|
241
351
|
var surveyPopup = void 0;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
surveyPopup = createRatingsPopup(posthog, survey);
|
|
352
|
+
if (survey.questions.length < 2) {
|
|
353
|
+
surveyPopup = createSingleQuestionSurvey(posthog, survey, survey.questions[0]);
|
|
245
354
|
}
|
|
246
|
-
else
|
|
247
|
-
surveyPopup =
|
|
355
|
+
else {
|
|
356
|
+
surveyPopup = createMultipleQuestionSurvey(posthog, survey);
|
|
248
357
|
}
|
|
249
|
-
|
|
250
|
-
|
|
358
|
+
if (surveyPopup) {
|
|
359
|
+
addCancelListeners(posthog, surveyPopup, survey.id, survey.name);
|
|
360
|
+
if ((_b = survey.appearance) === null || _b === void 0 ? void 0 : _b.whiteLabel) {
|
|
361
|
+
;
|
|
362
|
+
surveyPopup.getElementsByClassName('footer-branding')[0].style.display = 'none';
|
|
363
|
+
}
|
|
364
|
+
shadow_1.appendChild(surveyPopup);
|
|
251
365
|
}
|
|
252
|
-
if (
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
var shadow_1 = createShadow(style(survey.id, survey === null || survey === void 0 ? void 0 : survey.appearance), survey.id);
|
|
257
|
-
addCancelListeners(posthog, surveyPopup, survey.id, survey.name);
|
|
258
|
-
if ((_b = survey.appearance) === null || _b === void 0 ? void 0 : _b.whiteLabel) {
|
|
259
|
-
;
|
|
260
|
-
surveyPopup.getElementsByClassName('footer-branding')[0].style.display = 'none';
|
|
366
|
+
if (survey.questions.length > 1) {
|
|
367
|
+
var currentQuestion = 0;
|
|
368
|
+
showQuestion(currentQuestion, survey.id);
|
|
261
369
|
}
|
|
262
|
-
shadow_1
|
|
370
|
+
setTextColors(shadow_1);
|
|
263
371
|
window.dispatchEvent(new Event('PHSurveyShown'));
|
|
264
372
|
posthog.capture('survey shown', {
|
|
265
373
|
$survey_name: survey.name,
|
|
266
374
|
$survey_id: survey.id,
|
|
267
|
-
sessionRecordingUrl: posthog.get_session_replay_url(),
|
|
375
|
+
sessionRecordingUrl: (_c = posthog.get_session_replay_url) === null || _c === void 0 ? void 0 : _c.call(posthog),
|
|
268
376
|
});
|
|
269
377
|
localStorage.setItem("lastSeenSurveyDate", new Date().toISOString());
|
|
270
|
-
if ((
|
|
378
|
+
if ((_d = survey.appearance) === null || _d === void 0 ? void 0 : _d.displayThankYouMessage) {
|
|
271
379
|
window.addEventListener('PHSurveySent', function () {
|
|
380
|
+
var e_3, _a;
|
|
272
381
|
var thankYouElement = createThankYouMessage(survey);
|
|
273
382
|
shadow_1.appendChild(thankYouElement);
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
383
|
+
var cancelButtons = thankYouElement.querySelectorAll('.form-cancel, .form-submit');
|
|
384
|
+
try {
|
|
385
|
+
for (var cancelButtons_1 = __values(cancelButtons), cancelButtons_1_1 = cancelButtons_1.next(); !cancelButtons_1_1.done; cancelButtons_1_1 = cancelButtons_1.next()) {
|
|
386
|
+
var button = cancelButtons_1_1.value;
|
|
387
|
+
button.addEventListener('click', function () {
|
|
388
|
+
thankYouElement.remove();
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
393
|
+
finally {
|
|
394
|
+
try {
|
|
395
|
+
if (cancelButtons_1_1 && !cancelButtons_1_1.done && (_a = cancelButtons_1.return)) _a.call(cancelButtons_1);
|
|
396
|
+
}
|
|
397
|
+
finally { if (e_3) throw e_3.error; }
|
|
398
|
+
}
|
|
399
|
+
var countdownEl = thankYouElement.querySelector('.thank-you-message-countdown');
|
|
400
|
+
if (countdownEl) {
|
|
401
|
+
var count_1 = 3;
|
|
402
|
+
countdownEl.textContent = "(".concat(count_1, ")");
|
|
403
|
+
var countdown_1 = setInterval(function () {
|
|
404
|
+
count_1 -= 1;
|
|
405
|
+
if (count_1 <= 0) {
|
|
406
|
+
clearInterval(countdown_1);
|
|
407
|
+
thankYouElement.remove();
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
countdownEl.textContent = "(".concat(count_1, ")");
|
|
411
|
+
}, 1000);
|
|
412
|
+
}
|
|
413
|
+
setTextColors(shadow_1);
|
|
277
414
|
});
|
|
278
415
|
}
|
|
279
416
|
}
|
|
@@ -281,6 +418,147 @@ export var callSurveys = function (posthog, forceReload) {
|
|
|
281
418
|
});
|
|
282
419
|
}, forceReload);
|
|
283
420
|
};
|
|
421
|
+
export var createMultipleQuestionSurvey = function (posthog, survey) {
|
|
422
|
+
var questions = survey.questions;
|
|
423
|
+
var questionTypeMapping = {
|
|
424
|
+
open: createOpenTextOrLinkPopup,
|
|
425
|
+
link: createOpenTextOrLinkPopup,
|
|
426
|
+
rating: createRatingsPopup,
|
|
427
|
+
single_choice: createMultipleChoicePopup,
|
|
428
|
+
multiple_choice: createMultipleChoicePopup,
|
|
429
|
+
};
|
|
430
|
+
var multipleQuestionForm = Object.assign(document.createElement('form'), {
|
|
431
|
+
className: "survey-".concat(survey.id, "-form"),
|
|
432
|
+
onsubmit: function (e) {
|
|
433
|
+
var e_4, _a;
|
|
434
|
+
var _b, _c, _d;
|
|
435
|
+
e.preventDefault();
|
|
436
|
+
var multipleQuestionResponses = {};
|
|
437
|
+
var allTabs = e.target.getElementsByClassName('tab');
|
|
438
|
+
var idx = 0;
|
|
439
|
+
try {
|
|
440
|
+
for (var allTabs_1 = __values(allTabs), allTabs_1_1 = allTabs_1.next(); !allTabs_1_1.done; allTabs_1_1 = allTabs_1.next()) {
|
|
441
|
+
var tab = allTabs_1_1.value;
|
|
442
|
+
var classes = tab.classList;
|
|
443
|
+
var questionType = classes[2];
|
|
444
|
+
var response = void 0;
|
|
445
|
+
if (questionType === 'open') {
|
|
446
|
+
response = (_b = tab.querySelector('textarea')) === null || _b === void 0 ? void 0 : _b.value;
|
|
447
|
+
}
|
|
448
|
+
else if (questionType === 'link') {
|
|
449
|
+
response = 'link clicked';
|
|
450
|
+
}
|
|
451
|
+
else if (questionType === 'rating') {
|
|
452
|
+
response = parseInt((_c = tab.querySelector('.rating-active')) === null || _c === void 0 ? void 0 : _c.value);
|
|
453
|
+
}
|
|
454
|
+
else if (questionType === 'single_choice' || questionType === 'multiple_choice') {
|
|
455
|
+
var selectedChoices = questionType === 'single_choice'
|
|
456
|
+
? tab.querySelector('input[type=radio]:checked').value
|
|
457
|
+
: __spreadArray([], __read(tab.querySelectorAll('input[type=checkbox]:checked')), false).map(function (choice) { return choice.value; });
|
|
458
|
+
response = selectedChoices;
|
|
459
|
+
}
|
|
460
|
+
if (response !== undefined) {
|
|
461
|
+
if (idx === 0) {
|
|
462
|
+
multipleQuestionResponses['$survey_response'] = response;
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
multipleQuestionResponses["$survey_response_".concat(idx)] = response;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
idx++;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
472
|
+
finally {
|
|
473
|
+
try {
|
|
474
|
+
if (allTabs_1_1 && !allTabs_1_1.done && (_a = allTabs_1.return)) _a.call(allTabs_1);
|
|
475
|
+
}
|
|
476
|
+
finally { if (e_4) throw e_4.error; }
|
|
477
|
+
}
|
|
478
|
+
posthog.capture('survey sent', __assign({ $survey_name: survey.name, $survey_id: survey.id, $survey_questions: survey.questions.map(function (question) { return question.question; }), sessionRecordingUrl: (_d = posthog.get_session_replay_url) === null || _d === void 0 ? void 0 : _d.call(posthog) }, multipleQuestionResponses));
|
|
479
|
+
window.setTimeout(function () {
|
|
480
|
+
window.dispatchEvent(new Event('PHSurveySent'));
|
|
481
|
+
}, 200);
|
|
482
|
+
closeSurveyPopup(survey.id, multipleQuestionForm);
|
|
483
|
+
},
|
|
484
|
+
});
|
|
485
|
+
questions.map(function (question, idx) {
|
|
486
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
487
|
+
// @ts-ignore // TODO: Fix this, error because of survey question type mapping
|
|
488
|
+
var questionElement = questionTypeMapping[question.type](posthog, survey, question);
|
|
489
|
+
var questionTab = document.createElement('div');
|
|
490
|
+
questionTab.className = "tab question-".concat(idx, " ").concat(question.type);
|
|
491
|
+
if (idx < questions.length - 1) {
|
|
492
|
+
var questionElementSubmitButton = questionElement.getElementsByClassName('form-submit')[0];
|
|
493
|
+
questionElementSubmitButton.innerText = 'Next';
|
|
494
|
+
questionElementSubmitButton.type = 'button';
|
|
495
|
+
questionElementSubmitButton.addEventListener('click', function () {
|
|
496
|
+
nextQuestion(idx, survey.id);
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
questionTab.insertAdjacentElement('beforeend', questionElement);
|
|
500
|
+
multipleQuestionForm.insertAdjacentElement('beforeend', questionTab);
|
|
501
|
+
});
|
|
502
|
+
return multipleQuestionForm;
|
|
503
|
+
};
|
|
504
|
+
var createSingleQuestionSurvey = function (posthog, survey, question) {
|
|
505
|
+
var questionType = question.type;
|
|
506
|
+
if (questionType === 'rating') {
|
|
507
|
+
return createRatingsPopup(posthog, survey, question);
|
|
508
|
+
}
|
|
509
|
+
else if (questionType === 'open' || questionType === 'link') {
|
|
510
|
+
return createOpenTextOrLinkPopup(posthog, survey, question);
|
|
511
|
+
}
|
|
512
|
+
else if (questionType === 'single_choice' || questionType === 'multiple_choice') {
|
|
513
|
+
return createMultipleChoicePopup(posthog, survey, question);
|
|
514
|
+
}
|
|
515
|
+
return null;
|
|
516
|
+
};
|
|
517
|
+
function getTextColor(el) {
|
|
518
|
+
var backgroundColor = window.getComputedStyle(el).backgroundColor;
|
|
519
|
+
if (backgroundColor === 'rgba(0, 0, 0, 0)') {
|
|
520
|
+
return 'black';
|
|
521
|
+
}
|
|
522
|
+
var colorMatch = backgroundColor.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);
|
|
523
|
+
if (!colorMatch)
|
|
524
|
+
return 'black';
|
|
525
|
+
var r = parseInt(colorMatch[1]);
|
|
526
|
+
var g = parseInt(colorMatch[2]);
|
|
527
|
+
var b = parseInt(colorMatch[3]);
|
|
528
|
+
var hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b));
|
|
529
|
+
return hsp > 127.5 ? 'black' : 'white';
|
|
530
|
+
}
|
|
531
|
+
function setTextColors(parentEl) {
|
|
532
|
+
var e_5, _a;
|
|
533
|
+
try {
|
|
534
|
+
for (var _b = __values(parentEl.querySelectorAll('.auto-text-color')), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
535
|
+
var el = _c.value;
|
|
536
|
+
el.style.color = getTextColor(el);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
540
|
+
finally {
|
|
541
|
+
try {
|
|
542
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
543
|
+
}
|
|
544
|
+
finally { if (e_5) throw e_5.error; }
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
function showQuestion(n, surveyId) {
|
|
548
|
+
var _a, _b;
|
|
549
|
+
// This function will display the specified tab of the form...
|
|
550
|
+
var tabs = (_b = (_a = document
|
|
551
|
+
.getElementsByClassName("PostHogSurvey".concat(surveyId))[0]) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelectorAll('.tab');
|
|
552
|
+
tabs[n].style.display = 'block';
|
|
553
|
+
}
|
|
554
|
+
function nextQuestion(currentQuestionIdx, surveyId) {
|
|
555
|
+
var _a, _b;
|
|
556
|
+
// figure out which tab to display
|
|
557
|
+
var tabs = (_b = (_a = document
|
|
558
|
+
.getElementsByClassName("PostHogSurvey".concat(surveyId))[0]) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelectorAll('.tab');
|
|
559
|
+
tabs[currentQuestionIdx].style.display = 'none';
|
|
560
|
+
showQuestion(currentQuestionIdx + 1, surveyId);
|
|
561
|
+
}
|
|
284
562
|
export function generateSurveys(posthog) {
|
|
285
563
|
callSurveys(posthog, true);
|
|
286
564
|
var currentUrl = location.href;
|