@sprig-technologies/sprig-browser 2.40.1 → 2.40.2
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-ui-Qad4jSLB.js → conversational-ui-BYWN-x1R.js} +233 -233
- package/dist/{conversational-ui-DWOygt3h.cjs → conversational-ui-N_aaTzqd.cjs} +1 -1
- package/dist/{core-oShYwNGS.cjs → core-Br8FqGd4.cjs} +2 -2
- package/dist/{core-swSxd_ys.js → core-Cyu7gofl.js} +28 -28
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/{getAttributedUrl-DuHEi0A7.cjs → getAttributedUrl-CJJ96Ihj.cjs} +1 -1
- package/dist/{getAttributedUrl-C8OLV7E9.js → getAttributedUrl-C_5gL6aZ.js} +3 -3
- package/dist/{index-Zzh93qL6.js → index-BSk-C5b7.js} +4 -4
- package/dist/{index-DCMlaRyW.cjs → index-MWKreg7C.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-D0NmprYW.js → metricsReporter-B-oKhuWk.js} +1 -1
- package/dist/{metricsReporter-DC-3J5Sa.cjs → metricsReporter-Dc4CZlRc.cjs} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/{view-Cu1EeVuN.js → view-BGlLLPXB.js} +4 -4
- package/dist/{view-DAxlTNxd.cjs → view-BGzeHt4l.cjs} +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as A, u as e, h as $, c as L, b as j, e as J, f as fe, p as te, F as oe, _ as K, T as le, A as Ve, g as ke, i as Fe, j as Ze, k as Ye, w as Re, l as ze } from "./view-
|
|
2
|
-
import { v as Ke, R as V, B as X, M as z, Q as re, O as xe, a as W, b as ue, S as Xe, L as We, u as Je, H as ce, c as Ce, g as et, P as tt, p as rt, d as nt, s as st } from "./getAttributedUrl-
|
|
3
|
-
import { a as ve, D as Te, A as _e, g as at } from "./core-
|
|
4
|
-
import { t as Le } from "./metricsReporter-
|
|
1
|
+
import { a as A, u as e, h as $, c as L, b as j, e as J, f as fe, p as te, F as oe, _ as K, T as le, A as Ve, g as ke, i as Fe, j as Ze, k as Ye, w as Re, l as ze } from "./view-BGlLLPXB.js";
|
|
2
|
+
import { v as Ke, R as V, B as X, M as z, Q as re, O as xe, a as W, b as ue, S as Xe, L as We, u as Je, H as ce, c as Ce, g as et, P as tt, p as rt, d as nt, s as st } from "./getAttributedUrl-C_5gL6aZ.js";
|
|
3
|
+
import { a as ve, D as Te, A as _e, g as at } from "./core-Cyu7gofl.js";
|
|
4
|
+
import { t as Le } from "./metricsReporter-B-oKhuWk.js";
|
|
5
5
|
const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
|
|
6
6
|
const n = `ul-card-video__question_player-q${r}`, { apiURL: a, viewDocument: i } = A((o) => ({ apiURL: o.apiURL, viewDocument: o.viewDocument }));
|
|
7
7
|
return e("div", { id: n, ref: (o) => {
|
|
@@ -11,24 +11,24 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
|
|
|
11
11
|
}
|
|
12
12
|
} });
|
|
13
13
|
}, se = ({ isDisabled: t, onClick: s, children: r }) => e(X, { 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"] }), lt = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
|
|
14
|
-
const { useMobileStyling: i, border: o } = A((
|
|
15
|
-
|
|
16
|
-
let
|
|
17
|
-
if (!
|
|
18
|
-
if (!
|
|
19
|
-
|
|
14
|
+
const { useMobileStyling: i, border: o } = A((g) => ({ useMobileStyling: g.useMobileStyling, border: g.border })), [d, c] = $(!1), [m, h] = $(""), [l, u] = $(!1), y = r == null ? void 0 : r.collectName, x = (r == null ? void 0 : r.nameLabelText) || "Full Name", p = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", T = (r == null ? void 0 : r.submitButtonText) || "Submit", D = !!m.trim(), R = d && (!y || D), f = (g, w = !1) => {
|
|
15
|
+
g.preventDefault(), g.stopPropagation();
|
|
16
|
+
let I = null;
|
|
17
|
+
if (!w) {
|
|
18
|
+
if (!R) return void u(!0);
|
|
19
|
+
I = { submitted: !0 }, y && (I.name = m);
|
|
20
20
|
}
|
|
21
|
-
s({ value:
|
|
21
|
+
s({ value: I, questionId: n, type: a }, !!w || R);
|
|
22
22
|
};
|
|
23
|
-
return e("div", { className: L(t, "ul-card__consent-legal", "fade-in-transition"), children: e(z, { embeddedType: "pdf", properties: r, children: e(re, { children: [e("div", { className: "sprig-stretch", children: [e(xe, { allowTextEntry: !1, border: o, error: l && !d, id: "consent", isRadio: !1, isSelected: d, label: p, onUserInputChanged: ({ selected:
|
|
24
|
-
|
|
25
|
-
}, useMobileStyling: i }), y && e("input", { "aria-label":
|
|
26
|
-
|
|
27
|
-
}, onFocus: (
|
|
28
|
-
|
|
29
|
-
}, onInput: (
|
|
30
|
-
|
|
31
|
-
}, placeholder:
|
|
23
|
+
return e("div", { className: L(t, "ul-card__consent-legal", "fade-in-transition"), children: e(z, { embeddedType: "pdf", properties: r, children: e(re, { children: [e("div", { className: "sprig-stretch", children: [e(xe, { allowTextEntry: !1, border: o, error: l && !d, id: "consent", isRadio: !1, isSelected: d, label: p, onUserInputChanged: ({ selected: g }) => {
|
|
24
|
+
g !== d && c(!d);
|
|
25
|
+
}, useMobileStyling: i }), y && e("input", { "aria-label": x, "aria-placeholder": x, className: L(j("ul-consent-legal__name-input", i)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (g) => {
|
|
26
|
+
g.currentTarget.style.borderColor = l && !D ? ve : Te;
|
|
27
|
+
}, onFocus: (g) => {
|
|
28
|
+
g.currentTarget.style.borderColor = l && !D ? ve : o;
|
|
29
|
+
}, onInput: (g) => {
|
|
30
|
+
g.preventDefault(), g.stopPropagation(), h(g.currentTarget.value);
|
|
31
|
+
}, placeholder: x, style: l && !D ? { borderColor: ve } : {}, tabIndex: 0, value: m })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(se, { isDisabled: !R, onClick: (g) => f(new SubmitEvent(g.type)), children: J({ buttonText: T }) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (g) => f(new SubmitEvent(g.type), !0), children: fe(r) })] })] }) }) }, n);
|
|
32
32
|
}, ot = () => {
|
|
33
33
|
const { destroy: t, forceBrandedLogo: s } = A((r) => ({ destroy: r.destroy, forceBrandedLogo: r.forceBrandedLogo }));
|
|
34
34
|
return te(() => {
|
|
@@ -37,18 +37,18 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
|
|
|
37
37
|
}, s ? 4e3 : 2e3);
|
|
38
38
|
}, [t, s]), e("div", { className: "end-of-survey-text", children: "End of survey" });
|
|
39
39
|
}, ct = ({ activeValue: t, border: s, icon: r, enableCspTrustedTypes: n, isPressed: a, range: i, scaleLabelType: o, selectedValue: d, setSelectedValue: c, setActiveValue: m, setIsPressed: h, useMobileStyling: l, value: u, viewDocument: y }) => {
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
-
})(),
|
|
44
|
-
const
|
|
45
|
-
return p ? { ...
|
|
46
|
-
}, [
|
|
47
|
-
if (b === "smiley" && S ===
|
|
48
|
-
let
|
|
49
|
-
return
|
|
40
|
+
const x = `option-${u}`, p = o === "number", T = o === "star", D = o === "smiley", R = p && u === t || u === d, [f, g] = (() => {
|
|
41
|
+
const k = T && d !== null && u <= d;
|
|
42
|
+
return T && u <= t || D && u === t || k || u === t || u === d ? [s, a || k || u === d ? 1 : 0.3] : ["", 1];
|
|
43
|
+
})(), w = oe(() => {
|
|
44
|
+
const k = { borderColor: R ? f : "", fillOpacity: R ? "" : g, zIndex: R ? 3 : "auto", color: d === u ? "#fff" : "" };
|
|
45
|
+
return p ? { ...k, backgroundColor: d === u ? f : "" } : { ...k, color: T || D || d === u ? f : "" };
|
|
46
|
+
}, [R, f, g, d, u, p, T, D]), I = oe(() => at((({ icon: k, scaleLabelType: b, value: S, selectedValue: v }) => {
|
|
47
|
+
if (b === "smiley" && S === v) {
|
|
48
|
+
let _ = 0;
|
|
49
|
+
return k.replace(/black/g, () => ++_ == 1 ? "black" : "white");
|
|
50
50
|
}
|
|
51
|
-
return
|
|
51
|
+
return k;
|
|
52
52
|
})({ icon: r, scaleLabelType: o, value: u, selectedValue: d }), n), [n, r, o, d, u]);
|
|
53
53
|
return e("button", { "aria-label": p ? void 0 : String(u), className: (() => {
|
|
54
54
|
switch (o) {
|
|
@@ -59,68 +59,68 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
|
|
|
59
59
|
default:
|
|
60
60
|
return u === i ? L(j("likert-number", l), j(`likert-number-${u}`, l), j("likert-last-option", l)) : L(j("likert-number", l), j(`likert-number-${u}`, l));
|
|
61
61
|
}
|
|
62
|
-
})(), dangerouslySetInnerHTML: { __html:
|
|
63
|
-
|
|
64
|
-
}, onKeyDown: (
|
|
65
|
-
var
|
|
62
|
+
})(), dangerouslySetInnerHTML: { __html: I }, id: x, onClick: (k) => {
|
|
63
|
+
k.preventDefault(), k.stopPropagation(), c(u);
|
|
64
|
+
}, onKeyDown: (k) => {
|
|
65
|
+
var v, _;
|
|
66
66
|
const b = y.querySelectorAll(`.likert-${o ?? "number"}`), S = u - 1;
|
|
67
|
-
|
|
67
|
+
k.key === "ArrowRight" ? (v = b[S + 1]) == null || v.focus() : k.key === "ArrowLeft" ? (_ = b[S - 1]) == null || _.focus() : k.key !== "Enter" && k.key !== " " || (k.preventDefault(), k.stopPropagation(), c(u));
|
|
68
68
|
}, onPointerDown: () => h(!0), onPointerEnter: () => m(u), onPointerLeave: () => {
|
|
69
69
|
m(-1), h(!1);
|
|
70
|
-
}, style:
|
|
70
|
+
}, style: w, tabIndex: 0 });
|
|
71
71
|
}, dt = ({ className: t, labels: s, next: r, properties: n, questionId: a, type: i }) => {
|
|
72
|
-
const { border: o, useMobileStyling: d, viewDocument: c, enableCspTrustedTypes: m } = A((b) => ({ border: b.border, useMobileStyling: b.useMobileStyling, viewDocument: b.viewDocument, enableCspTrustedTypes: b.enableCspTrustedTypes })), [h, l] = $(-1), [u, y] = $(!1), [
|
|
73
|
-
let
|
|
74
|
-
const { range:
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
var S,
|
|
78
|
-
switch (
|
|
72
|
+
const { border: o, useMobileStyling: d, viewDocument: c, enableCspTrustedTypes: m } = A((b) => ({ border: b.border, useMobileStyling: b.useMobileStyling, viewDocument: b.viewDocument, enableCspTrustedTypes: b.enableCspTrustedTypes })), [h, l] = $(-1), [u, y] = $(!1), [x, p] = $(null), T = s && s.left, D = s && s.right;
|
|
73
|
+
let R;
|
|
74
|
+
const { range: f, scaleLabelType: g, ratingIcons: w } = n;
|
|
75
|
+
f && (R = Number(f));
|
|
76
|
+
const I = R || 5, k = (b) => {
|
|
77
|
+
var S, v;
|
|
78
|
+
switch (g) {
|
|
79
79
|
case "star":
|
|
80
|
-
return (S =
|
|
80
|
+
return (S = w[0]) == null ? void 0 : S.svg;
|
|
81
81
|
case "smiley":
|
|
82
|
-
return (
|
|
82
|
+
return (v = w[b]) == null ? void 0 : v.svg;
|
|
83
83
|
default:
|
|
84
84
|
return String(b + 1);
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
return e("form", { className: L(t, "ul-card--likert", "fade-in-transition"), children: e(z, { properties: n, children: [e(W, { children: [e("div", { "aria-label": `Rating (1 - ${
|
|
88
|
-
const
|
|
89
|
-
return e(ct, { activeValue: h, border: o, enableCspTrustedTypes: m, icon:
|
|
90
|
-
}) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children:
|
|
87
|
+
return e("form", { className: L(t, "ul-card--likert", "fade-in-transition"), children: e(z, { properties: n, children: [e(W, { children: [e("div", { "aria-label": `Rating (1 - ${I})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(I)].map((b, S) => {
|
|
88
|
+
const v = S + 1;
|
|
89
|
+
return e(ct, { activeValue: h, border: o, enableCspTrustedTypes: m, icon: k(S), isPressed: u, range: I, scaleLabelType: g, selectedValue: x, setActiveValue: l, setIsPressed: y, setSelectedValue: p, useMobileStyling: d, value: v, viewDocument: c }, S);
|
|
90
|
+
}) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: T }), e("span", { children: D })] })] }), e(re, { children: e(se, { isDisabled: x === null && n.required, onClick: () => r({ value: x, questionId: a, type: i }, !0), children: J(n) }) })] }) }, a);
|
|
91
91
|
}, ut = ({ columns: t, onSelect: s, options: r, selectedOptions: n }) => {
|
|
92
92
|
const a = K([]), { border: i, useMobileStyling: o } = A((u) => ({ border: u.border, useMobileStyling: u.useMobileStyling })), d = r.findIndex((u) => n[u.id] === null), [c, m] = $(d), h = le((u, y) => {
|
|
93
93
|
s(u, y);
|
|
94
|
-
const
|
|
95
|
-
p && n[p.id] === null && m(
|
|
94
|
+
const x = c + 1, p = r[x];
|
|
95
|
+
p && n[p.id] === null && m(x);
|
|
96
96
|
}, [s, r, n, c]), l = le((u, y) => {
|
|
97
|
-
const
|
|
98
|
-
return e(Ve, { animate: !0, header: y.label, isOpen:
|
|
97
|
+
const x = c === u;
|
|
98
|
+
return e(Ve, { animate: !0, header: y.label, isOpen: x, onClick: () => {
|
|
99
99
|
var p;
|
|
100
|
-
return m(
|
|
100
|
+
return m(x && !((p = window.UserLeap) != null && p.isMobileSDK) ? -1 : u);
|
|
101
101
|
}, ref: (p) => {
|
|
102
102
|
p && (a.current[u] = p);
|
|
103
103
|
}, showHeaderCheck: n[y.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: t.map((p) => e(xe, { allowTextEntry: !1, ariaLabel: `${y.label}-${p.label}`, border: i, error: !1, id: `${y.id}-${p.value}`, isRadio: !0, isSelected: n[y.id] === p.value, label: p.label, onUserInputChanged: () => h(y.id, p.value), useMobileStyling: o }, p.label)) }) }, y.id);
|
|
104
104
|
}, [i, t, c, h, n, o]);
|
|
105
105
|
return e("div", { children: r.map((u, y) => l(y, u)) });
|
|
106
106
|
}, pt = ({ className: t, next: s, options: r, properties: n, questionId: a, type: i, onSubmitButtonClick: o }) => {
|
|
107
|
-
const d = n.matrixColumn, c = n.required, m = (
|
|
108
|
-
|
|
109
|
-
}, h = r.reduce((
|
|
110
|
-
return e("form", { className: L(t, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: m, children: e(z, { properties: n, children: [e(W, { children: e(ut, { columns: d, onSelect: (
|
|
111
|
-
u((
|
|
112
|
-
}, options: r, selectedOptions: l }) }), e(re, { children: e(se, { isDisabled: (y = l, c && Object.values(y).every((
|
|
107
|
+
const d = n.matrixColumn, c = n.required, m = (x) => {
|
|
108
|
+
x.preventDefault(), x.stopPropagation(), s({ value: l, questionId: a, type: i }, !0), o && o();
|
|
109
|
+
}, h = r.reduce((x, p) => (x[p.id] = null, x), {}), [l, u] = $(h);
|
|
110
|
+
return e("form", { className: L(t, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: m, children: e(z, { properties: n, children: [e(W, { children: e(ut, { columns: d, onSelect: (x, p) => {
|
|
111
|
+
u((T) => ({ ...T, [x]: p }));
|
|
112
|
+
}, options: r, selectedOptions: l }) }), e(re, { children: e(se, { isDisabled: (y = l, c && Object.values(y).every((x) => x == null)), onClick: () => m(new SubmitEvent("submit")), children: J(n) }) })] }) }, a);
|
|
113
113
|
var y;
|
|
114
114
|
}, Me = ({ className: t, onSubmit: s, options: r = [], properties: n, questionId: a, type: i, showIndividualSubmit: o = !1, onSubmitButtonClick: d }) => {
|
|
115
|
-
const { border: c, useMobileStyling: m } = A((
|
|
116
|
-
var
|
|
117
|
-
return (
|
|
118
|
-
}),
|
|
115
|
+
const { border: c, useMobileStyling: m } = A((v) => ({ border: v.border, useMobileStyling: v.useMobileStyling })), h = r.reduce((v, _) => (v[_.id] = { isSelected: !1 }, v), {}), [l, u] = $(h), y = i === "multiplechoice", x = n.required, p = r.find((v) => {
|
|
116
|
+
var _;
|
|
117
|
+
return (_ = v.optionProperties) == null ? void 0 : _.noneOfTheAbove;
|
|
118
|
+
}), T = (v) => Object.entries(v).some(([_, B]) => {
|
|
119
119
|
var Q;
|
|
120
|
-
const H = r.find((ee) => `${ee.id}` ===
|
|
120
|
+
const H = r.find((ee) => `${ee.id}` === _), O = B.userText === void 0 || B.userText.trim() === "";
|
|
121
121
|
return ((Q = H == null ? void 0 : H.optionProperties) == null ? void 0 : Q.allowsTextEntry) && O && B.isSelected;
|
|
122
|
-
}),
|
|
123
|
-
const { minSelect: B = 0, maxSelect: H = 1 / 0, maxSelectMode: O } = n, Q =
|
|
122
|
+
}), D = (v) => Object.values(v).filter((_) => _.isSelected).length, R = n.minSelect && n.minSelect > 0 && n.maxSelectMode === ue.Range && D(l) < n.minSelect && (x || D(l) > 0), f = (v) => T(v) || x && !D(v) || !((_) => {
|
|
123
|
+
const { minSelect: B = 0, maxSelect: H = 1 / 0, maxSelectMode: O } = n, Q = D(_);
|
|
124
124
|
switch (O) {
|
|
125
125
|
case ue.Maximum:
|
|
126
126
|
return Q <= H;
|
|
@@ -129,32 +129,32 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
|
|
|
129
129
|
default:
|
|
130
130
|
return !0;
|
|
131
131
|
}
|
|
132
|
-
})(
|
|
132
|
+
})(v), g = Object.entries(l).some(([v, _]) => {
|
|
133
133
|
var B, H;
|
|
134
|
-
return
|
|
135
|
-
}),
|
|
136
|
-
S(
|
|
137
|
-
},
|
|
138
|
-
var
|
|
139
|
-
return (n == null ? void 0 : n.maxSelectMode) !== ue.Unlimited &&
|
|
134
|
+
return _.isSelected && ((H = (B = r.find((O) => `${O.id}` === v)) == null ? void 0 : B.optionProperties) == null ? void 0 : H.allowsTextEntry);
|
|
135
|
+
}), w = o && (!y || g), I = (v) => {
|
|
136
|
+
S(v.id, v.selected, v.userText, v.noneOfTheAbove);
|
|
137
|
+
}, k = (v) => {
|
|
138
|
+
var _;
|
|
139
|
+
return (n == null ? void 0 : n.maxSelectMode) !== ue.Unlimited && D(l) === (n == null ? void 0 : n.maxSelect) && !((_ = l[v]) != null && _.isSelected);
|
|
140
140
|
}, b = () => {
|
|
141
141
|
s(l, !0), d && d();
|
|
142
|
-
}, S = (
|
|
142
|
+
}, S = (v, _, B, H) => {
|
|
143
143
|
const O = Object.assign({}, l);
|
|
144
|
-
if ((y || H) &&
|
|
144
|
+
if ((y || H) && _) for (const Q of Object.values(O)) Q.isSelected = !1, delete Q.userText;
|
|
145
145
|
else p && !H && l[p.id].isSelected && (O[p.id].isSelected = !1);
|
|
146
|
-
O[
|
|
146
|
+
O[v] = { isSelected: _, userText: B }, u(O);
|
|
147
147
|
};
|
|
148
|
-
return e("form", { className: L(t, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: b, children: e(z, { properties: n, children: [e(W, { children: [n.isDropdown ? e(Xe, { disabledOptions: r.filter((
|
|
149
|
-
const
|
|
150
|
-
for (const B of r)
|
|
151
|
-
u(
|
|
152
|
-
}, options: r, placeholderText: n.dropdownPlaceholderText ?? (y ? "Select choice" : "Select choice(s)"), value: r.filter((
|
|
148
|
+
return e("form", { className: L(t, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: b, children: e(z, { properties: n, children: [e(W, { children: [n.isDropdown ? e(Xe, { disabledOptions: r.filter((v) => k(v.id)), dropdownFooter: R ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [D(l), "/", n.minSelect] }) : void 0, isMultiSelect: !y, multiselectText: n.dropdownMultiselectedText ?? "choices selected", onChange: (v) => {
|
|
149
|
+
const _ = { ...l };
|
|
150
|
+
for (const B of r) v.includes(B) ? _[B.id].isSelected = !0 : _[B.id].isSelected = !1;
|
|
151
|
+
u(_);
|
|
152
|
+
}, options: r, placeholderText: n.dropdownPlaceholderText ?? (y ? "Select choice" : "Select choice(s)"), value: r.filter((v) => l[v.id].isSelected) }) : e("div", { className: L(j("ul-card__choices", m)), role: y ? "radiogroup" : "group", children: [r.map(({ id: v, label: _, value: B, optionProperties: H }) => {
|
|
153
153
|
var G, ne;
|
|
154
|
-
const O = `${
|
|
155
|
-
return e(xe, { allowTextEntry: Q, border: c, disabled:
|
|
154
|
+
const O = `${v}`, { allowsTextEntry: Q, noneOfTheAbove: ee } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...H };
|
|
155
|
+
return e(xe, { allowTextEntry: Q, border: c, disabled: k(O), error: (Z = l, T(Z)), id: O, isRadio: y, isSelected: !!((G = l[O]) != null && G.isSelected), label: _, noneOfTheAbove: ee, onUserInputChanged: I, promptText: "Please specify", text: (ne = l[v]) == null ? void 0 : ne.userText, useMobileStyling: m, value: B }, O);
|
|
156
156
|
var Z;
|
|
157
|
-
}), !!
|
|
157
|
+
}), !!R && e("div", { className: "ul-card__min-select-counter", children: [D(l), "/", n.minSelect] })] }), w && e(We, { handleSubmit: b, isSubmitDisabled: f(l) })] }), e(re, { children: e(se, { isDisabled: f(l), onClick: b, children: J(n) }) })] }) }, a);
|
|
158
158
|
}, mt = (t) => {
|
|
159
159
|
const { questionId: s, type: r, next: n, options: a } = t;
|
|
160
160
|
return e(Me, { ...t, onSubmit: (i, o) => {
|
|
@@ -173,112 +173,112 @@ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
|
|
|
173
173
|
} });
|
|
174
174
|
}, vt = ({ className: t, labels: s, properties: r, next: n, questionId: a, type: i }) => {
|
|
175
175
|
const [o, d] = $(null), { border: c, useMobileStyling: m, viewDocument: h } = A((y) => ({ border: y.border, useMobileStyling: y.useMobileStyling, viewDocument: y.viewDocument })), l = s && s.left, u = s && s.right;
|
|
176
|
-
return e("form", { className: L(t, "ul-card--nps", "fade-in-transition"), children: e(z, { properties: r, children: [e(W, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((y,
|
|
177
|
-
p.preventDefault(), p.stopPropagation(), d(
|
|
176
|
+
return e("form", { className: L(t, "ul-card--nps", "fade-in-transition"), children: e(z, { properties: r, children: [e(W, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((y, x) => e("button", { className: L(j("nps-number", m), j(`nps-number-${x}`, m)), id: `option-${x}`, onClick: (p) => {
|
|
177
|
+
p.preventDefault(), p.stopPropagation(), d(x);
|
|
178
178
|
}, onKeyDown: (p) => {
|
|
179
|
-
var
|
|
180
|
-
const
|
|
181
|
-
p.key === "ArrowRight" ? (
|
|
179
|
+
var D, R;
|
|
180
|
+
const T = h.querySelectorAll("button.nps-number");
|
|
181
|
+
p.key === "ArrowRight" ? (D = T[x + 1]) == null || D.focus() : p.key === "ArrowLeft" ? (R = T[x - 1]) == null || R.focus() : p.key !== "Enter" && p.key !== " " || (p.preventDefault(), p.stopPropagation(), d(x));
|
|
182
182
|
}, onPointerDown: (p) => {
|
|
183
183
|
p.currentTarget.style.zIndex = "2", p.currentTarget.style.borderColor = c;
|
|
184
184
|
}, onPointerLeave: (p) => {
|
|
185
185
|
p.currentTarget.style.zIndex = "auto", p.currentTarget.style.borderColor = Te;
|
|
186
|
-
}, style: o ===
|
|
186
|
+
}, style: o === x ? { backgroundColor: c, color: "#fff" } : void 0, tabIndex: 0, children: x }, x)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: l }), e("span", { children: u })] })] }), e(re, { children: e(se, { isDisabled: o === null && r.required, onClick: () => n({ value: o, questionId: a, type: i }, !0), children: J(r) }) })] }) }, a);
|
|
187
187
|
}, gt = ({ className: t, next: s, properties: r, questionId: n, type: a, onSubmitButtonClick: i }) => {
|
|
188
|
-
const { border: o, useMobileStyling: d, update: c } = A((
|
|
189
|
-
return e("form", { className: L(t, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(z, { properties: r, children: e("div", { className: "ul-card-text", children: [e(W, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": p, className: L(j("ul-card-text__input", d)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (
|
|
190
|
-
|
|
191
|
-
}, onChange: (
|
|
192
|
-
const { value:
|
|
193
|
-
|
|
194
|
-
}, onFocus: (
|
|
195
|
-
|
|
196
|
-
}, placeholder: p, ref: l, role: "textbox", tabIndex: 0 }) }), r.footerHtml && e(ce, { className: "footer", html: r.footerHtml })] }), e(re, { children: e(se, { isDisabled: y, onClick: (
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
s({ value: m, questionId: n, type: a },
|
|
188
|
+
const { border: o, useMobileStyling: d, update: c } = A((T) => ({ border: T.border, useMobileStyling: T.useMobileStyling, update: T.update })), [m, h] = $(""), l = K(null), u = m.trim(), y = r.required === !0 && !u, x = Je(l, () => c()), p = r && r.openTextPlaceholder ? r.openTextPlaceholder : "";
|
|
189
|
+
return e("form", { className: L(t, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(z, { properties: r, children: e("div", { className: "ul-card-text", children: [e(W, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": p, className: L(j("ul-card-text__input", d)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (T) => {
|
|
190
|
+
T.currentTarget.style.borderColor = Te;
|
|
191
|
+
}, onChange: (T) => {
|
|
192
|
+
const { value: D } = T.currentTarget;
|
|
193
|
+
x(), T.preventDefault(), T.stopPropagation(), h(D);
|
|
194
|
+
}, onFocus: (T) => {
|
|
195
|
+
T.currentTarget.style.borderColor = o;
|
|
196
|
+
}, placeholder: p, ref: l, role: "textbox", tabIndex: 0 }) }), r.footerHtml && e(ce, { className: "footer", html: r.footerHtml })] }), e(re, { children: e(se, { isDisabled: y, onClick: (T) => {
|
|
197
|
+
T.preventDefault(), T.stopPropagation();
|
|
198
|
+
const D = r.required !== !0 || u.length > 0;
|
|
199
|
+
s({ value: m, questionId: n, type: a }, D), i && i();
|
|
200
200
|
}, children: J(r) }) })] }) }) }, n);
|
|
201
201
|
}, bt = ({ className: t, labels: s, next: r, properties: n, questionId: a, type: i, onSubmitButtonClick: o, options: d }) => {
|
|
202
|
-
const c = K(null), m = K(0), h = K(0), l = K(null), u = K(!1), y = K([]), [
|
|
203
|
-
|
|
204
|
-
const
|
|
202
|
+
const c = K(null), m = K(0), h = K(0), l = K(null), u = K(!1), y = K([]), [x, p] = $(() => (n == null ? void 0 : n.required) === !0), [T, D] = $(() => d.map((C) => ({ ...C, rank: null }))), R = oe(() => Array.from({ length: d.length }, (C, q) => q + 1), [d.length]), { useMobileStyling: f, isPreview: g, headers: w } = A((C) => ({ useMobileStyling: C.useMobileStyling, isPreview: C.isPreview, headers: C.headers })), I = (w == null ? void 0 : w["userleap-platform"]) === "android", k = f && !g && !I, b = !k && !I, S = (C, q) => {
|
|
203
|
+
D((P) => {
|
|
204
|
+
const N = parseInt(q), U = P.map((M) => ({ ...M }));
|
|
205
205
|
U.some((M) => M.rank == null) && U.forEach((M, ae) => M.rank = ae + 1);
|
|
206
|
-
const F = U.findIndex((M) => M.id ===
|
|
207
|
-
if (F === -1) return
|
|
206
|
+
const F = U.findIndex((M) => M.id === C);
|
|
207
|
+
if (F === -1) return P;
|
|
208
208
|
const E = U[F].rank;
|
|
209
|
-
return
|
|
210
|
-
M.id !==
|
|
211
|
-
}) :
|
|
212
|
-
M.id !==
|
|
213
|
-
}), U[F].rank =
|
|
209
|
+
return N < E ? U.forEach((M) => {
|
|
210
|
+
M.id !== C && M.rank >= N && M.rank < E && (M.rank = M.rank + 1);
|
|
211
|
+
}) : N > E && U.forEach((M) => {
|
|
212
|
+
M.id !== C && M.rank > E && M.rank <= N && (M.rank = M.rank - 1);
|
|
213
|
+
}), U[F].rank = N, U.sort((M, ae) => M.rank - ae.rank), ee(), U;
|
|
214
214
|
});
|
|
215
|
-
},
|
|
216
|
-
for (let
|
|
217
|
-
const
|
|
218
|
-
if (!
|
|
219
|
-
const U =
|
|
220
|
-
if (
|
|
215
|
+
}, v = (C, q) => {
|
|
216
|
+
for (let P = 0; P < y.current.length; P++) {
|
|
217
|
+
const N = y.current[P];
|
|
218
|
+
if (!N || N === l.current) continue;
|
|
219
|
+
const U = N.getBoundingClientRect();
|
|
220
|
+
if (C >= U.left && C <= U.right && q >= U.top && q <= U.bottom) return { element: N, index: P };
|
|
221
221
|
}
|
|
222
222
|
return null;
|
|
223
|
-
},
|
|
224
|
-
if (!
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
m.current =
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
}, B = (
|
|
231
|
-
if (!
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
h.current =
|
|
235
|
-
const
|
|
236
|
-
l.current && (l.current.style.transform = `translateY(${
|
|
223
|
+
}, _ = (C) => (q) => {
|
|
224
|
+
if (!k) return;
|
|
225
|
+
q.preventDefault(), q.stopPropagation(), u.current = !0, c.current = C;
|
|
226
|
+
const P = q.touches[0];
|
|
227
|
+
m.current = P.clientY, h.current = P.clientY;
|
|
228
|
+
const N = q.currentTarget.closest(".ul-card-rank__option");
|
|
229
|
+
N && (l.current = N, N.classList.add("is-dragging"));
|
|
230
|
+
}, B = (C) => {
|
|
231
|
+
if (!k || !u.current || c.current === null) return;
|
|
232
|
+
C.preventDefault(), C.stopPropagation();
|
|
233
|
+
const q = C.touches[0];
|
|
234
|
+
h.current = q.clientY;
|
|
235
|
+
const P = h.current - m.current;
|
|
236
|
+
l.current && (l.current.style.transform = `translateY(${P}px)`, l.current.style.zIndex = "1000"), y.current.forEach((U) => {
|
|
237
237
|
U && U !== l.current && U.classList.remove("is-drop-target");
|
|
238
238
|
});
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
}, H = (
|
|
242
|
-
if (!
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
l.current && (l.current.style.transform = "", l.current.style.zIndex = "", l.current.classList.remove("is-dragging")), y.current.forEach((
|
|
246
|
-
|
|
247
|
-
}),
|
|
248
|
-
}, O = (
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
return
|
|
239
|
+
const N = v(q.clientX, q.clientY);
|
|
240
|
+
N && N.element.classList.add("is-drop-target");
|
|
241
|
+
}, H = (C) => {
|
|
242
|
+
if (!k || !u.current || c.current === null) return;
|
|
243
|
+
C.preventDefault(), C.stopPropagation();
|
|
244
|
+
const q = C.changedTouches[0], P = v(q.clientX, q.clientY);
|
|
245
|
+
l.current && (l.current.style.transform = "", l.current.style.zIndex = "", l.current.classList.remove("is-dragging")), y.current.forEach((N) => {
|
|
246
|
+
N && N.classList.remove("is-drop-target");
|
|
247
|
+
}), P && P.index !== c.current && O(c.current, P.index), c.current = null, l.current = null, u.current = !1;
|
|
248
|
+
}, O = (C, q) => {
|
|
249
|
+
D((P) => {
|
|
250
|
+
const N = P.map((F) => ({ ...F })), [U] = N.splice(C, 1);
|
|
251
|
+
return N.splice(q, 0, U), N.forEach((F, E) => {
|
|
252
252
|
F.rank = E + 1;
|
|
253
|
-
}), ee(),
|
|
253
|
+
}), ee(), N;
|
|
254
254
|
});
|
|
255
|
-
}, Q = (
|
|
256
|
-
const
|
|
257
|
-
|
|
255
|
+
}, Q = (C) => {
|
|
256
|
+
const q = {};
|
|
257
|
+
C.reduce((P, N) => (P[N.id] = N.rank, P), q), r({ value: q, questionId: a, type: i }, !0);
|
|
258
258
|
}, ee = () => {
|
|
259
259
|
p(!1);
|
|
260
|
-
}, { left: Z, right: G } = s, ne = d.length, de = (
|
|
261
|
-
|
|
262
|
-
}, Ge = (
|
|
263
|
-
|
|
264
|
-
}, je = (
|
|
265
|
-
c.current = null,
|
|
260
|
+
}, { left: Z, right: G } = s, ne = d.length, de = (C) => {
|
|
261
|
+
C.preventDefault(), C.currentTarget.classList.add("is-drop-target");
|
|
262
|
+
}, Ge = (C) => {
|
|
263
|
+
C.currentTarget.classList.remove("is-drop-target");
|
|
264
|
+
}, je = (C) => {
|
|
265
|
+
c.current = null, C.currentTarget.classList.remove("is-dragging");
|
|
266
266
|
};
|
|
267
|
-
return e("form", { className: L(t, "ul-card-rank", "fade-in-transition"), onSubmit: (
|
|
268
|
-
|
|
269
|
-
}, children: e(z, { properties: n, children:
|
|
270
|
-
|
|
271
|
-
}, children:
|
|
272
|
-
return e("li", { className: "ul-card-rank__option", draggable: !!b || void 0, onDragEnd: b ? je : void 0, onDragEnter: b ? de : void 0, onDragLeave: b ? Ge : void 0, onDragStart: b ? (F =
|
|
267
|
+
return e("form", { className: L(t, "ul-card-rank", "fade-in-transition"), onSubmit: (C) => {
|
|
268
|
+
C.preventDefault(), Q(T), o && o();
|
|
269
|
+
}, children: e(z, { properties: n, children: I ? e(W, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", Z] }) }), e("ol", { className: "ul-card-rank__list", children: T.map(({ id: C, label: q, rank: P }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${q}`, className: L("ul-card-rank__select", P == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (N) => S(C, N.currentTarget.value), value: P ?? "", children: [P == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), R.map((N) => e("option", { className: "ul-card-rank__select-option", value: N, children: N }, `${N}-${a}`))] }), e("span", { children: q })] }, C)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", G] }) })] }) }) : e(ke, { children: [e(W, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", Z] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: I ? void 0 : (C) => {
|
|
270
|
+
C.preventDefault(), C.dataTransfer && (C.dataTransfer.dropEffect = "move");
|
|
271
|
+
}, children: T.map(({ id: C, label: q, rank: P }, N) => {
|
|
272
|
+
return e("li", { className: "ul-card-rank__option", draggable: !!b || void 0, onDragEnd: b ? je : void 0, onDragEnter: b ? de : void 0, onDragLeave: b ? Ge : void 0, onDragStart: b ? (F = N, (E) => {
|
|
273
273
|
c.current = F, E.dataTransfer && (E.dataTransfer.effectAllowed = "move", E.dataTransfer.setData("text/plain", String(F)), E.currentTarget.classList.add("is-dragging"));
|
|
274
|
-
}) : void 0, onDrop: b ? (U =
|
|
274
|
+
}) : void 0, onDrop: b ? (U = N, (E) => {
|
|
275
275
|
var ae, Ie;
|
|
276
276
|
E.preventDefault(), E.currentTarget.classList.remove("is-drop-target");
|
|
277
277
|
const M = c.current;
|
|
278
278
|
c.current = null, (Ie = (ae = E.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : ae.querySelector(".is-dragging")) == null || Ie.classList.remove("is-dragging"), M != null && M !== U && O(M, U);
|
|
279
|
-
}) : void 0, ref: (E) => y.current[
|
|
279
|
+
}) : void 0, ref: (E) => y.current[N] = E, children: [e("select", { "aria-label": `Rank for ${q}`, className: L("ul-card-rank__select", P == null && "ul-card-rank__select--placeholder"), name: `rank[${C}]`, onChange: (E) => S(C, E.currentTarget.value), value: P ?? "", children: [P == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), R.map((E) => e("option", { className: "ul-card-rank__select-option", value: E, children: E }, E))] }), e("span", { children: q }), !I && e("button", { "aria-label": `Drag ${q} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: k ? H : void 0, onTouchMove: k ? B : void 0, onTouchStart: k ? _(N) : 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);
|
|
280
280
|
var U, F;
|
|
281
|
-
}) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", G] }) })] }) }), e(re, { children: e("div", { className: "ul-card__button-wrapper", children: e(X, { disabled:
|
|
281
|
+
}) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", G] }) })] }) }), e(re, { children: e("div", { className: "ul-card__button-wrapper", children: e(X, { disabled: x, children: J(n) }) }) })] }) }) }, a);
|
|
282
282
|
}, ge = 1, Ue = 2, Ee = 3, pe = (t) => t.type === "av_permission", De = (t) => t.type === "screen_permission", Ae = (t, s) => t === void 0 ? ge : t ? ((r, n) => !(pe(n) ? n.permissionDescriptors : []).includes("camera") || r.getVideoTracks().length > 0)(t, s) ? Ee : ge : Ue, we = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
|
|
283
283
|
}, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, Y = Fe((t) => ({ ...we, reset: () => {
|
|
284
284
|
t(we);
|
|
@@ -383,25 +383,25 @@ const $e = "ul-permission-graphics-container", Be = "ul-permission-body", Oe = L
|
|
|
383
383
|
}, Nt = ({ className: t, properties: s, next: r, questionId: n }) => {
|
|
384
384
|
const a = A(), { surveyId: i, responseGroupUid: o, userId: d } = a, c = Y(), { screenPermissionRequested: m } = c, h = Y((p) => p.avStream);
|
|
385
385
|
let l = Y((p) => p.currentPage);
|
|
386
|
-
l || (l = function({ pages: p, userId:
|
|
387
|
-
const { updatePage:
|
|
386
|
+
l || (l = function({ pages: p, userId: T, responseGroupUid: D, surveyId: R, questionId: f, next: g }) {
|
|
387
|
+
const { updatePage: w } = Y.getState(), { eventEmitFn: I, recorderEventEmitter: k } = A.getState(), b = { questionId: f, surveyId: R, visitorId: T, responseGroupUid: D };
|
|
388
388
|
let S = 0;
|
|
389
|
-
|
|
389
|
+
k.emit("recorded.task.permission.screen"), I("recorded.task.permission.screen"), k.emit("permission.status", { "permission.status.callback": (_, B, H, O) => {
|
|
390
390
|
const Q = p[S], { type: ee } = Q, Z = ["screen"];
|
|
391
391
|
if (pe(Q)) {
|
|
392
392
|
const { permissionDescriptors: G } = Q, ne = G == null ? void 0 : G.includes("microphone"), de = G == null ? void 0 : G.includes("camera");
|
|
393
|
-
ne && Z.push("audio"), de && Z.push("video"), (
|
|
393
|
+
ne && Z.push("audio"), de && Z.push("video"), (_ != null && _.active && !de || _ != null && _.active && B) && S++;
|
|
394
394
|
}
|
|
395
|
-
De(p[S]) && H && (S++,
|
|
395
|
+
De(p[S]) && H && (S++, k.emit("begin.recording", { "recording.media.types": Z, "start.recording.callback": (G) => w({ mediaRecordingUids: G }) })), w({ currentPage: p[S], avStream: _, screenPermissionRequested: H, nextQuestion: g, type: ee, passthroughData: b, recordingMediaTypes: Z, captureStream: O });
|
|
396
396
|
} });
|
|
397
|
-
const
|
|
398
|
-
return
|
|
397
|
+
const v = p[S];
|
|
398
|
+
return v.type === "av_permission" && be({ currentPage: v, pages: p }), v;
|
|
399
399
|
}({ questionId: n, surveyId: i, next: (p) => {
|
|
400
400
|
r(p, !0);
|
|
401
401
|
}, pages: s.pages, responseGroupUid: o, userId: d }));
|
|
402
402
|
let u = l.headline, y = l.captionText;
|
|
403
|
-
const
|
|
404
|
-
return De(l) && m && (u = l.permissionDeniedHeadline, y = l.permissionDeniedCaptionText), pe(l) &&
|
|
403
|
+
const x = Ae(h, l);
|
|
404
|
+
return De(l) && m && (u = l.permissionDeniedHeadline, y = l.permissionDeniedCaptionText), pe(l) && x === Ee && (u = l.permissionGrantedHeadline, y = l.permissionGrantedCaptionText), e("div", { className: L(t, "ul-center-horizontally", "fade-in-transition"), children: [e(Ce, { isRequired: s == null ? void 0 : s.required, message: u, properties: { captionText: y } }), e(W, { children: e(St, { properties: s }) })] });
|
|
405
405
|
}, It = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
|
|
406
406
|
const { visitorAttributes: i, isLongFormSurvey: o } = A((h) => ({ visitorAttributes: h.visitorAttributes, isLongFormSurvey: Le(h.studyType) })), d = (h, l = !1) => {
|
|
407
407
|
s({ value: l ? { skipped: !0 } : void 0, questionId: n, type: a }, !0);
|
|
@@ -425,19 +425,19 @@ const $e = "ul-permission-graphics-container", Be = "ul-permission-body", Oe = L
|
|
|
425
425
|
const a = Math.round(Math.min(99, ...Object.values(s).filter((i) => i.isSubmitted).map((i) => i.progressPct || 0)));
|
|
426
426
|
return e("div", { className: L(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(Ce, { message: `${r} (${a}% complete)` }), e("p", { className: "ul-caption", children: n })] });
|
|
427
427
|
}, qe = 0, Pe = 1, Pt = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
|
|
428
|
-
const i = `ul-card-video__player_recorder-q${n}`, { apiURL: o, envId: d, handleUploadUpdate: c, headers: m, responseGroupUid: h, surveyId: l, viewDocument: u, visitorId: y } = A((b) => ({ apiURL: b.apiURL, envId: b.envId, handleUploadUpdate: b.handleUploadUpdate, headers: b.headers, responseGroupUid: b.responseGroupUid, surveyId: b.surveyId, viewDocument: b.viewDocument, visitorId: b.userId })), [
|
|
429
|
-
b === V.UPLOAD_STARTED ? (
|
|
430
|
-
},
|
|
431
|
-
b.preventDefault(), b.stopPropagation(), document.getElementById(i) && st(i),
|
|
428
|
+
const i = `ul-card-video__player_recorder-q${n}`, { apiURL: o, envId: d, handleUploadUpdate: c, headers: m, responseGroupUid: h, surveyId: l, viewDocument: u, visitorId: y } = A((b) => ({ apiURL: b.apiURL, envId: b.envId, handleUploadUpdate: b.handleUploadUpdate, headers: b.headers, responseGroupUid: b.responseGroupUid, surveyId: b.surveyId, viewDocument: b.viewDocument, visitorId: b.userId })), [x, p] = $(!1), [T, D] = $(null), [R, f] = $(null), [g, w] = $(qe), I = (b, S) => {
|
|
429
|
+
b === V.UPLOAD_STARTED ? (D(S[V.UPLOAD_ID]), f(S[V.MEDIA_RECORDING_UID]), p(!0)) : b === V.DELETE ? (D(null), f(null), p(!1)) : b === V.UPLOAD_PROGRESS ? isNaN(S[V.UPLOAD_PROGRESS_PCT]) ? c({ mediaRecordingUid: S[V.MEDIA_RECORDING_UID], isComplete: !0 }) : c({ mediaRecordingUid: S[V.MEDIA_RECORDING_UID], progressPct: S[V.UPLOAD_PROGRESS_PCT] }) : b === V.UPLOAD_FINISHED && c({ mediaRecordingUid: S[V.MEDIA_RECORDING_UID], isComplete: !0 });
|
|
430
|
+
}, k = (b) => {
|
|
431
|
+
b.preventDefault(), b.stopPropagation(), document.getElementById(i) && st(i), T && R ? (c({ mediaRecordingUid: R, isSubmitted: !0 }), s({ value: { mediaRecordingUid: R }, questionId: n, type: a }, !0)) : s({ value: null, questionId: n, type: a }, !0);
|
|
432
432
|
};
|
|
433
|
-
return e("form", { className: L(t, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(W, { children: [e("div", { id: "ul-question-player-container", style: { display:
|
|
434
|
-
b.preventDefault(), b.stopPropagation(), document.getElementById(i) && rt(i),
|
|
435
|
-
} }) }) }), e("div", { style: { display:
|
|
433
|
+
return e("form", { className: L(t, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(W, { children: [e("div", { id: "ul-question-player-container", style: { display: g === qe ? "" : "none" }, children: e(z, { properties: r, children: e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (b) => {
|
|
434
|
+
b.preventDefault(), b.stopPropagation(), document.getElementById(i) && rt(i), w(Pe);
|
|
435
|
+
} }) }) }), e("div", { style: { display: g === Pe ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (b) => {
|
|
436
436
|
if (b && b.children.length === 0) {
|
|
437
|
-
const S = nt(i, { surveyId: l, responseGroupUid: h, questionId: n, visitorId: y, envId: d }, o,
|
|
437
|
+
const S = nt(i, { surveyId: l, responseGroupUid: h, questionId: n, visitorId: y, envId: d }, o, I, void 0, { ...m, "x-ul-video-recorder-origin": "sdk" }, r.mediaType === V.MEDIA_TYPE_AUDIO, u);
|
|
438
438
|
b.appendChild(S);
|
|
439
439
|
}
|
|
440
|
-
} }) })] }), e(re, { children: [e(se, { isDisabled: !!r.required && !
|
|
440
|
+
} }) })] }), e(re, { children: [e(se, { isDisabled: !!r.required && !x, onClick: k, children: J(r) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: k, style: { ...r.required ? { display: "none" } : {}, ...x ? { display: "none" } : {} }, children: fe(r) })] })] });
|
|
441
441
|
}, Qe = (t) => t.type === "thanks" || t.type === "uploading", Rt = ({ card: t, avatars: s, isThinking: r, isCurrentQuestion: n, currentQuestionBubbleRef: a }) => {
|
|
442
442
|
const i = ((o) => "properties" in o.props && o.props.properties && "questionHtml" in o.props.properties && o.props.properties.questionHtml ? { content: o.props.properties.questionHtml, isHtml: !0 } : "message" in o.props ? { content: o.props.message, isHtml: !1 } : { content: "Question", isHtml: !1 })(t);
|
|
443
443
|
return e(ie, { avatars: s, isLeft: !0, message: { id: `question-${t.name}`, type: "question", content: i.content }, ref: n ? a : null, children: r ? e(wt, {}) : e(ke, { children: [i.isHtml ? e(ce, { className: "chat-message-text", html: i.content }) : e("div", { className: "chat-message-text", children: i.content }), t.type === "videovoice" && e(it, { properties: t.props, questionId: t.name, surveyVideoUrl: t.props.properties.videoUrl })] }) });
|
|
@@ -468,8 +468,8 @@ const $e = "ul-permission-graphics-container", Be = "ul-permission-body", Oe = L
|
|
|
468
468
|
}, Et = ({ card: t, cardIndex: s, index: r, avatars: n, cardResponses: a, questionThinkingStates: i, startingQuestionIdx: o, currentQuestionBubbleRef: d, handleCardResponse: c }) => {
|
|
469
469
|
const m = s === r, h = s < r, l = Qe(t);
|
|
470
470
|
if (l) return e(Ut, { avatars: n, card: t, currentQuestionBubbleRef: d, isCurrentQuestion: m });
|
|
471
|
-
const u = `${t.name}`, y = a.get(u),
|
|
472
|
-
return e(Re.Fragment, { children: [e(Rt, { avatars: n, card: t, currentQuestionBubbleRef: d, isCurrentQuestion: m, isThinking:
|
|
471
|
+
const u = `${t.name}`, y = a.get(u), x = t.type === "open", p = i.get(u), T = s > (o ?? 0) && t.type !== "thanks" && t.type !== "uploading" && (p === !0 || p === void 0);
|
|
472
|
+
return e(Re.Fragment, { children: [e(Rt, { avatars: n, card: t, currentQuestionBubbleRef: d, isCurrentQuestion: m, isThinking: T }), !T && e(Lt, { avatars: n, card: t }), h && x ? e(Mt, { avatars: n, card: t, userResponse: y }) : (!h || !x) && !T && e(ie, { avatars: n, isLeft: !1, message: { id: `card-${t.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e($t, { card: t, className: l ? "chat-thanks-card" : "chat-card", isAnswered: h, next: m ? c : () => {
|
|
473
473
|
} }) }) })] }, `question-card-${t.name}`);
|
|
474
474
|
}, ie = Re.forwardRef(({ message: t, isLeft: s = !1, children: r, avatars: n, hideAvatar: a = !1 }, i) => {
|
|
475
475
|
const o = s ? "chat-bubble-left" : "chat-bubble-right";
|
|
@@ -516,63 +516,63 @@ const At = () => {
|
|
|
516
516
|
}
|
|
517
517
|
}, Gt = ({ cards: t, next: s, previousResponses: r }) => {
|
|
518
518
|
const { cardResponses: n, setCardResponse: a } = (() => {
|
|
519
|
-
const [
|
|
520
|
-
return { cardResponses:
|
|
521
|
-
|
|
519
|
+
const [f, g] = $(/* @__PURE__ */ new Map());
|
|
520
|
+
return { cardResponses: f, setCardResponse: le((w, I) => {
|
|
521
|
+
g((k) => new Map(k).set(w, I));
|
|
522
522
|
}, []) };
|
|
523
|
-
})(), { index: i, isLongFormSurvey: o, avatars: d, startingQuestionIdx: c, viewDocument: m } = A((
|
|
524
|
-
const
|
|
525
|
-
const
|
|
526
|
-
if (
|
|
527
|
-
const
|
|
528
|
-
|
|
523
|
+
})(), { index: i, isLongFormSurvey: o, avatars: d, startingQuestionIdx: c, viewDocument: m, update: h } = A((f) => ({ index: f.index, isLongFormSurvey: Le(f.studyType), avatars: f.avatars, startingQuestionIdx: f.startingQuestionIdx, viewDocument: f.viewDocument, update: f.update })), { currentQuestionBubbleRef: l, scrollToCurrentQuestion: u } = (({ viewDocument: f }) => {
|
|
524
|
+
const g = K(null), w = le(() => {
|
|
525
|
+
const I = f.querySelector(".ul-card-main-content");
|
|
526
|
+
if (g.current && I && I instanceof HTMLElement) {
|
|
527
|
+
const k = g.current.offsetTop - I.offsetTop - 16;
|
|
528
|
+
I.scrollTo({ top: Math.max(0, k), behavior: "smooth" });
|
|
529
529
|
}
|
|
530
530
|
}, []);
|
|
531
|
-
return { currentQuestionBubbleRef:
|
|
532
|
-
})({ viewDocument: m }),
|
|
533
|
-
const [
|
|
531
|
+
return { currentQuestionBubbleRef: g, scrollToCurrentQuestion: w };
|
|
532
|
+
})({ viewDocument: m }), y = ((f, g, w) => {
|
|
533
|
+
const [I, k] = $(/* @__PURE__ */ new Map());
|
|
534
534
|
return te(() => {
|
|
535
|
-
if (
|
|
536
|
-
const
|
|
537
|
-
if (
|
|
538
|
-
|
|
539
|
-
const
|
|
540
|
-
|
|
535
|
+
if (f.length > 0 && g < f.length) {
|
|
536
|
+
const b = f[g], S = `${b.name}`;
|
|
537
|
+
if (g <= (w ?? 0) || Qe(b)) return void k((_) => new Map(_).set(S, !1));
|
|
538
|
+
k((_) => new Map(_).set(S, !0));
|
|
539
|
+
const v = setTimeout(() => {
|
|
540
|
+
k((_) => new Map(_).set(S, !1));
|
|
541
541
|
}, 1e3);
|
|
542
|
-
return () => clearTimeout(
|
|
542
|
+
return () => clearTimeout(v);
|
|
543
543
|
}
|
|
544
|
-
}, [
|
|
545
|
-
})(t, i, c),
|
|
546
|
-
const [
|
|
544
|
+
}, [g, f, w]), I;
|
|
545
|
+
})(t, i, c), x = ((f, g) => {
|
|
546
|
+
const [w, I] = $(/* @__PURE__ */ new Set([0]));
|
|
547
547
|
return te(() => {
|
|
548
|
-
|
|
549
|
-
}, [
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
-
const
|
|
553
|
-
for (let
|
|
554
|
-
return
|
|
548
|
+
I((k) => new Set(k).add(f));
|
|
549
|
+
}, [f]), te(() => {
|
|
550
|
+
const k = g ?? 0;
|
|
551
|
+
k > 0 && I((b) => {
|
|
552
|
+
const S = new Set(b);
|
|
553
|
+
for (let v = 0; v <= k; v++) S.add(v);
|
|
554
|
+
return S;
|
|
555
555
|
});
|
|
556
|
-
}, [
|
|
557
|
-
})(i, c),
|
|
558
|
-
var
|
|
559
|
-
return { ...
|
|
560
|
-
})) }), [r, n, t, i]),
|
|
556
|
+
}, [g]), w;
|
|
557
|
+
})(i, c), p = oe(() => ({ ...r, ...Ze(t.map((f, g) => {
|
|
558
|
+
var w, I;
|
|
559
|
+
return { ...f, value: g < i ? ((w = n.get(`${f.name}`)) == null ? void 0 : w.value) ?? null : null, secondaryValue: g < i ? ((I = n.get(`${f.name}`)) == null ? void 0 : I.secondaryValue) ?? null : null };
|
|
560
|
+
})) }), [r, n, t, i]), T = Ye(t, p);
|
|
561
561
|
te(() => {
|
|
562
562
|
requestAnimationFrame(() => {
|
|
563
|
-
|
|
564
|
-
});
|
|
565
|
-
}, [i,
|
|
566
|
-
const
|
|
567
|
-
if (!
|
|
568
|
-
const
|
|
569
|
-
if (!
|
|
570
|
-
const
|
|
571
|
-
a(
|
|
572
|
-
const
|
|
573
|
-
s([
|
|
574
|
-
}, [
|
|
575
|
-
return e("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!o && e(At, {}), e("div", { className: "chat-container", children: e("div", { className: "chat-messages", children:
|
|
563
|
+
u();
|
|
564
|
+
}), h();
|
|
565
|
+
}, [i, u, y, h]);
|
|
566
|
+
const D = le((f, g) => {
|
|
567
|
+
if (!g) return;
|
|
568
|
+
const w = T[i];
|
|
569
|
+
if (!w) return;
|
|
570
|
+
const I = `${w.name}`;
|
|
571
|
+
a(I, f);
|
|
572
|
+
const k = { ...f, questionText: ze(w) };
|
|
573
|
+
s([k]);
|
|
574
|
+
}, [T, i, s, a]), R = T.map((f, g) => ({ card: f, cardIndex: g })).filter(({ cardIndex: f }) => x.has(f));
|
|
575
|
+
return e("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!o && e(At, {}), e("div", { className: "chat-container", children: e("div", { className: "chat-messages", children: R.map(({ card: f, cardIndex: g }) => e(Et, { avatars: d, card: f, cardIndex: g, cardResponses: n, currentQuestionBubbleRef: l, handleCardResponse: D, index: i, questionThinkingStates: y, startingQuestionIdx: c }, `question-card-${f.name}`)) }) })] });
|
|
576
576
|
};
|
|
577
577
|
export {
|
|
578
578
|
Gt as default
|