@sprig-technologies/sprig-browser 2.42.1 → 2.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversational-ui-BnadcoG2.cjs +1 -0
- package/dist/{conversational-ui-D6UnLFmt.js → conversational-ui-CtA-YS3e.js} +4 -4
- package/dist/conversational-v2-styles-D3WQxdro.cjs +1 -0
- package/dist/conversational-v2-styles-XFcJt3-u.js +4 -0
- package/dist/{core-D9RfS2Z8.js → core-DJ3Dpomz.js} +355 -355
- package/dist/core-wqg-G3hc.cjs +12 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +2 -2
- package/dist/{index-CygVREGR.js → index-BEn8X37H.js} +4 -4
- package/dist/index-C0oA6Zlm.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-Dy6jXbOf.cjs → metricsReporter-BAjv1fmT.cjs} +1 -1
- package/dist/{metricsReporter-DqmmYkn-.js → metricsReporter-DDWVWGid.js} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/{getAttributedUrl-BkFxZZq1.js → videoPlayer-Cj-utOH3.js} +322 -320
- package/dist/{getAttributedUrl-DndmCZhi.cjs → videoPlayer-DD0Jmq0y.cjs} +3 -3
- package/dist/view-Ctyh240J.js +1737 -0
- package/dist/view-DlMlH6Lu.cjs +1 -0
- package/package.json +1 -1
- package/dist/conversational-ui-Bxn2-bHk.cjs +0 -1
- package/dist/core-C7eAp3i8.cjs +0 -12
- package/dist/index-C3QpXMSG.cjs +0 -1
- package/dist/view-BlV4gOTD.cjs +0 -1
- package/dist/view-q6KAoLll.js +0 -1729
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { l as H, g as O, s as
|
|
5
|
-
const
|
|
1
|
+
var Ot = Object.defineProperty;
|
|
2
|
+
var Ct = (r, e, i) => e in r ? Ot(r, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[e] = i;
|
|
3
|
+
var N = (r, e, i) => Ct(r, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
+
import { l as H, g as O, s as dt, e as g, S as u, v as ct, m as S, b as P, h as pt, E as ae, a as Q, D as C, c as Pt, r as G, i as Mt, j as jt, k as Ft, n as Ke, o as Je, d as qt, p as ut, q as gt } from "./metricsReporter-DDWVWGid.js";
|
|
5
|
+
const gr = 360, hr = "ul-app", yr = "#e6e6e6", br = "#bd282a", mr = 1030, Qe = () => {
|
|
6
6
|
try {
|
|
7
7
|
return window.parent.Intercom;
|
|
8
8
|
} catch {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
},
|
|
12
|
-
const r =
|
|
11
|
+
}, Ye = [Object.freeze(Object.defineProperty({ __proto__: null, disable: () => {
|
|
12
|
+
const r = Qe();
|
|
13
13
|
r && (r.ul_wasVisible = !!document.querySelector("iframe.intercom-launcher-frame"), r.ul_wasVisible && r("update", { hide_default_launcher: !0 }));
|
|
14
14
|
}, enable: () => {
|
|
15
|
-
const r =
|
|
15
|
+
const r = Qe();
|
|
16
16
|
r && (r.ul_wasVisible && r("update", { hide_default_launcher: !1 }), delete r.ul_wasVisible);
|
|
17
17
|
} }, Symbol.toStringTag, { value: "Module" }))];
|
|
18
|
-
class
|
|
18
|
+
class Ht {
|
|
19
19
|
static disable() {
|
|
20
|
-
|
|
20
|
+
Ye.forEach((e) => e.disable());
|
|
21
21
|
}
|
|
22
22
|
static enable() {
|
|
23
|
-
|
|
23
|
+
Ye.forEach((e) => e.enable());
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const Xe = "ul-view-sdk-script", Vt = /* @__PURE__ */ new Set(["ios", "android"]), F = "visitors", q = "environments";
|
|
27
27
|
async function D(r, e) {
|
|
28
28
|
var s, n, o;
|
|
29
29
|
const { shouldDropOnRateLimit: i, ...a } = e;
|
|
30
30
|
a.headers = Object.assign(O(window.UserLeap), a.headers);
|
|
31
|
-
const t = await
|
|
31
|
+
const t = await dt(r, { ...a, shouldDropOnRateLimit: i });
|
|
32
32
|
if (t.ok) {
|
|
33
33
|
const l = (s = t.headers) == null ? void 0 : s.get("Authorization"), c = l ? l.split(" ") : void 0, d = c && c.length === 2 ? c[1] : void 0, p = (n = t.headers) == null ? void 0 : n.get("x-ul-visitor-id");
|
|
34
34
|
if (window.UserLeap.userId && p === window.UserLeap.visitorId) {
|
|
35
35
|
const m = H.getItemObject("sprig.anon.env.vid.map");
|
|
36
36
|
m && m[window.UserLeap.envId] === p && (delete m[window.UserLeap.envId], H.setItemObject("sprig.anon.env.vid.map", m));
|
|
37
37
|
}
|
|
38
|
-
d && p && (p !== window.UserLeap.visitorId || window.UserLeap.token !== d) && (
|
|
38
|
+
d && p && (p !== window.UserLeap.visitorId || window.UserLeap.token !== d) && (_("token", d), _("vid", p), g.emit(u.VisitorIDUpdated, { visitorId: p }), window.UserLeap.token = d, window.UserLeap.visitorId = p);
|
|
39
39
|
}
|
|
40
40
|
return (o = t.json) != null && o.logMessage && console.warn(`[Sprig] ${t.json.logMessage}`), t;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function _(r, e) {
|
|
43
43
|
const i = H.getItemObject("userleap.ids");
|
|
44
44
|
let a = i[window.UserLeap.envId];
|
|
45
45
|
a ? a[r] = e : a = { [r]: e }, i[window.UserLeap.envId] = a, H.setItemObject("userleap.ids", i);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Ce() {
|
|
48
48
|
return window.previewMode ? "0" : window.UserLeap.visitorId ?? "";
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function x(r, e, i) {
|
|
51
51
|
const a = [window.UserLeap._API_URL, "sdk", r];
|
|
52
52
|
return e && e.forEach((t) => {
|
|
53
|
-
a.push(t), t === q ? a.push(window.UserLeap.envId) : t === F && a.push(
|
|
53
|
+
a.push(t), t === q ? a.push(window.UserLeap.envId) : t === F && a.push(Ce());
|
|
54
54
|
}), i && a.push(i), a.join("/");
|
|
55
55
|
}
|
|
56
|
-
const
|
|
57
|
-
var
|
|
58
|
-
const { context: a, delay: t, avatars: s,
|
|
59
|
-
if (
|
|
56
|
+
const te = async (r, e, i) => {
|
|
57
|
+
var ze, Ne, Be, $e;
|
|
58
|
+
const { context: a, delay: t, avatars: s, experimentFlags: n, forceBrandedLogo: o, endCard: l, isFeedback: c = !1, heatmap: d, locale: p, layout: m, previewMode: f, productConfig: h, questions: b, responseGroupUid: v, surveyId: y, uuid: I, vid: L, sessionReplay: k, studyType: V, surveyVisitorAttributes: T } = r, E = O(window.UserLeap), M = oe(E), K = we(E);
|
|
59
|
+
if (k) if (M) g.emit(u.ReplayCapture, { responseGroupUid: v, hasQuestions: !!(b != null && b.length), surveyId: y, uploadId: k.uploadId, replayType: k.replayDurationType ?? "before", seconds: k.replayDurationSeconds, generateVideoUploadUrlPayload: { mediaRecordingUid: ct(), mediaType: "screen", questionId: 1, responseGroupUid: v, surveyId: y, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), visitorId: window.UserLeap.visitorId, isReplay: !0 } });
|
|
60
60
|
else {
|
|
61
|
-
if (!
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
if (
|
|
65
|
-
if (!
|
|
66
|
-
const { eventId: U, replayParams:
|
|
67
|
-
await
|
|
68
|
-
var
|
|
69
|
-
return (
|
|
61
|
+
if (!S.replay) return window.UserLeap.reportError("displayQuestions", new Error("Replay module not registered")), { success: !1, message: "Replay module not registered", surveyState: "no survey" };
|
|
62
|
+
S.replay.scheduleOrCaptureReplay({ responseGroupId: v, surveyId: y, visitorId: L, replayParams: k, completeUploadHeaders: E, apiUrl: window.UserLeap._API_URL, triggerTimestamp: Date.now(), isStandalone: b.length === 0 });
|
|
63
|
+
}
|
|
64
|
+
if (d) {
|
|
65
|
+
if (!S.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: U, replayParams: z, responseGroupUid: Se, surveyId: Te } = d;
|
|
67
|
+
await S.replay.initializeReplay({ maxReplayDurationSeconds: 300, maxInflightRequests: window.UserLeap.maxInflightReplayRequests, teardownAfter: !0, apiUrl: window.UserLeap._API_URL, replaySettings: i }), S.replay.tryReplayAction(() => {
|
|
68
|
+
var Ge;
|
|
69
|
+
return (Ge = S.replay) == null ? void 0 : Ge.scheduleCapture({ apiUrl: window.UserLeap._API_URL, completeUploadHeaders: E, eventId: U, isHeatmap: !0, replayParams: z, responseGroupId: Se, surveyId: Te, triggerTimestamp: Date.now(), visitorId: L });
|
|
70
70
|
}, "Error in scheduling/capturing replay");
|
|
71
71
|
}
|
|
72
|
-
if (
|
|
72
|
+
if (L == null || !(b != null && b.length)) return P.info("CannotDisplaySurvey", { vid: L }), { success: !1, message: "[Sprig] no survey found", surveyState: window.UserLeap.container ? "previous survey ready" : "no survey" };
|
|
73
73
|
if (window.UserLeap.container) {
|
|
74
74
|
P.info("AlreadyDisplayingSurvey");
|
|
75
75
|
const U = "[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";
|
|
76
76
|
return console.warn(U), { success: !1, message: U, surveyState: "previous survey ready" };
|
|
77
77
|
}
|
|
78
|
-
if (
|
|
78
|
+
if (L !== window.UserLeap.visitorId && I !== window.UserLeap.visitorId && !window.previewMode) {
|
|
79
79
|
const U = "Attempted to display survey to a different visitor";
|
|
80
80
|
return window.UserLeap.reportError("DisplaySurvey", new Error(U)), { success: !1, message: U, surveyState: "no survey" };
|
|
81
81
|
}
|
|
82
|
-
P.info("ShowingSurvey", { surveyId:
|
|
83
|
-
let W,
|
|
84
|
-
const
|
|
85
|
-
const { "view.version":
|
|
86
|
-
|
|
82
|
+
P.info("ShowingSurvey", { surveyId: y }), (ze = S.replay) == null || ze.RecordSurveyShown({ id: y, userAgent: window.navigator.userAgent }), Ht.disable(), g.emit(u.SurveyWillPresent, { name: u.SurveyWillPresent, "survey.id": y, layout: m });
|
|
83
|
+
let W, X, R, ne, le = document.createElement("div");
|
|
84
|
+
const qe = (U) => {
|
|
85
|
+
const { "view.version": z } = U;
|
|
86
|
+
z !== E["x-ul-sdk-version"] && yt(), g.removeListener("verify.view.version", qe);
|
|
87
87
|
};
|
|
88
|
-
g.on("verify.view.version",
|
|
89
|
-
const U = O(window.UserLeap),
|
|
90
|
-
return
|
|
91
|
-
})() && (
|
|
92
|
-
const J = { apiURL: window.UserLeap._API_URL, avatars: s, cards:
|
|
88
|
+
g.on("verify.view.version", qe), window.UserLeap.useMobileStyling = K, pt(E) ? (W = "ul-direct-embeded-frame", X = document.head, R = window, ne = !1, (() => {
|
|
89
|
+
const U = O(window.UserLeap), z = oe(U), Se = window.UserLeap.forceDirectEmbed, Te = U["userleap-platform"] === "web";
|
|
90
|
+
return z || Se && Te;
|
|
91
|
+
})() && (ht(y, c), le.id = W, window.UserLeap.container.appendChild(le), bt(), g.emit(u.SurveyLifeCycle, { state: "presented" }), g.emit(u.SurveyPresented, { name: u.SurveyPresented, "survey.id": y }))) : { frameId: W, contentWinDocHead: X, contentWindow: R, hasOverlay: ne, iframe: le } = Nt({ productConfig: h, useMobileStyling: K, surveyId: y, isFeedback: c, enableCspTrustedTypes: (Ne = window.UserLeap._config) == null ? void 0 : Ne.enableCspTrustedTypes }), window.UserLeap.frameId = W;
|
|
92
|
+
const J = { apiURL: window.UserLeap._API_URL, avatars: s, cards: b, configureExitOnOverlayClick: (U) => {
|
|
93
93
|
g.once(u.CloseSurveyOnOverlayClick, U);
|
|
94
|
-
}, context: a, endCard:
|
|
95
|
-
(
|
|
96
|
-
const
|
|
97
|
-
J.customStyles =
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
const
|
|
94
|
+
}, context: a, endCard: l, envId: window.UserLeap.envId, eventEmitFn: g.emit.bind(g), experimentFlags: n, fontFamily: window.UserLeap.fontFamily, fontFamilyURL: window.UserLeap.fontFamilyURL, forceBrandedLogo: o, frame: le, headers: E, layout: m, locale: p, mobileSDKVersion: window.UserLeap.mobileSDKVersion, previewKey: Q.getItem("sprig.previewKey"), previewMode: f || !!window.previewMode, productConfig: { framePosition: h == null ? void 0 : h.framePosition, desktopDisplay: h == null ? void 0 : h.desktopDisplay, placement: h == null ? void 0 : h.placement }, responseGroupUid: v, startingQuestionIdx: (Be = window.UserLeap.config) == null ? void 0 : Be.startingQuestionIdx, studyType: V, styleNonce: window.UserLeap.styleNonce, surveyId: y, tabTitle: document.title, trackPageViewUrl: e, ulEvents: ae, upchunkLibraryURL: window.UserLeap.upchunkLibraryURL, useMobileStyling: K, userId: I, viewDocument: R == null ? void 0 : R.document, viewWindow: R, visitorAttributes: { externalUserId: window.UserLeap.userId, email: window.UserLeap.email }, surveyVisitorAttributes: T || {}, ...window.UserLeap._config };
|
|
95
|
+
($e = window.UserLeap._config) != null && $e.startingQuestionIdx && (window.UserLeap._config = { ...window.UserLeap._config, startingQuestionIdx: null });
|
|
96
|
+
const At = (c ? window.UserLeap.feedbackCustomStyles : window.UserLeap.customStyles) ?? h.customStyles;
|
|
97
|
+
J.customStyles = At, R && (R.__cfg = J);
|
|
98
|
+
const Le = window.UserLeap.viewSDKURL ? window.UserLeap.viewSDKURL : J.path, He = document.getElementById(Xe);
|
|
99
|
+
He && He.remove();
|
|
100
|
+
const Ue = function() {
|
|
101
101
|
const U = document.createElement("script");
|
|
102
|
-
return window.UserLeap.isMobileSDK || U.setAttribute("type", "module"), window.UserLeap.nonce && U.setAttribute("nonce", window.UserLeap.nonce), U.id =
|
|
103
|
-
}(),
|
|
102
|
+
return window.UserLeap.isMobileSDK || U.setAttribute("type", "module"), window.UserLeap.nonce && U.setAttribute("nonce", window.UserLeap.nonce), U.id = Xe, U;
|
|
103
|
+
}(), Ve = () => {
|
|
104
104
|
window.UserLeap.container && Object.assign(window.UserLeap.container.style, { display: "flex" });
|
|
105
105
|
};
|
|
106
106
|
if (J.installationMethod === "web-npm" || J.installationMethod === "web-npm-bundled") {
|
|
107
|
-
const { default: U } = await import("./view-
|
|
108
|
-
U.configure(J),
|
|
109
|
-
} else
|
|
110
|
-
window.UserLeap.container &&
|
|
111
|
-
}),
|
|
112
|
-
U.target instanceof HTMLScriptElement && U.target.src ===
|
|
107
|
+
const { default: U } = await import("./view-Ctyh240J.js").then((z) => z.z);
|
|
108
|
+
U.configure(J), ne && window.UserLeap.container && Ve();
|
|
109
|
+
} else Le && (Ue.src = `${Le}${window.UserLeap.isMobileSDK ? "" : `?t=${Date.now()}`}`, ne && Ue.addEventListener("load", () => {
|
|
110
|
+
window.UserLeap.container && Ve();
|
|
111
|
+
}), R == null || R.addEventListener("error", (U) => {
|
|
112
|
+
U.target instanceof HTMLScriptElement && U.target.src === Le && window.UserLeap.reportError("loadFrameScript", new Error("Frame script failed to load"));
|
|
113
113
|
}, { capture: !0, once: !0 }));
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
return window.UserLeap.isMobileSDK && t && (
|
|
114
|
+
X == null || X.appendChild(Ue);
|
|
115
|
+
const We = { success: !0, surveyState: "ready", surveyId: y, responseGroupUid: v };
|
|
116
|
+
return window.UserLeap.isMobileSDK && t && (We.delay = t), We;
|
|
117
117
|
};
|
|
118
|
-
function
|
|
118
|
+
function we(r) {
|
|
119
119
|
var i;
|
|
120
120
|
if (window.UserLeap.useMobileStyling !== void 0) return window.UserLeap.useMobileStyling;
|
|
121
121
|
const e = ((i = window.UserLeap.windowDimensions) == null ? void 0 : i.width) ?? document.body.clientWidth;
|
|
122
|
-
return
|
|
122
|
+
return oe(r) || e > 10 && e < 500;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
return
|
|
124
|
+
function oe(r) {
|
|
125
|
+
return Vt.has(r["userleap-platform"]);
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const Ze = /* @__PURE__ */ new WeakMap(), Wt = (r, e) => {
|
|
128
128
|
try {
|
|
129
129
|
return ((a) => {
|
|
130
130
|
var n, o;
|
|
131
|
-
const t =
|
|
131
|
+
const t = Ze.get(a);
|
|
132
132
|
if (t) return t;
|
|
133
133
|
if (!((n = a.trustedTypes) != null && n.createPolicy)) throw new Error("Trusted types not supported");
|
|
134
134
|
const s = (o = a.trustedTypes) == null ? void 0 : o.createPolicy("sprig-sdk", { createHTML: (l) => l, createScript: (l) => l, createScriptURL: (l) => l });
|
|
135
|
-
return
|
|
135
|
+
return Ze.set(a, s), s;
|
|
136
136
|
})(e).createHTML(r);
|
|
137
137
|
} catch (i) {
|
|
138
138
|
return console.warn("Could not create TrustedHTML object", i), r;
|
|
139
139
|
}
|
|
140
|
-
},
|
|
140
|
+
}, Pe = (r, e, i = window) => {
|
|
141
141
|
var a;
|
|
142
|
-
return e && ((a = i.trustedTypes) != null && a.createPolicy) ?
|
|
143
|
-
},
|
|
142
|
+
return e && ((a = i.trustedTypes) != null && a.createPolicy) ? Wt(r, i) : r;
|
|
143
|
+
}, Me = "ul-frame";
|
|
144
144
|
globalThis.UserLeap && globalThis.Sprig && (globalThis.Sprig._gtm ? globalThis.Sprig = globalThis.UserLeap : globalThis.UserLeap = globalThis.Sprig), globalThis.UserLeap || (globalThis.UserLeap = globalThis.Sprig), globalThis.Sprig || (globalThis.Sprig = globalThis.UserLeap);
|
|
145
|
-
const
|
|
145
|
+
const Ie = "0px", ht = (r, e, i) => {
|
|
146
146
|
globalThis.UserLeap.container = document.createElement("div"), globalThis.UserLeap.container.className = "ul-container" + (e ? " ul-container-feedback" : ""), r && (globalThis.UserLeap.container.dataset.studyId = r.toString());
|
|
147
|
-
const a =
|
|
147
|
+
const a = ft();
|
|
148
148
|
i && a && !globalThis.UserLeap.useMobileStyling ? a.appendChild(globalThis.UserLeap.container) : document.body.appendChild(globalThis.UserLeap.container);
|
|
149
|
-
},
|
|
149
|
+
}, yt = (r, e) => {
|
|
150
150
|
var a;
|
|
151
|
-
|
|
151
|
+
$t();
|
|
152
152
|
const i = globalThis.UserLeap.container;
|
|
153
153
|
if (i) try {
|
|
154
|
-
(a = i.parentNode) == null || a.removeChild(i), globalThis.UserLeap.container = null,
|
|
154
|
+
(a = i.parentNode) == null || a.removeChild(i), globalThis.UserLeap.container = null, _("trackStartUrl", null), g.emit(u.SurveyLifeCycle, { state: "dismissed" }), g.emit(u.SurveyClosed, { name: u.SurveyClosed, initiator: r, "survey.id": parseInt(i.dataset.studyId), ...e && { studyType: e } });
|
|
155
155
|
} catch (t) {
|
|
156
156
|
console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${r} ` + i), t instanceof Error && globalThis.UserLeap.reportError("dismissActiveSurvey", t);
|
|
157
157
|
}
|
|
158
|
-
},
|
|
158
|
+
}, bt = () => {
|
|
159
159
|
g.once(u.SurveyWillClose, ({ initiator: r, studyType: e }) => {
|
|
160
|
-
g.removeAllListeners(u.CloseSurveyOnOverlayClick),
|
|
160
|
+
g.removeAllListeners(u.CloseSurveyOnOverlayClick), yt(r, e);
|
|
161
161
|
});
|
|
162
|
-
},
|
|
162
|
+
}, zt = (r, e, i, a) => {
|
|
163
163
|
var d, p;
|
|
164
|
-
const t = { position: "fixed", bottom: "0px", right:
|
|
164
|
+
const t = { position: "fixed", bottom: "0px", right: Ie, 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%" }, s = Object.assign({}, e, globalThis.UserLeap), { desktopDisplay: n } = e || {}, o = n === "center-modal";
|
|
165
165
|
let l;
|
|
166
166
|
o && (s.framePosition = "center");
|
|
167
167
|
let c = !1;
|
|
@@ -174,10 +174,10 @@ const Te = "0px", gt = (r, e, i) => {
|
|
|
174
174
|
if (a) o ? m() : l = { position: "relative", height: "300px" };
|
|
175
175
|
else switch (s.framePosition) {
|
|
176
176
|
case "bottomLeft":
|
|
177
|
-
l = { left:
|
|
177
|
+
l = { left: Ie };
|
|
178
178
|
break;
|
|
179
179
|
case "topLeft":
|
|
180
|
-
l = { left:
|
|
180
|
+
l = { left: Ie, top: 0 };
|
|
181
181
|
break;
|
|
182
182
|
case "topRight":
|
|
183
183
|
l = { top: 0 };
|
|
@@ -186,107 +186,107 @@ const Te = "0px", gt = (r, e, i) => {
|
|
|
186
186
|
m();
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
return c && ((m,
|
|
190
|
-
const
|
|
191
|
-
|
|
189
|
+
return c && ((m, f) => {
|
|
190
|
+
const h = { position: "fixed", overflow: "auto", top: "0px", left: "0px", display: "none", height: "100%", width: "100%", transition: "background-color 0.3s ease-out", zIndex: 2147483646 }, b = f ? m.overlayStyleMobile : m.overlayStyle;
|
|
191
|
+
h["background-color"] = b === "light" ? "rgba(255,255,255, 0.95)" : "rgba(0,0,0,0.9)", f || (h.margin = "auto"), globalThis.UserLeap.container && Object.assign(globalThis.UserLeap.container.style, h);
|
|
192
192
|
})(s, i), Object.assign(r.style, t, l), c;
|
|
193
|
-
},
|
|
194
|
-
var
|
|
195
|
-
const s =
|
|
196
|
-
|
|
193
|
+
}, Nt = ({ productConfig: r, useMobileStyling: e, surveyId: i, isFeedback: a, enableCspTrustedTypes: t }) => {
|
|
194
|
+
var f, h;
|
|
195
|
+
const s = Me, n = a && r.desktopDisplay === "slider";
|
|
196
|
+
ht(i, a, n), Bt();
|
|
197
197
|
const o = document.createElement("iframe");
|
|
198
198
|
o.id = s, o.setAttribute("title", "Sprig User Feedback Dialog");
|
|
199
|
-
const l =
|
|
200
|
-
|
|
199
|
+
const l = zt(o, r, e, a);
|
|
200
|
+
bt();
|
|
201
201
|
let c = !1;
|
|
202
|
-
o.setHeight = (
|
|
203
|
-
parseInt(o.style.height) ==
|
|
202
|
+
o.setHeight = (b) => {
|
|
203
|
+
parseInt(o.style.height) == b && c || (c = !0, o.style.height = `${b}px`, g.emit(u.SurveyHeight, { name: u.SurveyHeight, contentFrameHeight: b, "survey.id": i }));
|
|
204
204
|
};
|
|
205
205
|
let d = !1;
|
|
206
|
-
o.setWidth = (
|
|
207
|
-
parseInt(o.style.width) ==
|
|
208
|
-
}, (
|
|
206
|
+
o.setWidth = (b) => {
|
|
207
|
+
parseInt(o.style.width) == b && d || (d = !0, o.style.width = `${b}px`, g.emit(u.SurveyWidth, { name: u.SurveyWidth, contentFrameWidth: b, "survey.id": i }));
|
|
208
|
+
}, (f = globalThis.UserLeap.container) == null || f.appendChild(o), r && (e ? r.exitOnOverlayClickMobile : r.exitOnOverlayClick) && globalThis.UserLeap.container && (globalThis.UserLeap.container.onclick = () => {
|
|
209
209
|
g.emit(u.CloseSurveyOnOverlayClick);
|
|
210
210
|
}), g.emit(u.SurveyLifeCycle, { state: "presented" }), g.emit(u.SurveyPresented, { name: u.SurveyPresented, "survey.id": i });
|
|
211
|
-
const p = (
|
|
212
|
-
if (p && (p.open("text/html", "replace"), p.write(
|
|
213
|
-
const
|
|
214
|
-
|
|
211
|
+
const p = (h = o.contentWindow) == null ? void 0 : h.document;
|
|
212
|
+
if (p && (p.open("text/html", "replace"), p.write(Pe("<!doctype html><head></head><body></body></html>", t, o.contentWindow)), p.close(), !e)) {
|
|
213
|
+
const b = p.body;
|
|
214
|
+
b.style.display = "flex", b.style.alignItems = "center";
|
|
215
215
|
}
|
|
216
216
|
const m = p == null ? void 0 : p.head;
|
|
217
217
|
return { frameId: s, contentWinDocHead: m, contentWindow: o.contentWindow, hasOverlay: l, iframe: o };
|
|
218
|
-
},
|
|
218
|
+
}, mt = { [u.SurveyFadingOut]: () => {
|
|
219
219
|
globalThis.UserLeap.container && Object.assign(globalThis.UserLeap.container.style, { "background-color": "rgba(0,0,0,0)" });
|
|
220
|
-
} },
|
|
221
|
-
Object.entries(
|
|
220
|
+
} }, Bt = () => {
|
|
221
|
+
Object.entries(mt).forEach(([r, e]) => {
|
|
222
222
|
g.on(r, e);
|
|
223
223
|
});
|
|
224
|
-
},
|
|
225
|
-
Object.entries(
|
|
224
|
+
}, $t = () => {
|
|
225
|
+
Object.entries(mt).forEach(([r, e]) => {
|
|
226
226
|
g.off(r, e);
|
|
227
227
|
});
|
|
228
|
-
}, j = (r) => !!r && r.nodeType === Node.ELEMENT_NODE,
|
|
228
|
+
}, j = (r) => !!r && r.nodeType === Node.ELEMENT_NODE, et = (r) => r instanceof HTMLElement || r instanceof SVGElement, pe = ({ document: r, elementId: e, styleString: i, nonce: a }) => {
|
|
229
229
|
const t = r.getElementById(e);
|
|
230
230
|
if (t) return void (t.textContent = i);
|
|
231
231
|
const s = r.createElement("style");
|
|
232
232
|
a && (s.nonce = a), s.textContent = i, s.id = e, r.head.appendChild(s);
|
|
233
|
-
},
|
|
233
|
+
}, tt = (r, e) => {
|
|
234
234
|
const i = e.querySelector(r);
|
|
235
235
|
if (!j(i)) return 0;
|
|
236
236
|
const a = getComputedStyle(i);
|
|
237
237
|
return parseFloat(a.paddingLeft) + parseFloat(a.paddingRight) + (parseFloat(a.marginLeft) + parseFloat(a.marginRight)) + (parseFloat(a.borderLeftWidth) + parseFloat(a.borderRightWidth));
|
|
238
|
-
},
|
|
238
|
+
}, Gt = (r, e, i) => {
|
|
239
239
|
const a = r.querySelector(".ul-card__container"), t = r.querySelector(".ul-app");
|
|
240
240
|
let s = 600, n = 360;
|
|
241
241
|
if (j(a) && j(t)) {
|
|
242
242
|
const o = a.querySelector(".ul-card--matrix_grid"), l = !o && e && i;
|
|
243
243
|
try {
|
|
244
244
|
l && (t.style.width = "360px"), s = a.scrollHeight, s += ((p) => {
|
|
245
|
-
const m = p.querySelector(".sprig-question-body"),
|
|
246
|
-
let
|
|
247
|
-
return j(
|
|
245
|
+
const m = p.querySelector(".sprig-question-body"), f = p.querySelector(".ul-card"), h = p.querySelector(".ul-card-main-content"), b = p.querySelector(".ul-footer"), v = p.querySelector(".sprig-container");
|
|
246
|
+
let y = 0;
|
|
247
|
+
return j(f) && (y += f.scrollHeight - f.clientHeight), j(h) && (y += h.scrollHeight - h.clientHeight), j(m) && (y += m.scrollHeight - m.clientHeight), j(b) && j(v) && v.clientHeight === 0 && (y += b.clientHeight), y;
|
|
248
248
|
})(r);
|
|
249
249
|
const c = getComputedStyle(a), d = parseFloat(c.marginTop) + parseFloat(c.marginBottom);
|
|
250
|
-
s += d + (parseFloat(c.borderTopWidth) + parseFloat(c.borderBottomWidth)), o && (n = o.scrollWidth, n +=
|
|
250
|
+
s += d + (parseFloat(c.borderTopWidth) + parseFloat(c.borderBottomWidth)), o && (n = o.scrollWidth, n += tt(".ul-card__container", r), n += tt(".sprig-question-body", r));
|
|
251
251
|
} finally {
|
|
252
252
|
l && t.style.removeProperty("width");
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
return [s + 2, n];
|
|
256
|
-
},
|
|
256
|
+
}, fr = (r) => {
|
|
257
257
|
const e = r.querySelector(".ul-card__container");
|
|
258
258
|
e && (e.scrollTop = 0);
|
|
259
|
-
},
|
|
260
|
-
let
|
|
261
|
-
const
|
|
259
|
+
}, ft = () => w, Y = () => document.getElementById("sprig-feedback-container"), Re = () => document.getElementById("sprig-feedback-loading-animation"), vt = () => !!document.getElementById(Me);
|
|
260
|
+
let rt = !1, w = null, A = null, je = !1, re = null, B = null;
|
|
261
|
+
const Kt = ["bottom-left", "bottom-right", "center-left", "center-right"], ue = () => {
|
|
262
262
|
var e;
|
|
263
263
|
const r = window.UserLeap.container;
|
|
264
264
|
return ((e = r == null ? void 0 : r.parentElement) == null ? void 0 : e.id) === "sprig-feedback-loading-container";
|
|
265
|
-
},
|
|
266
|
-
if (!
|
|
267
|
-
const r =
|
|
265
|
+
}, wt = () => document.getElementById("sprig-feedback-error-container"), Lt = () => {
|
|
266
|
+
if (!w) return 0;
|
|
267
|
+
const r = w == null ? void 0 : w.clientWidth, e = window.getComputedStyle(w);
|
|
268
268
|
return r + parseInt(e.borderRightWidth || "0") + parseInt(e.borderLeftWidth || "0");
|
|
269
|
-
},
|
|
269
|
+
}, ge = (r) => {
|
|
270
270
|
const e = Y();
|
|
271
|
-
e && (
|
|
272
|
-
},
|
|
273
|
-
if (
|
|
274
|
-
g.off(u.SurveyAppeared,
|
|
275
|
-
const r =
|
|
276
|
-
return
|
|
271
|
+
e && (B != null && B.endsWith("right") ? e.style.right = `${r}px` : B != null && B.endsWith("left") && (e.style.left = `${r}px`));
|
|
272
|
+
}, ke = () => {
|
|
273
|
+
if (w && (ue() || wt())) {
|
|
274
|
+
g.off(u.SurveyAppeared, ee), xe();
|
|
275
|
+
const r = Lt();
|
|
276
|
+
return ge(-r), !0;
|
|
277
277
|
}
|
|
278
278
|
return !1;
|
|
279
|
-
},
|
|
280
|
-
if (!
|
|
281
|
-
const r =
|
|
282
|
-
r && r.remove(),
|
|
283
|
-
},
|
|
284
|
-
if (
|
|
279
|
+
}, ee = () => {
|
|
280
|
+
if (!w || !A) return;
|
|
281
|
+
const r = Re();
|
|
282
|
+
r && r.remove(), w.style.height = "auto", w.style.width = "auto", A.disabled = !1, je = !1;
|
|
283
|
+
}, xe = () => {
|
|
284
|
+
if (w && !Re()) {
|
|
285
285
|
const r = (() => {
|
|
286
286
|
var i;
|
|
287
|
-
if (
|
|
287
|
+
if (Re()) return;
|
|
288
288
|
const e = document.createElement("div");
|
|
289
|
-
return e.className = "ul-loading-spinner-container", e.id = "sprig-feedback-loading-animation", e.role = "progressbar", e.setAttribute("aria-live", "polite"), e.setAttribute("aria-busy", "true"), e.setAttribute("aria-label", "Processing..."), e.innerHTML =
|
|
289
|
+
return e.className = "ul-loading-spinner-container", e.id = "sprig-feedback-loading-animation", e.role = "progressbar", e.setAttribute("aria-live", "polite"), e.setAttribute("aria-busy", "true"), e.setAttribute("aria-label", "Processing..."), e.innerHTML = Pe(`
|
|
290
290
|
<div class="ul-loading-spinner">
|
|
291
291
|
<div class="first"></div>
|
|
292
292
|
<div class="second"></div>
|
|
@@ -295,69 +295,69 @@ const Gt = ["bottom-left", "bottom-right", "center-left", "center-right"], pe =
|
|
|
295
295
|
</div>
|
|
296
296
|
`, (i = window.UserLeap._config) == null ? void 0 : i.enableCspTrustedTypes), e;
|
|
297
297
|
})();
|
|
298
|
-
r && (
|
|
298
|
+
r && (w.style.height = "300px", w.style.width = "360px", w.appendChild(r));
|
|
299
299
|
}
|
|
300
|
-
},
|
|
301
|
-
|
|
302
|
-
},
|
|
300
|
+
}, it = () => {
|
|
301
|
+
w && A && (ge(0), A.disabled = !0, je = !0);
|
|
302
|
+
}, Ut = async (r, e, i) => {
|
|
303
303
|
const { buttonTheme: a, customStyles: t, eventId: s, placement: n, desktopDisplay: o, feedbackLabel: l, surveyUuid: c, surveyId: d } = r;
|
|
304
304
|
window.UserLeap.feedbackCustomStyles = void 0;
|
|
305
305
|
let p = Y();
|
|
306
306
|
if (p) {
|
|
307
|
-
if (!e && s ===
|
|
308
|
-
p.remove(), g.off(
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
const [m,
|
|
312
|
-
((
|
|
313
|
-
if (Y() || !
|
|
314
|
-
const [I,
|
|
315
|
-
k.id = "sprig-feedback-container", k.classList.add(`sprig-feedback-container-${
|
|
307
|
+
if (!e && s === re) return;
|
|
308
|
+
p.remove(), g.off(ae.SURVEY_FADING_OUT, ke);
|
|
309
|
+
}
|
|
310
|
+
re = s, pe({ 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 }), pe({ document, elementId: "ul-custom-style", styleString: t ?? "", nonce: window.UserLeap.styleNonce }), rt = o === "center-modal", B = n;
|
|
311
|
+
const [m, f] = n.split("-");
|
|
312
|
+
((y) => {
|
|
313
|
+
if (Y() || !Kt.includes(y)) return;
|
|
314
|
+
const [I, L] = y.split("-"), k = document.createElement("div");
|
|
315
|
+
k.id = "sprig-feedback-container", k.classList.add(`sprig-feedback-container-${L}`, `sprig-feedback-container-${I}`), document.body.appendChild(k);
|
|
316
316
|
})(n), p = Y(), A = document.createElement("button");
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
const
|
|
320
|
-
if (
|
|
321
|
-
if (
|
|
317
|
+
const h = document.createElement("div");
|
|
318
|
+
h.className = "sprig-feedback-button-label", h.innerText = l, A.appendChild(h), A.id = "sprig-feedback-button", A.classList.add(`sprig-feedback-button-${f}`, `sprig-feedback-button-${m}`, `sprig-feedback-button-${a}`, "fade-in-transition"), g.on(ae.SURVEY_FADING_OUT, ke), A.addEventListener("click", async () => {
|
|
319
|
+
const y = document.getElementById("sprig-feedback-error-container");
|
|
320
|
+
if (vt() || wt()) {
|
|
321
|
+
if (ke()) {
|
|
322
322
|
g.emit(u.SurveyCloseRequested, { name: u.SurveyCloseRequested, initiator: C.FeedbackClosed, studyType: "feedbackButton", "survey.id": d }), g.emit(u.SurveyWillClose, { name: u.SurveyWillClose, initiator: C.FeedbackClosed, studyType: "feedbackButton", "survey.id": d });
|
|
323
|
-
const
|
|
324
|
-
|
|
323
|
+
const L = Y();
|
|
324
|
+
y && L && (L.remove(), re = null, w = null);
|
|
325
325
|
}
|
|
326
326
|
return;
|
|
327
327
|
}
|
|
328
|
-
if (
|
|
329
|
-
const I = await (async (
|
|
330
|
-
const k = await D(
|
|
328
|
+
if (we(O(window.UserLeap)) || je || it(), e) return w && w.classList.add("sprig-feedback-loading-container-previews"), await te(e), void ee();
|
|
329
|
+
const I = await (async (L) => {
|
|
330
|
+
const k = await D(x("1", [F], "startFeedbackStudy"), { body: JSON.stringify({ surveyUuid: L }), method: "POST" });
|
|
331
331
|
return k.ok ? k.json : null;
|
|
332
332
|
})(c);
|
|
333
|
-
if (I) g.once(u.SurveyAppeared,
|
|
334
|
-
else if (
|
|
335
|
-
const
|
|
336
|
-
|
|
333
|
+
if (I) g.once(u.SurveyAppeared, ee), te({ ...I, studyType: "feedbackButton" }, i);
|
|
334
|
+
else if (w) {
|
|
335
|
+
const L = Jt();
|
|
336
|
+
w.appendChild(L), ee(), w.style.height = "300px", w.style.width = "360px";
|
|
337
337
|
}
|
|
338
338
|
}), p == null || p.appendChild(A), g.emit(u.FeedbackButtonLoaded, { name: u.FeedbackButtonLoaded, "survey.id": d });
|
|
339
|
-
const { useMobileStyling:
|
|
340
|
-
if (
|
|
339
|
+
const { useMobileStyling: b, _config: { border: v } } = window.UserLeap;
|
|
340
|
+
if (rt || b) ge(0);
|
|
341
341
|
else {
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
const I =
|
|
345
|
-
|
|
342
|
+
const y = document.createElement("div");
|
|
343
|
+
y.id = "sprig-feedback-loading-container", y.className = `sprig-feedback-loading-container sprig-feedback-loading-container-${f}`, y.style.setProperty("--feedback-border", v), w = y, xe(), p == null || p.appendChild(y);
|
|
344
|
+
const I = Lt();
|
|
345
|
+
ge(-I);
|
|
346
346
|
}
|
|
347
|
-
window.UserLeap._config.isOnQuestionsTab && e && !
|
|
348
|
-
},
|
|
347
|
+
window.UserLeap._config.isOnQuestionsTab && e && !ue() && w && (it(), xe(), w && w.classList.add("sprig-feedback-loading-container-previews"), te(e), ee());
|
|
348
|
+
}, Jt = () => {
|
|
349
349
|
var i;
|
|
350
350
|
const r = document.createElement("div");
|
|
351
|
-
r.id = "sprig-feedback-error-container", r.innerHTML =
|
|
351
|
+
r.id = "sprig-feedback-error-container", r.innerHTML = Pe(`<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
|
|
352
352
|
<circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
|
|
353
353
|
<path d="M20 12L20 21.6" stroke="#B0B5B7" stroke-width="3" stroke-linecap="round"/>
|
|
354
354
|
<circle cx="19.9984" cy="27.6" r="1.6" fill="#B0B5B7"/>
|
|
355
355
|
</svg>`, (i = window.UserLeap._config) == null ? void 0 : i.enableCspTrustedTypes);
|
|
356
356
|
const e = document.createElement("h3");
|
|
357
357
|
return e.className = "sprig-feedback-error-text", e.innerText = "There was an error while loading the survey", r.appendChild(e), r;
|
|
358
|
-
},
|
|
358
|
+
}, De = new class {
|
|
359
359
|
constructor() {
|
|
360
|
-
|
|
360
|
+
N(this, "_ldData", {});
|
|
361
361
|
}
|
|
362
362
|
getAllLaunchDarklyVariations() {
|
|
363
363
|
return this._ldData;
|
|
@@ -372,10 +372,10 @@ const Gt = ["bottom-left", "bottom-right", "center-left", "center-right"], pe =
|
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
}();
|
|
375
|
-
Object.freeze(
|
|
376
|
-
const
|
|
375
|
+
Object.freeze(De);
|
|
376
|
+
const ce = new class {
|
|
377
377
|
constructor() {
|
|
378
|
-
|
|
378
|
+
N(this, "_optimizelyData", {});
|
|
379
379
|
}
|
|
380
380
|
setOptimizelyExperiment(r, e = !0) {
|
|
381
381
|
if (!r || typeof r != "object") return !1;
|
|
@@ -420,12 +420,12 @@ const de = new class {
|
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
}();
|
|
423
|
-
Object.freeze(
|
|
424
|
-
class
|
|
423
|
+
Object.freeze(ce);
|
|
424
|
+
class Qt {
|
|
425
425
|
constructor(e, i) {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
426
|
+
N(this, "paused");
|
|
427
|
+
N(this, "queue");
|
|
428
|
+
N(this, "ul");
|
|
429
429
|
this.ul = e, this.paused = !1, this.queue = [], this.flush(i);
|
|
430
430
|
}
|
|
431
431
|
flush(e) {
|
|
@@ -468,150 +468,150 @@ class Jt {
|
|
|
468
468
|
this.queue.length = 0;
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
-
let St,
|
|
472
|
-
const
|
|
471
|
+
let St, Tt;
|
|
472
|
+
const Ae = (r) => {
|
|
473
473
|
let e = 0, i = r.firstElementChild;
|
|
474
|
-
for (; i; ) e +=
|
|
474
|
+
for (; i; ) e += Ae(i), i.shadowRoot && (e += Ae(i.shadowRoot)), i = i.nextElementSibling, e++;
|
|
475
475
|
return e;
|
|
476
|
-
},
|
|
477
|
-
St.report(
|
|
478
|
-
},
|
|
476
|
+
}, st = () => {
|
|
477
|
+
St.report(Ae(document.body)), Tt.report(document.documentElement.innerHTML.toString().length);
|
|
478
|
+
}, Oe = (r, e) => {
|
|
479
479
|
const i = performance.now();
|
|
480
|
-
document.hidden ? setTimeout(() =>
|
|
480
|
+
document.hidden ? setTimeout(() => Oe(r, e), r) : setTimeout(() => {
|
|
481
481
|
const a = performance.now() - i;
|
|
482
|
-
e.report(a / 1e3), setTimeout(() =>
|
|
482
|
+
e.report(a / 1e3), setTimeout(() => Oe(r, e), r);
|
|
483
483
|
}, 0);
|
|
484
484
|
};
|
|
485
|
-
let
|
|
486
|
-
const
|
|
485
|
+
let he, ye, be, me, at, $ = {};
|
|
486
|
+
const de = (r, e = 1) => {
|
|
487
487
|
const { name: i } = r;
|
|
488
|
-
|
|
489
|
-
},
|
|
488
|
+
$[i] = ($[i] || 0) + e;
|
|
489
|
+
}, It = (r) => {
|
|
490
490
|
let e = 1;
|
|
491
491
|
return r.childNodes.forEach((i) => {
|
|
492
|
-
e +=
|
|
492
|
+
e += It(i);
|
|
493
493
|
}), e;
|
|
494
|
-
},
|
|
494
|
+
}, ot = (r) => {
|
|
495
495
|
let e = 0;
|
|
496
496
|
return r.forEach((i) => {
|
|
497
|
-
e +=
|
|
497
|
+
e += It(i);
|
|
498
498
|
}), e;
|
|
499
|
-
},
|
|
499
|
+
}, Yt = (r) => {
|
|
500
500
|
switch (r.type) {
|
|
501
501
|
case "childList":
|
|
502
|
-
return
|
|
502
|
+
return de(he, ot(r.addedNodes)), void de(ye, ot(r.removedNodes));
|
|
503
503
|
case "attributes":
|
|
504
|
-
return void
|
|
504
|
+
return void de(be);
|
|
505
505
|
case "characterData":
|
|
506
|
-
return void
|
|
507
|
-
}
|
|
508
|
-
},
|
|
509
|
-
|
|
510
|
-
},
|
|
511
|
-
|
|
512
|
-
},
|
|
513
|
-
|
|
506
|
+
return void de(me);
|
|
507
|
+
}
|
|
508
|
+
}, Xt = (r) => r.forEach(Yt), Zt = () => {
|
|
509
|
+
he.report($[he.name] || 0), ye.report($[ye.name] || 0), be.report($[be.name] || 0), me.report($[me.name] || 0), $ = {};
|
|
510
|
+
}, er = (r = 1e3) => {
|
|
511
|
+
he = G("sdk_mutations_nodes_added"), ye = G("sdk_mutations_nodes_removed"), be = G("sdk_mutations_attributes_changed"), me = G("sdk_mutations_character_data"), at = new MutationObserver(Xt), at.observe(document, { attributes: !0, attributeOldValue: !0, characterData: !0, characterDataOldValue: !0, childList: !0, subtree: !0 }), setInterval(Zt, r);
|
|
512
|
+
}, tr = ({ isWeb: r, reportingIntervalSeconds: e, thresholds: i, postMetrics: a }) => {
|
|
513
|
+
Mt(i, (t, s) => {
|
|
514
514
|
var n, o;
|
|
515
|
-
if ((n =
|
|
515
|
+
if ((n = S.replay) != null && n.isReplayRecording()) {
|
|
516
516
|
const l = `Value: ${t} on ${s.metric} violated threshold of ${s.type} ${s.value}`;
|
|
517
|
-
(o =
|
|
517
|
+
(o = S.replay) == null || o.disableRecording("Threshold violated", new Error(l), { reportError: !1 }), window.UserLeap.reportError("Sdk Performance Metric threshold violated", new Error("Sdk Performance Metric threshold violated"), { metricName: s.metric, type: s.type, value: s.value }, { metricName: s.metric }), Ft();
|
|
518
518
|
}
|
|
519
|
-
}),
|
|
520
|
-
const s =
|
|
521
|
-
|
|
519
|
+
}), jt({ reportingIntervalSeconds: e, postMetrics: a }), r && (((t = 1e3) => {
|
|
520
|
+
const s = G("sdk_event_queue_latency_seconds");
|
|
521
|
+
Oe(t, s);
|
|
522
522
|
})(), ((t = 1e4) => {
|
|
523
|
-
St =
|
|
524
|
-
})(),
|
|
525
|
-
},
|
|
526
|
-
let
|
|
527
|
-
const
|
|
528
|
-
var
|
|
529
|
-
let
|
|
530
|
-
function
|
|
523
|
+
St = G("sdk_dom_nodes_count"), Tt = G("sdk_page_html_characters"), st(), setInterval(st, t);
|
|
524
|
+
})(), er());
|
|
525
|
+
}, rr = "test", ir = ["popState", "pushState", "replaceState"];
|
|
526
|
+
let Fe, ie;
|
|
527
|
+
const fe = {}, Z = "!email", kt = "pageUrl";
|
|
528
|
+
var lt;
|
|
529
|
+
let Ee = ((lt = globalThis.location) == null ? void 0 : lt.href) || "";
|
|
530
|
+
function se(r) {
|
|
531
531
|
var o, l;
|
|
532
532
|
const { pageUrlEvents: e, interactiveEvents: i, dismissOnPageChange: a, platform: t } = globalThis.UserLeap._config;
|
|
533
533
|
if (t && t !== "web") return;
|
|
534
|
-
|
|
535
|
-
const s =
|
|
536
|
-
e &&
|
|
537
|
-
if (
|
|
534
|
+
Ee !== globalThis.location.href && P.navigation("LocationChange", { from: Ee, to: globalThis.location.href }), Ee = globalThis.location.href;
|
|
535
|
+
const s = Rt().trackStartUrl, n = s ? String(s) : null;
|
|
536
|
+
e && Dt(globalThis.location.href), i && (_t(), sr()), ft() && (() => {
|
|
537
|
+
if (ue()) return;
|
|
538
538
|
const c = Y();
|
|
539
|
-
c && (
|
|
540
|
-
})(), Q.getItem("sprig.isCapturingHeatmap") && ((l = (o =
|
|
539
|
+
c && (Pt(re) || (c.remove(), re = null, w = null));
|
|
540
|
+
})(), Q.getItem("sprig.isCapturingHeatmap") && ((l = (o = S.replay) == null ? void 0 : o.checkPendingHeatmapsUrl()) == null || l.then((c) => {
|
|
541
541
|
var d;
|
|
542
|
-
c && ((d =
|
|
543
|
-
})), !
|
|
542
|
+
c && ((d = S.replay) == null || d.uploadReadyPendingCaptures(!0));
|
|
543
|
+
})), !ue() && a && n && n !== globalThis.location.href && r && ir.includes(r.type) && globalThis.UserLeap("dismissActiveSurvey", C.PageChange);
|
|
544
544
|
}
|
|
545
|
-
const
|
|
546
|
-
const r = globalThis.UserLeap._config.interactiveEvents.filter((i) =>
|
|
545
|
+
const Et = { capture: !0 }, sr = () => {
|
|
546
|
+
const r = globalThis.UserLeap._config.interactiveEvents.filter((i) => ut(i, globalThis.location.href)).map((i) => {
|
|
547
547
|
const { name: a, properties: t } = i, { selector: s, innerText: n } = t;
|
|
548
548
|
return s ? (o) => {
|
|
549
|
-
if (
|
|
549
|
+
if (et(o.target)) try {
|
|
550
550
|
o.target.closest(s) && globalThis.UserLeap("track", a);
|
|
551
551
|
} catch {
|
|
552
552
|
}
|
|
553
553
|
return !1;
|
|
554
|
-
} : (o) => (
|
|
554
|
+
} : (o) => (et(o.target) && o.target.innerText === n && globalThis.UserLeap("track", a), !1);
|
|
555
555
|
}), e = (i) => r.forEach((a) => a(i));
|
|
556
|
-
globalThis.UserLeap._config.interactiveEventsHandler = e, globalThis.addEventListener("click", e,
|
|
557
|
-
},
|
|
558
|
-
globalThis.UserLeap._config.interactiveEventsHandler && globalThis.removeEventListener("click", globalThis.UserLeap._config.interactiveEventsHandler,
|
|
556
|
+
globalThis.UserLeap._config.interactiveEventsHandler = e, globalThis.addEventListener("click", e, Et);
|
|
557
|
+
}, _t = () => {
|
|
558
|
+
globalThis.UserLeap._config.interactiveEventsHandler && globalThis.removeEventListener("click", globalThis.UserLeap._config.interactiveEventsHandler, Et), delete globalThis.UserLeap._config.interactiveEventsHandler;
|
|
559
559
|
};
|
|
560
|
-
function
|
|
560
|
+
function Rt() {
|
|
561
561
|
const r = H.getItemObject("userleap.ids");
|
|
562
562
|
return (r == null ? void 0 : r[globalThis.UserLeap.envId]) || {};
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function xt() {
|
|
565
565
|
if (globalThis.previewMode) return;
|
|
566
566
|
const r = H.getItemObject("sprig.anon.env.vid.map") || {}, e = r[globalThis.UserLeap.envId];
|
|
567
|
-
globalThis.UserLeap.visitorId = e ||
|
|
567
|
+
globalThis.UserLeap.visitorId = e || ct(), P.info("NewVid", { vid: globalThis.UserLeap.visitorId }), _("vid", globalThis.UserLeap.visitorId), e || (r[globalThis.UserLeap.envId] = globalThis.UserLeap.visitorId, H.setItemObject("sprig.anon.env.vid.map", r)), g.emit(u.VisitorIDUpdated, { visitorId: globalThis.UserLeap.visitorId });
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function Dt(r, e, i, a) {
|
|
570
570
|
var t, s;
|
|
571
571
|
try {
|
|
572
572
|
if (r.endsWith("mock_snippet.html")) return;
|
|
573
573
|
P.info("PageView", { url: r });
|
|
574
574
|
const n = (t = document == null ? void 0 : document.querySelector('meta[name="description"]')) == null ? void 0 : t.getAttribute("content");
|
|
575
|
-
(s =
|
|
575
|
+
(s = S.replay) == null || s.RecordPageView({ ...n && { description: n }, url: r, referrer: document.referrer, pageTitle: document.title });
|
|
576
576
|
const o = globalThis.UserLeap._config.pageUrlEvents;
|
|
577
577
|
let l = !1;
|
|
578
|
-
if (o && o.length) for (let d = 0; d < o.length && (l =
|
|
578
|
+
if (o && o.length) for (let d = 0; d < o.length && (l = ut(o[d], r), !l); d++) ;
|
|
579
579
|
if (!l) return;
|
|
580
580
|
globalThis.UserLeap.debugMode && console.info("[DEBUG] Sprig trackPageView", r);
|
|
581
581
|
const c = { url: r };
|
|
582
|
-
a && (c.trackPageView = !0), globalThis.UserLeap._queue.push(["track",
|
|
582
|
+
a && (c.trackPageView = !0), globalThis.UserLeap._queue.push(["track", kt, e, c, i]);
|
|
583
583
|
} catch (n) {
|
|
584
584
|
n instanceof Error && (n.stack = r, globalThis.UserLeap.reportError("trackPageView", n)), console.warn("[Sprig] (ERR-428) Failed to track page view", n);
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function ar() {
|
|
588
588
|
var e;
|
|
589
589
|
const r = ((e = globalThis.Backbone) == null ? void 0 : e.history) || globalThis.history;
|
|
590
590
|
"pushState" in r && (r.pushState = /* @__PURE__ */ ((i) => function(...a) {
|
|
591
591
|
const t = i.apply(this, a), s = new Event("pushState");
|
|
592
|
-
return globalThis.dispatchEvent(s),
|
|
592
|
+
return globalThis.dispatchEvent(s), se(s), t;
|
|
593
593
|
})(r.pushState)), "replaceState" in r && (r.replaceState = /* @__PURE__ */ ((i) => function(...a) {
|
|
594
594
|
const t = i.apply(this, a), s = new Event("replaceState");
|
|
595
|
-
return globalThis.dispatchEvent(s),
|
|
596
|
-
})(r.replaceState)), ["hashchange", "popstate"].forEach((i) => globalThis.addEventListener(i,
|
|
595
|
+
return globalThis.dispatchEvent(s), se(s), t;
|
|
596
|
+
})(r.replaceState)), ["hashchange", "popstate"].forEach((i) => globalThis.addEventListener(i, se, !0));
|
|
597
597
|
}
|
|
598
|
-
async function
|
|
599
|
-
const i =
|
|
600
|
-
r && !e && (globalThis.UserLeap._config.mode =
|
|
601
|
-
const a =
|
|
602
|
-
const n = new URL(
|
|
598
|
+
async function _e(r, e) {
|
|
599
|
+
const i = Ce();
|
|
600
|
+
r && !e && (globalThis.UserLeap._config.mode = rr);
|
|
601
|
+
const a = we(O(globalThis.UserLeap)), t = await D(function(s) {
|
|
602
|
+
const n = new URL(x("1", [q], "questions"));
|
|
603
603
|
return Object.entries(s || {}).forEach(([o, l]) => {
|
|
604
604
|
l && n.searchParams.append(o, String(l));
|
|
605
605
|
}), n.toString();
|
|
606
606
|
}({ desktopDisplay: globalThis.UserLeap._config.desktopDisplay, isMobile: a, previewLanguage: globalThis.UserLeap._config.previewLanguage, surveyid: r == null ? void 0 : r.surveyId, surveytemplateid: r == null ? void 0 : r.surveyTemplateId, vid: i }), { shouldDropOnRateLimit: !0 });
|
|
607
607
|
if (!t.ok) return t.reportError && t.error && (console.warn("[Sprig] (ERR-414) Failed to request questions from the server", t.error), globalThis.UserLeap.reportError("getQuestions", t.error)), { success: !1, surveyState: "no survey" };
|
|
608
|
-
if (t.json.delay && await
|
|
608
|
+
if (t.json.delay && await gt(t.json.delay), !t.json.isFeedback) return te(t.json, ie, Fe);
|
|
609
609
|
{
|
|
610
610
|
const { feedbackLabel: s, productConfig: n, surveyUuid: o, feedbackCustomStyles: l } = t.json, { buttonTheme: c, placement: d, desktopDisplay: p } = n;
|
|
611
|
-
|
|
611
|
+
Ut({ customStyles: l, buttonTheme: c, desktopDisplay: p, eventId: 0, feedbackLabel: s, placement: d, surveyUuid: o, surveyId: r == null ? void 0 : r.surveyId }, t.json);
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function or(r) {
|
|
615
615
|
if (!r) return;
|
|
616
616
|
globalThis.UserLeap._config = r, r.mute && globalThis.UserLeap._queue.pause();
|
|
617
617
|
const { interactiveEvents: e, pageUrlEvents: i, dismissOnPageChange: a } = r;
|
|
@@ -623,53 +623,53 @@ function ar(r) {
|
|
|
623
623
|
const o = t[s];
|
|
624
624
|
t[s] = t[n], t[n] = o;
|
|
625
625
|
}
|
|
626
|
-
}(e), (e || i || a) && (
|
|
626
|
+
}(e), (e || i || a) && (ar(), se());
|
|
627
627
|
}
|
|
628
|
-
const
|
|
628
|
+
const nr = function(r) {
|
|
629
629
|
if (!globalThis.UserLeap) return;
|
|
630
630
|
const e = async (t = {}) => {
|
|
631
|
-
var
|
|
631
|
+
var y, I, L, k, V;
|
|
632
632
|
const { userId: s, anonymousId: n, metadata: o = {}, properties: l, showSurveyCallback: c } = t;
|
|
633
633
|
let { eventName: d } = t;
|
|
634
|
-
if (globalThis.UserLeap.debugMode && d !==
|
|
634
|
+
if (globalThis.UserLeap.debugMode && d !== kt && console.info("[DEBUG] Sprig track", t), r.mode === "test") return;
|
|
635
635
|
const p = Q.getItem("sprig.previewKey") ?? void 0;
|
|
636
636
|
if (r.requireUserIdForTracking && !globalThis.UserLeap.userId && !s) {
|
|
637
|
-
const
|
|
638
|
-
return console.warn(
|
|
637
|
+
const T = "[Sprig] - Skipping tracking without userId";
|
|
638
|
+
return console.warn(T), { success: !1, message: T, surveyState: "no survey" };
|
|
639
639
|
}
|
|
640
640
|
if (!d || d.trim().length === 0) {
|
|
641
641
|
d = d ? String(d) : "";
|
|
642
|
-
const
|
|
643
|
-
return console.warn(
|
|
642
|
+
const T = "[Sprig] - Invalid event name " + d;
|
|
643
|
+
return console.warn(T), { success: !1, message: T, surveyState: "no survey" };
|
|
644
644
|
}
|
|
645
|
-
const m =
|
|
646
|
-
o.url || (o.url = m),
|
|
647
|
-
const
|
|
648
|
-
if (!
|
|
649
|
-
const
|
|
650
|
-
return
|
|
645
|
+
const m = ie ?? globalThis.location.href;
|
|
646
|
+
o.url || (o.url = m), _("trackStartUrl", m), (I = (y = globalThis.UserLeap) == null ? void 0 : y._config) != null && I.optimizelyEnabled && (oe(O(globalThis.UserLeap)) || ce.getAndSetWebOptimizelyExperiments(), o.optimizelyExperiments = Object.assign({}, ce.getAllOptimizelyExperiments())), (k = (L = globalThis.UserLeap) == null ? void 0 : L._config) != null && k.launchDarklyEnabled && (o.launchDarklyFlags = De.getAllLaunchDarklyVariations()), s && (globalThis.UserLeap.userId = s), n && (globalThis.UserLeap.partnerAnonymousId = n), l && (o.eventProperties = l), (V = S.replay) == null || V.RecordEvent({ name: d, url: o.url }), P.info("TrackEvent", { eventName: d });
|
|
647
|
+
const f = globalThis.UserLeap.delayingSurvey || vt() ? await D(x("1", [F], "events/batch"), { body: JSON.stringify({ events: [{ event: d, metadata: o }], previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 }) : await D(x("1", [F], "events"), { body: JSON.stringify({ event: d, metadata: o, previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 });
|
|
648
|
+
if (!f.ok) {
|
|
649
|
+
const T = "[Sprig] (ERR-421) Failed to track event";
|
|
650
|
+
return f.reportError && (console.warn(T, f.error), f.error && globalThis.UserLeap.reportError("track", f.error)), { success: !1, message: T, error: f.error, surveyState: "no survey" };
|
|
651
651
|
}
|
|
652
|
-
s &&
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
const
|
|
656
|
-
return
|
|
657
|
-
var
|
|
658
|
-
let
|
|
659
|
-
return !(
|
|
660
|
-
}(
|
|
652
|
+
s && _("uid", s), n && _("aid", n);
|
|
653
|
+
const h = f.json;
|
|
654
|
+
h.invalidPreviewKey && Q.removeItem("sprig.previewKey");
|
|
655
|
+
const b = o.trackPageView ? o.url : void 0;
|
|
656
|
+
return h != null && h.feedbackButton && Ut(h.feedbackButton, void 0, b), await async function(T, E) {
|
|
657
|
+
var K, W;
|
|
658
|
+
let M = !0;
|
|
659
|
+
return !(E && ((K = T == null ? void 0 : T.json) != null && K.surveyId) && (globalThis.UserLeap.delayingSurvey = !0, M = await E(T.json.surveyId), globalThis.UserLeap.delayingSurvey = !1, !M)) && ((W = T == null ? void 0 : T.json) != null && W.delay && !globalThis.UserLeap.isMobileSDK && (globalThis.UserLeap.delayingSurvey = !0, await gt(T.json.delay), globalThis.UserLeap.delayingSurvey = !1), M);
|
|
660
|
+
}(f, c) ? function(T) {
|
|
661
661
|
if (!globalThis.UserLeap._config.dismissOnPageChange) return !0;
|
|
662
|
-
const
|
|
663
|
-
return
|
|
664
|
-
}(m) ?
|
|
662
|
+
const E = new URL(T), M = new URL(ie ?? globalThis.location.href);
|
|
663
|
+
return E.hostname === M.hostname && E.pathname === M.pathname;
|
|
664
|
+
}(m) ? te(h, b, Fe) : { 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" };
|
|
665
665
|
}, i = (t, s) => {
|
|
666
666
|
var o;
|
|
667
|
-
const n = (o = t == null ? void 0 : t.querySelector(`[id="${
|
|
668
|
-
n &&
|
|
669
|
-
}, a = { displaySurvey: async (t) => (console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."), globalThis.UserLeap("dismissActiveSurvey", C.Override),
|
|
670
|
-
globalThis.UserLeap("dismissActiveSurvey", C.Override),
|
|
667
|
+
const n = (o = t == null ? void 0 : t.querySelector(`[id="${Me}"]`)) == null ? void 0 : o.contentDocument;
|
|
668
|
+
n && pe({ document: n, elementId: "ul-custom-style", styleString: s });
|
|
669
|
+
}, a = { displaySurvey: async (t) => (console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."), globalThis.UserLeap("dismissActiveSurvey", C.Override), _e({ surveyId: t }, !0)), _previewSurvey(t) {
|
|
670
|
+
globalThis.UserLeap("dismissActiveSurvey", C.Override), _e({ surveyTemplateId: t }, !1);
|
|
671
671
|
}, _reviewSurvey(t) {
|
|
672
|
-
globalThis.UserLeap("dismissActiveSurvey", C.Override),
|
|
672
|
+
globalThis.UserLeap("dismissActiveSurvey", C.Override), _e({ surveyId: t }, !1);
|
|
673
673
|
}, previewSurvey(t) {
|
|
674
674
|
a._previewSurvey(t);
|
|
675
675
|
}, reviewSurvey(t) {
|
|
@@ -706,14 +706,14 @@ const or = function(r) {
|
|
|
706
706
|
return console.warn(d), { success: !1, message: d };
|
|
707
707
|
}
|
|
708
708
|
if (o) {
|
|
709
|
-
o.email && !o[
|
|
709
|
+
o.email && !o[Z] && (o[Z] = o.email, delete o.email);
|
|
710
710
|
const d = Object.keys(o);
|
|
711
|
-
for (const p of d) o[p] ===
|
|
711
|
+
for (const p of d) o[p] === fe[p] && delete o[p];
|
|
712
712
|
}
|
|
713
713
|
if (!(o && Object.keys(o).length !== 0 || s && globalThis.UserLeap.userId !== s || n && globalThis.UserLeap.partnerAnonymousId !== n)) return { success: !0 };
|
|
714
714
|
const l = {};
|
|
715
715
|
let c;
|
|
716
|
-
return s && (l.userId = globalThis.UserLeap.userId = s), n && (l.partnerAnonymousId = globalThis.UserLeap.partnerAnonymousId = n), o && Object.keys(o).length > 0 ? (c = await D(
|
|
716
|
+
return s && (l.userId = globalThis.UserLeap.userId = s), n && (l.partnerAnonymousId = globalThis.UserLeap.partnerAnonymousId = n), o && Object.keys(o).length > 0 ? (c = await D(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 && globalThis.UserLeap.reportError("identifyAndSetAttributes", c.error))) : c = await D(x("1", [q, F]), { body: JSON.stringify(l), method: "PUT" }), o && o[Z] && (globalThis.UserLeap.email = o[Z]), c.ok && (s && _("uid", s), n && _("aid", n)), { success: !!c.ok };
|
|
717
717
|
}, async removeAttributes(t) {
|
|
718
718
|
if (globalThis.UserLeap.debugMode && console.info("[DEBUG] Sprig removeAttributes", t), r.mode === "test") return;
|
|
719
719
|
if (t == null || t.length === 0) {
|
|
@@ -724,7 +724,7 @@ const or = function(r) {
|
|
|
724
724
|
const n = "[Sprig] - Skipping tracking without userId";
|
|
725
725
|
return console.warn(n), { success: !1, message: n };
|
|
726
726
|
}
|
|
727
|
-
const s = await D(
|
|
727
|
+
const s = await D(x("1", [q, F], "attributes"), { body: JSON.stringify({ delete: t }), method: "DELETE" });
|
|
728
728
|
return !s.ok && s.reportError && (console.warn("[Sprig] (ERR-433) Remove attributes failed", s.error), s.error && globalThis.UserLeap.reportError("removeAttributes", s.error)), { success: !!s.ok };
|
|
729
729
|
}, async addSurveyListener(t) {
|
|
730
730
|
g.on(u.SurveyLifeCycle, t);
|
|
@@ -746,38 +746,38 @@ const or = function(r) {
|
|
|
746
746
|
}
|
|
747
747
|
if (r.mode === "test" || t === globalThis.UserLeap.userId) return;
|
|
748
748
|
globalThis.UserLeap.userId = t;
|
|
749
|
-
const s = globalThis.UserLeap.visitorId, n = await D(
|
|
750
|
-
n.ok ? (s !== globalThis.UserLeap.visitorId && ((o =
|
|
749
|
+
const s = globalThis.UserLeap.visitorId, n = await D(x("1", [q, F]), { body: JSON.stringify({ userId: t }), method: "PUT" });
|
|
750
|
+
n.ok ? (s !== globalThis.UserLeap.visitorId && ((o = S.replay) == null || o.clearUserReplayData()), _("uid", t)) : n.reportError && (console.warn("[Sprig] (ERR-420) Failed to set user id", n.error), n.error && globalThis.UserLeap.reportError("setUserId", n.error));
|
|
751
751
|
}, async setPartnerAnonymousId(t) {
|
|
752
752
|
if (globalThis.UserLeap.debugMode && console.info("[DEBUG] Sprig setPartnerAnonymousId", t), t == null) {
|
|
753
753
|
const s = `[Sprig] - Invalid partnerAnonymousId ${t}`;
|
|
754
754
|
return console.warn(s), { success: !1, message: s };
|
|
755
755
|
}
|
|
756
|
-
return globalThis.UserLeap.partnerAnonymousId = t,
|
|
756
|
+
return globalThis.UserLeap.partnerAnonymousId = t, _("aid", t), { success: !0 };
|
|
757
757
|
}, track: async (t, s, n = {}, o = void 0) => e({ eventName: t, properties: s, metadata: n, showSurveyCallback: o }), identifyAndTrack: async (t) => await e(t), trackPageView(t, s = void 0, n = void 0, o = !0) {
|
|
758
|
-
|
|
758
|
+
ie = t, Dt(t, s, n, o);
|
|
759
759
|
}, applyFeedbackStyles({ button: t = "", view: s = "" }) {
|
|
760
|
-
globalThis.UserLeap.feedbackCustomStyles = s, document.getElementById("sprig-feedback-style") &&
|
|
760
|
+
globalThis.UserLeap.feedbackCustomStyles = s, document.getElementById("sprig-feedback-style") && pe({ document, elementId: "ul-custom-style", styleString: t, nonce: globalThis.UserLeap.styleNonce }), i(document.querySelector(".ul-container-feedback"), s);
|
|
761
761
|
}, applyStyles(t) {
|
|
762
762
|
globalThis.UserLeap.customStyles = t, i(globalThis.UserLeap.container, t);
|
|
763
763
|
}, setWindowDimensions(t, s) {
|
|
764
|
-
var m,
|
|
764
|
+
var m, f;
|
|
765
765
|
const n = typeof t == "string" ? parseInt(t, 10) : t, o = typeof s == "string" ? parseInt(s, 10) : s;
|
|
766
766
|
isNaN(n) || isNaN(o) || (globalThis.UserLeap.windowDimensions = { width: n, height: o });
|
|
767
|
-
const l = O(globalThis.UserLeap), c =
|
|
767
|
+
const l = O(globalThis.UserLeap), c = we(l), d = l["userleap-platform"] === "web";
|
|
768
768
|
if (!globalThis.UserLeap.frameId) return;
|
|
769
769
|
const p = document.getElementById(globalThis.UserLeap.frameId);
|
|
770
|
-
p && (globalThis.UserLeap.useMobileStyling && ((m = globalThis.UserLeap.windowDimensions) != null && m.width && (p.style.width = `${globalThis.UserLeap.windowDimensions.width}px`), (
|
|
770
|
+
p && (globalThis.UserLeap.useMobileStyling && ((m = globalThis.UserLeap.windowDimensions) != null && m.width && (p.style.width = `${globalThis.UserLeap.windowDimensions.width}px`), (f = globalThis.UserLeap.windowDimensions) != null && f.height && (p.style.maxHeight = globalThis.UserLeap.windowDimensions.height - 20 + "px"), p.contentDocument && (p.style.height = String(Gt(p.contentDocument, d && !c, pt(l))[0]) + "px")), g.emit(u.SurveyDimensions, { name: u.SurveyDimensions, contentFrameWidth: p.clientWidth, contentFrameHeight: p.clientHeight, "survey.id": parseInt(globalThis.UserLeap.container.dataset.studyId) }));
|
|
771
771
|
}, logoutUser() {
|
|
772
772
|
var t;
|
|
773
|
-
globalThis.UserLeap.debugMode && console.info("[DEBUG] Sprig logout"), P.info("LogOut", { vid: globalThis.UserLeap.visitorId, userId: globalThis.UserLeap.userId }), globalThis.UserLeap.visitorId = null, globalThis.UserLeap.userId = null, globalThis.UserLeap.partnerAnonymousId = null, globalThis.UserLeap.token = null, globalThis.UserLeap.email = null, H.removeItem("userleap.ids"), globalThis.UserLeap._queue.isPaused() && globalThis.UserLeap._queue.empty(),
|
|
773
|
+
globalThis.UserLeap.debugMode && console.info("[DEBUG] Sprig logout"), P.info("LogOut", { vid: globalThis.UserLeap.visitorId, userId: globalThis.UserLeap.userId }), globalThis.UserLeap.visitorId = null, globalThis.UserLeap.userId = null, globalThis.UserLeap.partnerAnonymousId = null, globalThis.UserLeap.token = null, globalThis.UserLeap.email = null, H.removeItem("userleap.ids"), globalThis.UserLeap._queue.isPaused() && globalThis.UserLeap._queue.empty(), xt(), (t = S.replay) == null || t.clearUserReplayData(), globalThis.UserLeap._queue.unpause();
|
|
774
774
|
}, teardown() {
|
|
775
|
-
["hashchange", "popstate"].forEach((t) => globalThis.removeEventListener(t,
|
|
775
|
+
["hashchange", "popstate"].forEach((t) => globalThis.removeEventListener(t, se, !0)), globalThis.UserLeap._config.interactiveEvents && _t(), globalThis.UserLeap("dismissActiveSurvey", C.API), delete globalThis.UserLeap, delete globalThis.Sprig, delete globalThis._Sprig;
|
|
776
776
|
}, integrateOptimizely(t, s = !0) {
|
|
777
777
|
var n, o;
|
|
778
778
|
if ((o = (n = globalThis.UserLeap) == null ? void 0 : n._config) != null && o.optimizelyEnabled) try {
|
|
779
779
|
const l = typeof t == "string" ? JSON.parse(t) : t;
|
|
780
|
-
|
|
780
|
+
ce.setOptimizelyExperiment(l, s);
|
|
781
781
|
} catch (l) {
|
|
782
782
|
console.warn("[Sprig] Error with integrating Optimizely data"), l instanceof Error && globalThis.UserLeap.reportError("integrateOptimizely", l);
|
|
783
783
|
}
|
|
@@ -791,8 +791,8 @@ const or = function(r) {
|
|
|
791
791
|
});
|
|
792
792
|
}, importLaunchDarklyData(t) {
|
|
793
793
|
var s, n;
|
|
794
|
-
(n = (s = globalThis.UserLeap) == null ? void 0 : s._config) != null && n.launchDarklyEnabled ?
|
|
795
|
-
}, setVisitorAttribute: (t, s) => (console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"), a.setAttribute(t, s)), setEmail: async (t) => a.setAttribute(
|
|
794
|
+
(n = (s = globalThis.UserLeap) == null ? void 0 : s._config) != null && n.launchDarklyEnabled ? De.setLDFlagsVariations(t) : console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");
|
|
795
|
+
}, setVisitorAttribute: (t, s) => (console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"), a.setAttribute(t, s)), setEmail: async (t) => a.setAttribute(Z, t), setVisitorEmail: async (t) => (console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"), a.setEmail(t)), _generateVideoUploadUrl: async (t) => async function(s) {
|
|
796
796
|
var o;
|
|
797
797
|
if (!s) return;
|
|
798
798
|
const n = `${globalThis.UserLeap._API_URL}/2/environments/integrations/upload`;
|
|
@@ -807,77 +807,77 @@ const or = function(r) {
|
|
|
807
807
|
console.warn("[Sprig] Error with generating video upload url"), l instanceof Error && globalThis.UserLeap.reportError("generateVideoUploadUrl", l);
|
|
808
808
|
}
|
|
809
809
|
}(t), _reportMetric(t, s) {
|
|
810
|
-
|
|
810
|
+
qt(t, s);
|
|
811
811
|
}, _completeSessionReplay: async ({ surveyId: t, responseGroupUuid: s, eventDigest: n }) => {
|
|
812
812
|
var o;
|
|
813
|
-
return
|
|
813
|
+
return S.replay ? (o = S.replay) == null ? void 0 : o._completeSessionReplay({ surveyId: t, responseGroupUuid: s, eventDigest: n, headers: O(globalThis.UserLeap) }) : (globalThis.UserLeap.reportError("_completeSessionReplay", new Error("Replay module not registered")), !1);
|
|
814
814
|
}, pauseReplayRecording() {
|
|
815
815
|
var t, s, n, o;
|
|
816
|
-
(s = (t =
|
|
816
|
+
(s = (t = S.replay) == null ? void 0 : t.isReplayPaused) != null && s.call(t) || ((o = (n = S.replay) == null ? void 0 : n.recordReplayPaused) == null || o.call(n));
|
|
817
817
|
}, resumeReplayRecording() {
|
|
818
818
|
var t, s, n, o, l, c;
|
|
819
|
-
(s = (t =
|
|
819
|
+
(s = (t = S.replay) == null ? void 0 : t.isReplayPaused) != null && s.call(t) && ((o = (n = S.replay) == null ? void 0 : n.recordReplayResumed) == null || o.call(n), (c = (l = S.replay) == null ? void 0 : l.recordFullSnapshot) == null || c.call(l));
|
|
820
820
|
} };
|
|
821
821
|
Object.assign(globalThis.UserLeap, a);
|
|
822
822
|
};
|
|
823
|
-
async function
|
|
823
|
+
async function lr(r, e, i = {}, a = {}) {
|
|
824
824
|
var d;
|
|
825
|
-
const t = (d = globalThis.__cfg) == null ? void 0 : d.mode, s =
|
|
826
|
-
(await D(
|
|
825
|
+
const t = (d = globalThis.__cfg) == null ? void 0 : d.mode, s = Ce(), n = globalThis.UserLeap.envId, o = globalThis.document.documentElement, l = { mode: t, screenWidth: globalThis.screen.width, screenHeight: globalThis.screen.height, clientWidth: o.clientWidth, clientHeight: o.clientHeight, location: ie ?? globalThis.location.href, language: globalThis.navigator.language, ...i }, c = { action: r, breadcrumbs: P.breadcrumbs, err: { message: `${e == null ? void 0 : e.name} - ${e == null ? void 0 : e.message}`, stack: e == null ? void 0 : e.stack }, meta: l, vid: s, envId: n, ...a };
|
|
826
|
+
(await D(x("1", null, "errors"), { method: "POST", headers: { "x-ul-error": globalThis.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(c), shouldDropOnRateLimit: !0 })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", e);
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function dr(r = {}) {
|
|
829
829
|
var a;
|
|
830
830
|
(a = globalThis.SprigLoggerCallback) == null || a.call(globalThis, "Initializing Sprig");
|
|
831
831
|
const e = new URLSearchParams(globalThis.location.search).get("sprigPreviewKey") ?? "";
|
|
832
832
|
async function i() {
|
|
833
|
-
var p, m,
|
|
833
|
+
var p, m, f, h, b;
|
|
834
834
|
if (globalThis.UserLeap.loaded) return;
|
|
835
|
-
if ((p = globalThis.SprigLoggerCallback) == null || p.call(globalThis, "Loading Sprig"), globalThis.UserLeap.reportError =
|
|
835
|
+
if ((p = globalThis.SprigLoggerCallback) == null || p.call(globalThis, "Loading Sprig"), globalThis.UserLeap.reportError = lr, globalThis.UserLeap.loaded = !0, globalThis.UserLeap._config = Object.assign({}, r, globalThis.UserLeap.config), globalThis.UserLeap.delayingSurvey = !1, globalThis.UserLeap._config && typeof globalThis.UserLeap._config == "object") for (const v in globalThis.UserLeap._config) globalThis.UserLeap[v] = globalThis.UserLeap._config[v];
|
|
836
836
|
if (globalThis.Sprig.outstandingTransactionLimit !== void 0 && (r.outstandingTransactionLimit = globalThis.Sprig.outstandingTransactionLimit), !globalThis.UserLeap.envId) {
|
|
837
837
|
if (!globalThis.UserLeap.appId) throw new Error("Missing Environment id");
|
|
838
838
|
globalThis.UserLeap.envId = globalThis.UserLeap.appId;
|
|
839
839
|
}
|
|
840
840
|
globalThis.UserLeap.debugMode && console.info("[DEBUG] Sprig debug mode enabled");
|
|
841
|
-
const t =
|
|
841
|
+
const t = Rt(), s = globalThis.UserLeap.sampleRate;
|
|
842
842
|
let n = t.sampled;
|
|
843
843
|
if (s) {
|
|
844
|
-
if (n === null && (n = Math.random() < s,
|
|
845
|
-
} else n !== null &&
|
|
844
|
+
if (n === null && (n = Math.random() < s, _("sampled", n)), !n) return;
|
|
845
|
+
} else n !== null && _("sampled", null);
|
|
846
846
|
globalThis.UserLeap._API_URL || (globalThis.UserLeap._API_URL = "https://api.sprig.com");
|
|
847
847
|
const o = [...globalThis.UserLeap._queue];
|
|
848
|
-
globalThis.UserLeap._queue = new
|
|
849
|
-
for (let
|
|
848
|
+
globalThis.UserLeap._queue = new Qt(globalThis.UserLeap, []), globalThis.UserLeap._queue.pause();
|
|
849
|
+
for (let v = 0; v < o.length; v++) globalThis.UserLeap._queue.push(o[v]);
|
|
850
850
|
const l = t.token;
|
|
851
|
-
l ? (globalThis.UserLeap.token = l, globalThis.UserLeap.visitorId = t.vid ?? null, globalThis.UserLeap.userId = t.uid ?? null, globalThis.UserLeap.partnerAnonymousId = t.aid ?? null) :
|
|
852
|
-
const c =
|
|
851
|
+
l ? (globalThis.UserLeap.token = l, globalThis.UserLeap.visitorId = t.vid ?? null, globalThis.UserLeap.userId = t.uid ?? null, globalThis.UserLeap.partnerAnonymousId = t.aid ?? null) : xt();
|
|
852
|
+
const c = oe(O(globalThis.UserLeap));
|
|
853
853
|
(m = globalThis.SprigLoggerCallback) == null || m.call(globalThis, "Sprig fetching config");
|
|
854
|
-
const d = await async function(
|
|
855
|
-
var k,
|
|
856
|
-
const
|
|
857
|
-
document.addEventListener("securitypolicyviolation",
|
|
858
|
-
const I = await
|
|
859
|
-
if (document.removeEventListener("securitypolicyviolation",
|
|
860
|
-
const
|
|
861
|
-
return
|
|
854
|
+
const d = await async function(v) {
|
|
855
|
+
var k, V;
|
|
856
|
+
const y = O(globalThis.UserLeap);
|
|
857
|
+
document.addEventListener("securitypolicyviolation", Ke);
|
|
858
|
+
const I = await dt(x("1", [q], "config"), { headers: y });
|
|
859
|
+
if (document.removeEventListener("securitypolicyviolation", Ke), !I.ok) return (k = globalThis.SprigLoggerCallback) == null || k.call(globalThis, "Sprig config fetch failed"), I.reportError && (console.warn("[Sprig] (ERR-422) Failed to load configuration", I.error), I.error && globalThis.UserLeap.reportError("applyRemoteConfig", I.error)), Je("Disabled: failed to fetch configuration"), v;
|
|
860
|
+
const L = I.json;
|
|
861
|
+
return L != null && L.disabled ? ((V = globalThis.SprigLoggerCallback) == null || V.call(globalThis, "Sprig config fetch disabled"), Je(`Disabled: ${L.disabled}`), { disabled: L.disabled }) : Object.assign({}, L, v);
|
|
862
862
|
}(r);
|
|
863
|
-
if ((
|
|
864
|
-
var
|
|
865
|
-
await D(
|
|
863
|
+
if ((f = globalThis.SprigLoggerCallback) == null || f.call(globalThis, "Sprig fetched config"), tr({ isWeb: !c, reportingIntervalSeconds: d.metricsReportingEnabled || d.mobileMetricsReportingEnabled ? d.metricsReportingIntervalSeconds : 0, thresholds: d.metricThresholds, postMetrics: async (v) => {
|
|
864
|
+
var y;
|
|
865
|
+
await D(x("1", [q], "metrics"), { body: v, method: "POST", headers: { "x-ul-replay-enabled": `${!!((y = S.replay) != null && y.isReplayRecording())}` }, shouldDropOnRateLimit: !0 });
|
|
866
866
|
} }), !c) {
|
|
867
|
-
const
|
|
868
|
-
await ((
|
|
867
|
+
const v = d.alwaysOnReplay ? { userAgent: globalThis.navigator.userAgent, surveyId: d.alwaysOnReplay.surveyId, responseGroupUuid: d.alwaysOnReplay.responseGroupUuid, sdkVersion: "2.43.0", maxDurationSeconds: d.alwaysOnReplay.maxDurationSeconds } : void 0;
|
|
868
|
+
await ((h = S.replay) == null ? void 0 : h.initializeReplay({ maxReplayDurationSeconds: d.maxReplayDurationSeconds, maxInflightRequests: globalThis.UserLeap.maxInflightReplayRequests ?? 2, replaySettings: d.replaySettings, apiUrl: globalThis.UserLeap._API_URL, alwaysOnConfig: v })), Fe = d.replaySettings;
|
|
869
869
|
}
|
|
870
|
-
|
|
871
|
-
for (const
|
|
870
|
+
nr(d), await or(d), globalThis.UserLeap._queue.unpause(), (b = globalThis.SprigLoggerCallback) == null || b.call(globalThis, "SdkReady"), g.emit(u.SDKReady, { mobileMetricsReportingEnabled: !!d.mobileMetricsReportingEnabled, metricsReportingInterval: d.metricsReportingIntervalSeconds || 0, metricsThresholds: d.metricThresholds || [], maxMobileReplayDurationSeconds: d.maxMobileReplayDurationSeconds, mobileReplaySettings: d.mobileReplaySettings }), g.emit(u.VisitorIDUpdated, { visitorId: globalThis.UserLeap.visitorId }), g.on(u.VisitorIDUpdated, () => {
|
|
871
|
+
for (const v in fe) delete fe[v];
|
|
872
872
|
});
|
|
873
873
|
}
|
|
874
|
-
globalThis.UserLeap.UPDATES =
|
|
874
|
+
globalThis.UserLeap.UPDATES = ae, globalThis.UserLeap("setPreviewKey", e), document.readyState === "complete" ? i() : globalThis.attachEvent ? globalThis.attachEvent("onload", i) : globalThis.addEventListener("load", () => {
|
|
875
875
|
i();
|
|
876
876
|
}, !1);
|
|
877
877
|
}
|
|
878
|
-
class
|
|
878
|
+
class ve {
|
|
879
879
|
constructor() {
|
|
880
|
-
|
|
880
|
+
N(this, "UPDATES", ae);
|
|
881
881
|
}
|
|
882
882
|
displaySurvey(e) {
|
|
883
883
|
var i;
|
|
@@ -972,32 +972,32 @@ class fe {
|
|
|
972
972
|
(e = globalThis.Sprig) == null || e.call(globalThis, "resumeReplayRecording");
|
|
973
973
|
}
|
|
974
974
|
}
|
|
975
|
-
const
|
|
975
|
+
const nt = { configure: (r) => {
|
|
976
976
|
if (!r.envId && !r.environmentId) throw new Error("Initialization Error: Sprig configure requires an environmentId");
|
|
977
977
|
if (r.envId || (r.envId = r.environmentId ?? ""), r.installationMethod = "web-npm", globalThis.Sprig) return globalThis.Sprig;
|
|
978
978
|
globalThis.Sprig = function() {
|
|
979
979
|
var i;
|
|
980
980
|
(i = globalThis.Sprig) == null || i._queue.push(arguments);
|
|
981
|
-
}, Object.getOwnPropertyNames(
|
|
982
|
-
i !== "constructor" && (globalThis.Sprig[i] =
|
|
981
|
+
}, Object.getOwnPropertyNames(ve.prototype).map((i) => {
|
|
982
|
+
i !== "constructor" && (globalThis.Sprig[i] = ve.prototype[i]);
|
|
983
983
|
});
|
|
984
984
|
const e = globalThis.Sprig;
|
|
985
|
-
return e.appId = r.envId, e._queue = [], globalThis.UserLeap = e,
|
|
986
|
-
} },
|
|
985
|
+
return e.appId = r.envId, e._queue = [], globalThis.UserLeap = e, dr(r), globalThis.Sprig;
|
|
986
|
+
} }, cr = new ve(), vr = { sprig: nt, SprigAPI: ve, configure: nt.configure, Sprig: cr };
|
|
987
987
|
export {
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
988
|
+
hr as A,
|
|
989
|
+
Ht as C,
|
|
990
|
+
yr as D,
|
|
991
|
+
mr as E,
|
|
992
|
+
cr as S,
|
|
993
|
+
ve as a,
|
|
994
|
+
br as b,
|
|
995
|
+
vr as c,
|
|
996
|
+
gr as d,
|
|
997
|
+
Gt as e,
|
|
998
|
+
pe as f,
|
|
999
|
+
Pe as g,
|
|
1000
1000
|
j as i,
|
|
1001
|
-
|
|
1002
|
-
|
|
1001
|
+
fr as r,
|
|
1002
|
+
nt as s
|
|
1003
1003
|
};
|