@sprig-technologies/sprig-browser 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-loLw6bPe.cjs +1 -0
- package/dist/conversational-ui-sHjWeSW0.js +589 -0
- package/dist/core-BAdMqSxY.js +982 -0
- package/dist/core-DGzfRh0z.cjs +12 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +16 -0
- package/dist/core.js +2 -2
- package/dist/{getAttributedUrl-CKXj5eVU.js → getAttributedUrl-5g_EQiGQ.js} +306 -297
- package/dist/{getAttributedUrl-Wrb2IVbi.cjs → getAttributedUrl-DmbhGoBX.cjs} +5 -5
- package/dist/index-DmjRxajT.cjs +1 -0
- package/dist/index-hWjFkOYS.js +688 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-1Oozsgva.js → metricsReporter-Chz3rKxD.js} +1 -1
- package/dist/{metricsReporter-CXdAqZlB.cjs → metricsReporter-DOjBAl52.cjs} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/view-BE-QqXV6.cjs +1 -0
- package/dist/{view-BTPuuKmm.js → view-CKY1RqAy.js} +490 -480
- package/package.json +1 -1
- package/dist/conversational-ui-BBEwlRyA.js +0 -586
- package/dist/conversational-ui-p-aTqz70.cjs +0 -1
- package/dist/core-D7GY8Q1p.cjs +0 -12
- package/dist/core-fXpU4mUJ.js +0 -963
- package/dist/index-2SxBb1Na.cjs +0 -1
- package/dist/index-C4JVn6IQ.js +0 -678
- package/dist/view-DrHm3QYY.cjs +0 -1
|
@@ -0,0 +1,982 @@
|
|
|
1
|
+
var Dt = Object.defineProperty;
|
|
2
|
+
var At = (t, r, n) => r in t ? Dt(t, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[r] = n;
|
|
3
|
+
var N = (t, r, n) => At(t, typeof r != "symbol" ? r + "" : r, n);
|
|
4
|
+
import { l as R, g as T, s as st, e as w, S as u, v as at, m as k, b as M, h as dt, E as ie, D as j, c as Ot, r as K, i as Ct, j as Tt, k as Pt, n as $e, o as Ge, d as jt, a as Mt, p as lt, q as ct } from "./metricsReporter-Chz3rKxD.js";
|
|
5
|
+
const pr = 360, ur = "ul-app", wr = "#e6e6e6", gr = "#bd282a", yr = 1030, Ke = () => {
|
|
6
|
+
try {
|
|
7
|
+
return window.parent.Intercom;
|
|
8
|
+
} catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
}, Je = [Object.freeze(Object.defineProperty({ __proto__: null, disable: () => {
|
|
12
|
+
const t = Ke();
|
|
13
|
+
t && (t.ul_wasVisible = !!document.querySelector("iframe.intercom-launcher-frame"), t.ul_wasVisible && t("update", { hide_default_launcher: !0 }));
|
|
14
|
+
}, enable: () => {
|
|
15
|
+
const t = Ke();
|
|
16
|
+
t && (t.ul_wasVisible && t("update", { hide_default_launcher: !1 }), delete t.ul_wasVisible);
|
|
17
|
+
} }, Symbol.toStringTag, { value: "Module" }))];
|
|
18
|
+
class qt {
|
|
19
|
+
static disable() {
|
|
20
|
+
Je.forEach((r) => r.disable());
|
|
21
|
+
}
|
|
22
|
+
static enable() {
|
|
23
|
+
Je.forEach((r) => r.enable());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const Qe = "ul-view-sdk-script", Ft = /* @__PURE__ */ new Set(["ios", "android"]), F = "visitors", H = "environments";
|
|
27
|
+
async function O(t, r) {
|
|
28
|
+
var i, a, o;
|
|
29
|
+
const { shouldDropOnRateLimit: n, ...s } = r;
|
|
30
|
+
s.headers = Object.assign(T(window.UserLeap), s.headers);
|
|
31
|
+
const e = await st(t, { ...s, shouldDropOnRateLimit: n });
|
|
32
|
+
if (e.ok) {
|
|
33
|
+
const d = (i = e.headers) == null ? void 0 : i.get("Authorization"), c = d ? d.split(" ") : void 0, l = c && c.length === 2 ? c[1] : void 0, p = (a = e.headers) == null ? void 0 : a.get("x-ul-visitor-id");
|
|
34
|
+
if (window.UserLeap.userId && p === window.UserLeap.visitorId) {
|
|
35
|
+
const f = R.getItemObject("sprig.anon.env.vid.map");
|
|
36
|
+
f && f[window.UserLeap.envId] === p && (delete f[window.UserLeap.envId], R.setItemObject("sprig.anon.env.vid.map", f));
|
|
37
|
+
}
|
|
38
|
+
l && p && (p !== window.UserLeap.visitorId || window.UserLeap.token !== l) && (_("token", l), _("vid", p), w.emit(u.VisitorIDUpdated, { visitorId: p }), window.UserLeap.token = l, window.UserLeap.visitorId = p);
|
|
39
|
+
}
|
|
40
|
+
return (o = e.json) != null && o.logMessage && console.warn(`[Sprig] ${e.json.logMessage}`), e;
|
|
41
|
+
}
|
|
42
|
+
function _(t, r) {
|
|
43
|
+
const n = R.getItemObject("userleap.ids");
|
|
44
|
+
let s = n[window.UserLeap.envId];
|
|
45
|
+
s ? s[t] = r : s = { [t]: r }, n[window.UserLeap.envId] = s, R.setItemObject("userleap.ids", n);
|
|
46
|
+
}
|
|
47
|
+
function Oe() {
|
|
48
|
+
return window.previewMode ? "0" : window.UserLeap.visitorId ?? "";
|
|
49
|
+
}
|
|
50
|
+
function D(t, r, n) {
|
|
51
|
+
const s = [window.UserLeap._API_URL, "sdk", t];
|
|
52
|
+
return r && r.forEach((e) => {
|
|
53
|
+
s.push(e), e === H ? s.push(window.UserLeap.envId) : e === F && s.push(Oe());
|
|
54
|
+
}), n && s.push(n), s.join("/");
|
|
55
|
+
}
|
|
56
|
+
const Z = async (t, r, n) => {
|
|
57
|
+
var ze, Ve, We, Be;
|
|
58
|
+
const { context: s, delay: e, avatars: i, forceBrandedLogo: a, endCard: o, isFeedback: d = !1, heatmap: c, locale: l, layout: p, previewMode: f, productConfig: g, questions: y, responseGroupUid: v, surveyId: m, uuid: U, vid: h, sessionReplay: S, studyType: E, surveyVisitorAttributes: z } = t, b = T(window.UserLeap), V = ne(b), A = fe(b);
|
|
59
|
+
if (S) if (V) w.emit(u.ReplayCapture, { responseGroupUid: v, hasQuestions: !!(y != null && y.length), surveyId: m, uploadId: S.uploadId, replayType: S.replayDurationType ?? "before", seconds: S.replayDurationSeconds, generateVideoUploadUrlPayload: { mediaRecordingUid: at(), mediaType: "screen", questionId: 1, responseGroupUid: v, surveyId: m, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), visitorId: window.UserLeap.visitorId, isReplay: !0 } });
|
|
60
|
+
else {
|
|
61
|
+
if (!k.replay) return window.UserLeap.reportError("displayQuestions", new Error("Replay module not registered")), { success: !1, message: "Replay module not registered", surveyState: "no survey" };
|
|
62
|
+
k.replay.scheduleOrCaptureReplay({ responseGroupId: v, surveyId: m, visitorId: h, replayParams: S, completeUploadHeaders: b, apiUrl: window.UserLeap._API_URL, triggerTimestamp: Date.now(), isStandalone: y.length === 0 });
|
|
63
|
+
}
|
|
64
|
+
if (c) {
|
|
65
|
+
if (!k.replay) return window.UserLeap.reportError("displayQuestions", new Error("Replay module not registered")), { success: !1, message: "Replay module not registered", surveyState: "no survey" };
|
|
66
|
+
const { eventId: I, replayParams: B, responseGroupUid: be, surveyId: Le } = c;
|
|
67
|
+
await k.replay.initializeReplay({ maxReplayDurationSeconds: 300, maxInflightRequests: window.UserLeap.maxInflightReplayRequests, teardownAfter: !0, apiUrl: window.UserLeap._API_URL, replaySettings: n }), k.replay.tryReplayAction(() => {
|
|
68
|
+
var Ne;
|
|
69
|
+
return (Ne = k.replay) == null ? void 0 : Ne.scheduleCapture({ apiUrl: window.UserLeap._API_URL, completeUploadHeaders: b, eventId: I, isHeatmap: !0, replayParams: B, responseGroupId: be, surveyId: Le, triggerTimestamp: Date.now(), visitorId: h });
|
|
70
|
+
}, "Error in scheduling/capturing replay");
|
|
71
|
+
}
|
|
72
|
+
if (h == null || !(y != null && y.length)) return M.info("CannotDisplaySurvey", { vid: h }), { success: !1, message: "[Sprig] no survey found", surveyState: "no survey" };
|
|
73
|
+
if (window.UserLeap.container) {
|
|
74
|
+
M.info("AlreadyDisplayingSurvey");
|
|
75
|
+
const I = "[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";
|
|
76
|
+
return console.warn(I), { success: !1, message: I, surveyState: "no survey" };
|
|
77
|
+
}
|
|
78
|
+
if (h !== window.UserLeap.visitorId && U !== window.UserLeap.visitorId && !window.previewMode) {
|
|
79
|
+
const I = "Attempted to display survey to a different visitor";
|
|
80
|
+
return window.UserLeap.reportError("DisplaySurvey", new Error(I)), { success: !1, message: I, surveyState: "no survey" };
|
|
81
|
+
}
|
|
82
|
+
M.info("ShowingSurvey", { surveyId: m }), (ze = k.replay) == null || ze.RecordSurveyShown({ id: m, userAgent: window.navigator.userAgent }), qt.disable(), w.emit(u.SurveyWillPresent, { name: u.SurveyWillPresent, "survey.id": m, layout: p });
|
|
83
|
+
let W, q, x, oe, se = document.createElement("div");
|
|
84
|
+
const Me = (I) => {
|
|
85
|
+
const { "view.version": B } = I;
|
|
86
|
+
B !== b["x-ul-sdk-version"] && ut(), w.removeListener("verify.view.version", Me);
|
|
87
|
+
};
|
|
88
|
+
w.on("verify.view.version", Me), window.UserLeap.useMobileStyling = A, dt(b) ? (W = "ul-direct-embeded-frame", q = document.head, x = window, oe = !1, (() => {
|
|
89
|
+
const I = T(window.UserLeap), B = ne(I), be = window.UserLeap.forceDirectEmbed, Le = I["userleap-platform"] === "web";
|
|
90
|
+
return B || be && Le;
|
|
91
|
+
})() && (pt(m, d), se.id = W, window.UserLeap.container.appendChild(se), wt(), w.emit(u.SurveyLifeCycle, { state: "presented" }), w.emit(u.SurveyPresented, { name: u.SurveyPresented, "survey.id": m }))) : { frameId: W, contentWinDocHead: q, contentWindow: x, hasOverlay: oe, iframe: se } = Vt({ productConfig: g, useMobileStyling: A, surveyId: m, isFeedback: d, enableCspTrustedTypes: (Ve = window.UserLeap._config) == null ? void 0 : Ve.enableCspTrustedTypes }), window.UserLeap.frameId = W;
|
|
92
|
+
const J = { apiURL: window.UserLeap._API_URL, avatars: i, cards: y, configureExitOnOverlayClick: (I) => {
|
|
93
|
+
w.once(u.CloseSurveyOnOverlayClick, I);
|
|
94
|
+
}, context: s, endCard: o, envId: window.UserLeap.envId, eventEmitFn: w.emit.bind(w), fontFamily: window.UserLeap.fontFamily, fontFamilyURL: window.UserLeap.fontFamilyURL, forceBrandedLogo: a, frame: se, headers: b, layout: p, locale: l, mobileSDKVersion: window.UserLeap.mobileSDKVersion, previewKey: R.getItem("sprig.previewKey"), previewMode: f, productConfig: { framePosition: g == null ? void 0 : g.framePosition, desktopDisplay: g == null ? void 0 : g.desktopDisplay, placement: g == null ? void 0 : g.placement }, responseGroupUid: v, startingQuestionIdx: (We = window.UserLeap.config) == null ? void 0 : We.startingQuestionIdx, studyType: E, styleNonce: window.UserLeap.styleNonce, surveyId: m, tabTitle: document.title, trackPageViewUrl: r, ulEvents: ie, upchunkLibraryURL: window.UserLeap.upchunkLibraryURL, useMobileStyling: A, userId: U, viewDocument: x == null ? void 0 : x.document, viewWindow: x, visitorAttributes: { externalUserId: window.UserLeap.userId, email: window.UserLeap.email }, surveyVisitorAttributes: z || {}, ...window.UserLeap._config };
|
|
95
|
+
(Be = window.UserLeap._config) != null && Be.startingQuestionIdx && (window.UserLeap._config = { ...window.UserLeap._config, startingQuestionIdx: null });
|
|
96
|
+
const xt = (d ? window.UserLeap.feedbackCustomStyles : window.UserLeap.customStyles) ?? g.customStyles;
|
|
97
|
+
J.customStyles = xt, x && (x.__cfg = J);
|
|
98
|
+
const ve = window.UserLeap.viewSDKURL ? window.UserLeap.viewSDKURL : J.path, qe = document.getElementById(Qe);
|
|
99
|
+
qe && qe.remove();
|
|
100
|
+
const he = function() {
|
|
101
|
+
const I = document.createElement("script");
|
|
102
|
+
return I.setAttribute("type", "module"), window.UserLeap.nonce && I.setAttribute("nonce", window.UserLeap.nonce), I.id = Qe, I;
|
|
103
|
+
}(), Fe = () => {
|
|
104
|
+
window.UserLeap.container && Object.assign(window.UserLeap.container.style, { display: "flex" });
|
|
105
|
+
};
|
|
106
|
+
if (J.installationMethod === "web-npm" || J.installationMethod === "web-npm-bundled") {
|
|
107
|
+
const { default: I } = await import("./view-CKY1RqAy.js").then((B) => B.v);
|
|
108
|
+
I.configure(J), oe && window.UserLeap.container && Fe();
|
|
109
|
+
} else ve && (he.src = `${ve}?t=${Date.now()}`, oe && he.addEventListener("load", () => {
|
|
110
|
+
window.UserLeap.container && Fe();
|
|
111
|
+
}), x == null || x.addEventListener("error", (I) => {
|
|
112
|
+
I.target instanceof HTMLScriptElement && I.target.src === ve && window.UserLeap.reportError("loadFrameScript", new Error("Frame script failed to load"));
|
|
113
|
+
}, { capture: !0, once: !0 }));
|
|
114
|
+
q == null || q.appendChild(he);
|
|
115
|
+
const He = { success: !0, surveyState: "ready", surveyId: m, responseGroupUid: v };
|
|
116
|
+
return window.UserLeap.isMobileSDK && e && (He.delay = e), He;
|
|
117
|
+
};
|
|
118
|
+
function fe(t) {
|
|
119
|
+
var n;
|
|
120
|
+
if (window.UserLeap.useMobileStyling !== void 0) return window.UserLeap.useMobileStyling;
|
|
121
|
+
const r = ((n = window.UserLeap.windowDimensions) == null ? void 0 : n.width) ?? document.body.clientWidth;
|
|
122
|
+
return ne(t) || r > 10 && r < 500;
|
|
123
|
+
}
|
|
124
|
+
function ne(t) {
|
|
125
|
+
return Ft.has(t["userleap-platform"]);
|
|
126
|
+
}
|
|
127
|
+
const Ye = /* @__PURE__ */ new WeakMap(), Ht = (t, r) => {
|
|
128
|
+
try {
|
|
129
|
+
return ((s) => {
|
|
130
|
+
var a, o;
|
|
131
|
+
const e = Ye.get(s);
|
|
132
|
+
if (e) return e;
|
|
133
|
+
if (!((a = s.trustedTypes) != null && a.createPolicy)) throw new Error("Trusted types not supported");
|
|
134
|
+
const i = (o = s.trustedTypes) == null ? void 0 : o.createPolicy("sprig-sdk", { createHTML: (d) => d, createScript: (d) => d, createScriptURL: (d) => d });
|
|
135
|
+
return Ye.set(s, i), i;
|
|
136
|
+
})(r).createHTML(t);
|
|
137
|
+
} catch (n) {
|
|
138
|
+
return console.warn("Could not create TrustedHTML object", n), t;
|
|
139
|
+
}
|
|
140
|
+
}, Ce = (t, r, n = window) => {
|
|
141
|
+
var s;
|
|
142
|
+
return r && ((s = n.trustedTypes) != null && s.createPolicy) ? Ht(t, n) : t;
|
|
143
|
+
}, Te = "ul-frame";
|
|
144
|
+
window.UserLeap && window.Sprig && (window.Sprig._gtm ? window.Sprig = window.UserLeap : window.UserLeap = window.Sprig), window.UserLeap || (window.UserLeap = window.Sprig), window.Sprig || (window.Sprig = window.UserLeap);
|
|
145
|
+
const Ue = "0px", pt = (t, r, n) => {
|
|
146
|
+
window.UserLeap.container = document.createElement("div"), window.UserLeap.container.className = "ul-container" + (r ? " ul-container-feedback" : ""), t && (window.UserLeap.container.dataset.studyId = t.toString());
|
|
147
|
+
const s = yt();
|
|
148
|
+
n && s && !window.UserLeap.useMobileStyling ? s.appendChild(window.UserLeap.container) : document.body.appendChild(window.UserLeap.container);
|
|
149
|
+
}, ut = (t, r) => {
|
|
150
|
+
var s;
|
|
151
|
+
Bt();
|
|
152
|
+
const n = window.UserLeap.container;
|
|
153
|
+
if (n) try {
|
|
154
|
+
(s = n.parentNode) == null || s.removeChild(n), window.UserLeap.container = null, _("trackStartUrl", null), w.emit(u.SurveyLifeCycle, { state: "dismissed" }), w.emit(u.SurveyClosed, { name: u.SurveyClosed, initiator: t, "survey.id": parseInt(n.dataset.studyId), ...r && { studyType: r } });
|
|
155
|
+
} catch (e) {
|
|
156
|
+
console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${t} ` + n), e instanceof Error && window.UserLeap.reportError("dismissActiveSurvey", e);
|
|
157
|
+
}
|
|
158
|
+
}, wt = () => {
|
|
159
|
+
w.once(u.SurveyWillClose, ({ initiator: t, studyType: r }) => {
|
|
160
|
+
w.removeAllListeners(u.CloseSurveyOnOverlayClick), ut(t, r);
|
|
161
|
+
});
|
|
162
|
+
}, zt = (t, r, n, s) => {
|
|
163
|
+
var l, p;
|
|
164
|
+
const e = { position: "fixed", bottom: "0px", right: Ue, border: 0, backgroundColor: "rgba(0,0,0,0)", zIndex: 2147483646, transition: "width 0.2s ease-in-out, height 0.2s ease-in-out", maxWidth: "100%" }, i = Object.assign({}, r, window.UserLeap), { desktopDisplay: a } = r || {}, o = a === "center-modal";
|
|
165
|
+
let d;
|
|
166
|
+
o && (i.framePosition = "center");
|
|
167
|
+
let c = !1;
|
|
168
|
+
if (n) (l = window.UserLeap.windowDimensions) != null && l.width ? e.width = `${window.UserLeap.windowDimensions.width}px` : e.width = "100%", (p = window.UserLeap.windowDimensions) != null && p.height ? e.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px" : window.UserLeap.maxHeight ? e.maxHeight = window.UserLeap.maxHeight : e.maxHeight = document.body.clientHeight - 20 + "px", ["light", "dark"].includes(i.overlayStyleMobile) && (c = !0);
|
|
169
|
+
else {
|
|
170
|
+
e.width = "360px", e.maxHeight = window.UserLeap.maxHeight || "66vh";
|
|
171
|
+
const f = () => {
|
|
172
|
+
c = !0, d = { margin: "auto", position: "static" };
|
|
173
|
+
};
|
|
174
|
+
if (s) o ? f() : d = { position: "relative", height: "300px" };
|
|
175
|
+
else switch (i.framePosition) {
|
|
176
|
+
case "bottomLeft":
|
|
177
|
+
d = { left: Ue };
|
|
178
|
+
break;
|
|
179
|
+
case "topLeft":
|
|
180
|
+
d = { left: Ue, top: 0 };
|
|
181
|
+
break;
|
|
182
|
+
case "topRight":
|
|
183
|
+
d = { top: 0 };
|
|
184
|
+
break;
|
|
185
|
+
case "center":
|
|
186
|
+
f();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return c && ((f, g) => {
|
|
190
|
+
const y = { position: "fixed", overflow: "auto", top: "0px", left: "0px", display: "none", height: "100%", width: "100%", transition: "background-color 0.3s ease-out", zIndex: 2147483646 }, v = g ? f.overlayStyleMobile : f.overlayStyle;
|
|
191
|
+
y["background-color"] = v === "light" ? "rgba(255,255,255, 0.95)" : "rgba(0,0,0,0.9)", g || (y.margin = "auto"), window.UserLeap.container && Object.assign(window.UserLeap.container.style, y);
|
|
192
|
+
})(i, n), Object.assign(t.style, e, d), c;
|
|
193
|
+
}, Vt = ({ productConfig: t, useMobileStyling: r, surveyId: n, isFeedback: s, enableCspTrustedTypes: e }) => {
|
|
194
|
+
var g, y;
|
|
195
|
+
const i = Te, a = s && t.desktopDisplay === "slider";
|
|
196
|
+
pt(n, s, a), Wt();
|
|
197
|
+
const o = document.createElement("iframe");
|
|
198
|
+
o.id = i, o.setAttribute("title", "Sprig User Feedback Dialog");
|
|
199
|
+
const d = zt(o, t, r, s);
|
|
200
|
+
wt();
|
|
201
|
+
let c = !1;
|
|
202
|
+
o.setHeight = (v) => {
|
|
203
|
+
parseInt(o.style.height) == v && c || (c = !0, o.style.height = `${v}px`, w.emit(u.SurveyHeight, { name: u.SurveyHeight, contentFrameHeight: v, "survey.id": n }));
|
|
204
|
+
};
|
|
205
|
+
let l = !1;
|
|
206
|
+
o.setWidth = (v) => {
|
|
207
|
+
parseInt(o.style.width) == v && l || (l = !0, o.style.width = `${v}px`, w.emit(u.SurveyWidth, { name: u.SurveyWidth, contentFrameWidth: v, "survey.id": n }));
|
|
208
|
+
}, (g = window.UserLeap.container) == null || g.appendChild(o), t && (r ? t.exitOnOverlayClickMobile : t.exitOnOverlayClick) && window.UserLeap.container && (window.UserLeap.container.onclick = () => {
|
|
209
|
+
w.emit(u.CloseSurveyOnOverlayClick);
|
|
210
|
+
}), w.emit(u.SurveyLifeCycle, { state: "presented" }), w.emit(u.SurveyPresented, { name: u.SurveyPresented, "survey.id": n });
|
|
211
|
+
const p = (y = o.contentWindow) == null ? void 0 : y.document;
|
|
212
|
+
if (p && (p.open("text/html", "replace"), p.write(Ce("<!doctype html><head></head><body></body></html>", e, o.contentWindow)), p.close(), !r)) {
|
|
213
|
+
const v = p.body;
|
|
214
|
+
v.style.display = "flex", v.style.alignItems = "center";
|
|
215
|
+
}
|
|
216
|
+
const f = p == null ? void 0 : p.head;
|
|
217
|
+
return { frameId: i, contentWinDocHead: f, contentWindow: o.contentWindow, hasOverlay: d, iframe: o };
|
|
218
|
+
}, gt = { [u.SurveyFadingOut]: () => {
|
|
219
|
+
window.UserLeap.container && Object.assign(window.UserLeap.container.style, { "background-color": "rgba(0,0,0,0)" });
|
|
220
|
+
} }, Wt = () => {
|
|
221
|
+
Object.entries(gt).forEach(([t, r]) => {
|
|
222
|
+
w.on(t, r);
|
|
223
|
+
});
|
|
224
|
+
}, Bt = () => {
|
|
225
|
+
Object.entries(gt).forEach(([t, r]) => {
|
|
226
|
+
w.off(t, r);
|
|
227
|
+
});
|
|
228
|
+
}, P = (t) => !!t && t.nodeType === Node.ELEMENT_NODE, Xe = (t) => t instanceof HTMLElement || t instanceof SVGElement, le = ({ document: t, elementId: r, styleString: n, nonce: s }) => {
|
|
229
|
+
const e = t.getElementById(r);
|
|
230
|
+
if (e) return void (e.textContent = n);
|
|
231
|
+
const i = t.createElement("style");
|
|
232
|
+
s && (i.nonce = s), i.textContent = n, i.id = r, t.head.appendChild(i);
|
|
233
|
+
}, Nt = (t, r) => {
|
|
234
|
+
const n = r.querySelector(".sprig-question-body");
|
|
235
|
+
if (!P(n)) return t;
|
|
236
|
+
const s = n.scrollHeight;
|
|
237
|
+
return s < 100 ? t : t - (s - 100);
|
|
238
|
+
}, Ze = (t, r) => {
|
|
239
|
+
const n = r.querySelector(t);
|
|
240
|
+
if (!P(n)) return 0;
|
|
241
|
+
const s = getComputedStyle(n);
|
|
242
|
+
return parseFloat(s.paddingLeft) + parseFloat(s.paddingRight) + (parseFloat(s.marginLeft) + parseFloat(s.marginRight)) + (parseFloat(s.borderLeftWidth) + parseFloat(s.borderRightWidth));
|
|
243
|
+
}, $t = (t, r, n) => {
|
|
244
|
+
const s = t.querySelector(".ul-card__container"), e = t.querySelector(".ul-app");
|
|
245
|
+
let i = 600, a = 360, o = 0;
|
|
246
|
+
if (P(s) && P(e)) {
|
|
247
|
+
const d = s.querySelector(".ul-card--matrix_grid"), c = !d && r && n;
|
|
248
|
+
try {
|
|
249
|
+
c && (e.style.width = "360px"), i = s.clientHeight, i += ((f) => {
|
|
250
|
+
const g = f.querySelector(".sprig-question-body"), y = f.querySelector(".ul-card"), v = f.querySelector(".ul-card-main-content"), m = f.querySelector(".ul-footer"), U = f.querySelector(".sprig-container");
|
|
251
|
+
let h = 0;
|
|
252
|
+
return P(y) && (h += y.scrollHeight - y.clientHeight), P(v) && (h += v.scrollHeight - v.clientHeight), P(g) && (h += g.scrollHeight - g.clientHeight), P(m) && P(U) && U.clientHeight === 0 && (h += m.clientHeight), h;
|
|
253
|
+
})(t);
|
|
254
|
+
const l = getComputedStyle(s);
|
|
255
|
+
o = i;
|
|
256
|
+
const p = parseFloat(l.marginTop) + parseFloat(l.marginBottom);
|
|
257
|
+
i += p + (parseFloat(l.borderTopWidth) + parseFloat(l.borderBottomWidth)), d && (a = d.scrollWidth, a += Ze(".ul-card__container", t), a += Ze(".sprig-question-body", t));
|
|
258
|
+
} finally {
|
|
259
|
+
c && e.style.removeProperty("width");
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return [i + 1, a, Nt(o, t)];
|
|
263
|
+
}, mr = (t) => {
|
|
264
|
+
const r = t.querySelector(".ul-card__container");
|
|
265
|
+
r && (r.scrollTop = 0);
|
|
266
|
+
}, yt = () => L, Q = () => document.getElementById("sprig-feedback-container"), Ee = () => document.getElementById("sprig-feedback-loading-animation"), mt = () => !!document.getElementById(Te);
|
|
267
|
+
let et = !1, L = null, C = null, Pe = !1, ee = null, $ = null;
|
|
268
|
+
const Gt = ["bottom-left", "bottom-right", "center-left", "center-right"], ce = () => {
|
|
269
|
+
var r;
|
|
270
|
+
const t = window.UserLeap.container;
|
|
271
|
+
return ((r = t == null ? void 0 : t.parentElement) == null ? void 0 : r.id) === "sprig-feedback-loading-container";
|
|
272
|
+
}, ft = () => document.getElementById("sprig-feedback-error-container"), vt = () => {
|
|
273
|
+
if (!L) return 0;
|
|
274
|
+
const t = L == null ? void 0 : L.clientWidth, r = window.getComputedStyle(L);
|
|
275
|
+
return t + parseInt(r.borderRightWidth || "0") + parseInt(r.borderLeftWidth || "0");
|
|
276
|
+
}, pe = (t) => {
|
|
277
|
+
const r = Q();
|
|
278
|
+
r && ($ != null && $.endsWith("right") ? r.style.right = `${t}px` : $ != null && $.endsWith("left") && (r.style.left = `${t}px`));
|
|
279
|
+
}, Se = () => {
|
|
280
|
+
if (L && (ce() || ft())) {
|
|
281
|
+
w.off(u.SurveyAppeared, X), _e();
|
|
282
|
+
const t = vt();
|
|
283
|
+
return pe(-t), !0;
|
|
284
|
+
}
|
|
285
|
+
return !1;
|
|
286
|
+
}, X = () => {
|
|
287
|
+
if (!L || !C) return;
|
|
288
|
+
const t = Ee();
|
|
289
|
+
t && t.remove(), L.style.height = "auto", L.style.width = "auto", C.disabled = !1, Pe = !1;
|
|
290
|
+
}, _e = () => {
|
|
291
|
+
if (L && !Ee()) {
|
|
292
|
+
const t = (() => {
|
|
293
|
+
var n;
|
|
294
|
+
if (Ee()) return;
|
|
295
|
+
const r = document.createElement("div");
|
|
296
|
+
return r.className = "ul-loading-spinner-container", r.id = "sprig-feedback-loading-animation", r.role = "progressbar", r.setAttribute("aria-live", "polite"), r.setAttribute("aria-busy", "true"), r.setAttribute("aria-label", "Processing..."), r.innerHTML = Ce(`
|
|
297
|
+
<div class="ul-loading-spinner">
|
|
298
|
+
<div class="first"></div>
|
|
299
|
+
<div class="second"></div>
|
|
300
|
+
<div class="third"></div>
|
|
301
|
+
<div class="fourth"></div>
|
|
302
|
+
</div>
|
|
303
|
+
`, (n = window.UserLeap._config) == null ? void 0 : n.enableCspTrustedTypes), r;
|
|
304
|
+
})();
|
|
305
|
+
t && (L.style.height = "300px", L.style.width = "360px", L.appendChild(t));
|
|
306
|
+
}
|
|
307
|
+
}, tt = () => {
|
|
308
|
+
L && C && (pe(0), C.disabled = !0, Pe = !0);
|
|
309
|
+
}, ht = async (t, r, n) => {
|
|
310
|
+
const { buttonTheme: s, customStyles: e, eventId: i, placement: a, desktopDisplay: o, feedbackLabel: d, surveyUuid: c, surveyId: l } = t;
|
|
311
|
+
window.UserLeap.feedbackCustomStyles = void 0;
|
|
312
|
+
let p = Q();
|
|
313
|
+
if (p) {
|
|
314
|
+
if (!r && i === ee) return;
|
|
315
|
+
p.remove(), w.off(ie.SURVEY_FADING_OUT, Se);
|
|
316
|
+
}
|
|
317
|
+
ee = i, le({ document, elementId: "sprig-feedback-style", styleString: '.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.fade-in-transition{animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}#sprig-feedback-button{border-left:0;border-radius:0 8px 8px 0;display:grid;padding:8px;text-align:center;transition:all ease-in-out 1s;z-index:inherit}#sprig-feedback-button:hover{cursor:pointer}.sprig-feedback-button-label{writing-mode:vertical-lr;text-orientation:sideways}.sprig-feedback-button-right{transform:rotate(180deg)}.sprig-feedback-button-bottom{align-self:flex-end;margin-bottom:20px}.sprig-feedback-button-light{background:#efefee;color:#000;border:1px solid #e2e3e1}.sprig-feedback-button-dark{background:#000;color:#fff;border:1px solid #000000}#sprig-feedback-container{display:flex;align-items:center;position:fixed;transition:right .2s linear,left .2s linear;z-index:2147483646}.sprig-feedback-container-left{flex-flow:row-reverse}.sprig-feedback-container-center{top:50%;transform:translateY(-50%)}.sprig-feedback-container-bottom{bottom:0%;margin-bottom:15px}.sprig-feedback-loading-container{align-items:center;background-color:#fff;border:2px solid var(--feedback-border);display:flex;max-height:90vh;max-width:90vw;min-width:0px}.sprig-feedback-loading-container-left{border-left:none;border-radius:0 8px 8px 0}.sprig-feedback-loading-container-right{border-right:none;border-radius:8px 0 0 8px}#sprig-feedback-error-container{margin:auto;text-align:center;width:360px}.sprig-feedback-error-text{font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol}#sprig-feedback-loading-container .ul-container{position:relative;max-height:inherit}#sprig-feedback-loading-animation{position:absolute}.sprig-feedback-loading-container-previews iframe{max-height:inherit!important}', nonce: window.UserLeap.styleNonce }), le({ document, elementId: "ul-custom-style", styleString: e ?? "", nonce: window.UserLeap.styleNonce }), et = o === "center-modal", $ = a;
|
|
318
|
+
const [f, g] = a.split("-");
|
|
319
|
+
((U) => {
|
|
320
|
+
if (Q() || !Gt.includes(U)) return;
|
|
321
|
+
const [h, S] = U.split("-"), E = document.createElement("div");
|
|
322
|
+
E.id = "sprig-feedback-container", E.classList.add(`sprig-feedback-container-${S}`, `sprig-feedback-container-${h}`), document.body.appendChild(E);
|
|
323
|
+
})(a), p = Q(), C = document.createElement("button");
|
|
324
|
+
const y = document.createElement("div");
|
|
325
|
+
y.className = "sprig-feedback-button-label", y.innerText = d, C.appendChild(y), C.id = "sprig-feedback-button", C.classList.add(`sprig-feedback-button-${g}`, `sprig-feedback-button-${f}`, `sprig-feedback-button-${s}`, "fade-in-transition"), w.on(ie.SURVEY_FADING_OUT, Se), C.addEventListener("click", async () => {
|
|
326
|
+
const U = document.getElementById("sprig-feedback-error-container");
|
|
327
|
+
if (mt() || ft()) {
|
|
328
|
+
if (Se()) {
|
|
329
|
+
w.emit(u.SurveyCloseRequested, { name: u.SurveyCloseRequested, initiator: j.FeedbackClosed, studyType: "feedbackButton", "survey.id": l }), w.emit(u.SurveyWillClose, { name: u.SurveyWillClose, initiator: j.FeedbackClosed, studyType: "feedbackButton", "survey.id": l });
|
|
330
|
+
const S = Q();
|
|
331
|
+
U && S && (S.remove(), ee = null, L = null);
|
|
332
|
+
}
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (fe(T(window.UserLeap)) || Pe || tt(), r) return L && L.classList.add("sprig-feedback-loading-container-previews"), await Z(r), void X();
|
|
336
|
+
const h = await (async (S) => {
|
|
337
|
+
const E = await O(D("1", [F], "startFeedbackStudy"), { body: JSON.stringify({ surveyUuid: S }), method: "POST" });
|
|
338
|
+
return E.ok ? E.json : null;
|
|
339
|
+
})(c);
|
|
340
|
+
if (h) w.once(u.SurveyAppeared, X), Z({ ...h, studyType: "feedbackButton" }, n);
|
|
341
|
+
else if (L) {
|
|
342
|
+
const S = Kt();
|
|
343
|
+
L.appendChild(S), X(), L.style.height = "300px", L.style.width = "360px";
|
|
344
|
+
}
|
|
345
|
+
}), p == null || p.appendChild(C), w.emit(u.FeedbackButtonLoaded, { name: u.FeedbackButtonLoaded, "survey.id": l });
|
|
346
|
+
const { useMobileStyling: v, _config: { border: m } } = window.UserLeap;
|
|
347
|
+
if (et || v) pe(0);
|
|
348
|
+
else {
|
|
349
|
+
const U = document.createElement("div");
|
|
350
|
+
U.id = "sprig-feedback-loading-container", U.className = `sprig-feedback-loading-container sprig-feedback-loading-container-${g}`, U.style.setProperty("--feedback-border", m), L = U, _e(), p == null || p.appendChild(U);
|
|
351
|
+
const h = vt();
|
|
352
|
+
pe(-h);
|
|
353
|
+
}
|
|
354
|
+
window.UserLeap._config.isOnQuestionsTab && r && !ce() && L && (tt(), _e(), L && L.classList.add("sprig-feedback-loading-container-previews"), Z(r), X());
|
|
355
|
+
}, Kt = () => {
|
|
356
|
+
var n;
|
|
357
|
+
const t = document.createElement("div");
|
|
358
|
+
t.id = "sprig-feedback-error-container", t.innerHTML = Ce(`<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
|
|
359
|
+
<circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
|
|
360
|
+
<path d="M20 12L20 21.6" stroke="#B0B5B7" stroke-width="3" stroke-linecap="round"/>
|
|
361
|
+
<circle cx="19.9984" cy="27.6" r="1.6" fill="#B0B5B7"/>
|
|
362
|
+
</svg>`, (n = window.UserLeap._config) == null ? void 0 : n.enableCspTrustedTypes);
|
|
363
|
+
const r = document.createElement("h3");
|
|
364
|
+
return r.className = "sprig-feedback-error-text", r.innerText = "There was an error while loading the survey", t.appendChild(r), t;
|
|
365
|
+
}, Re = new class {
|
|
366
|
+
constructor() {
|
|
367
|
+
N(this, "_ldData", {});
|
|
368
|
+
}
|
|
369
|
+
getAllLaunchDarklyVariations() {
|
|
370
|
+
return this._ldData;
|
|
371
|
+
}
|
|
372
|
+
setLDFlagsVariations(t) {
|
|
373
|
+
try {
|
|
374
|
+
return !(!t || typeof t != "object" || Array.isArray(t)) && (Object.keys(this._ldData).forEach((r) => {
|
|
375
|
+
delete this._ldData[r];
|
|
376
|
+
}), Object.keys(t).forEach((r) => this._ldData[`!launch_darkly_${r}`] = (t[r] ?? 0) + 1), !0);
|
|
377
|
+
} catch (r) {
|
|
378
|
+
return r instanceof Error && window.UserLeap.reportError("setAllLDFlagsVariations", r), console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."), !1;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}();
|
|
382
|
+
Object.freeze(Re);
|
|
383
|
+
const de = new class {
|
|
384
|
+
constructor() {
|
|
385
|
+
N(this, "_optimizelyData", {});
|
|
386
|
+
}
|
|
387
|
+
setOptimizelyExperiment(t, r = !0) {
|
|
388
|
+
if (!t || typeof t != "object") return !1;
|
|
389
|
+
const { experiments: n } = t;
|
|
390
|
+
try {
|
|
391
|
+
return r && Object.keys(this._optimizelyData).map((s) => {
|
|
392
|
+
delete this._optimizelyData[s];
|
|
393
|
+
}), n && n.map((s) => {
|
|
394
|
+
const { id: e, variation: i } = s, a = this.transformExperimentId(e);
|
|
395
|
+
i && typeof i == "string" && (this._optimizelyData[a] = i);
|
|
396
|
+
}), !0;
|
|
397
|
+
} catch (s) {
|
|
398
|
+
return s instanceof Error && window.UserLeap.reportError("setOptimizelyExperiment", s), !1;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
getAllOptimizelyExperiments() {
|
|
402
|
+
return this._optimizelyData;
|
|
403
|
+
}
|
|
404
|
+
getOptimizelyVariationName(t) {
|
|
405
|
+
return this._optimizelyData[this.transformExperimentId(t)];
|
|
406
|
+
}
|
|
407
|
+
transformExperimentId(t) {
|
|
408
|
+
return "!optimizely_experiments_" + t;
|
|
409
|
+
}
|
|
410
|
+
getAndSetWebOptimizelyExperiments() {
|
|
411
|
+
var t;
|
|
412
|
+
try {
|
|
413
|
+
if (window && window.optimizely && typeof window.optimizely.get == "function") {
|
|
414
|
+
const r = (t = window.optimizely.get("state")) == null ? void 0 : t.getExperimentStates({ isActive: !0 });
|
|
415
|
+
if (r) {
|
|
416
|
+
const n = Object.keys(r).map((s) => {
|
|
417
|
+
var e, i;
|
|
418
|
+
return (e = r[s].variation) != null && e.name ? { id: s, variation: (i = r[s].variation) == null ? void 0 : i.name } : { id: s, variation: "Original" };
|
|
419
|
+
});
|
|
420
|
+
return this.setOptimizelyExperiment({ experiments: n }, !1), !0;
|
|
421
|
+
}
|
|
422
|
+
return !1;
|
|
423
|
+
}
|
|
424
|
+
return !1;
|
|
425
|
+
} catch (r) {
|
|
426
|
+
return r instanceof Error && window.UserLeap.reportError("getAndSetWebOptimizely", r), !1;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}();
|
|
430
|
+
Object.freeze(de);
|
|
431
|
+
class Jt {
|
|
432
|
+
constructor(r, n) {
|
|
433
|
+
N(this, "paused");
|
|
434
|
+
N(this, "queue");
|
|
435
|
+
N(this, "ul");
|
|
436
|
+
this.ul = r, this.paused = !1, this.queue = [], this.flush(n);
|
|
437
|
+
}
|
|
438
|
+
flush(r) {
|
|
439
|
+
const n = r.length;
|
|
440
|
+
if (n) for (let s = 0; s < n; s++) this.push(r[s]);
|
|
441
|
+
}
|
|
442
|
+
isPaused() {
|
|
443
|
+
return this.paused;
|
|
444
|
+
}
|
|
445
|
+
pause() {
|
|
446
|
+
this.paused = !0;
|
|
447
|
+
}
|
|
448
|
+
unpause() {
|
|
449
|
+
this.paused = !1;
|
|
450
|
+
const r = this.queue.slice();
|
|
451
|
+
this.empty(), this.flush(r);
|
|
452
|
+
}
|
|
453
|
+
push(r) {
|
|
454
|
+
if (this.paused) this.queue.push(r);
|
|
455
|
+
else if (r instanceof Function) r();
|
|
456
|
+
else {
|
|
457
|
+
const n = Array.prototype.slice.call(r, 1), s = r[0], e = this.ul[s];
|
|
458
|
+
e instanceof Function ? e.apply(this.ul, n) : s && console.warn("[Sprig] (ERR-100) No valid UserLeap action called", s);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
perform(r) {
|
|
462
|
+
if (this.paused) {
|
|
463
|
+
let n = () => {
|
|
464
|
+
};
|
|
465
|
+
const s = new Promise(function(e) {
|
|
466
|
+
n = function() {
|
|
467
|
+
e(r());
|
|
468
|
+
};
|
|
469
|
+
});
|
|
470
|
+
return this.queue.push(n), s;
|
|
471
|
+
}
|
|
472
|
+
return r();
|
|
473
|
+
}
|
|
474
|
+
empty() {
|
|
475
|
+
this.queue.length = 0;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
let bt, Lt;
|
|
479
|
+
const xe = (t) => {
|
|
480
|
+
let r = 0, n = t.firstElementChild;
|
|
481
|
+
for (; n; ) r += xe(n), n.shadowRoot && (r += xe(n.shadowRoot)), n = n.nextElementSibling, r++;
|
|
482
|
+
return r;
|
|
483
|
+
}, rt = () => {
|
|
484
|
+
bt.report(xe(document.body)), Lt.report(document.documentElement.innerHTML.toString().length);
|
|
485
|
+
}, De = (t, r) => {
|
|
486
|
+
const n = performance.now();
|
|
487
|
+
document.hidden ? setTimeout(() => De(t, r), t) : setTimeout(() => {
|
|
488
|
+
const s = performance.now() - n;
|
|
489
|
+
r.report(s / 1e3), setTimeout(() => De(t, r), t);
|
|
490
|
+
}, 0);
|
|
491
|
+
};
|
|
492
|
+
let ue, we, ge, ye, it, G = {};
|
|
493
|
+
const ae = (t, r = 1) => {
|
|
494
|
+
const { name: n } = t;
|
|
495
|
+
G[n] = (G[n] || 0) + r;
|
|
496
|
+
}, Ut = (t) => {
|
|
497
|
+
let r = 1;
|
|
498
|
+
return t.childNodes.forEach((n) => {
|
|
499
|
+
r += Ut(n);
|
|
500
|
+
}), r;
|
|
501
|
+
}, nt = (t) => {
|
|
502
|
+
let r = 0;
|
|
503
|
+
return t.forEach((n) => {
|
|
504
|
+
r += Ut(n);
|
|
505
|
+
}), r;
|
|
506
|
+
}, Qt = (t) => {
|
|
507
|
+
switch (t.type) {
|
|
508
|
+
case "childList":
|
|
509
|
+
return ae(ue, nt(t.addedNodes)), void ae(we, nt(t.removedNodes));
|
|
510
|
+
case "attributes":
|
|
511
|
+
return void ae(ge);
|
|
512
|
+
case "characterData":
|
|
513
|
+
return void ae(ye);
|
|
514
|
+
}
|
|
515
|
+
}, Yt = (t) => t.forEach(Qt), Xt = () => {
|
|
516
|
+
ue.report(G[ue.name] || 0), we.report(G[we.name] || 0), ge.report(G[ge.name] || 0), ye.report(G[ye.name] || 0), G = {};
|
|
517
|
+
}, Zt = (t = 1e3) => {
|
|
518
|
+
ue = K("sdk_mutations_nodes_added"), we = K("sdk_mutations_nodes_removed"), ge = K("sdk_mutations_attributes_changed"), ye = K("sdk_mutations_character_data"), it = new MutationObserver(Yt), it.observe(document, { attributes: !0, attributeOldValue: !0, characterData: !0, characterDataOldValue: !0, childList: !0, subtree: !0 }), setInterval(Xt, t);
|
|
519
|
+
}, er = ({ isWeb: t, reportingIntervalSeconds: r, thresholds: n, postMetrics: s }) => {
|
|
520
|
+
Ct(n, (e, i) => {
|
|
521
|
+
var a, o;
|
|
522
|
+
if ((a = k.replay) != null && a.isReplayRecording()) {
|
|
523
|
+
const d = `Value: ${e} on ${i.metric} violated threshold of ${i.type} ${i.value}`;
|
|
524
|
+
(o = k.replay) == null || o.disableRecording("Threshold violated", new Error(d), { reportError: !1 }), window.UserLeap.reportError("Sdk Performance Metric threshold violated", new Error("Sdk Performance Metric threshold violated"), { metricName: i.metric, type: i.type, value: i.value }, { metricName: i.metric }), Pt();
|
|
525
|
+
}
|
|
526
|
+
}), Tt({ reportingIntervalSeconds: r, postMetrics: s }), t && (((e = 1e3) => {
|
|
527
|
+
const i = K("sdk_event_queue_latency_seconds");
|
|
528
|
+
De(e, i);
|
|
529
|
+
})(), ((e = 1e4) => {
|
|
530
|
+
bt = K("sdk_dom_nodes_count"), Lt = K("sdk_page_html_characters"), rt(), setInterval(rt, e);
|
|
531
|
+
})(), Zt());
|
|
532
|
+
}, tr = "test", rr = ["popState", "pushState", "replaceState"];
|
|
533
|
+
let je, te;
|
|
534
|
+
const me = {}, Y = "!email", St = "pageUrl";
|
|
535
|
+
let Ie = window.location.href;
|
|
536
|
+
function re(t) {
|
|
537
|
+
var o, d;
|
|
538
|
+
const { pageUrlEvents: r, interactiveEvents: n, dismissOnPageChange: s, platform: e } = window.UserLeap._config;
|
|
539
|
+
if (e && e !== "web") return;
|
|
540
|
+
Ie !== window.location.href && M.navigation("LocationChange", { from: Ie, to: window.location.href }), Ie = window.location.href;
|
|
541
|
+
const i = Et().trackStartUrl, a = i ? String(i) : null;
|
|
542
|
+
r && Rt(window.location.href), n && (kt(), ir()), yt() && (() => {
|
|
543
|
+
if (ce()) return;
|
|
544
|
+
const c = Q();
|
|
545
|
+
c && (Ot(ee) || (c.remove(), ee = null, L = null));
|
|
546
|
+
})(), Mt.getItem("sprig.isCapturingHeatmap") && ((d = (o = k.replay) == null ? void 0 : o.checkPendingHeatmapsUrl()) == null || d.then((c) => {
|
|
547
|
+
var l;
|
|
548
|
+
c && ((l = k.replay) == null || l.uploadReadyPendingCaptures(!0));
|
|
549
|
+
})), !ce() && s && a && a !== window.location.href && t && rr.includes(t.type) && window.UserLeap("dismissActiveSurvey", j.PageChange);
|
|
550
|
+
}
|
|
551
|
+
const It = { capture: !0 }, ir = () => {
|
|
552
|
+
const t = window.UserLeap._config.interactiveEvents.filter((n) => lt(n, window.location.href)).map((n) => {
|
|
553
|
+
const { name: s, properties: e } = n, { selector: i, innerText: a } = e;
|
|
554
|
+
return i ? (o) => {
|
|
555
|
+
if (Xe(o.target)) try {
|
|
556
|
+
o.target.closest(i) && window.UserLeap("track", s);
|
|
557
|
+
} catch {
|
|
558
|
+
}
|
|
559
|
+
return !1;
|
|
560
|
+
} : (o) => (Xe(o.target) && o.target.innerText === a && window.UserLeap("track", s), !1);
|
|
561
|
+
}), r = (n) => t.forEach((s) => s(n));
|
|
562
|
+
window.UserLeap._config.interactiveEventsHandler = r, window.addEventListener("click", r, It);
|
|
563
|
+
}, kt = () => {
|
|
564
|
+
window.UserLeap._config.interactiveEventsHandler && window.removeEventListener("click", window.UserLeap._config.interactiveEventsHandler, It), delete window.UserLeap._config.interactiveEventsHandler;
|
|
565
|
+
};
|
|
566
|
+
function Et() {
|
|
567
|
+
const t = R.getItemObject("userleap.ids");
|
|
568
|
+
return t && t[window.UserLeap.envId] || {};
|
|
569
|
+
}
|
|
570
|
+
function _t() {
|
|
571
|
+
if (window.previewMode) return;
|
|
572
|
+
const t = R.getItemObject("sprig.anon.env.vid.map") || {}, r = t[window.UserLeap.envId];
|
|
573
|
+
window.UserLeap.visitorId = r || at(), M.info("NewVid", { vid: window.UserLeap.visitorId }), _("vid", window.UserLeap.visitorId), r || (t[window.UserLeap.envId] = window.UserLeap.visitorId, R.setItemObject("sprig.anon.env.vid.map", t)), w.emit(u.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId });
|
|
574
|
+
}
|
|
575
|
+
function Rt(t, r, n, s) {
|
|
576
|
+
var e, i;
|
|
577
|
+
try {
|
|
578
|
+
if (t.endsWith("mock_snippet.html")) return;
|
|
579
|
+
M.info("PageView", { url: t });
|
|
580
|
+
const a = (e = document == null ? void 0 : document.querySelector('meta[name="description"]')) == null ? void 0 : e.getAttribute("content");
|
|
581
|
+
(i = k.replay) == null || i.RecordPageView({ ...a && { description: a }, url: t, referrer: document.referrer, pageTitle: document.title });
|
|
582
|
+
const o = window.UserLeap._config.pageUrlEvents;
|
|
583
|
+
let d = !1;
|
|
584
|
+
if (o && o.length) for (let l = 0; l < o.length && (d = lt(o[l], t), !d); l++) ;
|
|
585
|
+
if (!d) return;
|
|
586
|
+
window.UserLeap.debugMode && console.info("[DEBUG] Sprig trackPageView", t);
|
|
587
|
+
const c = { url: t };
|
|
588
|
+
s && (c.trackPageView = !0), window.UserLeap._queue.push(["track", St, r, c, n]);
|
|
589
|
+
} catch (a) {
|
|
590
|
+
a instanceof Error && (a.stack = t, window.UserLeap.reportError("trackPageView", a)), console.warn("[Sprig] (ERR-428) Failed to track page view", a);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
function nr() {
|
|
594
|
+
const t = "Backbone" in window && window.Backbone && window.Backbone.history ? window.Backbone.history : window.history;
|
|
595
|
+
"pushState" in t && (t.pushState = /* @__PURE__ */ ((r) => function(...n) {
|
|
596
|
+
const s = r.apply(this, n), e = new Event("pushState");
|
|
597
|
+
return window.dispatchEvent(e), re(e), s;
|
|
598
|
+
})(t.pushState)), "replaceState" in t && (t.replaceState = /* @__PURE__ */ ((r) => function(...n) {
|
|
599
|
+
const s = r.apply(this, n), e = new Event("replaceState");
|
|
600
|
+
return window.dispatchEvent(e), re(e), s;
|
|
601
|
+
})(t.replaceState)), ["hashchange", "popstate"].forEach((r) => window.addEventListener(r, re, !0));
|
|
602
|
+
}
|
|
603
|
+
async function ke(t, r) {
|
|
604
|
+
const n = Oe();
|
|
605
|
+
t && !r && (window.UserLeap._config.mode = tr);
|
|
606
|
+
const s = fe(T(window.UserLeap)), e = await O(function(i) {
|
|
607
|
+
const a = new URL(D("1", [H], "questions"));
|
|
608
|
+
return Object.entries(i || {}).forEach(([o, d]) => {
|
|
609
|
+
d && a.searchParams.append(o, String(d));
|
|
610
|
+
}), a.toString();
|
|
611
|
+
}({ desktopDisplay: window.UserLeap._config.desktopDisplay, isMobile: s, previewLanguage: window.UserLeap._config.previewLanguage, surveyid: t == null ? void 0 : t.surveyId, surveytemplateid: t == null ? void 0 : t.surveyTemplateId, vid: n }), { shouldDropOnRateLimit: !0 });
|
|
612
|
+
if (!e.ok) return e.reportError && e.error && (console.warn("[Sprig] (ERR-414) Failed to request questions from the server", e.error), window.UserLeap.reportError("getQuestions", e.error)), { success: !1, surveyState: "no survey" };
|
|
613
|
+
if (e.json.delay && await ct(e.json.delay), !e.json.isFeedback) return Z(e.json, te, je);
|
|
614
|
+
{
|
|
615
|
+
const { feedbackLabel: i, productConfig: a, surveyUuid: o, feedbackCustomStyles: d } = e.json, { buttonTheme: c, placement: l, desktopDisplay: p } = a;
|
|
616
|
+
ht({ customStyles: d, buttonTheme: c, desktopDisplay: p, eventId: 0, feedbackLabel: i, placement: l, surveyUuid: o, surveyId: t == null ? void 0 : t.surveyId }, e.json);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
function or(t) {
|
|
620
|
+
if (!t) return;
|
|
621
|
+
window.UserLeap._config = t, t.mute && window.UserLeap._queue.pause();
|
|
622
|
+
const { interactiveEvents: r, pageUrlEvents: n, dismissOnPageChange: s } = t;
|
|
623
|
+
r && function(e) {
|
|
624
|
+
let i = e.length;
|
|
625
|
+
for (; i; ) {
|
|
626
|
+
const a = Math.floor(Math.random() * i);
|
|
627
|
+
i -= 1;
|
|
628
|
+
const o = e[i];
|
|
629
|
+
e[i] = e[a], e[a] = o;
|
|
630
|
+
}
|
|
631
|
+
}(r), (r || n || s) && (nr(), re());
|
|
632
|
+
}
|
|
633
|
+
const sr = function(t) {
|
|
634
|
+
if (!window.UserLeap) return;
|
|
635
|
+
const r = async (e = {}) => {
|
|
636
|
+
var U, h, S, E, z;
|
|
637
|
+
const { userId: i, anonymousId: a, metadata: o = {}, properties: d, showSurveyCallback: c } = e;
|
|
638
|
+
let { eventName: l } = e;
|
|
639
|
+
if (window.UserLeap.debugMode && l !== St && console.info("[DEBUG] Sprig track", e), t.mode === "test") return;
|
|
640
|
+
const p = R.getItem("sprig.previewKey") ?? void 0;
|
|
641
|
+
if (t.requireUserIdForTracking && !window.UserLeap.userId && !i) {
|
|
642
|
+
const b = "[Sprig] - Skipping tracking without userId";
|
|
643
|
+
return console.warn(b), { success: !1, message: b, surveyState: "no survey" };
|
|
644
|
+
}
|
|
645
|
+
if (!l || l.trim().length === 0) {
|
|
646
|
+
l = l ? String(l) : "";
|
|
647
|
+
const b = "[Sprig] - Invalid event name " + l;
|
|
648
|
+
return console.warn(b), { success: !1, message: b, surveyState: "no survey" };
|
|
649
|
+
}
|
|
650
|
+
const f = te ?? window.location.href;
|
|
651
|
+
o.url || (o.url = f), _("trackStartUrl", f), (h = (U = window.UserLeap) == null ? void 0 : U._config) != null && h.optimizelyEnabled && (ne(T(window.UserLeap)) || de.getAndSetWebOptimizelyExperiments(), o.optimizelyExperiments = Object.assign({}, de.getAllOptimizelyExperiments())), (E = (S = window.UserLeap) == null ? void 0 : S._config) != null && E.launchDarklyEnabled && (o.launchDarklyFlags = Re.getAllLaunchDarklyVariations()), i && (window.UserLeap.userId = i), a && (window.UserLeap.partnerAnonymousId = a), d && (o.eventProperties = d), (z = k.replay) == null || z.RecordEvent({ name: l, url: o.url }), M.info("TrackEvent", { eventName: l });
|
|
652
|
+
const g = window.UserLeap.delayingSurvey || mt() ? await O(D("1", [F], "events/batch"), { body: JSON.stringify({ events: [{ event: l, metadata: o }], previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 }) : await O(D("1", [F], "events"), { body: JSON.stringify({ event: l, metadata: o, previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 });
|
|
653
|
+
if (!g.ok) {
|
|
654
|
+
const b = "[Sprig] (ERR-421) Failed to track event";
|
|
655
|
+
return g.reportError && (console.warn(b, g.error), g.error && window.UserLeap.reportError("track", g.error)), { success: !1, message: b, error: g.error, surveyState: "no survey" };
|
|
656
|
+
}
|
|
657
|
+
i && _("uid", i), a && _("aid", a);
|
|
658
|
+
const y = g.json;
|
|
659
|
+
y.invalidPreviewKey && R.removeItem("sprig.previewKey");
|
|
660
|
+
const v = o.trackPageView ? o.url : void 0;
|
|
661
|
+
return y != null && y.feedbackButton && ht(y.feedbackButton, void 0, v), await async function(b, V) {
|
|
662
|
+
var W, q;
|
|
663
|
+
let A = !0;
|
|
664
|
+
return !(V && ((W = b == null ? void 0 : b.json) != null && W.surveyId) && (window.UserLeap.delayingSurvey = !0, A = await V(b.json.surveyId), window.UserLeap.delayingSurvey = !1, !A)) && ((q = b == null ? void 0 : b.json) != null && q.delay && !window.UserLeap.isMobileSDK && (window.UserLeap.delayingSurvey = !0, await ct(b.json.delay), window.UserLeap.delayingSurvey = !1), A);
|
|
665
|
+
}(g, c) ? function(b) {
|
|
666
|
+
if (!window.UserLeap._config.dismissOnPageChange) return !0;
|
|
667
|
+
const V = new URL(b), A = new URL(te ?? window.location.href);
|
|
668
|
+
return V.hostname === A.hostname && V.pathname === A.pathname;
|
|
669
|
+
}(f) ? Z(y, v, je) : { success: !1, message: "Study should not be displayed after page navigation", surveyState: "no survey" } : { success: !1, message: "[Sprig] Callback returned false, aborting rendering of survey", surveyState: "no survey" };
|
|
670
|
+
}, n = (e, i) => {
|
|
671
|
+
var o;
|
|
672
|
+
const a = (o = e == null ? void 0 : e.querySelector(`[id="${Te}"]`)) == null ? void 0 : o.contentDocument;
|
|
673
|
+
a && le({ document: a, elementId: "ul-custom-style", styleString: i });
|
|
674
|
+
}, s = { displaySurvey: async (e) => (console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."), window.UserLeap("dismissActiveSurvey", j.Override), ke({ surveyId: e }, !0)), _previewSurvey(e) {
|
|
675
|
+
window.UserLeap("dismissActiveSurvey", j.Override), ke({ surveyTemplateId: e }, !1);
|
|
676
|
+
}, _reviewSurvey(e) {
|
|
677
|
+
window.UserLeap("dismissActiveSurvey", j.Override), ke({ surveyId: e }, !1);
|
|
678
|
+
}, previewSurvey(e) {
|
|
679
|
+
s._previewSurvey(e);
|
|
680
|
+
}, reviewSurvey(e) {
|
|
681
|
+
s._reviewSurvey(e);
|
|
682
|
+
}, mute() {
|
|
683
|
+
window.UserLeap._queue.pause();
|
|
684
|
+
}, unmute() {
|
|
685
|
+
window.UserLeap._queue.unpause();
|
|
686
|
+
}, setVisitorToken() {
|
|
687
|
+
console.warn("[Sprig] setVisitorToken is deprecated.");
|
|
688
|
+
}, dismissActiveSurvey(e = j.API) {
|
|
689
|
+
window.UserLeap.container && (e === j.Closed && window.Sprig.trackHistory && window.Sprig.trackHistory({ event: "closed" }), w.emit(u.SurveyCloseRequested, { name: u.SurveyCloseRequested, initiator: e, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }), w.emit(u.SurveyWillClose, { name: u.SurveyWillClose, initiator: e, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }));
|
|
690
|
+
}, async setAttribute(e, i) {
|
|
691
|
+
if (!e || !i && i !== 0 && i !== !1) {
|
|
692
|
+
const a = "[Sprig] - Disregarding empty attribute / value provided";
|
|
693
|
+
return console.warn(a), { success: !1, message: a };
|
|
694
|
+
}
|
|
695
|
+
return this.setAttributes({ [e]: i });
|
|
696
|
+
}, async setAttributes(e) {
|
|
697
|
+
if (e == null || Object.keys(e).length === 0) {
|
|
698
|
+
const i = "[Sprig] - Disregarding empty attributes provided";
|
|
699
|
+
return console.warn(i), { success: !1, message: i };
|
|
700
|
+
}
|
|
701
|
+
return this.identifyAndSetAttributes({ attributes: e });
|
|
702
|
+
}, async identifyAndSetAttributes(e) {
|
|
703
|
+
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig identifyAndSetAttributes", e), t.mode === "test") return;
|
|
704
|
+
if (e === null || typeof e != "object" || !(e.userId || e.anonymousId || e.attributes)) {
|
|
705
|
+
const l = "[Sprig] - Disregarding empty payload provided";
|
|
706
|
+
return console.warn(l), { success: !1, message: l };
|
|
707
|
+
}
|
|
708
|
+
const { userId: i, anonymousId: a, attributes: o } = e;
|
|
709
|
+
if (t.requireUserIdForTracking && !window.UserLeap.userId && !i) {
|
|
710
|
+
const l = "[Sprig] - Skipping tracking without userId";
|
|
711
|
+
return console.warn(l), { success: !1, message: l };
|
|
712
|
+
}
|
|
713
|
+
if (o) {
|
|
714
|
+
o.email && !o[Y] && (o[Y] = o.email, delete o.email);
|
|
715
|
+
const l = Object.keys(o);
|
|
716
|
+
for (const p of l) o[p] === me[p] && delete o[p];
|
|
717
|
+
}
|
|
718
|
+
if (!(o && Object.keys(o).length !== 0 || i && window.UserLeap.userId !== i || a && window.UserLeap.partnerAnonymousId !== a)) return { success: !0 };
|
|
719
|
+
const d = {};
|
|
720
|
+
let c;
|
|
721
|
+
return i && (d.userId = window.UserLeap.userId = i), a && (d.partnerAnonymousId = window.UserLeap.partnerAnonymousId = a), o && Object.keys(o).length > 0 ? (c = await O(D("1", [H, F], "attributes"), { body: JSON.stringify(o), method: "PUT" }), c.ok ? Object.assign(me, o) : c.reportError && (console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed", c.error), c.error && window.UserLeap.reportError("identifyAndSetAttributes", c.error))) : c = await O(D("1", [H, F]), { body: JSON.stringify(d), method: "PUT" }), o && o[Y] && (window.UserLeap.email = o[Y]), c.ok && (i && _("uid", i), a && _("aid", a)), { success: !!c.ok };
|
|
722
|
+
}, async removeAttributes(e) {
|
|
723
|
+
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig removeAttributes", e), t.mode === "test") return;
|
|
724
|
+
if (e == null || e.length === 0) {
|
|
725
|
+
const a = "[Sprig] - Disregarding empty attributes provided";
|
|
726
|
+
return console.warn(a), { success: !1, message: a };
|
|
727
|
+
}
|
|
728
|
+
if (t.requireUserIdForTracking && !window.UserLeap.userId) {
|
|
729
|
+
const a = "[Sprig] - Skipping tracking without userId";
|
|
730
|
+
return console.warn(a), { success: !1, message: a };
|
|
731
|
+
}
|
|
732
|
+
const i = await O(D("1", [H, F], "attributes"), { body: JSON.stringify({ delete: e }), method: "DELETE" });
|
|
733
|
+
return !i.ok && i.reportError && (console.warn("[Sprig] (ERR-433) Remove attributes failed", i.error), i.error && window.UserLeap.reportError("removeAttributes", i.error)), { success: !!i.ok };
|
|
734
|
+
}, async addSurveyListener(e) {
|
|
735
|
+
w.on(u.SurveyLifeCycle, e);
|
|
736
|
+
}, async removeSurveyListener(e) {
|
|
737
|
+
w.removeListener(u.SurveyLifeCycle, e);
|
|
738
|
+
}, async addListener(e, i) {
|
|
739
|
+
w.on(e, i);
|
|
740
|
+
}, async removeListener(e, i) {
|
|
741
|
+
w.removeListener(e, i);
|
|
742
|
+
}, async removeAllListeners() {
|
|
743
|
+
w.removeAllListeners();
|
|
744
|
+
}, setPreviewKey(e) {
|
|
745
|
+
e && typeof e == "string" && R.isStorageAvailable && e && R.setItem("sprig.previewKey", e);
|
|
746
|
+
}, async setUserId(e) {
|
|
747
|
+
var o;
|
|
748
|
+
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig setUserId", e), e == null) {
|
|
749
|
+
const d = `[Sprig] - Invalid userId ${e}`;
|
|
750
|
+
return console.warn(d), { success: !1, message: d };
|
|
751
|
+
}
|
|
752
|
+
if (t.mode === "test" || e === window.UserLeap.userId) return;
|
|
753
|
+
window.UserLeap.userId = e;
|
|
754
|
+
const i = window.UserLeap.visitorId, a = await O(D("1", [H, F]), { body: JSON.stringify({ userId: e }), method: "PUT" });
|
|
755
|
+
a.ok ? (i !== window.UserLeap.visitorId && ((o = k.replay) == null || o.clearUserReplayData()), _("uid", e)) : a.reportError && (console.warn("[Sprig] (ERR-420) Failed to set user id", a.error), a.error && window.UserLeap.reportError("setUserId", a.error));
|
|
756
|
+
}, async setPartnerAnonymousId(e) {
|
|
757
|
+
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig setPartnerAnonymousId", e), e == null) {
|
|
758
|
+
const i = `[Sprig] - Invalid partnerAnonymousId ${e}`;
|
|
759
|
+
return console.warn(i), { success: !1, message: i };
|
|
760
|
+
}
|
|
761
|
+
return window.UserLeap.partnerAnonymousId = e, _("aid", e), { success: !0 };
|
|
762
|
+
}, track: async (e, i, a = {}, o = void 0) => r({ eventName: e, properties: i, metadata: a, showSurveyCallback: o }), identifyAndTrack: async (e) => await r(e), trackPageView(e, i = void 0, a = void 0, o = !0) {
|
|
763
|
+
te = e, Rt(e, i, a, o);
|
|
764
|
+
}, applyFeedbackStyles({ button: e = "", view: i = "" }) {
|
|
765
|
+
window.UserLeap.feedbackCustomStyles = i, document.getElementById("sprig-feedback-style") && le({ document, elementId: "ul-custom-style", styleString: e, nonce: window.UserLeap.styleNonce }), n(document.querySelector(".ul-container-feedback"), i);
|
|
766
|
+
}, applyStyles(e) {
|
|
767
|
+
window.UserLeap.customStyles = e, n(window.UserLeap.container, e);
|
|
768
|
+
}, setWindowDimensions(e, i) {
|
|
769
|
+
var f, g;
|
|
770
|
+
const a = typeof e == "string" ? parseInt(e, 10) : e, o = typeof i == "string" ? parseInt(i, 10) : i;
|
|
771
|
+
isNaN(a) || isNaN(o) || (window.UserLeap.windowDimensions = { width: a, height: o });
|
|
772
|
+
const d = T(window.UserLeap), c = fe(d), l = d["userleap-platform"] === "web";
|
|
773
|
+
if (!window.UserLeap.frameId) return;
|
|
774
|
+
const p = document.getElementById(window.UserLeap.frameId);
|
|
775
|
+
p && (window.UserLeap.useMobileStyling && ((f = window.UserLeap.windowDimensions) != null && f.width && (p.style.width = `${window.UserLeap.windowDimensions.width}px`), (g = window.UserLeap.windowDimensions) != null && g.height && (p.style.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px"), p.contentDocument && (p.style.height = String($t(p.contentDocument, l && !c, dt(d))[0]) + "px")), w.emit(u.SurveyDimensions, { name: u.SurveyDimensions, contentFrameWidth: p.clientWidth, contentFrameHeight: p.clientHeight, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }));
|
|
776
|
+
}, logoutUser() {
|
|
777
|
+
var e;
|
|
778
|
+
window.UserLeap.debugMode && console.info("[DEBUG] Sprig logout"), M.info("LogOut", { vid: window.UserLeap.visitorId, userId: window.UserLeap.userId }), window.UserLeap.visitorId = null, window.UserLeap.userId = null, window.UserLeap.partnerAnonymousId = null, window.UserLeap.token = null, window.UserLeap.email = null, R.removeItem("userleap.ids"), window.UserLeap._queue.isPaused() && window.UserLeap._queue.empty(), _t(), (e = k.replay) == null || e.clearUserReplayData(), window.UserLeap._queue.unpause();
|
|
779
|
+
}, teardown() {
|
|
780
|
+
["hashchange", "popstate"].forEach((e) => window.removeEventListener(e, re, !0)), window.UserLeap._config.interactiveEvents && kt(), window.UserLeap("dismissActiveSurvey", j.API), delete window.UserLeap, delete window.Sprig, delete window._Sprig;
|
|
781
|
+
}, integrateOptimizely(e, i = !0) {
|
|
782
|
+
var a, o;
|
|
783
|
+
if ((o = (a = window.UserLeap) == null ? void 0 : a._config) != null && o.optimizelyEnabled) try {
|
|
784
|
+
const d = typeof e == "string" ? JSON.parse(e) : e;
|
|
785
|
+
de.setOptimizelyExperiment(d, i);
|
|
786
|
+
} catch (d) {
|
|
787
|
+
console.warn("[Sprig] Error with integrating Optimizely data"), d instanceof Error && window.UserLeap.reportError("integrateOptimizely", d);
|
|
788
|
+
}
|
|
789
|
+
else console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");
|
|
790
|
+
}, integrateOptimizelyClient(e) {
|
|
791
|
+
var i, a;
|
|
792
|
+
if (!((a = (i = window.UserLeap) == null ? void 0 : i._config) != null && a.optimizelyEnabled)) return void console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");
|
|
793
|
+
e.notificationCenter.addNotificationListener("ACTIVATE:experiment, user_id,attributes, variation, event", ({ experiment: o, variation: d }) => {
|
|
794
|
+
const c = { experiments: [{ id: o.id, variation: d.key }] };
|
|
795
|
+
window.UserLeap("integrateOptimizely", c, !1);
|
|
796
|
+
});
|
|
797
|
+
}, importLaunchDarklyData(e) {
|
|
798
|
+
var i, a;
|
|
799
|
+
(a = (i = window.UserLeap) == null ? void 0 : i._config) != null && a.launchDarklyEnabled ? Re.setLDFlagsVariations(e) : console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");
|
|
800
|
+
}, setVisitorAttribute: (e, i) => (console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"), s.setAttribute(e, i)), setEmail: async (e) => s.setAttribute(Y, e), setVisitorEmail: async (e) => (console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"), s.setEmail(e)), _generateVideoUploadUrl: async (e) => async function(i) {
|
|
801
|
+
var o;
|
|
802
|
+
if (!i) return;
|
|
803
|
+
const a = `${window.UserLeap._API_URL}/2/environments/integrations/upload`;
|
|
804
|
+
try {
|
|
805
|
+
const d = await fetch(a, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(i) });
|
|
806
|
+
if (d.ok) {
|
|
807
|
+
const c = await d.json();
|
|
808
|
+
return (o = c == null ? void 0 : c.upload) == null ? void 0 : o.url;
|
|
809
|
+
}
|
|
810
|
+
return null;
|
|
811
|
+
} catch (d) {
|
|
812
|
+
console.warn("[Sprig] Error with generating video upload url"), d instanceof Error && window.UserLeap.reportError("generateVideoUploadUrl", d);
|
|
813
|
+
}
|
|
814
|
+
}(e), _reportMetric(e, i) {
|
|
815
|
+
jt(e, i);
|
|
816
|
+
}, _completeSessionReplay: async ({ surveyId: e, responseGroupUuid: i, eventDigest: a }) => {
|
|
817
|
+
var o;
|
|
818
|
+
return k.replay ? (o = k.replay) == null ? void 0 : o._completeSessionReplay({ surveyId: e, responseGroupUuid: i, eventDigest: a, headers: T(window.UserLeap) }) : (window.UserLeap.reportError("_completeSessionReplay", new Error("Replay module not registered")), !1);
|
|
819
|
+
}, pauseReplayRecording() {
|
|
820
|
+
var e, i, a, o;
|
|
821
|
+
(i = (e = k.replay) == null ? void 0 : e.isReplayPaused) != null && i.call(e) || ((o = (a = k.replay) == null ? void 0 : a.recordReplayPaused) == null || o.call(a));
|
|
822
|
+
}, resumeReplayRecording() {
|
|
823
|
+
var e, i, a, o, d, c;
|
|
824
|
+
(i = (e = k.replay) == null ? void 0 : e.isReplayPaused) != null && i.call(e) && ((o = (a = k.replay) == null ? void 0 : a.recordReplayResumed) == null || o.call(a), (c = (d = k.replay) == null ? void 0 : d.recordFullSnapshot) == null || c.call(d));
|
|
825
|
+
} };
|
|
826
|
+
Object.assign(window.UserLeap, s);
|
|
827
|
+
};
|
|
828
|
+
async function ar(t, r, n = {}, s = {}) {
|
|
829
|
+
const e = window.__cfg && window.__cfg.mode, i = Oe(), a = window.UserLeap.envId, o = window.document.documentElement, d = { mode: e, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: o.clientWidth, clientHeight: o.clientHeight, location: te ?? window.location.href, language: window.navigator.language, ...n }, c = { action: t, breadcrumbs: M.breadcrumbs, err: { message: `${r == null ? void 0 : r.name} - ${r == null ? void 0 : r.message}`, stack: r == null ? void 0 : r.stack }, meta: d, vid: i, envId: a, ...s };
|
|
830
|
+
(await O(D("1", null, "errors"), { method: "POST", headers: { "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(c), shouldDropOnRateLimit: !0 })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", r);
|
|
831
|
+
}
|
|
832
|
+
function dr(t = {}) {
|
|
833
|
+
var s;
|
|
834
|
+
(s = window.SprigLoggerCallback) == null || s.call(window, "Initializing Sprig");
|
|
835
|
+
const r = new URLSearchParams(window.location.search).get("sprigPreviewKey") ?? "";
|
|
836
|
+
async function n() {
|
|
837
|
+
var p, f, g, y, v;
|
|
838
|
+
if (window.UserLeap.loaded) return;
|
|
839
|
+
if ((p = window.SprigLoggerCallback) == null || p.call(window, "Loading Sprig"), window.UserLeap.reportError = ar, window.UserLeap.loaded = !0, window.UserLeap._config = Object.assign({}, t, window.UserLeap.config), window.UserLeap.delayingSurvey = !1, window.UserLeap._config && typeof window.UserLeap._config == "object") for (const m in window.UserLeap._config) window.UserLeap[m] = window.UserLeap._config[m];
|
|
840
|
+
if (window.Sprig.outstandingTransactionLimit !== void 0 && (t.outstandingTransactionLimit = window.Sprig.outstandingTransactionLimit), !window.UserLeap.envId) {
|
|
841
|
+
if (!window.UserLeap.appId) throw new Error("Missing Environment id");
|
|
842
|
+
window.UserLeap.envId = window.UserLeap.appId;
|
|
843
|
+
}
|
|
844
|
+
window.UserLeap.debugMode && console.info("[DEBUG] Sprig debug mode enabled");
|
|
845
|
+
const e = Et(), i = window.UserLeap.sampleRate;
|
|
846
|
+
let a = e.sampled;
|
|
847
|
+
if (i) {
|
|
848
|
+
if (a === null && (a = Math.random() < i, _("sampled", a)), !a) return;
|
|
849
|
+
} else a !== null && _("sampled", null);
|
|
850
|
+
window.UserLeap._API_URL || (window.UserLeap._API_URL = "https://api.sprig.com");
|
|
851
|
+
const o = [...window.UserLeap._queue];
|
|
852
|
+
window.UserLeap._queue = new Jt(window.UserLeap, []), window.UserLeap._queue.pause();
|
|
853
|
+
for (let m = 0; m < o.length; m++) window.UserLeap._queue.push(o[m]);
|
|
854
|
+
const d = e.token;
|
|
855
|
+
d ? (window.UserLeap.token = d, window.UserLeap.visitorId = e.vid ?? null, window.UserLeap.userId = e.uid ?? null, window.UserLeap.partnerAnonymousId = e.aid ?? null) : _t();
|
|
856
|
+
const c = ne(T(window.UserLeap));
|
|
857
|
+
(f = window.SprigLoggerCallback) == null || f.call(window, "Sprig fetching config");
|
|
858
|
+
const l = await async function(m) {
|
|
859
|
+
var E, z;
|
|
860
|
+
const U = T(window.UserLeap);
|
|
861
|
+
document.addEventListener("securitypolicyviolation", $e);
|
|
862
|
+
const h = await st(D("1", [H], "config"), { headers: U });
|
|
863
|
+
if (document.removeEventListener("securitypolicyviolation", $e), !h.ok) return (E = window.SprigLoggerCallback) == null || E.call(window, "Sprig config fetch failed"), h.reportError && (console.warn("[Sprig] (ERR-422) Failed to load configuration", h.error), h.error && window.UserLeap.reportError("applyRemoteConfig", h.error)), Ge("Disabled: failed to fetch configuration"), m;
|
|
864
|
+
const S = h.json;
|
|
865
|
+
return S != null && S.disabled ? ((z = window.SprigLoggerCallback) == null || z.call(window, "Sprig config fetch disabled"), Ge(`Disabled: ${S.disabled}`), { disabled: S.disabled }) : Object.assign({}, S, m);
|
|
866
|
+
}(t);
|
|
867
|
+
if ((g = window.SprigLoggerCallback) == null || g.call(window, "Sprig fetched config"), er({ isWeb: !c, reportingIntervalSeconds: l.metricsReportingEnabled || l.mobileMetricsReportingEnabled ? l.metricsReportingIntervalSeconds : 0, thresholds: l.metricThresholds, postMetrics: async (m) => {
|
|
868
|
+
var U;
|
|
869
|
+
await O(D("1", [H], "metrics"), { body: m, method: "POST", headers: { "x-ul-replay-enabled": `${!!((U = k.replay) != null && U.isReplayRecording())}` }, shouldDropOnRateLimit: !0 });
|
|
870
|
+
} }), !c) {
|
|
871
|
+
const m = l.alwaysOnReplay ? { userAgent: window.navigator.userAgent, surveyId: l.alwaysOnReplay.surveyId, responseGroupUuid: l.alwaysOnReplay.responseGroupUuid, sdkVersion: "2.39.4", maxDurationSeconds: l.alwaysOnReplay.maxDurationSeconds } : void 0;
|
|
872
|
+
await ((y = k.replay) == null ? void 0 : y.initializeReplay({ maxReplayDurationSeconds: l.maxReplayDurationSeconds, maxInflightRequests: window.UserLeap.maxInflightReplayRequests ?? 2, replaySettings: l.replaySettings, apiUrl: window.UserLeap._API_URL, alwaysOnConfig: m })), je = l.replaySettings;
|
|
873
|
+
}
|
|
874
|
+
sr(l), await or(l), window.UserLeap._queue.unpause(), (v = window.SprigLoggerCallback) == null || v.call(window, "SdkReady"), w.emit(u.SDKReady, { mobileMetricsReportingEnabled: !!l.mobileMetricsReportingEnabled, metricsReportingInterval: l.metricsReportingIntervalSeconds || 0, metricsThresholds: l.metricThresholds || [], maxMobileReplayDurationSeconds: l.maxMobileReplayDurationSeconds, mobileReplaySettings: l.mobileReplaySettings }), w.emit(u.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId }), w.on(u.VisitorIDUpdated, () => {
|
|
875
|
+
for (const m in me) delete me[m];
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
window.UserLeap.UPDATES = ie, window.UserLeap("setPreviewKey", r), document.readyState === "complete" ? n() : window.attachEvent ? window.attachEvent("onload", n) : window.addEventListener("load", () => {
|
|
879
|
+
n();
|
|
880
|
+
}, !1);
|
|
881
|
+
}
|
|
882
|
+
class Ae {
|
|
883
|
+
constructor() {
|
|
884
|
+
N(this, "UPDATES", ie);
|
|
885
|
+
}
|
|
886
|
+
displaySurvey(r) {
|
|
887
|
+
window.Sprig("displaySurvey", r);
|
|
888
|
+
}
|
|
889
|
+
mute() {
|
|
890
|
+
window.Sprig("mute");
|
|
891
|
+
}
|
|
892
|
+
unmute() {
|
|
893
|
+
window.Sprig("unmute");
|
|
894
|
+
}
|
|
895
|
+
dismissActiveSurvey() {
|
|
896
|
+
window.Sprig("dismissActiveSurvey");
|
|
897
|
+
}
|
|
898
|
+
setAttribute(r, n) {
|
|
899
|
+
window.Sprig("setAttribute", r, n);
|
|
900
|
+
}
|
|
901
|
+
setAttributes(r) {
|
|
902
|
+
window.Sprig("setAttributes", r);
|
|
903
|
+
}
|
|
904
|
+
identifyAndSetAttributes(r) {
|
|
905
|
+
window.Sprig("identifyAndSetAttributes", r);
|
|
906
|
+
}
|
|
907
|
+
removeAttributes(r) {
|
|
908
|
+
window.Sprig("removeAttributes", r);
|
|
909
|
+
}
|
|
910
|
+
addListener(r, n) {
|
|
911
|
+
window.Sprig("addListener", r, n);
|
|
912
|
+
}
|
|
913
|
+
removeListener(r, n) {
|
|
914
|
+
window.Sprig("removeListener", r, n);
|
|
915
|
+
}
|
|
916
|
+
removeAllListeners() {
|
|
917
|
+
window.Sprig("removeAllListeners");
|
|
918
|
+
}
|
|
919
|
+
setEmail(r) {
|
|
920
|
+
window.Sprig("setAttribute", "!email", r);
|
|
921
|
+
}
|
|
922
|
+
setUserId(r) {
|
|
923
|
+
window.Sprig("setUserId", r);
|
|
924
|
+
}
|
|
925
|
+
setPartnerAnonymousId(r) {
|
|
926
|
+
window.Sprig("setPartnerAnonymousId", r);
|
|
927
|
+
}
|
|
928
|
+
track(r, n = {}, s = {}) {
|
|
929
|
+
window.Sprig("track", r, n, s);
|
|
930
|
+
}
|
|
931
|
+
identifyAndTrack(r) {
|
|
932
|
+
window.Sprig("identifyAndTrack", r);
|
|
933
|
+
}
|
|
934
|
+
trackPageView(r, n, s) {
|
|
935
|
+
window.Sprig("trackPageView", r, n, s);
|
|
936
|
+
}
|
|
937
|
+
applyStyles(r) {
|
|
938
|
+
window.Sprig("applyStyles", r);
|
|
939
|
+
}
|
|
940
|
+
setWindowDimensions(r, n) {
|
|
941
|
+
window.Sprig("setWindowDimensions", r, n);
|
|
942
|
+
}
|
|
943
|
+
logoutUser() {
|
|
944
|
+
window.Sprig("logoutUser");
|
|
945
|
+
}
|
|
946
|
+
teardown() {
|
|
947
|
+
window.Sprig("teardown");
|
|
948
|
+
}
|
|
949
|
+
pauseReplayRecording() {
|
|
950
|
+
window.Sprig("pauseReplayRecording");
|
|
951
|
+
}
|
|
952
|
+
resumeReplayRecording() {
|
|
953
|
+
window.Sprig("resumeReplayRecording");
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
const ot = { configure: (t) => {
|
|
957
|
+
if (!t.envId && !t.environmentId) throw new Error("Initialization Error: Sprig configure requires an environmentId");
|
|
958
|
+
if (t.envId || (t.envId = t.environmentId ?? ""), t.installationMethod = "web-npm", window.Sprig) return window.Sprig;
|
|
959
|
+
window.Sprig = function() {
|
|
960
|
+
window.Sprig._queue.push(arguments);
|
|
961
|
+
}, Object.getOwnPropertyNames(Ae.prototype).map((n) => {
|
|
962
|
+
n !== "constructor" && (window.Sprig[n] = Ae.prototype[n]);
|
|
963
|
+
});
|
|
964
|
+
const r = window.Sprig;
|
|
965
|
+
return r.appId = t.envId, r._queue = [], window.UserLeap = r, dr(t), window.Sprig;
|
|
966
|
+
} }, fr = { sprig: ot, SprigAPI: Ae, configure: ot.configure };
|
|
967
|
+
export {
|
|
968
|
+
ur as A,
|
|
969
|
+
qt as C,
|
|
970
|
+
wr as D,
|
|
971
|
+
yr as E,
|
|
972
|
+
Ae as S,
|
|
973
|
+
gr as a,
|
|
974
|
+
pr as b,
|
|
975
|
+
fr as c,
|
|
976
|
+
$t as d,
|
|
977
|
+
le as e,
|
|
978
|
+
Ce as g,
|
|
979
|
+
P as i,
|
|
980
|
+
mr as r,
|
|
981
|
+
ot as s
|
|
982
|
+
};
|