@sprig-technologies/sprig-browser 2.32.1 → 2.32.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core-D-LZZjJw.cjs +12 -0
- package/dist/{core-C4DvxVfT.js → core-DJ-C8ZCy.js} +168 -166
- 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-CWdbAU8e.cjs → metricsReporter-CiE5uf1B.cjs} +1 -1
- package/dist/{metricsReporter-D9j5QNEB.js → metricsReporter-D0VZ2ZgI.js} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/{view-DU1bRQNQ.js → view-CDdG2lXT.js} +11 -13
- package/dist/{view-CQF5DGxW.cjs → view-CW-37QDp.cjs} +2 -2
- package/package.json +1 -1
- package/dist/core-fo3rejWC.cjs +0 -12
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var G = (r, t, n) => (
|
|
4
|
-
import { g as z, s as
|
|
5
|
-
const
|
|
1
|
+
var vt = Object.defineProperty;
|
|
2
|
+
var ht = (r, t, n) => t in r ? vt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[t] = n;
|
|
3
|
+
var G = (r, t, n) => (ht(r, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
+
import { g as z, s as Qe, e as u, S as w, l as C, v as Ye, m as b, b as T, h as bt, E as te, D as V, c as Lt, r as $, i as Ut, j as St, k as It, n as je, o as ze, a as kt, p as Ee, d as Et, q as Xe } from "./metricsReporter-D0VZ2ZgI.js";
|
|
5
|
+
const _t = "360px", Zt = "ul-app", er = "#e6e6e6", tr = "#bd282a", rr = 1030, We = () => {
|
|
6
6
|
try {
|
|
7
7
|
return window.parent.Intercom;
|
|
8
8
|
} catch {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
},
|
|
12
|
-
const r =
|
|
11
|
+
}, Be = [Object.freeze(Object.defineProperty({ __proto__: null, disable: () => {
|
|
12
|
+
const r = We();
|
|
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 = We();
|
|
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 xt {
|
|
19
19
|
static disable() {
|
|
20
|
-
|
|
20
|
+
Be.forEach((t) => t.disable());
|
|
21
21
|
}
|
|
22
22
|
static enable() {
|
|
23
|
-
|
|
23
|
+
Be.forEach((t) => t.enable());
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const Ne = "ul-view-sdk-script", At = ["ios", "android"], F = "visitors", j = "environments";
|
|
27
27
|
async function O(r, t) {
|
|
28
28
|
var i, o, s;
|
|
29
29
|
const { shouldDropOnRateLimit: n, ...a } = t;
|
|
30
30
|
a.headers = Object.assign(z(window.UserLeap), a.headers);
|
|
31
|
-
const e = await
|
|
31
|
+
const e = await Qe(r, { ...a, shouldDropOnRateLimit: n });
|
|
32
32
|
if (e.ok) {
|
|
33
33
|
const d = (i = e.headers) == null ? void 0 : i.get("Authorization"), c = d ? d.split(" ") : void 0, l = c && c.length === 2 ? c[1] : void 0, p = (o = e.headers) == null ? void 0 : o.get("x-ul-visitor-id");
|
|
34
34
|
l && p && (p !== window.UserLeap.visitorId || window.UserLeap.token !== l) && (E("token", l), E("vid", p), u.emit(w.VisitorIDUpdated, { visitorId: p }), window.UserLeap.token = l, window.UserLeap.visitorId = p);
|
|
@@ -52,21 +52,21 @@ function E(r, t) {
|
|
|
52
52
|
i instanceof Error && console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${i.message}`);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function _e() {
|
|
56
56
|
return window.previewMode ? "0" : window.UserLeap.visitorId ?? "";
|
|
57
57
|
}
|
|
58
58
|
function D(r, t, n) {
|
|
59
59
|
const a = [window.UserLeap._API_URL, "sdk", r];
|
|
60
60
|
return t && t.forEach((e) => {
|
|
61
|
-
a.push(e), e === j ? a.push(window.UserLeap.envId) : e === F && a.push(
|
|
61
|
+
a.push(e), e === j ? a.push(window.UserLeap.envId) : e === F && a.push(_e());
|
|
62
62
|
}), n && a.push(n), a.join("/");
|
|
63
63
|
}
|
|
64
64
|
const X = async (r, t) => {
|
|
65
|
-
var
|
|
66
|
-
const { context: n, delay: a, forceBrandedLogo: e, endCard: i, isFeedback: o = !1, heatmap: s, locale: d, previewMode: c, productConfig: l, questions: p, responseGroupUid: y, surveyId: g, uuid: m, vid: _, sessionReplay: M, studyType: S } = r, L = z(window.UserLeap), I = ue(L), k =
|
|
65
|
+
var Ce, Te, Me;
|
|
66
|
+
const { context: n, delay: a, forceBrandedLogo: e, endCard: i, isFeedback: o = !1, heatmap: s, locale: d, previewMode: c, productConfig: l, questions: p, responseGroupUid: y, surveyId: g, uuid: m, vid: _, sessionReplay: M, studyType: S } = r, L = z(window.UserLeap), I = ue(L), k = xe(L);
|
|
67
67
|
if (M)
|
|
68
68
|
if (I)
|
|
69
|
-
u.emit(w.ReplayCapture, { responseGroupUid: y, hasQuestions: !!(p != null && p.length), surveyId: g, uploadId: M.uploadId, replayType: M.replayDurationType ?? "before", seconds: M.replayDurationSeconds, generateVideoUploadUrlPayload: { mediaRecordingUid:
|
|
69
|
+
u.emit(w.ReplayCapture, { responseGroupUid: y, hasQuestions: !!(p != null && p.length), surveyId: g, uploadId: M.uploadId, replayType: M.replayDurationType ?? "before", seconds: M.replayDurationSeconds, generateVideoUploadUrlPayload: { mediaRecordingUid: Ye(), mediaType: "screen", questionId: 1, responseGroupUid: y, surveyId: g, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), visitorId: window.UserLeap.visitorId, isReplay: !0 } });
|
|
70
70
|
else {
|
|
71
71
|
if (!b.replay)
|
|
72
72
|
return window.UserLeap.reportError("displayQuestions", new Error("Replay module not registered")), { success: !1, message: "Replay module not registered", surveyState: "no survey" };
|
|
@@ -75,10 +75,10 @@ const X = async (r, t) => {
|
|
|
75
75
|
if (s) {
|
|
76
76
|
if (!b.replay)
|
|
77
77
|
return window.UserLeap.reportError("displayQuestions", new Error("Replay module not registered")), { success: !1, message: "Replay module not registered", surveyState: "no survey" };
|
|
78
|
-
const { eventId: h, replayParams: ge, responseGroupUid:
|
|
78
|
+
const { eventId: h, replayParams: ge, responseGroupUid: yt, surveyId: ft } = s;
|
|
79
79
|
await b.replay.initializeReplay({ maxReplayDurationSeconds: 300, maxInflightRequests: window.UserLeap.maxInflightReplayRequests, teardownAfter: !0 }), b.replay.tryReplayAction(() => {
|
|
80
|
-
var
|
|
81
|
-
return (
|
|
80
|
+
var Fe;
|
|
81
|
+
return (Fe = b.replay) == null ? void 0 : Fe.scheduleCapture({ apiUrl: window.UserLeap._API_URL, completeUploadHeaders: L, eventId: h, isHeatmap: !0, replayParams: ge, responseGroupId: yt, surveyId: ft, triggerTimestamp: Date.now(), visitorId: _ });
|
|
82
82
|
}, "Error in scheduling/capturing replay");
|
|
83
83
|
}
|
|
84
84
|
if (_ == null || !(p != null && p.length))
|
|
@@ -92,41 +92,41 @@ const X = async (r, t) => {
|
|
|
92
92
|
const h = "Attempted to display survey to a different visitor";
|
|
93
93
|
return window.UserLeap.reportError("DisplaySurvey", new Error(h)), { success: !1, message: h, surveyState: "no survey" };
|
|
94
94
|
}
|
|
95
|
-
T.info("ShowingSurvey", { surveyId: g }), (
|
|
95
|
+
T.info("ShowingSurvey", { surveyId: g }), (Ce = b.replay) == null || Ce.RecordSurveyShown({ id: g, userAgent: window.navigator.userAgent }), xt.disable(), u.emit(w.SurveyWillPresent, { name: w.SurveyWillPresent, "survey.id": g });
|
|
96
96
|
let W, v, U, x, A = document.createElement("div");
|
|
97
97
|
const B = (h) => {
|
|
98
98
|
const { "view.version": ge } = h;
|
|
99
|
-
ge !== L["x-ul-sdk-version"] &&
|
|
99
|
+
ge !== L["x-ul-sdk-version"] && et(), u.removeListener("verify.view.version", B);
|
|
100
100
|
};
|
|
101
|
-
u.on("verify.view.version", B), window.UserLeap.useMobileStyling = k,
|
|
101
|
+
u.on("verify.view.version", B), window.UserLeap.useMobileStyling = k, bt(L) ? (W = "ul-direct-embeded-frame", v = document.head, U = window, x = !1, I && (Ze(g, o), A.id = W, window.UserLeap.container.appendChild(A), tt(), u.emit(w.SurveyLifeCycle, { state: "presented" }), u.emit(w.SurveyPresented, { name: w.SurveyPresented, "survey.id": g }))) : { frameId: W, contentWinDocHead: v, contentWindow: U, hasOverlay: x, iframe: A } = Rt({ productConfig: l, useMobileStyling: k, surveyId: g, isFeedback: o }), window.UserLeap.frameId = W;
|
|
102
102
|
const R = { apiURL: window.UserLeap._API_URL, cards: p, configureExitOnOverlayClick: (h) => {
|
|
103
103
|
u.once(w.CloseSurveyOnOverlayClick, h);
|
|
104
|
-
}, context: n, endCard: i, envId: window.UserLeap.envId, eventEmitFn: u.emit.bind(u), fontFamily: window.UserLeap.fontFamily, fontFamilyURL: window.UserLeap.fontFamilyURL, forceBrandedLogo: e, frame: A, headers: L, locale: d, mobileSDKVersion: window.UserLeap.mobileSDKVersion, previewKey: C.getItem("sprig.previewKey"), previewMode: c, productConfig: { framePosition: l == null ? void 0 : l.framePosition, desktopDisplay: l == null ? void 0 : l.desktopDisplay, placement: l == null ? void 0 : l.placement }, responseGroupUid: y, startingQuestionIdx: (
|
|
105
|
-
(
|
|
104
|
+
}, context: n, endCard: i, envId: window.UserLeap.envId, eventEmitFn: u.emit.bind(u), fontFamily: window.UserLeap.fontFamily, fontFamilyURL: window.UserLeap.fontFamilyURL, forceBrandedLogo: e, frame: A, headers: L, locale: d, mobileSDKVersion: window.UserLeap.mobileSDKVersion, previewKey: C.getItem("sprig.previewKey"), previewMode: c, productConfig: { framePosition: l == null ? void 0 : l.framePosition, desktopDisplay: l == null ? void 0 : l.desktopDisplay, placement: l == null ? void 0 : l.placement }, responseGroupUid: y, startingQuestionIdx: (Te = window.UserLeap.config) == null ? void 0 : Te.startingQuestionIdx, studyType: S, styleNonce: window.UserLeap.styleNonce, surveyId: g, tabTitle: document.title, trackPageViewUrl: t, ulEvents: te, upchunkLibraryURL: window.UserLeap.upchunkLibraryURL, useMobileStyling: k, userId: m, viewDocument: U == null ? void 0 : U.document, viewWindow: U, visitorAttributes: { externalUserId: window.UserLeap.userId, email: window.UserLeap.email }, ...window.UserLeap._config };
|
|
105
|
+
(Me = window.UserLeap._config) != null && Me.startingQuestionIdx && (window.UserLeap._config = { ...window.UserLeap._config, startingQuestionIdx: null });
|
|
106
106
|
const re = (o ? window.UserLeap.feedbackCustomStyles : window.UserLeap.customStyles) ?? l.customStyles;
|
|
107
107
|
R.customStyles = re, U && (U.__cfg = R);
|
|
108
|
-
const J = window.UserLeap.viewSDKURL ? window.UserLeap.viewSDKURL : R.path,
|
|
109
|
-
|
|
108
|
+
const J = window.UserLeap.viewSDKURL ? window.UserLeap.viewSDKURL : R.path, Re = document.getElementById(Ne);
|
|
109
|
+
Re && Re.remove();
|
|
110
110
|
const we = function() {
|
|
111
111
|
const h = document.createElement("script");
|
|
112
|
-
return window.UserLeap.nonce && h.setAttribute("nonce", window.UserLeap.nonce), h.id =
|
|
113
|
-
}(),
|
|
112
|
+
return window.UserLeap.nonce && h.setAttribute("nonce", window.UserLeap.nonce), h.id = Ne, h;
|
|
113
|
+
}(), Oe = () => {
|
|
114
114
|
window.UserLeap.container && Object.assign(window.UserLeap.container.style, { display: "flex" });
|
|
115
115
|
};
|
|
116
116
|
if (R.installationMethod === "web-npm" || R.installationMethod === "web-npm-bundled") {
|
|
117
|
-
const { default: h } = await import("./view-
|
|
118
|
-
h.configure(R), x && window.UserLeap.container &&
|
|
117
|
+
const { default: h } = await import("./view-CDdG2lXT.js");
|
|
118
|
+
h.configure(R), x && window.UserLeap.container && Oe();
|
|
119
119
|
} else
|
|
120
120
|
J && (we.src = J, x && we.addEventListener("load", () => {
|
|
121
|
-
window.UserLeap.container &&
|
|
121
|
+
window.UserLeap.container && Oe();
|
|
122
122
|
}), U == null || U.addEventListener("error", (h) => {
|
|
123
123
|
h.target instanceof HTMLScriptElement && h.target.src === J && window.UserLeap.reportError("loadFrameScript", new Error("Frame script failed to load"));
|
|
124
124
|
}, { capture: !0, once: !0 }));
|
|
125
125
|
v == null || v.appendChild(we);
|
|
126
|
-
const
|
|
127
|
-
return window.UserLeap.isMobileSDK && a && (
|
|
126
|
+
const Pe = { success: !0, surveyState: "ready", surveyId: g, responseGroupUid: y };
|
|
127
|
+
return window.UserLeap.isMobileSDK && a && (Pe.delay = a), Pe;
|
|
128
128
|
};
|
|
129
|
-
function
|
|
129
|
+
function xe(r) {
|
|
130
130
|
var n;
|
|
131
131
|
if (window.UserLeap.useMobileStyling !== void 0)
|
|
132
132
|
return window.UserLeap.useMobileStyling;
|
|
@@ -134,17 +134,17 @@ function _e(r) {
|
|
|
134
134
|
return ue(r) || t > 10 && t < 500;
|
|
135
135
|
}
|
|
136
136
|
function ue(r) {
|
|
137
|
-
return
|
|
137
|
+
return At.includes(r["userleap-platform"]);
|
|
138
138
|
}
|
|
139
|
-
const
|
|
139
|
+
const Ae = "ul-frame";
|
|
140
140
|
window.UserLeap && window.Sprig && (window.Sprig._gtm ? window.Sprig = window.UserLeap : window.UserLeap = window.Sprig), window.UserLeap || (window.UserLeap = window.Sprig), window.Sprig || (window.Sprig = window.UserLeap);
|
|
141
|
-
const me = "0px",
|
|
141
|
+
const me = "0px", Ze = (r, t, n) => {
|
|
142
142
|
window.UserLeap.container = document.createElement("div"), window.UserLeap.container.className = "ul-container" + (t ? " ul-container-feedback" : ""), r && (window.UserLeap.container.dataset.studyId = r.toString());
|
|
143
|
-
const a =
|
|
143
|
+
const a = it();
|
|
144
144
|
n && a && !window.UserLeap.useMobileStyling ? a.appendChild(window.UserLeap.container) : document.body.appendChild(window.UserLeap.container);
|
|
145
|
-
},
|
|
145
|
+
}, et = (r, t) => {
|
|
146
146
|
var a;
|
|
147
|
-
|
|
147
|
+
Pt();
|
|
148
148
|
const n = window.UserLeap.container;
|
|
149
149
|
if (n)
|
|
150
150
|
try {
|
|
@@ -152,11 +152,11 @@ const me = "0px", Xe = (r, t, n) => {
|
|
|
152
152
|
} catch (e) {
|
|
153
153
|
console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${r} ` + n), e instanceof Error && window.UserLeap.reportError("dismissActiveSurvey", e);
|
|
154
154
|
}
|
|
155
|
-
},
|
|
155
|
+
}, tt = () => {
|
|
156
156
|
u.once(w.SurveyWillClose, ({ initiator: r, studyType: t }) => {
|
|
157
|
-
u.removeAllListeners(w.CloseSurveyOnOverlayClick),
|
|
157
|
+
u.removeAllListeners(w.CloseSurveyOnOverlayClick), et(r, t);
|
|
158
158
|
});
|
|
159
|
-
},
|
|
159
|
+
}, Dt = (r, t, n, a) => {
|
|
160
160
|
var l, p;
|
|
161
161
|
const e = { position: "fixed", bottom: "0px", right: me, border: 0, backgroundColor: "rgba(0,0,0,0)", zIndex: 2147483646, transition: "width 0.2s ease-in-out, height 0.2s ease-in-out", maxWidth: "100%" }, i = Object.assign({}, t, window.UserLeap), { desktopDisplay: o } = t || {}, s = o === "center-modal";
|
|
162
162
|
let d;
|
|
@@ -165,7 +165,7 @@ const me = "0px", Xe = (r, t, n) => {
|
|
|
165
165
|
if (n)
|
|
166
166
|
(l = window.UserLeap.windowDimensions) != null && l.width ? e.width = `${window.UserLeap.windowDimensions.width}px` : e.width = "100%", (p = window.UserLeap.windowDimensions) != null && p.height ? e.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px" : window.UserLeap.maxHeight ? e.maxHeight = window.UserLeap.maxHeight : e.maxHeight = document.body.clientHeight - 20 + "px", ["light", "dark"].includes(i.overlayStyleMobile) && (c = !0);
|
|
167
167
|
else {
|
|
168
|
-
e.width =
|
|
168
|
+
e.width = _t, e.maxHeight = window.UserLeap.maxHeight || "66vh";
|
|
169
169
|
const y = () => {
|
|
170
170
|
c = !0, d = { margin: "auto", position: "static" };
|
|
171
171
|
};
|
|
@@ -190,14 +190,14 @@ const me = "0px", Xe = (r, t, n) => {
|
|
|
190
190
|
const m = { position: "fixed", overflow: "auto", top: "0px", left: "0px", display: "none", height: "100%", width: "100%", transition: "background-color 0.3s ease-out", zIndex: 2147483646 }, _ = g ? y.overlayStyleMobile : y.overlayStyle;
|
|
191
191
|
m["background-color"] = _ === "light" ? "rgba(255,255,255, 0.95)" : "rgba(0,0,0,0.9)", g || (m.margin = "auto"), window.UserLeap.container && Object.assign(window.UserLeap.container.style, m);
|
|
192
192
|
})(i, n), Object.assign(r.style, e, d), c;
|
|
193
|
-
},
|
|
193
|
+
}, Rt = ({ productConfig: r, useMobileStyling: t, surveyId: n, isFeedback: a }) => {
|
|
194
194
|
var y, g;
|
|
195
|
-
const e =
|
|
196
|
-
|
|
195
|
+
const e = Ae, i = a && r.desktopDisplay === "slider";
|
|
196
|
+
Ze(n, a, i), Ot();
|
|
197
197
|
const o = document.createElement("iframe");
|
|
198
198
|
o.id = e, o.setAttribute("title", "Sprig User Feedback Dialog");
|
|
199
|
-
const s =
|
|
200
|
-
|
|
199
|
+
const s = Dt(o, r, t, a);
|
|
200
|
+
tt();
|
|
201
201
|
let d = !1;
|
|
202
202
|
o.setHeight = (m) => {
|
|
203
203
|
parseInt(o.style.height) == m && d || (d = !0, o.style.height = `${m}px`, u.emit(w.SurveyHeight, { name: w.SurveyHeight, contentFrameHeight: m, "survey.id": n }));
|
|
@@ -215,23 +215,23 @@ const me = "0px", Xe = (r, t, n) => {
|
|
|
215
215
|
}
|
|
216
216
|
const p = l == null ? void 0 : l.head;
|
|
217
217
|
return { frameId: e, contentWinDocHead: p, contentWindow: o.contentWindow, hasOverlay: s, iframe: o };
|
|
218
|
-
},
|
|
218
|
+
}, rt = { [w.SurveyFadingOut]: () => {
|
|
219
219
|
window.UserLeap.container && Object.assign(window.UserLeap.container.style, { "background-color": "rgba(0,0,0,0)" });
|
|
220
|
-
} },
|
|
221
|
-
Object.entries(
|
|
220
|
+
} }, Ot = () => {
|
|
221
|
+
Object.entries(rt).forEach(([r, t]) => {
|
|
222
222
|
u.on(r, t);
|
|
223
223
|
});
|
|
224
|
-
},
|
|
225
|
-
Object.entries(
|
|
224
|
+
}, Pt = () => {
|
|
225
|
+
Object.entries(rt).forEach(([r, t]) => {
|
|
226
226
|
u.off(r, t);
|
|
227
227
|
});
|
|
228
|
-
},
|
|
228
|
+
}, qe = (r) => r instanceof HTMLElement || r instanceof SVGElement, oe = ({ document: r, elementId: t, styleString: n, nonce: a }) => {
|
|
229
229
|
const e = r.getElementById(t);
|
|
230
230
|
if (e)
|
|
231
231
|
return void (e.textContent = n);
|
|
232
232
|
const i = r.createElement("style");
|
|
233
233
|
a && (i.nonce = a), i.textContent = n, i.id = t, r.head.appendChild(i);
|
|
234
|
-
},
|
|
234
|
+
}, Ct = (r) => {
|
|
235
235
|
const t = r.querySelector(".ul-card__container");
|
|
236
236
|
let n = 600, a = 360;
|
|
237
237
|
if (t) {
|
|
@@ -244,16 +244,16 @@ const me = "0px", Xe = (r, t, n) => {
|
|
|
244
244
|
a += parseFloat(e.marginLeft) + parseFloat(e.marginRight) + (parseFloat(e.borderLeftWidth) + parseFloat(e.borderRightWidth)) + o;
|
|
245
245
|
}
|
|
246
246
|
return [n + 1, a];
|
|
247
|
-
},
|
|
247
|
+
}, ir = (r) => {
|
|
248
248
|
const t = r.querySelector(".ul-card__container");
|
|
249
249
|
t && (t.scrollTop = 0);
|
|
250
|
-
},
|
|
251
|
-
let
|
|
252
|
-
const
|
|
250
|
+
}, it = () => f, K = () => document.getElementById("sprig-feedback-container"), he = () => document.getElementById("sprig-feedback-loading-animation"), nt = () => !!document.getElementById(Ae);
|
|
251
|
+
let Ve = !1, f = null, P = null, De = !1, Z = null, N = null;
|
|
252
|
+
const Tt = ["bottom-left", "bottom-right", "center-left", "center-right"], se = () => {
|
|
253
253
|
var t;
|
|
254
254
|
const r = window.UserLeap.container;
|
|
255
255
|
return ((t = r == null ? void 0 : r.parentElement) == null ? void 0 : t.id) === "sprig-feedback-loading-container";
|
|
256
|
-
},
|
|
256
|
+
}, ot = () => document.getElementById("sprig-feedback-error-container"), st = () => {
|
|
257
257
|
if (!f)
|
|
258
258
|
return 0;
|
|
259
259
|
const r = f == null ? void 0 : f.clientWidth, t = window.getComputedStyle(f);
|
|
@@ -262,9 +262,9 @@ const Ct = ["bottom-left", "bottom-right", "center-left", "center-right"], se =
|
|
|
262
262
|
const t = K();
|
|
263
263
|
t && (N != null && N.endsWith("right") ? t.style.right = `${r}px` : N != null && N.endsWith("left") && (t.style.left = `${r}px`));
|
|
264
264
|
}, ye = () => {
|
|
265
|
-
if (f && (se() ||
|
|
265
|
+
if (f && (se() || ot())) {
|
|
266
266
|
u.off(w.SurveyAppeared, Y), be();
|
|
267
|
-
const r =
|
|
267
|
+
const r = st();
|
|
268
268
|
return ae(-r), !0;
|
|
269
269
|
}
|
|
270
270
|
return !1;
|
|
@@ -272,7 +272,7 @@ const Ct = ["bottom-left", "bottom-right", "center-left", "center-right"], se =
|
|
|
272
272
|
if (!f || !P)
|
|
273
273
|
return;
|
|
274
274
|
const r = he();
|
|
275
|
-
r && r.remove(), f.style.height = "auto", f.style.width = "auto", P.disabled = !1,
|
|
275
|
+
r && r.remove(), f.style.height = "auto", f.style.width = "auto", P.disabled = !1, De = !1;
|
|
276
276
|
}, be = () => {
|
|
277
277
|
if (f && !he()) {
|
|
278
278
|
const r = (() => {
|
|
@@ -290,9 +290,9 @@ const Ct = ["bottom-left", "bottom-right", "center-left", "center-right"], se =
|
|
|
290
290
|
})();
|
|
291
291
|
r && (f.style.height = "300px", f.style.width = "360px", f.appendChild(r));
|
|
292
292
|
}
|
|
293
|
-
},
|
|
294
|
-
f && P && (ae(0), P.disabled = !0,
|
|
295
|
-
},
|
|
293
|
+
}, He = () => {
|
|
294
|
+
f && P && (ae(0), P.disabled = !0, De = !0);
|
|
295
|
+
}, at = async (r, t, n) => {
|
|
296
296
|
const { buttonTheme: a, customStyles: e, eventId: i, placement: o, desktopDisplay: s, feedbackLabel: d, surveyUuid: c, surveyId: l } = r;
|
|
297
297
|
window.UserLeap.feedbackCustomStyles = void 0;
|
|
298
298
|
let p = K();
|
|
@@ -301,10 +301,10 @@ const Ct = ["bottom-left", "bottom-right", "center-left", "center-right"], se =
|
|
|
301
301
|
return;
|
|
302
302
|
p.remove(), u.off(te.SURVEY_FADING_OUT, ye);
|
|
303
303
|
}
|
|
304
|
-
Z = i, oe({ document, elementId: "sprig-feedback-style", styleString: '.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.fade-in-transition{animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}#sprig-feedback-button{border-left:0;border-radius:0 8px 8px 0;display:grid;padding:8px;text-align:center;transition:all ease-in-out 1s;z-index:inherit}#sprig-feedback-button:hover{cursor:pointer}.sprig-feedback-button-label{writing-mode:vertical-lr;text-orientation:sideways}.sprig-feedback-button-right{transform:rotate(180deg)}.sprig-feedback-button-bottom{align-self:flex-end;margin-bottom:20px}.sprig-feedback-button-light{background:#efefee;color:#000;border:1px solid #e2e3e1}.sprig-feedback-button-dark{background:#000;color:#fff;border:1px solid #000000}#sprig-feedback-container{display:flex;align-items:center;position:fixed;transition:right .2s linear,left .2s linear;z-index:2147483646}.sprig-feedback-container-left{flex-flow:row-reverse}.sprig-feedback-container-center{top:50%;transform:translateY(-50%)}.sprig-feedback-container-bottom{bottom:0%;margin-bottom:15px}.sprig-feedback-loading-container{align-items:center;background-color:#fff;border:2px solid var(--feedback-border);display:flex;max-height:90vh;max-width:90vw;min-width:0px}.sprig-feedback-loading-container-left{border-left:none;border-radius:0 8px 8px 0}.sprig-feedback-loading-container-right{border-right:none;border-radius:8px 0 0 8px}#sprig-feedback-error-container{margin:auto;text-align:center;width:360px}.sprig-feedback-error-text{font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol}#sprig-feedback-loading-container .ul-container{position:relative;max-height:inherit}#sprig-feedback-loading-animation{position:absolute}.sprig-feedback-loading-container-previews iframe{max-height:inherit!important}', nonce: window.UserLeap.styleNonce }), oe({ document, elementId: "ul-custom-style", styleString: e ?? "", nonce: window.UserLeap.styleNonce }),
|
|
304
|
+
Z = i, oe({ document, elementId: "sprig-feedback-style", styleString: '.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.fade-in-transition{animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}#sprig-feedback-button{border-left:0;border-radius:0 8px 8px 0;display:grid;padding:8px;text-align:center;transition:all ease-in-out 1s;z-index:inherit}#sprig-feedback-button:hover{cursor:pointer}.sprig-feedback-button-label{writing-mode:vertical-lr;text-orientation:sideways}.sprig-feedback-button-right{transform:rotate(180deg)}.sprig-feedback-button-bottom{align-self:flex-end;margin-bottom:20px}.sprig-feedback-button-light{background:#efefee;color:#000;border:1px solid #e2e3e1}.sprig-feedback-button-dark{background:#000;color:#fff;border:1px solid #000000}#sprig-feedback-container{display:flex;align-items:center;position:fixed;transition:right .2s linear,left .2s linear;z-index:2147483646}.sprig-feedback-container-left{flex-flow:row-reverse}.sprig-feedback-container-center{top:50%;transform:translateY(-50%)}.sprig-feedback-container-bottom{bottom:0%;margin-bottom:15px}.sprig-feedback-loading-container{align-items:center;background-color:#fff;border:2px solid var(--feedback-border);display:flex;max-height:90vh;max-width:90vw;min-width:0px}.sprig-feedback-loading-container-left{border-left:none;border-radius:0 8px 8px 0}.sprig-feedback-loading-container-right{border-right:none;border-radius:8px 0 0 8px}#sprig-feedback-error-container{margin:auto;text-align:center;width:360px}.sprig-feedback-error-text{font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol}#sprig-feedback-loading-container .ul-container{position:relative;max-height:inherit}#sprig-feedback-loading-animation{position:absolute}.sprig-feedback-loading-container-previews iframe{max-height:inherit!important}', nonce: window.UserLeap.styleNonce }), oe({ document, elementId: "ul-custom-style", styleString: e ?? "", nonce: window.UserLeap.styleNonce }), Ve = s === "center-modal", N = o;
|
|
305
305
|
const [y, g] = o.split("-");
|
|
306
306
|
((S) => {
|
|
307
|
-
if (K() || !
|
|
307
|
+
if (K() || !Tt.includes(S))
|
|
308
308
|
return;
|
|
309
309
|
const [L, I] = S.split("-"), k = document.createElement("div");
|
|
310
310
|
k.id = "sprig-feedback-container", k.classList.add(`sprig-feedback-container-${I}`, `sprig-feedback-container-${L}`), document.body.appendChild(k);
|
|
@@ -312,7 +312,7 @@ const Ct = ["bottom-left", "bottom-right", "center-left", "center-right"], se =
|
|
|
312
312
|
const m = document.createElement("div");
|
|
313
313
|
m.className = "sprig-feedback-button-label", m.innerText = d, P.appendChild(m), P.id = "sprig-feedback-button", P.classList.add(`sprig-feedback-button-${g}`, `sprig-feedback-button-${y}`, `sprig-feedback-button-${a}`, "fade-in-transition"), u.on(te.SURVEY_FADING_OUT, ye), P.addEventListener("click", async () => {
|
|
314
314
|
const S = document.getElementById("sprig-feedback-error-container");
|
|
315
|
-
if (
|
|
315
|
+
if (nt() || ot()) {
|
|
316
316
|
if (ye()) {
|
|
317
317
|
u.emit(w.SurveyWillClose, { name: w.SurveyWillClose, initiator: V.FeedbackClosed, studyType: "feedbackButton", "survey.id": l });
|
|
318
318
|
const I = K();
|
|
@@ -320,7 +320,7 @@ const Ct = ["bottom-left", "bottom-right", "center-left", "center-right"], se =
|
|
|
320
320
|
}
|
|
321
321
|
return;
|
|
322
322
|
}
|
|
323
|
-
if (
|
|
323
|
+
if (xe(z(window.UserLeap)) || De || He(), t)
|
|
324
324
|
return f && f.classList.add("sprig-feedback-loading-container-previews"), await X(t), void Y();
|
|
325
325
|
const L = await (async (I) => {
|
|
326
326
|
const k = await O(D("1", [F], "startFeedbackStudy"), { body: JSON.stringify({ surveyUuid: I }), method: "POST" });
|
|
@@ -329,21 +329,21 @@ const Ct = ["bottom-left", "bottom-right", "center-left", "center-right"], se =
|
|
|
329
329
|
if (L)
|
|
330
330
|
u.once(w.SurveyAppeared, Y), X({ ...L, studyType: "feedbackButton" }, n);
|
|
331
331
|
else if (f) {
|
|
332
|
-
const I =
|
|
332
|
+
const I = Mt();
|
|
333
333
|
f.appendChild(I), Y(), f.style.height = "300px", f.style.width = "360px";
|
|
334
334
|
}
|
|
335
335
|
}), p == null || p.appendChild(P), u.emit(w.FeedbackButtonLoaded, { name: w.FeedbackButtonLoaded, "survey.id": l });
|
|
336
336
|
const { useMobileStyling: _, _config: { border: M } } = window.UserLeap;
|
|
337
|
-
if (
|
|
337
|
+
if (Ve || _)
|
|
338
338
|
ae(0);
|
|
339
339
|
else {
|
|
340
340
|
const S = document.createElement("div");
|
|
341
341
|
S.id = "sprig-feedback-loading-container", S.className = `sprig-feedback-loading-container sprig-feedback-loading-container-${g}`, S.style.setProperty("--feedback-border", M), f = S, be(), p == null || p.appendChild(S);
|
|
342
|
-
const L =
|
|
342
|
+
const L = st();
|
|
343
343
|
ae(-L);
|
|
344
344
|
}
|
|
345
|
-
window.UserLeap._config.isOnQuestionsTab && t && !se() && f && (
|
|
346
|
-
},
|
|
345
|
+
window.UserLeap._config.isOnQuestionsTab && t && !se() && f && (He(), be(), f && f.classList.add("sprig-feedback-loading-container-previews"), X(t), Y());
|
|
346
|
+
}, Mt = () => {
|
|
347
347
|
const r = document.createElement("div");
|
|
348
348
|
r.id = "sprig-feedback-error-container", r.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
|
|
349
349
|
<circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
|
|
@@ -419,7 +419,7 @@ const ne = new class {
|
|
|
419
419
|
}
|
|
420
420
|
}();
|
|
421
421
|
Object.freeze(ne);
|
|
422
|
-
class
|
|
422
|
+
class Ft {
|
|
423
423
|
constructor(t, n) {
|
|
424
424
|
G(this, "paused");
|
|
425
425
|
G(this, "queue");
|
|
@@ -470,14 +470,14 @@ class Mt {
|
|
|
470
470
|
this.queue.length = 0;
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
|
-
let
|
|
473
|
+
let dt, lt;
|
|
474
474
|
const Ue = (r) => {
|
|
475
475
|
let t = 0, n = r.firstElementChild;
|
|
476
476
|
for (; n; )
|
|
477
477
|
t += Ue(n), n.shadowRoot && (t += Ue(n.shadowRoot)), n = n.nextElementSibling, t++;
|
|
478
478
|
return t;
|
|
479
|
-
},
|
|
480
|
-
|
|
479
|
+
}, $e = () => {
|
|
480
|
+
dt.report(Ue(document.body)), lt.report(document.documentElement.innerHTML.length);
|
|
481
481
|
}, Se = (r, t) => {
|
|
482
482
|
const n = performance.now();
|
|
483
483
|
document.hidden ? setTimeout(() => Se(r, t), r) : setTimeout(() => {
|
|
@@ -485,47 +485,49 @@ const Ue = (r) => {
|
|
|
485
485
|
t.report(a / 1e3), setTimeout(() => Se(r, t), r);
|
|
486
486
|
}, 0);
|
|
487
487
|
};
|
|
488
|
-
let de, le, ce, pe,
|
|
488
|
+
let de, le, ce, pe, Ge, H = {};
|
|
489
489
|
const ie = (r, t = 1) => {
|
|
490
490
|
const { name: n } = r;
|
|
491
491
|
H[n] = (H[n] || 0) + t;
|
|
492
|
-
},
|
|
492
|
+
}, ct = (r) => {
|
|
493
493
|
let t = 1;
|
|
494
494
|
return r.childNodes.forEach((n) => {
|
|
495
|
-
t +=
|
|
495
|
+
t += ct(n);
|
|
496
496
|
}), t;
|
|
497
|
-
},
|
|
497
|
+
}, Ke = (r) => {
|
|
498
498
|
let t = 0;
|
|
499
499
|
return r.forEach((n) => {
|
|
500
|
-
t +=
|
|
500
|
+
t += ct(n);
|
|
501
501
|
}), t;
|
|
502
|
-
},
|
|
502
|
+
}, jt = (r) => {
|
|
503
503
|
switch (r.type) {
|
|
504
504
|
case "childList":
|
|
505
|
-
return ie(de,
|
|
505
|
+
return ie(de, Ke(r.addedNodes)), void ie(le, Ke(r.removedNodes));
|
|
506
506
|
case "attributes":
|
|
507
507
|
return void ie(ce);
|
|
508
508
|
case "characterData":
|
|
509
509
|
return void ie(pe);
|
|
510
510
|
}
|
|
511
|
-
},
|
|
511
|
+
}, zt = (r) => r.forEach(jt), Wt = () => {
|
|
512
512
|
de.report(H[de.name] || 0), le.report(H[le.name] || 0), ce.report(H[ce.name] || 0), pe.report(H[pe.name] || 0), H = {};
|
|
513
|
-
},
|
|
514
|
-
de = $("sdk_mutations_nodes_added"), le = $("sdk_mutations_nodes_removed"), ce = $("sdk_mutations_attributes_changed"), pe = $("sdk_mutations_character_data"),
|
|
515
|
-
},
|
|
516
|
-
|
|
513
|
+
}, Bt = (r = 1e3) => {
|
|
514
|
+
de = $("sdk_mutations_nodes_added"), le = $("sdk_mutations_nodes_removed"), ce = $("sdk_mutations_attributes_changed"), pe = $("sdk_mutations_character_data"), Ge = new MutationObserver(zt), Ge.observe(document, { attributes: !0, attributeOldValue: !0, characterData: !0, characterDataOldValue: !0, childList: !0, subtree: !0 }), setInterval(Wt, r);
|
|
515
|
+
}, Nt = ({ isWeb: r, reportingIntervalSeconds: t, thresholds: n, postMetrics: a }) => {
|
|
516
|
+
Ut(n, (e, i) => {
|
|
517
517
|
var o, s;
|
|
518
518
|
if ((o = b.replay) != null && o.isReplayRecording()) {
|
|
519
519
|
const d = `Value: ${e} on ${i.metric} violated threshold of ${i.type} ${i.value}`;
|
|
520
|
-
(s = b.replay) == null || s.disableRecording("Threshold violated", new Error(d), { reportError: !1 }), window.UserLeap.reportError("Sdk Performance Metric threshold violated", new Error("Sdk Performance Metric threshold violated"), { metricName: i.metric, type: i.type, value: i.value }, { metricName: i.metric }),
|
|
520
|
+
(s = b.replay) == null || s.disableRecording("Threshold violated", new Error(d), { reportError: !1 }), window.UserLeap.reportError("Sdk Performance Metric threshold violated", new Error("Sdk Performance Metric threshold violated"), { metricName: i.metric, type: i.type, value: i.value }, { metricName: i.metric }), It();
|
|
521
521
|
}
|
|
522
|
-
}),
|
|
522
|
+
}), St({ reportingIntervalSeconds: t, postMetrics: a }), r && (((e = 1e3) => {
|
|
523
523
|
const i = $("sdk_event_queue_latency_seconds");
|
|
524
524
|
Se(e, i);
|
|
525
525
|
})(), ((e = 1e4) => {
|
|
526
|
-
|
|
527
|
-
})(),
|
|
528
|
-
},
|
|
526
|
+
dt = $("sdk_dom_nodes_count"), lt = $("sdk_page_html_characters"), $e(), setInterval($e, e);
|
|
527
|
+
})(), Bt());
|
|
528
|
+
}, qt = "test", Vt = ["popState", "pushState", "replaceState"];
|
|
529
|
+
let Ie;
|
|
530
|
+
const Q = "!email", pt = "pageUrl";
|
|
529
531
|
let fe = window.location.href;
|
|
530
532
|
function ee(r) {
|
|
531
533
|
var s;
|
|
@@ -534,28 +536,28 @@ function ee(r) {
|
|
|
534
536
|
return;
|
|
535
537
|
fe !== window.location.href && T.navigation("LocationChange", { from: fe, to: window.location.href }), fe = window.location.href;
|
|
536
538
|
const i = q("trackStartUrl"), o = i ? String(i) : null;
|
|
537
|
-
t &&
|
|
539
|
+
t && mt(window.location.href), n && (wt(), Ht()), it() && (() => {
|
|
538
540
|
if (se())
|
|
539
541
|
return;
|
|
540
542
|
const d = K();
|
|
541
|
-
d && (
|
|
542
|
-
})(),
|
|
543
|
+
d && (Lt(Z) || (d.remove(), Z = null, f = null));
|
|
544
|
+
})(), kt.getItem("sprig.isCapturingHeatmap") && ((s = b.replay) == null || s.checkPendingHeatmapsUrl()), !se() && a && o && o !== window.location.href && r && Vt.includes(r.type) && window.UserLeap("dismissActiveSurvey", V.PageChange);
|
|
543
545
|
}
|
|
544
|
-
const
|
|
545
|
-
const r = window.UserLeap._config.interactiveEvents.filter((n) =>
|
|
546
|
+
const ut = { capture: !0 }, Ht = () => {
|
|
547
|
+
const r = window.UserLeap._config.interactiveEvents.filter((n) => Ee(n, window.location.href)).map((n) => {
|
|
546
548
|
const { name: a, properties: e } = n, { selector: i, innerText: o } = e;
|
|
547
549
|
return i ? (s) => {
|
|
548
|
-
if (
|
|
550
|
+
if (qe(s.target))
|
|
549
551
|
try {
|
|
550
552
|
s.target.closest(i) && window.UserLeap("track", a);
|
|
551
553
|
} catch {
|
|
552
554
|
}
|
|
553
555
|
return !1;
|
|
554
|
-
} : (s) => (
|
|
556
|
+
} : (s) => (qe(s.target) && s.target.innerText === o && window.UserLeap("track", a), !1);
|
|
555
557
|
}), t = (n) => r.forEach((a) => a(n));
|
|
556
|
-
window.UserLeap._config.interactiveEventsHandler = t, window.addEventListener("click", t,
|
|
557
|
-
},
|
|
558
|
-
window.UserLeap._config.interactiveEventsHandler && window.removeEventListener("click", window.UserLeap._config.interactiveEventsHandler,
|
|
558
|
+
window.UserLeap._config.interactiveEventsHandler = t, window.addEventListener("click", t, ut);
|
|
559
|
+
}, wt = () => {
|
|
560
|
+
window.UserLeap._config.interactiveEventsHandler && window.removeEventListener("click", window.UserLeap._config.interactiveEventsHandler, ut), delete window.UserLeap._config.interactiveEventsHandler;
|
|
559
561
|
};
|
|
560
562
|
function q(r) {
|
|
561
563
|
const t = C.getItem("userleap.ids");
|
|
@@ -568,10 +570,10 @@ function q(r) {
|
|
|
568
570
|
}
|
|
569
571
|
return null;
|
|
570
572
|
}
|
|
571
|
-
function
|
|
572
|
-
window.previewMode || (window.UserLeap.visitorId =
|
|
573
|
+
function gt() {
|
|
574
|
+
window.previewMode || (window.UserLeap.visitorId = Ye(), T.info("NewVid", { vid: window.UserLeap.visitorId }), E("vid", window.UserLeap.visitorId), u.emit(w.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId }));
|
|
573
575
|
}
|
|
574
|
-
function
|
|
576
|
+
function mt(r, t, n, a) {
|
|
575
577
|
var e, i;
|
|
576
578
|
try {
|
|
577
579
|
if (r.endsWith("mock_snippet.html"))
|
|
@@ -580,20 +582,20 @@ function gt(r, t, n, a) {
|
|
|
580
582
|
const o = window.UserLeap._config.pageUrlEvents;
|
|
581
583
|
let s = !1;
|
|
582
584
|
if (o && o.length)
|
|
583
|
-
for (let l = 0; l < o.length && (s =
|
|
585
|
+
for (let l = 0; l < o.length && (s = Ee(o[l], r), !s); l++)
|
|
584
586
|
;
|
|
585
587
|
if (!s)
|
|
586
588
|
return;
|
|
587
589
|
window.UserLeap.debugMode && console.info("[DEBUG] Sprig trackPageView", r);
|
|
588
590
|
const d = { url: r };
|
|
589
|
-
a && (d.trackPageView = !0), window.UserLeap._queue.push(["track",
|
|
591
|
+
a && (d.trackPageView = !0), window.UserLeap._queue.push(["track", pt, t, d, n]);
|
|
590
592
|
const c = (e = document == null ? void 0 : document.querySelector('meta[name="description"]')) == null ? void 0 : e.getAttribute("content");
|
|
591
593
|
(i = b.replay) == null || i.RecordPageView({ ...c && { description: c }, url: r, referrer: document.referrer, pageTitle: document.title });
|
|
592
594
|
} catch (o) {
|
|
593
595
|
o instanceof Error && (o.stack = r, window.UserLeap.reportError("trackPageView", o)), console.warn("[Sprig] (ERR-428) Failed to track page view", o);
|
|
594
596
|
}
|
|
595
597
|
}
|
|
596
|
-
function
|
|
598
|
+
function $t() {
|
|
597
599
|
const r = "Backbone" in window && window.Backbone && window.Backbone.history ? window.Backbone.history : window.history;
|
|
598
600
|
"pushState" in r && (r.pushState = /* @__PURE__ */ ((t) => function(...n) {
|
|
599
601
|
const a = t.apply(this, n), e = new Event("pushState");
|
|
@@ -604,9 +606,9 @@ function Ht() {
|
|
|
604
606
|
})(r.replaceState)), ["hashchange", "popstate"].forEach((t) => window.addEventListener(t, ee, !0));
|
|
605
607
|
}
|
|
606
608
|
async function ve(r, t) {
|
|
607
|
-
const n =
|
|
608
|
-
r && !t && (window.UserLeap._config.mode =
|
|
609
|
-
const a =
|
|
609
|
+
const n = _e();
|
|
610
|
+
r && !t && (window.UserLeap._config.mode = qt);
|
|
611
|
+
const a = xe(z(window.UserLeap)), e = await O(function(i) {
|
|
610
612
|
const o = new URL(D("1", [j], "questions"));
|
|
611
613
|
return Object.entries(i || {}).forEach(([s, d]) => {
|
|
612
614
|
d && o.searchParams.append(s, String(d));
|
|
@@ -614,14 +616,14 @@ async function ve(r, t) {
|
|
|
614
616
|
}({ desktopDisplay: window.UserLeap._config.desktopDisplay, isMobile: a, previewLanguage: window.UserLeap._config.previewLanguage, surveyid: r == null ? void 0 : r.surveyId, surveytemplateid: r == null ? void 0 : r.surveyTemplateId, vid: n }), { shouldDropOnRateLimit: !0 });
|
|
615
617
|
if (!e.ok)
|
|
616
618
|
return e.reportError && e.error && (console.warn("[Sprig] (ERR-414) Failed to request questions from the server", e.error), window.UserLeap.reportError("getQuestions", e.error)), { success: !1, surveyState: "no survey" };
|
|
617
|
-
if (e.json.delay && await
|
|
618
|
-
return X(e.json);
|
|
619
|
+
if (e.json.delay && await Xe(e.json.delay), !e.json.isFeedback)
|
|
620
|
+
return X(e.json, Ie);
|
|
619
621
|
{
|
|
620
622
|
const { feedbackLabel: i, productConfig: o, surveyUuid: s, feedbackCustomStyles: d } = e.json, { buttonTheme: c, placement: l, desktopDisplay: p } = o;
|
|
621
|
-
|
|
623
|
+
at({ customStyles: d, buttonTheme: c, desktopDisplay: p, eventId: 0, feedbackLabel: i, placement: l, surveyUuid: s, surveyId: r == null ? void 0 : r.surveyId }, e.json);
|
|
622
624
|
}
|
|
623
625
|
}
|
|
624
|
-
function
|
|
626
|
+
function Gt(r) {
|
|
625
627
|
if (!r)
|
|
626
628
|
return;
|
|
627
629
|
window.UserLeap._config = r, r.mute && window.UserLeap._queue.pause();
|
|
@@ -634,16 +636,16 @@ function $t(r) {
|
|
|
634
636
|
const s = e[i];
|
|
635
637
|
e[i] = e[o], e[o] = s;
|
|
636
638
|
}
|
|
637
|
-
}(t), (t || n || a) && (
|
|
639
|
+
}(t), (t || n || a) && ($t(), ee());
|
|
638
640
|
}
|
|
639
|
-
const
|
|
641
|
+
const Kt = function(r) {
|
|
640
642
|
if (!window.UserLeap)
|
|
641
643
|
return;
|
|
642
644
|
const t = async (e = {}) => {
|
|
643
645
|
var S, L, I, k, W;
|
|
644
646
|
const { userId: i, anonymousId: o, metadata: s = {}, properties: d, showSurveyCallback: c } = e;
|
|
645
647
|
let { eventName: l } = e;
|
|
646
|
-
if (window.UserLeap.debugMode && l !==
|
|
648
|
+
if (window.UserLeap.debugMode && l !== pt && console.info("[DEBUG] Sprig track", e), r.mode === "test")
|
|
647
649
|
return;
|
|
648
650
|
const p = C.getItem("sprig.previewKey") ?? void 0;
|
|
649
651
|
if (r.requireUserIdForTracking && !window.UserLeap.userId && !i) {
|
|
@@ -655,9 +657,9 @@ const Gt = function(r) {
|
|
|
655
657
|
const v = "[Sprig] - Invalid event name " + l;
|
|
656
658
|
return console.warn(v), { success: !1, message: v, surveyState: "no survey" };
|
|
657
659
|
}
|
|
658
|
-
const y = window.location.href;
|
|
660
|
+
const y = Ie ?? window.location.href;
|
|
659
661
|
s.url || (s.url = y), E("trackStartUrl", y), (L = (S = window.UserLeap) == null ? void 0 : S._config) != null && L.optimizelyEnabled && (ue(z(window.UserLeap)) || ne.getAndSetWebOptimizelyExperiments(), s.optimizelyExperiments = Object.assign({}, ne.getAllOptimizelyExperiments())), (k = (I = window.UserLeap) == null ? void 0 : I._config) != null && k.launchDarklyEnabled && (s.launchDarklyFlags = Le.getAllLaunchDarklyVariations()), i && (window.UserLeap.userId = i), o && (window.UserLeap.partnerAnonymousId = o), d && (s.eventProperties = d), (W = b.replay) == null || W.RecordEvent({ name: l, url: s.url }), T.info("TrackEvent", { eventName: l });
|
|
660
|
-
const g = window.UserLeap.delayingSurvey ||
|
|
662
|
+
const g = window.UserLeap.delayingSurvey || nt() ? await O(D("1", [F], "events/batch"), { body: JSON.stringify({ events: [{ event: l, metadata: s }], previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 }) : await O(D("1", [F], "events"), { body: JSON.stringify({ event: l, metadata: s, previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 });
|
|
661
663
|
if (!g.ok) {
|
|
662
664
|
const v = "[Sprig] (ERR-421) Failed to track event";
|
|
663
665
|
return g.reportError && (console.warn(v, g.error), g.error && window.UserLeap.reportError("track", g.error)), { success: !1, message: v, error: g.error, surveyState: "no survey" };
|
|
@@ -666,10 +668,10 @@ const Gt = function(r) {
|
|
|
666
668
|
const m = g.json;
|
|
667
669
|
m.invalidPreviewKey && C.removeItem("sprig.previewKey");
|
|
668
670
|
const _ = s.trackPageView ? s.url : void 0;
|
|
669
|
-
return m != null && m.feedbackButton &&
|
|
671
|
+
return m != null && m.feedbackButton && at(m.feedbackButton, void 0, _), await async function(v, U) {
|
|
670
672
|
var A, B;
|
|
671
673
|
let x = !0;
|
|
672
|
-
return !(U && ((A = v == null ? void 0 : v.json) != null && A.surveyId) && (window.UserLeap.delayingSurvey = !0, x = await U(v.json.surveyId), window.UserLeap.delayingSurvey = !1, !x)) && ((B = v == null ? void 0 : v.json) != null && B.delay && !window.UserLeap.isMobileSDK && (window.UserLeap.delayingSurvey = !0, await
|
|
674
|
+
return !(U && ((A = v == null ? void 0 : v.json) != null && A.surveyId) && (window.UserLeap.delayingSurvey = !0, x = await U(v.json.surveyId), window.UserLeap.delayingSurvey = !1, !x)) && ((B = v == null ? void 0 : v.json) != null && B.delay && !window.UserLeap.isMobileSDK && (window.UserLeap.delayingSurvey = !0, await Xe(v.json.delay), window.UserLeap.delayingSurvey = !1), x);
|
|
673
675
|
}(g, c) ? function(v, U) {
|
|
674
676
|
const { pageUrlEvents: x, interactiveEvents: A, dismissOnPageChange: B } = window.UserLeap._config;
|
|
675
677
|
if (!B)
|
|
@@ -677,11 +679,11 @@ const Gt = function(r) {
|
|
|
677
679
|
const R = [];
|
|
678
680
|
x && x.length && R.push(...x), A && A.length && R.push(...A);
|
|
679
681
|
const re = v && R.find((J) => J.id === v);
|
|
680
|
-
return re ?
|
|
682
|
+
return re ? Ee(re, window.location.href) : U === window.location.href;
|
|
681
683
|
}(m.eventId, y) ? X(m, _) : { success: !1, message: "Study should not be displayed after page navigation", surveyState: "no survey" } : { success: !1, message: "[Sprig] Callback returned false, aborting rendering of survey", surveyState: "no survey" };
|
|
682
684
|
}, n = (e, i) => {
|
|
683
685
|
var s;
|
|
684
|
-
const o = (s = e == null ? void 0 : e.querySelector(`[id="${
|
|
686
|
+
const o = (s = e == null ? void 0 : e.querySelector(`[id="${Ae}"]`)) == null ? void 0 : s.contentDocument;
|
|
685
687
|
o && oe({ document: o, elementId: "ul-custom-style", styleString: i });
|
|
686
688
|
}, a = { displaySurvey: async (e) => (console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."), window.UserLeap("dismissActiveSurvey", V.Override), ve({ surveyId: e }, !0)), _previewSurvey(e) {
|
|
687
689
|
window.UserLeap("dismissActiveSurvey", V.Override), ve({ surveyTemplateId: e }, !1);
|
|
@@ -771,7 +773,7 @@ const Gt = function(r) {
|
|
|
771
773
|
}
|
|
772
774
|
return window.UserLeap.partnerAnonymousId = e, E("aid", e), { success: !0 };
|
|
773
775
|
}, track: async (e, i, o = {}, s = void 0) => t({ eventName: e, properties: i, metadata: o, showSurveyCallback: s }), identifyAndTrack: async (e) => await t(e), trackPageView(e, i = void 0, o = void 0, s = !0) {
|
|
774
|
-
|
|
776
|
+
Ie = e, mt(e, i, o, s);
|
|
775
777
|
}, applyFeedbackStyles({ button: e = "", view: i = "" }) {
|
|
776
778
|
window.UserLeap.feedbackCustomStyles = i, document.getElementById("sprig-feedback-style") && oe({ document, elementId: "ul-custom-style", styleString: e, nonce: window.UserLeap.styleNonce }), n(document.querySelector(".ul-container-feedback"), i);
|
|
777
779
|
}, applyStyles(e) {
|
|
@@ -782,12 +784,12 @@ const Gt = function(r) {
|
|
|
782
784
|
if (isNaN(o) || isNaN(s) || (window.UserLeap.windowDimensions = { width: o, height: s }), !window.UserLeap.frameId)
|
|
783
785
|
return;
|
|
784
786
|
const d = document.getElementById(window.UserLeap.frameId);
|
|
785
|
-
d && (window.UserLeap.useMobileStyling && ((c = window.UserLeap.windowDimensions) != null && c.width && (d.style.width = `${window.UserLeap.windowDimensions.width}px`), (l = window.UserLeap.windowDimensions) != null && l.height && (d.style.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px"), d.contentDocument && (d.style.height = String(
|
|
787
|
+
d && (window.UserLeap.useMobileStyling && ((c = window.UserLeap.windowDimensions) != null && c.width && (d.style.width = `${window.UserLeap.windowDimensions.width}px`), (l = window.UserLeap.windowDimensions) != null && l.height && (d.style.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px"), d.contentDocument && (d.style.height = String(Ct(d.contentDocument)[0]) + "px")), u.emit(w.SurveyDimensions, { name: w.SurveyDimensions, contentFrameWidth: d.clientWidth, contentFrameHeight: d.clientHeight, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }));
|
|
786
788
|
}, logoutUser() {
|
|
787
789
|
var e;
|
|
788
|
-
window.UserLeap.debugMode && console.info("[DEBUG] Sprig logout"), T.info("LogOut", { vid: window.UserLeap.visitorId, userId: window.UserLeap.userId }), window.UserLeap.visitorId = null, window.UserLeap.userId = null, window.UserLeap.partnerAnonymousId = null, window.UserLeap.token = null, window.UserLeap.email = null, C.removeItem("userleap.ids"), window.UserLeap._queue.isPaused() && window.UserLeap._queue.empty(),
|
|
790
|
+
window.UserLeap.debugMode && console.info("[DEBUG] Sprig logout"), T.info("LogOut", { vid: window.UserLeap.visitorId, userId: window.UserLeap.userId }), window.UserLeap.visitorId = null, window.UserLeap.userId = null, window.UserLeap.partnerAnonymousId = null, window.UserLeap.token = null, window.UserLeap.email = null, C.removeItem("userleap.ids"), window.UserLeap._queue.isPaused() && window.UserLeap._queue.empty(), gt(), (e = b.replay) == null || e.clearUserReplayData(), window.UserLeap._queue.unpause();
|
|
789
791
|
}, teardown() {
|
|
790
|
-
["hashchange", "popstate"].forEach((e) => window.removeEventListener(e, ee, !0)), window.UserLeap._config.interactiveEvents &&
|
|
792
|
+
["hashchange", "popstate"].forEach((e) => window.removeEventListener(e, ee, !0)), window.UserLeap._config.interactiveEvents && wt(), window.UserLeap("dismissActiveSurvey", V.API), delete window.UserLeap, delete window.Sprig, delete window._Sprig;
|
|
791
793
|
}, integrateOptimizely(e, i = !0) {
|
|
792
794
|
var o, s;
|
|
793
795
|
if ((s = (o = window.UserLeap) == null ? void 0 : o._config) != null && s.optimizelyEnabled)
|
|
@@ -826,24 +828,24 @@ const Gt = function(r) {
|
|
|
826
828
|
console.warn("[Sprig] Error with generating video upload url"), d instanceof Error && window.UserLeap.reportError("generateVideoUploadUrl", d);
|
|
827
829
|
}
|
|
828
830
|
}(e), _reportMetric(e, i) {
|
|
829
|
-
|
|
831
|
+
Et(e, i);
|
|
830
832
|
}, _completeSessionReplay: async ({ surveyId: e, responseGroupUuid: i, eventDigest: o }) => {
|
|
831
833
|
var s;
|
|
832
834
|
return b.replay ? (s = b.replay) == null ? void 0 : s._completeSessionReplay({ surveyId: e, responseGroupUuid: i, eventDigest: o, headers: z(window.UserLeap) }) : (window.UserLeap.reportError("_completeSessionReplay", new Error("Replay module not registered")), !1);
|
|
833
835
|
} };
|
|
834
836
|
Object.assign(window.UserLeap, a);
|
|
835
837
|
};
|
|
836
|
-
async function
|
|
837
|
-
const e = window.__cfg && window.__cfg.mode, i =
|
|
838
|
+
async function Jt(r, t, n = {}, a = {}) {
|
|
839
|
+
const e = window.__cfg && window.__cfg.mode, i = _e(), o = window.UserLeap.envId, s = window.document.documentElement, d = { mode: e, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: s.clientWidth, clientHeight: s.clientHeight, location: window.location.href, language: window.navigator.language, ...n }, c = { action: r, breadcrumbs: T.breadcrumbs, err: { message: `${t == null ? void 0 : t.name} - ${t == null ? void 0 : t.message}`, stack: t == null ? void 0 : t.stack }, meta: d, vid: i, envId: o, ...a };
|
|
838
840
|
(await O(D("1", null, "errors"), { method: "POST", headers: { "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(c), shouldDropOnRateLimit: !0 })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", t);
|
|
839
841
|
}
|
|
840
|
-
function
|
|
842
|
+
function Qt(r = {}) {
|
|
841
843
|
const t = new URLSearchParams(window.location.search).get("sprigPreviewKey") ?? "";
|
|
842
844
|
async function n() {
|
|
843
845
|
var d;
|
|
844
846
|
if (window.UserLeap.loaded)
|
|
845
847
|
return;
|
|
846
|
-
if (window.UserLeap.reportError =
|
|
848
|
+
if (window.UserLeap.reportError = Jt, window.UserLeap.loaded = !0, window.UserLeap._config = Object.assign({}, r, window.UserLeap.config), window.UserLeap.delayingSurvey = !1, window.UserLeap._config && typeof window.UserLeap._config == "object")
|
|
847
849
|
for (const c in window.UserLeap._config)
|
|
848
850
|
window.UserLeap[c] = window.UserLeap._config[c];
|
|
849
851
|
if (!window.UserLeap.envId) {
|
|
@@ -861,30 +863,30 @@ function Jt(r = {}) {
|
|
|
861
863
|
q("sampled") !== null && E("sampled", null);
|
|
862
864
|
window.UserLeap._API_URL || (window.UserLeap._API_URL = "https://api.sprig.com");
|
|
863
865
|
const e = [...window.UserLeap._queue];
|
|
864
|
-
window.UserLeap._queue = new
|
|
866
|
+
window.UserLeap._queue = new Ft(window.UserLeap, []), window.UserLeap._queue.pause();
|
|
865
867
|
for (let c = 0; c < e.length; c++)
|
|
866
868
|
window.UserLeap._queue.push(e[c]);
|
|
867
869
|
const i = q("token");
|
|
868
|
-
i ? (window.UserLeap.token = i, window.UserLeap.visitorId = q("vid"), window.UserLeap.userId = q("uid"), window.UserLeap.partnerAnonymousId = q("aid")) : (C.removeItem("userleap.ids"),
|
|
870
|
+
i ? (window.UserLeap.token = i, window.UserLeap.visitorId = q("vid"), window.UserLeap.userId = q("uid"), window.UserLeap.partnerAnonymousId = q("aid")) : (C.removeItem("userleap.ids"), gt());
|
|
869
871
|
const o = ue(z(window.UserLeap)), s = await async function(c) {
|
|
870
872
|
const l = z(window.UserLeap);
|
|
871
|
-
document.addEventListener("securitypolicyviolation",
|
|
872
|
-
const p = await
|
|
873
|
-
if (document.removeEventListener("securitypolicyviolation",
|
|
874
|
-
return p.reportError && (console.warn("[Sprig] (ERR-422) Failed to load configuration", p.error), p.error && window.UserLeap.reportError("applyRemoteConfig", p.error)),
|
|
873
|
+
document.addEventListener("securitypolicyviolation", je);
|
|
874
|
+
const p = await Qe(D("1", [j], "config"), { headers: l });
|
|
875
|
+
if (document.removeEventListener("securitypolicyviolation", je), !p.ok)
|
|
876
|
+
return p.reportError && (console.warn("[Sprig] (ERR-422) Failed to load configuration", p.error), p.error && window.UserLeap.reportError("applyRemoteConfig", p.error)), ze("Disabled: failed to fetch configuration"), c;
|
|
875
877
|
const y = p.json;
|
|
876
|
-
return y != null && y.disabled ? (
|
|
878
|
+
return y != null && y.disabled ? (ze(`Disabled: ${y.disabled}`), { disabled: y.disabled }) : Object.assign({}, y, c);
|
|
877
879
|
}(r);
|
|
878
|
-
|
|
880
|
+
Nt({ isWeb: !o, reportingIntervalSeconds: s.metricsReportingEnabled || s.mobileMetricsReportingEnabled ? s.metricsReportingIntervalSeconds : 0, thresholds: s.metricThresholds, postMetrics: async (c) => {
|
|
879
881
|
var l;
|
|
880
882
|
await O(D("1", [j], "metrics"), { body: c, method: "POST", headers: { "x-ul-replay-enabled": `${!!((l = b.replay) != null && l.isReplayRecording())}` }, shouldDropOnRateLimit: !0 });
|
|
881
|
-
} }), await ((d = b.replay) == null ? void 0 : d.initializeReplay({ maxReplayDurationSeconds: s.maxReplayDurationSeconds, maxInflightRequests: window.UserLeap.maxInflightReplayRequests ?? 2, replaySettings: s.replaySettings })),
|
|
883
|
+
} }), await ((d = b.replay) == null ? void 0 : d.initializeReplay({ maxReplayDurationSeconds: s.maxReplayDurationSeconds, maxInflightRequests: window.UserLeap.maxInflightReplayRequests ?? 2, replaySettings: s.replaySettings })), Kt(s), await Gt(s), window.UserLeap._queue.unpause(), u.emit(w.SDKReady, { mobileMetricsReportingEnabled: !!s.mobileMetricsReportingEnabled, metricsReportingInterval: s.metricsReportingIntervalSeconds || 0, metricsThresholds: s.metricThresholds || [], maxMobileReplayDurationSeconds: s.maxMobileReplayDurationSeconds, mobileReplaySettings: s.mobileReplaySettings }), u.emit(w.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId });
|
|
882
884
|
}
|
|
883
885
|
window.UserLeap.UPDATES = te, window.UserLeap("setPreviewKey", t), document.readyState === "complete" ? n() : window.attachEvent ? window.attachEvent("onload", n) : window.addEventListener("load", () => {
|
|
884
886
|
n();
|
|
885
887
|
}, !1);
|
|
886
888
|
}
|
|
887
|
-
class
|
|
889
|
+
class ke {
|
|
888
890
|
constructor() {
|
|
889
891
|
this.UPDATES = te;
|
|
890
892
|
}
|
|
@@ -952,30 +954,30 @@ class Ie {
|
|
|
952
954
|
window.Sprig("teardown");
|
|
953
955
|
}
|
|
954
956
|
}
|
|
955
|
-
const
|
|
957
|
+
const Je = { configure: (r) => {
|
|
956
958
|
if (!r.envId && !r.environmentId)
|
|
957
959
|
throw new Error("Initialization Error: Sprig configure requires an environmentId");
|
|
958
960
|
if (r.envId || (r.envId = r.environmentId ?? ""), r.installationMethod = "web-npm", window.Sprig)
|
|
959
961
|
return window.Sprig;
|
|
960
962
|
window.Sprig = function() {
|
|
961
963
|
window.Sprig._queue.push(arguments);
|
|
962
|
-
}, Object.getOwnPropertyNames(
|
|
963
|
-
n !== "constructor" && (window.Sprig[n] =
|
|
964
|
+
}, Object.getOwnPropertyNames(ke.prototype).map((n) => {
|
|
965
|
+
n !== "constructor" && (window.Sprig[n] = ke.prototype[n]);
|
|
964
966
|
});
|
|
965
967
|
const t = window.Sprig;
|
|
966
|
-
return t.appId = r.envId, t._queue = [], window.UserLeap = t,
|
|
967
|
-
} },
|
|
968
|
+
return t.appId = r.envId, t._queue = [], window.UserLeap = t, Qt(r), window.Sprig;
|
|
969
|
+
} }, nr = { sprig: Je, SprigAPI: ke, configure: Je.configure };
|
|
968
970
|
export {
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
971
|
+
Zt as A,
|
|
972
|
+
xt as C,
|
|
973
|
+
_t as D,
|
|
974
|
+
rr as E,
|
|
975
|
+
ke as S,
|
|
976
|
+
Ct as a,
|
|
977
|
+
tr as b,
|
|
978
|
+
nr as c,
|
|
979
|
+
er as d,
|
|
978
980
|
oe as e,
|
|
979
|
-
|
|
980
|
-
|
|
981
|
+
ir as r,
|
|
982
|
+
Je as s
|
|
981
983
|
};
|