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