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