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