@sprig-technologies/sprig-bundled 2.40.0 → 2.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversational-styles-BiL7hMhj.js +4 -0
- package/dist/conversational-styles-DlhTFTL6.cjs +1 -0
- package/dist/conversational-ui-COaQs_Nu.cjs +658 -0
- package/dist/conversational-ui-D-i49ps3.js +1477 -0
- package/dist/getAttributedUrl-B0b2NdfZ.js +188 -0
- package/dist/getAttributedUrl-B2AD3-f7.cjs +12 -0
- package/dist/{index-gY11yXiE.js → index-BZjOqtTO.js} +388 -394
- package/dist/index-BlwcV11_.js +658 -0
- package/dist/index-C3Nj6aLe.cjs +1 -0
- package/dist/{index-C4jT0KTM.cjs → index-D7xIZ9_C.cjs} +21 -21
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +3 -3
- package/dist/view-CRNTl40s.cjs +1 -0
- package/dist/view-JArMqSNr.js +1494 -0
- package/package.json +1 -1
- package/dist/conversational-styles-CWNea3pP.js +0 -4
- package/dist/conversational-styles-CzhxRRD3.cjs +0 -1
- package/dist/conversational-ui-B4Gz-ntg.cjs +0 -658
- package/dist/conversational-ui-B_gqybcU.js +0 -1508
- package/dist/getAttributedUrl-BQOt-2c9.js +0 -192
- package/dist/getAttributedUrl-SO6zrj5v.cjs +0 -12
- package/dist/index-B7XdLO9n.cjs +0 -1
- package/dist/index-rqy70x2s.js +0 -670
- package/dist/view-BjWfEnbU.js +0 -1482
- package/dist/view-D-Rk2_yd.cjs +0 -1
package/dist/index-rqy70x2s.js
DELETED
|
@@ -1,670 +0,0 @@
|
|
|
1
|
-
import { u as j, h as W, a as e, c as B, g as X, d as Qe, F as ge, p as Y, e as be, b as ue, _ as te, T as Se, A as Je, f as et, l as tt, q as rt, M as le, m as nt, n as it, S as st, o as at, i as lt, j as ot, y as dt, k as Re } from "./view-BjWfEnbU.js";
|
|
2
|
-
import { i as re, E as Ie, h as qe, j as $e, A as ct } from "./index-gY11yXiE.js";
|
|
3
|
-
import { c as ne, a as ae, H as fe, M as ce, Q as de, O as he, B as K, L as ve, b as xe, S as ut, u as pt, g as mt, P as gt } from "./getAttributedUrl-BQOt-2c9.js";
|
|
4
|
-
const ht = ({ className: n, message: i, next: l, properties: t, questionId: r, type: o }) => {
|
|
5
|
-
const { useMobileStyling: b, border: f, isLongFormSurvey: d, focusedQuestionId: v } = j((c) => ({ useMobileStyling: c.useMobileStyling, border: c.border, isLongFormSurvey: re(c.studyType), focusedQuestionId: c.focusedQuestionId })), [s, m] = W(!1), [a, S] = W(""), [p, h] = W(!1), N = d && v === r, T = t == null ? void 0 : t.collectName, w = (t == null ? void 0 : t.nameLabelText) || "Full Name", _ = (t == null ? void 0 : t.consentText) || "I agree to the stated conditions", q = (t == null ? void 0 : t.submitButtonText) || "Submit", L = !!a.trim(), E = s && (!T || L), F = (c, y = !1) => {
|
|
6
|
-
c.preventDefault(), c.stopPropagation();
|
|
7
|
-
let R = null;
|
|
8
|
-
if (!y) {
|
|
9
|
-
if (!E) return void h(!0);
|
|
10
|
-
R = { submitted: !0 }, T && (R.name = a);
|
|
11
|
-
}
|
|
12
|
-
l({ value: R, questionId: r, type: o }, E);
|
|
13
|
-
};
|
|
14
|
-
return e("div", { className: B(n, d && !N && "ul-card--unfocused", "ul-card__consent-legal", "fade-in-transition"), children: [e(ne, { isRequired: d && (t == null ? void 0 : t.required), message: i, properties: { questionHtml: t.questionHtml } }), t != null && t.richTextBody ? e(ae, { children: e(fe, { className: "ul-rich-text-body", html: t.richTextBody, id: "ul-card__consent-legal-body-container" }) }) : null, e(ce, { embeddedType: "pdf", properties: t, children: e(de, { children: [e("div", { className: "sprig-stretch", children: [e(he, { allowTextEntry: !1, border: f, error: p && !s, id: "consent", isRadio: !1, isSelected: s, label: _, onUserInputChanged: ({ selected: c }) => {
|
|
15
|
-
c !== s && m(!s);
|
|
16
|
-
}, useMobileStyling: b }), T && e("input", { "aria-label": w, "aria-placeholder": w, className: B(X("ul-consent-legal__name-input", b)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (c) => {
|
|
17
|
-
c.currentTarget.style.borderColor = p && !L ? Ie : qe;
|
|
18
|
-
}, onFocus: (c) => {
|
|
19
|
-
c.currentTarget.style.borderColor = p && !L ? Ie : f;
|
|
20
|
-
}, onInput: (c) => {
|
|
21
|
-
c.preventDefault(), c.stopPropagation(), S(c.currentTarget.value);
|
|
22
|
-
}, placeholder: w, style: p && !L ? { borderColor: Ie } : {}, tabIndex: 0, value: a })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(K, { className: E ? "" : "sprig-button-disabled", onClick: F, children: q }), t.required === !1 && !d && e("button", { className: "ul-card-skip__button", onClick: (c) => F(c, !0), children: Qe(t) })] })] }) })] }, r);
|
|
23
|
-
}, bt = ({ activeValue: n, border: i, icon: l, isPressed: t, onSubmit: r, range: o, scaleLabelType: b, selectedValue: f, setSelectedValue: d, setActiveValue: v, setIsPressed: s, useMobileStyling: m, value: a, viewDocument: S }) => {
|
|
24
|
-
const { isLongFormSurvey: p, enableCspTrustedTypes: h } = j((y) => ({ isLongFormSurvey: re(y.studyType), enableCspTrustedTypes: y.enableCspTrustedTypes })), N = `option-${a}`, T = b === "number", w = b === "star", _ = b === "smiley", q = T && a === n || a === f, [L, E] = (() => {
|
|
25
|
-
const y = w && f !== null && a <= f;
|
|
26
|
-
return w && a <= n || _ && a === n || y || a === n || a === f ? [i, t || y || a === f ? 1 : 0.3] : ["", 1];
|
|
27
|
-
})(), F = ge(() => {
|
|
28
|
-
const y = { borderColor: q ? L : "", fillOpacity: q ? "" : E, zIndex: q ? 3 : "auto", color: f === a ? "#fff" : "" };
|
|
29
|
-
return T ? { ...y, backgroundColor: f === a ? L : "" } : { ...y, color: w || _ || f === a ? L : "" };
|
|
30
|
-
}, [q, L, E, f, a, T, w, _]), c = ge(() => $e((({ icon: y, scaleLabelType: R, value: Q, selectedValue: u }) => {
|
|
31
|
-
if (R === "smiley" && Q === u) {
|
|
32
|
-
let x = 0;
|
|
33
|
-
return y.replace(/black/g, () => ++x == 1 ? "black" : "white");
|
|
34
|
-
}
|
|
35
|
-
return y;
|
|
36
|
-
})({ icon: l, scaleLabelType: b, value: a, selectedValue: f }), h), [h, l, b, f, a]);
|
|
37
|
-
return e("button", { "aria-label": T ? void 0 : String(a), className: (() => {
|
|
38
|
-
switch (b) {
|
|
39
|
-
case "star":
|
|
40
|
-
return B(X("likert-star", m), X(`likert-star-${a}`, m));
|
|
41
|
-
case "smiley":
|
|
42
|
-
return B(X("likert-smiley", m), X(`likert-smiley-${a}`, m));
|
|
43
|
-
default:
|
|
44
|
-
return a === o ? B(X("likert-number", m), X(`likert-number-${a}`, m), X("likert-last-option", m)) : B(X("likert-number", m), X(`likert-number-${a}`, m));
|
|
45
|
-
}
|
|
46
|
-
})(), dangerouslySetInnerHTML: { __html: c }, id: N, onClick: (y) => {
|
|
47
|
-
p && (y.preventDefault(), y.stopPropagation(), d(a)), r();
|
|
48
|
-
}, onKeyDown: (y) => {
|
|
49
|
-
var u, x;
|
|
50
|
-
const R = S.querySelectorAll(`.likert-${b ?? "number"}`), Q = a - 1;
|
|
51
|
-
y.key === "ArrowRight" ? (u = R[Q + 1]) == null || u.focus() : y.key === "ArrowLeft" ? (x = R[Q - 1]) == null || x.focus() : y.key !== "Enter" && y.key !== " " || (p && (y.preventDefault(), y.stopPropagation(), d(a)), r());
|
|
52
|
-
}, onPointerDown: () => s(!0), onPointerEnter: () => v(a), onPointerLeave: () => {
|
|
53
|
-
v(-1), s(!1);
|
|
54
|
-
}, style: F, tabIndex: 0 });
|
|
55
|
-
}, vt = ({ className: n, labels: i, message: l, next: t, properties: r, questionId: o, type: b }) => {
|
|
56
|
-
const { border: f, useMobileStyling: d, viewDocument: v, isLongFormSurvey: s, focusedQuestionId: m, update: a } = j((u) => ({ border: u.border, useMobileStyling: u.useMobileStyling, viewDocument: u.viewDocument, isLongFormSurvey: re(u.studyType), focusedQuestionId: u.focusedQuestionId, update: u.update })), [S, p] = W(-1), [h, N] = W(!1), [T, w] = W(null), _ = s && m === o, q = i && i.left, L = i && i.right;
|
|
57
|
-
let E;
|
|
58
|
-
const { range: F, scaleLabelType: c, ratingIcons: y } = r;
|
|
59
|
-
F && (E = Number(F));
|
|
60
|
-
const R = E || 5, Q = (u) => {
|
|
61
|
-
var x, k;
|
|
62
|
-
switch (c) {
|
|
63
|
-
case "star":
|
|
64
|
-
return (x = y[0]) == null ? void 0 : x.svg;
|
|
65
|
-
case "smiley":
|
|
66
|
-
return (k = y[u]) == null ? void 0 : k.svg;
|
|
67
|
-
default:
|
|
68
|
-
return String(u + 1);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
return Y(() => {
|
|
72
|
-
a();
|
|
73
|
-
}, [a]), e("form", { className: B(n, "ul-card--likert", "fade-in-transition", s && !_ && "ul-card--unfocused"), children: [e(ne, { isRequired: s && (r == null ? void 0 : r.required), message: l, properties: r }), e(ce, { properties: r, children: e(be, { children: [e(ae, { children: [e("div", { "aria-label": `Rating (1 - ${R})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(R)].map((u, x) => {
|
|
74
|
-
const k = x + 1;
|
|
75
|
-
return e(bt, { activeValue: S, border: f, icon: Q(x), isPressed: h, onSubmit: () => t({ value: k, questionId: o, type: b }, !0), range: R, scaleLabelType: c, selectedValue: T, setActiveValue: p, setIsPressed: N, setSelectedValue: w, useMobileStyling: d, value: k, viewDocument: v }, x);
|
|
76
|
-
}) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: q }), e("span", { children: L })] })] }), !r.required && !s && e(de, { children: e("div", { className: "ul-vertical-centered-container", children: e(K, { onClick: (u) => {
|
|
77
|
-
u.preventDefault(), u.stopPropagation(), t({ value: null, questionId: o, type: b }, !0);
|
|
78
|
-
}, children: ue(r) }) }) })] }) })] }, o);
|
|
79
|
-
}, Oe = (n) => n && (n.scrollHeight > n.offsetHeight ? n : Oe(n.parentElement)), ft = (n) => {
|
|
80
|
-
if (!n || !((l) => l instanceof HTMLElement)(n)) return 0;
|
|
81
|
-
const i = getComputedStyle(n);
|
|
82
|
-
return parseFloat(i.marginTop) + parseFloat(i.marginBottom) + (parseFloat(i.borderTopWidth) + parseFloat(i.borderBottomWidth));
|
|
83
|
-
}, yt = ({ columns: n, onSelect: i, options: l, selectedOptions: t }) => {
|
|
84
|
-
const r = te([]), { border: o, useMobileStyling: b } = j((a) => ({ border: a.border, useMobileStyling: a.useMobileStyling })), f = l.findIndex((a) => t[a.id] === null), [d, v] = W(f), s = Se((a, S) => {
|
|
85
|
-
i(a, S);
|
|
86
|
-
const p = d + 1, h = l[p];
|
|
87
|
-
if (h && t[h.id] === null) {
|
|
88
|
-
v(p);
|
|
89
|
-
const N = r.current[d];
|
|
90
|
-
if (N != null && N.firstElementChild) {
|
|
91
|
-
const T = Oe(N), w = N.firstElementChild, _ = ft(N) + w.clientHeight;
|
|
92
|
-
T == null || T.scrollTo(0, N.offsetTop + _);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}, [i, l, t, d]), m = Se((a, S) => {
|
|
96
|
-
const p = d === a;
|
|
97
|
-
return e(Je, { animate: !0, header: S.label, isOpen: p, onClick: () => {
|
|
98
|
-
var h;
|
|
99
|
-
return v(p && !((h = window.UserLeap) != null && h.isMobileSDK) ? -1 : a);
|
|
100
|
-
}, ref: (h) => {
|
|
101
|
-
h && (r.current[a] = h);
|
|
102
|
-
}, showHeaderCheck: t[S.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: n.map((h) => e(he, { allowTextEntry: !1, ariaLabel: `${S.label}-${h.label}`, border: o, error: !1, id: `${S.id}-${h.value}`, isRadio: !0, isSelected: t[S.id] === h.value, label: h.label, onUserInputChanged: () => s(S.id, h.value), useMobileStyling: b }, h.label)) }) }, S.id);
|
|
103
|
-
}, [o, n, d, s, t, b]);
|
|
104
|
-
return e("div", { children: l.map((a, S) => m(S, a)) });
|
|
105
|
-
}, xt = ({ columns: n, onSelect: i, options: l, selectedOptions: t }) => {
|
|
106
|
-
const { border: r, useMobileStyling: o, isLongFormSurvey: b } = j((p) => ({ border: p.border, useMobileStyling: p.useMobileStyling, isLongFormSurvey: re(p.studyType) })), f = l.length, d = n.length, v = te(null), [s, m] = W(!1), [a, S] = W(!1);
|
|
107
|
-
return Y(() => {
|
|
108
|
-
const p = v.current, h = new ResizeObserver((N) => {
|
|
109
|
-
window.requestAnimationFrame(() => {
|
|
110
|
-
p && (m(Math.round(N[0].contentRect.width) < p.scrollWidth), S(Math.round(N[0].contentRect.width) < p.scrollWidth));
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
return p && h.observe(p), () => {
|
|
114
|
-
p && h.unobserve(p);
|
|
115
|
-
};
|
|
116
|
-
}, []), e("div", { className: "ul-card--matrix_question_container", children: [e("div", { className: B("ul-card--matrix_container", s && "ul-matrix-scroll-gradient"), onScroll: () => {
|
|
117
|
-
(() => {
|
|
118
|
-
const p = v.current;
|
|
119
|
-
p && m(p.clientWidth + Math.abs(p.scrollLeft) < p.scrollWidth);
|
|
120
|
-
})();
|
|
121
|
-
}, ref: v, children: e("div", { className: B(b && "ul-card--matrix_grid_longform", "ul-card--matrix_grid"), style: `--numColumns: ${d}; --numRows: ${f + 1};`, children: [e("div", {}), " ", n.map((p) => e("div", { className: "ul-matrix-column-label", children: p.label }, p.label)), l.map((p) => e(be, { children: [e("div", { "aria-label": p.label, className: "ul-matrix-row-label", children: p.label }, p.label), e("div", { className: "ul-matrix-row-options", role: "radiogroup", children: n.map((h, N) => e("div", { className: B("ul-matrix-option-wrapper", N === d - 1 && "ul-matrix-last-option"), children: e(he, { allowTextEntry: !1, ariaLabel: `${p.label}-${h.label}`, border: r, choiceStyle: { background: "transparent", border: "none", marginBottom: "0", padding: "0" }, error: !1, id: `${p.id}-${h.value}`, isRadio: !0, isSelected: t[p.id] === h.value, onUserInputChanged: () => i(p.id, h.value), useMobileStyling: o }) }, h.value)) })] }))] }) }), (s || a) && e("button", { className: a && !s ? "ul-matrix-scroll-arrow left" : "ul-matrix-scroll-arrow", onClick: a && !s ? (p) => {
|
|
122
|
-
p.preventDefault();
|
|
123
|
-
const h = v.current;
|
|
124
|
-
if (h) {
|
|
125
|
-
const N = getComputedStyle(h).direction === "rtl";
|
|
126
|
-
h.scrollTo({ left: N ? h.scrollWidth - h.clientWidth : 0, behavior: "smooth" });
|
|
127
|
-
}
|
|
128
|
-
} : (p) => {
|
|
129
|
-
p.preventDefault();
|
|
130
|
-
const h = v.current;
|
|
131
|
-
if (h) {
|
|
132
|
-
const N = getComputedStyle(h).direction === "rtl";
|
|
133
|
-
h.scrollTo({ left: N ? h.clientWidth - h.scrollWidth : h.scrollWidth, behavior: "smooth" });
|
|
134
|
-
}
|
|
135
|
-
}, children: e(a && !s ? St : kt, {}) })] });
|
|
136
|
-
}, St = () => e("svg", { fill: "currentColor", height: "32", transform: "matrix(-1,0,0,1,0,0)", version: "1.1", viewBox: "0 0 256 256", width: "32", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" }) }), kt = () => e("svg", { fill: "currentColor", height: "32", viewBox: "0 0 256 256", width: "32", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" }) }), Tt = ({ className: n, message: i, next: l, options: t, properties: r, questionId: o, type: b, showIndividualSubmit: f = !1, onSubmitButtonClick: d }) => {
|
|
137
|
-
const { useMobileStyling: v, isLongFormSurvey: s, focusedQuestionId: m, setFocusedQuestionId: a, update: S } = j((c) => ({ useMobileStyling: c.useMobileStyling, isLongFormSurvey: re(c.studyType), focusedQuestionId: c.focusedQuestionId, setFocusedQuestionId: c.setFocusedQuestionId, update: c.update })), p = r.matrixColumn, h = r.required, N = s && m === o, T = (c) => {
|
|
138
|
-
c.preventDefault(), c.stopPropagation(), l({ value: _, questionId: o, type: b }, !0), d && d();
|
|
139
|
-
}, w = t.reduce((c, y) => (c[y.id] = null, c), {}), [_, q] = W(w), L = (c) => h && Object.values(c).every((y) => y == null), E = (c, y) => {
|
|
140
|
-
s && l({ value: { ..._, [c]: y }, questionId: o, type: b }, !L({ ..._, [c]: y })), q((R) => ({ ...R, [c]: y }));
|
|
141
|
-
}, F = r.displayMatrixAsAccordion || v;
|
|
142
|
-
return Y(() => {
|
|
143
|
-
S();
|
|
144
|
-
}, [S]), e("form", { className: B(n, !s && "ul-card__matrix", "fade-in-transition", s && !N && "ul-card--unfocused"), id: "text-form", onClick: () => {
|
|
145
|
-
N && a(o);
|
|
146
|
-
}, onSubmit: T, children: [e(ne, { isRequired: s && (r == null ? void 0 : r.required), message: i, properties: r }), e(ce, { properties: r, children: [e(ae, { children: [e(F ? yt : xt, { columns: p, onSelect: E, options: t, selectedOptions: _ }), f && e(ve, { handleSubmit: T, isSubmitDisabled: L(_) })] }), !s && e(de, { children: e("div", { className: "ul-card__button-wrapper", children: e(K, { disabled: L(_), children: ue(r) }) }) })] })] }, o);
|
|
147
|
-
}, Ue = ({ className: n, message: i, onSubmit: l, options: t = [], properties: r, questionId: o, type: b, showIndividualSubmit: f = !1, onSubmitButtonClick: d }) => {
|
|
148
|
-
const { border: v, useMobileStyling: s, isLongFormSurvey: m, focusedQuestionId: a, setFocusedQuestionId: S, update: p } = j((g) => ({ border: g.border, useMobileStyling: g.useMobileStyling, isLongFormSurvey: re(g.studyType), focusedQuestionId: g.focusedQuestionId, setFocusedQuestionId: g.setFocusedQuestionId, update: g.update })), h = m && a === o, N = t.reduce((g, C) => (g[C.id] = { isSelected: !1 }, g), {}), [T, w] = W(N), _ = b === "multiplechoice", q = r.required, L = t.find((g) => {
|
|
149
|
-
var C;
|
|
150
|
-
return (C = g.optionProperties) == null ? void 0 : C.noneOfTheAbove;
|
|
151
|
-
}), E = (g) => Object.entries(g).some(([C, P]) => {
|
|
152
|
-
var z;
|
|
153
|
-
const Z = t.find((J) => `${J.id}` === C), O = P.userText === void 0 || P.userText.trim() === "";
|
|
154
|
-
return ((z = Z == null ? void 0 : Z.optionProperties) == null ? void 0 : z.allowsTextEntry) && O && P.isSelected;
|
|
155
|
-
}), F = (g) => Object.values(g).filter((C) => C.isSelected).length, c = r.minSelect && r.minSelect > 0 && r.maxSelectMode === xe.Range && F(T) < r.minSelect && (q || F(T) > 0), y = (g) => E(g) || q && !F(g) || !((C) => {
|
|
156
|
-
const { minSelect: P = 0, maxSelect: Z = 1 / 0, maxSelectMode: O } = r, z = F(C);
|
|
157
|
-
switch (O) {
|
|
158
|
-
case xe.Maximum:
|
|
159
|
-
return z <= Z;
|
|
160
|
-
case xe.Range:
|
|
161
|
-
return z === 0 || z >= P;
|
|
162
|
-
default:
|
|
163
|
-
return !0;
|
|
164
|
-
}
|
|
165
|
-
})(g), R = Object.entries(T).some(([g, C]) => {
|
|
166
|
-
var P, Z;
|
|
167
|
-
return C.isSelected && ((Z = (P = t.find((O) => `${O.id}` === g)) == null ? void 0 : P.optionProperties) == null ? void 0 : Z.allowsTextEntry);
|
|
168
|
-
}), Q = f && (!_ || R), u = (g) => {
|
|
169
|
-
D(g.id, g.selected, g.userText, g.noneOfTheAbove), g.selected && m && !_ && !h && S(o);
|
|
170
|
-
}, x = (g) => {
|
|
171
|
-
var C;
|
|
172
|
-
return (r == null ? void 0 : r.maxSelectMode) !== xe.Unlimited && F(T) === (r == null ? void 0 : r.maxSelect) && !((C = T[g]) != null && C.isSelected);
|
|
173
|
-
}, k = (g) => {
|
|
174
|
-
g.preventDefault(), g.stopPropagation(), l(T, !0), d && d();
|
|
175
|
-
}, D = (g, C, P, Z) => {
|
|
176
|
-
const O = Object.assign({}, T);
|
|
177
|
-
if ((_ || Z) && C) for (const G of Object.values(O)) G.isSelected = !1, delete G.userText;
|
|
178
|
-
else L && !Z && T[L.id].isSelected && (O[L.id].isSelected = !1);
|
|
179
|
-
O[g] = { isSelected: C, userText: P };
|
|
180
|
-
const z = _ && Object.entries(O).some(([G, ie]) => {
|
|
181
|
-
var ee, pe;
|
|
182
|
-
return ie.isSelected && ((pe = (ee = t.find((ye) => `${ye.id}` === G)) == null ? void 0 : ee.optionProperties) == null ? void 0 : pe.allowsTextEntry);
|
|
183
|
-
}), J = !y(O);
|
|
184
|
-
m && (l(O, J), _ && !z && J && d && d()), w(O);
|
|
185
|
-
};
|
|
186
|
-
return Y(() => {
|
|
187
|
-
p();
|
|
188
|
-
}, []), e("form", { className: B(n, "ul-card--multiple", "fade-in-transition", m && !h && "ul-card--unfocused"), id: "text-form", onClick: b === "multipleselect" ? () => {
|
|
189
|
-
m && a !== o && b === "multipleselect" && S(o);
|
|
190
|
-
} : void 0, onSubmit: k, children: [e(ne, { isRequired: m && (r == null ? void 0 : r.required), message: i, properties: r }), e(ce, { properties: r, children: e(be, { children: [e(ae, { children: [r.isDropdown ? e(ut, { disabledOptions: t.filter((g) => x(g.id)), dropdownFooter: c ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [F(T), "/", r.minSelect] }) : void 0, isMultiSelect: !_, multiselectText: r.dropdownMultiselectedText ?? "choices selected", onChange: (g) => {
|
|
191
|
-
const C = { ...T };
|
|
192
|
-
for (const P of t) g.includes(P) ? C[P.id].isSelected = !0 : C[P.id].isSelected = !1;
|
|
193
|
-
m && l(C, !y(C)), w(C);
|
|
194
|
-
}, options: t, placeholderText: r.dropdownPlaceholderText ?? (_ ? "Select choice" : "Select choice(s)"), value: t.filter((g) => T[g.id].isSelected) }) : e("div", { className: B(X("ul-card__choices", s)), role: _ ? "radiogroup" : "group", children: [t.map(({ id: g, label: C, value: P, optionProperties: Z }) => {
|
|
195
|
-
var ie, ee;
|
|
196
|
-
const O = `${g}`, { allowsTextEntry: z, noneOfTheAbove: J } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...Z };
|
|
197
|
-
return e(he, { allowTextEntry: z, border: v, disabled: x(O), error: (G = T, E(G)), id: O, isRadio: _, isSelected: !!((ie = T[O]) != null && ie.isSelected), label: C, noneOfTheAbove: J, onUserInputChanged: u, promptText: "Please specify", text: (ee = T[g]) == null ? void 0 : ee.userText, useMobileStyling: s, value: P }, O);
|
|
198
|
-
var G;
|
|
199
|
-
}), !!c && e("div", { className: "ul-card__min-select-counter", children: [F(T), "/", r.minSelect] })] }), Q && e(ve, { handleSubmit: k, isSubmitDisabled: y(T) })] }), !m && e(de, { children: e("div", { className: "ul-card__button-wrapper", children: e(K, { disabled: y(T), onClick: k, children: ue(r) }) }) })] }) })] }, o);
|
|
200
|
-
}, _t = (n) => {
|
|
201
|
-
const { questionId: i, type: l, next: t, options: r } = n, { setFocusedQuestionId: o } = j((b) => ({ setFocusedQuestionId: b.setFocusedQuestionId }));
|
|
202
|
-
return e(Ue, { ...n, onSubmit: (b, f) => {
|
|
203
|
-
var S;
|
|
204
|
-
const d = Object.entries(b).find(([, p]) => p.isSelected) || [void 0, void 0], [v, s] = d, m = r.find((p) => `${p.id}` === v);
|
|
205
|
-
!((S = m == null ? void 0 : m.optionProperties) != null && S.allowsTextEntry) || s != null && s.userText && s.userText.trim() !== "" || o(i);
|
|
206
|
-
const a = s != null && s.userText ? { [v]: { userText: s.userText } } : null;
|
|
207
|
-
t({ value: m && v ? { [v]: m.value } : {}, secondaryValue: a, questionId: i, type: l }, f);
|
|
208
|
-
} });
|
|
209
|
-
}, It = (n) => {
|
|
210
|
-
const { questionId: i, type: l, next: t } = n;
|
|
211
|
-
return e(Ue, { ...n, onSubmit: (r, o) => {
|
|
212
|
-
const b = Object.entries(r).reduce((d, [v, s]) => (d[v] = s.isSelected, d), {}), f = Object.entries(r).reduce((d, [v, s]) => {
|
|
213
|
-
if (!s.userText) return d;
|
|
214
|
-
const m = d || {};
|
|
215
|
-
return m[v] = { userText: s.userText }, m;
|
|
216
|
-
}, null);
|
|
217
|
-
t({ value: b, secondaryValue: f, questionId: i, type: l }, o);
|
|
218
|
-
} });
|
|
219
|
-
}, Ct = ({ className: n, labels: i, message: l, properties: t, next: r, questionId: o, type: b }) => {
|
|
220
|
-
const [f, d] = W(null), { border: v, useMobileStyling: s, viewDocument: m, isLongFormSurvey: a, focusedQuestionId: S, update: p } = j((w) => ({ border: w.border, useMobileStyling: w.useMobileStyling, viewDocument: w.viewDocument, isLongFormSurvey: re(w.studyType), focusedQuestionId: w.focusedQuestionId, update: w.update })), h = a && S === o, N = i && i.left, T = i && i.right;
|
|
221
|
-
return Y(() => {
|
|
222
|
-
p();
|
|
223
|
-
}, [p]), e("form", { className: B(n, "ul-card--nps", "fade-in-transition", a && !h && "ul-card--unfocused"), children: [e(ne, { isRequired: a && (t == null ? void 0 : t.required), message: l, properties: t }), e(ce, { properties: t, children: [e(ae, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((w, _) => e("button", { className: B(X("nps-number", s), X(`nps-number-${_}`, s)), id: `option-${_}`, onClick: (q) => {
|
|
224
|
-
a && (q.preventDefault(), q.stopPropagation(), d(_)), r({ value: _, questionId: o, type: b }, !0);
|
|
225
|
-
}, onKeyDown: (q) => {
|
|
226
|
-
var E, F;
|
|
227
|
-
const L = m.querySelectorAll("button.nps-number");
|
|
228
|
-
q.key === "ArrowRight" ? (E = L[_ + 1]) == null || E.focus() : q.key === "ArrowLeft" ? (F = L[_ - 1]) == null || F.focus() : q.key !== "Enter" && q.key !== " " || (a && (q.preventDefault(), q.stopPropagation(), d(_)), r({ value: _, questionId: o, type: b }, !0));
|
|
229
|
-
}, onPointerDown: (q) => {
|
|
230
|
-
q.currentTarget.style.zIndex = "2", q.currentTarget.style.borderColor = v;
|
|
231
|
-
}, onPointerLeave: (q) => {
|
|
232
|
-
q.currentTarget.style.zIndex = "auto", q.currentTarget.style.borderColor = qe;
|
|
233
|
-
}, style: f === _ ? { backgroundColor: v, color: "#fff" } : void 0, tabIndex: 0, children: _ }, _)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: N }), e("span", { children: T })] })] }), !t.required && !a && e(de, { children: e("div", { className: "ul-vertical-centered-container", children: e(K, { onClick: (w) => {
|
|
234
|
-
w.preventDefault(), w.stopPropagation(), r({ value: null, questionId: o, type: b }, !0);
|
|
235
|
-
}, children: ue(t) }) }) })] })] }, o);
|
|
236
|
-
}, Nt = ({ className: n, message: i, next: l, properties: t, questionId: r, type: o, showIndividualSubmit: b = !1, onSubmitButtonClick: f }) => {
|
|
237
|
-
const { border: d, useMobileStyling: v, update: s, isLongFormSurvey: m, focusedQuestionId: a, setFocusedQuestionId: S, isPreview: p } = j((c) => ({ border: c.border, useMobileStyling: c.useMobileStyling, update: c.update, isLongFormSurvey: re(c.studyType), focusedQuestionId: c.focusedQuestionId, setFocusedQuestionId: c.setFocusedQuestionId, isPreview: c.isPreview })), [h, N] = W(""), T = te(null), w = m && a === r;
|
|
238
|
-
Y(() => {
|
|
239
|
-
var c, y;
|
|
240
|
-
m && !p && (w ? (c = T.current) == null || c.focus() : (y = T.current) == null || y.blur());
|
|
241
|
-
}, [m, w, p]);
|
|
242
|
-
const _ = h.trim(), q = t.required === !0 && !_, L = pt(T, () => s()), E = (c) => {
|
|
243
|
-
c.preventDefault(), c.stopPropagation(), l({ value: h, questionId: r, type: o }, !t.required || _.length > 0), f && f();
|
|
244
|
-
}, F = t && t.openTextPlaceholder ? t.openTextPlaceholder : "";
|
|
245
|
-
return e("form", { className: B(n, "ul-card-text", "fade-in-transition", m && !w && "ul-card--unfocused"), id: "text-form", onClick: () => {
|
|
246
|
-
m && a !== r && S(r);
|
|
247
|
-
}, children: [e(ne, { isRequired: m && (t == null ? void 0 : t.required), message: i, properties: t }), e(ce, { properties: t, children: e("div", { className: "ul-card-text", children: e(ae, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": F, className: B(X("ul-card-text__input", v)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (c) => {
|
|
248
|
-
c.currentTarget.style.borderColor = qe;
|
|
249
|
-
}, onChange: (c) => {
|
|
250
|
-
const { value: y } = c.currentTarget;
|
|
251
|
-
if (L(), c.preventDefault(), c.stopPropagation(), N(y), m) {
|
|
252
|
-
const R = y.trim().length > 0;
|
|
253
|
-
l({ value: y, questionId: r, type: o }, R);
|
|
254
|
-
}
|
|
255
|
-
}, onFocus: (c) => {
|
|
256
|
-
c.currentTarget.style.borderColor = d, S(r);
|
|
257
|
-
}, placeholder: F, ref: T, role: "textbox", tabIndex: 0 }) }), t.footerHtml && e(fe, { className: "footer", html: t.footerHtml }), b && e(ve, { handleSubmit: E, isSubmitDisabled: q }), e(de, { children: !m && e(K, { disabled: q, onClick: E, children: ue(t) }) })] }) }) })] }, r);
|
|
258
|
-
}, Ce = 1, He = 2, Ae = 3, ke = (n) => n.type === "av_permission", De = (n) => n.type === "screen_permission", je = (n, i) => n === void 0 ? Ce : n ? ((l, t) => !(ke(t) ? t.permissionDescriptors : []).includes("camera") || l.getVideoTracks().length > 0)(n, i) ? Ae : Ce : He, Fe = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
|
|
259
|
-
}, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, oe = et((n) => ({ ...Fe, reset: () => {
|
|
260
|
-
n(Fe);
|
|
261
|
-
}, updatePage: (i) => {
|
|
262
|
-
n(i);
|
|
263
|
-
} }));
|
|
264
|
-
function Ne({ currentPage: n, pages: i }) {
|
|
265
|
-
const { avStream: l, recordingMediaTypes: t, updatePage: r } = oe.getState(), { recorderEventEmitter: o } = j.getState();
|
|
266
|
-
o.emit("av.permission", { "permission.descriptors": n.permissionDescriptors, "stream.ready": (b, f) => {
|
|
267
|
-
if (l === b) return;
|
|
268
|
-
let d = n;
|
|
269
|
-
if (b && !n.permissionDescriptors.includes("camera")) {
|
|
270
|
-
const v = i.indexOf(n), s = f != null && f.active ? v + 2 : v + 1;
|
|
271
|
-
f != null && f.active && t && o.emit("begin.recording", { "recording.media.types": t, "start.recording.callback": (m) => r({ mediaRecordingUids: m }) }), d = i[s];
|
|
272
|
-
}
|
|
273
|
-
r({ currentPage: d, avStream: b });
|
|
274
|
-
} });
|
|
275
|
-
}
|
|
276
|
-
function we({ status: n }) {
|
|
277
|
-
const { nextQuestion: i, passthroughData: l, mediaRecordingUids: t, reset: r } = oe.getState(), { recorderEventEmitter: o, handleUploadUpdate: b, index: f } = j.getState(), d = { value: { taskStatus: n }, type: "recordedtask", questionId: (l == null ? void 0 : l.questionId) || 1 };
|
|
278
|
-
l && o.emit("finish.task", { "begin.callback": (v) => {
|
|
279
|
-
b({ mediaRecordingUid: v, isSubmitted: !0, progressPct: 0, isComplete: !1 });
|
|
280
|
-
}, "progress.callback": (v, s) => {
|
|
281
|
-
b({ mediaRecordingUid: v, progressPct: s.detail, isSubmitted: !1, isComplete: !1 });
|
|
282
|
-
}, "upload.callback": (v) => {
|
|
283
|
-
v && b({ mediaRecordingUid: v, isComplete: !0, isSubmitted: !0, progressPct: 100 });
|
|
284
|
-
}, "passthrough.data": l, "current.index": f, "task.response": d, "task.complete.callback": (v) => {
|
|
285
|
-
d.value.taskDurationMillisecond = v, t && (d.value.mediaRecordingUids = t), r(), i(d);
|
|
286
|
-
} });
|
|
287
|
-
}
|
|
288
|
-
function Le({ pages: n, setIsRequestingPermission: i }) {
|
|
289
|
-
const { recorderEventEmitter: l, eventEmitFn: t } = j.getState(), { updatePage: r, currentPage: o, recordingMediaTypes: b, screenPermissionRequested: f } = oe.getState();
|
|
290
|
-
if (!o) return;
|
|
291
|
-
const d = n.indexOf(o);
|
|
292
|
-
switch (o.type) {
|
|
293
|
-
case "av_permission": {
|
|
294
|
-
const v = f ? d + 2 : d + 1;
|
|
295
|
-
return f && b && l.emit("begin.recording", { "recording.media.types": b, "start.recording.callback": (s) => {
|
|
296
|
-
r({ mediaRecordingUids: s });
|
|
297
|
-
} }), void r({ currentPage: n[v] });
|
|
298
|
-
}
|
|
299
|
-
case "screen_permission":
|
|
300
|
-
return void l.emit("screen.permission", { "screen.permission.requested": i, "stream.ready.callback": (v, s) => {
|
|
301
|
-
const m = s ? n[d + 1] : o;
|
|
302
|
-
s && b && l.emit("begin.recording", { "recording.media.types": b, "start.recording.callback": (a) => {
|
|
303
|
-
r({ captureStream: s, mediaRecordingUids: a });
|
|
304
|
-
} }), r({ currentPage: m, screenPermissionRequested: !0, captureStream: s });
|
|
305
|
-
} });
|
|
306
|
-
case "start_task":
|
|
307
|
-
return t("recorded.task.start"), l.emit("recorded.task.start"), l.emit("start.task"), void r({ currentPage: n[d + 1], screenPermissionRequested: !0 });
|
|
308
|
-
case "complete_task":
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
const Ve = "ul-permission-graphics-container", Ze = "ul-permission-body", We = B(Ve, "ul_recorded-task-inset-spacing"), Te = B("ul-horizontal-button-container", "ul-horizontal-button-container-left"), Ge = ({ richTextBody: n }) => e(fe, { className: "ul-rich-text-body", html: n, id: "ul-task-detail-container" }), _e = ({ required: n, skipButtonText: i, bottom: l = !1 }) => n ? null : e(K, { className: B(l && "ul-skip-button-below", "ul-button-inactive"), onClick: we.bind(null, { status: "abandoned" }), children: i || "Skip" }), Pe = (n) => {
|
|
313
|
-
const { avStream: i, captureStream: l, recordingMediaTypes: t, updatePage: r } = oe.getState(), o = (t == null ? void 0 : t.includes("audio")) || (t == null ? void 0 : t.includes("video"));
|
|
314
|
-
Y(() => {
|
|
315
|
-
const b = setInterval(() => {
|
|
316
|
-
o && i && !i.active ? r({ avStream: null, currentPage: n[0] }) : l && l.active || r({ captureStream: void 0, currentPage: n[o ? 1 : 0] });
|
|
317
|
-
}, 1e3);
|
|
318
|
-
return () => clearInterval(b);
|
|
319
|
-
}, [i, l, o, n, t, r]);
|
|
320
|
-
}, wt = ({ content: n, pages: i, required: l }) => {
|
|
321
|
-
const { buttonText: t, skipButtonText: r, taskDetail: o } = n;
|
|
322
|
-
return Pe(i), e("div", { className: "ul-task-page", children: [o && e(Ge, { richTextBody: o }), e("div", { className: Te, children: [e(K, { onClick: Le.bind(null, { pages: i }), children: t }), e(_e, { required: l, skipButtonText: r })] })] }, "start-task");
|
|
323
|
-
}, qt = ({ content: n, pages: i, properties: l }) => {
|
|
324
|
-
const { buttonText: t, skipButtonText: r } = n;
|
|
325
|
-
return Pe(i), e("div", { className: "ul-task-page", children: [n.taskDetail && e(Ge, { richTextBody: n.taskDetail }), e(ce, { properties: l, children: e("div", { className: Te, children: [e(K, { className: "ul-complete-task-button", onClick: we.bind(null, { status: "completed" }), children: t }), e(K, { className: B("ul-button-inactive"), onClick: we.bind(null, { status: "given.up" }), children: r })] }) })] }, "complete-task");
|
|
326
|
-
}, Lt = ({ content: n, pages: i, required: l }) => {
|
|
327
|
-
const { buttonText: t, skipButtonText: r } = n, [o] = j((d) => [d.tabTitle]), [b, f] = W(!1);
|
|
328
|
-
return e("div", { children: [e("div", { className: We, children: [e("p", { style: { marginTop: "auto" }, children: n.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: Ze, children: o }) })] }), e("div", { className: l ? "" : Te, children: [e(K, { disabled: b, onClick: Le.bind(null, { pages: i, setIsRequestingPermission: f }), children: t }), e(_e, { required: l, skipButtonText: r })] })] });
|
|
329
|
-
}, Pt = ({ content: n }) => e(fe, { className: B(Ve, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), html: n.svg }, "ul-permission-request-graphic"), Mt = ({ content: n, pages: i, required: l }) => {
|
|
330
|
-
const { permissionDeniedHeadline: t, permissionDeniedBody: r, skipButtonText: o, tryAgainButtonText: b } = n, f = ke(i[0]) ? i[0] : null;
|
|
331
|
-
return Y(() => {
|
|
332
|
-
const d = setInterval(() => {
|
|
333
|
-
f !== null && Ne({ currentPage: f, pages: i });
|
|
334
|
-
}, 1e3);
|
|
335
|
-
return () => clearInterval(d);
|
|
336
|
-
}, [f, i]), f ? e("div", { children: [e("div", { className: We, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: t }), e("span", { className: Ze, children: r })] }) }), e("div", { className: Te, children: [e(K, { onClick: Ne.bind(null, { currentPage: f, pages: i }), children: b }), e(_e, { required: l, skipButtonText: o })] })] }) : null;
|
|
337
|
-
}, Rt = ({ stream: n }) => e("video", { autoPlay: !0, className: B("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (i) => {
|
|
338
|
-
i && (i.srcObject = n || null);
|
|
339
|
-
} }), Dt = ({ content: n, pages: i, required: l }) => {
|
|
340
|
-
const { skipButtonText: t } = n, { avStream: r } = oe.getState();
|
|
341
|
-
return Pe(i), e("div", { children: [e(Rt, { stream: r }), e("div", { className: "ul-vertical-button-container-center", children: [e(K, { onClick: Le.bind(null, { pages: i }), children: n.buttonText }), e(_e, { bottom: !0, required: l, skipButtonText: t })] })] });
|
|
342
|
-
}, Ft = ({ properties: n }) => {
|
|
343
|
-
const { pages: i, required: l } = n, { avStream: t, currentPage: r } = oe.getState();
|
|
344
|
-
if (r === void 0) return null;
|
|
345
|
-
switch (r == null ? void 0 : r.type) {
|
|
346
|
-
case "av_permission": {
|
|
347
|
-
const o = je(t, r);
|
|
348
|
-
return o === Ce ? e(Pt, { content: r }) : e(o === He ? Mt : Dt, { content: r, pages: i, required: l });
|
|
349
|
-
}
|
|
350
|
-
case "screen_permission":
|
|
351
|
-
return e(Lt, { content: r, pages: i, required: l });
|
|
352
|
-
case "start_task":
|
|
353
|
-
return e(wt, { content: r, pages: i, required: l });
|
|
354
|
-
case "complete_task":
|
|
355
|
-
return e(qt, { content: r, pages: i, properties: n });
|
|
356
|
-
default:
|
|
357
|
-
return null;
|
|
358
|
-
}
|
|
359
|
-
}, Bt = ({ className: n, properties: i, next: l, questionId: t }) => {
|
|
360
|
-
const r = j(), { surveyId: o, responseGroupUid: b, userId: f } = r, d = oe(), { screenPermissionRequested: v } = d, s = oe((h) => h.avStream);
|
|
361
|
-
let m = oe((h) => h.currentPage);
|
|
362
|
-
m || (m = function({ pages: h, userId: N, responseGroupUid: T, surveyId: w, questionId: _, next: q }) {
|
|
363
|
-
const { updatePage: L } = oe.getState(), { eventEmitFn: E, recorderEventEmitter: F } = j.getState(), c = { questionId: _, surveyId: w, visitorId: N, responseGroupUid: T };
|
|
364
|
-
let y = 0;
|
|
365
|
-
F.emit("recorded.task.permission.screen"), E("recorded.task.permission.screen"), F.emit("permission.status", { "permission.status.callback": (Q, u, x, k) => {
|
|
366
|
-
const D = h[y], { type: g } = D, C = ["screen"];
|
|
367
|
-
if (ke(D)) {
|
|
368
|
-
const { permissionDescriptors: P } = D, Z = P == null ? void 0 : P.includes("microphone"), O = P == null ? void 0 : P.includes("camera");
|
|
369
|
-
Z && C.push("audio"), O && C.push("video"), (Q != null && Q.active && !O || Q != null && Q.active && u) && y++;
|
|
370
|
-
}
|
|
371
|
-
De(h[y]) && x && (y++, F.emit("begin.recording", { "recording.media.types": C, "start.recording.callback": (P) => L({ mediaRecordingUids: P }) })), L({ currentPage: h[y], avStream: Q, screenPermissionRequested: x, nextQuestion: q, type: g, passthroughData: c, recordingMediaTypes: C, captureStream: k });
|
|
372
|
-
} });
|
|
373
|
-
const R = h[y];
|
|
374
|
-
return R.type === "av_permission" && Ne({ currentPage: R, pages: h }), R;
|
|
375
|
-
}({ questionId: t, surveyId: o, next: (h) => {
|
|
376
|
-
l(h, !0);
|
|
377
|
-
}, pages: i.pages, responseGroupUid: b, userId: f }));
|
|
378
|
-
let a = m.headline, S = m.captionText;
|
|
379
|
-
const p = je(s, m);
|
|
380
|
-
return De(m) && v && (a = m.permissionDeniedHeadline, S = m.permissionDeniedCaptionText), ke(m) && p === Ae && (a = m.permissionGrantedHeadline, S = m.permissionGrantedCaptionText), e("div", { className: B(n, "ul-center-horizontally", "fade-in-transition"), children: [e(ne, { isRequired: i == null ? void 0 : i.required, message: a, properties: { captionText: S } }), e(ae, { children: e(Ft, { properties: i }) })] });
|
|
381
|
-
}, Et = ({ richTextBody: n, plaintextBody: i, update: l }) => (Y(() => {
|
|
382
|
-
l();
|
|
383
|
-
}, [l]), n ? e(fe, { className: "ul-rich-text-body", html: n, id: "ul-card__text-url-body-container" }) : i ? e("div", { className: "ul-rich-text-body", id: "ul-card__text-url-body-container", children: (i ? i.split(/\n\s*\n/g) : []).map((t, r) => e("p", { children: t }, r)) }) : null), Qt = ({ className: n, message: i, next: l, properties: t, questionId: r, type: o }) => {
|
|
384
|
-
const { visitorAttributes: b, isLongFormSurvey: f, update: d } = j((a) => ({ visitorAttributes: a.visitorAttributes, isLongFormSurvey: re(a.studyType), update: a.update })), v = (a, S = !1) => {
|
|
385
|
-
l({ value: S ? { skipped: !0 } : void 0, questionId: r, type: o }, !0);
|
|
386
|
-
}, s = mt(t && t.buttonUrl, b), m = f && t.promptActionType === gt.NO_BUTTON;
|
|
387
|
-
return e("div", { className: B(n, "ul-card__text-url-prompt", "fade-in-transition"), children: [e(ne, { isRequired: f && (t == null ? void 0 : t.required), message: i, properties: { questionHtml: t.questionHtml } }), e(ae, { children: e(Et, { plaintextBody: t == null ? void 0 : t.body, richTextBody: t == null ? void 0 : t.richTextBody, update: d }) }), e(ce, { properties: t, children: !m && e(de, { children: e("div", { className: "ul-card-button-group", children: [e("a", { className: "ul-card-text__button ul-card__text-url-prompt-button", href: s, id: "ul-card-text__button", onClick: v, onKeyPress: (a) => {
|
|
388
|
-
a.key !== "Enter" && a.key !== " " || l({ value: void 0, questionId: r, type: o }, !0);
|
|
389
|
-
}, rel: "noreferrer", role: s ? "link" : "button", tabIndex: 0, target: "_blank", children: ue(t) }), t.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (a) => v(0, !0), children: Qe(t) })] }) }) })] }, r);
|
|
390
|
-
}, $t = ({ className: n, questionId: i }) => {
|
|
391
|
-
const { border: l, destroy: t, endCard: r, forceBrandedLogo: o } = j((d) => ({ border: d.border, destroy: d.destroy, endCard: d.endCard, forceBrandedLogo: d.forceBrandedLogo }));
|
|
392
|
-
Y(() => {
|
|
393
|
-
setTimeout(() => {
|
|
394
|
-
t(ct);
|
|
395
|
-
}, o ? 4e3 : 2e3);
|
|
396
|
-
}, [t, o]);
|
|
397
|
-
const b = r && r.subheader ? e("p", { className: "ul-caption", children: r.subheader }) : null, f = r && r.headline ? r.headline : "";
|
|
398
|
-
return e("div", { className: B(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: l, 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: l, 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(ne, { message: f }), b] }) }) }, i);
|
|
399
|
-
}, Ot = ({ className: n }) => {
|
|
400
|
-
const { uploadProgress: i } = j((o) => ({ uploadProgress: o.uploadProgress }));
|
|
401
|
-
let l, t;
|
|
402
|
-
Object.values(i).filter((o) => o.isSubmitted).length > 1 ? (l = "Your responses are processing", t = "Please keep this tab open until your responses are fully processed.") : (l = "Your response is processing", t = "Please keep this tab open until your response is fully processed.");
|
|
403
|
-
const r = Math.round(Math.min(99, ...Object.values(i).filter((o) => o.isSubmitted).map((o) => o.progressPct || 0)));
|
|
404
|
-
return e("div", { className: B(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(ne, { message: `${l} (${r}% complete)` }), e("p", { className: "ul-caption", children: t })] });
|
|
405
|
-
}, ze = tt(void 0), Ut = ({ value: n, children: i }) => e(ze.Provider, { value: n, children: i }), Ht = ({ isRightLabel: n, isLeftLabel: i }) => n ? le.RIGHT : i ? le.LEFT : null, At = "Best", jt = "Worst", Vt = ({ className: n, labels: i, message: l, properties: t, options: r, questionId: o, type: b, next: f }) => {
|
|
406
|
-
var q, L, E, F;
|
|
407
|
-
const [d, v] = W(r.map((c, y) => ({ ...c, label: c.label === "" ? `Item ${y + 1}` : c.label, isRightLabel: !1, isLeftLabel: !1 }))), s = (() => {
|
|
408
|
-
const c = rt(ze);
|
|
409
|
-
if (c === void 0) throw new Error("usePreviousResponses must be used within a PreviousResponsesProvider");
|
|
410
|
-
return c;
|
|
411
|
-
})(), m = { padding: "24px", display: "flex", cursor: "pointer", width: "auto" }, [a, S] = W(!1);
|
|
412
|
-
Y(() => {
|
|
413
|
-
const c = d.findIndex((g) => g.isRightLabel), y = d.findIndex((g) => g.isLeftLabel), R = c !== -1 && y !== -1;
|
|
414
|
-
S(R);
|
|
415
|
-
const Q = !t.required || t.required && R, u = d.map((g) => ({ id: g.id, option: g.label, selected: Ht(g) })), x = Math.floor(o), k = Object.keys(s).filter((g) => g.startsWith(x.toString())).map(Number).sort((g, C) => g - C).at(-1), D = [];
|
|
416
|
-
if (typeof k == "number") {
|
|
417
|
-
const g = s[k], C = JSON.parse(g);
|
|
418
|
-
D.push(...C);
|
|
419
|
-
}
|
|
420
|
-
D.push(u), setTimeout(() => {
|
|
421
|
-
f({ value: D, questionId: o, type: b }, Q, R), S(!1);
|
|
422
|
-
}, R ? 500 : 0);
|
|
423
|
-
}, [d]);
|
|
424
|
-
const { border: p, useMobileStyling: h, enableCspTrustedTypes: N } = j((c) => ({ border: c.border, useMobileStyling: c.useMobileStyling, enableCspTrustedTypes: c.enableCspTrustedTypes })), T = (c, y) => () => {
|
|
425
|
-
a || v((R) => ((Q, u, x) => Q.map((k) => k.id === u ? { ...k, isRightLabel: x === le.RIGHT, isLeftLabel: x === le.LEFT } : x === le.RIGHT && k.isRightLabel || x === le.LEFT && k.isLeftLabel ? { ...k, isRightLabel: !1, isLeftLabel: !1 } : k))(R, c, y));
|
|
426
|
-
}, w = (q = t.ratingIcons) == null ? void 0 : q[0].svg, _ = (L = t.ratingIcons) == null ? void 0 : L[1].svg;
|
|
427
|
-
return e("form", { className: B(n, "ul-card-maxdiff", "fade-in-transition"), children: [e(ne, { isRequired: t == null ? void 0 : t.required, message: l, properties: t }), e(ae, { children: e("div", { className: "ul-card--maxdiff__question-inner-container", children: [e("div", { className: "ul-card-maxdiff__label", children: (i == null ? void 0 : i.left) || ((E = t == null ? void 0 : t.labels) == null ? void 0 : E.left) || At }), e("div", { children: " " }), e("div", { className: "ul-card-maxdiff__label", children: (i == null ? void 0 : i.right) || ((F = t == null ? void 0 : t.labels) == null ? void 0 : F.right) || jt }), d.map(({ id: c, label: y, isLeftLabel: R, isRightLabel: Q }) => e(be, { children: [e("div", { className: "ul-card-maxdiff__option-control " + (_ ? "smiley" : ""), children: _ ? e(Be, { ariaPressed: R, className: R ? "ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected good" : "ul-card-maxdiff__option-btn", enableCspTrustedTypes: N, html: _, id: `smiley-good-${c}`, onClick: T(c, le.LEFT) }) : e(he, { allowTextEntry: !1, ariaLabel: `bestLabel-${y}`, border: p, choiceStyle: m, error: !1, id: `${c}`, isRadio: !0, isSelected: R, onUserInputChanged: T(c, le.LEFT), useMobileStyling: h }) }), e("div", { className: "ul-card-maxdiff__option-label", children: y }), e("div", { className: "ul-card-maxdiff__option-control " + (w ? "smiley" : ""), children: w ? e(Be, { ariaPressed: Q, className: Q ? "ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected bad" : "ul-card-maxdiff__option-btn", enableCspTrustedTypes: N, html: w, id: `smiley-bad-${c}`, onClick: T(c, le.RIGHT) }) : e(he, { allowTextEntry: !1, ariaLabel: `worstLabel-${y}`, border: p, choiceStyle: m, error: !1, id: `${c}`, isRadio: !0, isSelected: Q, onUserInputChanged: T(c, le.RIGHT), useMobileStyling: h }) })] }))] }) })] }, o);
|
|
428
|
-
}, Be = ({ enableCspTrustedTypes: n, ariaPressed: i, className: l, html: t, id: r, onClick: o }) => {
|
|
429
|
-
const b = ge(() => $e(t, n), [n, t]);
|
|
430
|
-
return e("span", { "aria-pressed": i, className: l, dangerouslySetInnerHTML: { __html: b }, id: r, onClick: o, tabIndex: 0, type: "button" });
|
|
431
|
-
}, Zt = ({ className: n, labels: i, message: l, next: t, properties: r, questionId: o, type: b, onSubmitButtonClick: f, options: d, showIndividualSubmit: v = !1 }) => {
|
|
432
|
-
const s = te(null), m = te(0), a = te(0), S = te(null), p = te(!1), h = te([]), [N, T] = W(() => (r == null ? void 0 : r.required) === !0), [w, _] = W(() => d.map((I) => ({ ...I, rank: null }))), q = ge(() => Array.from({ length: d.length }, (I, $) => $ + 1), [d.length]), { isLongFormSurvey: L, focusedQuestionId: E, setFocusedQuestionId: F, useMobileStyling: c, isPreview: y, headers: R, update: Q } = j((I) => ({ useMobileStyling: I.useMobileStyling, isLongFormSurvey: re(I.studyType), focusedQuestionId: I.focusedQuestionId, setFocusedQuestionId: I.setFocusedQuestionId, isPreview: I.isPreview, headers: I.headers, update: I.update })), u = (R == null ? void 0 : R["userleap-platform"]) === "android", x = c && !y && !u, k = !x && !u, D = L && E === o, g = (I) => {
|
|
433
|
-
I.preventDefault(), G(w), f && f();
|
|
434
|
-
}, C = (I, $) => {
|
|
435
|
-
_((U) => {
|
|
436
|
-
const M = parseInt($), H = U.map((A) => ({ ...A }));
|
|
437
|
-
H.some((A) => A.rank == null) && H.forEach((A, me) => A.rank = me + 1);
|
|
438
|
-
const se = H.findIndex((A) => A.id === I);
|
|
439
|
-
if (se === -1) return U;
|
|
440
|
-
const V = H[se].rank;
|
|
441
|
-
return M < V ? H.forEach((A) => {
|
|
442
|
-
A.id !== I && A.rank >= M && A.rank < V && (A.rank = A.rank + 1);
|
|
443
|
-
}) : M > V && H.forEach((A) => {
|
|
444
|
-
A.id !== I && A.rank > V && A.rank <= M && (A.rank = A.rank - 1);
|
|
445
|
-
}), H[se].rank = M, H.sort((A, me) => A.rank - me.rank), ie(H), H;
|
|
446
|
-
});
|
|
447
|
-
}, P = (I, $) => {
|
|
448
|
-
for (let U = 0; U < h.current.length; U++) {
|
|
449
|
-
const M = h.current[U];
|
|
450
|
-
if (!M || M === S.current) continue;
|
|
451
|
-
const H = M.getBoundingClientRect();
|
|
452
|
-
if (I >= H.left && I <= H.right && $ >= H.top && $ <= H.bottom) return { element: M, index: U };
|
|
453
|
-
}
|
|
454
|
-
return null;
|
|
455
|
-
}, Z = (I) => ($) => {
|
|
456
|
-
if (!x) return;
|
|
457
|
-
$.preventDefault(), $.stopPropagation(), p.current = !0, s.current = I;
|
|
458
|
-
const U = $.touches[0];
|
|
459
|
-
m.current = U.clientY, a.current = U.clientY;
|
|
460
|
-
const M = $.currentTarget.closest(".ul-card-rank__option");
|
|
461
|
-
M && (S.current = M, M.classList.add("is-dragging"));
|
|
462
|
-
}, O = (I) => {
|
|
463
|
-
if (!x || !p.current || s.current === null) return;
|
|
464
|
-
I.preventDefault(), I.stopPropagation();
|
|
465
|
-
const $ = I.touches[0];
|
|
466
|
-
a.current = $.clientY;
|
|
467
|
-
const U = a.current - m.current;
|
|
468
|
-
S.current && (S.current.style.transform = `translateY(${U}px)`, S.current.style.zIndex = "1000"), h.current.forEach((H) => {
|
|
469
|
-
H && H !== S.current && H.classList.remove("is-drop-target");
|
|
470
|
-
});
|
|
471
|
-
const M = P($.clientX, $.clientY);
|
|
472
|
-
M && M.element.classList.add("is-drop-target");
|
|
473
|
-
}, z = (I) => {
|
|
474
|
-
if (!x || !p.current || s.current === null) return;
|
|
475
|
-
I.preventDefault(), I.stopPropagation();
|
|
476
|
-
const $ = I.changedTouches[0], U = P($.clientX, $.clientY);
|
|
477
|
-
S.current && (S.current.style.transform = "", S.current.style.zIndex = "", S.current.classList.remove("is-dragging")), h.current.forEach((M) => {
|
|
478
|
-
M && M.classList.remove("is-drop-target");
|
|
479
|
-
}), U && U.index !== s.current && J(s.current, U.index), s.current = null, S.current = null, p.current = !1;
|
|
480
|
-
}, J = (I, $) => {
|
|
481
|
-
_((U) => {
|
|
482
|
-
const M = U.map((se) => ({ ...se })), [H] = M.splice(I, 1);
|
|
483
|
-
return M.splice($, 0, H), M.forEach((se, V) => {
|
|
484
|
-
se.rank = V + 1;
|
|
485
|
-
}), ie(M), M;
|
|
486
|
-
});
|
|
487
|
-
}, G = (I) => {
|
|
488
|
-
const $ = {};
|
|
489
|
-
I.reduce((U, M) => (U[M.id] = M.rank, U), $), t({ value: $, questionId: o, type: b }, !0);
|
|
490
|
-
}, ie = (I) => {
|
|
491
|
-
T(!1), L && G(I);
|
|
492
|
-
}, { left: ee, right: pe } = i, ye = d.length, Ye = (I) => {
|
|
493
|
-
I.preventDefault(), I.currentTarget.classList.add("is-drop-target");
|
|
494
|
-
}, Ke = (I) => {
|
|
495
|
-
I.currentTarget.classList.remove("is-drop-target");
|
|
496
|
-
}, Xe = (I) => {
|
|
497
|
-
s.current = null, I.currentTarget.classList.remove("is-dragging");
|
|
498
|
-
};
|
|
499
|
-
return Y(() => {
|
|
500
|
-
Q();
|
|
501
|
-
}, [Q]), e("form", { className: B(n, "ul-card-rank", "fade-in-transition", L && !D && "ul-card--unfocused"), onClick: L ? () => {
|
|
502
|
-
L && E !== o && F(o);
|
|
503
|
-
} : void 0, onSubmit: g, children: [e(ne, { isRequired: r == null ? void 0 : r.required, message: l, properties: r }), e(ce, { properties: r, children: e(be, u ? { 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 - ", ee] }) }), e("ol", { className: "ul-card-rank__list", children: w.map(({ id: I, label: $, rank: U }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${$}`, className: B("ul-card-rank__select", U == null && "ul-card-rank__select--placeholder"), name: `rank[${I}]`, onChange: (M) => C(I, M.currentTarget.value), value: U ?? "", children: [U == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), q.map((M) => e("option", { className: "ul-card-rank__select-option", value: M, children: M }, `${M}-${o}`))] }), e("span", { children: $ })] }, I)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ye, " - ", pe] }) })] }), v && e(ve, { handleSubmit: g, isSubmitDisabled: N })] }), !L && e(de, { children: e("div", { className: "ul-card__button-wrapper", children: e(K, { disabled: N, children: ue(r) }) }) })] } : { 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 - ", ee] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: u ? void 0 : (I) => {
|
|
504
|
-
I.preventDefault(), I.dataTransfer && (I.dataTransfer.dropEffect = "move");
|
|
505
|
-
}, children: w.map(({ id: I, label: $, rank: U }, M) => {
|
|
506
|
-
return e("li", { className: "ul-card-rank__option", draggable: !!k || void 0, onDragEnd: k ? Xe : void 0, onDragEnter: k ? Ye : void 0, onDragLeave: k ? Ke : void 0, onDragStart: k ? (se = M, (V) => {
|
|
507
|
-
s.current = se, V.dataTransfer && (V.dataTransfer.effectAllowed = "move", V.dataTransfer.setData("text/plain", String(se)), V.currentTarget.classList.add("is-dragging"));
|
|
508
|
-
}) : void 0, onDrop: k ? (H = M, (V) => {
|
|
509
|
-
var me, Me;
|
|
510
|
-
V.preventDefault(), V.currentTarget.classList.remove("is-drop-target");
|
|
511
|
-
const A = s.current;
|
|
512
|
-
s.current = null, (Me = (me = V.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : me.querySelector(".is-dragging")) == null || Me.classList.remove("is-dragging"), A != null && A !== H && J(A, H);
|
|
513
|
-
}) : void 0, ref: (V) => h.current[M] = V, children: [e("select", { "aria-label": `Rank for ${$}`, className: B("ul-card-rank__select", U == null && "ul-card-rank__select--placeholder"), name: `rank[${I}]`, onChange: (V) => C(I, V.currentTarget.value), value: U ?? "", children: [U == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), q.map((V) => e("option", { className: "ul-card-rank__select-option", value: V, children: V }, `${V}-${o}`))] }), e("span", { children: $ }), !u && e("button", { "aria-label": `Drag ${$} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: x ? z : void 0, onTouchMove: x ? O : void 0, onTouchStart: x ? Z(M) : void 0, title: "Drag to reorder", type: "button", children: e("svg", { fill: "none", height: "17", viewBox: "0 0 16 17", width: "16", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z", fill: "currentColor" }) }) })] }, I);
|
|
514
|
-
var H, se;
|
|
515
|
-
}) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ye, " - ", pe] }) })] }), v && e(ve, { handleSubmit: g, isSubmitDisabled: N })] }), !L && e(de, { children: e("div", { className: "ul-card__button-wrapper", children: e(K, { disabled: N, children: ue(r) }) }) })] }) })] }, o);
|
|
516
|
-
}, Wt = /* @__PURE__ */ new Set(["open", "matrix", "multipleselect", "multiplechoice", "rankorder"]), Ee = ({ cardInstance: n, moveToNextQuestion: i, showIndividualSubmit: l, submitQuestion: t, updateCardValues: r }) => {
|
|
517
|
-
const { isLongFormSurvey: o } = j((a) => ({ isLongFormSurvey: re(a.studyType) }));
|
|
518
|
-
if (!n) return null;
|
|
519
|
-
const { name: b, type: f, props: d } = n, v = l && Wt.has(f), s = { className: "ul-card", next: (a, S, p = !0) => t(a, S && p), questionId: b, type: f, showIndividualSubmit: l, ...v ? { next: (a, S) => {
|
|
520
|
-
r(a.questionId, a, S ?? !0);
|
|
521
|
-
}, onSubmitButtonClick: () => i(b) } : {} }, m = (() => {
|
|
522
|
-
switch (f) {
|
|
523
|
-
case "consentlegal":
|
|
524
|
-
return e(ht, { ...s, ...d });
|
|
525
|
-
case "likert":
|
|
526
|
-
return e(vt, { ...s, ...d });
|
|
527
|
-
case "matrix":
|
|
528
|
-
return e(Tt, { ...s, ...d });
|
|
529
|
-
case "maxdiff":
|
|
530
|
-
return e(Vt, { ...s, ...d });
|
|
531
|
-
case "multiplechoice":
|
|
532
|
-
return e(_t, { ...s, ...d });
|
|
533
|
-
case "multipleselect":
|
|
534
|
-
return e(It, { ...s, ...d });
|
|
535
|
-
case "nps":
|
|
536
|
-
return e(Ct, { ...s, ...d });
|
|
537
|
-
case "open":
|
|
538
|
-
return e(Nt, { ...s, ...d });
|
|
539
|
-
case "rankorder":
|
|
540
|
-
return e(Zt, { ...s, ...d });
|
|
541
|
-
case "recordedtask":
|
|
542
|
-
return e(Bt, { ...s, ...d });
|
|
543
|
-
case "texturlprompt":
|
|
544
|
-
return e(Qt, { ...s, ...d });
|
|
545
|
-
case "thanks":
|
|
546
|
-
return e($t, { ...s, ...d });
|
|
547
|
-
case "uploading":
|
|
548
|
-
return e(Ot, { ...s, ...d });
|
|
549
|
-
default:
|
|
550
|
-
return null;
|
|
551
|
-
}
|
|
552
|
-
})();
|
|
553
|
-
return m ? o ? e("div", { className: "ul-card-scroll-wrapper", children: m }, b) : m : null;
|
|
554
|
-
}, Gt = ({ isSubmitDisabled: n = !1, onSubmit: i, buttonText: l }) => {
|
|
555
|
-
var S;
|
|
556
|
-
const { cards: t, forceBrandedLogo: r, index: o, marketingUrl: b, showSurveyBrand: f, slugName: d, surveyId: v, useMobileStyling: s } = j((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 })), m = ((S = t[o]) == null ? void 0 : S.type) === "thanks", a = it({ marketingUrl: b, slugName: d, surveyId: v, forceBrandedLogo: r });
|
|
557
|
-
return e("footer", { className: B("long-form-question-footer-container", s && "long-form-question-footer-container--mobile", m && "long-form-question-footer-container-center"), children: [m && r ? e(nt, { marketingUrlLink: a }) : e("div", { className: "long-form-question-footer-container-logo", children: f ? e(st, { forceBrandedLogo: r, marketingUrlLink: a }) : null }), !m && e("div", { className: B("ul-card__button-wrapper", "ul-card-vertical__button-wrapper", "long-form-question-footer-container-actions"), children: e(K, { className: B("long-form-button", n && "sprig-button-disabled"), disabled: n, onClick: i, children: e("span", { className: "long-form-button-text-container", children: l ?? e(at, { stroke: "white" }) }) }) })] });
|
|
558
|
-
}, Xt = ({ cards: n, next: i, previousResponses: l }) => {
|
|
559
|
-
var Q;
|
|
560
|
-
const [t, r] = W({}), [o, b] = W({}), f = ge(() => ({ ...l, ...lt(n.map((u) => {
|
|
561
|
-
var x, k;
|
|
562
|
-
return { ...u, value: ((x = t[u.name]) == null ? void 0 : x.value) ?? null, secondaryValue: ((k = t[u.name]) == null ? void 0 : k.secondaryValue) ?? null };
|
|
563
|
-
})) }), [l, t, n]), d = ot(n, f), { isLongFormSurvey: v, focusedQuestionId: s, setFocusedQuestionId: m, update: a, index: S } = j((u) => ({ index: u.index, isLongFormSurvey: re(u.studyType), focusedQuestionId: u.focusedQuestionId, setFocusedQuestionId: u.setFocusedQuestionId, update: u.update })), p = te(null), h = te(!1), N = te(null);
|
|
564
|
-
dt(() => {
|
|
565
|
-
a();
|
|
566
|
-
}, [a, S]);
|
|
567
|
-
const T = Se((u) => {
|
|
568
|
-
var g, C;
|
|
569
|
-
h.current = !0;
|
|
570
|
-
const x = n.findIndex((P) => P.name === u);
|
|
571
|
-
if (!v || u === null || x === -1) return void (h.current = !1);
|
|
572
|
-
const k = (g = p.current) == null ? void 0 : g.querySelectorAll(".ul-card-scroll-wrapper")[x], D = (C = p.current) == null ? void 0 : C.closest(".ul-card__container");
|
|
573
|
-
if (k && D) {
|
|
574
|
-
if (k && D) {
|
|
575
|
-
const P = k.getBoundingClientRect(), Z = D.getBoundingClientRect(), O = P.top - Z.top + D.scrollTop, z = O + P.height / 2, J = window.innerHeight - 157;
|
|
576
|
-
let G;
|
|
577
|
-
P.height >= J ? G = O : G = z - D.clientHeight / 2;
|
|
578
|
-
const ie = D.clientHeight, ee = D.scrollHeight - ie, pe = Math.max(0, Math.min(G, ee));
|
|
579
|
-
D.scrollTo({ top: pe, behavior: "smooth" }), setTimeout(() => {
|
|
580
|
-
h.current = !1;
|
|
581
|
-
}, 500);
|
|
582
|
-
}
|
|
583
|
-
} else h.current = !1;
|
|
584
|
-
}, [v, n]);
|
|
585
|
-
function w(u, x) {
|
|
586
|
-
return u.map((k) => {
|
|
587
|
-
const D = x[k.name], g = d.find((C) => C.name === k.name);
|
|
588
|
-
return { ...D, questionText: g ? Re(g) : void 0 };
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
Y(() => {
|
|
592
|
-
s !== null && n.findIndex((u) => u.name === s) !== -1 || m(n[0].name);
|
|
593
|
-
}, [n, s, m]);
|
|
594
|
-
const _ = (u) => {
|
|
595
|
-
if (!v) return;
|
|
596
|
-
const x = n.findIndex((k) => k.name === u) + 1;
|
|
597
|
-
if (x < n.length) {
|
|
598
|
-
const k = n[x].name;
|
|
599
|
-
m(k);
|
|
600
|
-
} else m(u);
|
|
601
|
-
};
|
|
602
|
-
Y(() => {
|
|
603
|
-
v && s !== null && (N.current !== s ? T(s) : N.current = null);
|
|
604
|
-
}, [s, v, T]);
|
|
605
|
-
const q = Se(() => {
|
|
606
|
-
var Z, O;
|
|
607
|
-
if (h.current) return;
|
|
608
|
-
const u = (Z = p.current) == null ? void 0 : Z.closest(".ul-card__container");
|
|
609
|
-
if (!u) return;
|
|
610
|
-
const x = (O = p.current) == null ? void 0 : O.querySelectorAll(".ul-card-scroll-wrapper");
|
|
611
|
-
if (!x || x.length === 0) return;
|
|
612
|
-
const k = u.getBoundingClientRect(), D = k.top + k.height / 2;
|
|
613
|
-
let g = 0, C = 1 / 0;
|
|
614
|
-
x.forEach((z, J) => {
|
|
615
|
-
const G = z.getBoundingClientRect(), ie = G.top + G.height / 2, ee = Math.abs(D - ie);
|
|
616
|
-
ee < C && (C = ee, g = J);
|
|
617
|
-
});
|
|
618
|
-
const P = n[g];
|
|
619
|
-
N.current = P.name, m(P.name);
|
|
620
|
-
}, [n, m]);
|
|
621
|
-
Y(() => {
|
|
622
|
-
var x;
|
|
623
|
-
if (!v) return;
|
|
624
|
-
const u = ((x = p.current) == null ? void 0 : x.closest(".ul-card__container")) || null;
|
|
625
|
-
return u && u.addEventListener("scroll", q, { passive: !0 }), () => {
|
|
626
|
-
u && u.removeEventListener("scroll", q);
|
|
627
|
-
};
|
|
628
|
-
}, [q, v]);
|
|
629
|
-
const L = ge(() => Object.values(o).every((u, x) => {
|
|
630
|
-
var D;
|
|
631
|
-
const k = n[x];
|
|
632
|
-
return !(!(k != null && k.props) || !("properties" in k.props) || ((D = k.props.properties) == null ? void 0 : D.required) !== !1) || u;
|
|
633
|
-
}), [o, n]), E = async (u, x, k) => {
|
|
634
|
-
return b((g) => ({ ...g, [u]: k })), await (D = (g) => ({ ...g, [u]: x }), new Promise((g) => {
|
|
635
|
-
r((C) => {
|
|
636
|
-
const P = D(C);
|
|
637
|
-
return g(P), P;
|
|
638
|
-
});
|
|
639
|
-
}));
|
|
640
|
-
var D;
|
|
641
|
-
};
|
|
642
|
-
Y(() => {
|
|
643
|
-
if (!v) return;
|
|
644
|
-
const u = {};
|
|
645
|
-
n.forEach((x) => {
|
|
646
|
-
var D, g;
|
|
647
|
-
const k = x;
|
|
648
|
-
(g = (D = k.props) == null ? void 0 : D.properties) != null && g.required || (u[k.name] = { value: null, questionId: k.name, type: k.type });
|
|
649
|
-
}), r(u), b({});
|
|
650
|
-
}, [n, v]);
|
|
651
|
-
const F = async (u, x) => {
|
|
652
|
-
if (v) {
|
|
653
|
-
const k = await E(u.questionId, u, x), D = c(u.type), g = y(u.type);
|
|
654
|
-
if (D && _(u.questionId), g && x) {
|
|
655
|
-
const C = w(n, k);
|
|
656
|
-
i(C);
|
|
657
|
-
}
|
|
658
|
-
} else {
|
|
659
|
-
const k = d.find((g) => g.name === u.questionId), D = { ...u, questionText: k ? Re(k) : void 0 };
|
|
660
|
-
i([D]);
|
|
661
|
-
}
|
|
662
|
-
}, c = (u) => (/* @__PURE__ */ new Set(["nps", "likert", "multiplechoice"])).has(u), y = (u) => (/* @__PURE__ */ new Set(["videovoice", "consentlegal", "texturlprompt", "maxdiff"])).has(u), R = ((Q = n[0]) == null ? void 0 : Q.type) === "thanks";
|
|
663
|
-
return v ? e("div", { className: "ul-card-list-container--longform", "data-testid": "ui-container", ref: p, children: [e(Ut, { value: l, children: d.map((u, x) => e(Ee, { cardInstance: u, moveToNextQuestion: _, showIndividualSubmit: v && n.length > 1 && x < n.length - 1, submitQuestion: F, updateCardValues: E }, (u == null ? void 0 : u.name) || x)) }), !R && e(Gt, { isSubmitDisabled: Object.keys(t).length < n.length || !L, onSubmit: function() {
|
|
664
|
-
const u = w(n, t);
|
|
665
|
-
i(u);
|
|
666
|
-
} })] }) : e(be, { children: [e("div", { "data-testid": "ui-container", style: { display: "none" } }), d.map((u, x) => e(Ee, { cardInstance: u, moveToNextQuestion: _, showIndividualSubmit: v && n.length > 1 && x < n.length - 1, submitQuestion: F, updateCardValues: E }, (u == null ? void 0 : u.name) || x))] });
|
|
667
|
-
};
|
|
668
|
-
export {
|
|
669
|
-
Xt as PageCard
|
|
670
|
-
};
|