@sprig-technologies/sprig-bundled 2.40.3 → 2.41.0
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-BXidfSdu.js → conversational-ui-BMaVlQM7.js} +604 -590
- package/dist/{conversational-ui-DUGOWcXj.cjs → conversational-ui-Dfwwfe2B.cjs} +2 -2
- package/dist/getAttributedUrl-BI712lA1.js +195 -0
- package/dist/getAttributedUrl-CuAx8r1V.cjs +12 -0
- package/dist/index-CEpl_fRY.cjs +1 -0
- package/dist/{index-B0SmBCWR.cjs → index-DZZhe9UA.cjs} +2 -2
- package/dist/{index-B-1ZVEfz.js → index-YBebm7NT.js} +3 -3
- package/dist/index-cT-GmgDY.js +712 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +64 -5
- package/dist/index.js +1 -1
- package/dist/view-BHOd3THT.js +1713 -0
- package/dist/view-Btk1gSAI.cjs +1 -0
- package/package.json +1 -1
- package/dist/getAttributedUrl-B28r1ayG.js +0 -188
- package/dist/getAttributedUrl-C_nBQU9-.cjs +0 -12
- package/dist/index-BM-ZKnlM.js +0 -658
- package/dist/index-DuLz6-LB.cjs +0 -1
- package/dist/view-CwyS6VJ8.js +0 -1494
- package/dist/view-IVflCEcd.cjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import { v as
|
|
3
|
-
import { B as oe, M as ie, Q as le, O as Oe, a as de, b as Ce, S as
|
|
4
|
-
const pe = "https://cdn.sprig.com",
|
|
1
|
+
import { u as G, a as e, h as Z, c as O, g as K, b as re, d as Me, p as ue, F as fe, _ as se, T as be, A as Cn, e as Be, f as xn, i as kn, j as ze, k as wn, l as En, S as jn, w as nn, m as In } from "./view-BHOd3THT.js";
|
|
2
|
+
import { v as Tn, E as Ie, h as qe, A as Ue, j as _n, i as tn } from "./index-YBebm7NT.js";
|
|
3
|
+
import { B as oe, M as ie, Q as le, O as Oe, a as de, b as Ce, S as Dn, L as Sn, u as Pn, H as ye, c as Ae, g as Ln, P as Rn } from "./getAttributedUrl-BI712lA1.js";
|
|
4
|
+
const pe = "https://cdn.sprig.com", j = { document: void 0, videojs: void 0 }, He = (n) => n + "-loading-spiner", W = "hidden", Ge = ".m3u8", Te = "questionId", _e = "ul-video-recorder-camera-off-button", De = "ul-recording-in-session", Nn = [{ type: "link", content: `${pe}/dependencies/videojs-record-4.5.0.min.css` }, { type: "script", content: `${pe}/dependencies/RecordRTC-5.6.2.js` }, { type: "script", content: `${pe}/dependencies/adapter.8.0.0.min.js` }, { type: "script", content: `${pe}/dependencies/videojs-record-4.5.0.min.js` }, { type: "script", content: `${pe}/userleap-web-upchunk-v2.2.2.js` }], rn = [{ type: "link", content: `${pe}/dependencies/video-js-7.18.0.min.css` }, { type: "script", content: `${pe}/dependencies/video-js-7.18.0.min.js` }, { type: "style", content: `/* progress control styles */
|
|
5
5
|
.video-js .vjs-control {
|
|
6
6
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
|
7
7
|
}
|
|
@@ -658,32 +658,32 @@ span.ul-button-text {
|
|
|
658
658
|
.vjs-poster {
|
|
659
659
|
background-size: cover;
|
|
660
660
|
}
|
|
661
|
-
` }],
|
|
662
|
-
let ne,
|
|
663
|
-
const ce = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, metadata:
|
|
664
|
-
const d =
|
|
661
|
+
` }], on = "-video-player", Ze = "-secondary-video-player", Qe = "-video-recorder";
|
|
662
|
+
let ne, Ye;
|
|
663
|
+
const ce = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, metadata: s }) => {
|
|
664
|
+
const d = j.document.documentElement;
|
|
665
665
|
if (!r || !i) return;
|
|
666
|
-
const u = { event: `SDK - ${n}`, visitorId: r, environmentId: i, metadata: { ...
|
|
666
|
+
const u = { event: `SDK - ${n}`, visitorId: r, environmentId: i, metadata: { ...s || {}, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: d.clientWidth, clientHeight: d.clientHeight, location: window.location.href, language: navigator.language } };
|
|
667
667
|
(await fetch(`${o}/sdk/1/visitors/${r}/analytics`, { method: "POST", cache: "no-cache", headers: t, body: JSON.stringify(u) })).ok || console.warn("[Sprig] (ERR-444) Failed to track analytics", n);
|
|
668
|
-
}, ae = async (n, o, t, r, i,
|
|
669
|
-
ce({ event: `Video Error ${o}`, apiBase: t, headers: r, visitorId: i, envId:
|
|
670
|
-
const d =
|
|
671
|
-
(await fetch(`${t}/sdk/1/errors`, { method: "POST", cache: "no-cache", headers: { ...r, "userleap-platform": "video_recorder", "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(
|
|
672
|
-
},
|
|
668
|
+
}, ae = async (n, o, t, r, i, s) => {
|
|
669
|
+
ce({ event: `Video Error ${o}`, apiBase: t, headers: r, visitorId: i, envId: s, metadata: { errorMessage: n.message } });
|
|
670
|
+
const d = j.document.documentElement, u = { screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: d.clientWidth, clientHeight: d.clientHeight, location: window.location.href, language: navigator.language }, a = { action: o, err: { message: n.message, stack: n.stack }, meta: u, vid: i, envId: s };
|
|
671
|
+
(await fetch(`${t}/sdk/1/errors`, { method: "POST", cache: "no-cache", headers: { ...r, "userleap-platform": "video_recorder", "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(a) })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", n);
|
|
672
|
+
}, sn = (n, o) => {
|
|
673
673
|
if (n.length === 0) return o && o();
|
|
674
|
-
Promise.all(n.reduce((t, r) => (t.push(((i, { type:
|
|
675
|
-
let
|
|
676
|
-
|
|
674
|
+
Promise.all(n.reduce((t, r) => (t.push(((i, { type: s, content: d }) => new Promise(function(u, a) {
|
|
675
|
+
let v;
|
|
676
|
+
s === "script" ? (v = j.document.createElement("script"), v.src = d) : s === "link" ? (v = j.document.createElement("link"), v.rel = "stylesheet", v.href = d, v.type = "text/css") : (v = j.document.createElement("style"), v.innerHTML = d), v.onload = function() {
|
|
677
677
|
u(d);
|
|
678
|
-
},
|
|
679
|
-
|
|
680
|
-
},
|
|
681
|
-
}))(
|
|
682
|
-
|
|
678
|
+
}, v.onerror = function() {
|
|
679
|
+
a(d);
|
|
680
|
+
}, v.async = !1, v.id = btoa(d), i.appendChild(v);
|
|
681
|
+
}))(j.document.head, r)), t), [])).then(() => {
|
|
682
|
+
j.videojs = j.document.defaultView.videojs, o && o();
|
|
683
683
|
}).catch(function(t) {
|
|
684
684
|
console.log(t + " failed to load");
|
|
685
685
|
});
|
|
686
|
-
},
|
|
686
|
+
}, We = (n, o, t) => {
|
|
687
687
|
if (o === "start" && (n.style.visibility = "visible"), o === "none") n.style.visibility = W;
|
|
688
688
|
else if (o === "success") n.style.visibility = W, n.innerHTML = "Upload succeeded!";
|
|
689
689
|
else {
|
|
@@ -691,14 +691,14 @@ const ce = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
|
|
|
691
691
|
n.innerHTML = `Uploading <span class="ul-upload-progress-label__time">${r}%</span>`, n.style.background = `linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`;
|
|
692
692
|
}
|
|
693
693
|
}, Se = (n, o) => {
|
|
694
|
-
const t =
|
|
694
|
+
const t = j.videojs(n.id());
|
|
695
695
|
return t == null ? void 0 : t.payload[o];
|
|
696
|
-
},
|
|
697
|
-
const t = new (
|
|
696
|
+
}, an = (n, o) => {
|
|
697
|
+
const t = new (j.videojs.getComponent("Component"))(n);
|
|
698
698
|
return t.addClass("ul-buttons-panel"), o.map((r) => {
|
|
699
699
|
t.addChild(r);
|
|
700
|
-
}),
|
|
701
|
-
},
|
|
700
|
+
}), Mn(t), t;
|
|
701
|
+
}, Mn = (n) => {
|
|
702
702
|
n.children().forEach((o) => {
|
|
703
703
|
if (X[o.name_]) {
|
|
704
704
|
const t = xe(X[o.name_], `ul-${X[o.name_]}`);
|
|
@@ -706,772 +706,786 @@ const ce = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, me
|
|
|
706
706
|
}
|
|
707
707
|
});
|
|
708
708
|
}, xe = (n, o = "") => {
|
|
709
|
-
const t =
|
|
709
|
+
const t = j.document.createElement("span");
|
|
710
710
|
return t.className = "ul-button-text", t.innerHTML = n, t.id = o, t;
|
|
711
|
-
},
|
|
711
|
+
}, ln = (n, o, t, r, i = !1, s) => {
|
|
712
712
|
n.addClass("ul-video-player");
|
|
713
|
-
const d = new (
|
|
714
|
-
d.addClass("ul-control-panel"), n.progressBar = d.addChild("ProgressControl"), t && n.src(t), n.audioPlayerPlaceholder = new (
|
|
715
|
-
const u = t && t.src ?
|
|
716
|
-
!t || !i && u ? (n.audioPlayerPlaceholder.hide(),
|
|
717
|
-
i || !t || u ||
|
|
713
|
+
const d = new (j.videojs.getComponent("Component"))(n);
|
|
714
|
+
d.addClass("ul-control-panel"), n.progressBar = d.addChild("ProgressControl"), t && n.src(t), n.audioPlayerPlaceholder = new (j.videojs.getComponent("Component"))(n), n.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");
|
|
715
|
+
const u = t && t.src ? On(t.src) : null;
|
|
716
|
+
!t || !i && u ? (n.audioPlayerPlaceholder.hide(), j.document.getElementById(`${n.id()}_html5_api`).style.height = "100%", u && n.poster(u)) : (n.children()[0].classList.add("vjs-hidden"), j.document.getElementById(`${n.id()}_html5_api`).style.height = "0px"), n.on("play", () => {
|
|
717
|
+
i || !t || u || qn(n), s == null || s.play();
|
|
718
718
|
}), n.on("pause", () => {
|
|
719
|
-
|
|
719
|
+
s == null || s.pause();
|
|
720
720
|
}), n.on("seeked", () => {
|
|
721
|
-
|
|
721
|
+
s == null || s.currentTime(n.currentTime());
|
|
722
722
|
}), n.on("ratechange", () => {
|
|
723
|
-
|
|
723
|
+
s == null || s.playbackRate(n.playbackRate());
|
|
724
724
|
}), n.addChild(n.audioPlayerPlaceholder, {}, 1), d.addChild(o), n.addChild(d), r && r(n);
|
|
725
|
-
},
|
|
726
|
-
|
|
727
|
-
const
|
|
728
|
-
if (!
|
|
729
|
-
|
|
730
|
-
const { surveyId:
|
|
725
|
+
}, Bn = (n, o, t, r, i, s, d, u = !1) => {
|
|
726
|
+
Ye = Date.now();
|
|
727
|
+
const a = ke(o, { controls: !1, bigPlayButton: !1, fluid: !1, width: 1280, height: 720, playsinline: !0, plugins: { record: { audio: !0, video: { mandatory: { minWidth: 1280, minHeight: 720 } }, frameWidth: 1280, frameHeight: 720, maxLength: 600, autoMuteDevice: !0 } } });
|
|
728
|
+
if (!a) return;
|
|
729
|
+
a.payload = t;
|
|
730
|
+
const { surveyId: v, questionId: y, responseGroupUid: c, visitorId: h, envId: k } = t;
|
|
731
731
|
let C;
|
|
732
|
-
const
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
const
|
|
736
|
-
l ? (
|
|
737
|
-
|
|
738
|
-
}), window.navigator.mediaDevices.getUserMedia({ video: !0, audio: !0 }).then((
|
|
739
|
-
C =
|
|
740
|
-
|
|
741
|
-
}),
|
|
742
|
-
}).catch(
|
|
743
|
-
|
|
744
|
-
}),
|
|
745
|
-
},
|
|
746
|
-
|
|
732
|
+
const g = (l) => {
|
|
733
|
+
const p = _e, x = _e + "-audio-only";
|
|
734
|
+
We(a.uploadProgressLabel, "none"), ne && ne.startTime >= Ye && ne.abort();
|
|
735
|
+
const P = j.document.getElementById("ul-camera-button");
|
|
736
|
+
l ? (a.children()[0].classList.add("vjs-hidden"), R.removeClass(p), R.addClass(x), P.innerHTML = X.TurnOnCamera, a.audioPlayerPlaceholder.removeClass("vjs-hidden"), C == null || C.getTracks().forEach((I) => {
|
|
737
|
+
I.stop();
|
|
738
|
+
}), window.navigator.mediaDevices.getUserMedia({ video: !0, audio: !0 }).then((I) => {
|
|
739
|
+
C = I, I.getVideoTracks().forEach((M) => {
|
|
740
|
+
M.enabled = !1;
|
|
741
|
+
}), a.record().onDeviceReady(I);
|
|
742
|
+
}).catch(a.record().onDeviceError.bind(a.record()))) : (C == null || C.getVideoTracks().forEach((I) => {
|
|
743
|
+
I.enabled = !0;
|
|
744
|
+
}), a.children()[0].classList.remove("vjs-hidden"), a.record().getDevice(), R.removeClass(x), R.addClass(p), P.innerHTML = X.TurnOffCamera, a.audioPlayerPlaceholder.addClass("vjs-hidden"));
|
|
745
|
+
}, f = new (j.videojs.getComponent("Button"))(a, { clickHandler: () => {
|
|
746
|
+
f.hasClass(W) || (ce({ event: "Video Delete Button Clicked", apiBase: r, headers: d, visitorId: h, envId: k, metadata: { questionId: y, responseGroupUid: c, surveyId: v } }), g(a.cameraOff), i(L.DELETE, {}), R.removeClass(W), f.addClass(W));
|
|
747
747
|
} });
|
|
748
|
-
|
|
749
|
-
const _ =
|
|
750
|
-
_.classList.contains("vjs-fullscreen") &&
|
|
748
|
+
f.addClass("ul-video-recorder-delete-button"), f.el_.appendChild(xe(X.DeleteButton, "ul-delete-button"));
|
|
749
|
+
const _ = j.document.getElementById(o), N = () => {
|
|
750
|
+
_.classList.contains("vjs-fullscreen") && a.cameraOff ? _.style.display = "table" : _.style.display = "flex";
|
|
751
751
|
};
|
|
752
|
-
|
|
753
|
-
const
|
|
754
|
-
|
|
752
|
+
N();
|
|
753
|
+
const R = new (j.videojs.getComponent("Button"))(a, { clickHandler: () => {
|
|
754
|
+
a.record().isRecording() || (a.cameraOff = !a.cameraOff, ce({ event: "Video Camera Button Clicked", apiBase: r, headers: d, visitorId: t.visitorId, envId: t.envId, metadata: { questionId: y, responseGroupUid: c, surveyId: v, cameraOff: a.cameraOff } }), g(a.cameraOff), !f.hasClass(W) && f.addClass(W), i(L.DELETE, {}), N());
|
|
755
755
|
} });
|
|
756
|
-
|
|
757
|
-
const
|
|
758
|
-
const l =
|
|
759
|
-
if (
|
|
756
|
+
R.addClass(_e), R.el_.appendChild(xe(X.TurnOffCamera, "ul-camera-button"));
|
|
757
|
+
const T = new (j.videojs.getComponent("Button"))(a, { clickHandler: () => {
|
|
758
|
+
const l = j.document.getElementById("ul-recorder-toggle");
|
|
759
|
+
if (a.record().isRecording()) a.record().stop(), l && (l.innerHTML = X.RecordButton), T.removeClass(De), f.removeClass(W);
|
|
760
760
|
else {
|
|
761
|
-
const
|
|
762
|
-
if (
|
|
761
|
+
const p = j.document.getElementById("ul-recording-countdown-screen");
|
|
762
|
+
if (p) p.remove(), l && (l.innerHTML = X.RecordButton), g(a.cameraOff), i(L.DELETE, {}), R.removeClass(W), f.addClass(W), T.removeClass(De), m.show();
|
|
763
763
|
else {
|
|
764
|
-
|
|
765
|
-
const
|
|
766
|
-
|
|
764
|
+
T.addClass(De), m.hide(), R.addClass(W), f.addClass(W), l && (l.innerHTML = X.StopButton);
|
|
765
|
+
const x = j.document.createElement("div");
|
|
766
|
+
x.id = "ul-recording-countdown-screen", _.insertBefore(x, _.children[1]), x.style.height = `${_.offsetHeight}px`, dn(a, 3);
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
769
|
} });
|
|
770
|
-
|
|
771
|
-
const
|
|
772
|
-
|
|
773
|
-
const
|
|
774
|
-
|
|
775
|
-
const
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
}),
|
|
779
|
-
|
|
780
|
-
}), ((l,
|
|
781
|
-
const { surveyId:
|
|
770
|
+
T.addClass("ul-video-recorder-toggle-button"), T.el_.appendChild(xe(X.RecordButton, "ul-recorder-toggle"));
|
|
771
|
+
const $ = j.document.createElement("p");
|
|
772
|
+
$.style.visibility = "hidden", $.className = "ul-upload-progress-label", n.appendChild($), a.uploadProgressLabel = $;
|
|
773
|
+
const A = an(a, [f, R, "PlayToggle", T, "FullscreenToggle"]), m = A.children().find((l) => l.name_ === "FullscreenToggle");
|
|
774
|
+
m.hasClass("vjs-disabled") && m.hide();
|
|
775
|
+
const b = A.children().find((l) => l.name_ === "PlayToggle");
|
|
776
|
+
b.hide(), f.addClass(W), ln(a, A, s, !1, u), a.on("stopRecord", () => {
|
|
777
|
+
T.hide(), b.show(), m.show(), f.removeClass(W);
|
|
778
|
+
}), a.on("deviceReady", () => {
|
|
779
|
+
T.show(), b.hide(), f.addClass(W);
|
|
780
|
+
}), ((l, p, x, P, I) => {
|
|
781
|
+
const { surveyId: M, responseGroupUid: H, visitorId: U, envId: q } = l.payload;
|
|
782
782
|
l.on("deviceError", function() {
|
|
783
|
-
console.warn("device error: ", l.deviceErrorCode), l.deviceErrorCode.message === "Permission denied" ? (l.deviceButton.addClass("permission-denied"),
|
|
784
|
-
}), l.on("error", function(
|
|
785
|
-
ae(Y || l.error(), "recorderError",
|
|
786
|
-
}), l.on("startRecord", function(
|
|
787
|
-
|
|
783
|
+
console.warn("device error: ", l.deviceErrorCode), l.deviceErrorCode.message === "Permission denied" ? (l.deviceButton.addClass("permission-denied"), x && x(L.ERROR, { type: L.PERMISSION_DENIED }), ce({ event: "Video Permission Denied", apiBase: p, headers: I, visitorId: U, envId: q, metadata: { questionId: Se(l, Te), responseGroupUid: H, surveyId: M } })) : (x && x(L.ERROR, { type: L.OTHER }), ae(new Error(l.deviceErrorCode.message), "recorderDeviceError", p, I, U, q));
|
|
784
|
+
}), l.on("error", function(Q, Y) {
|
|
785
|
+
ae(Y || l.error(), "recorderError", p, I, U, q);
|
|
786
|
+
}), l.on("startRecord", function(Q, Y) {
|
|
787
|
+
P(l.uploadProgressLabel, "none"), ce({ event: "Video Record Start", apiBase: p, headers: I, visitorId: U, envId: q, metadata: { questionId: Se(l, Te), responseGroupUid: H, surveyId: M } });
|
|
788
788
|
}), l.on("finishRecord", async function() {
|
|
789
|
-
|
|
790
|
-
const
|
|
791
|
-
if (!
|
|
792
|
-
const
|
|
793
|
-
return
|
|
789
|
+
P(l.uploadProgressLabel, "start", 0);
|
|
790
|
+
const Q = Se(l, Te);
|
|
791
|
+
if (!M) {
|
|
792
|
+
const D = "internal error: missing fields in payload";
|
|
793
|
+
return x && x(L.ERROR, { type: L.OTHER }), ae(new Error(D), "finishRecord", p, I, U, q), null;
|
|
794
794
|
}
|
|
795
795
|
l.record().stopDevice();
|
|
796
|
-
const Y = l.cameraOff ? L.MEDIA_TYPE_AUDIO : L.MEDIA_TYPE_VIDEO, ee =
|
|
797
|
-
ce({ event: "Video Record Finish", apiBase:
|
|
798
|
-
const me = { surveyId:
|
|
799
|
-
|
|
796
|
+
const Y = l.cameraOff ? L.MEDIA_TYPE_AUDIO : L.MEDIA_TYPE_VIDEO, ee = Tn();
|
|
797
|
+
ce({ event: "Video Record Finish", apiBase: p, headers: I, visitorId: U, envId: q, metadata: { mediaRecordingUid: ee, questionId: Q, responseGroupUid: H, surveyId: M, mediaType: Y } });
|
|
798
|
+
const me = { surveyId: M, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), mediaType: Y, mediaRecordingUid: ee };
|
|
799
|
+
Q && (me.questionId = Q), H && (me.responseGroupUid = H), U && (me.visitorId = U);
|
|
800
800
|
const E = await (async () => {
|
|
801
|
-
const
|
|
802
|
-
if (
|
|
803
|
-
const B = await
|
|
804
|
-
return
|
|
801
|
+
const D = await fetch(`${p}/2/environments/integrations/upload`, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(me) });
|
|
802
|
+
if (D.ok) {
|
|
803
|
+
const B = await D.json();
|
|
804
|
+
return x && x(L.UPLOAD_STARTED, { [L.UPLOAD_ID]: B.upload.id, [L.MEDIA_TYPE]: Y, [L.MEDIA_RECORDING_UID]: ee }), B.upload.url;
|
|
805
805
|
}
|
|
806
|
-
return
|
|
806
|
+
return x && x(L.ERROR, { type: L.OTHER, response: D }), ae(new Error("failed to get upload response with url"), "finishRecord", p, I, U, q), null;
|
|
807
807
|
})();
|
|
808
|
-
E && (ne =
|
|
809
|
-
|
|
810
|
-
}), ne.on("progress", (
|
|
811
|
-
|
|
808
|
+
E && (ne = j.document.defaultView.UpChunk.createUpload({ endpoint: E, file: new j.document.defaultView.File([l.recordedData], `recording ${Y} ${Date.now()}`), chunkSize: 5120 }), ne.startTime = Date.now(), ce({ event: "Video Upload Start", apiBase: p, headers: I, visitorId: U, envId: q, metadata: { mediaRecordingUid: ee, questionId: Q, responseGroupUid: H, surveyId: M, mediaType: Y, url: E } }), ne.on("error", (D) => {
|
|
809
|
+
P(l.uploadProgressLabel, "none"), x && x(L.UPLOAD_FINISHED, { [L.MEDIA_RECORDING_UID]: ee }), ae(D, "finishRecord", p, I, U, q);
|
|
810
|
+
}), ne.on("progress", (D) => {
|
|
811
|
+
x && x(L.UPLOAD_PROGRESS, { [L.MEDIA_RECORDING_UID]: ee, [L.UPLOAD_PROGRESS_PCT]: D.detail }), P(l.uploadProgressLabel, "progress", D.detail);
|
|
812
812
|
}), ne.on("success", () => {
|
|
813
|
-
|
|
813
|
+
P(l.uploadProgressLabel, "success"), x && x(L.UPLOAD_FINISHED, { [L.MEDIA_RECORDING_UID]: ee }), ce({ event: "Video Upload Success", apiBase: p, headers: I, visitorId: U, envId: q, metadata: { mediaRecordingUid: ee, questionId: Q, responseGroupUid: H, surveyId: M, mediaType: Y, url: E, elapsedMs: ne.startTime && Date.now() - ne.startTime } });
|
|
814
814
|
}));
|
|
815
815
|
});
|
|
816
|
-
})(
|
|
817
|
-
const
|
|
818
|
-
!
|
|
819
|
-
var
|
|
820
|
-
return (
|
|
816
|
+
})(a, r, i, We, d);
|
|
817
|
+
const w = [{ name: "microphone" }];
|
|
818
|
+
!a.cameraOff && w.push({ name: "camera" }), Promise.all(w.map((l) => {
|
|
819
|
+
var p;
|
|
820
|
+
return (p = navigator == null ? void 0 : navigator.permissions) == null ? void 0 : p.query(l);
|
|
821
821
|
})).then((l) => {
|
|
822
|
-
l.reduce((
|
|
822
|
+
l.reduce((p, x) => p & x.state === "granted", !0) && a && (a.deviceButton && a.deviceButton.hide(), a.record().getDevice());
|
|
823
823
|
}).catch((l) => {
|
|
824
824
|
});
|
|
825
|
-
},
|
|
826
|
-
const t =
|
|
825
|
+
}, dn = (n, o = 3) => {
|
|
826
|
+
const t = j.document.getElementById("ul-recording-countdown-screen");
|
|
827
827
|
t && o === 0 ? (t.remove(), n.record().start()) : t && (t.innerHTML = `<span class='ul-countdown-text'>Recording in... ${o}</span>`, setTimeout(() => {
|
|
828
|
-
|
|
828
|
+
dn(n, o - 1);
|
|
829
829
|
}, 1e3));
|
|
830
|
-
},
|
|
831
|
-
const o =
|
|
830
|
+
}, cn = (n) => {
|
|
831
|
+
const o = j.document.createElement("div");
|
|
832
832
|
return o.className = "ul-video-container", o.appendChild(((t) => {
|
|
833
|
-
const r =
|
|
833
|
+
const r = j.document.createElement("div");
|
|
834
834
|
return r.className = "ul-video-player-loading", r.id = He(t), ["first", "second", "third", "fourth"].map((i) => {
|
|
835
|
-
const
|
|
836
|
-
|
|
835
|
+
const s = j.document.createElement("div");
|
|
836
|
+
s.className = i, r.appendChild(s);
|
|
837
837
|
}), r;
|
|
838
838
|
})(n)), o;
|
|
839
839
|
}, Pe = (n, o) => {
|
|
840
|
-
const t =
|
|
840
|
+
const t = j.document.createElement("video");
|
|
841
841
|
t.id = n, t.className = "video-js vjs-default-skin ul-video-player-video";
|
|
842
|
-
const r =
|
|
842
|
+
const r = j.document.createElement("p");
|
|
843
843
|
r.className = "vjs-no-js", r.innerHTML = "To view this video please enable JavaScript, and consider upgrading to a web browser that";
|
|
844
|
-
const i =
|
|
844
|
+
const i = j.document.createElement("a");
|
|
845
845
|
return i.href = "https://videojs.com/html5-video-support/", i.target = "_blank", i.innerHTML = "supports HTML5 video", r.appendChild(i), t.appendChild(r), o.appendChild(t), o;
|
|
846
|
-
},
|
|
847
|
-
n.children()[0].classList.remove("vjs-hidden"), n.audioPlayerPlaceholder.hide(),
|
|
848
|
-
}, ke = (n, o) =>
|
|
849
|
-
|
|
850
|
-
const
|
|
851
|
-
return
|
|
852
|
-
ae(new Error(`Voice & Video feature violates ${
|
|
853
|
-
}),
|
|
854
|
-
|
|
855
|
-
const
|
|
846
|
+
}, qn = (n, o) => {
|
|
847
|
+
n.children()[0].classList.remove("vjs-hidden"), n.audioPlayerPlaceholder.hide(), j.document.getElementById(`${n.id()}_html5_api`).style.height = "100%";
|
|
848
|
+
}, ke = (n, o) => j.document.getElementById(n) ? o ? j.videojs(n, o) : j.videojs(n) : (console.error(`Error in finding player element with ID, ${n}`), null), Un = (n, o, t, r = !1, i = "https://api.sprig.com", s = document, d = null, u = null) => {
|
|
849
|
+
j.document = s;
|
|
850
|
+
const a = n + on, v = cn(a);
|
|
851
|
+
return j.document.addEventListener("securitypolicyviolation", (y) => {
|
|
852
|
+
ae(new Error(`Voice & Video feature violates ${y.violatedDirective} web page CSP policies for the question player.`), "playerDeviceError", i, {});
|
|
853
|
+
}), sn(rn, () => {
|
|
854
|
+
j.document.getElementById(He(a)).remove(), Pe(a, v);
|
|
855
|
+
const y = { playsinline: !0, playbackRates: [0.5, 1, 1.5, 2], fill: !0 };
|
|
856
856
|
try {
|
|
857
|
-
const c = n +
|
|
858
|
-
Pe(c,
|
|
859
|
-
const
|
|
860
|
-
if (!
|
|
861
|
-
((
|
|
862
|
-
|
|
863
|
-
const
|
|
864
|
-
_ &&
|
|
865
|
-
})(
|
|
866
|
-
const C =
|
|
867
|
-
|
|
857
|
+
const c = n + Ze;
|
|
858
|
+
Pe(c, v);
|
|
859
|
+
const h = ke(a, y), k = ke(c, { muted: !0, ...y });
|
|
860
|
+
if (!h || !k) return;
|
|
861
|
+
((f, _, N) => {
|
|
862
|
+
f.addClass(`ul${Ze}`);
|
|
863
|
+
const R = new (j.videojs.getComponent("Component"))(f);
|
|
864
|
+
_ && f.src(_), f.addChild(R), N && N(f);
|
|
865
|
+
})(k, d, u), d || k.addClass(W);
|
|
866
|
+
const C = an(h, ["PlaybackRateMenuButton", "PlayToggle", "FullscreenToggle"]), g = C.children().find((f) => f.name_ === "FullscreenToggle");
|
|
867
|
+
g.hasClass("vjs-disabled") && g.hide(), ln(h, C, o, t, r, k);
|
|
868
868
|
} catch (c) {
|
|
869
869
|
return void ae(new Error(`Error when creating video player object ${c}`), "playerDeviceError", i, {});
|
|
870
870
|
}
|
|
871
|
-
}),
|
|
872
|
-
},
|
|
871
|
+
}), v;
|
|
872
|
+
}, On = (n) => {
|
|
873
873
|
if (!n) return null;
|
|
874
874
|
const o = n.match(/https:\/\/stream.mux.com\/(.*)/);
|
|
875
875
|
let t = o ? o[1] : null;
|
|
876
|
-
return t.includes(
|
|
877
|
-
}, L = { UPLOAD_STARTED: "upload.started", UPLOAD_PROGRESS: "upload.progress", UPLOAD_FINISHED: "upload.finished", DELETE: "delete", ERROR: "error", MEDIA_TYPE: "media.type", PERMISSION_DENIED: "permission_denied", OTHER: "other", UPLOAD_ID: "upload.id", UPLOAD_PROGRESS_PCT: "upload.progress.pct", MEDIA_RECORDING_UID: "media.recording.uid", MEDIA_TYPE_VIDEO: "video", MEDIA_TYPE_AUDIO: "audio" }, X = { PlaybackRateMenuButton: "Speed", PlayToggle: "Play", FullscreenToggle: "Expand", TurnOnCamera: "Turn on", TurnOffCamera: "Turn off", DeleteButton: "Delete", RecordButton: "Record", StopButton: "Stop", PauseButton: "Pause" },
|
|
878
|
-
const r = `ul-card-video__question_player-q${t}`, { apiURL: i, viewDocument:
|
|
876
|
+
return t.includes(Ge) && (t = t.replace(Ge, "")), t ? `https://image.mux.com/${t}/thumbnail.jpg?time=0` : null;
|
|
877
|
+
}, L = { UPLOAD_STARTED: "upload.started", UPLOAD_PROGRESS: "upload.progress", UPLOAD_FINISHED: "upload.finished", DELETE: "delete", ERROR: "error", MEDIA_TYPE: "media.type", PERMISSION_DENIED: "permission_denied", OTHER: "other", UPLOAD_ID: "upload.id", UPLOAD_PROGRESS_PCT: "upload.progress.pct", MEDIA_RECORDING_UID: "media.recording.uid", MEDIA_TYPE_VIDEO: "video", MEDIA_TYPE_AUDIO: "audio" }, X = { PlaybackRateMenuButton: "Speed", PlayToggle: "Play", FullscreenToggle: "Expand", TurnOnCamera: "Turn on", TurnOffCamera: "Turn off", DeleteButton: "Delete", RecordButton: "Record", StopButton: "Stop", PauseButton: "Pause" }, An = ({ properties: n, surveyVideoUrl: o, questionId: t }) => {
|
|
878
|
+
const r = `ul-card-video__question_player-q${t}`, { apiURL: i, viewDocument: s } = G((d) => ({ apiURL: d.apiURL, viewDocument: d.viewDocument }));
|
|
879
879
|
return e("div", { id: r, ref: (d) => {
|
|
880
880
|
if (d && d.children.length === 0 && !n.properties.hideRecordedPrompt) {
|
|
881
|
-
const u =
|
|
881
|
+
const u = Un(r, { src: o, type: "application/x-mpegURL" }, void 0, n.properties.mediaType === L.MEDIA_TYPE_AUDIO, i, s);
|
|
882
882
|
d.appendChild(u);
|
|
883
883
|
}
|
|
884
884
|
} });
|
|
885
|
-
}, ve = ({ isDisabled: n, onClick: o, children: t }) => e(oe, { className: "ul-card__button-checkmark", disabled: n, onClick: o, 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" }) }), t || "Ok"] }),
|
|
886
|
-
const { useMobileStyling:
|
|
887
|
-
|
|
888
|
-
let
|
|
889
|
-
if (
|
|
890
|
-
if (!
|
|
891
|
-
|
|
885
|
+
}, ve = ({ isDisabled: n, onClick: o, children: t }) => e(oe, { className: "ul-card__button-checkmark", disabled: n, onClick: o, 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" }) }), t || "Ok"] }), Hn = ({ className: n, next: o, properties: t, questionId: r, type: i }) => {
|
|
886
|
+
const { useMobileStyling: s, border: d } = G((T) => ({ useMobileStyling: T.useMobileStyling, border: T.border })), [u, a] = Z(!1), [v, y] = Z(""), [c, h] = Z(!1), k = t == null ? void 0 : t.collectName, C = (t == null ? void 0 : t.nameLabelText) || "Full Name", g = (t == null ? void 0 : t.consentText) || "I agree to the stated conditions", f = (t == null ? void 0 : t.submitButtonText) || "Submit", _ = !!v.trim(), N = u && (!k || _), R = (T, $ = !1) => {
|
|
887
|
+
T.preventDefault(), T.stopPropagation();
|
|
888
|
+
let A = null;
|
|
889
|
+
if (!$) {
|
|
890
|
+
if (!N) return void h(!0);
|
|
891
|
+
A = { submitted: !0 }, k && (A.name = v);
|
|
892
892
|
}
|
|
893
|
-
o({ value:
|
|
893
|
+
o({ value: A, questionId: r, type: i }, !!$ || N);
|
|
894
894
|
};
|
|
895
|
-
return e("div", { className:
|
|
896
|
-
|
|
897
|
-
}, useMobileStyling:
|
|
898
|
-
|
|
899
|
-
}, onFocus: (
|
|
900
|
-
|
|
901
|
-
}, onInput: (
|
|
902
|
-
|
|
903
|
-
}, placeholder: C, style: c && !_ ? { borderColor: Ie } : {}, tabIndex: 0, value:
|
|
904
|
-
},
|
|
905
|
-
const { destroy: n, forceBrandedLogo: o } =
|
|
895
|
+
return e("div", { className: O(n, "ul-card__consent-legal", "fade-in-transition"), children: e(ie, { embeddedType: "pdf", properties: t, children: e(le, { children: [e("div", { className: "sprig-stretch", children: [e(Oe, { allowTextEntry: !1, border: d, error: c && !u, id: "consent", isRadio: !1, isSelected: u, label: g, onUserInputChanged: ({ selected: T }) => {
|
|
896
|
+
T !== u && a(!u);
|
|
897
|
+
}, useMobileStyling: s }), k && e("input", { "aria-label": C, "aria-placeholder": C, className: O(K("ul-consent-legal__name-input", s)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (T) => {
|
|
898
|
+
T.currentTarget.style.borderColor = c && !_ ? Ie : qe;
|
|
899
|
+
}, onFocus: (T) => {
|
|
900
|
+
T.currentTarget.style.borderColor = c && !_ ? Ie : d;
|
|
901
|
+
}, onInput: (T) => {
|
|
902
|
+
T.preventDefault(), T.stopPropagation(), y(T.currentTarget.value);
|
|
903
|
+
}, placeholder: C, style: c && !_ ? { borderColor: Ie } : {}, tabIndex: 0, value: v })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(ve, { isDisabled: !N, onClick: (T) => R(new SubmitEvent(T.type)), children: re({ buttonText: f }) }), t.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (T) => R(new SubmitEvent(T.type), !0), children: Me(t) })] })] }) }) }, r);
|
|
904
|
+
}, $n = () => {
|
|
905
|
+
const { destroy: n, forceBrandedLogo: o } = G((t) => ({ destroy: t.destroy, forceBrandedLogo: t.forceBrandedLogo }));
|
|
906
906
|
return ue(() => {
|
|
907
907
|
setTimeout(() => {
|
|
908
908
|
n(Ue);
|
|
909
909
|
}, o ? 4e3 : 2e3);
|
|
910
910
|
}, [n, o]), e("div", { className: "end-of-survey-text", children: "End of survey" });
|
|
911
|
-
},
|
|
912
|
-
const C = `option-${
|
|
913
|
-
const
|
|
914
|
-
return
|
|
915
|
-
})(),
|
|
916
|
-
const
|
|
917
|
-
return
|
|
918
|
-
}, [
|
|
919
|
-
if (
|
|
920
|
-
let
|
|
921
|
-
return
|
|
911
|
+
}, Vn = ({ activeValue: n, border: o, icon: t, enableCspTrustedTypes: r, isPressed: i, range: s, scaleLabelType: d, selectedValue: u, setSelectedValue: a, setActiveValue: v, setIsPressed: y, useMobileStyling: c, value: h, viewDocument: k }) => {
|
|
912
|
+
const C = `option-${h}`, g = d === "number", f = d === "star", _ = d === "smiley", N = g && h === n || h === u, [R, T] = (() => {
|
|
913
|
+
const m = f && u !== null && h <= u;
|
|
914
|
+
return f && h <= n || _ && h === n || m || h === n || h === u ? [o, i || m || h === u ? 1 : 0.3] : ["", 1];
|
|
915
|
+
})(), $ = fe(() => {
|
|
916
|
+
const m = { borderColor: N ? R : "", fillOpacity: N ? "" : T, zIndex: N ? 3 : "auto", color: u === h ? "#fff" : "" };
|
|
917
|
+
return g ? { ...m, backgroundColor: u === h ? R : "" } : { ...m, color: f || _ || u === h ? R : "" };
|
|
918
|
+
}, [N, R, T, u, h, g, f, _]), A = fe(() => _n((({ icon: m, scaleLabelType: b, value: w, selectedValue: l }) => {
|
|
919
|
+
if (b === "smiley" && w === l) {
|
|
920
|
+
let p = 0;
|
|
921
|
+
return m.replace(/black/g, () => ++p == 1 ? "black" : "white");
|
|
922
922
|
}
|
|
923
|
-
return
|
|
924
|
-
})({ icon: t, scaleLabelType: d, value:
|
|
925
|
-
return e("button", { "aria-label":
|
|
923
|
+
return m;
|
|
924
|
+
})({ icon: t, scaleLabelType: d, value: h, selectedValue: u }), r), [r, t, d, u, h]);
|
|
925
|
+
return e("button", { "aria-label": g ? void 0 : String(h), className: (() => {
|
|
926
926
|
switch (d) {
|
|
927
927
|
case "star":
|
|
928
|
-
return
|
|
928
|
+
return O(K("likert-star", c), K(`likert-star-${h}`, c));
|
|
929
929
|
case "smiley":
|
|
930
|
-
return
|
|
930
|
+
return O(K("likert-smiley", c), K(`likert-smiley-${h}`, c));
|
|
931
931
|
default:
|
|
932
|
-
return
|
|
932
|
+
return h === s ? O(K("likert-number", c), K(`likert-number-${h}`, c), K("likert-last-option", c)) : O(K("likert-number", c), K(`likert-number-${h}`, c));
|
|
933
933
|
}
|
|
934
|
-
})(), dangerouslySetInnerHTML: { __html:
|
|
935
|
-
|
|
936
|
-
}, onKeyDown: (
|
|
937
|
-
var l,
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
}, onPointerDown: () =>
|
|
941
|
-
|
|
942
|
-
}, style:
|
|
943
|
-
},
|
|
944
|
-
const { border: d, useMobileStyling: u, viewDocument:
|
|
945
|
-
let
|
|
946
|
-
const { range:
|
|
947
|
-
|
|
948
|
-
const
|
|
949
|
-
var
|
|
950
|
-
switch (
|
|
934
|
+
})(), dangerouslySetInnerHTML: { __html: A }, id: C, onClick: (m) => {
|
|
935
|
+
m.preventDefault(), m.stopPropagation(), a(h);
|
|
936
|
+
}, onKeyDown: (m) => {
|
|
937
|
+
var l, p;
|
|
938
|
+
const b = k.querySelectorAll(`.likert-${d ?? "number"}`), w = h - 1;
|
|
939
|
+
m.key === "ArrowRight" ? (l = b[w + 1]) == null || l.focus() : m.key === "ArrowLeft" ? (p = b[w - 1]) == null || p.focus() : m.key !== "Enter" && m.key !== " " || (m.preventDefault(), m.stopPropagation(), a(h));
|
|
940
|
+
}, onPointerDown: () => y(!0), onPointerEnter: () => v(h), onPointerLeave: () => {
|
|
941
|
+
v(-1), y(!1);
|
|
942
|
+
}, style: $, tabIndex: 0 });
|
|
943
|
+
}, Fn = ({ className: n, labels: o, next: t, properties: r, questionId: i, type: s }) => {
|
|
944
|
+
const { border: d, useMobileStyling: u, viewDocument: a, enableCspTrustedTypes: v } = G((b) => ({ border: b.border, useMobileStyling: b.useMobileStyling, viewDocument: b.viewDocument, enableCspTrustedTypes: b.enableCspTrustedTypes })), [y, c] = Z(-1), [h, k] = Z(!1), [C, g] = Z(null), f = o && o.left, _ = o && o.right;
|
|
945
|
+
let N;
|
|
946
|
+
const { range: R, scaleLabelType: T, ratingIcons: $ } = r;
|
|
947
|
+
R && (N = Number(R));
|
|
948
|
+
const A = N || 5, m = (b) => {
|
|
949
|
+
var w, l;
|
|
950
|
+
switch (T) {
|
|
951
951
|
case "star":
|
|
952
|
-
return (
|
|
952
|
+
return (w = $[0]) == null ? void 0 : w.svg;
|
|
953
953
|
case "smiley":
|
|
954
|
-
return (l =
|
|
954
|
+
return (l = $[b]) == null ? void 0 : l.svg;
|
|
955
955
|
default:
|
|
956
|
-
return String(
|
|
956
|
+
return String(b + 1);
|
|
957
957
|
}
|
|
958
958
|
};
|
|
959
|
-
return e("form", { className:
|
|
960
|
-
const l =
|
|
961
|
-
return e(
|
|
962
|
-
}) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children:
|
|
963
|
-
},
|
|
964
|
-
const i = se([]), { border:
|
|
965
|
-
o(
|
|
966
|
-
const C =
|
|
967
|
-
|
|
968
|
-
}, [o, t, r,
|
|
969
|
-
const C =
|
|
970
|
-
return e(
|
|
971
|
-
var
|
|
972
|
-
return
|
|
973
|
-
}, ref: (
|
|
974
|
-
|
|
975
|
-
}, showHeaderCheck: r[
|
|
976
|
-
}, [
|
|
977
|
-
return e("div", { children: t.map((
|
|
978
|
-
},
|
|
979
|
-
const u = r.matrixColumn,
|
|
980
|
-
C.preventDefault(), C.stopPropagation(), o({ value: c, questionId: i, type:
|
|
981
|
-
},
|
|
982
|
-
return e("form", { className:
|
|
983
|
-
|
|
984
|
-
}, options: t, selectedOptions: c }) }), e(le, { children: e(ve, { isDisabled: (
|
|
985
|
-
var
|
|
986
|
-
},
|
|
987
|
-
const { border:
|
|
988
|
-
var
|
|
989
|
-
return (
|
|
990
|
-
}),
|
|
991
|
-
var
|
|
992
|
-
const
|
|
993
|
-
return ((
|
|
994
|
-
}), _ = (l) => Object.values(l).filter((
|
|
995
|
-
const { minSelect:
|
|
996
|
-
switch (
|
|
959
|
+
return e("form", { className: O(n, "ul-card--likert", "fade-in-transition"), children: e(ie, { properties: r, children: [e(de, { children: [e("div", { "aria-label": `Rating (1 - ${A})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(A)].map((b, w) => {
|
|
960
|
+
const l = w + 1;
|
|
961
|
+
return e(Vn, { activeValue: y, border: d, enableCspTrustedTypes: v, icon: m(w), isPressed: h, range: A, scaleLabelType: T, selectedValue: C, setActiveValue: c, setIsPressed: k, setSelectedValue: g, useMobileStyling: u, value: l, viewDocument: a }, w);
|
|
962
|
+
}) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: f }), e("span", { children: _ })] })] }), e(le, { children: e(ve, { isDisabled: C === null && r.required, onClick: () => t({ value: C, questionId: i, type: s }, !0), children: re(r) }) })] }) }, i);
|
|
963
|
+
}, zn = ({ columns: n, onSelect: o, options: t, selectedOptions: r }) => {
|
|
964
|
+
const i = se([]), { border: s, useMobileStyling: d } = G((h) => ({ border: h.border, useMobileStyling: h.useMobileStyling })), u = t.findIndex((h) => r[h.id] === null), [a, v] = Z(u), y = be((h, k) => {
|
|
965
|
+
o(h, k);
|
|
966
|
+
const C = a + 1, g = t[C];
|
|
967
|
+
g && r[g.id] === null && v(C);
|
|
968
|
+
}, [o, t, r, a]), c = be((h, k) => {
|
|
969
|
+
const C = a === h;
|
|
970
|
+
return e(Cn, { animate: !0, header: k.label, isOpen: C, onClick: () => {
|
|
971
|
+
var g;
|
|
972
|
+
return v(C && !((g = window.UserLeap) != null && g.isMobileSDK) ? -1 : h);
|
|
973
|
+
}, ref: (g) => {
|
|
974
|
+
g && (i.current[h] = g);
|
|
975
|
+
}, showHeaderCheck: r[k.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: n.map((g) => e(Oe, { allowTextEntry: !1, ariaLabel: `${k.label}-${g.label}`, border: s, error: !1, id: `${k.id}-${g.value}`, isRadio: !0, isSelected: r[k.id] === g.value, label: g.label, onUserInputChanged: () => y(k.id, g.value), useMobileStyling: d }, g.label)) }) }, k.id);
|
|
976
|
+
}, [s, n, a, y, r, d]);
|
|
977
|
+
return e("div", { children: t.map((h, k) => c(k, h)) });
|
|
978
|
+
}, Gn = ({ className: n, next: o, options: t, properties: r, questionId: i, type: s, onSubmitButtonClick: d }) => {
|
|
979
|
+
const u = r.matrixColumn, a = r.required, v = (C) => {
|
|
980
|
+
C.preventDefault(), C.stopPropagation(), o({ value: c, questionId: i, type: s }, !0), d && d();
|
|
981
|
+
}, y = t.reduce((C, g) => (C[g.id] = null, C), {}), [c, h] = Z(y);
|
|
982
|
+
return e("form", { className: O(n, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: v, children: e(ie, { properties: r, children: [e(de, { children: e(zn, { columns: u, onSelect: (C, g) => {
|
|
983
|
+
h((f) => ({ ...f, [C]: g }));
|
|
984
|
+
}, options: t, selectedOptions: c }) }), e(le, { children: e(ve, { isDisabled: (k = c, a && Object.values(k).every((C) => C == null)), onClick: () => v(new SubmitEvent("submit")), children: re(r) }) })] }) }, i);
|
|
985
|
+
var k;
|
|
986
|
+
}, un = ({ className: n, onSubmit: o, options: t = [], properties: r, questionId: i, type: s, showIndividualSubmit: d = !1, onSubmitButtonClick: u }) => {
|
|
987
|
+
const { border: a, useMobileStyling: v } = G((l) => ({ border: l.border, useMobileStyling: l.useMobileStyling })), y = t.reduce((l, p) => (l[p.id] = { isSelected: !1 }, l), {}), [c, h] = Z(y), k = s === "multiplechoice", C = r.required, g = t.find((l) => {
|
|
988
|
+
var p;
|
|
989
|
+
return (p = l.optionProperties) == null ? void 0 : p.noneOfTheAbove;
|
|
990
|
+
}), f = (l) => Object.entries(l).some(([p, x]) => {
|
|
991
|
+
var M;
|
|
992
|
+
const P = t.find((H) => `${H.id}` === p), I = x.userText === void 0 || x.userText.trim() === "";
|
|
993
|
+
return ((M = P == null ? void 0 : P.optionProperties) == null ? void 0 : M.allowsTextEntry) && I && x.isSelected;
|
|
994
|
+
}), _ = (l) => Object.values(l).filter((p) => p.isSelected).length, N = r.minSelect && r.minSelect > 0 && r.maxSelectMode === Ce.Range && _(c) < r.minSelect && (C || _(c) > 0), R = (l) => f(l) || C && !_(l) || !((p) => {
|
|
995
|
+
const { minSelect: x = 0, maxSelect: P = 1 / 0, maxSelectMode: I } = r, M = _(p);
|
|
996
|
+
switch (I) {
|
|
997
997
|
case Ce.Maximum:
|
|
998
|
-
return
|
|
998
|
+
return M <= P;
|
|
999
999
|
case Ce.Range:
|
|
1000
|
-
return
|
|
1000
|
+
return M === 0 || M >= x;
|
|
1001
1001
|
default:
|
|
1002
1002
|
return !0;
|
|
1003
1003
|
}
|
|
1004
|
-
})(l),
|
|
1005
|
-
var
|
|
1006
|
-
return
|
|
1007
|
-
}),
|
|
1008
|
-
|
|
1009
|
-
},
|
|
1010
|
-
var
|
|
1011
|
-
return (r == null ? void 0 : r.maxSelectMode) !== Ce.Unlimited && _(c) === (r == null ? void 0 : r.maxSelect) && !((
|
|
1012
|
-
},
|
|
1004
|
+
})(l), T = Object.entries(c).some(([l, p]) => {
|
|
1005
|
+
var x, P;
|
|
1006
|
+
return p.isSelected && ((P = (x = t.find((I) => `${I.id}` === l)) == null ? void 0 : x.optionProperties) == null ? void 0 : P.allowsTextEntry);
|
|
1007
|
+
}), $ = d && (!k || T), A = (l) => {
|
|
1008
|
+
w(l.id, l.selected, l.userText, l.noneOfTheAbove);
|
|
1009
|
+
}, m = (l) => {
|
|
1010
|
+
var p;
|
|
1011
|
+
return (r == null ? void 0 : r.maxSelectMode) !== Ce.Unlimited && _(c) === (r == null ? void 0 : r.maxSelect) && !((p = c[l]) != null && p.isSelected);
|
|
1012
|
+
}, b = () => {
|
|
1013
1013
|
o(c, !0), u && u();
|
|
1014
|
-
},
|
|
1015
|
-
const
|
|
1016
|
-
if ((
|
|
1017
|
-
else
|
|
1018
|
-
|
|
1014
|
+
}, w = (l, p, x, P) => {
|
|
1015
|
+
const I = Object.assign({}, c);
|
|
1016
|
+
if ((k || P) && p) for (const M of Object.values(I)) M.isSelected = !1, delete M.userText;
|
|
1017
|
+
else g && !P && c[g.id].isSelected && (I[g.id].isSelected = !1);
|
|
1018
|
+
I[l] = { isSelected: p, userText: x }, h(I);
|
|
1019
1019
|
};
|
|
1020
|
-
return e("form", { className:
|
|
1021
|
-
const
|
|
1022
|
-
for (const
|
|
1023
|
-
|
|
1024
|
-
}, options: t, placeholderText: r.dropdownPlaceholderText ?? (
|
|
1025
|
-
var
|
|
1026
|
-
const
|
|
1027
|
-
return e(Oe, { allowTextEntry:
|
|
1028
|
-
var
|
|
1029
|
-
}), !!
|
|
1030
|
-
},
|
|
1020
|
+
return e("form", { className: O(n, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: b, children: e(ie, { properties: r, children: [e(de, { children: [r.isDropdown ? e(Dn, { disabledOptions: t.filter((l) => m(l.id)), dropdownFooter: N ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [_(c), "/", r.minSelect] }) : void 0, isMultiSelect: !k, multiselectText: r.dropdownMultiselectedText ?? "choices selected", onChange: (l) => {
|
|
1021
|
+
const p = { ...c };
|
|
1022
|
+
for (const x of t) l.includes(x) ? p[x.id].isSelected = !0 : p[x.id].isSelected = !1;
|
|
1023
|
+
h(p);
|
|
1024
|
+
}, options: t, placeholderText: r.dropdownPlaceholderText ?? (k ? "Select choice" : "Select choice(s)"), value: t.filter((l) => c[l.id].isSelected) }) : e("div", { className: O(K("ul-card__choices", v)), role: k ? "radiogroup" : "group", children: [t.map(({ id: l, label: p, value: x, optionProperties: P }) => {
|
|
1025
|
+
var q, Q;
|
|
1026
|
+
const I = `${l}`, { allowsTextEntry: M, noneOfTheAbove: H } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...P };
|
|
1027
|
+
return e(Oe, { allowTextEntry: M, border: a, disabled: m(I), error: (U = c, f(U)), id: I, isRadio: k, isSelected: !!((q = c[I]) != null && q.isSelected), label: p, noneOfTheAbove: H, onUserInputChanged: A, promptText: "Please specify", text: (Q = c[l]) == null ? void 0 : Q.userText, useMobileStyling: v, value: x }, I);
|
|
1028
|
+
var U;
|
|
1029
|
+
}), !!N && e("div", { className: "ul-card__min-select-counter", children: [_(c), "/", r.minSelect] })] }), $ && e(Sn, { handleSubmit: b, isSubmitDisabled: R(c) })] }), e(le, { children: e(ve, { isDisabled: R(c), onClick: b, children: re(r) }) })] }) }, i);
|
|
1030
|
+
}, Zn = (n) => {
|
|
1031
1031
|
const { questionId: o, type: t, next: r, options: i } = n;
|
|
1032
|
-
return e(
|
|
1033
|
-
const u = Object.entries(
|
|
1034
|
-
r({ value:
|
|
1032
|
+
return e(un, { ...n, onSubmit: (s, d) => {
|
|
1033
|
+
const u = Object.entries(s).find(([, h]) => h.isSelected) || [void 0, void 0], [a, v] = u, y = i.find((h) => `${h.id}` === a), c = v != null && v.userText ? { [a]: { userText: v.userText } } : null;
|
|
1034
|
+
r({ value: y && a ? { [a]: y.value } : {}, secondaryValue: c, questionId: o, type: t }, d);
|
|
1035
1035
|
} });
|
|
1036
|
-
},
|
|
1036
|
+
}, Qn = (n) => {
|
|
1037
1037
|
const { questionId: o, type: t, next: r } = n;
|
|
1038
|
-
return e(
|
|
1039
|
-
const d = Object.entries(i).reduce((
|
|
1040
|
-
if (!
|
|
1041
|
-
const c =
|
|
1042
|
-
return c[
|
|
1038
|
+
return e(un, { ...n, onSubmit: (i, s) => {
|
|
1039
|
+
const d = Object.entries(i).reduce((a, [v, y]) => (a[v] = y.isSelected, a), {}), u = Object.entries(i).reduce((a, [v, y]) => {
|
|
1040
|
+
if (!y.userText) return a;
|
|
1041
|
+
const c = a || {};
|
|
1042
|
+
return c[v] = { userText: y.userText }, c;
|
|
1043
1043
|
}, null);
|
|
1044
|
-
r({ value: d, secondaryValue: u, questionId: o, type: t },
|
|
1044
|
+
r({ value: d, secondaryValue: u, questionId: o, type: t }, s);
|
|
1045
1045
|
} });
|
|
1046
|
-
},
|
|
1047
|
-
const [d, u] =
|
|
1048
|
-
return e("form", { className:
|
|
1049
|
-
|
|
1050
|
-
}, onKeyDown: (
|
|
1051
|
-
var _,
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1054
|
-
}, onPointerDown: (
|
|
1055
|
-
|
|
1056
|
-
}, onPointerLeave: (
|
|
1057
|
-
|
|
1058
|
-
}, style: d === C ? { backgroundColor:
|
|
1059
|
-
},
|
|
1060
|
-
const { border: d, useMobileStyling: u, update:
|
|
1061
|
-
return e("form", { className:
|
|
1062
|
-
|
|
1063
|
-
}, onChange: (
|
|
1064
|
-
const { value: _ } =
|
|
1065
|
-
C(),
|
|
1066
|
-
}, onFocus: (
|
|
1067
|
-
|
|
1068
|
-
}, placeholder:
|
|
1069
|
-
|
|
1070
|
-
const _ = t.required !== !0 ||
|
|
1071
|
-
o({ value:
|
|
1046
|
+
}, Yn = ({ className: n, labels: o, properties: t, next: r, questionId: i, type: s }) => {
|
|
1047
|
+
const [d, u] = Z(null), { border: a, useMobileStyling: v, viewDocument: y } = G((k) => ({ border: k.border, useMobileStyling: k.useMobileStyling, viewDocument: k.viewDocument })), c = o && o.left, h = o && o.right;
|
|
1048
|
+
return e("form", { className: O(n, "ul-card--nps", "fade-in-transition"), children: e(ie, { properties: t, children: [e(de, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((k, C) => e("button", { className: O(K("nps-number", v), K(`nps-number-${C}`, v)), id: `option-${C}`, onClick: (g) => {
|
|
1049
|
+
g.preventDefault(), g.stopPropagation(), u(C);
|
|
1050
|
+
}, onKeyDown: (g) => {
|
|
1051
|
+
var _, N;
|
|
1052
|
+
const f = y.querySelectorAll("button.nps-number");
|
|
1053
|
+
g.key === "ArrowRight" ? (_ = f[C + 1]) == null || _.focus() : g.key === "ArrowLeft" ? (N = f[C - 1]) == null || N.focus() : g.key !== "Enter" && g.key !== " " || (g.preventDefault(), g.stopPropagation(), u(C));
|
|
1054
|
+
}, onPointerDown: (g) => {
|
|
1055
|
+
g.currentTarget.style.zIndex = "2", g.currentTarget.style.borderColor = a;
|
|
1056
|
+
}, onPointerLeave: (g) => {
|
|
1057
|
+
g.currentTarget.style.zIndex = "auto", g.currentTarget.style.borderColor = qe;
|
|
1058
|
+
}, style: d === C ? { backgroundColor: a, color: "#fff" } : void 0, tabIndex: 0, children: C }, C)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: c }), e("span", { children: h })] })] }), e(le, { children: e(ve, { isDisabled: d === null && t.required, onClick: () => r({ value: d, questionId: i, type: s }, !0), children: re(t) }) })] }) }, i);
|
|
1059
|
+
}, Wn = ({ className: n, next: o, properties: t, questionId: r, type: i, onSubmitButtonClick: s }) => {
|
|
1060
|
+
const { border: d, useMobileStyling: u, update: a } = G((f) => ({ border: f.border, useMobileStyling: f.useMobileStyling, update: f.update })), [v, y] = Z(""), c = se(null), h = v.trim(), k = t.required === !0 && !h, C = Pn(c, () => a()), g = t && t.openTextPlaceholder ? t.openTextPlaceholder : "";
|
|
1061
|
+
return e("form", { className: O(n, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(ie, { properties: t, children: e("div", { className: "ul-card-text", children: [e(de, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": g, className: O(K("ul-card-text__input", u)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (f) => {
|
|
1062
|
+
f.currentTarget.style.borderColor = qe;
|
|
1063
|
+
}, onChange: (f) => {
|
|
1064
|
+
const { value: _ } = f.currentTarget;
|
|
1065
|
+
C(), f.preventDefault(), f.stopPropagation(), y(_);
|
|
1066
|
+
}, onFocus: (f) => {
|
|
1067
|
+
f.currentTarget.style.borderColor = d;
|
|
1068
|
+
}, placeholder: g, ref: c, role: "textbox", tabIndex: 0 }) }), t.footerHtml && e(ye, { className: "footer", html: t.footerHtml })] }), e(le, { children: e(ve, { isDisabled: k, onClick: (f) => {
|
|
1069
|
+
f.preventDefault(), f.stopPropagation();
|
|
1070
|
+
const _ = t.required !== !0 || h.length > 0;
|
|
1071
|
+
o({ value: v, questionId: r, type: i }, _), s && s();
|
|
1072
1072
|
}, children: re(t) }) })] }) }) }, r);
|
|
1073
|
-
},
|
|
1074
|
-
const
|
|
1073
|
+
}, Kn = ({ className: n, labels: o, next: t, properties: r, questionId: i, type: s, onSubmitButtonClick: d, options: u }) => {
|
|
1074
|
+
const a = se(null), v = se(0), y = se(0), c = se(null), h = se(!1), k = se([]), [C, g] = Z(() => (r == null ? void 0 : r.required) === !0), [f, _] = Z(() => u.map((E) => ({ ...E, rank: null }))), N = fe(() => Array.from({ length: u.length }, (E, D) => D + 1), [u.length]), { useMobileStyling: R, isPreview: T, headers: $ } = G((E) => ({ useMobileStyling: E.useMobileStyling, isPreview: E.isPreview, headers: E.headers })), A = ($ == null ? void 0 : $["userleap-platform"]) === "android", m = R && !T && !A, b = !m && !A, w = (E, D) => {
|
|
1075
1075
|
_((B) => {
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
const J =
|
|
1076
|
+
const S = parseInt(D), F = B.map((V) => ({ ...V }));
|
|
1077
|
+
F.some((V) => V.rank == null) && F.forEach((V, he) => V.rank = he + 1);
|
|
1078
|
+
const J = F.findIndex((V) => V.id === E);
|
|
1079
1079
|
if (J === -1) return B;
|
|
1080
|
-
const
|
|
1081
|
-
return
|
|
1082
|
-
|
|
1083
|
-
}) :
|
|
1084
|
-
|
|
1085
|
-
}),
|
|
1080
|
+
const z = F[J].rank;
|
|
1081
|
+
return S < z ? F.forEach((V) => {
|
|
1082
|
+
V.id !== E && V.rank >= S && V.rank < z && (V.rank = V.rank + 1);
|
|
1083
|
+
}) : S > z && F.forEach((V) => {
|
|
1084
|
+
V.id !== E && V.rank > z && V.rank <= S && (V.rank = V.rank - 1);
|
|
1085
|
+
}), F[J].rank = S, F.sort((V, he) => V.rank - he.rank), H(), F;
|
|
1086
1086
|
});
|
|
1087
|
-
}, l = (E,
|
|
1088
|
-
for (let B = 0; B <
|
|
1089
|
-
const
|
|
1090
|
-
if (!
|
|
1091
|
-
const
|
|
1092
|
-
if (E >=
|
|
1087
|
+
}, l = (E, D) => {
|
|
1088
|
+
for (let B = 0; B < k.current.length; B++) {
|
|
1089
|
+
const S = k.current[B];
|
|
1090
|
+
if (!S || S === c.current) continue;
|
|
1091
|
+
const F = S.getBoundingClientRect();
|
|
1092
|
+
if (E >= F.left && E <= F.right && D >= F.top && D <= F.bottom) return { element: S, index: B };
|
|
1093
1093
|
}
|
|
1094
1094
|
return null;
|
|
1095
|
-
},
|
|
1096
|
-
if (!
|
|
1097
|
-
|
|
1098
|
-
const B =
|
|
1099
|
-
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
},
|
|
1103
|
-
if (!
|
|
1095
|
+
}, p = (E) => (D) => {
|
|
1096
|
+
if (!m) return;
|
|
1097
|
+
D.preventDefault(), D.stopPropagation(), h.current = !0, a.current = E;
|
|
1098
|
+
const B = D.touches[0];
|
|
1099
|
+
v.current = B.clientY, y.current = B.clientY;
|
|
1100
|
+
const S = D.currentTarget.closest(".ul-card-rank__option");
|
|
1101
|
+
S && (c.current = S, S.classList.add("is-dragging"));
|
|
1102
|
+
}, x = (E) => {
|
|
1103
|
+
if (!m || !h.current || a.current === null) return;
|
|
1104
1104
|
E.preventDefault(), E.stopPropagation();
|
|
1105
|
-
const
|
|
1106
|
-
|
|
1107
|
-
const B =
|
|
1108
|
-
c.current && (c.current.style.transform = `translateY(${B}px)`, c.current.style.zIndex = "1000"),
|
|
1109
|
-
|
|
1105
|
+
const D = E.touches[0];
|
|
1106
|
+
y.current = D.clientY;
|
|
1107
|
+
const B = y.current - v.current;
|
|
1108
|
+
c.current && (c.current.style.transform = `translateY(${B}px)`, c.current.style.zIndex = "1000"), k.current.forEach((F) => {
|
|
1109
|
+
F && F !== c.current && F.classList.remove("is-drop-target");
|
|
1110
1110
|
});
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1113
|
-
},
|
|
1114
|
-
if (!
|
|
1111
|
+
const S = l(D.clientX, D.clientY);
|
|
1112
|
+
S && S.element.classList.add("is-drop-target");
|
|
1113
|
+
}, P = (E) => {
|
|
1114
|
+
if (!m || !h.current || a.current === null) return;
|
|
1115
1115
|
E.preventDefault(), E.stopPropagation();
|
|
1116
|
-
const
|
|
1117
|
-
c.current && (c.current.style.transform = "", c.current.style.zIndex = "", c.current.classList.remove("is-dragging")),
|
|
1118
|
-
|
|
1119
|
-
}), B && B.index !==
|
|
1120
|
-
},
|
|
1116
|
+
const D = E.changedTouches[0], B = l(D.clientX, D.clientY);
|
|
1117
|
+
c.current && (c.current.style.transform = "", c.current.style.zIndex = "", c.current.classList.remove("is-dragging")), k.current.forEach((S) => {
|
|
1118
|
+
S && S.classList.remove("is-drop-target");
|
|
1119
|
+
}), B && B.index !== a.current && I(a.current, B.index), a.current = null, c.current = null, h.current = !1;
|
|
1120
|
+
}, I = (E, D) => {
|
|
1121
1121
|
_((B) => {
|
|
1122
|
-
const
|
|
1123
|
-
return
|
|
1124
|
-
J.rank =
|
|
1125
|
-
}),
|
|
1122
|
+
const S = B.map((J) => ({ ...J })), [F] = S.splice(E, 1);
|
|
1123
|
+
return S.splice(D, 0, F), S.forEach((J, z) => {
|
|
1124
|
+
J.rank = z + 1;
|
|
1125
|
+
}), H(), S;
|
|
1126
1126
|
});
|
|
1127
|
-
},
|
|
1128
|
-
const
|
|
1129
|
-
E.reduce((B,
|
|
1130
|
-
},
|
|
1131
|
-
|
|
1132
|
-
}, { left:
|
|
1127
|
+
}, M = (E) => {
|
|
1128
|
+
const D = {};
|
|
1129
|
+
E.reduce((B, S) => (B[S.id] = S.rank, B), D), t({ value: D, questionId: i, type: s }, !0);
|
|
1130
|
+
}, H = () => {
|
|
1131
|
+
g(!1);
|
|
1132
|
+
}, { left: U, right: q } = o, Q = u.length, Y = (E) => {
|
|
1133
1133
|
E.preventDefault(), E.currentTarget.classList.add("is-drop-target");
|
|
1134
1134
|
}, ee = (E) => {
|
|
1135
1135
|
E.currentTarget.classList.remove("is-drop-target");
|
|
1136
1136
|
}, me = (E) => {
|
|
1137
|
-
|
|
1137
|
+
a.current = null, E.currentTarget.classList.remove("is-dragging");
|
|
1138
1138
|
};
|
|
1139
|
-
return e("form", { className:
|
|
1140
|
-
E.preventDefault(),
|
|
1141
|
-
}, children: e(ie, { properties: r, children: e(Be,
|
|
1139
|
+
return e("form", { className: O(n, "ul-card-rank", "fade-in-transition"), onSubmit: (E) => {
|
|
1140
|
+
E.preventDefault(), M(f), d && d();
|
|
1141
|
+
}, children: e(ie, { properties: r, children: e(Be, A ? { children: [e(de, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", U] }) }), e("ol", { className: "ul-card-rank__list", children: f.map(({ id: E, label: D, rank: B }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${D}`, className: O("ul-card-rank__select", B == null && "ul-card-rank__select--placeholder"), name: `rank[${E}]`, onChange: (S) => w(E, S.currentTarget.value), value: B ?? "", children: [B == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), N.map((S) => e("option", { className: "ul-card-rank__select-option", value: S, children: S }, `${S}-${i}`))] }), e("span", { children: D })] }, E)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [Q, " - ", q] }) })] }) }), e(le, { children: e("div", { className: "ul-card__button-wrapper", children: e(oe, { disabled: C, children: re(r) }) }) })] } : { children: [e(de, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", U] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: A ? void 0 : (E) => {
|
|
1142
1142
|
E.preventDefault(), E.dataTransfer && (E.dataTransfer.dropEffect = "move");
|
|
1143
|
-
}, children:
|
|
1144
|
-
return e("li", { className: "ul-card-rank__option", draggable: !!
|
|
1145
|
-
|
|
1146
|
-
}) : void 0, onDrop:
|
|
1143
|
+
}, children: f.map(({ id: E, label: D, rank: B }, S) => {
|
|
1144
|
+
return e("li", { className: "ul-card-rank__option", draggable: !!b || void 0, onDragEnd: b ? me : void 0, onDragEnter: b ? Y : void 0, onDragLeave: b ? ee : void 0, onDragStart: b ? (J = S, (z) => {
|
|
1145
|
+
a.current = J, z.dataTransfer && (z.dataTransfer.effectAllowed = "move", z.dataTransfer.setData("text/plain", String(J)), z.currentTarget.classList.add("is-dragging"));
|
|
1146
|
+
}) : void 0, onDrop: b ? (F = S, (z) => {
|
|
1147
1147
|
var he, Fe;
|
|
1148
|
-
|
|
1149
|
-
const
|
|
1150
|
-
|
|
1151
|
-
}) : void 0, ref: (
|
|
1152
|
-
var
|
|
1153
|
-
}) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [
|
|
1154
|
-
},
|
|
1155
|
-
}, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, te =
|
|
1156
|
-
n(
|
|
1148
|
+
z.preventDefault(), z.currentTarget.classList.remove("is-drop-target");
|
|
1149
|
+
const V = a.current;
|
|
1150
|
+
a.current = null, (Fe = (he = z.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : he.querySelector(".is-dragging")) == null || Fe.classList.remove("is-dragging"), V != null && V !== F && I(V, F);
|
|
1151
|
+
}) : void 0, ref: (z) => k.current[S] = z, children: [e("select", { "aria-label": `Rank for ${D}`, className: O("ul-card-rank__select", B == null && "ul-card-rank__select--placeholder"), name: `rank[${E}]`, onChange: (z) => w(E, z.currentTarget.value), value: B ?? "", children: [B == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), N.map((z) => e("option", { className: "ul-card-rank__select-option", value: z, children: z }, z))] }), e("span", { children: D }), !A && e("button", { "aria-label": `Drag ${D} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: m ? P : void 0, onTouchMove: m ? x : void 0, onTouchStart: m ? p(S) : 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" }) }) })] }, E);
|
|
1152
|
+
var F, J;
|
|
1153
|
+
}) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [Q, " - ", q] }) })] }) }), e(le, { children: e("div", { className: "ul-card__button-wrapper", children: e(oe, { disabled: C, children: re(r) }) }) })] }) }) }, i);
|
|
1154
|
+
}, Le = 1, pn = 2, vn = 3, we = (n) => n.type === "av_permission", Ke = (n) => n.type === "screen_permission", mn = (n, o) => n === void 0 ? Le : n ? ((t, r) => !(we(r) ? r.permissionDescriptors : []).includes("camera") || t.getVideoTracks().length > 0)(n, o) ? vn : Le : pn, Je = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
|
|
1155
|
+
}, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, te = xn((n) => ({ ...Je, reset: () => {
|
|
1156
|
+
n(Je);
|
|
1157
1157
|
}, updatePage: (o) => {
|
|
1158
1158
|
n(o);
|
|
1159
1159
|
} }));
|
|
1160
|
-
function
|
|
1161
|
-
const { avStream: t, recordingMediaTypes: r, updatePage: i } = te.getState(), { recorderEventEmitter:
|
|
1162
|
-
|
|
1160
|
+
function Re({ currentPage: n, pages: o }) {
|
|
1161
|
+
const { avStream: t, recordingMediaTypes: r, updatePage: i } = te.getState(), { recorderEventEmitter: s } = G.getState();
|
|
1162
|
+
s.emit("av.permission", { "permission.descriptors": n.permissionDescriptors, "stream.ready": (d, u) => {
|
|
1163
1163
|
if (t === d) return;
|
|
1164
|
-
let
|
|
1164
|
+
let a = n;
|
|
1165
1165
|
if (d && !n.permissionDescriptors.includes("camera")) {
|
|
1166
|
-
const
|
|
1167
|
-
u != null && u.active && r &&
|
|
1166
|
+
const v = o.indexOf(n), y = u != null && u.active ? v + 2 : v + 1;
|
|
1167
|
+
u != null && u.active && r && s.emit("begin.recording", { "recording.media.types": r, "start.recording.callback": (c) => i({ mediaRecordingUids: c }) }), a = o[y];
|
|
1168
1168
|
}
|
|
1169
|
-
i({ currentPage:
|
|
1169
|
+
i({ currentPage: a, avStream: d });
|
|
1170
1170
|
} });
|
|
1171
1171
|
}
|
|
1172
|
-
function
|
|
1173
|
-
const { nextQuestion: o, passthroughData: t, mediaRecordingUids: r, reset: i } = te.getState(), { recorderEventEmitter:
|
|
1174
|
-
t &&
|
|
1175
|
-
d({ mediaRecordingUid:
|
|
1176
|
-
}, "progress.callback": (
|
|
1177
|
-
d({ mediaRecordingUid:
|
|
1178
|
-
}, "upload.callback": (
|
|
1179
|
-
|
|
1180
|
-
}, "passthrough.data": t, "current.index": u, "task.response":
|
|
1181
|
-
|
|
1172
|
+
function Ne({ status: n }) {
|
|
1173
|
+
const { nextQuestion: o, passthroughData: t, mediaRecordingUids: r, reset: i } = te.getState(), { recorderEventEmitter: s, handleUploadUpdate: d, index: u } = G.getState(), a = { value: { taskStatus: n }, type: "recordedtask", questionId: (t == null ? void 0 : t.questionId) || 1 };
|
|
1174
|
+
t && s.emit("finish.task", { "begin.callback": (v) => {
|
|
1175
|
+
d({ mediaRecordingUid: v, isSubmitted: !0, progressPct: 0, isComplete: !1 });
|
|
1176
|
+
}, "progress.callback": (v, y) => {
|
|
1177
|
+
d({ mediaRecordingUid: v, progressPct: y.detail, isSubmitted: !1, isComplete: !1 });
|
|
1178
|
+
}, "upload.callback": (v) => {
|
|
1179
|
+
v && d({ mediaRecordingUid: v, isComplete: !0, isSubmitted: !0, progressPct: 100 });
|
|
1180
|
+
}, "passthrough.data": t, "current.index": u, "task.response": a, "task.complete.callback": (v) => {
|
|
1181
|
+
a.value.taskDurationMillisecond = v, r && (a.value.mediaRecordingUids = r), i(), o(a);
|
|
1182
1182
|
} });
|
|
1183
1183
|
}
|
|
1184
1184
|
function $e({ pages: n, setIsRequestingPermission: o }) {
|
|
1185
|
-
const { recorderEventEmitter: t, eventEmitFn: r } =
|
|
1186
|
-
if (!
|
|
1187
|
-
const
|
|
1188
|
-
switch (
|
|
1185
|
+
const { recorderEventEmitter: t, eventEmitFn: r } = G.getState(), { updatePage: i, currentPage: s, recordingMediaTypes: d, screenPermissionRequested: u } = te.getState();
|
|
1186
|
+
if (!s) return;
|
|
1187
|
+
const a = n.indexOf(s);
|
|
1188
|
+
switch (s.type) {
|
|
1189
1189
|
case "av_permission": {
|
|
1190
|
-
const
|
|
1191
|
-
return u && d && t.emit("begin.recording", { "recording.media.types": d, "start.recording.callback": (
|
|
1192
|
-
i({ mediaRecordingUids:
|
|
1193
|
-
} }), void i({ currentPage: n[
|
|
1190
|
+
const v = u ? a + 2 : a + 1;
|
|
1191
|
+
return u && d && t.emit("begin.recording", { "recording.media.types": d, "start.recording.callback": (y) => {
|
|
1192
|
+
i({ mediaRecordingUids: y });
|
|
1193
|
+
} }), void i({ currentPage: n[v] });
|
|
1194
1194
|
}
|
|
1195
1195
|
case "screen_permission":
|
|
1196
|
-
return void t.emit("screen.permission", { "screen.permission.requested": o, "stream.ready.callback": (
|
|
1197
|
-
const c =
|
|
1198
|
-
|
|
1199
|
-
i({ captureStream:
|
|
1200
|
-
} }), i({ currentPage: c, screenPermissionRequested: !0, captureStream:
|
|
1196
|
+
return void t.emit("screen.permission", { "screen.permission.requested": o, "stream.ready.callback": (v, y) => {
|
|
1197
|
+
const c = y ? n[a + 1] : s;
|
|
1198
|
+
y && d && t.emit("begin.recording", { "recording.media.types": d, "start.recording.callback": (h) => {
|
|
1199
|
+
i({ captureStream: y, mediaRecordingUids: h });
|
|
1200
|
+
} }), i({ currentPage: c, screenPermissionRequested: !0, captureStream: y });
|
|
1201
1201
|
} });
|
|
1202
1202
|
case "start_task":
|
|
1203
|
-
return r("recorded.task.start"), t.emit("recorded.task.start"), t.emit("start.task"), void i({ currentPage: n[
|
|
1203
|
+
return r("recorded.task.start"), t.emit("recorded.task.start"), t.emit("start.task"), void i({ currentPage: n[a + 1], screenPermissionRequested: !0 });
|
|
1204
1204
|
case "complete_task":
|
|
1205
1205
|
return;
|
|
1206
1206
|
}
|
|
1207
1207
|
}
|
|
1208
|
-
const
|
|
1209
|
-
const { avStream: o, captureStream: t, recordingMediaTypes: r, updatePage: i } = te.getState(),
|
|
1208
|
+
const hn = "ul-permission-graphics-container", gn = "ul-permission-body", bn = O(hn, "ul_recorded-task-inset-spacing"), Ee = O("ul-horizontal-button-container", "ul-horizontal-button-container-left"), fn = ({ richTextBody: n }) => e(ye, { className: "ul-rich-text-body", html: n, id: "ul-task-detail-container" }), je = ({ required: n, skipButtonText: o, bottom: t = !1 }) => n ? null : e(oe, { className: O(t && "ul-skip-button-below", "ul-button-inactive"), onClick: Ne.bind(null, { status: "abandoned" }), children: o || "Skip" }), Ve = (n) => {
|
|
1209
|
+
const { avStream: o, captureStream: t, recordingMediaTypes: r, updatePage: i } = te.getState(), s = (r == null ? void 0 : r.includes("audio")) || (r == null ? void 0 : r.includes("video"));
|
|
1210
1210
|
ue(() => {
|
|
1211
1211
|
const d = setInterval(() => {
|
|
1212
|
-
|
|
1212
|
+
s && o && !o.active ? i({ avStream: null, currentPage: n[0] }) : t && t.active || i({ captureStream: void 0, currentPage: n[s ? 1 : 0] });
|
|
1213
1213
|
}, 1e3);
|
|
1214
1214
|
return () => clearInterval(d);
|
|
1215
|
-
}, [o, t,
|
|
1216
|
-
},
|
|
1217
|
-
const { buttonText: r, skipButtonText: i, taskDetail:
|
|
1218
|
-
return Ve(o), e("div", { className: "ul-task-page", children: [
|
|
1219
|
-
},
|
|
1215
|
+
}, [o, t, s, n, r, i]);
|
|
1216
|
+
}, Jn = ({ content: n, pages: o, required: t }) => {
|
|
1217
|
+
const { buttonText: r, skipButtonText: i, taskDetail: s } = n;
|
|
1218
|
+
return Ve(o), e("div", { className: "ul-task-page", children: [s && e(fn, { richTextBody: s }), e("div", { className: Ee, children: [e(oe, { onClick: $e.bind(null, { pages: o }), children: r }), e(je, { required: t, skipButtonText: i })] })] }, "start-task");
|
|
1219
|
+
}, Xn = ({ content: n, pages: o, properties: t }) => {
|
|
1220
1220
|
const { buttonText: r, skipButtonText: i } = n;
|
|
1221
|
-
return Ve(o), e("div", { className: "ul-task-page", children: [n.taskDetail && e(
|
|
1222
|
-
},
|
|
1223
|
-
const { buttonText: r, skipButtonText: i } = n, [
|
|
1224
|
-
return e("div", { children: [e("div", { className:
|
|
1225
|
-
},
|
|
1226
|
-
const { permissionDeniedHeadline: r, permissionDeniedBody: i, skipButtonText:
|
|
1221
|
+
return Ve(o), e("div", { className: "ul-task-page", children: [n.taskDetail && e(fn, { richTextBody: n.taskDetail }), e(ie, { properties: t, children: e("div", { className: Ee, children: [e(oe, { className: "ul-complete-task-button", onClick: Ne.bind(null, { status: "completed" }), children: r }), e(oe, { className: O("ul-button-inactive"), onClick: Ne.bind(null, { status: "given.up" }), children: i })] }) })] }, "complete-task");
|
|
1222
|
+
}, et = ({ content: n, pages: o, required: t }) => {
|
|
1223
|
+
const { buttonText: r, skipButtonText: i } = n, [s] = G((a) => [a.tabTitle]), [d, u] = Z(!1);
|
|
1224
|
+
return e("div", { children: [e("div", { className: bn, children: [e("p", { style: { marginTop: "auto" }, children: n.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: gn, children: s }) })] }), e("div", { className: t ? "" : Ee, children: [e(oe, { disabled: d, onClick: $e.bind(null, { pages: o, setIsRequestingPermission: u }), children: r }), e(je, { required: t, skipButtonText: i })] })] });
|
|
1225
|
+
}, nt = ({ content: n }) => e(ye, { className: O(hn, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), html: n.svg }, "ul-permission-request-graphic"), tt = ({ content: n, pages: o, required: t }) => {
|
|
1226
|
+
const { permissionDeniedHeadline: r, permissionDeniedBody: i, skipButtonText: s, tryAgainButtonText: d } = n, u = we(o[0]) ? o[0] : null;
|
|
1227
1227
|
return ue(() => {
|
|
1228
|
-
const
|
|
1229
|
-
u !== null &&
|
|
1228
|
+
const a = setInterval(() => {
|
|
1229
|
+
u !== null && Re({ currentPage: u, pages: o });
|
|
1230
1230
|
}, 1e3);
|
|
1231
|
-
return () => clearInterval(
|
|
1232
|
-
}, [u, o]), u ? e("div", { children: [e("div", { className:
|
|
1233
|
-
},
|
|
1231
|
+
return () => clearInterval(a);
|
|
1232
|
+
}, [u, o]), u ? e("div", { children: [e("div", { className: bn, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: r }), e("span", { className: gn, children: i })] }) }), e("div", { className: Ee, children: [e(oe, { onClick: Re.bind(null, { currentPage: u, pages: o }), children: d }), e(je, { required: t, skipButtonText: s })] })] }) : null;
|
|
1233
|
+
}, rt = ({ stream: n }) => e("video", { autoPlay: !0, className: O("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (o) => {
|
|
1234
1234
|
o && (o.srcObject = n || null);
|
|
1235
|
-
} }),
|
|
1235
|
+
} }), ot = ({ content: n, pages: o, required: t }) => {
|
|
1236
1236
|
const { skipButtonText: r } = n, { avStream: i } = te.getState();
|
|
1237
|
-
return Ve(o), e("div", { children: [e(
|
|
1238
|
-
},
|
|
1237
|
+
return Ve(o), e("div", { children: [e(rt, { stream: i }), e("div", { className: "ul-vertical-button-container-center", children: [e(oe, { onClick: $e.bind(null, { pages: o }), children: n.buttonText }), e(je, { bottom: !0, required: t, skipButtonText: r })] })] });
|
|
1238
|
+
}, it = ({ properties: n }) => {
|
|
1239
1239
|
const { pages: o, required: t } = n, { avStream: r, currentPage: i } = te.getState();
|
|
1240
1240
|
if (i === void 0) return null;
|
|
1241
1241
|
switch (i == null ? void 0 : i.type) {
|
|
1242
1242
|
case "av_permission": {
|
|
1243
|
-
const
|
|
1244
|
-
return
|
|
1243
|
+
const s = mn(r, i);
|
|
1244
|
+
return s === Le ? e(nt, { content: i }) : e(s === pn ? tt : ot, { content: i, pages: o, required: t });
|
|
1245
1245
|
}
|
|
1246
1246
|
case "screen_permission":
|
|
1247
|
-
return e(
|
|
1247
|
+
return e(et, { content: i, pages: o, required: t });
|
|
1248
1248
|
case "start_task":
|
|
1249
|
-
return e(
|
|
1249
|
+
return e(Jn, { content: i, pages: o, required: t });
|
|
1250
1250
|
case "complete_task":
|
|
1251
|
-
return e(
|
|
1251
|
+
return e(Xn, { content: i, pages: o, properties: n });
|
|
1252
1252
|
default:
|
|
1253
1253
|
return null;
|
|
1254
1254
|
}
|
|
1255
|
-
},
|
|
1256
|
-
const i =
|
|
1257
|
-
let c = te((
|
|
1258
|
-
c || (c = function({ pages:
|
|
1259
|
-
const { updatePage:
|
|
1260
|
-
let
|
|
1261
|
-
|
|
1262
|
-
const
|
|
1263
|
-
if (we(
|
|
1264
|
-
const { permissionDescriptors:
|
|
1265
|
-
|
|
1255
|
+
}, st = ({ className: n, properties: o, next: t, questionId: r }) => {
|
|
1256
|
+
const i = G(), { surveyId: s, responseGroupUid: d, userId: u } = i, a = te(), { screenPermissionRequested: v } = a, y = te((g) => g.avStream);
|
|
1257
|
+
let c = te((g) => g.currentPage);
|
|
1258
|
+
c || (c = function({ pages: g, userId: f, responseGroupUid: _, surveyId: N, questionId: R, next: T }) {
|
|
1259
|
+
const { updatePage: $ } = te.getState(), { eventEmitFn: A, recorderEventEmitter: m } = G.getState(), b = { questionId: R, surveyId: N, visitorId: f, responseGroupUid: _ };
|
|
1260
|
+
let w = 0;
|
|
1261
|
+
m.emit("recorded.task.permission.screen"), A("recorded.task.permission.screen"), m.emit("permission.status", { "permission.status.callback": (p, x, P, I) => {
|
|
1262
|
+
const M = g[w], { type: H } = M, U = ["screen"];
|
|
1263
|
+
if (we(M)) {
|
|
1264
|
+
const { permissionDescriptors: q } = M, Q = q == null ? void 0 : q.includes("microphone"), Y = q == null ? void 0 : q.includes("camera");
|
|
1265
|
+
Q && U.push("audio"), Y && U.push("video"), (p != null && p.active && !Y || p != null && p.active && x) && w++;
|
|
1266
1266
|
}
|
|
1267
|
-
|
|
1267
|
+
Ke(g[w]) && P && (w++, m.emit("begin.recording", { "recording.media.types": U, "start.recording.callback": (q) => $({ mediaRecordingUids: q }) })), $({ currentPage: g[w], avStream: p, screenPermissionRequested: P, nextQuestion: T, type: H, passthroughData: b, recordingMediaTypes: U, captureStream: I });
|
|
1268
1268
|
} });
|
|
1269
|
-
const l =
|
|
1270
|
-
return l.type === "av_permission" &&
|
|
1271
|
-
}({ questionId: r, surveyId:
|
|
1272
|
-
t(
|
|
1269
|
+
const l = g[w];
|
|
1270
|
+
return l.type === "av_permission" && Re({ currentPage: l, pages: g }), l;
|
|
1271
|
+
}({ questionId: r, surveyId: s, next: (g) => {
|
|
1272
|
+
t(g, !0);
|
|
1273
1273
|
}, pages: o.pages, responseGroupUid: d, userId: u }));
|
|
1274
|
-
let
|
|
1275
|
-
const C =
|
|
1276
|
-
return
|
|
1277
|
-
},
|
|
1278
|
-
const { visitorAttributes:
|
|
1274
|
+
let h = c.headline, k = c.captionText;
|
|
1275
|
+
const C = mn(y, c);
|
|
1276
|
+
return Ke(c) && v && (h = c.permissionDeniedHeadline, k = c.permissionDeniedCaptionText), we(c) && C === vn && (h = c.permissionGrantedHeadline, k = c.permissionGrantedCaptionText), e("div", { className: O(n, "ul-center-horizontally", "fade-in-transition"), children: [e(Ae, { isRequired: o == null ? void 0 : o.required, message: h, properties: { captionText: k } }), e(de, { children: e(it, { properties: o }) })] });
|
|
1277
|
+
}, at = ({ className: n, next: o, properties: t, questionId: r, type: i }) => {
|
|
1278
|
+
const { visitorAttributes: s, isLongFormSurvey: d } = G((y) => ({ visitorAttributes: y.visitorAttributes, isLongFormSurvey: tn(y.studyType) })), u = (y, c = !1) => {
|
|
1279
1279
|
o({ value: c ? { skipped: !0 } : void 0, questionId: r, type: i }, !0);
|
|
1280
|
-
},
|
|
1281
|
-
return e("div", { className:
|
|
1282
|
-
|
|
1283
|
-
}, rel: "noreferrer", role:
|
|
1284
|
-
},
|
|
1285
|
-
const { border: t, destroy: r, endCard: i, forceBrandedLogo:
|
|
1280
|
+
}, a = Ln(t && t.buttonUrl, s), v = d && t.promptActionType === Rn.NO_BUTTON;
|
|
1281
|
+
return e("div", { className: O(n, "ul-card__text-url-prompt", "fade-in-transition"), children: e(ie, { properties: t, children: !v && 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: a, id: "ul-card-text__button", onClick: u, onKeyPress: (y) => {
|
|
1282
|
+
y.key !== "Enter" && y.key !== " " || o({ value: void 0, questionId: r, type: i }, !0);
|
|
1283
|
+
}, rel: "noreferrer", role: a ? "link" : "button", tabIndex: 0, target: "_blank", children: re(t) }), t.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (y) => u(0, !0), children: Me(t) })] }) }) }) }, r);
|
|
1284
|
+
}, lt = ({ className: n, questionId: o }) => {
|
|
1285
|
+
const { border: t, destroy: r, endCard: i, forceBrandedLogo: s } = G((a) => ({ border: a.border, destroy: a.destroy, endCard: a.endCard, forceBrandedLogo: a.forceBrandedLogo }));
|
|
1286
1286
|
ue(() => {
|
|
1287
1287
|
setTimeout(() => {
|
|
1288
1288
|
r(Ue);
|
|
1289
|
-
},
|
|
1290
|
-
}, [r,
|
|
1289
|
+
}, s ? 4e3 : 2e3);
|
|
1290
|
+
}, [r, s]);
|
|
1291
1291
|
const d = i && i.subheader ? e("p", { className: "ul-caption", children: i.subheader }) : null, u = i && i.headline ? i.headline : "";
|
|
1292
|
-
return e("div", { className:
|
|
1293
|
-
},
|
|
1294
|
-
const { uploadProgress: o } =
|
|
1292
|
+
return e("div", { className: O(n, "ul-card--thanks", "fade-in-transition"), children: e("div", { children: e("div", { className: "ul-card--thanks-content", children: [e("div", { className: "ul-thanks-check", children: e("svg", { "aria-labelledby": "title", fill: "none", height: "99", viewBox: "0 0 81 99", width: "81", xmlns: "http://www.w3.org/2000/svg", children: [e("path", { clipRule: "evenodd", d: "M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z", fill: t, 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: t, 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(Ae, { message: u }), d] }) }) }, o);
|
|
1293
|
+
}, dt = () => e("div", { className: "thinking-dots-container", children: e("div", { className: "thinking-dot" }) }), ct = ({ className: n }) => {
|
|
1294
|
+
const { uploadProgress: o } = G((s) => ({ uploadProgress: s.uploadProgress }));
|
|
1295
1295
|
let t, r;
|
|
1296
|
-
Object.values(o).filter((
|
|
1297
|
-
const i = Math.round(Math.min(99, ...Object.values(o).filter((
|
|
1298
|
-
return e("div", { className:
|
|
1299
|
-
},
|
|
1300
|
-
const
|
|
1301
|
-
|
|
1302
|
-
},
|
|
1303
|
-
|
|
1304
|
-
const l =
|
|
1305
|
-
if (
|
|
1296
|
+
Object.values(o).filter((s) => s.isSubmitted).length > 1 ? (t = "Your responses are processing", r = "Please keep this tab open until your responses are fully processed.") : (t = "Your response is processing", r = "Please keep this tab open until your response is fully processed.");
|
|
1297
|
+
const i = Math.round(Math.min(99, ...Object.values(o).filter((s) => s.isSubmitted).map((s) => s.progressPct || 0)));
|
|
1298
|
+
return e("div", { className: O(n, "ul-card--uploading", "fade-in-transition"), children: [e("div", { "aria-busy": "true", "aria-label": "Processing...", "aria-live": "polite", className: "ul-loading-spinner-container", role: "progressbar", children: e("div", { className: "ul-loading-spinner", children: [e("div", { className: "first" }), e("div", { className: "second" }), e("div", { className: "third" }), e("div", { className: "fourth" })] }) }), e(Ae, { message: `${t} (${i}% complete)` }), e("p", { className: "ul-caption", children: r })] });
|
|
1299
|
+
}, Xe = 0, en = 1, ut = ({ className: n, next: o, properties: t, questionId: r, type: i }) => {
|
|
1300
|
+
const s = `ul-card-video__player_recorder-q${r}`, { apiURL: d, envId: u, handleUploadUpdate: a, headers: v, responseGroupUid: y, surveyId: c, viewDocument: h, visitorId: k } = G((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 })), [C, g] = Z(!1), [f, _] = Z(null), [N, R] = Z(null), [T, $] = Z(Xe), A = (b, w) => {
|
|
1301
|
+
b === L.UPLOAD_STARTED ? (_(w[L.UPLOAD_ID]), R(w[L.MEDIA_RECORDING_UID]), g(!0)) : b === L.DELETE ? (_(null), R(null), g(!1)) : b === L.UPLOAD_PROGRESS ? isNaN(w[L.UPLOAD_PROGRESS_PCT]) ? a({ mediaRecordingUid: w[L.MEDIA_RECORDING_UID], isComplete: !0 }) : a({ mediaRecordingUid: w[L.MEDIA_RECORDING_UID], progressPct: w[L.UPLOAD_PROGRESS_PCT] }) : b === L.UPLOAD_FINISHED && a({ mediaRecordingUid: w[L.MEDIA_RECORDING_UID], isComplete: !0 });
|
|
1302
|
+
}, m = (b) => {
|
|
1303
|
+
b.preventDefault(), b.stopPropagation(), document.getElementById(s) && ((w) => {
|
|
1304
|
+
const l = w + Qe;
|
|
1305
|
+
if (j.document.getElementById(l) && j.videojs) {
|
|
1306
1306
|
try {
|
|
1307
|
-
if (!
|
|
1307
|
+
if (!j.videojs(l).record().stream) return;
|
|
1308
1308
|
} catch {
|
|
1309
1309
|
return;
|
|
1310
1310
|
}
|
|
1311
|
-
|
|
1311
|
+
j.videojs(l).record().stop(), j.videojs(l).record().stopDevice();
|
|
1312
1312
|
}
|
|
1313
|
-
})(
|
|
1313
|
+
})(s), f && N ? (a({ mediaRecordingUid: N, isSubmitted: !0 }), o({ value: { mediaRecordingUid: N }, questionId: r, type: i }, !0)) : o({ value: null, questionId: r, type: i }, !0);
|
|
1314
1314
|
};
|
|
1315
|
-
return e("form", { className:
|
|
1316
|
-
|
|
1317
|
-
const l = ke(
|
|
1315
|
+
return e("form", { className: O(n, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(de, { children: [e("div", { id: "ul-question-player-container", style: { display: T === Xe ? "" : "none" }, children: e(ie, { properties: t, children: e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (b) => {
|
|
1316
|
+
b.preventDefault(), b.stopPropagation(), document.getElementById(s) && ((w) => {
|
|
1317
|
+
const l = ke(w + on);
|
|
1318
1318
|
l == null || l.pause();
|
|
1319
|
-
})(
|
|
1320
|
-
} }) }) }), e("div", { style: { display:
|
|
1321
|
-
if (
|
|
1322
|
-
const
|
|
1323
|
-
|
|
1324
|
-
const
|
|
1325
|
-
return
|
|
1326
|
-
ae(new Error(`Voice & Video feature violates ${Y.violatedDirective} web page CSP policies for the recorder player.`), "recorderDeviceError",
|
|
1327
|
-
}),
|
|
1328
|
-
Pe(
|
|
1319
|
+
})(s), $(en);
|
|
1320
|
+
} }) }) }), e("div", { style: { display: T === en ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (b) => {
|
|
1321
|
+
if (b && b.children.length === 0) {
|
|
1322
|
+
const w = ((l, p = {}, x = "https://api.userleap.com", P, I, M, H = !1, U = document) => {
|
|
1323
|
+
j.document = U;
|
|
1324
|
+
const q = l + Qe, Q = cn(q);
|
|
1325
|
+
return j.document.addEventListener("securitypolicyviolation", (Y) => {
|
|
1326
|
+
ae(new Error(`Voice & Video feature violates ${Y.violatedDirective} web page CSP policies for the recorder player.`), "recorderDeviceError", x, M, p.visitorId, p.envId);
|
|
1327
|
+
}), sn(rn.concat(Nn), () => {
|
|
1328
|
+
Pe(q, Q), j.document.getElementById(He(q)).remove();
|
|
1329
1329
|
try {
|
|
1330
|
-
|
|
1330
|
+
Bn(Q, q, p, x, P, I, M, H);
|
|
1331
1331
|
} catch (Y) {
|
|
1332
|
-
return void ae(new Error(`Error when creating video recorder player object ${Y}`), "recorderDeviceError",
|
|
1332
|
+
return void ae(new Error(`Error when creating video recorder player object ${Y}`), "recorderDeviceError", x, M, p.visitorId, p.envId);
|
|
1333
1333
|
}
|
|
1334
|
-
}),
|
|
1335
|
-
})(
|
|
1336
|
-
|
|
1334
|
+
}), Q;
|
|
1335
|
+
})(s, { surveyId: c, responseGroupUid: y, questionId: r, visitorId: k, envId: u }, d, A, void 0, { ...v, "x-ul-video-recorder-origin": "sdk" }, t.mediaType === L.MEDIA_TYPE_AUDIO, h);
|
|
1336
|
+
b.appendChild(w);
|
|
1337
1337
|
}
|
|
1338
|
-
} }) })] }), e(le, { children: [e(ve, { isDisabled: !!t.required && !C, onClick:
|
|
1339
|
-
},
|
|
1340
|
-
const
|
|
1341
|
-
return e(ge, { avatars: o, isLeft: !0, message: { id: `question-${n.name}`, type: "question", content:
|
|
1342
|
-
},
|
|
1338
|
+
} }) })] }), e(le, { children: [e(ve, { isDisabled: !!t.required && !C, onClick: m, children: re(t) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: m, style: { ...t.required ? { display: "none" } : {}, ...C ? { display: "none" } : {} }, children: Me(t) })] })] });
|
|
1339
|
+
}, yn = (n) => n.type === "thanks" || n.type === "uploading", pt = ({ card: n, avatars: o, isThinking: t, isCurrentQuestion: r, currentQuestionBubbleRef: i }) => {
|
|
1340
|
+
const s = ((d) => "properties" in d.props && d.props.properties && "questionHtml" in d.props.properties && d.props.properties.questionHtml ? { content: d.props.properties.questionHtml, isHtml: !0 } : "message" in d.props ? { content: d.props.message, isHtml: !1 } : { content: "Question", isHtml: !1 })(n);
|
|
1341
|
+
return e(ge, { avatars: o, isLeft: !0, message: { id: `question-${n.name}`, type: "question", content: s.content }, ref: r ? i : null, children: t ? e(dt, {}) : e(Be, { children: [s.isHtml ? e(ye, { className: "chat-message-text", html: s.content }) : e("div", { className: "chat-message-text", children: s.content }), n.type === "videovoice" && e(An, { properties: n.props, questionId: n.name, surveyVideoUrl: n.props.properties.videoUrl })] }) });
|
|
1342
|
+
}, vt = ({ card: n, avatars: o }) => {
|
|
1343
1343
|
const t = ((r) => {
|
|
1344
1344
|
if (!("properties" in r.props) || !r.props.properties || typeof r.props.properties != "object") return null;
|
|
1345
|
-
const i = r.props.properties,
|
|
1346
|
-
for (const { key: d, isHtml: u } of
|
|
1347
|
-
const
|
|
1348
|
-
if (typeof
|
|
1349
|
-
const
|
|
1350
|
-
if (
|
|
1351
|
-
if (u && !
|
|
1352
|
-
return { content:
|
|
1345
|
+
const i = r.props.properties, s = [{ key: "captionHtml", isHtml: !0 }, { key: "captionText", isHtml: !1 }, { key: "richTextBody", isHtml: !0 }, { key: "body", isHtml: !1 }];
|
|
1346
|
+
for (const { key: d, isHtml: u } of s) {
|
|
1347
|
+
const a = i[d];
|
|
1348
|
+
if (typeof a != "string") continue;
|
|
1349
|
+
const v = a.trim();
|
|
1350
|
+
if (v) {
|
|
1351
|
+
if (u && !v.replaceAll(/<[^>]*>/g, "").trim()) continue;
|
|
1352
|
+
return { content: v, isHtml: u };
|
|
1353
1353
|
}
|
|
1354
1354
|
}
|
|
1355
1355
|
return null;
|
|
1356
1356
|
})(n);
|
|
1357
1357
|
return t ? e(ge, { avatars: o, hideAvatar: !0, isLeft: !0, message: { id: `caption-${n.name}`, type: "question", content: t.content }, children: t.isHtml ? e(ye, { className: "chat-message-text", html: t.content }) : e("div", { className: "chat-message-text", children: t.content }) }) : null;
|
|
1358
|
-
},
|
|
1359
|
-
const r = ((i,
|
|
1360
|
-
if (i.type === "open" &&
|
|
1358
|
+
}, mt = ({ card: n, userResponse: o, avatars: t }) => {
|
|
1359
|
+
const r = ((i, s) => {
|
|
1360
|
+
if (i.type === "open" && s && typeof s == "object" && "value" in s) return s.value;
|
|
1361
1361
|
})(n, o);
|
|
1362
1362
|
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: r || e("div", { className: "chat-message-no-response", children: "No response" }) }) }), e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${t.respondentAvatar["1x"]} 1x, ${t.respondentAvatar["2x"]} 2x` })] });
|
|
1363
|
-
},
|
|
1364
|
-
const { endCard: i } =
|
|
1365
|
-
return e(Be, { children: [e(ge, { avatars: o, isLeft: !0, message: { id: `thanks-${n.name}`, type: "question", content: (i == null ? void 0 : i.headline) ?? "Great! Thank you for your participation." }, ref: t ? r : null }), (i == null ? void 0 : i.subheader) && e(ge, { avatars: o, hideAvatar: !0, isLeft: !0, message: { id: `caption-${n.name}`, type: "question", content: i.subheader } }), e(
|
|
1366
|
-
},
|
|
1367
|
-
const
|
|
1368
|
-
if (c) return e(
|
|
1369
|
-
const
|
|
1370
|
-
return e(
|
|
1363
|
+
}, ht = ({ card: n, avatars: o, isCurrentQuestion: t, currentQuestionBubbleRef: r }) => {
|
|
1364
|
+
const { endCard: i } = G((s) => ({ endCard: s.endCard }));
|
|
1365
|
+
return e(Be, { children: [e(ge, { avatars: o, isLeft: !0, message: { id: `thanks-${n.name}`, type: "question", content: (i == null ? void 0 : i.headline) ?? "Great! Thank you for your participation." }, ref: t ? r : null }), (i == null ? void 0 : i.subheader) && e(ge, { avatars: o, hideAvatar: !0, isLeft: !0, message: { id: `caption-${n.name}`, type: "question", content: i.subheader } }), e($n, {})] });
|
|
1366
|
+
}, gt = ({ card: n, cardIndex: o, index: t, avatars: r, cardResponses: i, questionThinkingStates: s, startingQuestionIdx: d, currentQuestionBubbleRef: u, handleCardResponse: a }) => {
|
|
1367
|
+
const v = o === t, y = o < t, c = yn(n);
|
|
1368
|
+
if (c) return e(ht, { avatars: r, card: n, currentQuestionBubbleRef: u, isCurrentQuestion: v });
|
|
1369
|
+
const h = `${n.name}`, k = i.get(h), C = n.type === "open", g = s.get(h), f = o > (d ?? 0) && n.type !== "thanks" && n.type !== "uploading" && (g === !0 || g === void 0);
|
|
1370
|
+
return e(nn.Fragment, { children: [e(pt, { avatars: r, card: n, currentQuestionBubbleRef: u, isCurrentQuestion: v, isThinking: f }), !f && e(vt, { avatars: r, card: n }), y && C ? e(mt, { avatars: r, card: n, userResponse: k }) : (!y || !C) && !f && e(ge, { avatars: r, isLeft: !1, message: { id: `card-${n.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e(ft, { card: n, className: c ? "chat-thanks-card" : "chat-card", isAnswered: y, next: v ? a : () => {
|
|
1371
1371
|
} }) }) })] }, `question-card-${n.name}`);
|
|
1372
|
-
}, ge =
|
|
1372
|
+
}, ge = nn.forwardRef(({ message: n, isLeft: o = !1, children: t, avatars: r, hideAvatar: i = !1 }, s) => {
|
|
1373
1373
|
const d = o ? "chat-bubble-left" : "chat-bubble-right";
|
|
1374
|
-
return e("div", { className: `chat-bubble-container ${o ? "chat-left" : "chat-right"}${o && i ? " chat-no-avatar" : ""}`, ref:
|
|
1374
|
+
return e("div", { className: `chat-bubble-container ${o ? "chat-left" : "chat-right"}${o && i ? " chat-no-avatar" : ""}`, ref: s, children: [o && !i && e("img", { alt: "AI Avatar", className: "chat-avatar chat-avatar-left", srcSet: `${r.agentAvatar["1x"]} 1x, ${r.agentAvatar["2x"]} 2x` }), e("div", { className: `chat-bubble ${d}`, children: t || e("div", { className: "chat-message-text", children: n.content }) }), !o && !i && e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x` })] });
|
|
1375
1375
|
});
|
|
1376
1376
|
ge.displayName = "ChatBubble";
|
|
1377
|
-
const
|
|
1378
|
-
const n =
|
|
1377
|
+
const bt = () => {
|
|
1378
|
+
const n = G((t) => t.close), o = fe(() => () => n(Ue), [n]);
|
|
1379
1379
|
return e("div", { "aria-label": "Close button", className: "conversational-close-btn", onClick: o, onKeyPress: (t) => {
|
|
1380
1380
|
t.key === "Enter" && o();
|
|
1381
1381
|
}, 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" }) }) });
|
|
1382
|
-
},
|
|
1382
|
+
}, ft = ({ card: n, next: o, className: t = "", isAnswered: r = !1 }) => {
|
|
1383
1383
|
const i = { className: r ? `${t} answered-card` : t, next: r ? () => {
|
|
1384
1384
|
} : o, questionId: n.name, type: n.type, isAnswered: r };
|
|
1385
1385
|
switch (n.type) {
|
|
1386
1386
|
case "consentlegal":
|
|
1387
|
-
return e(Un, { ...i, ...n.props });
|
|
1388
|
-
case "likert":
|
|
1389
1387
|
return e(Hn, { ...i, ...n.props });
|
|
1388
|
+
case "likert":
|
|
1389
|
+
return e(Fn, { ...i, ...n.props });
|
|
1390
1390
|
case "matrix":
|
|
1391
|
-
return e(
|
|
1391
|
+
return e(Gn, { ...i, ...n.props });
|
|
1392
1392
|
case "multiplechoice":
|
|
1393
|
-
return e(
|
|
1393
|
+
return e(Zn, { ...i, ...n.props });
|
|
1394
1394
|
case "multipleselect":
|
|
1395
|
-
return e(
|
|
1395
|
+
return e(Qn, { ...i, ...n.props });
|
|
1396
1396
|
case "nps":
|
|
1397
|
-
return e(
|
|
1397
|
+
return e(Yn, { ...i, ...n.props });
|
|
1398
|
+
case "aidynamicfollowup":
|
|
1398
1399
|
case "open":
|
|
1399
|
-
return e(
|
|
1400
|
+
return e(Wn, { ...i, type: n.type, ...n.props });
|
|
1400
1401
|
case "rankorder":
|
|
1401
|
-
return e(
|
|
1402
|
+
return e(Kn, { ...i, ...n.props });
|
|
1402
1403
|
case "recordedtask":
|
|
1403
|
-
return e(
|
|
1404
|
+
return e(st, { ...i, ...n.props });
|
|
1404
1405
|
case "texturlprompt":
|
|
1405
|
-
return e(
|
|
1406
|
+
return e(at, { ...i, ...n.props });
|
|
1406
1407
|
case "thanks":
|
|
1407
|
-
return e(
|
|
1408
|
+
return e(lt, { ...i, ...n.props });
|
|
1408
1409
|
case "uploading":
|
|
1409
|
-
return e(
|
|
1410
|
+
return e(ct, { ...i, ...n.props });
|
|
1410
1411
|
case "videovoice":
|
|
1411
|
-
return e(
|
|
1412
|
+
return e(ut, { ...i, ...n.props });
|
|
1412
1413
|
default:
|
|
1413
1414
|
return null;
|
|
1414
1415
|
}
|
|
1415
|
-
},
|
|
1416
|
+
}, kt = ({ cards: n, next: o, previousResponses: t }) => {
|
|
1416
1417
|
const { cardResponses: r, setCardResponse: i } = (() => {
|
|
1417
|
-
const [
|
|
1418
|
-
return { cardResponses:
|
|
1419
|
-
|
|
1418
|
+
const [m, b] = Z(/* @__PURE__ */ new Map());
|
|
1419
|
+
return { cardResponses: m, setCardResponse: be((w, l) => {
|
|
1420
|
+
b((p) => new Map(p).set(w, l));
|
|
1420
1421
|
}, []) };
|
|
1421
|
-
})(), { index:
|
|
1422
|
-
const
|
|
1423
|
-
const
|
|
1424
|
-
if (
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1422
|
+
})(), { index: s, isLongFormSurvey: d, avatars: u, showSurveyBrand: a, forceBrandedLogo: v, marketingUrlLink: y, startingQuestionIdx: c, viewDocument: h, createDynamicQuestion: k, update: C } = G((m) => ({ index: m.index, isLongFormSurvey: tn(m.studyType), avatars: m.avatars, forceBrandedLogo: m.forceBrandedLogo, startingQuestionIdx: m.startingQuestionIdx, showSurveyBrand: m.showSurveyBrand, marketingUrlLink: kn({ marketingUrl: m.marketingUrl, slugName: m.slugName, surveyId: m.surveyId, forceBrandedLogo: m.forceBrandedLogo }), viewDocument: m.viewDocument, createDynamicQuestion: m.createDynamicQuestion, update: m.update })), { currentQuestionBubbleRef: g, scrollToCurrentQuestion: f } = (({ viewDocument: m }) => {
|
|
1423
|
+
const b = se(null), w = be(() => {
|
|
1424
|
+
const l = m.querySelector(".ul-card-main-content");
|
|
1425
|
+
if (b.current && l && l instanceof HTMLElement) {
|
|
1426
|
+
const p = b.current.offsetTop - l.offsetTop - 16;
|
|
1427
|
+
l.scrollTo({ top: Math.max(0, p), behavior: "smooth" });
|
|
1427
1428
|
}
|
|
1428
1429
|
}, []);
|
|
1429
|
-
return { currentQuestionBubbleRef:
|
|
1430
|
-
})({ viewDocument:
|
|
1431
|
-
const [
|
|
1430
|
+
return { currentQuestionBubbleRef: b, scrollToCurrentQuestion: w };
|
|
1431
|
+
})({ viewDocument: h }), _ = ((m, b, w) => {
|
|
1432
|
+
const [l, p] = Z(/* @__PURE__ */ new Map());
|
|
1432
1433
|
return ue(() => {
|
|
1433
|
-
if (
|
|
1434
|
-
const
|
|
1435
|
-
if (
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1434
|
+
if (m.length > 0 && b < m.length) {
|
|
1435
|
+
const x = m[b], P = `${x.name}`;
|
|
1436
|
+
if (b <= (w ?? 0) || yn(x)) return void p((H) => new Map(H).set(P, !1));
|
|
1437
|
+
const I = (H) => H.type === "aidynamicfollowup";
|
|
1438
|
+
p((H) => {
|
|
1439
|
+
const U = !I(x) || !!x.props.loading;
|
|
1440
|
+
return new Map(H).set(P, U);
|
|
1441
|
+
});
|
|
1442
|
+
const M = setTimeout(() => {
|
|
1443
|
+
p((H) => {
|
|
1444
|
+
const U = !!I(x) && !!x.props.loading;
|
|
1445
|
+
return new Map(H).set(P, U);
|
|
1446
|
+
});
|
|
1439
1447
|
}, 1e3);
|
|
1440
|
-
return () => clearTimeout(
|
|
1448
|
+
return () => clearTimeout(M);
|
|
1441
1449
|
}
|
|
1442
|
-
}, [
|
|
1443
|
-
})(n,
|
|
1444
|
-
const [
|
|
1450
|
+
}, [b, m, w]), l;
|
|
1451
|
+
})(n, s, c), N = ((m, b) => {
|
|
1452
|
+
const [w, l] = Z(() => /* @__PURE__ */ new Set([m]));
|
|
1445
1453
|
return ue(() => {
|
|
1446
|
-
|
|
1447
|
-
}, [
|
|
1448
|
-
const
|
|
1449
|
-
|
|
1450
|
-
const
|
|
1451
|
-
for (let
|
|
1452
|
-
return
|
|
1454
|
+
l((p) => new Set(p).add(m));
|
|
1455
|
+
}, [m]), ue(() => {
|
|
1456
|
+
const p = b ?? 0;
|
|
1457
|
+
p > 0 && l((x) => {
|
|
1458
|
+
const P = new Set(x);
|
|
1459
|
+
for (let I = 0; I <= p; I++) P.add(I);
|
|
1460
|
+
return P;
|
|
1453
1461
|
});
|
|
1454
|
-
}, [
|
|
1455
|
-
})(
|
|
1456
|
-
var
|
|
1457
|
-
return { ...
|
|
1458
|
-
})) }), [t, r, n,
|
|
1462
|
+
}, [b]), w;
|
|
1463
|
+
})(s, c), R = fe(() => ({ ...t, ...ze(n.map((m, b) => {
|
|
1464
|
+
var w, l;
|
|
1465
|
+
return { ...m, value: b < s ? ((w = r.get(`${m.name}`)) == null ? void 0 : w.value) ?? null : null, secondaryValue: b < s ? ((l = r.get(`${m.name}`)) == null ? void 0 : l.secondaryValue) ?? null : null };
|
|
1466
|
+
})) }), [t, r, n, s]);
|
|
1467
|
+
wn(R);
|
|
1468
|
+
const T = En(n, R);
|
|
1459
1469
|
ue(() => {
|
|
1460
1470
|
requestAnimationFrame(() => {
|
|
1461
|
-
|
|
1462
|
-
}),
|
|
1463
|
-
}, [
|
|
1464
|
-
const
|
|
1465
|
-
if (!
|
|
1466
|
-
const
|
|
1467
|
-
if (!
|
|
1468
|
-
const
|
|
1469
|
-
i(
|
|
1470
|
-
const
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1471
|
+
f();
|
|
1472
|
+
}), C();
|
|
1473
|
+
}, [s, f, _, C]);
|
|
1474
|
+
const $ = be((m, b) => {
|
|
1475
|
+
if (!b) return;
|
|
1476
|
+
const w = T[s];
|
|
1477
|
+
if (!w) return;
|
|
1478
|
+
const l = `${w.name}`;
|
|
1479
|
+
i(l, m);
|
|
1480
|
+
const p = { ...m, questionText: In(w) };
|
|
1481
|
+
if (w.childId && (p == null ? void 0 : p.value) != null) {
|
|
1482
|
+
const x = ze([w].map((P) => ({ ...P, value: (p == null ? void 0 : p.value) ?? null, secondaryValue: (p == null ? void 0 : p.secondaryValue) ?? null })));
|
|
1483
|
+
k({ parentQuestionId: w.name, parentResponseConfig: x });
|
|
1484
|
+
}
|
|
1485
|
+
o([p]);
|
|
1486
|
+
}, [T, s, o, i]), A = T.map((m, b) => ({ card: m, cardIndex: b })).filter(({ cardIndex: m }) => N.has(m));
|
|
1487
|
+
return e("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!d && e(bt, {}), e("div", { className: "chat-container", children: e("div", { className: "chat-messages", children: A.map(({ card: m, cardIndex: b }) => e(gt, { avatars: u, card: m, cardIndex: b, cardResponses: r, currentQuestionBubbleRef: g, handleCardResponse: $, index: s, questionThinkingStates: _, startingQuestionIdx: c }, `question-card-${m.name}`)) }) }), d && e("div", { className: "long-form-question-footer-container-logo", children: a && e(jn, { forceBrandedLogo: v, marketingUrlLink: y }) })] });
|
|
1474
1488
|
};
|
|
1475
1489
|
export {
|
|
1476
|
-
|
|
1490
|
+
kt as default
|
|
1477
1491
|
};
|