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