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