@sprig-technologies/sprig-browser 2.41.3 → 2.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- import { a as Y, h as Z, u as e, c as O, b as re, f as Me, F as he, g as ye, e as ge, _ as te, T as ke, A as ir, p as ne, i as ar, q as lr, r as or, M as de, s as Ze, t as dr, j as cr, n as ur, v as pr, k as Ae, l as mr, m as gr, x as hr, o as Qe } from "./view-CbuHTm4G.js";
2
- import { t as le } from "./metricsReporter-BGxaFPwL.js";
3
- import { a as qe, D as Ee, g as We, A as br } from "./core-DcjPmwAM.js";
4
- import { c as ie, a as ae, H as _e, M as pe, Q as ue, O as Se, B as ee, L as Ie, b as Te, S as vr, u as yr, g as fr, P as Sr, p as xr, v as kr, R as se, d as Ir, s as _r, e as Tr } from "./getAttributedUrl-DUf8Ossa.js";
1
+ import { a as Y, h as Z, u as e, c as O, f as Me, b as re, F as he, g as ye, e as ge, _ as te, T as ke, A as ir, p as ne, i as ar, q as lr, r as or, M as de, s as Ze, t as dr, n as cr, v as ur, j as pr, k as Ae, l as mr, m as gr, x as hr, o as Qe } from "./view-q6KAoLll.js";
2
+ import { t as le } from "./metricsReporter-DqmmYkn-.js";
3
+ import { b as qe, D as Ee, g as We, A as br } from "./core-D9RfS2Z8.js";
4
+ import { c as ie, a as ae, H as _e, M as pe, Q as ue, O as Se, B as ee, L as Ie, b as Te, S as vr, u as yr, g as fr, P as Sr, p as xr, v as kr, R as se, d as Ir, s as _r, e as Tr } from "./getAttributedUrl-BkFxZZq1.js";
5
5
  const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, type: a }) => {
6
- const { useMobileStyling: m, border: y, isLongFormSurvey: d, focusedQuestionId: g } = Y((v) => ({ useMobileStyling: v.useMobileStyling, border: v.border, isLongFormSurvey: le(v.studyType), focusedQuestionId: v.focusedQuestionId })), [c, f] = Z(!1), [i, S] = Z(""), [p, h] = Z(!1), b = d && g === t, x = r == null ? void 0 : r.collectName, _ = (r == null ? void 0 : r.nameLabelText) || "Full Name", k = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", U = (r == null ? void 0 : r.submitButtonText) || "Submit", P = !!i.trim(), M = c && (!x || P), D = (v, w = !1) => {
6
+ const { useMobileStyling: m, border: y, isLongFormSurvey: d, focusedQuestionId: g } = Y((v) => ({ useMobileStyling: v.useMobileStyling, border: v.border, isLongFormSurvey: le(v.studyType), focusedQuestionId: v.focusedQuestionId })), [c, f] = Z(!1), [i, S] = Z(""), [p, h] = Z(!1), b = d && g === t, x = r == null ? void 0 : r.collectName, _ = (r == null ? void 0 : r.nameLabelText) || "Full Name", k = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", U = (r == null ? void 0 : r.submitButtonText) || "Submit", P = !!i.trim(), E = c && (!x || P), D = (v, w = !1) => {
7
7
  v.preventDefault(), v.stopPropagation();
8
8
  let B = null;
9
9
  if (!w) {
10
- if (!M) return void h(!0);
10
+ if (!E) return void h(!0);
11
11
  B = { submitted: !0 }, x && (B.name = i);
12
12
  }
13
- o({ value: B, questionId: t, type: a }, M);
13
+ o({ value: B, questionId: t, type: a }, E);
14
14
  };
15
15
  return e("div", { className: O(n, d && !b && "ul-card--unfocused", "ul-card__consent-legal", "fade-in-transition"), children: [e(ie, { isRequired: d && (r == null ? void 0 : r.required), message: s, properties: { questionHtml: r.questionHtml } }), r != null && r.richTextBody ? e(ae, { children: e(_e, { className: "ul-rich-text-body", html: r.richTextBody, id: "ul-card__consent-legal-body-container" }) }) : null, e(pe, { embeddedType: "pdf", properties: r, children: e(ue, { children: [e("div", { className: "sprig-stretch", children: [e(Se, { allowTextEntry: !1, border: y, error: p && !c, id: "consent", isRadio: !1, isSelected: c, label: k, onUserInputChanged: ({ selected: v }) => {
16
16
  v !== c && f(!c);
@@ -20,15 +20,15 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
20
20
  v.currentTarget.style.borderColor = p && !P ? qe : y;
21
21
  }, onInput: (v) => {
22
22
  v.preventDefault(), v.stopPropagation(), S(v.currentTarget.value);
23
- }, placeholder: _, style: p && !P ? { borderColor: qe } : {}, tabIndex: 0, value: i })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(ee, { className: M ? "" : "sprig-button-disabled", onClick: D, children: U }), r.required === !1 && !d && e("button", { className: "ul-card-skip__button", onClick: (v) => D(v, !0), children: Me(r) })] })] }) })] }, t);
23
+ }, placeholder: _, style: p && !P ? { borderColor: qe } : {}, tabIndex: 0, value: i })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(ee, { className: E ? "" : "sprig-button-disabled", onClick: D, children: U }), r.required === !1 && !d && e("button", { className: "ul-card-skip__button", onClick: (v) => D(v, !0), children: Me(r) })] })] }) })] }, t);
24
24
  }, Nr = ({ activeValue: n, border: s, icon: o, isPressed: r, onSubmit: t, range: a, scaleLabelType: m, selectedValue: y, setSelectedValue: d, setActiveValue: g, setIsPressed: c, useMobileStyling: f, value: i, viewDocument: S }) => {
25
- const { isLongFormSurvey: p, enableCspTrustedTypes: h } = Y((w) => ({ isLongFormSurvey: le(w.studyType), enableCspTrustedTypes: w.enableCspTrustedTypes })), b = `option-${i}`, x = m === "number", _ = m === "star", k = m === "smiley", U = x && i === n || i === y, [P, M] = (() => {
25
+ const { isLongFormSurvey: p, enableCspTrustedTypes: h } = Y((w) => ({ isLongFormSurvey: le(w.studyType), enableCspTrustedTypes: w.enableCspTrustedTypes })), b = `option-${i}`, x = m === "number", _ = m === "star", k = m === "smiley", U = x && i === n || i === y, [P, E] = (() => {
26
26
  const w = _ && y !== null && i <= y;
27
27
  return _ && i <= n || k && i === n || w || i === n || i === y ? [s, r || w || i === y ? 1 : 0.3] : ["", 1];
28
28
  })(), D = he(() => {
29
- const w = { borderColor: U ? P : "", fillOpacity: U ? "" : M, zIndex: U ? 3 : "auto", color: y === i ? "#fff" : "" };
29
+ const w = { borderColor: U ? P : "", fillOpacity: U ? "" : E, zIndex: U ? 3 : "auto", color: y === i ? "#fff" : "" };
30
30
  return x ? { ...w, backgroundColor: y === i ? P : "" } : { ...w, color: _ || k || y === i ? P : "" };
31
- }, [U, P, M, y, i, x, _, k]), v = he(() => We((({ icon: w, scaleLabelType: B, value: T, selectedValue: L }) => {
31
+ }, [U, P, E, y, i, x, _, k]), v = he(() => We((({ icon: w, scaleLabelType: B, value: T, selectedValue: L }) => {
32
32
  if (B === "smiley" && T === L) {
33
33
  let A = 0;
34
34
  return w.replace(/black/g, () => ++A == 1 ? "black" : "white");
@@ -56,8 +56,8 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
56
56
  }, wr = ({ className: n, labels: s, message: o, next: r, properties: t, questionId: a, type: m }) => {
57
57
  const { border: y, useMobileStyling: d, viewDocument: g, isLongFormSurvey: c, focusedQuestionId: f } = Y((T) => ({ border: T.border, useMobileStyling: T.useMobileStyling, viewDocument: T.viewDocument, isLongFormSurvey: le(T.studyType), focusedQuestionId: T.focusedQuestionId })), [i, S] = Z(-1), [p, h] = Z(!1), [b, x] = Z(null), _ = c && f === a, k = s && s.left, U = s && s.right;
58
58
  let P;
59
- const { range: M, scaleLabelType: D, ratingIcons: v } = t;
60
- M && (P = Number(M));
59
+ const { range: E, scaleLabelType: D, ratingIcons: v } = t;
60
+ E && (P = Number(E));
61
61
  const w = P || 5, B = (T) => {
62
62
  var L, A;
63
63
  switch (D) {
@@ -137,10 +137,10 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
137
137
  D.preventDefault(), D.stopPropagation(), o({ value: _, questionId: a, type: m }, !0), d && d();
138
138
  }, x = r.reduce((D, v) => (D[v.id] = null, D), {}), [_, k] = Z(x), U = (D) => p && Object.values(D).every((v) => v == null), P = (D, v) => {
139
139
  c && o({ value: { ..._, [D]: v }, questionId: a, type: m }, !U({ ..._, [D]: v })), k((w) => ({ ...w, [D]: v }));
140
- }, M = t.displayMatrixAsAccordion || g;
140
+ }, E = t.displayMatrixAsAccordion || g;
141
141
  return e("form", { className: O(n, !c && "ul-card__matrix", "fade-in-transition", c && !h && "ul-card--unfocused"), id: "text-form", onClick: () => {
142
142
  h && i(a);
143
- }, onSubmit: b, children: [e(ie, { isRequired: c && (t == null ? void 0 : t.required), message: s, properties: t }), e(pe, { properties: t, children: [e(ae, { children: [e(M ? Lr : Pr, { columns: S, onSelect: P, options: r, selectedOptions: _ }), y && e(Ie, { handleSubmit: b, isSubmitDisabled: U(_) })] }), !c && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: U(_), children: ge(t) }) }) })] })] }, a);
143
+ }, onSubmit: b, children: [e(ie, { isRequired: c && (t == null ? void 0 : t.required), message: s, properties: t }), e(pe, { properties: t, children: [e(ae, { children: [e(E ? Lr : Pr, { columns: S, onSelect: P, options: r, selectedOptions: _ }), y && e(Ie, { handleSubmit: b, isSubmitDisabled: U(_) })] }), !c && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: U(_), children: ge(t) }) }) })] })] }, a);
144
144
  }, Ye = ({ className: n, message: s, onSubmit: o, options: r = [], properties: t, questionId: a, type: m, showIndividualSubmit: y = !1, onSubmitButtonClick: d }) => {
145
145
  const { border: g, useMobileStyling: c, isLongFormSurvey: f, focusedQuestionId: i, setFocusedQuestionId: S } = Y((u) => ({ border: u.border, useMobileStyling: u.useMobileStyling, isLongFormSurvey: le(u.studyType), focusedQuestionId: u.focusedQuestionId, setFocusedQuestionId: u.setFocusedQuestionId })), p = f && i === a, h = r.reduce((u, C) => (u[C.id] = { isSelected: !1 }, u), {}), [b, x] = Z(h), _ = m === "multiplechoice", k = t.required, U = r.find((u) => {
146
146
  var C;
@@ -149,8 +149,8 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
149
149
  var l;
150
150
  const W = r.find((I) => `${I.id}` === C), H = V.userText === void 0 || V.userText.trim() === "";
151
151
  return ((l = W == null ? void 0 : W.optionProperties) == null ? void 0 : l.allowsTextEntry) && H && V.isSelected;
152
- }), M = (u) => Object.values(u).filter((C) => C.isSelected).length, D = t.minSelect && t.minSelect > 0 && t.maxSelectMode === Te.Range && M(b) < t.minSelect && (k || M(b) > 0), v = (u) => P(u) || k && !M(u) || !((C) => {
153
- const { minSelect: V = 0, maxSelect: W = 1 / 0, maxSelectMode: H } = t, l = M(C);
152
+ }), E = (u) => Object.values(u).filter((C) => C.isSelected).length, D = t.minSelect && t.minSelect > 0 && t.maxSelectMode === Te.Range && E(b) < t.minSelect && (k || E(b) > 0), v = (u) => P(u) || k && !E(u) || !((C) => {
153
+ const { minSelect: V = 0, maxSelect: W = 1 / 0, maxSelectMode: H } = t, l = E(C);
154
154
  switch (H) {
155
155
  case Te.Maximum:
156
156
  return l <= W;
@@ -166,7 +166,7 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
166
166
  K(u.id, u.selected, u.userText, u.noneOfTheAbove), u.selected && f && !_ && !p && S(a);
167
167
  }, L = (u) => {
168
168
  var C;
169
- return (t == null ? void 0 : t.maxSelectMode) !== Te.Unlimited && M(b) === (t == null ? void 0 : t.maxSelect) && !((C = b[u]) != null && C.isSelected);
169
+ return (t == null ? void 0 : t.maxSelectMode) !== Te.Unlimited && E(b) === (t == null ? void 0 : t.maxSelect) && !((C = b[u]) != null && C.isSelected);
170
170
  }, A = (u) => {
171
171
  u.preventDefault(), u.stopPropagation(), o(b, !0), d && d();
172
172
  }, K = (u, C, V, W) => {
@@ -175,23 +175,23 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
175
175
  else U && !W && b[U.id].isSelected && (H[U.id].isSelected = !1);
176
176
  H[u] = { isSelected: C, userText: V };
177
177
  const l = _ && Object.entries(H).some(([q, F]) => {
178
- var E, G;
179
- return F.isSelected && ((G = (E = r.find((X) => `${X.id}` === q)) == null ? void 0 : E.optionProperties) == null ? void 0 : G.allowsTextEntry);
178
+ var M, G;
179
+ return F.isSelected && ((G = (M = r.find((X) => `${X.id}` === q)) == null ? void 0 : M.optionProperties) == null ? void 0 : G.allowsTextEntry);
180
180
  }), I = !v(H);
181
181
  f && (o(H, I), _ && !l && I && d && d()), x(H);
182
182
  };
183
183
  return e("form", { className: O(n, "ul-card--multiple", "fade-in-transition", f && !p && "ul-card--unfocused"), id: "text-form", onClick: m === "multipleselect" ? () => {
184
184
  f && i !== a && m === "multipleselect" && S(a);
185
- } : void 0, onSubmit: A, children: [e(ie, { isRequired: f && (t == null ? void 0 : t.required), message: s, properties: t }), e(pe, { properties: t, children: e(ye, { children: [e(ae, { children: [t.isDropdown ? e(vr, { disabledOptions: r.filter((u) => L(u.id)), dropdownFooter: D ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [M(b), "/", t.minSelect] }) : void 0, isMultiSelect: !_, multiselectText: t.dropdownMultiselectedText ?? "choices selected", onChange: (u) => {
185
+ } : void 0, onSubmit: A, children: [e(ie, { isRequired: f && (t == null ? void 0 : t.required), message: s, properties: t }), e(pe, { properties: t, children: e(ye, { children: [e(ae, { children: [t.isDropdown ? e(vr, { disabledOptions: r.filter((u) => L(u.id)), dropdownFooter: D ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [E(b), "/", t.minSelect] }) : void 0, isMultiSelect: !_, multiselectText: t.dropdownMultiselectedText ?? "choices selected", onChange: (u) => {
186
186
  const C = { ...b };
187
187
  for (const V of r) u.includes(V) ? C[V.id].isSelected = !0 : C[V.id].isSelected = !1;
188
188
  f && o(C, !v(C)), x(C);
189
189
  }, options: r, placeholderText: t.dropdownPlaceholderText ?? (_ ? "Select choice" : "Select choice(s)"), value: r.filter((u) => b[u.id].isSelected) }) : e("div", { className: O(re("ul-card__choices", c)), role: _ ? "radiogroup" : "group", children: [r.map(({ id: u, label: C, value: V, optionProperties: W }) => {
190
- var F, E;
190
+ var F, M;
191
191
  const H = `${u}`, { allowsTextEntry: l, noneOfTheAbove: I } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...W };
192
- return e(Se, { allowTextEntry: l, border: g, disabled: L(H), error: (q = b, P(q)), id: H, isRadio: _, isSelected: !!((F = b[H]) != null && F.isSelected), label: C, noneOfTheAbove: I, onUserInputChanged: T, promptText: (W == null ? void 0 : W.otherOptionPlaceholder) || "Please specify", text: (E = b[u]) == null ? void 0 : E.userText, useMobileStyling: c, value: V }, H);
192
+ return e(Se, { allowTextEntry: l, border: g, disabled: L(H), error: (q = b, P(q)), id: H, isRadio: _, isSelected: !!((F = b[H]) != null && F.isSelected), label: C, noneOfTheAbove: I, onUserInputChanged: T, promptText: (W == null ? void 0 : W.otherOptionPlaceholder) || "Please specify", text: (M = b[u]) == null ? void 0 : M.userText, useMobileStyling: c, value: V }, H);
193
193
  var q;
194
- }), !!D && e("div", { className: "ul-card__min-select-counter", children: [M(b), "/", t.minSelect] })] }), B && e(Ie, { handleSubmit: A, isSubmitDisabled: v(b) })] }), !f && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: v(b), onClick: A, children: ge(t) }) }) })] }) })] }, a);
194
+ }), !!D && e("div", { className: "ul-card__min-select-counter", children: [E(b), "/", t.minSelect] })] }), B && e(Ie, { handleSubmit: A, isSubmitDisabled: v(b) })] }), !f && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: v(b), onClick: A, children: ge(t) }) }) })] }) })] }, a);
195
195
  }, Er = (n) => {
196
196
  const { questionId: s, type: o, next: r, options: t } = n, { setFocusedQuestionId: a } = Y((m) => ({ setFocusedQuestionId: m.setFocusedQuestionId }));
197
197
  return e(Ye, { ...n, onSubmit: (m, y) => {
@@ -216,9 +216,9 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
216
216
  return e("form", { className: O(n, "ul-card--nps", "fade-in-transition", i && !p && "ul-card--unfocused"), children: [e(ie, { isRequired: i && (r == null ? void 0 : r.required), message: o, properties: r }), e(pe, { properties: r, children: [e(ae, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((x, _) => e("button", { className: O(re("nps-number", c), re(`nps-number-${_}`, c)), id: `option-${_}`, onClick: (k) => {
217
217
  i && (k.preventDefault(), k.stopPropagation(), d(_)), t({ value: _, questionId: a, type: m }, !0);
218
218
  }, onKeyDown: (k) => {
219
- var P, M;
219
+ var P, E;
220
220
  const U = f.querySelectorAll("button.nps-number");
221
- k.key === "ArrowRight" ? (P = U[_ + 1]) == null || P.focus() : k.key === "ArrowLeft" ? (M = U[_ - 1]) == null || M.focus() : k.key !== "Enter" && k.key !== " " || (i && (k.preventDefault(), k.stopPropagation(), d(_)), t({ value: _, questionId: a, type: m }, !0));
221
+ k.key === "ArrowRight" ? (P = U[_ + 1]) == null || P.focus() : k.key === "ArrowLeft" ? (E = U[_ - 1]) == null || E.focus() : k.key !== "Enter" && k.key !== " " || (i && (k.preventDefault(), k.stopPropagation(), d(_)), t({ value: _, questionId: a, type: m }, !0));
222
222
  }, onPointerDown: (k) => {
223
223
  k.currentTarget.style.zIndex = "2", k.currentTarget.style.borderColor = g;
224
224
  }, onPointerLeave: (k) => {
@@ -232,7 +232,7 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
232
232
  var T, L;
233
233
  S && !b && (U ? (T = k.current) == null || T.focus() : (L = k.current) == null || L.blur());
234
234
  }, [S, U, b]);
235
- const P = x.trim(), M = t.required === !0 && !P, D = yr(k, () => i()), v = (T) => {
235
+ const P = x.trim(), E = t.required === !0 && !P, D = yr(k, () => i()), v = (T) => {
236
236
  T.preventDefault(), T.stopPropagation();
237
237
  const L = P.length > 0, A = !t.required || L;
238
238
  r({ value: x, questionId: a, type: m }, A), d && d(L);
@@ -251,7 +251,7 @@ const Cr = ({ className: n, message: s, next: o, properties: r, questionId: t, t
251
251
  }
252
252
  }, onFocus: (T) => {
253
253
  T.currentTarget.style.borderColor = c, h(a);
254
- }, placeholder: w, ref: k, role: "textbox", tabIndex: 0 }) }), t.footerHtml && e(_e, { className: "footer", html: t.footerHtml }), y && e(Ie, { handleSubmit: v, isSubmitDisabled: M }), e(ue, { children: !S && e(ee, { disabled: M || !!g, onClick: v, children: ge(t) }) })] }) }) })] }, a);
254
+ }, placeholder: w, ref: k, role: "textbox", tabIndex: 0 }) }), t.footerHtml && e(_e, { className: "footer", html: t.footerHtml }), y && e(Ie, { handleSubmit: v, isSubmitDisabled: E }), e(ue, { children: !S && e(ee, { disabled: E || !!g, onClick: v, children: ge(t) }) })] }) }) })] }, a);
255
255
  }, Pe = 1, Ke = 2, Xe = 3, Ce = (n) => n.type === "av_permission", Oe = (n) => n.type === "screen_permission", Je = (n, s) => n === void 0 ? Pe : n ? ((o, r) => !(Ce(r) ? r.permissionDescriptors : []).includes("camera") || o.getVideoTracks().length > 0)(n, s) ? Xe : Pe : Ke, $e = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
256
256
  }, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, ce = ar((n) => ({ ...$e, reset: () => {
257
257
  n($e);
@@ -357,7 +357,7 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
357
357
  const t = Y(), { surveyId: a, responseGroupUid: m, userId: y, update: d } = t, g = ce(), { screenPermissionRequested: c } = g, f = ce((b) => b.avStream);
358
358
  let i = ce((b) => b.currentPage);
359
359
  i || (i = function({ pages: b, userId: x, responseGroupUid: _, surveyId: k, questionId: U, next: P }) {
360
- const { updatePage: M } = ce.getState(), { eventEmitFn: D, recorderEventEmitter: v } = Y.getState(), w = { questionId: U, surveyId: k, visitorId: x, responseGroupUid: _ };
360
+ const { updatePage: E } = ce.getState(), { eventEmitFn: D, recorderEventEmitter: v } = Y.getState(), w = { questionId: U, surveyId: k, visitorId: x, responseGroupUid: _ };
361
361
  let B = 0;
362
362
  v.emit("recorded.task.permission.screen"), D("recorded.task.permission.screen"), v.emit("permission.status", { "permission.status.callback": (L, A, K, u) => {
363
363
  const C = b[B], { type: V } = C, W = ["screen"];
@@ -365,7 +365,7 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
365
365
  const { permissionDescriptors: H } = C, l = H == null ? void 0 : H.includes("microphone"), I = H == null ? void 0 : H.includes("camera");
366
366
  l && W.push("audio"), I && W.push("video"), (L != null && L.active && !I || L != null && L.active && A) && B++;
367
367
  }
368
- Oe(b[B]) && K && (B++, v.emit("begin.recording", { "recording.media.types": W, "start.recording.callback": (H) => M({ mediaRecordingUids: H }) })), M({ currentPage: b[B], avStream: L, screenPermissionRequested: K, nextQuestion: P, type: V, passthroughData: w, recordingMediaTypes: W, captureStream: u });
368
+ Oe(b[B]) && K && (B++, v.emit("begin.recording", { "recording.media.types": W, "start.recording.callback": (H) => E({ mediaRecordingUids: H }) })), E({ currentPage: b[B], avStream: L, screenPermissionRequested: K, nextQuestion: P, type: V, passthroughData: w, recordingMediaTypes: W, captureStream: u });
369
369
  } });
370
370
  const T = b[B];
371
371
  return T.type === "av_permission" && Re({ currentPage: T, pages: b }), T;
@@ -396,7 +396,7 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
396
396
  m();
397
397
  }, [m]), e("div", { className: O(n, "ul-card--thanks", "fade-in-transition"), children: e("div", { children: e("div", { className: "ul-card--thanks-content", children: [e("div", { className: "ul-thanks-check", children: e("svg", { "aria-labelledby": "title", fill: "none", height: "99", viewBox: "0 0 81 99", width: "81", xmlns: "http://www.w3.org/2000/svg", children: [e("path", { clipRule: "evenodd", d: "M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z", fill: o, fillRule: "evenodd" }), e("path", { clipRule: "evenodd", d: "M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z", fill: o, fillRule: "evenodd" }), e("path", { d: "M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z", fill: "black", fillOpacity: "0.2" })] }) }), e(ie, { message: d }), y] }) }) }, s);
398
398
  }, ve = "ul-card-video__player_recorder", He = "ul-video-btn", Le = 0, Ve = 1, Kr = ({ className: n, message: s, next: o, properties: r, questionId: t, type: a }) => {
399
- const { apiURL: m, envId: y, handleUploadUpdate: d, headers: g, responseGroupUid: c, surveyId: f, update: i, viewDocument: S, visitorId: p } = Y((u) => ({ apiURL: u.apiURL, envId: u.envId, handleUploadUpdate: u.handleUploadUpdate, headers: u.headers, responseGroupUid: u.responseGroupUid, surveyId: u.surveyId, update: u.update, viewDocument: u.viewDocument, visitorId: u.userId })), [h, b] = Z(!1), [x, _] = Z(null), [k, U] = Z(null), [P, M] = Z(Le), [D, v] = Z(null), [w, B] = Z(null), T = r && r.videoUrl, L = ke((u) => {
399
+ const { apiURL: m, envId: y, handleUploadUpdate: d, headers: g, responseGroupUid: c, surveyId: f, update: i, viewDocument: S, visitorId: p } = Y((u) => ({ apiURL: u.apiURL, envId: u.envId, handleUploadUpdate: u.handleUploadUpdate, headers: u.headers, responseGroupUid: u.responseGroupUid, surveyId: u.surveyId, update: u.update, viewDocument: u.viewDocument, visitorId: u.userId })), [h, b] = Z(!1), [x, _] = Z(null), [k, U] = Z(null), [P, E] = Z(Le), [D, v] = Z(null), [w, B] = Z(null), T = r && r.videoUrl, L = ke((u) => {
400
400
  u && v(u);
401
401
  }, [v]);
402
402
  ne(() => {
@@ -419,9 +419,9 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
419
419
  u.appendChild(C);
420
420
  }
421
421
  } }), e(pe, { properties: r, children: e("button", { className: `${He} ul-record-response-btn`, onClick: (u) => {
422
- u.preventDefault(), u.stopPropagation(), document.getElementById(ve) && xr(ve), M(Ve);
422
+ u.preventDefault(), u.stopPropagation(), document.getElementById(ve) && xr(ve), E(Ve);
423
423
  } }) })] }), e("div", { style: { display: P === Ve ? "block" : "none" }, children: [e("button", { className: `${He} ul-back-question-btn`, onClick: (u) => {
424
- u.preventDefault(), u.stopPropagation(), M(Le);
424
+ u.preventDefault(), u.stopPropagation(), E(Le);
425
425
  }, style: { display: r.hideRecordedPrompt ? "none" : "block" } }), e("div", { id: "ul-recorder-player-container", ref: (u) => {
426
426
  if (u && u.children.length === 0) {
427
427
  B(u);
@@ -436,7 +436,7 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
436
436
  const t = Math.round(Math.min(99, ...Object.values(s).filter((a) => a.isSubmitted).map((a) => a.progressPct || 0)));
437
437
  return e("div", { className: O(n, "ul-card--uploading", "fade-in-transition"), children: [e("div", { "aria-busy": "true", "aria-label": "Processing...", "aria-live": "polite", className: "ul-loading-spinner-container", role: "progressbar", children: e("div", { className: "ul-loading-spinner", children: [e("div", { className: "first" }), e("div", { className: "second" }), e("div", { className: "third" }), e("div", { className: "fourth" })] }) }), e(ie, { message: `${o} (${t}% complete)` }), e("p", { className: "ul-caption", children: r })] });
438
438
  }, sr = lr(void 0), Jr = ({ value: n, children: s }) => e(sr.Provider, { value: n, children: s }), et = ({ isRightLabel: n, isLeftLabel: s }) => n ? de.RIGHT : s ? de.LEFT : null, rt = "Best", tt = "Worst", nt = ({ className: n, labels: s, message: o, properties: r, options: t, questionId: a, type: m, next: y }) => {
439
- var U, P, M, D;
439
+ var U, P, E, D;
440
440
  const [d, g] = Z(t.map((v, w) => ({ ...v, label: v.label === "" ? `Item ${w + 1}` : v.label, isRightLabel: !1, isLeftLabel: !1 }))), c = (() => {
441
441
  const v = or(sr);
442
442
  if (v === void 0) throw new Error("usePreviousResponses must be used within a PreviousResponsesProvider");
@@ -457,12 +457,12 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
457
457
  const { border: p, useMobileStyling: h, enableCspTrustedTypes: b } = Y((v) => ({ border: v.border, useMobileStyling: v.useMobileStyling, enableCspTrustedTypes: v.enableCspTrustedTypes })), x = (v, w) => () => {
458
458
  i || g((B) => ((T, L, A) => T.map((K) => K.id === L ? { ...K, isRightLabel: A === de.RIGHT, isLeftLabel: A === de.LEFT } : A === de.RIGHT && K.isRightLabel || A === de.LEFT && K.isLeftLabel ? { ...K, isRightLabel: !1, isLeftLabel: !1 } : K))(B, v, w));
459
459
  }, _ = (U = r.ratingIcons) == null ? void 0 : U[0].svg, k = (P = r.ratingIcons) == null ? void 0 : P[1].svg;
460
- return e("form", { className: O(n, "ul-card-maxdiff", "fade-in-transition"), children: [e(ie, { isRequired: r == null ? void 0 : r.required, message: o, properties: r }), e(ae, { children: e("div", { className: "ul-card--maxdiff__question-inner-container", children: [e("div", { className: "ul-card-maxdiff__label", children: (s == null ? void 0 : s.left) || ((M = r == null ? void 0 : r.labels) == null ? void 0 : M.left) || rt }), e("div", { children: " " }), e("div", { className: "ul-card-maxdiff__label", children: (s == null ? void 0 : s.right) || ((D = r == null ? void 0 : r.labels) == null ? void 0 : D.right) || tt }), d.map(({ id: v, label: w, isLeftLabel: B, isRightLabel: T }) => e(ye, { children: [e("div", { className: "ul-card-maxdiff__option-control " + (k ? "smiley" : ""), children: k ? e(Ge, { ariaPressed: B, className: B ? "ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected good" : "ul-card-maxdiff__option-btn", enableCspTrustedTypes: b, html: k, id: `smiley-good-${v}`, onClick: x(v, de.LEFT) }) : e(Se, { allowTextEntry: !1, ariaLabel: `bestLabel-${w}`, border: p, choiceStyle: f, error: !1, id: `${v}`, isRadio: !0, isSelected: B, onUserInputChanged: x(v, de.LEFT), useMobileStyling: h }) }), e("div", { className: "ul-card-maxdiff__option-label", children: w }), e("div", { className: "ul-card-maxdiff__option-control " + (_ ? "smiley" : ""), children: _ ? e(Ge, { ariaPressed: T, className: T ? "ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected bad" : "ul-card-maxdiff__option-btn", enableCspTrustedTypes: b, html: _, id: `smiley-bad-${v}`, onClick: x(v, de.RIGHT) }) : e(Se, { allowTextEntry: !1, ariaLabel: `worstLabel-${w}`, border: p, choiceStyle: f, error: !1, id: `${v}`, isRadio: !0, isSelected: T, onUserInputChanged: x(v, de.RIGHT), useMobileStyling: h }) })] }))] }) })] }, a);
460
+ return e("form", { className: O(n, "ul-card-maxdiff", "fade-in-transition"), children: [e(ie, { isRequired: r == null ? void 0 : r.required, message: o, properties: r }), e(ae, { children: e("div", { className: "ul-card--maxdiff__question-inner-container", children: [e("div", { className: "ul-card-maxdiff__label", children: (s == null ? void 0 : s.left) || ((E = r == null ? void 0 : r.labels) == null ? void 0 : E.left) || rt }), e("div", { children: " " }), e("div", { className: "ul-card-maxdiff__label", children: (s == null ? void 0 : s.right) || ((D = r == null ? void 0 : r.labels) == null ? void 0 : D.right) || tt }), d.map(({ id: v, label: w, isLeftLabel: B, isRightLabel: T }) => e(ye, { children: [e("div", { className: "ul-card-maxdiff__option-control " + (k ? "smiley" : ""), children: k ? e(Ge, { ariaPressed: B, className: B ? "ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected good" : "ul-card-maxdiff__option-btn", enableCspTrustedTypes: b, html: k, id: `smiley-good-${v}`, onClick: x(v, de.LEFT) }) : e(Se, { allowTextEntry: !1, ariaLabel: `bestLabel-${w}`, border: p, choiceStyle: f, error: !1, id: `${v}`, isRadio: !0, isSelected: B, onUserInputChanged: x(v, de.LEFT), useMobileStyling: h }) }), e("div", { className: "ul-card-maxdiff__option-label", children: w }), e("div", { className: "ul-card-maxdiff__option-control " + (_ ? "smiley" : ""), children: _ ? e(Ge, { ariaPressed: T, className: T ? "ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected bad" : "ul-card-maxdiff__option-btn", enableCspTrustedTypes: b, html: _, id: `smiley-bad-${v}`, onClick: x(v, de.RIGHT) }) : e(Se, { allowTextEntry: !1, ariaLabel: `worstLabel-${w}`, border: p, choiceStyle: f, error: !1, id: `${v}`, isRadio: !0, isSelected: T, onUserInputChanged: x(v, de.RIGHT), useMobileStyling: h }) })] }))] }) })] }, a);
461
461
  }, Ge = ({ enableCspTrustedTypes: n, ariaPressed: s, className: o, html: r, id: t, onClick: a }) => {
462
462
  const m = he(() => We(r, n), [n, r]);
463
463
  return e("span", { "aria-pressed": s, className: o, dangerouslySetInnerHTML: { __html: m }, id: t, onClick: a, tabIndex: 0, type: "button" });
464
464
  }, st = ({ className: n, labels: s, message: o, next: r, properties: t, questionId: a, type: m, onSubmitButtonClick: y, options: d, showIndividualSubmit: g = !1 }) => {
465
- const c = te(null), f = te(0), i = te(0), S = te(null), p = te(!1), h = te([]), [b, x] = Z(() => (t == null ? void 0 : t.required) === !0), [_, k] = Z(() => d.map((N) => ({ ...N, rank: null }))), U = he(() => Array.from({ length: d.length }, (N, Q) => Q + 1), [d.length]), { isLongFormSurvey: P, focusedQuestionId: M, setFocusedQuestionId: D, useMobileStyling: v, isPreview: w, headers: B } = Y((N) => ({ useMobileStyling: N.useMobileStyling, isLongFormSurvey: le(N.studyType), focusedQuestionId: N.focusedQuestionId, setFocusedQuestionId: N.setFocusedQuestionId, isPreview: N.isPreview, headers: N.headers })), T = (B == null ? void 0 : B["userleap-platform"]) === "android", L = v && !w && !T, A = !L && !T, K = P && M === a, u = (N) => {
465
+ const c = te(null), f = te(0), i = te(0), S = te(null), p = te(!1), h = te([]), [b, x] = Z(() => (t == null ? void 0 : t.required) === !0), [_, k] = Z(() => d.map((N) => ({ ...N, rank: null }))), U = he(() => Array.from({ length: d.length }, (N, Q) => Q + 1), [d.length]), { isLongFormSurvey: P, focusedQuestionId: E, setFocusedQuestionId: D, useMobileStyling: v, isPreview: w, headers: B } = Y((N) => ({ useMobileStyling: N.useMobileStyling, isLongFormSurvey: le(N.studyType), focusedQuestionId: N.focusedQuestionId, setFocusedQuestionId: N.setFocusedQuestionId, isPreview: N.isPreview, headers: N.headers })), T = (B == null ? void 0 : B["userleap-platform"]) === "android", L = v && !w && !T, A = !L && !T, K = P && E === a, u = (N) => {
466
466
  N.preventDefault(), q(_), y && y();
467
467
  }, C = (N, Q) => {
468
468
  k(($) => {
@@ -522,16 +522,16 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
522
522
  N.reduce(($, R) => ($[R.id] = R.rank, $), Q), r({ value: Q, questionId: a, type: m }, !0);
523
523
  }, F = (N) => {
524
524
  x(!1), P && q(N);
525
- }, { left: E, right: G } = s, X = d.length, me = (N) => {
525
+ }, { left: M, right: G } = s, X = d.length, me = (N) => {
526
526
  N.preventDefault(), N.currentTarget.classList.add("is-drop-target");
527
527
  }, be = (N) => {
528
528
  N.currentTarget.classList.remove("is-drop-target");
529
529
  }, xe = (N) => {
530
530
  c.current = null, N.currentTarget.classList.remove("is-dragging");
531
531
  };
532
- return e("form", { className: O(n, "ul-card-rank", "fade-in-transition", P && !K && "ul-card--unfocused"), onClick: P ? () => {
533
- P && M !== a && D(a);
534
- } : void 0, onSubmit: u, children: [e(ie, { isRequired: t == null ? void 0 : t.required, message: o, properties: t }), e(pe, { properties: t, children: e(ye, T ? { children: [e(ae, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", E] }) }), e("ol", { className: "ul-card-rank__list", children: _.map(({ id: N, label: Q, rank: $ }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${Q}`, className: O("ul-card-rank__select", $ == null && "ul-card-rank__select--placeholder"), name: `rank[${N}]`, onChange: (R) => C(N, R.currentTarget.value), value: $ ?? "", children: [$ == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), U.map((R) => e("option", { className: "ul-card-rank__select-option", value: R, children: R }, `${R}-${a}`))] }), e("span", { children: Q })] }, N)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [X, " - ", G] }) })] }), g && e(Ie, { handleSubmit: u, isSubmitDisabled: b })] }), !P && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: b, children: ge(t) }) }) })] } : { children: [e(ae, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", E] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: T ? void 0 : (N) => {
532
+ return e("form", { className: O(n, "ul-card-rank", "fade-in-transition", P && !K && "ul-card--unfocused"), onClick: P && !K ? () => {
533
+ D(a);
534
+ } : void 0, onSubmit: u, children: [e(ie, { isRequired: t == null ? void 0 : t.required, message: o, properties: t }), e(pe, { properties: t, children: e(ye, T ? { children: [e(ae, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", M] }) }), e("ol", { className: "ul-card-rank__list", children: _.map(({ id: N, label: Q, rank: $ }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${Q}`, className: O("ul-card-rank__select", $ == null && "ul-card-rank__select--placeholder"), name: `rank[${N}]`, onChange: (R) => C(N, R.currentTarget.value), value: $ ?? "", children: [$ == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), U.map((R) => e("option", { className: "ul-card-rank__select-option", value: R, children: R }, `${R}-${a}`))] }), e("span", { children: Q })] }, N)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [X, " - ", G] }) })] }), g && e(Ie, { handleSubmit: u, isSubmitDisabled: b })] }), !P && e(ue, { children: e("div", { className: "ul-card__button-wrapper", children: e(ee, { disabled: b, children: ge(t) }) }) })] } : { children: [e(ae, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", M] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: T ? void 0 : (N) => {
535
535
  N.preventDefault(), N.dataTransfer && (N.dataTransfer.dropEffect = "move");
536
536
  }, children: _.map(({ id: N, label: Q, rank: $ }, R) => {
537
537
  return e("li", { className: "ul-card-rank__option", draggable: !!A || void 0, onDragEnd: A ? xe : void 0, onDragEnter: A ? me : void 0, onDragLeave: A ? be : void 0, onDragStart: A ? (oe = R, (J) => {
@@ -591,8 +591,8 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
591
591
  return _ ? m ? e("div", { className: "ul-card-scroll-wrapper", children: _ }, c) : _ : null;
592
592
  }, at = ({ isSubmitDisabled: n = !1, onSubmit: s, buttonText: o }) => {
593
593
  var S;
594
- const { cards: r, forceBrandedLogo: t, index: a, marketingUrl: m, showSurveyBrand: y, slugName: d, surveyId: g, useMobileStyling: c } = Y((p) => ({ cards: p.cards, forceBrandedLogo: p.forceBrandedLogo, index: p.index, marketingUrl: p.marketingUrl, showSurveyBrand: p.showSurveyBrand, slugName: p.slugName, surveyId: p.surveyId, useMobileStyling: p.useMobileStyling })), f = ((S = r[a]) == null ? void 0 : S.type) === "thanks", i = cr({ marketingUrl: m, slugName: d, surveyId: g, forceBrandedLogo: t });
595
- return e("footer", { className: O("long-form-question-footer-container", c && "long-form-question-footer-container--mobile", f && "long-form-question-footer-container-center"), children: [f && t ? e(dr, { marketingUrlLink: i }) : e("div", { className: "long-form-question-footer-container-logo", children: y ? e(ur, { forceBrandedLogo: t, marketingUrlLink: i }) : null }), !f && e("div", { className: O("ul-card__button-wrapper", "ul-card-vertical__button-wrapper", "long-form-question-footer-container-actions"), children: e(ee, { className: O("long-form-button", n && "sprig-button-disabled"), disabled: n, onClick: s, children: e("span", { className: "long-form-button-text-container", children: o ?? e(pr, { stroke: "white" }) }) }) })] });
594
+ const { cards: r, forceBrandedLogo: t, index: a, marketingUrl: m, showSurveyBrand: y, slugName: d, surveyId: g, useMobileStyling: c } = Y((p) => ({ cards: p.cards, forceBrandedLogo: p.forceBrandedLogo, index: p.index, marketingUrl: p.marketingUrl, showSurveyBrand: p.showSurveyBrand, slugName: p.slugName, surveyId: p.surveyId, useMobileStyling: p.useMobileStyling })), f = ((S = r[a]) == null ? void 0 : S.type) === "thanks", i = pr({ marketingUrl: m, slugName: d, surveyId: g, forceBrandedLogo: t });
595
+ return e("footer", { className: O("long-form-question-footer-container", c && "long-form-question-footer-container--mobile", f && "long-form-question-footer-container-center"), children: [f && t ? e(dr, { marketingUrlLink: i }) : e("div", { className: "long-form-question-footer-container-logo", children: y ? e(cr, { forceBrandedLogo: t, marketingUrlLink: i }) : null }), !f && e("div", { className: O("ul-card__button-wrapper", "ul-card-vertical__button-wrapper", "long-form-question-footer-container-actions"), children: e(ee, { className: O("long-form-button", n && "sprig-button-disabled"), disabled: n, onClick: s, children: e("span", { className: "long-form-button-text-container", children: o ?? e(ur, { stroke: "white" }) }) }) })] });
596
596
  }, ut = ({ cards: n, next: s, previousResponses: o }) => {
597
597
  var H;
598
598
  const r = te(null), [t, a] = Z({}), [m, y] = Z({}), { isLongFormSurvey: d, focusedQuestionId: g, setFocusedQuestionId: c, createDynamicQuestion: f, allResponses: i, cardIndexByName: S, surveyVisitorAttributes: p, cards: h } = Y((l) => ({ isLongFormSurvey: le(l.studyType), focusedQuestionId: l.focusedQuestionId, setFocusedQuestionId: l.setFocusedQuestionId, createDynamicQuestion: l.createDynamicQuestion, allResponses: l.allResponses, cardIndexByName: l.cardIndexByName, surveyVisitorAttributes: l.surveyVisitorAttributes, cards: l.cards })), b = he(() => ({ ...o, ...Ae(n.map((l) => {
@@ -612,20 +612,20 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
612
612
  ne(() => {
613
613
  const l = k, I = U.current;
614
614
  if (I !== null) for (const q of I) l.has(q) || (a((F) => {
615
- const E = { ...F };
616
- return delete E[q], E;
615
+ const M = { ...F };
616
+ return delete M[q], M;
617
617
  }), y((F) => {
618
- const E = { ...F };
619
- return delete E[q], E;
618
+ const M = { ...F };
619
+ return delete M[q], M;
620
620
  }));
621
621
  U.current = new Set(l);
622
622
  }, [k]);
623
- const P = te(null), M = te(!1), D = te(null), v = ke((l) => {
624
- var E, G;
625
- M.current = !0;
623
+ const P = te(null), E = te(!1), D = te(null), v = ke((l) => {
624
+ var M, G;
625
+ E.current = !0;
626
626
  const I = n.findIndex((X) => X.name === l);
627
- if (!d || l === null || I === -1) return void (M.current = !1);
628
- const q = (E = P.current) == null ? void 0 : E.querySelectorAll(".ul-card-scroll-wrapper")[I], F = (G = P.current) == null ? void 0 : G.closest(".ul-card-main-content");
627
+ if (!d || l === null || I === -1) return void (E.current = !1);
628
+ const q = (M = P.current) == null ? void 0 : M.querySelectorAll(".ul-card-scroll-wrapper")[I], F = (G = P.current) == null ? void 0 : G.closest(".ul-card-main-content");
629
629
  if (q && F) {
630
630
  if (q && F) {
631
631
  const X = q.getBoundingClientRect(), me = F.getBoundingClientRect(), be = X.top - me.top + F.scrollTop, xe = be + X.height / 2, N = window.innerHeight - 157;
@@ -633,10 +633,10 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
633
633
  X.height >= N ? Q = be : Q = xe - F.clientHeight / 2;
634
634
  const $ = F.clientHeight, R = F.scrollHeight - $, j = Math.max(0, Math.min(Q, R));
635
635
  F.scrollTo({ top: j, behavior: "smooth" }), setTimeout(() => {
636
- M.current = !1;
636
+ E.current = !1;
637
637
  }, 500);
638
638
  }
639
- } else M.current = !1;
639
+ } else E.current = !1;
640
640
  }, [d, n]);
641
641
  ne(() => {
642
642
  g !== null && n.findIndex((l) => l.name === g) !== -1 || c(n[0].name);
@@ -649,8 +649,8 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
649
649
  };
650
650
  function B(l, I) {
651
651
  return l.filter((q) => k.has(q.name)).map((q) => {
652
- const F = I[q.name], E = x.find((G) => G.name === q.name);
653
- return { ...F, questionText: E ? Qe(E) : void 0 };
652
+ const F = I[q.name], M = x.find((G) => G.name === q.name);
653
+ return { ...F, questionText: M ? Qe(M) : void 0 };
654
654
  });
655
655
  }
656
656
  const T = (l) => {
@@ -664,18 +664,18 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
664
664
  }, [g, d, v]);
665
665
  const L = ke(() => {
666
666
  var me, be;
667
- if (M.current) return;
667
+ if (E.current) return;
668
668
  const l = (me = P.current) == null ? void 0 : me.closest(".ul-card-main-content");
669
669
  if (!l) return;
670
670
  const I = (be = P.current) == null ? void 0 : be.querySelectorAll(".ul-card-scroll-wrapper");
671
671
  if (!I || I.length === 0) return;
672
672
  const q = l.getBoundingClientRect(), F = q.top + q.height / 2;
673
- let E = 0, G = 1 / 0;
673
+ let M = 0, G = 1 / 0;
674
674
  I.forEach((xe, N) => {
675
675
  const Q = xe.getBoundingClientRect(), $ = Q.top + Q.height / 2, R = Math.abs(F - $);
676
- R < G && (G = R, E = N);
676
+ R < G && (G = R, M = N);
677
677
  });
678
- const X = n[E];
678
+ const X = n[M];
679
679
  D.current = X.name, c(X.name);
680
680
  }, [n, c]);
681
681
  ne(() => {
@@ -690,10 +690,10 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
690
690
  var I;
691
691
  return !k.has(l.name) || !(!(l != null && l.props) || !("properties" in l.props) || ((I = l.props.properties) == null ? void 0 : I.required) !== !1) || m[l.name];
692
692
  }), [m, n, k]), K = async (l, I, q) => {
693
- return y((E) => ({ ...E, [l]: q })), await (F = (E) => ({ ...E, [l]: I }), new Promise((E) => {
693
+ return y((M) => ({ ...M, [l]: q })), await (F = (M) => ({ ...M, [l]: I }), new Promise((M) => {
694
694
  a((G) => {
695
695
  const X = F(G);
696
- return E(X), X;
696
+ return M(X), X;
697
697
  });
698
698
  }));
699
699
  var F;
@@ -704,28 +704,28 @@ const er = "ul-permission-graphics-container", rr = "ul-permission-body", tr = O
704
704
  const l = r.current, I = (F = n == null ? void 0 : n[0]) == null ? void 0 : F.groupId;
705
705
  r.current = I;
706
706
  const q = {};
707
- if (n.forEach((E) => {
707
+ if (n.forEach((M) => {
708
708
  var G, X;
709
- Tr(E) && (E.props.properties.required || (q[E.name] = { value: ((G = t[E.name]) == null ? void 0 : G.value) ?? null, secondaryValue: ((X = t[E.name]) == null ? void 0 : X.secondaryValue) ?? null, questionId: E.name, type: E.type }));
709
+ Tr(M) && (M.props.properties.required || (q[M.name] = { value: ((G = t[M.name]) == null ? void 0 : G.value) ?? null, secondaryValue: ((X = t[M.name]) == null ? void 0 : X.secondaryValue) ?? null, questionId: M.name, type: M.type }));
710
710
  }), l == null || l !== I) a(q), y({});
711
711
  else {
712
712
  a((G) => ({ ...G, ...q }));
713
- const E = n.reduce((G, X) => {
713
+ const M = n.reduce((G, X) => {
714
714
  var me;
715
715
  return X.type === "aidynamicfollowup" && ((me = X.props) == null ? void 0 : me.loading) === null && (G[X.name] = !0), G;
716
716
  }, {});
717
- y((G) => ({ ...G, ...E }));
717
+ y((G) => ({ ...G, ...M }));
718
718
  }
719
719
  }, [n, d]);
720
720
  const u = async (l, I) => {
721
721
  if (d) {
722
- const q = await K(l.questionId, l, I), F = C(l.type), E = V(l.type);
723
- if (F && T(l.questionId), E && I) {
722
+ const q = await K(l.questionId, l, I), F = C(l.type), M = V(l.type);
723
+ if (F && T(l.questionId), M && I) {
724
724
  const G = B(n, q);
725
725
  s(G);
726
726
  }
727
727
  } else {
728
- const q = x.find((E) => E.name === l.questionId), F = { ...l, questionText: q ? Qe(q) : void 0 };
728
+ const q = x.find((M) => M.name === l.questionId), F = { ...l, questionText: q ? Qe(q) : void 0 };
729
729
  w({ displayCard: q, response: l }), s([F]);
730
730
  }
731
731
  }, C = (l) => (/* @__PURE__ */ new Set(["nps", "likert", "multiplechoice"])).has(l), V = (l) => (/* @__PURE__ */ new Set(["videovoice", "consentlegal", "texturlprompt", "maxdiff"])).has(l), W = ((H = n[0]) == null ? void 0 : H.type) === "thanks";
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./core-Ciwf_Oir.cjs");require("./replay.cjs");const r=require("./metricsReporter-DYupscmb.cjs");exports.SprigAPI=e.SprigAPI,exports.default=e.core,exports.sprig=e.sprig,exports.DismissReason=r.DismissReason,exports.SprigEvent=r.SprigEvent;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./core-C7eAp3i8.cjs");require("./replay.cjs");const r=require("./metricsReporter-Dy6jXbOf.cjs");exports.Sprig=e.Sprig,exports.SprigAPI=e.SprigAPI,exports.default=e.core,exports.sprig=e.sprig,exports.DismissReason=r.DismissReason,exports.SprigEvent=r.SprigEvent;
package/dist/index.d.ts CHANGED
@@ -1550,7 +1550,7 @@ interface RecordedTaskResponseType {
1550
1550
  value: RecordedTaskResponseValueType;
1551
1551
  }
1552
1552
 
1553
- type SurveyState = "ready" | "no survey";
1553
+ type SurveyState = "ready" | "no survey" | "previous survey ready";
1554
1554
  type ReplayDurationType = "after" | "before" | "beforeAndAfter";
1555
1555
 
1556
1556
  interface MobileReplayConfig {
@@ -1827,7 +1827,6 @@ interface Config extends MobileReplayConfig {
1827
1827
  interactiveEventsHandler?: (e: MouseEvent) => void;
1828
1828
  isConversationalUI?: boolean;
1829
1829
  isOnQuestionsTab?: boolean;
1830
- isPreview?: boolean;
1831
1830
  launchDarklyEnabled?: boolean;
1832
1831
  layout: StudyLayout;
1833
1832
  locale: string;
@@ -1935,45 +1934,6 @@ type EventDigest = {
1935
1934
  type: "Sprig_ReplayResumed";
1936
1935
  };
1937
1936
 
1938
- declare namespace optimizely {
1939
- interface Optimizely {
1940
- get?: (key: "state") => {
1941
- getExperimentStates: (options: {
1942
- filter?: unknown;
1943
- isActive?: boolean;
1944
- }) => Record<string, OptimizelyExperimentState>;
1945
- };
1946
- }
1947
-
1948
- // Ref: https://docs.developers.optimizely.com/web/docs/state#return-value-2
1949
- interface OptimizelyExperimentState {
1950
- /** Audiences the visitor was in when the experiment was activated.
1951
- * @example { "id": "6672770135", "name": "Chrome users" }
1952
- */
1953
- audiences: { id: number; name: string }[];
1954
- /** The name of the experiment
1955
- * @example OptimizelyExperimentState
1956
- * */
1957
- experimentName: string;
1958
- /** The ID of the experiment
1959
- * @example OptimizelyExperimentState
1960
- * */
1961
- id: string;
1962
- /** Indicates if the experiment is currently active */
1963
- isActive: boolean;
1964
- /** Indicates if the visitor is in the holdback (i.e., is excluded due traffic allocation) */
1965
- isInExperimentHoldback: boolean;
1966
- /** The name of the object. Required */
1967
- name: string;
1968
- /** An object with the name and the ID of the variation the visitor is bucketed in, or null if the visitor was not bucketed
1969
- * @example { "id": "6626731852", "name": "Variation #1" }
1970
- */
1971
- variation: { id: number; name: string } | null;
1972
- /** Indicates if the visitor was redirected due to this experiment */
1973
- visitorRedirected: boolean;
1974
- }
1975
- }
1976
-
1977
1937
  declare namespace sprigConfig {
1978
1938
  type IdentifyResult = Promise<
1979
1939
  | {
@@ -2170,6 +2130,33 @@ declare global {
2170
2130
  SprigLoggerCallback?: (message: string) => void;
2171
2131
  }
2172
2132
 
2133
+ /* eslint-disable no-var */
2134
+ var __cfg: Config;
2135
+ var _sprigReinitialize: () => void;
2136
+ var attachEvent: typeof window.addEventListener | undefined;
2137
+ var Backbone: {
2138
+ history: typeof window.history;
2139
+ };
2140
+ var Intercom: { ul_wasVisible?: boolean } & ((
2141
+ method: string,
2142
+ data?: unknown,
2143
+ ) => void);
2144
+ var optimizely: optimizely.Optimizely;
2145
+ var optimizelyDatafile: object;
2146
+ var previewMode: unknown;
2147
+ var UpChunk: {
2148
+ createUpload: typeof createUpload;
2149
+ };
2150
+ var _Sprig: sprigConfig.WindowSprig | undefined;
2151
+ var Sprig: sprigConfig.WindowSprig;
2152
+ var UserLeap: sprigConfig.WindowSprig & {
2153
+ windowDimensions?: { height: number; width: number };
2154
+ };
2155
+ var rrwebRecord: (typeof _rrweb_record)["record"] | undefined;
2156
+ var sprigAPI: { openUrl: (url: string) => void } | undefined;
2157
+ var SprigLoggerCallback: (message: string) => void | undefined;
2158
+ /* eslint-enable no-var */
2159
+
2173
2160
  type WindowSprig = sprigConfig.WindowSprig;
2174
2161
  type SprigAttributes = Record<string, boolean | number | string>;
2175
2162
  type SprigListener = Listener<unknown[]>;
@@ -2216,17 +2203,12 @@ declare class SprigAPI {
2216
2203
  SURVEY_WILL_PRESENT: SprigEvent;
2217
2204
  QUESTION_ANSWERED: SprigEvent;
2218
2205
  REPLAY_CAPTURE: SprigEvent;
2219
- CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent; /**
2220
- * Tracks a page view with the provided URL and additional event properties.
2221
- */
2206
+ CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
2222
2207
  VISITOR_ID_UPDATED: SprigEvent;
2223
2208
  DATA: {
2224
2209
  DISMISS_REASONS: {
2225
2210
  API: DismissReason;
2226
2211
  CLOSED: DismissReason;
2227
- /**
2228
- * Apply a css string representing the customized styles
2229
- */
2230
2212
  COMPLETE: DismissReason;
2231
2213
  PAGE_CHANGE: DismissReason;
2232
2214
  OVERRIDE: DismissReason;
@@ -2325,7 +2307,7 @@ declare class SprigAPI {
2325
2307
  */
2326
2308
  logoutUser(): void;
2327
2309
  /**
2328
- * Clears Sprig from window
2310
+ * Clears Sprig from globalThis
2329
2311
  */
2330
2312
  teardown(): void;
2331
2313
  /**
@@ -2350,8 +2332,9 @@ declare const sprig: {
2350
2332
  */
2351
2333
  configure: (config: NpmConfig) => sprigConfig.WindowSprig;
2352
2334
  };
2353
- type WindowSprig$1 = typeof window.Sprig;
2335
+ type WindowSprig$1 = typeof globalThis.Sprig;
2354
2336
 
2337
+ declare const Sprig: SprigAPI;
2355
2338
  declare const _default: {
2356
2339
  sprig: {
2357
2340
  /**
@@ -2363,6 +2346,7 @@ declare const _default: {
2363
2346
  };
2364
2347
  SprigAPI: typeof SprigAPI;
2365
2348
  configure: (config: NpmConfig) => sprigConfig.WindowSprig;
2349
+ Sprig: SprigAPI;
2366
2350
  };
2367
2351
 
2368
- export { DismissReason, SprigAPI, SprigEvent, type WindowSprig$1 as WindowSprig, _default as default, sprig };
2352
+ export { DismissReason, Sprig, SprigAPI, SprigEvent, type WindowSprig$1 as WindowSprig, _default as default, sprig };
package/dist/index.js CHANGED
@@ -1,10 +1,11 @@
1
- import { S as i, c as o, s as p } from "./core-DcjPmwAM.js";
1
+ import { S as i, a as p, c as o, s as e } from "./core-D9RfS2Z8.js";
2
2
  import "./replay.js";
3
- import { D as t, S as m } from "./metricsReporter-BGxaFPwL.js";
3
+ import { D as S, S as g } from "./metricsReporter-DqmmYkn-.js";
4
4
  export {
5
- t as DismissReason,
6
- i as SprigAPI,
7
- m as SprigEvent,
5
+ S as DismissReason,
6
+ i as Sprig,
7
+ p as SprigAPI,
8
+ g as SprigEvent,
8
9
  o as default,
9
- p as sprig
10
+ e as sprig
10
11
  };
@@ -217,7 +217,7 @@ const J = (e) => e._config && e._config.installationMethod ? e._config.installat
217
217
  U = !0, A = e;
218
218
  };
219
219
  function ce(e = {}) {
220
- const t = { "Content-Type": "application/json", "userleap-platform": "web", "x-ul-sdk-version": "2.41.3", "x-ul-installation-method": J(e), "sprig-modules": B() };
220
+ const t = { "Content-Type": "application/json", "userleap-platform": "web", "x-ul-sdk-version": "2.42.1", "x-ul-installation-method": J(e), "sprig-modules": B() };
221
221
  if (e.envId && (t["x-ul-environment-id"] = e.envId), e.token && (t.Authorization = "Bearer " + e.token), e.userId && (t["x-ul-user-id"] = e.userId), e.visitorId && (t["x-ul-visitor-id"] = e.visitorId), e.partnerAnonymousId && (t["x-ul-anonymous-id"] = e.partnerAnonymousId), e.mobileHeadersJSON) {
222
222
  const s = JSON.parse(e.mobileHeadersJSON);
223
223
  Object.assign(t, s);