@sprig-technologies/sprig-browser 2.39.0 → 2.39.3
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-DHBMIjKf.js +4 -0
- package/dist/conversational-styles-DLzzNPKy.cjs +1 -0
- package/dist/conversational-ui-BBEwlRyA.js +586 -0
- package/dist/conversational-ui-p-aTqz70.cjs +1 -0
- package/dist/{core-_Z8BkMvO.cjs → core-D7GY8Q1p.cjs} +3 -3
- package/dist/{core-BFvjNMlE.js → core-fXpU4mUJ.js} +252 -253
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +2 -2
- package/dist/{getAttributedUrl-B6IiqzoK.js → getAttributedUrl-CKXj5eVU.js} +3 -3
- package/dist/{getAttributedUrl-CsC-pdfo.cjs → getAttributedUrl-Wrb2IVbi.cjs} +1 -1
- package/dist/index-2SxBb1Na.cjs +1 -0
- package/dist/index-C4JVn6IQ.js +678 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-Bm14xa4G.js → metricsReporter-1Oozsgva.js} +1 -1
- package/dist/{metricsReporter-BtpOP9Ry.cjs → metricsReporter-CXdAqZlB.cjs} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/{view-DA2mrBDJ.js → view-BTPuuKmm.js} +46 -43
- package/dist/view-DrHm3QYY.cjs +1 -0
- package/package.json +1 -1
- package/dist/conversational-styles-DkkPEdxY.cjs +0 -1
- package/dist/conversational-styles-FqFq9n7G.js +0 -4
- package/dist/conversational-ui-CJhN0LJK.js +0 -615
- package/dist/conversational-ui-Dfd7UJ-H.cjs +0 -1
- package/dist/index-DA4zJIRr.cjs +0 -1
- package/dist/index-DW3YeTpg.js +0 -678
- package/dist/view-DSmDY1mu.cjs +0 -1
|
@@ -1,615 +0,0 @@
|
|
|
1
|
-
import { a as R, u as e, h as U, c as D, g as G, e as ee, f as we, p as W, F as be, d as te, _ as Z, T as pe, A as Xe, i as Je, j as et, k as tt, w as Ee } from "./view-DA2mrBDJ.js";
|
|
2
|
-
import { v as rt, R as j, B as J, M as K, O as ye, Q as re, a as ne, b as ve, S as nt, L as $e, u as st, H as De, g as at, P as it, p as ot, c as lt, s as ct } from "./getAttributedUrl-B6IiqzoK.js";
|
|
3
|
-
import { a as Te, D as qe, A as Pe, b as dt } from "./core-BFvjNMlE.js";
|
|
4
|
-
import { t as fe } from "./metricsReporter-Bm14xa4G.js";
|
|
5
|
-
const ut = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
|
|
6
|
-
const n = `ul-card-video__question_player-q${r}`, { apiURL: a, viewDocument: o } = R((l) => ({ apiURL: l.apiURL, viewDocument: l.viewDocument }));
|
|
7
|
-
return e("div", { id: n, ref: (l) => {
|
|
8
|
-
if (l && l.children.length === 0 && !t.properties.hideRecordedPrompt) {
|
|
9
|
-
const m = rt(n, { src: s, type: "application/x-mpegURL" }, void 0, t.properties.mediaType === j.MEDIA_TYPE_AUDIO, a, o);
|
|
10
|
-
l.appendChild(m);
|
|
11
|
-
}
|
|
12
|
-
} });
|
|
13
|
-
}, oe = ({ isDisabled: t, onClick: s, children: r }) => e(J, { className: "ul-card__button-checkmark", disabled: t, onClick: s, type: "button", children: [e("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#ffffff", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), r || "Ok"] }), pt = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
|
|
14
|
-
const { useMobileStyling: o, border: l } = R((_) => ({ useMobileStyling: _.useMobileStyling, border: _.border })), [m, d] = U(!1), [u, g] = U(""), [i, h] = U(!1), y = r == null ? void 0 : r.collectName, p = (r == null ? void 0 : r.nameLabelText) || "Full Name", c = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", x = (r == null ? void 0 : r.submitButtonText) || "Submit", S = !!u.trim(), v = m && (!y || S), C = (_, w = !1) => {
|
|
15
|
-
_.preventDefault(), _.stopPropagation();
|
|
16
|
-
let f = null;
|
|
17
|
-
if (!w) {
|
|
18
|
-
if (!v) return void h(!0);
|
|
19
|
-
f = { submitted: !0 }, y && (f.name = u);
|
|
20
|
-
}
|
|
21
|
-
s({ value: f, questionId: n, type: a }, !!w || v);
|
|
22
|
-
}, T = (_) => {
|
|
23
|
-
_.preventDefault(), _.stopPropagation(), g(_.currentTarget.value);
|
|
24
|
-
}, k = (_) => {
|
|
25
|
-
_.currentTarget.style.borderColor = i && !S ? Te : l;
|
|
26
|
-
}, P = (_) => {
|
|
27
|
-
_.currentTarget.style.borderColor = i && !S ? Te : qe;
|
|
28
|
-
}, I = () => e(re, { children: [e("div", { className: "sprig-stretch", children: [e(ye, { allowTextEntry: !1, border: l, error: i && !m, id: "consent", isRadio: !1, isSelected: m, label: c, onUserInputChanged: ({ selected: _ }) => {
|
|
29
|
-
_ !== m && d(!m);
|
|
30
|
-
}, useMobileStyling: o }), y && e("input", { "aria-label": p, "aria-placeholder": p, className: D(G("ul-consent-legal__name-input", o)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: P, onFocus: k, onInput: T, placeholder: p, style: i && !S ? { borderColor: Te } : {}, tabIndex: 0, value: u })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(oe, { isDisabled: !v, onClick: (_) => C(new SubmitEvent(_.type)), children: ee({ buttonText: x }) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (_) => C(new SubmitEvent(_.type), !0), children: we(r) })] })] });
|
|
31
|
-
return e("div", { className: D(t, "ul-card__consent-legal", "fade-in-transition"), children: e(K, { properties: r, defaultBody: I, embeddedType: "pdf" }) }, n);
|
|
32
|
-
}, mt = () => {
|
|
33
|
-
const { destroy: t, forceBrandedLogo: s } = R((r) => ({ destroy: r.destroy, forceBrandedLogo: r.forceBrandedLogo }));
|
|
34
|
-
return W(() => {
|
|
35
|
-
setTimeout(() => {
|
|
36
|
-
t(Pe);
|
|
37
|
-
}, s ? 4e3 : 2e3);
|
|
38
|
-
}, [t, s]), e("div", { className: "end-of-survey-text", children: "End of survey" });
|
|
39
|
-
}, ht = ({ icon: t, scaleLabelType: s, value: r, selectedValue: n }) => {
|
|
40
|
-
if (s === "smiley" && r === n) {
|
|
41
|
-
let a = 0;
|
|
42
|
-
return t.replace(/black/g, () => ++a == 1 ? "black" : "white");
|
|
43
|
-
}
|
|
44
|
-
return t;
|
|
45
|
-
}, vt = ({ activeValue: t, border: s, icon: r, isPressed: n, range: a, scaleLabelType: o, selectedValue: l, setSelectedValue: m, setActiveValue: d, setIsPressed: u, useMobileStyling: g, value: i, viewDocument: h }) => {
|
|
46
|
-
const y = `option-${i}`, p = o === "number", c = o === "star", x = o === "smiley", S = p && i === t || i === l, [v, C] = (() => {
|
|
47
|
-
const k = c && l !== null && i <= l;
|
|
48
|
-
return c && i <= t || x && i === t || k || i === t || i === l ? [s, n || k || i === l ? 1 : 0.3] : ["", 1];
|
|
49
|
-
})(), T = be(() => {
|
|
50
|
-
const k = { borderColor: S ? v : "", fillOpacity: S ? "" : C, zIndex: S ? 3 : "auto", color: l === i ? "#fff" : "" };
|
|
51
|
-
return p ? { ...k, backgroundColor: l === i ? v : "" } : { ...k, color: c || x || l === i ? v : "" };
|
|
52
|
-
}, [S, v, C, l, i, p, c, x]);
|
|
53
|
-
return e("button", { "aria-label": p ? void 0 : String(i), className: (() => {
|
|
54
|
-
switch (o) {
|
|
55
|
-
case "star":
|
|
56
|
-
return D(G("likert-star", g), G(`likert-star-${i}`, g));
|
|
57
|
-
case "smiley":
|
|
58
|
-
return D(G("likert-smiley", g), G(`likert-smiley-${i}`, g));
|
|
59
|
-
default:
|
|
60
|
-
return i === a ? D(G("likert-number", g), G(`likert-number-${i}`, g), G("likert-last-option", g)) : D(G("likert-number", g), G(`likert-number-${i}`, g));
|
|
61
|
-
}
|
|
62
|
-
})(), dangerouslySetInnerHTML: { __html: ht({ icon: r, scaleLabelType: o, value: i, selectedValue: l }) }, id: y, onClick: (k) => {
|
|
63
|
-
k.preventDefault(), k.stopPropagation(), m(i);
|
|
64
|
-
}, onKeyDown: (k) => {
|
|
65
|
-
var _, w;
|
|
66
|
-
const P = h.querySelectorAll(`.likert-${o ?? "number"}`), I = i - 1;
|
|
67
|
-
k.key === "ArrowRight" ? (_ = P[I + 1]) == null || _.focus() : k.key === "ArrowLeft" ? (w = P[I - 1]) == null || w.focus() : k.key !== "Enter" && k.key !== " " || (k.preventDefault(), k.stopPropagation(), m(i));
|
|
68
|
-
}, onPointerDown: () => u(!0), onPointerEnter: () => d(i), onPointerLeave: () => {
|
|
69
|
-
d(-1), u(!1);
|
|
70
|
-
}, style: T, tabIndex: 0 });
|
|
71
|
-
}, gt = ({ className: t, labels: s, next: r, properties: n, questionId: a, type: o }) => {
|
|
72
|
-
const { border: l, useMobileStyling: m, viewDocument: d } = R((_) => ({ border: _.border, useMobileStyling: _.useMobileStyling, viewDocument: _.viewDocument })), [u, g] = U(-1), [i, h] = U(!1), [y, p] = U(null), c = s && s.left, x = s && s.right;
|
|
73
|
-
let S;
|
|
74
|
-
const { range: v, scaleLabelType: C, ratingIcons: T } = n;
|
|
75
|
-
v && (S = Number(v));
|
|
76
|
-
const k = S || 5, P = (_) => {
|
|
77
|
-
var w, f;
|
|
78
|
-
switch (C) {
|
|
79
|
-
case "star":
|
|
80
|
-
return (w = T[0]) == null ? void 0 : w.svg;
|
|
81
|
-
case "smiley":
|
|
82
|
-
return (f = T[_]) == null ? void 0 : f.svg;
|
|
83
|
-
default:
|
|
84
|
-
return String(_ + 1);
|
|
85
|
-
}
|
|
86
|
-
}, I = [...Array(k)].map((_, w) => {
|
|
87
|
-
const f = w + 1;
|
|
88
|
-
return e(vt, { activeValue: u, border: l, icon: P(w), isPressed: i, range: k, scaleLabelType: C, selectedValue: y, setActiveValue: g, setIsPressed: h, setSelectedValue: p, useMobileStyling: m, value: f, viewDocument: d }, w);
|
|
89
|
-
});
|
|
90
|
-
return e("form", { className: D(t, "ul-card--likert", "fade-in-transition"), children: e(K, { properties: n, defaultBody: () => e(te, { children: [e(ne, { children: [e("div", { "aria-label": `Rating (1 - ${k})`, className: "ul-card--likert__numbers", role: "radiogroup", children: I }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: c }), e("span", { children: x })] })] }), e(re, { children: e(oe, { isDisabled: y === null && n.required, onClick: () => r({ value: y, questionId: a, type: o }, !0), children: ee(n) }) })] }) }) }, a);
|
|
91
|
-
}, bt = ({ columns: t, onSelect: s, options: r, selectedOptions: n }) => {
|
|
92
|
-
const a = Z([]), { border: o, useMobileStyling: l } = R((h) => ({ border: h.border, useMobileStyling: h.useMobileStyling })), m = r.findIndex((h) => n[h.id] === null), [d, u] = U(m), g = pe((h, y) => {
|
|
93
|
-
s(h, y);
|
|
94
|
-
const p = d + 1, c = r[p];
|
|
95
|
-
c && n[c.id] === null && u(p);
|
|
96
|
-
}, [s, r, n, d]), i = pe((h, y) => {
|
|
97
|
-
const p = d === h;
|
|
98
|
-
return e(Xe, { animate: !0, header: y.label, isOpen: p, onClick: () => u(p && !window.UserLeap.isMobileSDK ? -1 : h), ref: (c) => {
|
|
99
|
-
c && (a.current[h] = c);
|
|
100
|
-
}, showHeaderCheck: n[y.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: t.map((c) => e(ye, { allowTextEntry: !1, ariaLabel: `${y.label}-${c.label}`, border: o, error: !1, id: `${y.id}-${c.value}`, isRadio: !0, isSelected: n[y.id] === c.value, label: c.label, onUserInputChanged: () => g(y.id, c.value), useMobileStyling: l }, c.label)) }) }, y.id);
|
|
101
|
-
}, [o, t, d, g, n, l]);
|
|
102
|
-
return e("div", { children: r.map((h, y) => i(y, h)) });
|
|
103
|
-
}, yt = ({ columns: t, onSelect: s, options: r, selectedOptions: n }) => {
|
|
104
|
-
const { border: a, useMobileStyling: o, isLongFormSurvey: l } = R((p) => ({ border: p.border, useMobileStyling: p.useMobileStyling, isLongFormSurvey: fe(p.studyType) })), m = r.length, d = t.length, u = Z(null), [g, i] = U(!1), [h, y] = U(!1);
|
|
105
|
-
return W(() => {
|
|
106
|
-
const p = u.current, c = new ResizeObserver((x) => {
|
|
107
|
-
window.requestAnimationFrame(() => {
|
|
108
|
-
p && (i(Math.round(x[0].contentRect.width) < p.scrollWidth), y(Math.round(x[0].contentRect.width) < p.scrollWidth));
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
return p && c.observe(p), () => {
|
|
112
|
-
p && c.unobserve(p);
|
|
113
|
-
};
|
|
114
|
-
}, []), e("div", { className: "ul-card--matrix_question_container", children: [e("div", { className: D("ul-card--matrix_container", g && "ul-matrix-scroll-gradient"), onScroll: () => {
|
|
115
|
-
(() => {
|
|
116
|
-
const p = u.current;
|
|
117
|
-
p && i(p.clientWidth + Math.abs(p.scrollLeft) < p.scrollWidth);
|
|
118
|
-
})();
|
|
119
|
-
}, ref: u, children: e("div", { className: D(l && "ul-card--matrix_grid_longform", "ul-card--matrix_grid"), style: `--numColumns: ${d}; --numRows: ${m + 1};`, children: [e("div", {}), " ", t.map((p) => e("div", { className: "ul-matrix-column-label", children: p.label }, p.label)), r.map((p) => e(te, { 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: t.map((c, x) => e("div", { className: D("ul-matrix-option-wrapper", x === d - 1 && "ul-matrix-last-option"), children: e(ye, { allowTextEntry: !1, ariaLabel: `${p.label}-${c.label}`, border: a, choiceStyle: { background: "transparent", border: "none", marginBottom: "0", padding: "0" }, error: !1, id: `${p.id}-${c.value}`, isRadio: !0, isSelected: n[p.id] === c.value, onUserInputChanged: () => s(p.id, c.value), useMobileStyling: o }) }, c.value)) })] }))] }) }), (g || h) && e("button", { className: h && !g ? "ul-matrix-scroll-arrow left" : "ul-matrix-scroll-arrow", onClick: h && !g ? (p) => {
|
|
120
|
-
p.preventDefault();
|
|
121
|
-
const c = u.current;
|
|
122
|
-
if (c) {
|
|
123
|
-
const x = getComputedStyle(c).direction === "rtl";
|
|
124
|
-
c.scrollTo({ left: x ? c.scrollWidth - c.clientWidth : 0, behavior: "smooth" });
|
|
125
|
-
}
|
|
126
|
-
} : (p) => {
|
|
127
|
-
p.preventDefault();
|
|
128
|
-
const c = u.current;
|
|
129
|
-
if (c) {
|
|
130
|
-
const x = getComputedStyle(c).direction === "rtl";
|
|
131
|
-
c.scrollTo({ left: x ? c.clientWidth - c.scrollWidth : c.scrollWidth, behavior: "smooth" });
|
|
132
|
-
}
|
|
133
|
-
}, children: e(h && !g ? ft : xt, {}) })] });
|
|
134
|
-
}, ft = () => 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" }) }), xt = () => 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" }) }), kt = ({ className: t, next: s, options: r, properties: n, questionId: a, type: o, onSubmitButtonClick: l }) => {
|
|
135
|
-
const { useMobileStyling: m, isLongFormSurvey: d } = R((S) => ({ useMobileStyling: S.useMobileStyling, isLongFormSurvey: fe(S.studyType) })), u = n.matrixColumn, g = n.required, i = (S) => {
|
|
136
|
-
S.preventDefault(), S.stopPropagation(), s({ value: y, questionId: a, type: o }, !0), l && l();
|
|
137
|
-
}, h = r.reduce((S, v) => (S[v.id] = null, S), {}), [y, p] = U(h), c = (S, v) => {
|
|
138
|
-
p((C) => ({ ...C, [S]: v }));
|
|
139
|
-
}, x = n.displayMatrixAsAccordion || m;
|
|
140
|
-
return e("form", { className: D(t, !d && "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: i, children: e(K, { properties: n, defaultBody: () => {
|
|
141
|
-
return e(te, { children: [e(ne, { children: e(x ? bt : yt, { columns: u, onSelect: c, options: r, selectedOptions: y }) }), e(re, { children: e(oe, { isDisabled: (S = y, g && Object.values(S).every((v) => v == null)), onClick: () => i(new SubmitEvent("submit")), children: ee(n) }) })] });
|
|
142
|
-
var S;
|
|
143
|
-
} }) }, a);
|
|
144
|
-
}, Oe = ({ className: t, onSubmit: s, options: r = [], properties: n, questionId: a, type: o, showIndividualSubmit: l = !1, onSubmitButtonClick: m }) => {
|
|
145
|
-
const { border: d, useMobileStyling: u } = R((b) => ({ border: b.border, useMobileStyling: b.useMobileStyling })), g = r.reduce((b, q) => (b[q.id] = { isSelected: !1 }, b), {}), [i, h] = U(g), y = o === "multiplechoice", p = n.required, c = r.find((b) => {
|
|
146
|
-
var q;
|
|
147
|
-
return (q = b.optionProperties) == null ? void 0 : q.noneOfTheAbove;
|
|
148
|
-
}), x = (b) => Object.entries(b).some(([q, B]) => {
|
|
149
|
-
var Q;
|
|
150
|
-
const O = r.find((z) => `${z.id}` === q), E = B.userText === void 0 || B.userText.trim() === "";
|
|
151
|
-
return ((Q = O == null ? void 0 : O.optionProperties) == null ? void 0 : Q.allowsTextEntry) && E && B.isSelected;
|
|
152
|
-
}), S = (b) => Object.values(b).filter((q) => q.isSelected).length, v = n.minSelect && n.minSelect > 0 && n.maxSelectMode === ve.Range && S(i) < n.minSelect && (p || S(i) > 0), C = (b) => x(b) || p && !S(b) || !((q) => {
|
|
153
|
-
const { minSelect: B = 0, maxSelect: O = 1 / 0, maxSelectMode: E } = n, Q = S(q);
|
|
154
|
-
switch (E) {
|
|
155
|
-
case ve.Maximum:
|
|
156
|
-
return Q <= O;
|
|
157
|
-
case ve.Range:
|
|
158
|
-
return Q === 0 || Q >= B;
|
|
159
|
-
default:
|
|
160
|
-
return !0;
|
|
161
|
-
}
|
|
162
|
-
})(b), T = Object.entries(i).some(([b, q]) => {
|
|
163
|
-
var B, O;
|
|
164
|
-
return q.isSelected && ((O = (B = r.find((E) => `${E.id}` === b)) == null ? void 0 : B.optionProperties) == null ? void 0 : O.allowsTextEntry);
|
|
165
|
-
}), k = l && (!y || T), P = (b) => {
|
|
166
|
-
f(b.id, b.selected, b.userText, b.noneOfTheAbove);
|
|
167
|
-
}, I = (b) => {
|
|
168
|
-
var q;
|
|
169
|
-
return (n == null ? void 0 : n.maxSelectMode) !== ve.Unlimited && S(i) === (n == null ? void 0 : n.maxSelect) && !((q = i[b]) != null && q.isSelected);
|
|
170
|
-
}, _ = r.map(({ id: b, label: q, value: B, optionProperties: O }) => {
|
|
171
|
-
var le, se;
|
|
172
|
-
const E = `${b}`, { allowsTextEntry: Q, noneOfTheAbove: z } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...O };
|
|
173
|
-
return e(ye, { allowTextEntry: Q, border: d, disabled: I(E), error: (V = i, x(V)), id: E, isRadio: y, isSelected: !!((le = i[E]) != null && le.isSelected), label: q, noneOfTheAbove: z, onUserInputChanged: P, promptText: "Please specify", text: (se = i[b]) == null ? void 0 : se.userText, useMobileStyling: u, value: B }, E);
|
|
174
|
-
var V;
|
|
175
|
-
}), w = () => {
|
|
176
|
-
s(i, !0), m && m();
|
|
177
|
-
}, f = (b, q, B, O) => {
|
|
178
|
-
const E = Object.assign({}, i);
|
|
179
|
-
if ((y || O) && q) for (const Q of Object.values(E)) Q.isSelected = !1, delete Q.userText;
|
|
180
|
-
else c && !O && i[c.id].isSelected && (E[c.id].isSelected = !1);
|
|
181
|
-
E[b] = { isSelected: q, userText: B }, h(E);
|
|
182
|
-
};
|
|
183
|
-
return e("form", { className: D(t, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: w, children: e(K, { properties: n, defaultBody: () => e(te, { children: [e(ne, { children: [n.isDropdown ? e(nt, { disabledOptions: r.filter((b) => I(b.id)), dropdownFooter: v ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [S(i), "/", n.minSelect] }) : void 0, isMultiSelect: !y, multiselectText: n.dropdownMultiselectedText ?? "choices selected", onChange: (b) => {
|
|
184
|
-
const q = { ...i };
|
|
185
|
-
for (const B of r) b.includes(B) ? q[B.id].isSelected = !0 : q[B.id].isSelected = !1;
|
|
186
|
-
h(q);
|
|
187
|
-
}, options: r, placeholderText: n.dropdownPlaceholderText ?? (y ? "Select choice" : "Select choice(s)"), value: r.filter((b) => i[b.id].isSelected) }) : e("div", { className: D(G("ul-card__choices", u)), role: y ? "radiogroup" : "group", children: [_, !!v && e("div", { className: "ul-card__min-select-counter", children: [S(i), "/", n.minSelect] })] }), k && e($e, { handleSubmit: w, isSubmitDisabled: C(i) })] }), e(re, { children: e("div", { className: "ul-card__button-wrapper", children: e(oe, { isDisabled: C(i), onClick: w, children: ee(n) }) }) })] }) }) }, a);
|
|
188
|
-
}, St = (t) => {
|
|
189
|
-
const { questionId: s, type: r, next: n, options: a } = t;
|
|
190
|
-
return e(Oe, { ...t, onSubmit: (o, l) => {
|
|
191
|
-
const m = Object.entries(o).find(([, h]) => h.isSelected) || [void 0, void 0], [d, u] = m, g = a.find((h) => `${h.id}` === d), i = u != null && u.userText ? { [d]: { userText: u.userText } } : null;
|
|
192
|
-
n({ value: g && d ? { [d]: g.value } : {}, secondaryValue: i, questionId: s, type: r }, l);
|
|
193
|
-
} });
|
|
194
|
-
}, Ct = (t) => {
|
|
195
|
-
const { questionId: s, type: r, next: n } = t;
|
|
196
|
-
return e(Oe, { ...t, onSubmit: (a, o) => {
|
|
197
|
-
const l = Object.entries(a).reduce((d, [u, g]) => (d[u] = g.isSelected, d), {}), m = Object.entries(a).reduce((d, [u, g]) => {
|
|
198
|
-
if (!g.userText) return d;
|
|
199
|
-
const i = d || {};
|
|
200
|
-
return i[u] = { userText: g.userText }, i;
|
|
201
|
-
}, null);
|
|
202
|
-
n({ value: l, secondaryValue: m, questionId: s, type: r }, o);
|
|
203
|
-
} });
|
|
204
|
-
}, Tt = ({ className: t, labels: s, properties: r, next: n, questionId: a, type: o }) => {
|
|
205
|
-
const [l, m] = U(null), { border: d, useMobileStyling: u, viewDocument: g } = R((p) => ({ border: p.border, useMobileStyling: p.useMobileStyling, viewDocument: p.viewDocument })), i = s && s.left, h = s && s.right, y = [...Array(11)].map((p, c) => e("button", { className: D(G("nps-number", u), G(`nps-number-${c}`, u)), id: `option-${c}`, onClick: (x) => {
|
|
206
|
-
x.preventDefault(), x.stopPropagation(), m(c);
|
|
207
|
-
}, onKeyDown: (x) => {
|
|
208
|
-
var v, C;
|
|
209
|
-
const S = g.querySelectorAll("button.nps-number");
|
|
210
|
-
x.key === "ArrowRight" ? (v = S[c + 1]) == null || v.focus() : x.key === "ArrowLeft" ? (C = S[c - 1]) == null || C.focus() : x.key !== "Enter" && x.key !== " " || (x.preventDefault(), x.stopPropagation(), m(c));
|
|
211
|
-
}, onPointerDown: (x) => {
|
|
212
|
-
x.currentTarget.style.zIndex = "2", x.currentTarget.style.borderColor = d;
|
|
213
|
-
}, onPointerLeave: (x) => {
|
|
214
|
-
x.currentTarget.style.zIndex = "auto", x.currentTarget.style.borderColor = qe;
|
|
215
|
-
}, style: l === c ? { backgroundColor: d, color: "#fff" } : void 0, tabIndex: 0, children: c }, c));
|
|
216
|
-
return e("form", { className: D(t, "ul-card--nps", "fade-in-transition"), children: e(K, { properties: r, defaultBody: () => e(te, { children: [e(ne, { children: [e("div", { className: "ul-card--nps__numbers", children: y }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: i }), e("span", { children: h })] })] }), e(re, { children: e(oe, { isDisabled: l === null && r.required, onClick: () => n({ value: l, questionId: a, type: o }, !0), children: ee(r) }) })] }) }) }, a);
|
|
217
|
-
}, _t = ({ className: t, next: s, properties: r, questionId: n, type: a, onSubmitButtonClick: o }) => {
|
|
218
|
-
const { border: l, useMobileStyling: m, update: d } = R((T) => ({ border: T.border, useMobileStyling: T.useMobileStyling, update: T.update })), [u, g] = U(""), i = Z(null), h = u.trim(), y = r.required === !0 && !h, p = st(i, () => d()), c = (T) => {
|
|
219
|
-
const { value: k } = T.currentTarget;
|
|
220
|
-
p(), T.preventDefault(), T.stopPropagation(), g(k);
|
|
221
|
-
}, x = (T) => {
|
|
222
|
-
T.preventDefault(), T.stopPropagation();
|
|
223
|
-
const k = r.required !== !0 || h.length > 0;
|
|
224
|
-
s({ value: u, questionId: n, type: a }, k), o && o();
|
|
225
|
-
}, S = r && r.openTextPlaceholder ? r.openTextPlaceholder : "", v = (T) => {
|
|
226
|
-
T.currentTarget.style.borderColor = l;
|
|
227
|
-
}, C = (T) => {
|
|
228
|
-
T.currentTarget.style.borderColor = qe;
|
|
229
|
-
};
|
|
230
|
-
return e("form", { className: D(t, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(K, { defaultBody: () => e("div", { className: "ul-card-text", children: [e(ne, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": S, className: D(G("ul-card-text__input", m)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: C, onChange: c, onFocus: v, placeholder: S, ref: i, role: "textbox", tabIndex: 0 }) }), r.footerHtml && e("div", { className: "footer", dangerouslySetInnerHTML: { __html: r.footerHtml } })] }), e(re, { children: e(oe, { isDisabled: y, onClick: x, children: ee(r) }) })] }), properties: r }) }, n);
|
|
231
|
-
}, Nt = ({ className: t, labels: s, next: r, properties: n, questionId: a, type: o, onSubmitButtonClick: l, options: m, showIndividualSubmit: d = !1 }) => {
|
|
232
|
-
const u = Z(null), g = Z(0), i = Z(0), h = Z(null), y = Z(!1), p = Z([]), [c, x] = U(() => (n == null ? void 0 : n.required) === !0), [S, v] = U(() => m.map((N) => ({ ...N, rank: null }))), C = be(() => Array.from({ length: m.length }, (N, M) => M + 1), [m.length]), { useMobileStyling: T, isPreview: k, headers: P } = R((N) => ({ useMobileStyling: N.useMobileStyling, isPreview: N.isPreview, headers: N.headers })), I = T && !k, _ = dt(P) && I, w = (N) => {
|
|
233
|
-
N.preventDefault(), Q(S), l && l();
|
|
234
|
-
}, f = (N, M) => {
|
|
235
|
-
for (let A = 0; A < p.current.length; A++) {
|
|
236
|
-
const L = p.current[A];
|
|
237
|
-
if (!L || L === h.current) continue;
|
|
238
|
-
const F = L.getBoundingClientRect();
|
|
239
|
-
if (N >= F.left && N <= F.right && M >= F.top && M <= F.bottom) return { element: L, index: A };
|
|
240
|
-
}
|
|
241
|
-
return null;
|
|
242
|
-
}, b = (N) => (M) => {
|
|
243
|
-
if (!I) return;
|
|
244
|
-
M.preventDefault(), M.stopPropagation(), y.current = !0, u.current = N;
|
|
245
|
-
const A = M.touches[0];
|
|
246
|
-
g.current = A.clientY, i.current = A.clientY;
|
|
247
|
-
const L = M.currentTarget.closest(".ul-card-rank__option");
|
|
248
|
-
L && (h.current = L, L.classList.add("is-dragging"));
|
|
249
|
-
}, q = (N) => {
|
|
250
|
-
if (!I || !y.current || u.current === null) return;
|
|
251
|
-
N.preventDefault(), N.stopPropagation();
|
|
252
|
-
const M = N.touches[0];
|
|
253
|
-
i.current = M.clientY;
|
|
254
|
-
const A = i.current - g.current;
|
|
255
|
-
h.current && (h.current.style.transform = `translateY(${A}px)`, h.current.style.zIndex = "1000"), p.current.forEach((F) => {
|
|
256
|
-
F && F !== h.current && F.classList.remove("is-drop-target");
|
|
257
|
-
});
|
|
258
|
-
const L = f(M.clientX, M.clientY);
|
|
259
|
-
L && L.element.classList.add("is-drop-target");
|
|
260
|
-
}, B = (N) => {
|
|
261
|
-
if (!I || !y.current || u.current === null) return;
|
|
262
|
-
N.preventDefault(), N.stopPropagation();
|
|
263
|
-
const M = N.changedTouches[0], A = f(M.clientX, M.clientY);
|
|
264
|
-
h.current && (h.current.style.transform = "", h.current.style.zIndex = "", h.current.classList.remove("is-dragging")), p.current.forEach((L) => {
|
|
265
|
-
L && L.classList.remove("is-drop-target");
|
|
266
|
-
}), A && A.index !== u.current && O(u.current, A.index), u.current = null, h.current = null, y.current = !1;
|
|
267
|
-
}, O = (N, M) => {
|
|
268
|
-
v((A) => {
|
|
269
|
-
const L = A.map((ae) => ({ ...ae })), [F] = L.splice(N, 1);
|
|
270
|
-
return L.splice(M, 0, F), L.forEach((ae, H) => {
|
|
271
|
-
ae.rank = H + 1;
|
|
272
|
-
}), z(), L;
|
|
273
|
-
});
|
|
274
|
-
}, E = (N) => {
|
|
275
|
-
N.preventDefault(), N.dataTransfer && (N.dataTransfer.dropEffect = "move");
|
|
276
|
-
}, Q = (N) => {
|
|
277
|
-
const M = {};
|
|
278
|
-
N.reduce((A, L) => (A[L.id] = L.rank, A), M), r({ value: M, questionId: a, type: o }, !0);
|
|
279
|
-
}, z = () => {
|
|
280
|
-
x(!1);
|
|
281
|
-
}, { left: V, right: le } = s, se = m.length, We = (N) => {
|
|
282
|
-
N.preventDefault(), N.currentTarget.classList.add("is-drop-target");
|
|
283
|
-
}, Ye = (N) => {
|
|
284
|
-
N.currentTarget.classList.remove("is-drop-target");
|
|
285
|
-
}, Ke = (N) => {
|
|
286
|
-
u.current = null, N.currentTarget.classList.remove("is-dragging");
|
|
287
|
-
};
|
|
288
|
-
return e("form", { className: D(t, "ul-card-rank", "fade-in-transition"), onSubmit: w, children: e(K, { properties: n, defaultBody: () => e(te, { children: [e(ne, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", V] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: E, children: S.map(({ id: N, label: M, rank: A }, L) => {
|
|
289
|
-
return e("li", { className: "ul-card-rank__option", draggable: !I, onDragEnd: I ? void 0 : Ke, onDragEnter: I ? void 0 : We, onDragLeave: I ? void 0 : Ye, onDragStart: I ? void 0 : (ae = L, (H) => {
|
|
290
|
-
u.current = ae, H.dataTransfer && (H.dataTransfer.effectAllowed = "move", H.dataTransfer.setData("text/plain", String(ae)), H.currentTarget.classList.add("is-dragging"));
|
|
291
|
-
}), onDrop: I ? void 0 : (F = L, (H) => {
|
|
292
|
-
var me, de;
|
|
293
|
-
H.preventDefault(), H.currentTarget.classList.remove("is-drop-target");
|
|
294
|
-
const ie = u.current;
|
|
295
|
-
u.current = null, (de = (me = H.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : me.querySelector(".is-dragging")) == null || de.classList.remove("is-dragging"), ie != null && ie !== F && O(ie, F);
|
|
296
|
-
}), ref: (H) => p.current[L] = H, children: [e("select", { "aria-label": `Rank for ${M}`, className: D("ul-card-rank__select", A == null && "ul-card-rank__select--placeholder"), name: `rank[${N}]`, onChange: (H) => ((ie, me) => {
|
|
297
|
-
v((de) => {
|
|
298
|
-
const ue = parseInt(me), X = de.map(($) => ({ ...$ }));
|
|
299
|
-
X.some(($) => $.rank == null) && X.forEach(($, Ce) => $.rank = Ce + 1);
|
|
300
|
-
const Se = X.findIndex(($) => $.id === ie);
|
|
301
|
-
if (Se === -1) return de;
|
|
302
|
-
const he = X[Se].rank;
|
|
303
|
-
return ue < he ? X.forEach(($) => {
|
|
304
|
-
$.id !== ie && $.rank >= ue && $.rank < he && ($.rank = $.rank + 1);
|
|
305
|
-
}) : ue > he && X.forEach(($) => {
|
|
306
|
-
$.id !== ie && $.rank > he && $.rank <= ue && ($.rank = $.rank - 1);
|
|
307
|
-
}), X[Se].rank = ue, X.sort(($, Ce) => $.rank - Ce.rank), z(), X;
|
|
308
|
-
});
|
|
309
|
-
})(N, H.currentTarget.value), value: A ?? "", children: [A == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), C.map((H) => e("option", { className: "ul-card-rank__select-option", value: H, children: H }, H))] }), e("span", { children: M }), _ && e("button", { "aria-label": `Drag ${M} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: I ? B : void 0, onTouchMove: I ? q : void 0, onTouchStart: I ? b(L) : 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" }) }) })] }, N);
|
|
310
|
-
var F, ae;
|
|
311
|
-
}) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [se, " - ", le] }) })] }), d && e($e, { handleSubmit: w, isSubmitDisabled: c })] }), e(re, { children: e("div", { className: "ul-card__button-wrapper", children: e(J, { disabled: c, children: ee(n) }) }) })] }) }) }, a);
|
|
312
|
-
}, _e = 1, He = 2, Qe = 3, ge = (t) => t.type === "av_permission", Re = (t) => t.type === "screen_permission", Fe = (t, s) => t === void 0 ? _e : t ? ((r, n) => !(ge(n) ? n.permissionDescriptors : []).includes("camera") || r.getVideoTracks().length > 0)(t, s) ? Qe : _e : He, Ue = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
|
|
313
|
-
}, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, Y = Je((t) => ({ ...Ue, reset: () => {
|
|
314
|
-
t(Ue);
|
|
315
|
-
}, updatePage: (s) => {
|
|
316
|
-
t(s);
|
|
317
|
-
} }));
|
|
318
|
-
function Ne({ currentPage: t, pages: s }) {
|
|
319
|
-
const { avStream: r, recordingMediaTypes: n, updatePage: a } = Y.getState(), { recorderEventEmitter: o } = R.getState();
|
|
320
|
-
o.emit("av.permission", { "permission.descriptors": t.permissionDescriptors, "stream.ready": (l, m) => {
|
|
321
|
-
if (r === l) return;
|
|
322
|
-
let d = t;
|
|
323
|
-
if (l && !t.permissionDescriptors.includes("camera")) {
|
|
324
|
-
const u = s.indexOf(t), g = m != null && m.active ? u + 2 : u + 1;
|
|
325
|
-
m != null && m.active && n && o.emit("begin.recording", { "recording.media.types": n, "start.recording.callback": (i) => a({ mediaRecordingUids: i }) }), d = s[g];
|
|
326
|
-
}
|
|
327
|
-
a({ currentPage: d, avStream: l });
|
|
328
|
-
} });
|
|
329
|
-
}
|
|
330
|
-
function Ie({ status: t }) {
|
|
331
|
-
const { nextQuestion: s, passthroughData: r, mediaRecordingUids: n, reset: a } = Y.getState(), { recorderEventEmitter: o, handleUploadUpdate: l, index: m } = R.getState(), d = { value: { taskStatus: t }, type: "recordedtask", questionId: (r == null ? void 0 : r.questionId) || 1 };
|
|
332
|
-
r && o.emit("finish.task", { "begin.callback": (u) => {
|
|
333
|
-
l({ mediaRecordingUid: u, isSubmitted: !0, progressPct: 0, isComplete: !1 });
|
|
334
|
-
}, "progress.callback": (u, g) => {
|
|
335
|
-
l({ mediaRecordingUid: u, progressPct: g.detail, isSubmitted: !1, isComplete: !1 });
|
|
336
|
-
}, "upload.callback": (u) => {
|
|
337
|
-
u && l({ mediaRecordingUid: u, isComplete: !0, isSubmitted: !0, progressPct: 100 });
|
|
338
|
-
}, "passthrough.data": r, "current.index": m, "task.response": d, "task.complete.callback": (u) => {
|
|
339
|
-
d.value.taskDurationMillisecond = u, n && (d.value.mediaRecordingUids = n), a(), s(d);
|
|
340
|
-
} });
|
|
341
|
-
}
|
|
342
|
-
function Le({ pages: t, setIsRequestingPermission: s }) {
|
|
343
|
-
const { recorderEventEmitter: r, eventEmitFn: n } = R.getState(), { updatePage: a, currentPage: o, recordingMediaTypes: l, screenPermissionRequested: m } = Y.getState();
|
|
344
|
-
if (!o) return;
|
|
345
|
-
const d = t.indexOf(o);
|
|
346
|
-
switch (o.type) {
|
|
347
|
-
case "av_permission": {
|
|
348
|
-
const u = m ? d + 2 : d + 1;
|
|
349
|
-
return m && l && r.emit("begin.recording", { "recording.media.types": l, "start.recording.callback": (g) => {
|
|
350
|
-
a({ mediaRecordingUids: g });
|
|
351
|
-
} }), void a({ currentPage: t[u] });
|
|
352
|
-
}
|
|
353
|
-
case "screen_permission":
|
|
354
|
-
return void r.emit("screen.permission", { "screen.permission.requested": s, "stream.ready.callback": (u, g) => {
|
|
355
|
-
const i = g ? t[d + 1] : o;
|
|
356
|
-
g && l && r.emit("begin.recording", { "recording.media.types": l, "start.recording.callback": (h) => {
|
|
357
|
-
a({ captureStream: g, mediaRecordingUids: h });
|
|
358
|
-
} }), a({ currentPage: i, screenPermissionRequested: !0, captureStream: g });
|
|
359
|
-
} });
|
|
360
|
-
case "start_task":
|
|
361
|
-
return n("recorded.task.start"), r.emit("recorded.task.start"), r.emit("start.task"), void a({ currentPage: t[d + 1], screenPermissionRequested: !0 });
|
|
362
|
-
case "complete_task":
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
const Ge = "ul-permission-graphics-container", Ve = "ul-permission-body", je = D(Ge, "ul_recorded-task-inset-spacing"), xe = D("ul-horizontal-button-container", "ul-horizontal-button-container-left"), Ze = ({ richTextBody: t }) => e("div", { className: "ul-rich-text-body", dangerouslySetInnerHTML: { __html: t }, id: "ul-task-detail-container" }), ke = ({ required: t, skipButtonText: s, bottom: r = !1 }) => t ? null : e(J, { className: D(r && "ul-skip-button-below", "ul-button-inactive"), onClick: Ie.bind(null, { status: "abandoned" }), children: s || "Skip" }), Me = (t) => {
|
|
367
|
-
const { avStream: s, captureStream: r, recordingMediaTypes: n, updatePage: a } = Y.getState(), o = (n == null ? void 0 : n.includes("audio")) || (n == null ? void 0 : n.includes("video"));
|
|
368
|
-
W(() => {
|
|
369
|
-
const l = setInterval(() => {
|
|
370
|
-
o && s && !s.active ? a({ avStream: null, currentPage: t[0] }) : r && r.active || a({ captureStream: void 0, currentPage: t[o ? 1 : 0] });
|
|
371
|
-
}, 1e3);
|
|
372
|
-
return () => clearInterval(l);
|
|
373
|
-
}, [s, r, o, t, n, a]);
|
|
374
|
-
}, It = ({ content: t, pages: s, required: r }) => {
|
|
375
|
-
const { buttonText: n, skipButtonText: a, taskDetail: o } = t;
|
|
376
|
-
return Me(s), e("div", { className: "ul-task-page", children: [o && e(Ze, { richTextBody: o }), e("div", { className: xe, children: [e(J, { onClick: Le.bind(null, { pages: s }), children: n }), e(ke, { required: r, skipButtonText: a })] })] }, "start-task");
|
|
377
|
-
}, wt = ({ content: t, pages: s, properties: r }) => {
|
|
378
|
-
const { buttonText: n, skipButtonText: a } = t;
|
|
379
|
-
Me(s);
|
|
380
|
-
const o = e(K, { properties: r, defaultBody: () => e("div", { className: xe, children: [e(J, { className: "ul-complete-task-button", onClick: Ie.bind(null, { status: "completed" }), children: n }), e(J, { className: D("ul-button-inactive"), onClick: Ie.bind(null, { status: "given.up" }), children: a })] }) });
|
|
381
|
-
return e("div", { className: "ul-task-page", children: [t.taskDetail && e(Ze, { richTextBody: t.taskDetail }), o] }, "complete-task");
|
|
382
|
-
}, Dt = ({ content: t, pages: s, required: r }) => {
|
|
383
|
-
const { buttonText: n, skipButtonText: a } = t, [o] = R((d) => [d.tabTitle]), [l, m] = U(!1);
|
|
384
|
-
return e("div", { children: [e("div", { className: je, children: [e("p", { style: { marginTop: "auto" }, children: t.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: Ve, children: o }) })] }), e("div", { className: r ? "" : xe, children: [e(J, { disabled: l, onClick: Le.bind(null, { pages: s, setIsRequestingPermission: m }), children: n }), e(ke, { required: r, skipButtonText: a })] })] });
|
|
385
|
-
}, qt = ({ content: t }) => e("div", { className: D(Ge, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), dangerouslySetInnerHTML: { __html: t.svg } }, "ul-permission-request-graphic"), Pt = ({ content: t, pages: s, required: r }) => {
|
|
386
|
-
const { permissionDeniedHeadline: n, permissionDeniedBody: a, skipButtonText: o, tryAgainButtonText: l } = t, m = ge(s[0]) ? s[0] : null;
|
|
387
|
-
return W(() => {
|
|
388
|
-
const d = setInterval(() => {
|
|
389
|
-
m !== null && Ne({ currentPage: m, pages: s });
|
|
390
|
-
}, 1e3);
|
|
391
|
-
return () => clearInterval(d);
|
|
392
|
-
}, [m, s]), m ? e("div", { children: [e("div", { className: je, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: n }), e("span", { className: Ve, children: a })] }) }), e("div", { className: xe, children: [e(J, { onClick: Ne.bind(null, { currentPage: m, pages: s }), children: l }), e(ke, { required: r, skipButtonText: o })] })] }) : null;
|
|
393
|
-
}, Lt = ({ stream: t }) => e("video", { autoPlay: !0, className: D("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (s) => {
|
|
394
|
-
s && (s.srcObject = t || null);
|
|
395
|
-
} }), Mt = ({ content: t, pages: s, required: r }) => {
|
|
396
|
-
const { skipButtonText: n } = t, { avStream: a } = Y.getState();
|
|
397
|
-
return Me(s), e("div", { children: [e(Lt, { stream: a }), e("div", { className: "ul-vertical-button-container-center", children: [e(J, { onClick: Le.bind(null, { pages: s }), children: t.buttonText }), e(ke, { bottom: !0, required: r, skipButtonText: n })] })] });
|
|
398
|
-
}, Rt = ({ properties: t }) => {
|
|
399
|
-
const { pages: s, required: r } = t, { avStream: n, currentPage: a } = Y.getState();
|
|
400
|
-
if (a === void 0) return null;
|
|
401
|
-
switch (a == null ? void 0 : a.type) {
|
|
402
|
-
case "av_permission": {
|
|
403
|
-
const o = Fe(n, a);
|
|
404
|
-
return o === _e ? e(qt, { content: a }) : e(o === He ? Pt : Mt, { content: a, pages: s, required: r });
|
|
405
|
-
}
|
|
406
|
-
case "screen_permission":
|
|
407
|
-
return e(Dt, { content: a, pages: s, required: r });
|
|
408
|
-
case "start_task":
|
|
409
|
-
return e(It, { content: a, pages: s, required: r });
|
|
410
|
-
case "complete_task":
|
|
411
|
-
return e(wt, { content: a, pages: s, properties: t });
|
|
412
|
-
default:
|
|
413
|
-
return null;
|
|
414
|
-
}
|
|
415
|
-
}, Ut = ({ className: t, properties: s, next: r, questionId: n }) => {
|
|
416
|
-
const a = R(), { surveyId: o, responseGroupUid: l, userId: m } = a, d = Y(), { screenPermissionRequested: u } = d, g = Y((c) => c.avStream);
|
|
417
|
-
let i = Y((c) => c.currentPage);
|
|
418
|
-
i || (i = function({ pages: c, userId: x, responseGroupUid: S, surveyId: v, questionId: C, next: T }) {
|
|
419
|
-
const { updatePage: k } = Y.getState(), { eventEmitFn: P, recorderEventEmitter: I } = R.getState(), _ = { questionId: C, surveyId: v, visitorId: x, responseGroupUid: S };
|
|
420
|
-
let w = 0;
|
|
421
|
-
I.emit("recorded.task.permission.screen"), P("recorded.task.permission.screen"), I.emit("permission.status", { "permission.status.callback": (b, q, B, O) => {
|
|
422
|
-
const E = c[w], { type: Q } = E, z = ["screen"];
|
|
423
|
-
if (ge(E)) {
|
|
424
|
-
const { permissionDescriptors: V } = E, le = V == null ? void 0 : V.includes("microphone"), se = V == null ? void 0 : V.includes("camera");
|
|
425
|
-
le && z.push("audio"), se && z.push("video"), (b != null && b.active && !se || b != null && b.active && q) && w++;
|
|
426
|
-
}
|
|
427
|
-
Re(c[w]) && B && (w++, I.emit("begin.recording", { "recording.media.types": z, "start.recording.callback": (V) => k({ mediaRecordingUids: V }) })), k({ currentPage: c[w], avStream: b, screenPermissionRequested: B, nextQuestion: T, type: Q, passthroughData: _, recordingMediaTypes: z, captureStream: O });
|
|
428
|
-
} });
|
|
429
|
-
const f = c[w];
|
|
430
|
-
return f.type === "av_permission" && Ne({ currentPage: f, pages: c }), f;
|
|
431
|
-
}({ questionId: n, surveyId: o, next: (c) => {
|
|
432
|
-
r(c, !0);
|
|
433
|
-
}, pages: s.pages, responseGroupUid: l, userId: m }));
|
|
434
|
-
let h = i.headline, y = i.captionText;
|
|
435
|
-
const p = Fe(g, i);
|
|
436
|
-
return Re(i) && u && (h = i.permissionDeniedHeadline, y = i.permissionDeniedCaptionText), ge(i) && p === Qe && (h = i.permissionGrantedHeadline, y = i.permissionGrantedCaptionText), e("div", { className: D(t, "ul-center-horizontally", "fade-in-transition"), children: [e(De, { message: h, properties: { captionText: y } }), e(ne, { children: e(Rt, { properties: s }) })] });
|
|
437
|
-
}, At = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
|
|
438
|
-
const { visitorAttributes: o, isLongFormSurvey: l } = R((i) => ({ visitorAttributes: i.visitorAttributes, isLongFormSurvey: fe(i.studyType) })), m = (i, h = !1) => {
|
|
439
|
-
s({ value: h ? { skipped: !0 } : void 0, questionId: n, type: a }, !0);
|
|
440
|
-
}, d = (i) => {
|
|
441
|
-
i.key !== "Enter" && i.key !== " " || s({ value: void 0, questionId: n, type: a }, !0);
|
|
442
|
-
}, u = at(r && r.buttonUrl, o), g = l && r.promptActionType === it.NO_BUTTON ? () => e(te, {}) : () => e("div", { children: e("div", { className: "ul-card-button-group", children: [e("a", { className: "ul-card-text__button ul-card__text-url-prompt-button", href: u, id: "ul-card-text__button", onClick: m, onKeyPress: d, rel: "noreferrer", role: u ? "link" : "button", tabIndex: 0, target: "_blank", children: ee(r) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (i) => m(0, !0), children: we(r) })] }) });
|
|
443
|
-
return e("div", { className: D(t, "ul-card__text-url-prompt", "fade-in-transition"), children: e(K, { defaultBody: g, properties: r }) }, n);
|
|
444
|
-
}, Bt = ({ className: t, questionId: s }) => {
|
|
445
|
-
const { border: r, destroy: n, endCard: a, forceBrandedLogo: o } = R((d) => ({ border: d.border, destroy: d.destroy, endCard: d.endCard, forceBrandedLogo: d.forceBrandedLogo }));
|
|
446
|
-
W(() => {
|
|
447
|
-
setTimeout(() => {
|
|
448
|
-
n(Pe);
|
|
449
|
-
}, o ? 4e3 : 2e3);
|
|
450
|
-
}, [n, o]);
|
|
451
|
-
const l = a && a.subheader ? e("p", { className: "ul-caption", children: a.subheader }) : null, m = a && a.headline ? a.headline : "";
|
|
452
|
-
return e("div", { className: D(t, "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: r, 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: r, 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(De, { message: m }), l] }) }) }, s);
|
|
453
|
-
}, Et = () => e("div", { className: "thinking-dots-container", children: e("div", { className: "thinking-dot" }) }), $t = ({ className: t }) => {
|
|
454
|
-
const { uploadProgress: s } = R((o) => ({ uploadProgress: o.uploadProgress }));
|
|
455
|
-
let r, n;
|
|
456
|
-
Object.values(s).filter((o) => o.isSubmitted).length > 1 ? (r = "Your responses are processing", n = "Please keep this tab open until your responses are fully processed.") : (r = "Your response is processing", n = "Please keep this tab open until your response is fully processed.");
|
|
457
|
-
const a = Math.round(Math.min(99, ...Object.values(s).filter((o) => o.isSubmitted).map((o) => o.progressPct || 0)));
|
|
458
|
-
return e("div", { className: D(t, "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(De, { message: `${r} (${a}% complete)` }), e("p", { className: "ul-caption", children: n })] });
|
|
459
|
-
}, Ae = 0, Be = 1, Ot = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
|
|
460
|
-
const o = `ul-card-video__player_recorder-q${n}`, { apiURL: l, envId: m, handleUploadUpdate: d, headers: u, responseGroupUid: g, surveyId: i, update: h, viewDocument: y, visitorId: p } = R((f) => ({ apiURL: f.apiURL, envId: f.envId, handleUploadUpdate: f.handleUploadUpdate, headers: f.headers, responseGroupUid: f.responseGroupUid, surveyId: f.surveyId, update: f.update, viewDocument: f.viewDocument, visitorId: f.userId })), [c, x] = U(!1), [S, v] = U(null), [C, T] = U(null), [k, P] = U(Ae), I = Z(null);
|
|
461
|
-
W(() => {
|
|
462
|
-
const f = I.current, b = new ResizeObserver(() => {
|
|
463
|
-
h();
|
|
464
|
-
});
|
|
465
|
-
return f && b.observe(f), () => {
|
|
466
|
-
f && b.unobserve(f);
|
|
467
|
-
};
|
|
468
|
-
}, [h]);
|
|
469
|
-
const _ = (f, b) => {
|
|
470
|
-
f === j.UPLOAD_STARTED ? (v(b[j.UPLOAD_ID]), T(b[j.MEDIA_RECORDING_UID]), x(!0)) : f === j.DELETE ? (v(null), T(null), x(!1)) : f === j.UPLOAD_PROGRESS ? isNaN(b[j.UPLOAD_PROGRESS_PCT]) ? d({ mediaRecordingUid: b[j.MEDIA_RECORDING_UID], isComplete: !0 }) : d({ mediaRecordingUid: b[j.MEDIA_RECORDING_UID], progressPct: b[j.UPLOAD_PROGRESS_PCT] }) : f === j.UPLOAD_FINISHED && d({ mediaRecordingUid: b[j.MEDIA_RECORDING_UID], isComplete: !0 });
|
|
471
|
-
}, w = (f) => {
|
|
472
|
-
f.preventDefault(), f.stopPropagation(), document.getElementById(o) && ct(o), S && C ? (d({ mediaRecordingUid: C, isSubmitted: !0 }), s({ value: { mediaRecordingUid: C }, questionId: n, type: a }, !0)) : s({ value: null, questionId: n, type: a }, !0);
|
|
473
|
-
};
|
|
474
|
-
return e("form", { className: D(t, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(ne, { children: [e("div", { id: "ul-question-player-container", ref: I, style: { display: k === Ae ? "" : "none" }, children: e(K, { defaultBody: () => e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (f) => {
|
|
475
|
-
f.preventDefault(), f.stopPropagation(), document.getElementById(o) && ot(o), P(Be);
|
|
476
|
-
} }), properties: r }) }), e("div", { style: { display: k === Be ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (f) => {
|
|
477
|
-
if (f && f.children.length === 0) {
|
|
478
|
-
const b = lt(o, { surveyId: i, responseGroupUid: g, questionId: n, visitorId: p, envId: m }, l, _, void 0, { ...u, "x-ul-video-recorder-origin": "sdk" }, r.mediaType === j.MEDIA_TYPE_AUDIO, y);
|
|
479
|
-
f.appendChild(b);
|
|
480
|
-
}
|
|
481
|
-
} }) })] }), e(re, { children: [e(oe, { isDisabled: !!r.required && !c, onClick: w, children: ee(r) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: w, style: { ...r.required ? { display: "none" } : {}, ...c ? { display: "none" } : {} }, children: we(r) })] })] });
|
|
482
|
-
}, ze = (t) => t.type === "thanks" || t.type === "uploading", Ht = ({ card: t, avatars: s, isThinking: r, isCurrentQuestion: n, currentQuestionBubbleRef: a }) => {
|
|
483
|
-
const o = ((l) => "properties" in l.props && l.props.properties && "questionHtml" in l.props.properties && l.props.properties.questionHtml ? { content: l.props.properties.questionHtml, isHtml: !0 } : "message" in l.props ? { content: l.props.message, isHtml: !1 } : { content: "Question", isHtml: !1 })(t);
|
|
484
|
-
return e(ce, { avatars: s, isLeft: !0, message: { id: `question-${t.name}`, type: "question", content: o.content }, ref: n ? a : null, children: r ? e(Et, {}) : e(te, { children: [o.isHtml ? e("div", { className: "chat-message-text", dangerouslySetInnerHTML: { __html: o.content } }) : e("div", { className: "chat-message-text", children: o.content }), t.type === "videovoice" && e(ut, { properties: t.props, questionId: t.name, surveyVideoUrl: t.props.properties.videoUrl })] }) });
|
|
485
|
-
}, Qt = ({ card: t, avatars: s }) => {
|
|
486
|
-
const r = ((n) => {
|
|
487
|
-
if (!("properties" in n.props) || !n.props.properties || typeof n.props.properties != "object") return null;
|
|
488
|
-
const a = n.props.properties, o = [{ key: "captionHtml", isHtml: !0 }, { key: "captionText", isHtml: !1 }, { key: "richTextBody", isHtml: !0 }, { key: "body", isHtml: !1 }];
|
|
489
|
-
for (const { key: l, isHtml: m } of o) {
|
|
490
|
-
const d = a[l];
|
|
491
|
-
if (typeof d == "string") {
|
|
492
|
-
const u = d.trim();
|
|
493
|
-
if (u) return { content: u, isHtml: m };
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
return null;
|
|
497
|
-
})(t);
|
|
498
|
-
return r ? e(ce, { avatars: s, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: r.content }, children: r.isHtml ? e("div", { className: "chat-message-text", dangerouslySetInnerHTML: { __html: r.content } }) : e("div", { className: "chat-message-text", children: r.content }) }) : null;
|
|
499
|
-
}, Ft = ({ card: t, userResponse: s, avatars: r }) => {
|
|
500
|
-
const n = ((a, o) => {
|
|
501
|
-
if (a.type === "open" && o && typeof o == "object" && "value" in o) return o.value;
|
|
502
|
-
})(t, s);
|
|
503
|
-
return e("div", { className: "chat-bubble-container chat-right", children: [e("div", { className: "chat-bubble chat-bubble-right chat-bubble-text-only", children: e("div", { className: "chat-message-text", children: n || e("div", { className: "chat-message-no-response", children: "No response" }) }) }), e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x` })] });
|
|
504
|
-
}, Gt = ({ card: t, avatars: s, isCurrentQuestion: r, currentQuestionBubbleRef: n }) => {
|
|
505
|
-
const { endCard: a } = R((o) => ({ endCard: o.endCard }));
|
|
506
|
-
return e(te, { children: [e(ce, { avatars: s, isLeft: !0, message: { id: `thanks-${t.name}`, type: "question", content: (a == null ? void 0 : a.headline) ?? "Great! Thank you for your participation." }, ref: r ? n : null }), (a == null ? void 0 : a.subheader) && e(ce, { avatars: s, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: a.subheader } }), e(mt, {})] });
|
|
507
|
-
}, Vt = ({ card: t, cardIndex: s, index: r, avatars: n, cardResponses: a, questionThinkingStates: o, startingQuestionIdx: l, currentQuestionBubbleRef: m, handleCardResponse: d }) => {
|
|
508
|
-
const u = s === r, g = s < r, i = ze(t);
|
|
509
|
-
if (i) return e(Gt, { avatars: n, card: t, currentQuestionBubbleRef: m, isCurrentQuestion: u });
|
|
510
|
-
const h = `${t.name}`, y = a.get(h), p = t.type === "open", c = o.get(h), x = s > (l ?? 0) && t.type !== "thanks" && t.type !== "uploading" && (c === !0 || c === void 0);
|
|
511
|
-
return e(Ee.Fragment, { children: [e(Ht, { avatars: n, card: t, currentQuestionBubbleRef: m, isCurrentQuestion: u, isThinking: x }), !x && e(Qt, { avatars: n, card: t }), g && p ? e(Ft, { avatars: n, card: t, userResponse: y }) : (!g || !p) && !x && e(ce, { avatars: n, isLeft: !1, message: { id: `card-${t.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e(Zt, { card: t, className: i ? "chat-thanks-card" : "chat-card", isAnswered: g, next: u ? d : () => {
|
|
512
|
-
} }) }) })] }, `question-card-${t.name}`);
|
|
513
|
-
}, ce = Ee.forwardRef(({ message: t, isLeft: s = !1, children: r, avatars: n, hideAvatar: a = !1 }, o) => {
|
|
514
|
-
const l = s ? "chat-bubble-left" : "chat-bubble-right";
|
|
515
|
-
return e("div", { className: `chat-bubble-container ${s ? "chat-left" : "chat-right"}${s && a ? " chat-no-avatar" : ""}`, ref: o, children: [s && !a && e("img", { alt: "AI Avatar", className: "chat-avatar chat-avatar-left", srcSet: `${n.agentAvatar["1x"]} 1x, ${n.agentAvatar["2x"]} 2x` }), e("div", { className: `chat-bubble ${l}`, children: r || e("div", { className: "chat-message-text", children: t.content }) }), !s && !a && e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${n.respondentAvatar["1x"]} 1x, ${n.respondentAvatar["2x"]} 2x` })] });
|
|
516
|
-
});
|
|
517
|
-
ce.displayName = "ChatBubble";
|
|
518
|
-
const jt = () => {
|
|
519
|
-
const t = R((r) => r.close), s = be(() => () => t(Pe), [t]);
|
|
520
|
-
return e("div", { "aria-label": "Close button", className: "conversational-close-btn", onClick: s, onKeyPress: (r) => {
|
|
521
|
-
r.key === "Enter" && s();
|
|
522
|
-
}, role: "button", tabIndex: 0, children: e("svg", { fill: "none", height: "16px", viewBox: "0 0 13 13", width: "16px", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z", fill: "#262136" }) }) });
|
|
523
|
-
}, Zt = ({ card: t, next: s, className: r = "", isAnswered: n = !1 }) => {
|
|
524
|
-
const a = { className: n ? `${r} answered-card` : r, next: n ? () => {
|
|
525
|
-
} : s, questionId: t.name, type: t.type, isAnswered: n };
|
|
526
|
-
switch (t.type) {
|
|
527
|
-
case "consentlegal":
|
|
528
|
-
return e(pt, { ...a, ...t.props });
|
|
529
|
-
case "likert":
|
|
530
|
-
return e(gt, { ...a, ...t.props });
|
|
531
|
-
case "matrix":
|
|
532
|
-
return e(kt, { ...a, ...t.props });
|
|
533
|
-
case "multiplechoice":
|
|
534
|
-
return e(St, { ...a, ...t.props });
|
|
535
|
-
case "multipleselect":
|
|
536
|
-
return e(Ct, { ...a, ...t.props });
|
|
537
|
-
case "nps":
|
|
538
|
-
return e(Tt, { ...a, ...t.props });
|
|
539
|
-
case "open":
|
|
540
|
-
return e(_t, { ...a, ...t.props });
|
|
541
|
-
case "rankorder":
|
|
542
|
-
return e(Nt, { ...a, ...t.props });
|
|
543
|
-
case "recordedtask":
|
|
544
|
-
return e(Ut, { ...a, ...t.props });
|
|
545
|
-
case "texturlprompt":
|
|
546
|
-
return e(At, { ...a, ...t.props });
|
|
547
|
-
case "thanks":
|
|
548
|
-
return e(Bt, { ...a, ...t.props });
|
|
549
|
-
case "uploading":
|
|
550
|
-
return e($t, { ...a, ...t.props });
|
|
551
|
-
case "videovoice":
|
|
552
|
-
return e(Ot, { ...a, ...t.props });
|
|
553
|
-
default:
|
|
554
|
-
return null;
|
|
555
|
-
}
|
|
556
|
-
}, Xt = ({ cards: t, next: s, previousResponses: r }) => {
|
|
557
|
-
const { messagesContainerRef: n, currentQuestionBubbleRef: a, scrollToCurrentQuestion: o } = (() => {
|
|
558
|
-
const v = Z(null), C = Z(null), T = pe(() => {
|
|
559
|
-
if (C.current && v.current) {
|
|
560
|
-
const k = v.current, P = C.current.offsetTop - k.offsetTop - 16;
|
|
561
|
-
k.scrollTo({ top: Math.max(0, P), behavior: "smooth" });
|
|
562
|
-
}
|
|
563
|
-
}, []);
|
|
564
|
-
return { messagesContainerRef: v, currentQuestionBubbleRef: C, scrollToCurrentQuestion: T };
|
|
565
|
-
})(), { cardResponses: l, setCardResponse: m } = (() => {
|
|
566
|
-
const [v, C] = U(/* @__PURE__ */ new Map());
|
|
567
|
-
return { cardResponses: v, setCardResponse: pe((T, k) => {
|
|
568
|
-
C((P) => new Map(P).set(T, k));
|
|
569
|
-
}, []) };
|
|
570
|
-
})(), { index: d, isLongFormSurvey: u, avatars: g, startingQuestionIdx: i } = R((v) => ({ index: v.index, isLongFormSurvey: fe(v.studyType), avatars: v.avatars, startingQuestionIdx: v.startingQuestionIdx })), h = ((v, C, T) => {
|
|
571
|
-
const [k, P] = U(/* @__PURE__ */ new Map());
|
|
572
|
-
return W(() => {
|
|
573
|
-
if (v.length > 0 && C < v.length) {
|
|
574
|
-
const I = v[C], _ = `${I.name}`;
|
|
575
|
-
if (C <= (T ?? 0) || ze(I)) return void P((f) => new Map(f).set(_, !1));
|
|
576
|
-
P((f) => new Map(f).set(_, !0));
|
|
577
|
-
const w = setTimeout(() => {
|
|
578
|
-
P((f) => new Map(f).set(_, !1));
|
|
579
|
-
}, 1e3);
|
|
580
|
-
return () => clearTimeout(w);
|
|
581
|
-
}
|
|
582
|
-
}, [C, v, T]), k;
|
|
583
|
-
})(t, d, i), y = ((v, C) => {
|
|
584
|
-
const [T, k] = U(/* @__PURE__ */ new Set([0]));
|
|
585
|
-
return W(() => {
|
|
586
|
-
k((P) => new Set(P).add(v));
|
|
587
|
-
}, [v]), W(() => {
|
|
588
|
-
const P = C ?? 0;
|
|
589
|
-
P > 0 && k((I) => {
|
|
590
|
-
const _ = new Set(I);
|
|
591
|
-
for (let w = 0; w <= P; w++) _.add(w);
|
|
592
|
-
return _;
|
|
593
|
-
});
|
|
594
|
-
}, [C]), T;
|
|
595
|
-
})(d, i), p = be(() => ({ ...r, ...et(t.map((v, C) => {
|
|
596
|
-
var T, k;
|
|
597
|
-
return { ...v, value: C < d ? ((T = l.get(`${v.name}`)) == null ? void 0 : T.value) ?? null : null, secondaryValue: C < d ? ((k = l.get(`${v.name}`)) == null ? void 0 : k.secondaryValue) ?? null : null };
|
|
598
|
-
})) }), [r, l, t, d]), c = tt(t, p);
|
|
599
|
-
W(() => {
|
|
600
|
-
requestAnimationFrame(() => {
|
|
601
|
-
o();
|
|
602
|
-
});
|
|
603
|
-
}, [d, o, h]);
|
|
604
|
-
const x = pe((v, C) => {
|
|
605
|
-
if (!C) return;
|
|
606
|
-
const T = c[d];
|
|
607
|
-
if (!T) return;
|
|
608
|
-
const k = `${T.name}`;
|
|
609
|
-
m(k, v), s([v]);
|
|
610
|
-
}, [c, d, s, m]), S = c.map((v, C) => ({ card: v, cardIndex: C })).filter(({ cardIndex: v }) => y.has(v));
|
|
611
|
-
return e("div", { className: "conversational-ui ul-conversational-ui", children: [!u && e(jt, {}), e("div", { className: "chat-container", ref: n, children: e("div", { className: "chat-messages", children: S.map(({ card: v, cardIndex: C }) => e(Vt, { avatars: g, card: v, cardIndex: C, cardResponses: l, currentQuestionBubbleRef: a, handleCardResponse: x, index: d, questionThinkingStates: h, startingQuestionIdx: i }, `question-card-${v.name}`)) }) })] });
|
|
612
|
-
};
|
|
613
|
-
export {
|
|
614
|
-
Xt as default
|
|
615
|
-
};
|