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