@sprig-technologies/sprig-browser 2.32.6 → 2.32.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{core-GM5ainPn.js → core-B-DyGs3n.js} +154 -154
- package/dist/{core-DNNKcB-C.cjs → core-DdcxBCQS.cjs} +3 -3
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-hJoXXbKC.cjs → metricsReporter-DNKMOwn_.cjs} +1 -1
- package/dist/{metricsReporter-IUVTL7s6.js → metricsReporter-rplm9tEP.js} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/{view-BC8pDITD.js → view-Ck6u_lD1.js} +142 -141
- package/dist/{view-D-38xPZ5.cjs → view-DvJ_Vu4Z.cjs} +2 -2
- package/package.json +1 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
var Lt = Object.defineProperty;
|
|
2
2
|
var Ut = (t, e, n) => e in t ? Lt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
-
var
|
|
4
|
-
import { g as F, s as Qe, l as D, e as
|
|
5
|
-
const
|
|
3
|
+
var $ = (t, e, n) => (Ut(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
+
import { g as F, s as Qe, l as D, e as w, S as g, v as Ye, m as I, b as T, h as St, E as te, D as W, c as It, r as V, i as kt, j as Et, k as _t, n as Me, o as qe, a as xt, p as Xe, d as Dt, q as Ze } from "./metricsReporter-rplm9tEP.js";
|
|
5
|
+
const rr = 360, ir = "ul-app", nr = "#e6e6e6", or = "#bd282a", sr = 1030, Fe = () => {
|
|
6
6
|
try {
|
|
7
7
|
return window.parent.Intercom;
|
|
8
8
|
} catch {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
11
|
}, ze = [Object.freeze(Object.defineProperty({ __proto__: null, disable: () => {
|
|
12
|
-
const t =
|
|
12
|
+
const t = Fe();
|
|
13
13
|
t && (t.ul_wasVisible = !!document.querySelector("iframe.intercom-launcher-frame"), t.ul_wasVisible && t("update", { hide_default_launcher: !0 }));
|
|
14
14
|
}, enable: () => {
|
|
15
|
-
const t =
|
|
15
|
+
const t = Fe();
|
|
16
16
|
t && (t.ul_wasVisible && t("update", { hide_default_launcher: !1 }), delete t.ul_wasVisible);
|
|
17
17
|
} }, Symbol.toStringTag, { value: "Module" }))];
|
|
18
|
-
class
|
|
18
|
+
class At {
|
|
19
19
|
static disable() {
|
|
20
20
|
ze.forEach((e) => e.disable());
|
|
21
21
|
}
|
|
@@ -23,7 +23,7 @@ class Rt {
|
|
|
23
23
|
ze.forEach((e) => e.enable());
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const He = "ul-view-sdk-script", Rt = ["ios", "android"], j = "visitors", q = "environments";
|
|
27
27
|
async function C(t, e) {
|
|
28
28
|
var i, o, a;
|
|
29
29
|
const { shouldDropOnRateLimit: n, ...s } = e;
|
|
@@ -32,10 +32,10 @@ async function C(t, e) {
|
|
|
32
32
|
if (r.ok) {
|
|
33
33
|
const l = (i = r.headers) == null ? void 0 : i.get("Authorization"), c = l ? l.split(" ") : void 0, d = c && c.length === 2 ? c[1] : void 0, p = (o = r.headers) == null ? void 0 : o.get("x-ul-visitor-id");
|
|
34
34
|
if (window.UserLeap.userId && p === window.UserLeap.visitorId) {
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const m = D.getItemObject("sprig.anon.env.vid.map");
|
|
36
|
+
m && m[window.UserLeap.envId] === p && (delete m[window.UserLeap.envId], D.setItemObject("sprig.anon.env.vid.map", m));
|
|
37
37
|
}
|
|
38
|
-
d && p && (p !== window.UserLeap.visitorId || window.UserLeap.token !== d) && (x("token", d), x("vid", p),
|
|
38
|
+
d && p && (p !== window.UserLeap.visitorId || window.UserLeap.token !== d) && (x("token", d), x("vid", p), w.emit(g.VisitorIDUpdated, { visitorId: p }), window.UserLeap.token = d, window.UserLeap.visitorId = p);
|
|
39
39
|
}
|
|
40
40
|
return (a = r.json) != null && a.logMessage && console.warn(`[Sprig] ${r.json.logMessage}`), r;
|
|
41
41
|
}
|
|
@@ -50,19 +50,19 @@ function Ee() {
|
|
|
50
50
|
function R(t, e, n) {
|
|
51
51
|
const s = [window.UserLeap._API_URL, "sdk", t];
|
|
52
52
|
return e && e.forEach((r) => {
|
|
53
|
-
s.push(r), r ===
|
|
53
|
+
s.push(r), r === q ? s.push(window.UserLeap.envId) : r === j && s.push(Ee());
|
|
54
54
|
}), n && s.push(n), s.join("/");
|
|
55
55
|
}
|
|
56
56
|
const Y = async (t, e) => {
|
|
57
57
|
var Ce, Pe, Te;
|
|
58
|
-
const { context: n, delay: s, forceBrandedLogo: r, endCard: i, isFeedback: o = !1, heatmap: a, locale: l, previewMode: c, productConfig: d, questions: p, responseGroupUid:
|
|
58
|
+
const { context: n, delay: s, forceBrandedLogo: r, endCard: i, isFeedback: o = !1, heatmap: a, locale: l, previewMode: c, productConfig: d, questions: p, responseGroupUid: m, surveyId: u, uuid: y, vid: _, sessionReplay: b, studyType: U } = t, h = F(window.UserLeap), L = ue(h), E = _e(h);
|
|
59
59
|
if (b)
|
|
60
60
|
if (L)
|
|
61
|
-
|
|
61
|
+
w.emit(g.ReplayCapture, { responseGroupUid: m, hasQuestions: !!(p != null && p.length), surveyId: u, uploadId: b.uploadId, replayType: b.replayDurationType ?? "before", seconds: b.replayDurationSeconds, generateVideoUploadUrlPayload: { mediaRecordingUid: Ye(), mediaType: "screen", questionId: 1, responseGroupUid: m, surveyId: u, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), visitorId: window.UserLeap.visitorId, isReplay: !0 } });
|
|
62
62
|
else {
|
|
63
63
|
if (!I.replay)
|
|
64
64
|
return window.UserLeap.reportError("displayQuestions", new Error("Replay module not registered")), { success: !1, message: "Replay module not registered", surveyState: "no survey" };
|
|
65
|
-
I.replay.scheduleOrCaptureReplay({ responseGroupId:
|
|
65
|
+
I.replay.scheduleOrCaptureReplay({ responseGroupId: m, surveyId: u, visitorId: _, replayParams: b, completeUploadHeaders: h, apiUrl: window.UserLeap._API_URL, triggerTimestamp: Date.now(), isStandalone: p.length === 0 });
|
|
66
66
|
}
|
|
67
67
|
if (a) {
|
|
68
68
|
if (!I.replay)
|
|
@@ -80,34 +80,34 @@ const Y = async (t, e) => {
|
|
|
80
80
|
const S = "[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";
|
|
81
81
|
return console.warn(S), { success: !1, message: S, surveyState: "no survey" };
|
|
82
82
|
}
|
|
83
|
-
if (_ !== window.UserLeap.visitorId &&
|
|
83
|
+
if (_ !== window.UserLeap.visitorId && y !== window.UserLeap.visitorId && !window.previewMode) {
|
|
84
84
|
const S = "Attempted to display survey to a different visitor";
|
|
85
85
|
return window.UserLeap.reportError("DisplaySurvey", new Error(S)), { success: !1, message: S, surveyState: "no survey" };
|
|
86
86
|
}
|
|
87
|
-
T.info("ShowingSurvey", { surveyId:
|
|
88
|
-
let O, v, k, A,
|
|
87
|
+
T.info("ShowingSurvey", { surveyId: u }), (Ce = I.replay) == null || Ce.RecordSurveyShown({ id: u, userAgent: window.navigator.userAgent }), At.disable(), w.emit(g.SurveyWillPresent, { name: g.SurveyWillPresent, "survey.id": u });
|
|
88
|
+
let O, v, k, A, z = document.createElement("div");
|
|
89
89
|
const K = (S) => {
|
|
90
90
|
const { "view.version": me } = S;
|
|
91
|
-
me !== h["x-ul-sdk-version"] && tt(),
|
|
91
|
+
me !== h["x-ul-sdk-version"] && tt(), w.removeListener("verify.view.version", K);
|
|
92
92
|
};
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
}, context: n, endCard: i, envId: window.UserLeap.envId, eventEmitFn:
|
|
93
|
+
w.on("verify.view.version", K), window.UserLeap.useMobileStyling = E, St(h) ? (O = "ul-direct-embeded-frame", v = document.head, k = window, A = !1, L && (et(u, o), z.id = O, window.UserLeap.container.appendChild(z), rt(), w.emit(g.SurveyLifeCycle, { state: "presented" }), w.emit(g.SurveyPresented, { name: g.SurveyPresented, "survey.id": u }))) : { frameId: O, contentWinDocHead: v, contentWindow: k, hasOverlay: A, iframe: z } = Ct({ productConfig: d, useMobileStyling: E, surveyId: u, isFeedback: o }), window.UserLeap.frameId = O;
|
|
94
|
+
const B = { apiURL: window.UserLeap._API_URL, cards: p, configureExitOnOverlayClick: (S) => {
|
|
95
|
+
w.once(g.CloseSurveyOnOverlayClick, S);
|
|
96
|
+
}, context: n, endCard: i, envId: window.UserLeap.envId, eventEmitFn: w.emit.bind(w), fontFamily: window.UserLeap.fontFamily, fontFamilyURL: window.UserLeap.fontFamilyURL, forceBrandedLogo: r, frame: z, headers: h, locale: l, mobileSDKVersion: window.UserLeap.mobileSDKVersion, previewKey: D.getItem("sprig.previewKey"), previewMode: c, productConfig: { framePosition: d == null ? void 0 : d.framePosition, desktopDisplay: d == null ? void 0 : d.desktopDisplay, placement: d == null ? void 0 : d.placement }, responseGroupUid: m, startingQuestionIdx: (Pe = window.UserLeap.config) == null ? void 0 : Pe.startingQuestionIdx, studyType: U, styleNonce: window.UserLeap.styleNonce, surveyId: u, tabTitle: document.title, trackPageViewUrl: e, ulEvents: te, upchunkLibraryURL: window.UserLeap.upchunkLibraryURL, useMobileStyling: E, userId: y, viewDocument: k == null ? void 0 : k.document, viewWindow: k, visitorAttributes: { externalUserId: window.UserLeap.userId, email: window.UserLeap.email }, ...window.UserLeap._config };
|
|
97
97
|
(Te = window.UserLeap._config) != null && Te.startingQuestionIdx && (window.UserLeap._config = { ...window.UserLeap._config, startingQuestionIdx: null });
|
|
98
98
|
const vt = (o ? window.UserLeap.feedbackCustomStyles : window.UserLeap.customStyles) ?? d.customStyles;
|
|
99
|
-
|
|
100
|
-
const we = window.UserLeap.viewSDKURL ? window.UserLeap.viewSDKURL :
|
|
99
|
+
B.customStyles = vt, k && (k.__cfg = B);
|
|
100
|
+
const we = window.UserLeap.viewSDKURL ? window.UserLeap.viewSDKURL : B.path, Ae = document.getElementById(He);
|
|
101
101
|
Ae && Ae.remove();
|
|
102
102
|
const ge = function() {
|
|
103
103
|
const S = document.createElement("script");
|
|
104
|
-
return window.UserLeap.nonce && S.setAttribute("nonce", window.UserLeap.nonce), S.id =
|
|
104
|
+
return window.UserLeap.nonce && S.setAttribute("nonce", window.UserLeap.nonce), S.id = He, S;
|
|
105
105
|
}(), Re = () => {
|
|
106
106
|
window.UserLeap.container && Object.assign(window.UserLeap.container.style, { display: "flex" });
|
|
107
107
|
};
|
|
108
|
-
if (
|
|
109
|
-
const { default: S } = await import("./view-
|
|
110
|
-
S.configure(
|
|
108
|
+
if (B.installationMethod === "web-npm" || B.installationMethod === "web-npm-bundled") {
|
|
109
|
+
const { default: S } = await import("./view-Ck6u_lD1.js");
|
|
110
|
+
S.configure(B), A && window.UserLeap.container && Re();
|
|
111
111
|
} else
|
|
112
112
|
we && (ge.src = we, A && ge.addEventListener("load", () => {
|
|
113
113
|
window.UserLeap.container && Re();
|
|
@@ -115,7 +115,7 @@ const Y = async (t, e) => {
|
|
|
115
115
|
S.target instanceof HTMLScriptElement && S.target.src === we && window.UserLeap.reportError("loadFrameScript", new Error("Frame script failed to load"));
|
|
116
116
|
}, { capture: !0, once: !0 }));
|
|
117
117
|
v == null || v.appendChild(ge);
|
|
118
|
-
const Oe = { success: !0, surveyState: "ready", surveyId:
|
|
118
|
+
const Oe = { success: !0, surveyState: "ready", surveyId: u, responseGroupUid: m };
|
|
119
119
|
return window.UserLeap.isMobileSDK && s && (Oe.delay = s), Oe;
|
|
120
120
|
};
|
|
121
121
|
function _e(t) {
|
|
@@ -126,7 +126,7 @@ function _e(t) {
|
|
|
126
126
|
return ue(t) || e > 10 && e < 500;
|
|
127
127
|
}
|
|
128
128
|
function ue(t) {
|
|
129
|
-
return
|
|
129
|
+
return Rt.includes(t["userleap-platform"]);
|
|
130
130
|
}
|
|
131
131
|
const xe = "ul-frame";
|
|
132
132
|
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);
|
|
@@ -136,33 +136,33 @@ const ye = "0px", et = (t, e, n) => {
|
|
|
136
136
|
n && s && !window.UserLeap.useMobileStyling ? s.appendChild(window.UserLeap.container) : document.body.appendChild(window.UserLeap.container);
|
|
137
137
|
}, tt = (t, e) => {
|
|
138
138
|
var s;
|
|
139
|
-
|
|
139
|
+
Tt();
|
|
140
140
|
const n = window.UserLeap.container;
|
|
141
141
|
if (n)
|
|
142
142
|
try {
|
|
143
|
-
(s = n.parentNode) == null || s.removeChild(n), window.UserLeap.container = null, x("trackStartUrl", null),
|
|
143
|
+
(s = n.parentNode) == null || s.removeChild(n), window.UserLeap.container = null, x("trackStartUrl", null), w.emit(g.SurveyLifeCycle, { state: "dismissed" }), w.emit(g.SurveyClosed, { name: g.SurveyClosed, initiator: t, "survey.id": parseInt(n.dataset.studyId), ...e && { studyType: e } });
|
|
144
144
|
} catch (r) {
|
|
145
145
|
console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${t} ` + n), r instanceof Error && window.UserLeap.reportError("dismissActiveSurvey", r);
|
|
146
146
|
}
|
|
147
147
|
}, rt = () => {
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
w.once(g.SurveyWillClose, ({ initiator: t, studyType: e }) => {
|
|
149
|
+
w.removeAllListeners(g.CloseSurveyOnOverlayClick), tt(t, e);
|
|
150
150
|
});
|
|
151
|
-
},
|
|
151
|
+
}, Ot = (t, e, n, s) => {
|
|
152
152
|
var d, p;
|
|
153
|
-
const r = { position: "fixed", bottom: "0px", right: ye, border: 0, backgroundColor: "rgba(0,0,0,0)", zIndex: 2147483646, transition: "
|
|
153
|
+
const r = { position: "fixed", bottom: "0px", right: ye, border: 0, backgroundColor: "rgba(0,0,0,0)", zIndex: 2147483646, transition: "height 0.2s ease-in-out", maxWidth: "100%" }, i = Object.assign({}, e, window.UserLeap), { desktopDisplay: o } = e || {}, a = o === "center-modal";
|
|
154
154
|
let l;
|
|
155
155
|
a && (i.framePosition = "center");
|
|
156
156
|
let c = !1;
|
|
157
157
|
if (n)
|
|
158
158
|
(d = window.UserLeap.windowDimensions) != null && d.width ? r.width = `${window.UserLeap.windowDimensions.width}px` : r.width = "100%", (p = window.UserLeap.windowDimensions) != null && p.height ? r.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px" : window.UserLeap.maxHeight ? r.maxHeight = window.UserLeap.maxHeight : r.maxHeight = document.body.clientHeight - 20 + "px", ["light", "dark"].includes(i.overlayStyleMobile) && (c = !0);
|
|
159
159
|
else {
|
|
160
|
-
r.width =
|
|
161
|
-
const
|
|
160
|
+
r.width = "360px", r.maxHeight = window.UserLeap.maxHeight || "66vh";
|
|
161
|
+
const m = () => {
|
|
162
162
|
c = !0, l = { margin: "auto", position: "static" };
|
|
163
163
|
};
|
|
164
164
|
if (s)
|
|
165
|
-
a ?
|
|
165
|
+
a ? m() : l = { position: "relative", height: "300px" };
|
|
166
166
|
else
|
|
167
167
|
switch (i.framePosition) {
|
|
168
168
|
case "bottomLeft":
|
|
@@ -175,86 +175,86 @@ const ye = "0px", et = (t, e, n) => {
|
|
|
175
175
|
l = { top: 0 };
|
|
176
176
|
break;
|
|
177
177
|
case "center":
|
|
178
|
-
|
|
178
|
+
m();
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
return c && ((
|
|
182
|
-
const
|
|
183
|
-
|
|
181
|
+
return c && ((m, u) => {
|
|
182
|
+
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 }, _ = u ? m.overlayStyleMobile : m.overlayStyle;
|
|
183
|
+
y["background-color"] = _ === "light" ? "rgba(255,255,255, 0.95)" : "rgba(0,0,0,0.9)", u || (y.margin = "auto"), window.UserLeap.container && Object.assign(window.UserLeap.container.style, y);
|
|
184
184
|
})(i, n), Object.assign(t.style, r, l), c;
|
|
185
|
-
},
|
|
186
|
-
var
|
|
185
|
+
}, Ct = ({ productConfig: t, useMobileStyling: e, surveyId: n, isFeedback: s }) => {
|
|
186
|
+
var m, u;
|
|
187
187
|
const r = xe, i = s && t.desktopDisplay === "slider";
|
|
188
|
-
et(n, s, i),
|
|
188
|
+
et(n, s, i), Pt();
|
|
189
189
|
const o = document.createElement("iframe");
|
|
190
190
|
o.id = r, o.setAttribute("title", "Sprig User Feedback Dialog");
|
|
191
|
-
const a =
|
|
191
|
+
const a = Ot(o, t, e, s);
|
|
192
192
|
rt();
|
|
193
193
|
let l = !1;
|
|
194
|
-
o.setHeight = (
|
|
195
|
-
parseInt(o.style.height) ==
|
|
194
|
+
o.setHeight = (y) => {
|
|
195
|
+
parseInt(o.style.height) == y && l || (l = !0, o.style.height = `${y}px`, w.emit(g.SurveyHeight, { name: g.SurveyHeight, contentFrameHeight: y, "survey.id": n }));
|
|
196
196
|
};
|
|
197
197
|
let c = !1;
|
|
198
|
-
o.setWidth = (
|
|
199
|
-
parseInt(o.style.width) ==
|
|
200
|
-
}, (
|
|
201
|
-
|
|
202
|
-
}),
|
|
203
|
-
const d = (
|
|
198
|
+
o.setWidth = (y) => {
|
|
199
|
+
parseInt(o.style.width) == y && c || (c = !0, o.style.width = `${y}px`, w.emit(g.SurveyWidth, { name: g.SurveyWidth, contentFrameWidth: y, "survey.id": n }));
|
|
200
|
+
}, (m = window.UserLeap.container) == null || m.appendChild(o), t && (e ? t.exitOnOverlayClickMobile : t.exitOnOverlayClick) && window.UserLeap.container && (window.UserLeap.container.onclick = () => {
|
|
201
|
+
w.emit(g.CloseSurveyOnOverlayClick);
|
|
202
|
+
}), w.emit(g.SurveyLifeCycle, { state: "presented" }), w.emit(g.SurveyPresented, { name: g.SurveyPresented, "survey.id": n });
|
|
203
|
+
const d = (u = o.contentWindow) == null ? void 0 : u.document;
|
|
204
204
|
if (d && (d.open("text/html", "replace"), d.write("<!doctype html><head></head><body></body></html>"), d.close(), !e)) {
|
|
205
|
-
const
|
|
206
|
-
|
|
205
|
+
const y = d.body;
|
|
206
|
+
y.style.display = "flex", y.style.alignItems = "center";
|
|
207
207
|
}
|
|
208
208
|
const p = d == null ? void 0 : d.head;
|
|
209
209
|
return { frameId: r, contentWinDocHead: p, contentWindow: o.contentWindow, hasOverlay: a, iframe: o };
|
|
210
|
-
}, it = { [
|
|
210
|
+
}, it = { [g.SurveyFadingOut]: () => {
|
|
211
211
|
window.UserLeap.container && Object.assign(window.UserLeap.container.style, { "background-color": "rgba(0,0,0,0)" });
|
|
212
|
-
} },
|
|
212
|
+
} }, Pt = () => {
|
|
213
213
|
Object.entries(it).forEach(([t, e]) => {
|
|
214
|
-
|
|
214
|
+
w.on(t, e);
|
|
215
215
|
});
|
|
216
|
-
},
|
|
216
|
+
}, Tt = () => {
|
|
217
217
|
Object.entries(it).forEach(([t, e]) => {
|
|
218
|
-
|
|
218
|
+
w.off(t, e);
|
|
219
219
|
});
|
|
220
|
-
},
|
|
220
|
+
}, M = (t) => !!t && t.nodeType === Node.ELEMENT_NODE, We = (t) => t instanceof HTMLElement || t instanceof SVGElement, ne = ({ document: t, elementId: e, styleString: n, nonce: s }) => {
|
|
221
221
|
const r = t.getElementById(e);
|
|
222
222
|
if (r)
|
|
223
223
|
return void (r.textContent = n);
|
|
224
224
|
const i = t.createElement("style");
|
|
225
225
|
s && (i.nonce = s), i.textContent = n, i.id = e, t.head.appendChild(i);
|
|
226
|
-
},
|
|
226
|
+
}, jt = (t, e) => {
|
|
227
227
|
const n = e.querySelector(".sprig-question-body");
|
|
228
|
-
if (
|
|
228
|
+
if (!M(n))
|
|
229
229
|
return t;
|
|
230
230
|
const s = n.scrollHeight;
|
|
231
231
|
return s < 100 ? t : t - (s - 100);
|
|
232
232
|
}, Ne = (t, e) => {
|
|
233
233
|
const n = e.querySelector(t);
|
|
234
|
-
if (
|
|
234
|
+
if (!M(n))
|
|
235
235
|
return 0;
|
|
236
236
|
const s = getComputedStyle(n);
|
|
237
237
|
return parseFloat(s.paddingLeft) + parseFloat(s.paddingRight) + (parseFloat(s.marginLeft) + parseFloat(s.marginRight)) + (parseFloat(s.borderLeftWidth) + parseFloat(s.borderRightWidth));
|
|
238
|
-
},
|
|
238
|
+
}, Mt = (t) => {
|
|
239
239
|
const e = t.querySelector(".ul-card__container");
|
|
240
240
|
let n = 600, s = 360, r = 0;
|
|
241
|
-
if (
|
|
241
|
+
if (M(e)) {
|
|
242
242
|
n = e.clientHeight, n += ((a) => {
|
|
243
|
-
const l = a.querySelector(".sprig-question-body"), c = a.querySelector(".ul-card"), d = a.querySelector(".ul-card-main-content");
|
|
244
|
-
let
|
|
245
|
-
return
|
|
243
|
+
const l = a.querySelector(".sprig-question-body"), c = a.querySelector(".ul-card"), d = a.querySelector(".ul-card-main-content"), p = a.querySelector(".ul-footer"), m = a.querySelector(".sprig-container");
|
|
244
|
+
let u = 0;
|
|
245
|
+
return M(c) && (u += c.scrollHeight - c.clientHeight), M(d) && (u += d.scrollHeight - d.clientHeight), M(l) && (u += l.scrollHeight - l.clientHeight), M(p) && M(m) && m.clientHeight === 0 && (u += p.clientHeight), u;
|
|
246
246
|
})(t);
|
|
247
247
|
const i = getComputedStyle(e);
|
|
248
248
|
r = n, n += parseFloat(i.marginTop) + parseFloat(i.marginBottom) + (parseFloat(i.borderTopWidth) + parseFloat(i.borderBottomWidth));
|
|
249
249
|
const o = e.querySelector(".ul-card--matrix_grid");
|
|
250
250
|
s = o ? o.scrollWidth : e.scrollWidth, s += Ne(".ul-card__container", t), s += Ne(".sprig-question-body", t);
|
|
251
251
|
}
|
|
252
|
-
return [n + 1, s,
|
|
252
|
+
return [n + 1, s, jt(r, t)];
|
|
253
253
|
}, ar = (t) => {
|
|
254
254
|
const e = t.querySelector(".ul-card__container");
|
|
255
255
|
e && (e.scrollTop = 0);
|
|
256
256
|
}, nt = () => f, G = () => document.getElementById("sprig-feedback-container"), be = () => document.getElementById("sprig-feedback-loading-animation"), ot = () => !!document.getElementById(xe);
|
|
257
|
-
let Ve = !1, f = null, P = null, De = !1, X = null,
|
|
257
|
+
let Ve = !1, f = null, P = null, De = !1, X = null, H = null;
|
|
258
258
|
const qt = ["bottom-left", "bottom-right", "center-left", "center-right"], oe = () => {
|
|
259
259
|
var e;
|
|
260
260
|
const t = window.UserLeap.container;
|
|
@@ -266,10 +266,10 @@ const qt = ["bottom-left", "bottom-right", "center-left", "center-right"], oe =
|
|
|
266
266
|
return t + parseInt(e.borderRightWidth || "0") + parseInt(e.borderLeftWidth || "0");
|
|
267
267
|
}, se = (t) => {
|
|
268
268
|
const e = G();
|
|
269
|
-
e && (
|
|
269
|
+
e && (H != null && H.endsWith("right") ? e.style.right = `${t}px` : H != null && H.endsWith("left") && (e.style.left = `${t}px`));
|
|
270
270
|
}, fe = () => {
|
|
271
271
|
if (f && (oe() || st())) {
|
|
272
|
-
|
|
272
|
+
w.off(g.SurveyAppeared, Q), Le();
|
|
273
273
|
const t = at();
|
|
274
274
|
return se(-t), !0;
|
|
275
275
|
}
|
|
@@ -305,22 +305,22 @@ const qt = ["bottom-left", "bottom-right", "center-left", "center-right"], oe =
|
|
|
305
305
|
if (p) {
|
|
306
306
|
if (!e && i === X)
|
|
307
307
|
return;
|
|
308
|
-
p.remove(),
|
|
308
|
+
p.remove(), w.off(te.SURVEY_FADING_OUT, fe);
|
|
309
309
|
}
|
|
310
|
-
X = i, ne({ 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 }), ne({ document, elementId: "ul-custom-style", styleString: r ?? "", nonce: window.UserLeap.styleNonce }), Ve = a === "center-modal",
|
|
311
|
-
const [
|
|
310
|
+
X = i, ne({ 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 }), ne({ document, elementId: "ul-custom-style", styleString: r ?? "", nonce: window.UserLeap.styleNonce }), Ve = a === "center-modal", H = o;
|
|
311
|
+
const [m, u] = o.split("-");
|
|
312
312
|
((U) => {
|
|
313
313
|
if (G() || !qt.includes(U))
|
|
314
314
|
return;
|
|
315
315
|
const [h, L] = U.split("-"), E = document.createElement("div");
|
|
316
316
|
E.id = "sprig-feedback-container", E.classList.add(`sprig-feedback-container-${L}`, `sprig-feedback-container-${h}`), document.body.appendChild(E);
|
|
317
317
|
})(o), p = G(), P = document.createElement("button");
|
|
318
|
-
const
|
|
319
|
-
|
|
318
|
+
const y = document.createElement("div");
|
|
319
|
+
y.className = "sprig-feedback-button-label", y.innerText = l, P.appendChild(y), P.id = "sprig-feedback-button", P.classList.add(`sprig-feedback-button-${u}`, `sprig-feedback-button-${m}`, `sprig-feedback-button-${s}`, "fade-in-transition"), w.on(te.SURVEY_FADING_OUT, fe), P.addEventListener("click", async () => {
|
|
320
320
|
const U = document.getElementById("sprig-feedback-error-container");
|
|
321
321
|
if (ot() || st()) {
|
|
322
322
|
if (fe()) {
|
|
323
|
-
|
|
323
|
+
w.emit(g.SurveyWillClose, { name: g.SurveyWillClose, initiator: W.FeedbackClosed, studyType: "feedbackButton", "survey.id": d });
|
|
324
324
|
const L = G();
|
|
325
325
|
U && L && (L.remove(), X = null, f = null);
|
|
326
326
|
}
|
|
@@ -333,23 +333,23 @@ const qt = ["bottom-left", "bottom-right", "center-left", "center-right"], oe =
|
|
|
333
333
|
return E.ok ? E.json : null;
|
|
334
334
|
})(c);
|
|
335
335
|
if (h)
|
|
336
|
-
|
|
336
|
+
w.once(g.SurveyAppeared, Q), Y({ ...h, studyType: "feedbackButton" }, n);
|
|
337
337
|
else if (f) {
|
|
338
|
-
const L =
|
|
338
|
+
const L = Ft();
|
|
339
339
|
f.appendChild(L), Q(), f.style.height = "300px", f.style.width = "360px";
|
|
340
340
|
}
|
|
341
|
-
}), p == null || p.appendChild(P),
|
|
341
|
+
}), p == null || p.appendChild(P), w.emit(g.FeedbackButtonLoaded, { name: g.FeedbackButtonLoaded, "survey.id": d });
|
|
342
342
|
const { useMobileStyling: _, _config: { border: b } } = window.UserLeap;
|
|
343
343
|
if (Ve || _)
|
|
344
344
|
se(0);
|
|
345
345
|
else {
|
|
346
346
|
const U = document.createElement("div");
|
|
347
|
-
U.id = "sprig-feedback-loading-container", U.className = `sprig-feedback-loading-container sprig-feedback-loading-container-${
|
|
347
|
+
U.id = "sprig-feedback-loading-container", U.className = `sprig-feedback-loading-container sprig-feedback-loading-container-${u}`, U.style.setProperty("--feedback-border", b), f = U, Le(), p == null || p.appendChild(U);
|
|
348
348
|
const h = at();
|
|
349
349
|
se(-h);
|
|
350
350
|
}
|
|
351
351
|
window.UserLeap._config.isOnQuestionsTab && e && !oe() && f && (Be(), Le(), f && f.classList.add("sprig-feedback-loading-container-previews"), Y(e), Q());
|
|
352
|
-
},
|
|
352
|
+
}, Ft = () => {
|
|
353
353
|
const t = document.createElement("div");
|
|
354
354
|
t.id = "sprig-feedback-error-container", t.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
|
|
355
355
|
<circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
|
|
@@ -360,7 +360,7 @@ const qt = ["bottom-left", "bottom-right", "center-left", "center-right"], oe =
|
|
|
360
360
|
return e.className = "sprig-feedback-error-text", e.innerText = "There was an error while loading the survey", t.appendChild(e), t;
|
|
361
361
|
}, Ue = new class {
|
|
362
362
|
constructor() {
|
|
363
|
-
|
|
363
|
+
$(this, "_ldData", {});
|
|
364
364
|
}
|
|
365
365
|
getAllLaunchDarklyVariations() {
|
|
366
366
|
return this._ldData;
|
|
@@ -378,7 +378,7 @@ const qt = ["bottom-left", "bottom-right", "center-left", "center-right"], oe =
|
|
|
378
378
|
Object.freeze(Ue);
|
|
379
379
|
const ie = new class {
|
|
380
380
|
constructor() {
|
|
381
|
-
|
|
381
|
+
$(this, "_optimizelyData", {});
|
|
382
382
|
}
|
|
383
383
|
setOptimizelyExperiment(t, e = !0) {
|
|
384
384
|
if (!t || typeof t != "object")
|
|
@@ -425,11 +425,11 @@ const ie = new class {
|
|
|
425
425
|
}
|
|
426
426
|
}();
|
|
427
427
|
Object.freeze(ie);
|
|
428
|
-
class
|
|
428
|
+
class zt {
|
|
429
429
|
constructor(e, n) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
430
|
+
$(this, "paused");
|
|
431
|
+
$(this, "queue");
|
|
432
|
+
$(this, "ul");
|
|
433
433
|
this.ul = e, this.paused = !1, this.queue = [], this.flush(n);
|
|
434
434
|
}
|
|
435
435
|
flush(e) {
|
|
@@ -491,10 +491,10 @@ const Se = (t) => {
|
|
|
491
491
|
e.report(s / 1e3), setTimeout(() => Ie(t, e), t);
|
|
492
492
|
}, 0);
|
|
493
493
|
};
|
|
494
|
-
let ae, de, le, ce, Ge,
|
|
494
|
+
let ae, de, le, ce, Ge, N = {};
|
|
495
495
|
const re = (t, e = 1) => {
|
|
496
496
|
const { name: n } = t;
|
|
497
|
-
|
|
497
|
+
N[n] = (N[n] || 0) + e;
|
|
498
498
|
}, pt = (t) => {
|
|
499
499
|
let e = 1;
|
|
500
500
|
return t.childNodes.forEach((n) => {
|
|
@@ -514,11 +514,11 @@ const re = (t, e = 1) => {
|
|
|
514
514
|
case "characterData":
|
|
515
515
|
return void re(ce);
|
|
516
516
|
}
|
|
517
|
-
},
|
|
518
|
-
ae.report(
|
|
519
|
-
},
|
|
520
|
-
ae =
|
|
521
|
-
},
|
|
517
|
+
}, Wt = (t) => t.forEach(Ht), Nt = () => {
|
|
518
|
+
ae.report(N[ae.name] || 0), de.report(N[de.name] || 0), le.report(N[le.name] || 0), ce.report(N[ce.name] || 0), N = {};
|
|
519
|
+
}, Vt = (t = 1e3) => {
|
|
520
|
+
ae = V("sdk_mutations_nodes_added"), de = V("sdk_mutations_nodes_removed"), le = V("sdk_mutations_attributes_changed"), ce = V("sdk_mutations_character_data"), Ge = new MutationObserver(Wt), Ge.observe(document, { attributes: !0, attributeOldValue: !0, characterData: !0, characterDataOldValue: !0, childList: !0, subtree: !0 }), setInterval(Nt, t);
|
|
521
|
+
}, Bt = ({ isWeb: t, reportingIntervalSeconds: e, thresholds: n, postMetrics: s }) => {
|
|
522
522
|
kt(n, (r, i) => {
|
|
523
523
|
var o, a;
|
|
524
524
|
if ((o = I.replay) != null && o.isReplayRecording()) {
|
|
@@ -526,12 +526,12 @@ const re = (t, e = 1) => {
|
|
|
526
526
|
(a = I.replay) == null || a.disableRecording("Threshold violated", new Error(l), { 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 }), _t();
|
|
527
527
|
}
|
|
528
528
|
}), Et({ reportingIntervalSeconds: e, postMetrics: s }), t && (((r = 1e3) => {
|
|
529
|
-
const i =
|
|
529
|
+
const i = V("sdk_event_queue_latency_seconds");
|
|
530
530
|
Ie(r, i);
|
|
531
531
|
})(), ((r = 1e4) => {
|
|
532
|
-
lt =
|
|
533
|
-
})(),
|
|
534
|
-
},
|
|
532
|
+
lt = V("sdk_dom_nodes_count"), ct = V("sdk_page_html_characters"), $e(), setInterval($e, r);
|
|
533
|
+
})(), Vt());
|
|
534
|
+
}, $t = "test", Gt = ["popState", "pushState", "replaceState"];
|
|
535
535
|
let Z;
|
|
536
536
|
const pe = {}, J = "!email", ut = "pageUrl";
|
|
537
537
|
let ve = window.location.href;
|
|
@@ -542,24 +542,24 @@ function ee(t) {
|
|
|
542
542
|
return;
|
|
543
543
|
ve !== window.location.href && T.navigation("LocationChange", { from: ve, to: window.location.href }), ve = window.location.href;
|
|
544
544
|
const i = mt().trackStartUrl, o = i ? String(i) : null;
|
|
545
|
-
e && ft(window.location.href), n && (gt(),
|
|
545
|
+
e && ft(window.location.href), n && (gt(), Kt()), nt() && (() => {
|
|
546
546
|
if (oe())
|
|
547
547
|
return;
|
|
548
548
|
const l = G();
|
|
549
549
|
l && (It(X) || (l.remove(), X = null, f = null));
|
|
550
|
-
})(), xt.getItem("sprig.isCapturingHeatmap") && ((a = I.replay) == null || a.checkPendingHeatmapsUrl()), !oe() && s && o && o !== window.location.href && t &&
|
|
550
|
+
})(), xt.getItem("sprig.isCapturingHeatmap") && ((a = I.replay) == null || a.checkPendingHeatmapsUrl()), !oe() && s && o && o !== window.location.href && t && Gt.includes(t.type) && window.UserLeap("dismissActiveSurvey", W.PageChange);
|
|
551
551
|
}
|
|
552
|
-
const wt = { capture: !0 },
|
|
552
|
+
const wt = { capture: !0 }, Kt = () => {
|
|
553
553
|
const t = window.UserLeap._config.interactiveEvents.filter((n) => Xe(n, window.location.href)).map((n) => {
|
|
554
554
|
const { name: s, properties: r } = n, { selector: i, innerText: o } = r;
|
|
555
555
|
return i ? (a) => {
|
|
556
|
-
if (
|
|
556
|
+
if (We(a.target))
|
|
557
557
|
try {
|
|
558
558
|
a.target.closest(i) && window.UserLeap("track", s);
|
|
559
559
|
} catch {
|
|
560
560
|
}
|
|
561
561
|
return !1;
|
|
562
|
-
} : (a) => (
|
|
562
|
+
} : (a) => (We(a.target) && a.target.innerText === o && window.UserLeap("track", s), !1);
|
|
563
563
|
}), e = (n) => t.forEach((s) => s(n));
|
|
564
564
|
window.UserLeap._config.interactiveEventsHandler = e, window.addEventListener("click", e, wt);
|
|
565
565
|
}, gt = () => {
|
|
@@ -573,7 +573,7 @@ function yt() {
|
|
|
573
573
|
if (window.previewMode)
|
|
574
574
|
return;
|
|
575
575
|
const t = D.getItemObject("sprig.anon.env.vid.map") || {}, e = t[window.UserLeap.envId];
|
|
576
|
-
window.UserLeap.visitorId = e || Ye(), T.info("NewVid", { vid: window.UserLeap.visitorId }), x("vid", window.UserLeap.visitorId), e || (t[window.UserLeap.envId] = window.UserLeap.visitorId, D.setItemObject("sprig.anon.env.vid.map", t)),
|
|
576
|
+
window.UserLeap.visitorId = e || Ye(), T.info("NewVid", { vid: window.UserLeap.visitorId }), x("vid", window.UserLeap.visitorId), e || (t[window.UserLeap.envId] = window.UserLeap.visitorId, D.setItemObject("sprig.anon.env.vid.map", t)), w.emit(g.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId });
|
|
577
577
|
}
|
|
578
578
|
function ft(t, e, n, s) {
|
|
579
579
|
var r, i;
|
|
@@ -597,7 +597,7 @@ function ft(t, e, n, s) {
|
|
|
597
597
|
o instanceof Error && (o.stack = t, window.UserLeap.reportError("trackPageView", o)), console.warn("[Sprig] (ERR-428) Failed to track page view", o);
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function Jt() {
|
|
601
601
|
const t = "Backbone" in window && window.Backbone && window.Backbone.history ? window.Backbone.history : window.history;
|
|
602
602
|
"pushState" in t && (t.pushState = /* @__PURE__ */ ((e) => function(...n) {
|
|
603
603
|
const s = e.apply(this, n), r = new Event("pushState");
|
|
@@ -609,9 +609,9 @@ function Qt() {
|
|
|
609
609
|
}
|
|
610
610
|
async function he(t, e) {
|
|
611
611
|
const n = Ee();
|
|
612
|
-
t && !e && (window.UserLeap._config.mode =
|
|
612
|
+
t && !e && (window.UserLeap._config.mode = $t);
|
|
613
613
|
const s = _e(F(window.UserLeap)), r = await C(function(i) {
|
|
614
|
-
const o = new URL(R("1", [
|
|
614
|
+
const o = new URL(R("1", [q], "questions"));
|
|
615
615
|
return Object.entries(i || {}).forEach(([a, l]) => {
|
|
616
616
|
l && o.searchParams.append(a, String(l));
|
|
617
617
|
}), o.toString();
|
|
@@ -625,7 +625,7 @@ async function he(t, e) {
|
|
|
625
625
|
dt({ customStyles: l, buttonTheme: c, desktopDisplay: p, eventId: 0, feedbackLabel: i, placement: d, surveyUuid: a, surveyId: t == null ? void 0 : t.surveyId }, r.json);
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function Qt(t) {
|
|
629
629
|
if (!t)
|
|
630
630
|
return;
|
|
631
631
|
window.UserLeap._config = t, t.mute && window.UserLeap._queue.pause();
|
|
@@ -638,9 +638,9 @@ function Yt(t) {
|
|
|
638
638
|
const a = r[i];
|
|
639
639
|
r[i] = r[o], r[o] = a;
|
|
640
640
|
}
|
|
641
|
-
}(e), (e || n || s) && (
|
|
641
|
+
}(e), (e || n || s) && (Jt(), ee());
|
|
642
642
|
}
|
|
643
|
-
const
|
|
643
|
+
const Yt = function(t) {
|
|
644
644
|
if (!window.UserLeap)
|
|
645
645
|
return;
|
|
646
646
|
const e = async (r = {}) => {
|
|
@@ -659,27 +659,27 @@ const Xt = function(t) {
|
|
|
659
659
|
const v = "[Sprig] - Invalid event name " + d;
|
|
660
660
|
return console.warn(v), { success: !1, message: v, surveyState: "no survey" };
|
|
661
661
|
}
|
|
662
|
-
const
|
|
663
|
-
a.url || (a.url =
|
|
664
|
-
const
|
|
665
|
-
if (!
|
|
662
|
+
const m = Z ?? window.location.href;
|
|
663
|
+
a.url || (a.url = m), x("trackStartUrl", m), (h = (U = window.UserLeap) == null ? void 0 : U._config) != null && h.optimizelyEnabled && (ue(F(window.UserLeap)) || ie.getAndSetWebOptimizelyExperiments(), a.optimizelyExperiments = Object.assign({}, ie.getAllOptimizelyExperiments())), (E = (L = window.UserLeap) == null ? void 0 : L._config) != null && E.launchDarklyEnabled && (a.launchDarklyFlags = Ue.getAllLaunchDarklyVariations()), i && (window.UserLeap.userId = i), o && (window.UserLeap.partnerAnonymousId = o), l && (a.eventProperties = l), (O = I.replay) == null || O.RecordEvent({ name: d, url: a.url }), T.info("TrackEvent", { eventName: d });
|
|
664
|
+
const u = window.UserLeap.delayingSurvey || ot() ? await C(R("1", [j], "events/batch"), { body: JSON.stringify({ events: [{ event: d, metadata: a }], previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 }) : await C(R("1", [j], "events"), { body: JSON.stringify({ event: d, metadata: a, previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 });
|
|
665
|
+
if (!u.ok) {
|
|
666
666
|
const v = "[Sprig] (ERR-421) Failed to track event";
|
|
667
|
-
return
|
|
667
|
+
return u.reportError && (console.warn(v, u.error), u.error && window.UserLeap.reportError("track", u.error)), { success: !1, message: v, error: u.error, surveyState: "no survey" };
|
|
668
668
|
}
|
|
669
669
|
i && x("uid", i), o && x("aid", o);
|
|
670
|
-
const
|
|
671
|
-
|
|
670
|
+
const y = u.json;
|
|
671
|
+
y.invalidPreviewKey && D.removeItem("sprig.previewKey");
|
|
672
672
|
const _ = a.trackPageView ? a.url : void 0;
|
|
673
|
-
return
|
|
674
|
-
var
|
|
673
|
+
return y != null && y.feedbackButton && dt(y.feedbackButton, void 0, _), await async function(v, k) {
|
|
674
|
+
var z, K;
|
|
675
675
|
let A = !0;
|
|
676
|
-
return !(k && ((
|
|
677
|
-
}(
|
|
676
|
+
return !(k && ((z = v == null ? void 0 : v.json) != null && z.surveyId) && (window.UserLeap.delayingSurvey = !0, A = await k(v.json.surveyId), window.UserLeap.delayingSurvey = !1, !A)) && ((K = v == null ? void 0 : v.json) != null && K.delay && !window.UserLeap.isMobileSDK && (window.UserLeap.delayingSurvey = !0, await Ze(v.json.delay), window.UserLeap.delayingSurvey = !1), A);
|
|
677
|
+
}(u, c) ? function(v) {
|
|
678
678
|
if (!window.UserLeap._config.dismissOnPageChange)
|
|
679
679
|
return !0;
|
|
680
680
|
const k = new URL(v), A = new URL(Z ?? window.location.href);
|
|
681
681
|
return k.hostname === A.hostname && k.pathname === A.pathname;
|
|
682
|
-
}(
|
|
682
|
+
}(m) ? Y(y, _) : { 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" };
|
|
683
683
|
}, n = (r, i) => {
|
|
684
684
|
var a;
|
|
685
685
|
const o = (a = r == null ? void 0 : r.querySelector(`[id="${xe}"]`)) == null ? void 0 : a.contentDocument;
|
|
@@ -699,7 +699,7 @@ const Xt = function(t) {
|
|
|
699
699
|
}, setVisitorToken() {
|
|
700
700
|
console.warn("[Sprig] setVisitorToken is deprecated.");
|
|
701
701
|
}, dismissActiveSurvey(r = W.API) {
|
|
702
|
-
window.UserLeap.container &&
|
|
702
|
+
window.UserLeap.container && w.emit(g.SurveyWillClose, { name: g.SurveyWillClose, initiator: r, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) });
|
|
703
703
|
}, async setAttribute(r, i) {
|
|
704
704
|
if (!r || !i && i !== 0 && i !== !1) {
|
|
705
705
|
const o = "[Sprig] - Disregarding empty attribute / value provided";
|
|
@@ -734,7 +734,7 @@ const Xt = function(t) {
|
|
|
734
734
|
return { success: !0 };
|
|
735
735
|
const l = {};
|
|
736
736
|
let c;
|
|
737
|
-
return i && (l.userId = window.UserLeap.userId = i), o && (l.partnerAnonymousId = window.UserLeap.partnerAnonymousId = o), a && Object.keys(a).length > 0 ? (c = await C(R("1", [
|
|
737
|
+
return i && (l.userId = window.UserLeap.userId = i), o && (l.partnerAnonymousId = window.UserLeap.partnerAnonymousId = o), a && Object.keys(a).length > 0 ? (c = await C(R("1", [q, j], "attributes"), { body: JSON.stringify(a), method: "PUT" }), c.ok ? Object.assign(pe, a) : c.reportError && (console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed", c.error), c.error && window.UserLeap.reportError("identifyAndSetAttributes", c.error))) : c = await C(R("1", [q, j]), { body: JSON.stringify(l), method: "PUT" }), a && a[J] && (window.UserLeap.email = a[J]), c.ok && (i && x("uid", i), o && x("aid", o)), { success: !!c.ok };
|
|
738
738
|
}, async removeAttributes(r) {
|
|
739
739
|
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig removeAttributes", r), t.mode === "test")
|
|
740
740
|
return;
|
|
@@ -746,18 +746,18 @@ const Xt = function(t) {
|
|
|
746
746
|
const o = "[Sprig] - Skipping tracking without userId";
|
|
747
747
|
return console.warn(o), { success: !1, message: o };
|
|
748
748
|
}
|
|
749
|
-
const i = await C(R("1", [
|
|
749
|
+
const i = await C(R("1", [q, j], "attributes"), { body: JSON.stringify({ delete: r }), method: "DELETE" });
|
|
750
750
|
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 };
|
|
751
751
|
}, async addSurveyListener(r) {
|
|
752
|
-
|
|
752
|
+
w.on(g.SurveyLifeCycle, r);
|
|
753
753
|
}, async removeSurveyListener(r) {
|
|
754
|
-
|
|
754
|
+
w.removeListener(g.SurveyLifeCycle, r);
|
|
755
755
|
}, async addListener(r, i) {
|
|
756
|
-
|
|
756
|
+
w.on(r, i);
|
|
757
757
|
}, async removeListener(r, i) {
|
|
758
|
-
|
|
758
|
+
w.removeListener(r, i);
|
|
759
759
|
}, async removeAllListeners() {
|
|
760
|
-
|
|
760
|
+
w.removeAllListeners();
|
|
761
761
|
}, setPreviewKey(r) {
|
|
762
762
|
r && typeof r == "string" && D.isStorageAvailable && r && D.setItem("sprig.previewKey", r);
|
|
763
763
|
}, async setUserId(r) {
|
|
@@ -769,7 +769,7 @@ const Xt = function(t) {
|
|
|
769
769
|
if (t.mode === "test" || r === window.UserLeap.userId)
|
|
770
770
|
return;
|
|
771
771
|
window.UserLeap.userId = r;
|
|
772
|
-
const i = window.UserLeap.visitorId, o = await C(R("1", [
|
|
772
|
+
const i = window.UserLeap.visitorId, o = await C(R("1", [q, j]), { body: JSON.stringify({ userId: r }), method: "PUT" });
|
|
773
773
|
o.ok ? (i !== window.UserLeap.visitorId && ((a = I.replay) == null || a.clearUserReplayData()), x("uid", r)) : o.reportError && (console.warn("[Sprig] (ERR-420) Failed to set user id", o.error), o.error && window.UserLeap.reportError("setUserId", o.error));
|
|
774
774
|
}, async setPartnerAnonymousId(r) {
|
|
775
775
|
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig setPartnerAnonymousId", r), r == null) {
|
|
@@ -789,7 +789,7 @@ const Xt = function(t) {
|
|
|
789
789
|
if (isNaN(o) || isNaN(a) || (window.UserLeap.windowDimensions = { width: o, height: a }), !window.UserLeap.frameId)
|
|
790
790
|
return;
|
|
791
791
|
const l = document.getElementById(window.UserLeap.frameId);
|
|
792
|
-
l && (window.UserLeap.useMobileStyling && ((c = window.UserLeap.windowDimensions) != null && c.width && (l.style.width = `${window.UserLeap.windowDimensions.width}px`), (d = window.UserLeap.windowDimensions) != null && d.height && (l.style.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px"), l.contentDocument && (l.style.height = String(
|
|
792
|
+
l && (window.UserLeap.useMobileStyling && ((c = window.UserLeap.windowDimensions) != null && c.width && (l.style.width = `${window.UserLeap.windowDimensions.width}px`), (d = window.UserLeap.windowDimensions) != null && d.height && (l.style.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px"), l.contentDocument && (l.style.height = String(Mt(l.contentDocument)[0]) + "px")), w.emit(g.SurveyDimensions, { name: g.SurveyDimensions, contentFrameWidth: l.clientWidth, contentFrameHeight: l.clientHeight, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }));
|
|
793
793
|
}, logoutUser() {
|
|
794
794
|
var r;
|
|
795
795
|
window.UserLeap.debugMode && console.info("[DEBUG] Sprig logout"), T.info("LogOut", { vid: window.UserLeap.visitorId, userId: window.UserLeap.userId }), window.UserLeap.visitorId = null, window.UserLeap.userId = null, window.UserLeap.partnerAnonymousId = null, window.UserLeap.token = null, window.UserLeap.email = null, D.removeItem("userleap.ids"), window.UserLeap._queue.isPaused() && window.UserLeap._queue.empty(), yt(), (r = I.replay) == null || r.clearUserReplayData(), window.UserLeap._queue.unpause();
|
|
@@ -840,19 +840,19 @@ const Xt = function(t) {
|
|
|
840
840
|
} };
|
|
841
841
|
Object.assign(window.UserLeap, s);
|
|
842
842
|
};
|
|
843
|
-
async function
|
|
843
|
+
async function Xt(t, e, n = {}, s = {}) {
|
|
844
844
|
const r = window.__cfg && window.__cfg.mode, i = Ee(), o = window.UserLeap.envId, a = window.document.documentElement, l = { mode: r, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: a.clientWidth, clientHeight: a.clientHeight, location: Z ?? window.location.href, language: window.navigator.language, ...n }, c = { action: t, breadcrumbs: T.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: i, envId: o, ...s };
|
|
845
845
|
(await C(R("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", e);
|
|
846
846
|
}
|
|
847
|
-
function
|
|
847
|
+
function Zt(t = {}) {
|
|
848
848
|
var s;
|
|
849
849
|
(s = window.SprigLoggerCallback) == null || s.call(window, "Initializing Sprig");
|
|
850
850
|
const e = new URLSearchParams(window.location.search).get("sprigPreviewKey") ?? "";
|
|
851
851
|
async function n() {
|
|
852
|
-
var p,
|
|
852
|
+
var p, m, u, y, _;
|
|
853
853
|
if (window.UserLeap.loaded)
|
|
854
854
|
return;
|
|
855
|
-
if ((p = window.SprigLoggerCallback) == null || p.call(window, "Loading Sprig"), window.UserLeap.reportError =
|
|
855
|
+
if ((p = window.SprigLoggerCallback) == null || p.call(window, "Loading Sprig"), window.UserLeap.reportError = Xt, window.UserLeap.loaded = !0, window.UserLeap._config = Object.assign({}, t, window.UserLeap.config), window.UserLeap.delayingSurvey = !1, window.UserLeap._config && typeof window.UserLeap._config == "object")
|
|
856
856
|
for (const b in window.UserLeap._config)
|
|
857
857
|
window.UserLeap[b] = window.UserLeap._config[b];
|
|
858
858
|
if (!window.UserLeap.envId) {
|
|
@@ -870,27 +870,27 @@ function er(t = {}) {
|
|
|
870
870
|
o !== null && x("sampled", null);
|
|
871
871
|
window.UserLeap._API_URL || (window.UserLeap._API_URL = "https://api.sprig.com");
|
|
872
872
|
const a = [...window.UserLeap._queue];
|
|
873
|
-
window.UserLeap._queue = new
|
|
873
|
+
window.UserLeap._queue = new zt(window.UserLeap, []), window.UserLeap._queue.pause();
|
|
874
874
|
for (let b = 0; b < a.length; b++)
|
|
875
875
|
window.UserLeap._queue.push(a[b]);
|
|
876
876
|
const l = r.token;
|
|
877
877
|
l ? (window.UserLeap.token = l, window.UserLeap.visitorId = r.vid ?? null, window.UserLeap.userId = r.uid ?? null, window.UserLeap.partnerAnonymousId = r.aid ?? null) : yt();
|
|
878
878
|
const c = ue(F(window.UserLeap));
|
|
879
|
-
(
|
|
879
|
+
(m = window.SprigLoggerCallback) == null || m.call(window, "Sprig fetching config");
|
|
880
880
|
const d = await async function(b) {
|
|
881
881
|
var E, O;
|
|
882
882
|
const U = F(window.UserLeap);
|
|
883
883
|
document.addEventListener("securitypolicyviolation", Me);
|
|
884
|
-
const h = await Qe(R("1", [
|
|
884
|
+
const h = await Qe(R("1", [q], "config"), { headers: U });
|
|
885
885
|
if (document.removeEventListener("securitypolicyviolation", Me), !h.ok)
|
|
886
|
-
return (E = window.SprigLoggerCallback) == null || E.call(window, "Sprig config fetch failed"), h.reportError && (console.warn("[Sprig] (ERR-422) Failed to load configuration", h.error), h.error && window.UserLeap.reportError("applyRemoteConfig", h.error)),
|
|
886
|
+
return (E = window.SprigLoggerCallback) == null || E.call(window, "Sprig config fetch failed"), h.reportError && (console.warn("[Sprig] (ERR-422) Failed to load configuration", h.error), h.error && window.UserLeap.reportError("applyRemoteConfig", h.error)), qe("Disabled: failed to fetch configuration"), b;
|
|
887
887
|
const L = h.json;
|
|
888
|
-
return L != null && L.disabled ? ((O = window.SprigLoggerCallback) == null || O.call(window, "Sprig config fetch disabled"),
|
|
888
|
+
return L != null && L.disabled ? ((O = window.SprigLoggerCallback) == null || O.call(window, "Sprig config fetch disabled"), qe(`Disabled: ${L.disabled}`), { disabled: L.disabled }) : Object.assign({}, L, b);
|
|
889
889
|
}(t);
|
|
890
|
-
(
|
|
890
|
+
(u = window.SprigLoggerCallback) == null || u.call(window, "Sprig fetched config"), Bt({ isWeb: !c, reportingIntervalSeconds: d.metricsReportingEnabled || d.mobileMetricsReportingEnabled ? d.metricsReportingIntervalSeconds : 0, thresholds: d.metricThresholds, postMetrics: async (b) => {
|
|
891
891
|
var U;
|
|
892
|
-
await C(R("1", [
|
|
893
|
-
} }), await ((
|
|
892
|
+
await C(R("1", [q], "metrics"), { body: b, method: "POST", headers: { "x-ul-replay-enabled": `${!!((U = I.replay) != null && U.isReplayRecording())}` }, shouldDropOnRateLimit: !0 });
|
|
893
|
+
} }), await ((y = I.replay) == null ? void 0 : y.initializeReplay({ maxReplayDurationSeconds: d.maxReplayDurationSeconds, maxInflightRequests: window.UserLeap.maxInflightReplayRequests ?? 2, replaySettings: d.replaySettings })), Yt(d), await Qt(d), window.UserLeap._queue.unpause(), (_ = window.SprigLoggerCallback) == null || _.call(window, "SdkReady"), w.emit(g.SDKReady, { mobileMetricsReportingEnabled: !!d.mobileMetricsReportingEnabled, metricsReportingInterval: d.metricsReportingIntervalSeconds || 0, metricsThresholds: d.metricThresholds || [], maxMobileReplayDurationSeconds: d.maxMobileReplayDurationSeconds, mobileReplaySettings: d.mobileReplaySettings }), w.emit(g.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId }), w.on(g.VisitorIDUpdated, () => {
|
|
894
894
|
for (const b in pe)
|
|
895
895
|
delete pe[b];
|
|
896
896
|
});
|
|
@@ -978,20 +978,20 @@ const Je = { configure: (t) => {
|
|
|
978
978
|
n !== "constructor" && (window.Sprig[n] = ke.prototype[n]);
|
|
979
979
|
});
|
|
980
980
|
const e = window.Sprig;
|
|
981
|
-
return e.appId = t.envId, e._queue = [], window.UserLeap = e,
|
|
981
|
+
return e.appId = t.envId, e._queue = [], window.UserLeap = e, Zt(t), window.Sprig;
|
|
982
982
|
} }, dr = { sprig: Je, SprigAPI: ke, configure: Je.configure };
|
|
983
983
|
export {
|
|
984
984
|
ir as A,
|
|
985
|
-
|
|
986
|
-
|
|
985
|
+
At as C,
|
|
986
|
+
rr as D,
|
|
987
987
|
sr as E,
|
|
988
988
|
ke as S,
|
|
989
|
-
|
|
989
|
+
Mt as a,
|
|
990
990
|
or as b,
|
|
991
991
|
dr as c,
|
|
992
992
|
nr as d,
|
|
993
993
|
ne as e,
|
|
994
|
-
|
|
994
|
+
M as i,
|
|
995
995
|
ar as r,
|
|
996
996
|
Je as s
|
|
997
997
|
};
|