@sprig-technologies/sprig-browser 2.40.0 → 2.40.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversational-styles-BiL7hMhj.js +4 -0
- package/dist/conversational-styles-DlhTFTL6.cjs +1 -0
- package/dist/conversational-ui-BYWN-x1R.js +579 -0
- package/dist/conversational-ui-N_aaTzqd.cjs +1 -0
- package/dist/core-Br8FqGd4.cjs +12 -0
- package/dist/{core-CzqULo6b.js → core-Cyu7gofl.js} +451 -458
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +11 -0
- package/dist/core.js +2 -2
- package/dist/debounce-CMb8f7wh.js +9 -0
- package/dist/debounce-DsC7462b.cjs +1 -0
- package/dist/{getAttributedUrl-C1AsMcwH.cjs → getAttributedUrl-CJJ96Ihj.cjs} +6 -6
- package/dist/{getAttributedUrl-DUesmkhh.js → getAttributedUrl-C_5gL6aZ.js} +241 -244
- package/dist/index-BSk-C5b7.js +695 -0
- package/dist/index-MWKreg7C.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-BChkCOLD.js → metricsReporter-B-oKhuWk.js} +1 -1
- package/dist/{metricsReporter-Bqy_vLyq.cjs → metricsReporter-Dc4CZlRc.cjs} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +134 -138
- package/dist/view-BGlLLPXB.js +1503 -0
- package/dist/view-BGzeHt4l.cjs +1 -0
- package/package.json +1 -1
- package/dist/conversational-styles-CWNea3pP.js +0 -4
- package/dist/conversational-styles-CzhxRRD3.cjs +0 -1
- package/dist/conversational-ui-D2Y5H9To.js +0 -610
- package/dist/conversational-ui-DJlCFQ-6.cjs +0 -1
- package/dist/core-CvM2f3CD.cjs +0 -12
- package/dist/index-D1_q2uph.cjs +0 -1
- package/dist/index-mshAF3wp.js +0 -709
- package/dist/view-C7XtFlCN.cjs +0 -1
- package/dist/view-afp9mz2J.js +0 -1491
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
var Dt = Object.defineProperty;
|
|
2
|
-
var At = (
|
|
3
|
-
var N = (
|
|
4
|
-
import { l as R, g as T, s as st, e as w, S as u, v as at, m as
|
|
5
|
-
const
|
|
2
|
+
var At = (r, t, n) => t in r ? Dt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[t] = n;
|
|
3
|
+
var N = (r, t, n) => At(r, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { l as R, g as T, s as st, e as w, S as u, v as at, m as I, b as M, h as dt, E as ie, D as P, c as Ot, r as K, i as Ct, j as Tt, k as Pt, n as $e, o as Ge, d as Mt, a as jt, p as lt, q as ct } from "./metricsReporter-B-oKhuWk.js";
|
|
5
|
+
const cr = 360, pr = "ul-app", ur = "#e6e6e6", wr = "#bd282a", gr = 1030, Ke = () => {
|
|
6
6
|
try {
|
|
7
7
|
return window.parent.Intercom;
|
|
8
8
|
} catch {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
11
|
}, Je = [Object.freeze(Object.defineProperty({ __proto__: null, disable: () => {
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const r = Ke();
|
|
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
|
|
16
|
-
|
|
15
|
+
const r = Ke();
|
|
16
|
+
r && (r.ul_wasVisible && r("update", { hide_default_launcher: !1 }), delete r.ul_wasVisible);
|
|
17
17
|
} }, Symbol.toStringTag, { value: "Module" }))];
|
|
18
|
-
class
|
|
18
|
+
class Ft {
|
|
19
19
|
static disable() {
|
|
20
|
-
Je.forEach((
|
|
20
|
+
Je.forEach((t) => t.disable());
|
|
21
21
|
}
|
|
22
22
|
static enable() {
|
|
23
|
-
Je.forEach((
|
|
23
|
+
Je.forEach((t) => t.enable());
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
const Qe = "ul-view-sdk-script",
|
|
27
|
-
async function O(
|
|
28
|
-
var i,
|
|
29
|
-
const { shouldDropOnRateLimit: n, ...
|
|
30
|
-
|
|
31
|
-
const e = await st(
|
|
26
|
+
const Qe = "ul-view-sdk-script", qt = /* @__PURE__ */ new Set(["ios", "android"]), q = "visitors", H = "environments";
|
|
27
|
+
async function O(r, t) {
|
|
28
|
+
var i, s, o;
|
|
29
|
+
const { shouldDropOnRateLimit: n, ...a } = t;
|
|
30
|
+
a.headers = Object.assign(T(window.UserLeap), a.headers);
|
|
31
|
+
const e = await st(r, { ...a, shouldDropOnRateLimit: n });
|
|
32
32
|
if (e.ok) {
|
|
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 = (
|
|
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
35
|
const f = R.getItemObject("sprig.anon.env.vid.map");
|
|
36
36
|
f && f[window.UserLeap.envId] === p && (delete f[window.UserLeap.envId], R.setItemObject("sprig.anon.env.vid.map", f));
|
|
@@ -39,129 +39,129 @@ async function O(t, r) {
|
|
|
39
39
|
}
|
|
40
40
|
return (o = e.json) != null && o.logMessage && console.warn(`[Sprig] ${e.json.logMessage}`), e;
|
|
41
41
|
}
|
|
42
|
-
function _(
|
|
42
|
+
function _(r, t) {
|
|
43
43
|
const n = R.getItemObject("userleap.ids");
|
|
44
|
-
let
|
|
45
|
-
|
|
44
|
+
let a = n[window.UserLeap.envId];
|
|
45
|
+
a ? a[r] = t : a = { [r]: t }, n[window.UserLeap.envId] = a, R.setItemObject("userleap.ids", n);
|
|
46
46
|
}
|
|
47
47
|
function Oe() {
|
|
48
48
|
return window.previewMode ? "0" : window.UserLeap.visitorId ?? "";
|
|
49
49
|
}
|
|
50
|
-
function D(
|
|
51
|
-
const
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
}), n &&
|
|
50
|
+
function D(r, t, n) {
|
|
51
|
+
const a = [window.UserLeap._API_URL, "sdk", r];
|
|
52
|
+
return t && t.forEach((e) => {
|
|
53
|
+
a.push(e), e === H ? a.push(window.UserLeap.envId) : e === q && a.push(Oe());
|
|
54
|
+
}), n && a.push(n), a.join("/");
|
|
55
55
|
}
|
|
56
|
-
const Z = async (
|
|
56
|
+
const Z = async (r, t, n) => {
|
|
57
57
|
var ze, Ve, We, Be;
|
|
58
|
-
const { context:
|
|
59
|
-
if (
|
|
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 = T(window.UserLeap), V = ne(b), A = fe(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: at(), mediaType: "screen", questionId: 1, responseGroupUid: v, surveyId: m, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), visitorId: window.UserLeap.visitorId, isReplay: !0 } });
|
|
60
60
|
else {
|
|
61
|
-
if (!
|
|
62
|
-
|
|
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
|
+
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
|
-
if (!
|
|
66
|
-
const { eventId:
|
|
67
|
-
await
|
|
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: be, surveyId: Le } = c;
|
|
67
|
+
await I.replay.initializeReplay({ maxReplayDurationSeconds: 300, maxInflightRequests: window.UserLeap.maxInflightReplayRequests, teardownAfter: !0, apiUrl: window.UserLeap._API_URL, replaySettings: n }), I.replay.tryReplayAction(() => {
|
|
68
68
|
var Ne;
|
|
69
|
-
return (Ne =
|
|
69
|
+
return (Ne = I.replay) == null ? void 0 : Ne.scheduleCapture({ apiUrl: window.UserLeap._API_URL, completeUploadHeaders: b, eventId: S, isHeatmap: !0, replayParams: B, responseGroupId: be, surveyId: Le, triggerTimestamp: Date.now(), visitorId: k });
|
|
70
70
|
}, "Error in scheduling/capturing replay");
|
|
71
71
|
}
|
|
72
|
-
if (
|
|
72
|
+
if (k == null || !(y != null && y.length)) return M.info("CannotDisplaySurvey", { vid: k }), { success: !1, message: "[Sprig] no survey found", surveyState: "no survey" };
|
|
73
73
|
if (window.UserLeap.container) {
|
|
74
74
|
M.info("AlreadyDisplayingSurvey");
|
|
75
|
-
const
|
|
76
|
-
return console.warn(
|
|
77
|
-
}
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
return window.UserLeap.reportError("DisplaySurvey", new Error(
|
|
81
|
-
}
|
|
82
|
-
M.info("ShowingSurvey", { surveyId: m }), (ze =
|
|
83
|
-
let W,
|
|
84
|
-
const
|
|
85
|
-
const { "view.version": B } =
|
|
86
|
-
B !== b["x-ul-sdk-version"] && ut(), w.removeListener("verify.view.version",
|
|
75
|
+
const S = "[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";
|
|
76
|
+
return console.warn(S), { success: !1, message: S, surveyState: "no survey" };
|
|
77
|
+
}
|
|
78
|
+
if (k !== window.UserLeap.visitorId && h !== window.UserLeap.visitorId && !window.previewMode) {
|
|
79
|
+
const S = "Attempted to display survey to a different visitor";
|
|
80
|
+
return window.UserLeap.reportError("DisplaySurvey", new Error(S)), { success: !1, message: S, surveyState: "no survey" };
|
|
81
|
+
}
|
|
82
|
+
M.info("ShowingSurvey", { surveyId: m }), (ze = I.replay) == null || ze.RecordSurveyShown({ id: m, userAgent: window.navigator.userAgent }), Ft.disable(), w.emit(u.SurveyWillPresent, { name: u.SurveyWillPresent, "survey.id": m, layout: p });
|
|
83
|
+
let W, j, x, oe, se = document.createElement("div");
|
|
84
|
+
const je = (S) => {
|
|
85
|
+
const { "view.version": B } = S;
|
|
86
|
+
B !== b["x-ul-sdk-version"] && ut(), w.removeListener("verify.view.version", je);
|
|
87
87
|
};
|
|
88
|
-
w.on("verify.view.version",
|
|
89
|
-
const
|
|
88
|
+
w.on("verify.view.version", je), window.UserLeap.useMobileStyling = A, dt(b) ? (W = "ul-direct-embeded-frame", j = document.head, x = window, oe = !1, (() => {
|
|
89
|
+
const S = T(window.UserLeap), B = ne(S), be = window.UserLeap.forceDirectEmbed, Le = S["userleap-platform"] === "web";
|
|
90
90
|
return B || be && Le;
|
|
91
|
-
})() && (pt(m, d), se.id = W, window.UserLeap.container.appendChild(se), wt(), w.emit(u.SurveyLifeCycle, { state: "presented" }), w.emit(u.SurveyPresented, { name: u.SurveyPresented, "survey.id": m }))) : { frameId: W, contentWinDocHead:
|
|
92
|
-
const J = { apiURL: window.UserLeap._API_URL, avatars: i, cards: y, configureExitOnOverlayClick: (
|
|
93
|
-
w.once(u.CloseSurveyOnOverlayClick,
|
|
94
|
-
}, context:
|
|
91
|
+
})() && (pt(m, d), se.id = W, window.UserLeap.container.appendChild(se), wt(), w.emit(u.SurveyLifeCycle, { state: "presented" }), w.emit(u.SurveyPresented, { name: u.SurveyPresented, "survey.id": m }))) : { frameId: W, contentWinDocHead: j, contentWindow: x, hasOverlay: oe, iframe: se } = Vt({ productConfig: g, useMobileStyling: A, surveyId: m, isFeedback: d, enableCspTrustedTypes: (Ve = window.UserLeap._config) == null ? void 0 : Ve.enableCspTrustedTypes }), window.UserLeap.frameId = W;
|
|
92
|
+
const J = { apiURL: window.UserLeap._API_URL, avatars: i, cards: y, configureExitOnOverlayClick: (S) => {
|
|
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: se, headers: b, layout: p, locale: l, mobileSDKVersion: window.UserLeap.mobileSDKVersion, previewKey: R.getItem("sprig.previewKey"), previewMode: f, 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: (We = window.UserLeap.config) == null ? void 0 : We.startingQuestionIdx, studyType: E, styleNonce: window.UserLeap.styleNonce, surveyId: m, tabTitle: document.title, trackPageViewUrl: t, ulEvents: ie, upchunkLibraryURL: window.UserLeap.upchunkLibraryURL, useMobileStyling: A, userId: h, viewDocument: x == null ? void 0 : x.document, viewWindow: x, visitorAttributes: { externalUserId: window.UserLeap.userId, email: window.UserLeap.email }, surveyVisitorAttributes: z || {}, ...window.UserLeap._config };
|
|
95
95
|
(Be = window.UserLeap._config) != null && Be.startingQuestionIdx && (window.UserLeap._config = { ...window.UserLeap._config, startingQuestionIdx: null });
|
|
96
96
|
const xt = (d ? window.UserLeap.feedbackCustomStyles : window.UserLeap.customStyles) ?? g.customStyles;
|
|
97
97
|
J.customStyles = xt, x && (x.__cfg = J);
|
|
98
|
-
const ve = window.UserLeap.viewSDKURL ? window.UserLeap.viewSDKURL : J.path,
|
|
99
|
-
|
|
98
|
+
const ve = window.UserLeap.viewSDKURL ? window.UserLeap.viewSDKURL : J.path, Fe = document.getElementById(Qe);
|
|
99
|
+
Fe && Fe.remove();
|
|
100
100
|
const he = function() {
|
|
101
|
-
const
|
|
102
|
-
return
|
|
103
|
-
}(),
|
|
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 = Qe, S;
|
|
103
|
+
}(), qe = () => {
|
|
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:
|
|
108
|
-
|
|
109
|
-
} else ve && (he.src = `${ve}?t=${Date.now()}`, oe && he.addEventListener("load", () => {
|
|
110
|
-
window.UserLeap.container &&
|
|
111
|
-
}), x == null || x.addEventListener("error", (
|
|
112
|
-
|
|
107
|
+
const { default: S } = await import("./view-BGlLLPXB.js").then((B) => B.v);
|
|
108
|
+
S.configure(J), oe && window.UserLeap.container && qe();
|
|
109
|
+
} else ve && (he.src = `${ve}${window.UserLeap.isMobileSDK ? "" : `?t=${Date.now()}`}`, oe && he.addEventListener("load", () => {
|
|
110
|
+
window.UserLeap.container && qe();
|
|
111
|
+
}), x == null || x.addEventListener("error", (S) => {
|
|
112
|
+
S.target instanceof HTMLScriptElement && S.target.src === ve && window.UserLeap.reportError("loadFrameScript", new Error("Frame script failed to load"));
|
|
113
113
|
}, { capture: !0, once: !0 }));
|
|
114
|
-
|
|
114
|
+
j == null || j.appendChild(he);
|
|
115
115
|
const He = { success: !0, surveyState: "ready", surveyId: m, responseGroupUid: v };
|
|
116
116
|
return window.UserLeap.isMobileSDK && e && (He.delay = e), He;
|
|
117
117
|
};
|
|
118
|
-
function fe(
|
|
118
|
+
function fe(r) {
|
|
119
119
|
var n;
|
|
120
120
|
if (window.UserLeap.useMobileStyling !== void 0) return window.UserLeap.useMobileStyling;
|
|
121
|
-
const
|
|
122
|
-
return ne(
|
|
121
|
+
const t = ((n = window.UserLeap.windowDimensions) == null ? void 0 : n.width) ?? document.body.clientWidth;
|
|
122
|
+
return ne(r) || t > 10 && t < 500;
|
|
123
123
|
}
|
|
124
|
-
function ne(
|
|
125
|
-
return
|
|
124
|
+
function ne(r) {
|
|
125
|
+
return qt.has(r["userleap-platform"]);
|
|
126
126
|
}
|
|
127
|
-
const Ye = /* @__PURE__ */ new WeakMap(), Ht = (
|
|
127
|
+
const Ye = /* @__PURE__ */ new WeakMap(), Ht = (r, t) => {
|
|
128
128
|
try {
|
|
129
|
-
return ((
|
|
130
|
-
var
|
|
131
|
-
const e = Ye.get(
|
|
129
|
+
return ((a) => {
|
|
130
|
+
var s, o;
|
|
131
|
+
const e = Ye.get(a);
|
|
132
132
|
if (e) return e;
|
|
133
|
-
if (!((
|
|
134
|
-
const i = (o =
|
|
135
|
-
return Ye.set(
|
|
136
|
-
})(
|
|
133
|
+
if (!((s = a.trustedTypes) != null && s.createPolicy)) throw new Error("Trusted types not supported");
|
|
134
|
+
const i = (o = a.trustedTypes) == null ? void 0 : o.createPolicy("sprig-sdk", { createHTML: (d) => d, createScript: (d) => d, createScriptURL: (d) => d });
|
|
135
|
+
return Ye.set(a, i), i;
|
|
136
|
+
})(t).createHTML(r);
|
|
137
137
|
} catch (n) {
|
|
138
|
-
return console.warn("Could not create TrustedHTML object", n),
|
|
138
|
+
return console.warn("Could not create TrustedHTML object", n), r;
|
|
139
139
|
}
|
|
140
|
-
}, Ce = (
|
|
141
|
-
var
|
|
142
|
-
return
|
|
140
|
+
}, Ce = (r, t, n = window) => {
|
|
141
|
+
var a;
|
|
142
|
+
return t && ((a = n.trustedTypes) != null && a.createPolicy) ? Ht(r, n) : r;
|
|
143
143
|
}, Te = "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 Ue = "0px", pt = (
|
|
146
|
-
window.UserLeap.container = document.createElement("div"), window.UserLeap.container.className = "ul-container" + (
|
|
147
|
-
const
|
|
148
|
-
n &&
|
|
149
|
-
}, ut = (
|
|
150
|
-
var
|
|
145
|
+
const Ue = "0px", pt = (r, t, n) => {
|
|
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 = yt();
|
|
148
|
+
n && a && !window.UserLeap.useMobileStyling ? a.appendChild(window.UserLeap.container) : document.body.appendChild(window.UserLeap.container);
|
|
149
|
+
}, ut = (r, t) => {
|
|
150
|
+
var a;
|
|
151
151
|
Bt();
|
|
152
152
|
const n = window.UserLeap.container;
|
|
153
153
|
if (n) try {
|
|
154
|
-
(
|
|
154
|
+
(a = n.parentNode) == null || a.removeChild(n), window.UserLeap.container = null, _("trackStartUrl", null), w.emit(u.SurveyLifeCycle, { state: "dismissed" }), w.emit(u.SurveyClosed, { name: u.SurveyClosed, initiator: r, "survey.id": parseInt(n.dataset.studyId), ...t && { studyType: t } });
|
|
155
155
|
} catch (e) {
|
|
156
|
-
console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${
|
|
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
|
}, wt = () => {
|
|
159
|
-
w.once(u.SurveyWillClose, ({ initiator:
|
|
160
|
-
w.removeAllListeners(u.CloseSurveyOnOverlayClick), ut(
|
|
159
|
+
w.once(u.SurveyWillClose, ({ initiator: r, studyType: t }) => {
|
|
160
|
+
w.removeAllListeners(u.CloseSurveyOnOverlayClick), ut(r, t);
|
|
161
161
|
});
|
|
162
|
-
}, zt = (
|
|
162
|
+
}, zt = (r, t, n, a) => {
|
|
163
163
|
var l, p;
|
|
164
|
-
const e = { position: "fixed", bottom: "0px", right: Ue, 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({},
|
|
164
|
+
const e = { position: "fixed", bottom: "0px", right: Ue, 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;
|
|
@@ -171,7 +171,7 @@ const Ue = "0px", pt = (t, r, n) => {
|
|
|
171
171
|
const f = () => {
|
|
172
172
|
c = !0, d = { margin: "auto", position: "static" };
|
|
173
173
|
};
|
|
174
|
-
if (
|
|
174
|
+
if (a) o ? f() : d = { position: "relative", height: "300px" };
|
|
175
175
|
else switch (i.framePosition) {
|
|
176
176
|
case "bottomLeft":
|
|
177
177
|
d = { left: Ue };
|
|
@@ -189,14 +189,14 @@ const Ue = "0px", pt = (t, r, n) => {
|
|
|
189
189
|
return c && ((f, g) => {
|
|
190
190
|
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 }, v = g ? f.overlayStyleMobile : f.overlayStyle;
|
|
191
191
|
y["background-color"] = v === "light" ? "rgba(255,255,255, 0.95)" : "rgba(0,0,0,0.9)", g || (y.margin = "auto"), window.UserLeap.container && Object.assign(window.UserLeap.container.style, y);
|
|
192
|
-
})(i, n), Object.assign(
|
|
193
|
-
}, Vt = ({ productConfig:
|
|
192
|
+
})(i, n), Object.assign(r.style, e, d), c;
|
|
193
|
+
}, Vt = ({ productConfig: r, useMobileStyling: t, surveyId: n, isFeedback: a, enableCspTrustedTypes: e }) => {
|
|
194
194
|
var g, y;
|
|
195
|
-
const i = Te,
|
|
196
|
-
pt(n,
|
|
195
|
+
const i = Te, s = a && r.desktopDisplay === "slider";
|
|
196
|
+
pt(n, a, s), Wt();
|
|
197
197
|
const o = document.createElement("iframe");
|
|
198
198
|
o.id = i, o.setAttribute("title", "Sprig User Feedback Dialog");
|
|
199
|
-
const d = zt(o,
|
|
199
|
+
const d = zt(o, r, t, a);
|
|
200
200
|
wt();
|
|
201
201
|
let c = !1;
|
|
202
202
|
o.setHeight = (v) => {
|
|
@@ -205,11 +205,11 @@ const Ue = "0px", pt = (t, r, n) => {
|
|
|
205
205
|
let l = !1;
|
|
206
206
|
o.setWidth = (v) => {
|
|
207
207
|
parseInt(o.style.width) == v && l || (l = !0, o.style.width = `${v}px`, w.emit(u.SurveyWidth, { name: u.SurveyWidth, contentFrameWidth: v, "survey.id": n }));
|
|
208
|
-
}, (g = window.UserLeap.container) == null || g.appendChild(o),
|
|
208
|
+
}, (g = window.UserLeap.container) == null || g.appendChild(o), r && (t ? r.exitOnOverlayClickMobile : r.exitOnOverlayClick) && window.UserLeap.container && (window.UserLeap.container.onclick = () => {
|
|
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(Ce("<!doctype html><head></head><body></body></html>", e, o.contentWindow)), p.close(), !
|
|
212
|
+
if (p && (p.open("text/html", "replace"), p.write(Ce("<!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
|
}
|
|
@@ -218,150 +218,143 @@ const Ue = "0px", pt = (t, r, n) => {
|
|
|
218
218
|
}, gt = { [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(gt).forEach(([
|
|
222
|
-
w.on(
|
|
221
|
+
Object.entries(gt).forEach(([r, t]) => {
|
|
222
|
+
w.on(r, t);
|
|
223
223
|
});
|
|
224
224
|
}, Bt = () => {
|
|
225
|
-
Object.entries(gt).forEach(([
|
|
226
|
-
w.off(
|
|
225
|
+
Object.entries(gt).forEach(([r, t]) => {
|
|
226
|
+
w.off(r, t);
|
|
227
227
|
});
|
|
228
|
-
},
|
|
229
|
-
const e =
|
|
228
|
+
}, F = (r) => !!r && r.nodeType === Node.ELEMENT_NODE, Xe = (r) => r instanceof HTMLElement || r instanceof SVGElement, le = ({ document: r, elementId: t, styleString: n, nonce: a }) => {
|
|
229
|
+
const e = r.getElementById(t);
|
|
230
230
|
if (e) return void (e.textContent = n);
|
|
231
|
-
const i =
|
|
232
|
-
|
|
233
|
-
},
|
|
234
|
-
const n =
|
|
235
|
-
if (!
|
|
236
|
-
const
|
|
237
|
-
return
|
|
238
|
-
},
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}, $t = (t, r, n) => {
|
|
244
|
-
const s = t.querySelector(".ul-card__container"), e = t.querySelector(".ul-app");
|
|
245
|
-
let i = 600, a = 360, o = 0;
|
|
246
|
-
if (P(s) && P(e)) {
|
|
247
|
-
const d = s.querySelector(".ul-card--matrix_grid"), c = !d && r && n;
|
|
231
|
+
const i = r.createElement("style");
|
|
232
|
+
a && (i.nonce = a), i.textContent = n, i.id = t, r.head.appendChild(i);
|
|
233
|
+
}, Ze = (r, t) => {
|
|
234
|
+
const n = t.querySelector(r);
|
|
235
|
+
if (!F(n)) return 0;
|
|
236
|
+
const a = getComputedStyle(n);
|
|
237
|
+
return parseFloat(a.paddingLeft) + parseFloat(a.paddingRight) + (parseFloat(a.marginLeft) + parseFloat(a.marginRight)) + (parseFloat(a.borderLeftWidth) + parseFloat(a.borderRightWidth));
|
|
238
|
+
}, Nt = (r, t, n) => {
|
|
239
|
+
const a = r.querySelector(".ul-card__container"), e = r.querySelector(".ul-app");
|
|
240
|
+
let i = 600, s = 360;
|
|
241
|
+
if (F(a) && F(e)) {
|
|
242
|
+
const o = a.querySelector(".ul-card--matrix_grid"), d = !o && t && n;
|
|
248
243
|
try {
|
|
249
|
-
|
|
250
|
-
const
|
|
244
|
+
d && (e.style.width = "360px"), i = a.scrollHeight, i += ((p) => {
|
|
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");
|
|
251
246
|
let h = 0;
|
|
252
|
-
return
|
|
253
|
-
})(
|
|
254
|
-
const
|
|
255
|
-
o =
|
|
256
|
-
const p = parseFloat(l.marginTop) + parseFloat(l.marginBottom);
|
|
257
|
-
i += p + (parseFloat(l.borderTopWidth) + parseFloat(l.borderBottomWidth)), d && (a = d.scrollWidth, a += Ze(".ul-card__container", t), a += Ze(".sprig-question-body", t));
|
|
247
|
+
return F(g) && (h += g.scrollHeight - g.clientHeight), F(y) && (h += y.scrollHeight - y.clientHeight), F(f) && (h += f.scrollHeight - f.clientHeight), F(v) && F(m) && m.clientHeight === 0 && (h += v.clientHeight), h;
|
|
248
|
+
})(r);
|
|
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 += Ze(".ul-card__container", r), s += Ze(".sprig-question-body", r));
|
|
258
251
|
} finally {
|
|
259
|
-
|
|
252
|
+
d && e.style.removeProperty("width");
|
|
260
253
|
}
|
|
261
254
|
}
|
|
262
|
-
return [i + 2,
|
|
263
|
-
},
|
|
264
|
-
const
|
|
265
|
-
|
|
255
|
+
return [i + 2, s];
|
|
256
|
+
}, yr = (r) => {
|
|
257
|
+
const t = r.querySelector(".ul-card__container");
|
|
258
|
+
t && (t.scrollTop = 0);
|
|
266
259
|
}, yt = () => L, Q = () => document.getElementById("sprig-feedback-container"), Ee = () => document.getElementById("sprig-feedback-loading-animation"), mt = () => !!document.getElementById(Te);
|
|
267
260
|
let et = !1, L = null, C = null, Pe = !1, ee = null, $ = null;
|
|
268
|
-
const
|
|
269
|
-
var
|
|
270
|
-
const
|
|
271
|
-
return ((
|
|
261
|
+
const $t = ["bottom-left", "bottom-right", "center-left", "center-right"], ce = () => {
|
|
262
|
+
var t;
|
|
263
|
+
const r = window.UserLeap.container;
|
|
264
|
+
return ((t = r == null ? void 0 : r.parentElement) == null ? void 0 : t.id) === "sprig-feedback-loading-container";
|
|
272
265
|
}, ft = () => document.getElementById("sprig-feedback-error-container"), vt = () => {
|
|
273
266
|
if (!L) return 0;
|
|
274
|
-
const
|
|
275
|
-
return
|
|
276
|
-
}, pe = (
|
|
277
|
-
const
|
|
278
|
-
|
|
267
|
+
const r = L == null ? void 0 : L.clientWidth, t = window.getComputedStyle(L);
|
|
268
|
+
return r + parseInt(t.borderRightWidth || "0") + parseInt(t.borderLeftWidth || "0");
|
|
269
|
+
}, pe = (r) => {
|
|
270
|
+
const t = Q();
|
|
271
|
+
t && ($ != null && $.endsWith("right") ? t.style.right = `${r}px` : $ != null && $.endsWith("left") && (t.style.left = `${r}px`));
|
|
279
272
|
}, Se = () => {
|
|
280
273
|
if (L && (ce() || ft())) {
|
|
281
274
|
w.off(u.SurveyAppeared, X), _e();
|
|
282
|
-
const
|
|
283
|
-
return pe(-
|
|
275
|
+
const r = vt();
|
|
276
|
+
return pe(-r), !0;
|
|
284
277
|
}
|
|
285
278
|
return !1;
|
|
286
279
|
}, X = () => {
|
|
287
280
|
if (!L || !C) return;
|
|
288
|
-
const
|
|
289
|
-
|
|
281
|
+
const r = Ee();
|
|
282
|
+
r && r.remove(), L.style.height = "auto", L.style.width = "auto", C.disabled = !1, Pe = !1;
|
|
290
283
|
}, _e = () => {
|
|
291
284
|
if (L && !Ee()) {
|
|
292
|
-
const
|
|
285
|
+
const r = (() => {
|
|
293
286
|
var n;
|
|
294
287
|
if (Ee()) return;
|
|
295
|
-
const
|
|
296
|
-
return
|
|
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 = Ce(`
|
|
297
290
|
<div class="ul-loading-spinner">
|
|
298
291
|
<div class="first"></div>
|
|
299
292
|
<div class="second"></div>
|
|
300
293
|
<div class="third"></div>
|
|
301
294
|
<div class="fourth"></div>
|
|
302
295
|
</div>
|
|
303
|
-
`, (n = window.UserLeap._config) == null ? void 0 : n.enableCspTrustedTypes),
|
|
296
|
+
`, (n = window.UserLeap._config) == null ? void 0 : n.enableCspTrustedTypes), t;
|
|
304
297
|
})();
|
|
305
|
-
|
|
298
|
+
r && (L.style.height = "300px", L.style.width = "360px", L.appendChild(r));
|
|
306
299
|
}
|
|
307
300
|
}, tt = () => {
|
|
308
301
|
L && C && (pe(0), C.disabled = !0, Pe = !0);
|
|
309
|
-
}, ht = async (
|
|
310
|
-
const { buttonTheme:
|
|
302
|
+
}, ht = async (r, t, n) => {
|
|
303
|
+
const { buttonTheme: a, customStyles: e, eventId: i, placement: s, desktopDisplay: o, feedbackLabel: d, surveyUuid: c, surveyId: l } = r;
|
|
311
304
|
window.UserLeap.feedbackCustomStyles = void 0;
|
|
312
305
|
let p = Q();
|
|
313
306
|
if (p) {
|
|
314
|
-
if (!
|
|
307
|
+
if (!t && i === ee) return;
|
|
315
308
|
p.remove(), w.off(ie.SURVEY_FADING_OUT, Se);
|
|
316
309
|
}
|
|
317
|
-
ee = i, le({ 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 }), le({ document, elementId: "ul-custom-style", styleString: e ?? "", nonce: window.UserLeap.styleNonce }), et = o === "center-modal", $ =
|
|
318
|
-
const [f, g] =
|
|
319
|
-
((
|
|
320
|
-
if (Q() ||
|
|
321
|
-
const [
|
|
322
|
-
E.id = "sprig-feedback-container", E.classList.add(`sprig-feedback-container-${
|
|
323
|
-
})(
|
|
310
|
+
ee = i, le({ 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 }), le({ document, elementId: "ul-custom-style", styleString: e ?? "", nonce: window.UserLeap.styleNonce }), et = o === "center-modal", $ = s;
|
|
311
|
+
const [f, g] = s.split("-");
|
|
312
|
+
((h) => {
|
|
313
|
+
if (Q() || !$t.includes(h)) return;
|
|
314
|
+
const [k, U] = h.split("-"), E = document.createElement("div");
|
|
315
|
+
E.id = "sprig-feedback-container", E.classList.add(`sprig-feedback-container-${U}`, `sprig-feedback-container-${k}`), document.body.appendChild(E);
|
|
316
|
+
})(s), p = Q(), C = document.createElement("button");
|
|
324
317
|
const y = document.createElement("div");
|
|
325
|
-
y.className = "sprig-feedback-button-label", y.innerText = d, C.appendChild(y), C.id = "sprig-feedback-button", C.classList.add(`sprig-feedback-button-${g}`, `sprig-feedback-button-${f}`, `sprig-feedback-button-${
|
|
326
|
-
const
|
|
318
|
+
y.className = "sprig-feedback-button-label", y.innerText = d, C.appendChild(y), C.id = "sprig-feedback-button", C.classList.add(`sprig-feedback-button-${g}`, `sprig-feedback-button-${f}`, `sprig-feedback-button-${a}`, "fade-in-transition"), w.on(ie.SURVEY_FADING_OUT, Se), C.addEventListener("click", async () => {
|
|
319
|
+
const h = document.getElementById("sprig-feedback-error-container");
|
|
327
320
|
if (mt() || ft()) {
|
|
328
321
|
if (Se()) {
|
|
329
|
-
w.emit(u.SurveyCloseRequested, { name: u.SurveyCloseRequested, initiator:
|
|
330
|
-
const
|
|
331
|
-
|
|
322
|
+
w.emit(u.SurveyCloseRequested, { name: u.SurveyCloseRequested, initiator: P.FeedbackClosed, studyType: "feedbackButton", "survey.id": l }), w.emit(u.SurveyWillClose, { name: u.SurveyWillClose, initiator: P.FeedbackClosed, studyType: "feedbackButton", "survey.id": l });
|
|
323
|
+
const U = Q();
|
|
324
|
+
h && U && (U.remove(), ee = null, L = null);
|
|
332
325
|
}
|
|
333
326
|
return;
|
|
334
327
|
}
|
|
335
|
-
if (fe(T(window.UserLeap)) || Pe || tt(),
|
|
336
|
-
const
|
|
337
|
-
const E = await O(D("1", [
|
|
328
|
+
if (fe(T(window.UserLeap)) || Pe || tt(), t) return L && L.classList.add("sprig-feedback-loading-container-previews"), await Z(t), void X();
|
|
329
|
+
const k = await (async (U) => {
|
|
330
|
+
const E = await O(D("1", [q], "startFeedbackStudy"), { body: JSON.stringify({ surveyUuid: U }), method: "POST" });
|
|
338
331
|
return E.ok ? E.json : null;
|
|
339
332
|
})(c);
|
|
340
|
-
if (
|
|
333
|
+
if (k) w.once(u.SurveyAppeared, X), Z({ ...k, studyType: "feedbackButton" }, n);
|
|
341
334
|
else if (L) {
|
|
342
|
-
const
|
|
343
|
-
L.appendChild(
|
|
335
|
+
const U = Gt();
|
|
336
|
+
L.appendChild(U), X(), L.style.height = "300px", L.style.width = "360px";
|
|
344
337
|
}
|
|
345
338
|
}), p == null || p.appendChild(C), w.emit(u.FeedbackButtonLoaded, { name: u.FeedbackButtonLoaded, "survey.id": l });
|
|
346
339
|
const { useMobileStyling: v, _config: { border: m } } = window.UserLeap;
|
|
347
340
|
if (et || v) pe(0);
|
|
348
341
|
else {
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
const
|
|
352
|
-
pe(-
|
|
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, _e(), p == null || p.appendChild(h);
|
|
344
|
+
const k = vt();
|
|
345
|
+
pe(-k);
|
|
353
346
|
}
|
|
354
|
-
window.UserLeap._config.isOnQuestionsTab &&
|
|
355
|
-
},
|
|
347
|
+
window.UserLeap._config.isOnQuestionsTab && t && !ce() && L && (tt(), _e(), L && L.classList.add("sprig-feedback-loading-container-previews"), Z(t), X());
|
|
348
|
+
}, Gt = () => {
|
|
356
349
|
var n;
|
|
357
|
-
const
|
|
358
|
-
|
|
350
|
+
const r = document.createElement("div");
|
|
351
|
+
r.id = "sprig-feedback-error-container", r.innerHTML = Ce(`<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
|
|
359
352
|
<circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
|
|
360
353
|
<path d="M20 12L20 21.6" stroke="#B0B5B7" stroke-width="3" stroke-linecap="round"/>
|
|
361
354
|
<circle cx="19.9984" cy="27.6" r="1.6" fill="#B0B5B7"/>
|
|
362
355
|
</svg>`, (n = window.UserLeap._config) == null ? void 0 : n.enableCspTrustedTypes);
|
|
363
|
-
const
|
|
364
|
-
return
|
|
356
|
+
const t = document.createElement("h3");
|
|
357
|
+
return t.className = "sprig-feedback-error-text", t.innerText = "There was an error while loading the survey", r.appendChild(t), r;
|
|
365
358
|
}, Re = new class {
|
|
366
359
|
constructor() {
|
|
367
360
|
N(this, "_ldData", {});
|
|
@@ -369,13 +362,13 @@ const Gt = ["bottom-left", "bottom-right", "center-left", "center-right"], ce =
|
|
|
369
362
|
getAllLaunchDarklyVariations() {
|
|
370
363
|
return this._ldData;
|
|
371
364
|
}
|
|
372
|
-
setLDFlagsVariations(
|
|
365
|
+
setLDFlagsVariations(r) {
|
|
373
366
|
try {
|
|
374
|
-
return !(!
|
|
375
|
-
delete this._ldData[
|
|
376
|
-
}), Object.keys(
|
|
377
|
-
} catch (
|
|
378
|
-
return
|
|
367
|
+
return !(!r || typeof r != "object" || Array.isArray(r)) && (Object.keys(this._ldData).forEach((t) => {
|
|
368
|
+
delete this._ldData[t];
|
|
369
|
+
}), Object.keys(r).forEach((t) => this._ldData[`!launch_darkly_${t}`] = (r[t] ?? 0) + 1), !0);
|
|
370
|
+
} catch (t) {
|
|
371
|
+
return t instanceof Error && window.UserLeap.reportError("setAllLDFlagsVariations", t), console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."), !1;
|
|
379
372
|
}
|
|
380
373
|
}
|
|
381
374
|
}();
|
|
@@ -384,60 +377,60 @@ const de = new class {
|
|
|
384
377
|
constructor() {
|
|
385
378
|
N(this, "_optimizelyData", {});
|
|
386
379
|
}
|
|
387
|
-
setOptimizelyExperiment(
|
|
388
|
-
if (!
|
|
389
|
-
const { experiments: n } =
|
|
380
|
+
setOptimizelyExperiment(r, t = !0) {
|
|
381
|
+
if (!r || typeof r != "object") return !1;
|
|
382
|
+
const { experiments: n } = r;
|
|
390
383
|
try {
|
|
391
|
-
return
|
|
392
|
-
delete this._optimizelyData[
|
|
393
|
-
}), n && n.map((
|
|
394
|
-
const { id: e, variation: i } =
|
|
395
|
-
i && typeof i == "string" && (this._optimizelyData[
|
|
384
|
+
return t && Object.keys(this._optimizelyData).map((a) => {
|
|
385
|
+
delete this._optimizelyData[a];
|
|
386
|
+
}), n && n.map((a) => {
|
|
387
|
+
const { id: e, variation: i } = a, s = this.transformExperimentId(e);
|
|
388
|
+
i && typeof i == "string" && (this._optimizelyData[s] = i);
|
|
396
389
|
}), !0;
|
|
397
|
-
} catch (
|
|
398
|
-
return
|
|
390
|
+
} catch (a) {
|
|
391
|
+
return a instanceof Error && window.UserLeap.reportError("setOptimizelyExperiment", a), !1;
|
|
399
392
|
}
|
|
400
393
|
}
|
|
401
394
|
getAllOptimizelyExperiments() {
|
|
402
395
|
return this._optimizelyData;
|
|
403
396
|
}
|
|
404
|
-
getOptimizelyVariationName(
|
|
405
|
-
return this._optimizelyData[this.transformExperimentId(
|
|
397
|
+
getOptimizelyVariationName(r) {
|
|
398
|
+
return this._optimizelyData[this.transformExperimentId(r)];
|
|
406
399
|
}
|
|
407
|
-
transformExperimentId(
|
|
408
|
-
return "!optimizely_experiments_" +
|
|
400
|
+
transformExperimentId(r) {
|
|
401
|
+
return "!optimizely_experiments_" + r;
|
|
409
402
|
}
|
|
410
403
|
getAndSetWebOptimizelyExperiments() {
|
|
411
|
-
var
|
|
404
|
+
var r;
|
|
412
405
|
try {
|
|
413
406
|
if (window && window.optimizely && typeof window.optimizely.get == "function") {
|
|
414
|
-
const
|
|
415
|
-
if (
|
|
416
|
-
const n = Object.keys(
|
|
407
|
+
const t = (r = window.optimizely.get("state")) == null ? void 0 : r.getExperimentStates({ isActive: !0 });
|
|
408
|
+
if (t) {
|
|
409
|
+
const n = Object.keys(t).map((a) => {
|
|
417
410
|
var e, i;
|
|
418
|
-
return (e =
|
|
411
|
+
return (e = t[a].variation) != null && e.name ? { id: a, variation: (i = t[a].variation) == null ? void 0 : i.name } : { id: a, variation: "Original" };
|
|
419
412
|
});
|
|
420
413
|
return this.setOptimizelyExperiment({ experiments: n }, !1), !0;
|
|
421
414
|
}
|
|
422
415
|
return !1;
|
|
423
416
|
}
|
|
424
417
|
return !1;
|
|
425
|
-
} catch (
|
|
426
|
-
return
|
|
418
|
+
} catch (t) {
|
|
419
|
+
return t instanceof Error && window.UserLeap.reportError("getAndSetWebOptimizely", t), !1;
|
|
427
420
|
}
|
|
428
421
|
}
|
|
429
422
|
}();
|
|
430
423
|
Object.freeze(de);
|
|
431
|
-
class
|
|
432
|
-
constructor(
|
|
424
|
+
class Kt {
|
|
425
|
+
constructor(t, n) {
|
|
433
426
|
N(this, "paused");
|
|
434
427
|
N(this, "queue");
|
|
435
428
|
N(this, "ul");
|
|
436
|
-
this.ul =
|
|
429
|
+
this.ul = t, this.paused = !1, this.queue = [], this.flush(n);
|
|
437
430
|
}
|
|
438
|
-
flush(
|
|
439
|
-
const n =
|
|
440
|
-
if (n) for (let
|
|
431
|
+
flush(t) {
|
|
432
|
+
const n = t.length;
|
|
433
|
+
if (n) for (let a = 0; a < n; a++) this.push(t[a]);
|
|
441
434
|
}
|
|
442
435
|
isPaused() {
|
|
443
436
|
return this.paused;
|
|
@@ -447,198 +440,198 @@ class Jt {
|
|
|
447
440
|
}
|
|
448
441
|
unpause() {
|
|
449
442
|
this.paused = !1;
|
|
450
|
-
const
|
|
451
|
-
this.empty(), this.flush(
|
|
443
|
+
const t = this.queue.slice();
|
|
444
|
+
this.empty(), this.flush(t);
|
|
452
445
|
}
|
|
453
|
-
push(
|
|
454
|
-
if (this.paused) this.queue.push(
|
|
455
|
-
else if (
|
|
446
|
+
push(t) {
|
|
447
|
+
if (this.paused) this.queue.push(t);
|
|
448
|
+
else if (t instanceof Function) t();
|
|
456
449
|
else {
|
|
457
|
-
const n = Array.prototype.slice.call(
|
|
458
|
-
e instanceof Function ? e.apply(this.ul, n) :
|
|
450
|
+
const n = Array.prototype.slice.call(t, 1), a = t[0], e = this.ul[a];
|
|
451
|
+
e instanceof Function ? e.apply(this.ul, n) : a && console.warn("[Sprig] (ERR-100) No valid UserLeap action called", a);
|
|
459
452
|
}
|
|
460
453
|
}
|
|
461
|
-
perform(
|
|
454
|
+
perform(t) {
|
|
462
455
|
if (this.paused) {
|
|
463
456
|
let n = () => {
|
|
464
457
|
};
|
|
465
|
-
const
|
|
458
|
+
const a = new Promise(function(e) {
|
|
466
459
|
n = function() {
|
|
467
|
-
e(
|
|
460
|
+
e(t());
|
|
468
461
|
};
|
|
469
462
|
});
|
|
470
|
-
return this.queue.push(n),
|
|
463
|
+
return this.queue.push(n), a;
|
|
471
464
|
}
|
|
472
|
-
return
|
|
465
|
+
return t();
|
|
473
466
|
}
|
|
474
467
|
empty() {
|
|
475
468
|
this.queue.length = 0;
|
|
476
469
|
}
|
|
477
470
|
}
|
|
478
471
|
let bt, Lt;
|
|
479
|
-
const xe = (
|
|
480
|
-
let
|
|
481
|
-
for (; n; )
|
|
482
|
-
return
|
|
472
|
+
const xe = (r) => {
|
|
473
|
+
let t = 0, n = r.firstElementChild;
|
|
474
|
+
for (; n; ) t += xe(n), n.shadowRoot && (t += xe(n.shadowRoot)), n = n.nextElementSibling, t++;
|
|
475
|
+
return t;
|
|
483
476
|
}, rt = () => {
|
|
484
477
|
bt.report(xe(document.body)), Lt.report(document.documentElement.innerHTML.toString().length);
|
|
485
|
-
}, De = (
|
|
478
|
+
}, De = (r, t) => {
|
|
486
479
|
const n = performance.now();
|
|
487
|
-
document.hidden ? setTimeout(() => De(
|
|
488
|
-
const
|
|
489
|
-
|
|
480
|
+
document.hidden ? setTimeout(() => De(r, t), r) : setTimeout(() => {
|
|
481
|
+
const a = performance.now() - n;
|
|
482
|
+
t.report(a / 1e3), setTimeout(() => De(r, t), r);
|
|
490
483
|
}, 0);
|
|
491
484
|
};
|
|
492
485
|
let ue, we, ge, ye, it, G = {};
|
|
493
|
-
const ae = (
|
|
494
|
-
const { name: n } =
|
|
495
|
-
G[n] = (G[n] || 0) +
|
|
496
|
-
}, Ut = (
|
|
497
|
-
let
|
|
498
|
-
return
|
|
499
|
-
|
|
500
|
-
}),
|
|
501
|
-
}, nt = (
|
|
502
|
-
let
|
|
503
|
-
return
|
|
504
|
-
|
|
505
|
-
}),
|
|
506
|
-
},
|
|
507
|
-
switch (
|
|
486
|
+
const ae = (r, t = 1) => {
|
|
487
|
+
const { name: n } = r;
|
|
488
|
+
G[n] = (G[n] || 0) + t;
|
|
489
|
+
}, Ut = (r) => {
|
|
490
|
+
let t = 1;
|
|
491
|
+
return r.childNodes.forEach((n) => {
|
|
492
|
+
t += Ut(n);
|
|
493
|
+
}), t;
|
|
494
|
+
}, nt = (r) => {
|
|
495
|
+
let t = 0;
|
|
496
|
+
return r.forEach((n) => {
|
|
497
|
+
t += Ut(n);
|
|
498
|
+
}), t;
|
|
499
|
+
}, Jt = (r) => {
|
|
500
|
+
switch (r.type) {
|
|
508
501
|
case "childList":
|
|
509
|
-
return ae(ue, nt(
|
|
502
|
+
return ae(ue, nt(r.addedNodes)), void ae(we, nt(r.removedNodes));
|
|
510
503
|
case "attributes":
|
|
511
504
|
return void ae(ge);
|
|
512
505
|
case "characterData":
|
|
513
506
|
return void ae(ye);
|
|
514
507
|
}
|
|
515
|
-
},
|
|
508
|
+
}, Qt = (r) => r.forEach(Jt), Yt = () => {
|
|
516
509
|
ue.report(G[ue.name] || 0), we.report(G[we.name] || 0), ge.report(G[ge.name] || 0), ye.report(G[ye.name] || 0), G = {};
|
|
517
|
-
},
|
|
518
|
-
ue = K("sdk_mutations_nodes_added"), we = K("sdk_mutations_nodes_removed"), ge = K("sdk_mutations_attributes_changed"), ye = K("sdk_mutations_character_data"), it = new MutationObserver(
|
|
519
|
-
},
|
|
510
|
+
}, Xt = (r = 1e3) => {
|
|
511
|
+
ue = K("sdk_mutations_nodes_added"), we = K("sdk_mutations_nodes_removed"), ge = K("sdk_mutations_attributes_changed"), ye = K("sdk_mutations_character_data"), it = new MutationObserver(Qt), it.observe(document, { attributes: !0, attributeOldValue: !0, characterData: !0, characterDataOldValue: !0, childList: !0, subtree: !0 }), setInterval(Yt, r);
|
|
512
|
+
}, Zt = ({ isWeb: r, reportingIntervalSeconds: t, thresholds: n, postMetrics: a }) => {
|
|
520
513
|
Ct(n, (e, i) => {
|
|
521
|
-
var
|
|
522
|
-
if ((
|
|
514
|
+
var s, o;
|
|
515
|
+
if ((s = I.replay) != null && s.isReplayRecording()) {
|
|
523
516
|
const d = `Value: ${e} on ${i.metric} violated threshold of ${i.type} ${i.value}`;
|
|
524
|
-
(o =
|
|
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 }), Pt();
|
|
525
518
|
}
|
|
526
|
-
}), Tt({ reportingIntervalSeconds:
|
|
519
|
+
}), Tt({ reportingIntervalSeconds: t, postMetrics: a }), r && (((e = 1e3) => {
|
|
527
520
|
const i = K("sdk_event_queue_latency_seconds");
|
|
528
521
|
De(e, i);
|
|
529
522
|
})(), ((e = 1e4) => {
|
|
530
523
|
bt = K("sdk_dom_nodes_count"), Lt = K("sdk_page_html_characters"), rt(), setInterval(rt, e);
|
|
531
|
-
})(),
|
|
532
|
-
},
|
|
533
|
-
let
|
|
524
|
+
})(), Xt());
|
|
525
|
+
}, er = "test", tr = ["popState", "pushState", "replaceState"];
|
|
526
|
+
let Me, te;
|
|
534
527
|
const me = {}, Y = "!email", St = "pageUrl";
|
|
535
528
|
let Ie = window.location.href;
|
|
536
|
-
function re(
|
|
529
|
+
function re(r) {
|
|
537
530
|
var o, d;
|
|
538
|
-
const { pageUrlEvents:
|
|
531
|
+
const { pageUrlEvents: t, interactiveEvents: n, dismissOnPageChange: a, platform: e } = window.UserLeap._config;
|
|
539
532
|
if (e && e !== "web") return;
|
|
540
533
|
Ie !== window.location.href && M.navigation("LocationChange", { from: Ie, to: window.location.href }), Ie = window.location.href;
|
|
541
|
-
const i = Et().trackStartUrl,
|
|
542
|
-
|
|
534
|
+
const i = Et().trackStartUrl, s = i ? String(i) : null;
|
|
535
|
+
t && Rt(window.location.href), n && (kt(), rr()), yt() && (() => {
|
|
543
536
|
if (ce()) return;
|
|
544
537
|
const c = Q();
|
|
545
538
|
c && (Ot(ee) || (c.remove(), ee = null, L = null));
|
|
546
|
-
})(),
|
|
539
|
+
})(), jt.getItem("sprig.isCapturingHeatmap") && ((d = (o = I.replay) == null ? void 0 : o.checkPendingHeatmapsUrl()) == null || d.then((c) => {
|
|
547
540
|
var l;
|
|
548
|
-
c && ((l =
|
|
549
|
-
})), !ce() &&
|
|
541
|
+
c && ((l = I.replay) == null || l.uploadReadyPendingCaptures(!0));
|
|
542
|
+
})), !ce() && a && s && s !== window.location.href && r && tr.includes(r.type) && window.UserLeap("dismissActiveSurvey", P.PageChange);
|
|
550
543
|
}
|
|
551
|
-
const It = { capture: !0 },
|
|
552
|
-
const
|
|
553
|
-
const { name:
|
|
544
|
+
const It = { capture: !0 }, rr = () => {
|
|
545
|
+
const r = window.UserLeap._config.interactiveEvents.filter((n) => lt(n, window.location.href)).map((n) => {
|
|
546
|
+
const { name: a, properties: e } = n, { selector: i, innerText: s } = e;
|
|
554
547
|
return i ? (o) => {
|
|
555
548
|
if (Xe(o.target)) try {
|
|
556
|
-
o.target.closest(i) && window.UserLeap("track",
|
|
549
|
+
o.target.closest(i) && window.UserLeap("track", a);
|
|
557
550
|
} catch {
|
|
558
551
|
}
|
|
559
552
|
return !1;
|
|
560
|
-
} : (o) => (Xe(o.target) && o.target.innerText ===
|
|
561
|
-
}),
|
|
562
|
-
window.UserLeap._config.interactiveEventsHandler =
|
|
553
|
+
} : (o) => (Xe(o.target) && o.target.innerText === s && window.UserLeap("track", a), !1);
|
|
554
|
+
}), t = (n) => r.forEach((a) => a(n));
|
|
555
|
+
window.UserLeap._config.interactiveEventsHandler = t, window.addEventListener("click", t, It);
|
|
563
556
|
}, kt = () => {
|
|
564
557
|
window.UserLeap._config.interactiveEventsHandler && window.removeEventListener("click", window.UserLeap._config.interactiveEventsHandler, It), delete window.UserLeap._config.interactiveEventsHandler;
|
|
565
558
|
};
|
|
566
559
|
function Et() {
|
|
567
|
-
const
|
|
568
|
-
return
|
|
560
|
+
const r = R.getItemObject("userleap.ids");
|
|
561
|
+
return r && r[window.UserLeap.envId] || {};
|
|
569
562
|
}
|
|
570
563
|
function _t() {
|
|
571
564
|
if (window.previewMode) return;
|
|
572
|
-
const
|
|
573
|
-
window.UserLeap.visitorId =
|
|
565
|
+
const r = R.getItemObject("sprig.anon.env.vid.map") || {}, t = r[window.UserLeap.envId];
|
|
566
|
+
window.UserLeap.visitorId = t || at(), M.info("NewVid", { vid: window.UserLeap.visitorId }), _("vid", window.UserLeap.visitorId), t || (r[window.UserLeap.envId] = window.UserLeap.visitorId, R.setItemObject("sprig.anon.env.vid.map", r)), w.emit(u.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId });
|
|
574
567
|
}
|
|
575
|
-
function Rt(
|
|
568
|
+
function Rt(r, t, n, a) {
|
|
576
569
|
var e, i;
|
|
577
570
|
try {
|
|
578
|
-
if (
|
|
579
|
-
M.info("PageView", { url:
|
|
580
|
-
const
|
|
581
|
-
(i =
|
|
571
|
+
if (r.endsWith("mock_snippet.html")) return;
|
|
572
|
+
M.info("PageView", { url: r });
|
|
573
|
+
const s = (e = document == null ? void 0 : document.querySelector('meta[name="description"]')) == null ? void 0 : e.getAttribute("content");
|
|
574
|
+
(i = I.replay) == null || i.RecordPageView({ ...s && { description: s }, url: r, referrer: document.referrer, pageTitle: document.title });
|
|
582
575
|
const o = window.UserLeap._config.pageUrlEvents;
|
|
583
576
|
let d = !1;
|
|
584
|
-
if (o && o.length) for (let l = 0; l < o.length && (d = lt(o[l],
|
|
577
|
+
if (o && o.length) for (let l = 0; l < o.length && (d = lt(o[l], r), !d); l++) ;
|
|
585
578
|
if (!d) return;
|
|
586
|
-
window.UserLeap.debugMode && console.info("[DEBUG] Sprig trackPageView",
|
|
587
|
-
const c = { url:
|
|
588
|
-
|
|
589
|
-
} catch (
|
|
590
|
-
|
|
579
|
+
window.UserLeap.debugMode && console.info("[DEBUG] Sprig trackPageView", r);
|
|
580
|
+
const c = { url: r };
|
|
581
|
+
a && (c.trackPageView = !0), window.UserLeap._queue.push(["track", St, t, c, n]);
|
|
582
|
+
} catch (s) {
|
|
583
|
+
s instanceof Error && (s.stack = r, window.UserLeap.reportError("trackPageView", s)), console.warn("[Sprig] (ERR-428) Failed to track page view", s);
|
|
591
584
|
}
|
|
592
585
|
}
|
|
593
|
-
function
|
|
594
|
-
const
|
|
595
|
-
"pushState" in
|
|
596
|
-
const
|
|
597
|
-
return window.dispatchEvent(e), re(e),
|
|
598
|
-
})(
|
|
599
|
-
const
|
|
600
|
-
return window.dispatchEvent(e), re(e),
|
|
601
|
-
})(
|
|
586
|
+
function ir() {
|
|
587
|
+
const r = "Backbone" in window && window.Backbone && window.Backbone.history ? window.Backbone.history : window.history;
|
|
588
|
+
"pushState" in r && (r.pushState = /* @__PURE__ */ ((t) => function(...n) {
|
|
589
|
+
const a = t.apply(this, n), e = new Event("pushState");
|
|
590
|
+
return window.dispatchEvent(e), re(e), a;
|
|
591
|
+
})(r.pushState)), "replaceState" in r && (r.replaceState = /* @__PURE__ */ ((t) => function(...n) {
|
|
592
|
+
const a = t.apply(this, n), e = new Event("replaceState");
|
|
593
|
+
return window.dispatchEvent(e), re(e), a;
|
|
594
|
+
})(r.replaceState)), ["hashchange", "popstate"].forEach((t) => window.addEventListener(t, re, !0));
|
|
602
595
|
}
|
|
603
|
-
async function ke(
|
|
596
|
+
async function ke(r, t) {
|
|
604
597
|
const n = Oe();
|
|
605
|
-
|
|
606
|
-
const
|
|
607
|
-
const
|
|
598
|
+
r && !t && (window.UserLeap._config.mode = er);
|
|
599
|
+
const a = fe(T(window.UserLeap)), e = await O(function(i) {
|
|
600
|
+
const s = new URL(D("1", [H], "questions"));
|
|
608
601
|
return Object.entries(i || {}).forEach(([o, d]) => {
|
|
609
|
-
d &&
|
|
610
|
-
}),
|
|
611
|
-
}({ desktopDisplay: window.UserLeap._config.desktopDisplay, isMobile:
|
|
602
|
+
d && s.searchParams.append(o, String(d));
|
|
603
|
+
}), s.toString();
|
|
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 });
|
|
612
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" };
|
|
613
|
-
if (e.json.delay && await ct(e.json.delay), !e.json.isFeedback) return Z(e.json, te,
|
|
606
|
+
if (e.json.delay && await ct(e.json.delay), !e.json.isFeedback) return Z(e.json, te, Me);
|
|
614
607
|
{
|
|
615
|
-
const { feedbackLabel: i, productConfig:
|
|
616
|
-
ht({ customStyles: d, buttonTheme: c, desktopDisplay: p, eventId: 0, feedbackLabel: i, placement: l, surveyUuid: o, surveyId:
|
|
608
|
+
const { feedbackLabel: i, productConfig: s, surveyUuid: o, feedbackCustomStyles: d } = e.json, { buttonTheme: c, placement: l, desktopDisplay: p } = s;
|
|
609
|
+
ht({ customStyles: d, buttonTheme: c, desktopDisplay: p, eventId: 0, feedbackLabel: i, placement: l, surveyUuid: o, surveyId: r == null ? void 0 : r.surveyId }, e.json);
|
|
617
610
|
}
|
|
618
611
|
}
|
|
619
|
-
function
|
|
620
|
-
if (!
|
|
621
|
-
window.UserLeap._config =
|
|
622
|
-
const { interactiveEvents:
|
|
623
|
-
|
|
612
|
+
function nr(r) {
|
|
613
|
+
if (!r) return;
|
|
614
|
+
window.UserLeap._config = r, r.mute && window.UserLeap._queue.pause();
|
|
615
|
+
const { interactiveEvents: t, pageUrlEvents: n, dismissOnPageChange: a } = r;
|
|
616
|
+
t && function(e) {
|
|
624
617
|
let i = e.length;
|
|
625
618
|
for (; i; ) {
|
|
626
|
-
const
|
|
619
|
+
const s = Math.floor(Math.random() * i);
|
|
627
620
|
i -= 1;
|
|
628
621
|
const o = e[i];
|
|
629
|
-
e[i] = e[
|
|
622
|
+
e[i] = e[s], e[s] = o;
|
|
630
623
|
}
|
|
631
|
-
}(
|
|
624
|
+
}(t), (t || n || a) && (ir(), re());
|
|
632
625
|
}
|
|
633
|
-
const
|
|
626
|
+
const or = function(r) {
|
|
634
627
|
if (!window.UserLeap) return;
|
|
635
|
-
const
|
|
636
|
-
var
|
|
637
|
-
const { userId: i, anonymousId:
|
|
628
|
+
const t = async (e = {}) => {
|
|
629
|
+
var h, k, U, E, z;
|
|
630
|
+
const { userId: i, anonymousId: s, metadata: o = {}, properties: d, showSurveyCallback: c } = e;
|
|
638
631
|
let { eventName: l } = e;
|
|
639
|
-
if (window.UserLeap.debugMode && l !== St && console.info("[DEBUG] Sprig track", e),
|
|
632
|
+
if (window.UserLeap.debugMode && l !== St && console.info("[DEBUG] Sprig track", e), r.mode === "test") return;
|
|
640
633
|
const p = R.getItem("sprig.previewKey") ?? void 0;
|
|
641
|
-
if (
|
|
634
|
+
if (r.requireUserIdForTracking && !window.UserLeap.userId && !i) {
|
|
642
635
|
const b = "[Sprig] - Skipping tracking without userId";
|
|
643
636
|
return console.warn(b), { success: !1, message: b, surveyState: "no survey" };
|
|
644
637
|
}
|
|
@@ -648,49 +641,49 @@ const sr = function(t) {
|
|
|
648
641
|
return console.warn(b), { success: !1, message: b, surveyState: "no survey" };
|
|
649
642
|
}
|
|
650
643
|
const f = te ?? window.location.href;
|
|
651
|
-
o.url || (o.url = f), _("trackStartUrl", f), (
|
|
652
|
-
const g = window.UserLeap.delayingSurvey || mt() ? await O(D("1", [
|
|
644
|
+
o.url || (o.url = f), _("trackStartUrl", f), (k = (h = window.UserLeap) == null ? void 0 : h._config) != null && k.optimizelyEnabled && (ne(T(window.UserLeap)) || de.getAndSetWebOptimizelyExperiments(), o.optimizelyExperiments = Object.assign({}, de.getAllOptimizelyExperiments())), (E = (U = window.UserLeap) == null ? void 0 : U._config) != null && E.launchDarklyEnabled && (o.launchDarklyFlags = Re.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 }), M.info("TrackEvent", { eventName: l });
|
|
645
|
+
const g = window.UserLeap.delayingSurvey || mt() ? await O(D("1", [q], "events/batch"), { body: JSON.stringify({ events: [{ event: l, metadata: o }], previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 }) : await O(D("1", [q], "events"), { body: JSON.stringify({ event: l, metadata: o, previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 });
|
|
653
646
|
if (!g.ok) {
|
|
654
647
|
const b = "[Sprig] (ERR-421) Failed to track event";
|
|
655
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" };
|
|
656
649
|
}
|
|
657
|
-
i && _("uid", i),
|
|
650
|
+
i && _("uid", i), s && _("aid", s);
|
|
658
651
|
const y = g.json;
|
|
659
652
|
y.invalidPreviewKey && R.removeItem("sprig.previewKey");
|
|
660
653
|
const v = o.trackPageView ? o.url : void 0;
|
|
661
654
|
return y != null && y.feedbackButton && ht(y.feedbackButton, void 0, v), await async function(b, V) {
|
|
662
|
-
var W,
|
|
655
|
+
var W, j;
|
|
663
656
|
let A = !0;
|
|
664
|
-
return !(V && ((W = b == null ? void 0 : b.json) != null && W.surveyId) && (window.UserLeap.delayingSurvey = !0, A = await V(b.json.surveyId), window.UserLeap.delayingSurvey = !1, !A)) && ((
|
|
657
|
+
return !(V && ((W = b == null ? void 0 : b.json) != null && W.surveyId) && (window.UserLeap.delayingSurvey = !0, A = await V(b.json.surveyId), window.UserLeap.delayingSurvey = !1, !A)) && ((j = b == null ? void 0 : b.json) != null && j.delay && !window.UserLeap.isMobileSDK && (window.UserLeap.delayingSurvey = !0, await ct(b.json.delay), window.UserLeap.delayingSurvey = !1), A);
|
|
665
658
|
}(g, c) ? function(b) {
|
|
666
659
|
if (!window.UserLeap._config.dismissOnPageChange) return !0;
|
|
667
660
|
const V = new URL(b), A = new URL(te ?? window.location.href);
|
|
668
661
|
return V.hostname === A.hostname && V.pathname === A.pathname;
|
|
669
|
-
}(f) ? Z(y, v,
|
|
662
|
+
}(f) ? Z(y, v, Me) : { 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" };
|
|
670
663
|
}, n = (e, i) => {
|
|
671
664
|
var o;
|
|
672
|
-
const
|
|
673
|
-
|
|
674
|
-
},
|
|
675
|
-
window.UserLeap("dismissActiveSurvey",
|
|
665
|
+
const s = (o = e == null ? void 0 : e.querySelector(`[id="${Te}"]`)) == null ? void 0 : o.contentDocument;
|
|
666
|
+
s && le({ 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", P.Override), ke({ surveyId: e }, !0)), _previewSurvey(e) {
|
|
668
|
+
window.UserLeap("dismissActiveSurvey", P.Override), ke({ surveyTemplateId: e }, !1);
|
|
676
669
|
}, _reviewSurvey(e) {
|
|
677
|
-
window.UserLeap("dismissActiveSurvey",
|
|
670
|
+
window.UserLeap("dismissActiveSurvey", P.Override), ke({ surveyId: e }, !1);
|
|
678
671
|
}, previewSurvey(e) {
|
|
679
|
-
|
|
672
|
+
a._previewSurvey(e);
|
|
680
673
|
}, reviewSurvey(e) {
|
|
681
|
-
|
|
674
|
+
a._reviewSurvey(e);
|
|
682
675
|
}, mute() {
|
|
683
676
|
window.UserLeap._queue.pause();
|
|
684
677
|
}, unmute() {
|
|
685
678
|
window.UserLeap._queue.unpause();
|
|
686
679
|
}, setVisitorToken() {
|
|
687
680
|
console.warn("[Sprig] setVisitorToken is deprecated.");
|
|
688
|
-
}, dismissActiveSurvey(e =
|
|
689
|
-
window.UserLeap.container && (e ===
|
|
681
|
+
}, dismissActiveSurvey(e = P.API) {
|
|
682
|
+
window.UserLeap.container && (e === P.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) }));
|
|
690
683
|
}, async setAttribute(e, i) {
|
|
691
684
|
if (!e || !i && i !== 0 && i !== !1) {
|
|
692
|
-
const
|
|
693
|
-
return console.warn(
|
|
685
|
+
const s = "[Sprig] - Disregarding empty attribute / value provided";
|
|
686
|
+
return console.warn(s), { success: !1, message: s };
|
|
694
687
|
}
|
|
695
688
|
return this.setAttributes({ [e]: i });
|
|
696
689
|
}, async setAttributes(e) {
|
|
@@ -700,13 +693,13 @@ const sr = function(t) {
|
|
|
700
693
|
}
|
|
701
694
|
return this.identifyAndSetAttributes({ attributes: e });
|
|
702
695
|
}, async identifyAndSetAttributes(e) {
|
|
703
|
-
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig identifyAndSetAttributes", e),
|
|
696
|
+
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig identifyAndSetAttributes", e), r.mode === "test") return;
|
|
704
697
|
if (e === null || typeof e != "object" || !(e.userId || e.anonymousId || e.attributes)) {
|
|
705
698
|
const l = "[Sprig] - Disregarding empty payload provided";
|
|
706
699
|
return console.warn(l), { success: !1, message: l };
|
|
707
700
|
}
|
|
708
|
-
const { userId: i, anonymousId:
|
|
709
|
-
if (
|
|
701
|
+
const { userId: i, anonymousId: s, attributes: o } = e;
|
|
702
|
+
if (r.requireUserIdForTracking && !window.UserLeap.userId && !i) {
|
|
710
703
|
const l = "[Sprig] - Skipping tracking without userId";
|
|
711
704
|
return console.warn(l), { success: !1, message: l };
|
|
712
705
|
}
|
|
@@ -715,21 +708,21 @@ const sr = function(t) {
|
|
|
715
708
|
const l = Object.keys(o);
|
|
716
709
|
for (const p of l) o[p] === me[p] && delete o[p];
|
|
717
710
|
}
|
|
718
|
-
if (!(o && Object.keys(o).length !== 0 || i && window.UserLeap.userId !== i ||
|
|
711
|
+
if (!(o && Object.keys(o).length !== 0 || i && window.UserLeap.userId !== i || s && window.UserLeap.partnerAnonymousId !== s)) return { success: !0 };
|
|
719
712
|
const d = {};
|
|
720
713
|
let c;
|
|
721
|
-
return i && (d.userId = window.UserLeap.userId = i),
|
|
714
|
+
return i && (d.userId = window.UserLeap.userId = i), s && (d.partnerAnonymousId = window.UserLeap.partnerAnonymousId = s), o && Object.keys(o).length > 0 ? (c = await O(D("1", [H, q], "attributes"), { body: JSON.stringify(o), method: "PUT" }), c.ok ? Object.assign(me, o) : c.reportError && (console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed", c.error), c.error && window.UserLeap.reportError("identifyAndSetAttributes", c.error))) : c = await O(D("1", [H, q]), { body: JSON.stringify(d), method: "PUT" }), o && o[Y] && (window.UserLeap.email = o[Y]), c.ok && (i && _("uid", i), s && _("aid", s)), { success: !!c.ok };
|
|
722
715
|
}, async removeAttributes(e) {
|
|
723
|
-
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig removeAttributes", e),
|
|
716
|
+
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig removeAttributes", e), r.mode === "test") return;
|
|
724
717
|
if (e == null || e.length === 0) {
|
|
725
|
-
const
|
|
726
|
-
return console.warn(
|
|
718
|
+
const s = "[Sprig] - Disregarding empty attributes provided";
|
|
719
|
+
return console.warn(s), { success: !1, message: s };
|
|
727
720
|
}
|
|
728
|
-
if (
|
|
729
|
-
const
|
|
730
|
-
return console.warn(
|
|
721
|
+
if (r.requireUserIdForTracking && !window.UserLeap.userId) {
|
|
722
|
+
const s = "[Sprig] - Skipping tracking without userId";
|
|
723
|
+
return console.warn(s), { success: !1, message: s };
|
|
731
724
|
}
|
|
732
|
-
const i = await O(D("1", [H,
|
|
725
|
+
const i = await O(D("1", [H, q], "attributes"), { body: JSON.stringify({ delete: e }), method: "DELETE" });
|
|
733
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 };
|
|
734
727
|
}, async addSurveyListener(e) {
|
|
735
728
|
w.on(u.SurveyLifeCycle, e);
|
|
@@ -749,38 +742,38 @@ const sr = function(t) {
|
|
|
749
742
|
const d = `[Sprig] - Invalid userId ${e}`;
|
|
750
743
|
return console.warn(d), { success: !1, message: d };
|
|
751
744
|
}
|
|
752
|
-
if (
|
|
745
|
+
if (r.mode === "test" || e === window.UserLeap.userId) return;
|
|
753
746
|
window.UserLeap.userId = e;
|
|
754
|
-
const i = window.UserLeap.visitorId,
|
|
755
|
-
|
|
747
|
+
const i = window.UserLeap.visitorId, s = await O(D("1", [H, q]), { body: JSON.stringify({ userId: e }), method: "PUT" });
|
|
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));
|
|
756
749
|
}, async setPartnerAnonymousId(e) {
|
|
757
750
|
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig setPartnerAnonymousId", e), e == null) {
|
|
758
751
|
const i = `[Sprig] - Invalid partnerAnonymousId ${e}`;
|
|
759
752
|
return console.warn(i), { success: !1, message: i };
|
|
760
753
|
}
|
|
761
754
|
return window.UserLeap.partnerAnonymousId = e, _("aid", e), { success: !0 };
|
|
762
|
-
}, track: async (e, i,
|
|
763
|
-
te = e, Rt(e, i,
|
|
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
|
+
te = e, Rt(e, i, s, o);
|
|
764
757
|
}, applyFeedbackStyles({ button: e = "", view: i = "" }) {
|
|
765
758
|
window.UserLeap.feedbackCustomStyles = i, document.getElementById("sprig-feedback-style") && le({ document, elementId: "ul-custom-style", styleString: e, nonce: window.UserLeap.styleNonce }), n(document.querySelector(".ul-container-feedback"), i);
|
|
766
759
|
}, applyStyles(e) {
|
|
767
760
|
window.UserLeap.customStyles = e, n(window.UserLeap.container, e);
|
|
768
761
|
}, setWindowDimensions(e, i) {
|
|
769
762
|
var f, g;
|
|
770
|
-
const
|
|
771
|
-
isNaN(
|
|
763
|
+
const s = typeof e == "string" ? parseInt(e, 10) : e, o = typeof i == "string" ? parseInt(i, 10) : i;
|
|
764
|
+
isNaN(s) || isNaN(o) || (window.UserLeap.windowDimensions = { width: s, height: o });
|
|
772
765
|
const d = T(window.UserLeap), c = fe(d), l = d["userleap-platform"] === "web";
|
|
773
766
|
if (!window.UserLeap.frameId) return;
|
|
774
767
|
const p = document.getElementById(window.UserLeap.frameId);
|
|
775
|
-
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(
|
|
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, dt(d))[0]) + "px")), w.emit(u.SurveyDimensions, { name: u.SurveyDimensions, contentFrameWidth: p.clientWidth, contentFrameHeight: p.clientHeight, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }));
|
|
776
769
|
}, logoutUser() {
|
|
777
770
|
var e;
|
|
778
|
-
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, R.removeItem("userleap.ids"), window.UserLeap._queue.isPaused() && window.UserLeap._queue.empty(), _t(), (e =
|
|
771
|
+
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, R.removeItem("userleap.ids"), window.UserLeap._queue.isPaused() && window.UserLeap._queue.empty(), _t(), (e = I.replay) == null || e.clearUserReplayData(), window.UserLeap._queue.unpause();
|
|
779
772
|
}, teardown() {
|
|
780
|
-
["hashchange", "popstate"].forEach((e) => window.removeEventListener(e, re, !0)), window.UserLeap._config.interactiveEvents && kt(), window.UserLeap("dismissActiveSurvey",
|
|
773
|
+
["hashchange", "popstate"].forEach((e) => window.removeEventListener(e, re, !0)), window.UserLeap._config.interactiveEvents && kt(), window.UserLeap("dismissActiveSurvey", P.API), delete window.UserLeap, delete window.Sprig, delete window._Sprig;
|
|
781
774
|
}, integrateOptimizely(e, i = !0) {
|
|
782
|
-
var
|
|
783
|
-
if ((o = (
|
|
775
|
+
var s, o;
|
|
776
|
+
if ((o = (s = window.UserLeap) == null ? void 0 : s._config) != null && o.optimizelyEnabled) try {
|
|
784
777
|
const d = typeof e == "string" ? JSON.parse(e) : e;
|
|
785
778
|
de.setOptimizelyExperiment(d, i);
|
|
786
779
|
} catch (d) {
|
|
@@ -788,21 +781,21 @@ const sr = function(t) {
|
|
|
788
781
|
}
|
|
789
782
|
else console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");
|
|
790
783
|
}, integrateOptimizelyClient(e) {
|
|
791
|
-
var i,
|
|
792
|
-
if (!((
|
|
784
|
+
var i, s;
|
|
785
|
+
if (!((s = (i = window.UserLeap) == null ? void 0 : i._config) != null && s.optimizelyEnabled)) return void console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");
|
|
793
786
|
e.notificationCenter.addNotificationListener("ACTIVATE:experiment, user_id,attributes, variation, event", ({ experiment: o, variation: d }) => {
|
|
794
787
|
const c = { experiments: [{ id: o.id, variation: d.key }] };
|
|
795
788
|
window.UserLeap("integrateOptimizely", c, !1);
|
|
796
789
|
});
|
|
797
790
|
}, importLaunchDarklyData(e) {
|
|
798
|
-
var i,
|
|
799
|
-
(
|
|
800
|
-
}, setVisitorAttribute: (e, i) => (console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),
|
|
791
|
+
var i, s;
|
|
792
|
+
(s = (i = window.UserLeap) == null ? void 0 : i._config) != null && s.launchDarklyEnabled ? Re.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(Y, e), setVisitorEmail: async (e) => (console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"), a.setEmail(e)), _generateVideoUploadUrl: async (e) => async function(i) {
|
|
801
794
|
var o;
|
|
802
795
|
if (!i) return;
|
|
803
|
-
const
|
|
796
|
+
const s = `${window.UserLeap._API_URL}/2/environments/integrations/upload`;
|
|
804
797
|
try {
|
|
805
|
-
const d = await fetch(
|
|
798
|
+
const d = await fetch(s, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(i) });
|
|
806
799
|
if (d.ok) {
|
|
807
800
|
const c = await d.json();
|
|
808
801
|
return (o = c == null ? void 0 : c.upload) == null ? void 0 : o.url;
|
|
@@ -812,44 +805,44 @@ const sr = function(t) {
|
|
|
812
805
|
console.warn("[Sprig] Error with generating video upload url"), d instanceof Error && window.UserLeap.reportError("generateVideoUploadUrl", d);
|
|
813
806
|
}
|
|
814
807
|
}(e), _reportMetric(e, i) {
|
|
815
|
-
|
|
816
|
-
}, _completeSessionReplay: async ({ surveyId: e, responseGroupUuid: i, eventDigest:
|
|
808
|
+
Mt(e, i);
|
|
809
|
+
}, _completeSessionReplay: async ({ surveyId: e, responseGroupUuid: i, eventDigest: s }) => {
|
|
817
810
|
var o;
|
|
818
|
-
return
|
|
811
|
+
return I.replay ? (o = I.replay) == null ? void 0 : o._completeSessionReplay({ surveyId: e, responseGroupUuid: i, eventDigest: s, headers: T(window.UserLeap) }) : (window.UserLeap.reportError("_completeSessionReplay", new Error("Replay module not registered")), !1);
|
|
819
812
|
}, pauseReplayRecording() {
|
|
820
|
-
var e, i,
|
|
821
|
-
(i = (e =
|
|
813
|
+
var e, i, s, o;
|
|
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));
|
|
822
815
|
}, resumeReplayRecording() {
|
|
823
|
-
var e, i,
|
|
824
|
-
(i = (e =
|
|
816
|
+
var e, i, s, o, d, c;
|
|
817
|
+
(i = (e = I.replay) == null ? void 0 : e.isReplayPaused) != null && i.call(e) && ((o = (s = I.replay) == null ? void 0 : s.recordReplayResumed) == null || o.call(s), (c = (d = I.replay) == null ? void 0 : d.recordFullSnapshot) == null || c.call(d));
|
|
825
818
|
} };
|
|
826
|
-
Object.assign(window.UserLeap,
|
|
819
|
+
Object.assign(window.UserLeap, a);
|
|
827
820
|
};
|
|
828
|
-
async function
|
|
829
|
-
const e = window.__cfg && window.__cfg.mode, i = Oe(),
|
|
830
|
-
(await O(D("1", null, "errors"), { method: "POST", headers: { "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(c), shouldDropOnRateLimit: !0 })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API",
|
|
821
|
+
async function sr(r, t, n = {}, a = {}) {
|
|
822
|
+
const e = window.__cfg && window.__cfg.mode, i = Oe(), 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: te ?? window.location.href, language: window.navigator.language, ...n }, c = { action: r, breadcrumbs: M.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 O(D("1", null, "errors"), { method: "POST", headers: { "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(c), shouldDropOnRateLimit: !0 })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", t);
|
|
831
824
|
}
|
|
832
|
-
function
|
|
833
|
-
var
|
|
834
|
-
(
|
|
835
|
-
const
|
|
825
|
+
function ar(r = {}) {
|
|
826
|
+
var a;
|
|
827
|
+
(a = window.SprigLoggerCallback) == null || a.call(window, "Initializing Sprig");
|
|
828
|
+
const t = new URLSearchParams(window.location.search).get("sprigPreviewKey") ?? "";
|
|
836
829
|
async function n() {
|
|
837
830
|
var p, f, g, y, v;
|
|
838
831
|
if (window.UserLeap.loaded) return;
|
|
839
|
-
if ((p = window.SprigLoggerCallback) == null || p.call(window, "Loading Sprig"), window.UserLeap.reportError =
|
|
840
|
-
if (window.Sprig.outstandingTransactionLimit !== void 0 && (
|
|
832
|
+
if ((p = window.SprigLoggerCallback) == null || p.call(window, "Loading Sprig"), window.UserLeap.reportError = sr, window.UserLeap.loaded = !0, window.UserLeap._config = Object.assign({}, r, window.UserLeap.config), window.UserLeap.delayingSurvey = !1, window.UserLeap._config && typeof window.UserLeap._config == "object") for (const m in window.UserLeap._config) window.UserLeap[m] = window.UserLeap._config[m];
|
|
833
|
+
if (window.Sprig.outstandingTransactionLimit !== void 0 && (r.outstandingTransactionLimit = window.Sprig.outstandingTransactionLimit), !window.UserLeap.envId) {
|
|
841
834
|
if (!window.UserLeap.appId) throw new Error("Missing Environment id");
|
|
842
835
|
window.UserLeap.envId = window.UserLeap.appId;
|
|
843
836
|
}
|
|
844
837
|
window.UserLeap.debugMode && console.info("[DEBUG] Sprig debug mode enabled");
|
|
845
838
|
const e = Et(), i = window.UserLeap.sampleRate;
|
|
846
|
-
let
|
|
839
|
+
let s = e.sampled;
|
|
847
840
|
if (i) {
|
|
848
|
-
if (
|
|
849
|
-
} else
|
|
841
|
+
if (s === null && (s = Math.random() < i, _("sampled", s)), !s) return;
|
|
842
|
+
} else s !== null && _("sampled", null);
|
|
850
843
|
window.UserLeap._API_URL || (window.UserLeap._API_URL = "https://api.sprig.com");
|
|
851
844
|
const o = [...window.UserLeap._queue];
|
|
852
|
-
window.UserLeap._queue = new
|
|
845
|
+
window.UserLeap._queue = new Kt(window.UserLeap, []), window.UserLeap._queue.pause();
|
|
853
846
|
for (let m = 0; m < o.length; m++) window.UserLeap._queue.push(o[m]);
|
|
854
847
|
const d = e.token;
|
|
855
848
|
d ? (window.UserLeap.token = d, window.UserLeap.visitorId = e.vid ?? null, window.UserLeap.userId = e.uid ?? null, window.UserLeap.partnerAnonymousId = e.aid ?? null) : _t();
|
|
@@ -857,25 +850,25 @@ function dr(t = {}) {
|
|
|
857
850
|
(f = window.SprigLoggerCallback) == null || f.call(window, "Sprig fetching config");
|
|
858
851
|
const l = await async function(m) {
|
|
859
852
|
var E, z;
|
|
860
|
-
const
|
|
853
|
+
const h = T(window.UserLeap);
|
|
861
854
|
document.addEventListener("securitypolicyviolation", $e);
|
|
862
|
-
const
|
|
863
|
-
if (document.removeEventListener("securitypolicyviolation", $e), !
|
|
864
|
-
const
|
|
865
|
-
return
|
|
866
|
-
}(
|
|
867
|
-
if ((g = window.SprigLoggerCallback) == null || g.call(window, "Sprig fetched config"),
|
|
868
|
-
var
|
|
869
|
-
await O(D("1", [H], "metrics"), { body: m, method: "POST", headers: { "x-ul-replay-enabled": `${!!((
|
|
855
|
+
const k = await st(D("1", [H], "config"), { headers: h });
|
|
856
|
+
if (document.removeEventListener("securitypolicyviolation", $e), !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)), Ge("Disabled: failed to fetch configuration"), m;
|
|
857
|
+
const U = k.json;
|
|
858
|
+
return U != null && U.disabled ? ((z = window.SprigLoggerCallback) == null || z.call(window, "Sprig config fetch disabled"), Ge(`Disabled: ${U.disabled}`), { disabled: U.disabled }) : Object.assign({}, U, m);
|
|
859
|
+
}(r);
|
|
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
|
+
var h;
|
|
862
|
+
await O(D("1", [H], "metrics"), { body: m, method: "POST", headers: { "x-ul-replay-enabled": `${!!((h = I.replay) != null && h.isReplayRecording())}` }, shouldDropOnRateLimit: !0 });
|
|
870
863
|
} }), !c) {
|
|
871
|
-
const m = l.alwaysOnReplay ? { userAgent: window.navigator.userAgent, surveyId: l.alwaysOnReplay.surveyId, responseGroupUuid: l.alwaysOnReplay.responseGroupUuid, sdkVersion: "2.40.
|
|
872
|
-
await ((y =
|
|
864
|
+
const m = l.alwaysOnReplay ? { userAgent: window.navigator.userAgent, surveyId: l.alwaysOnReplay.surveyId, responseGroupUuid: l.alwaysOnReplay.responseGroupUuid, sdkVersion: "2.40.2", 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 })), Me = l.replaySettings;
|
|
873
866
|
}
|
|
874
|
-
|
|
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, () => {
|
|
875
868
|
for (const m in me) delete me[m];
|
|
876
869
|
});
|
|
877
870
|
}
|
|
878
|
-
window.UserLeap.UPDATES = ie, window.UserLeap("setPreviewKey",
|
|
871
|
+
window.UserLeap.UPDATES = ie, window.UserLeap("setPreviewKey", t), document.readyState === "complete" ? n() : window.attachEvent ? window.attachEvent("onload", n) : window.addEventListener("load", () => {
|
|
879
872
|
n();
|
|
880
873
|
}, !1);
|
|
881
874
|
}
|
|
@@ -883,8 +876,8 @@ class Ae {
|
|
|
883
876
|
constructor() {
|
|
884
877
|
N(this, "UPDATES", ie);
|
|
885
878
|
}
|
|
886
|
-
displaySurvey(
|
|
887
|
-
window.Sprig("displaySurvey",
|
|
879
|
+
displaySurvey(t) {
|
|
880
|
+
window.Sprig("displaySurvey", t);
|
|
888
881
|
}
|
|
889
882
|
mute() {
|
|
890
883
|
window.Sprig("mute");
|
|
@@ -895,50 +888,50 @@ class Ae {
|
|
|
895
888
|
dismissActiveSurvey() {
|
|
896
889
|
window.Sprig("dismissActiveSurvey");
|
|
897
890
|
}
|
|
898
|
-
setAttribute(
|
|
899
|
-
window.Sprig("setAttribute",
|
|
891
|
+
setAttribute(t, n) {
|
|
892
|
+
window.Sprig("setAttribute", t, n);
|
|
900
893
|
}
|
|
901
|
-
setAttributes(
|
|
902
|
-
window.Sprig("setAttributes",
|
|
894
|
+
setAttributes(t) {
|
|
895
|
+
window.Sprig("setAttributes", t);
|
|
903
896
|
}
|
|
904
|
-
identifyAndSetAttributes(
|
|
905
|
-
window.Sprig("identifyAndSetAttributes",
|
|
897
|
+
identifyAndSetAttributes(t) {
|
|
898
|
+
window.Sprig("identifyAndSetAttributes", t);
|
|
906
899
|
}
|
|
907
|
-
removeAttributes(
|
|
908
|
-
window.Sprig("removeAttributes",
|
|
900
|
+
removeAttributes(t) {
|
|
901
|
+
window.Sprig("removeAttributes", t);
|
|
909
902
|
}
|
|
910
|
-
addListener(
|
|
911
|
-
window.Sprig("addListener",
|
|
903
|
+
addListener(t, n) {
|
|
904
|
+
window.Sprig("addListener", t, n);
|
|
912
905
|
}
|
|
913
|
-
removeListener(
|
|
914
|
-
window.Sprig("removeListener",
|
|
906
|
+
removeListener(t, n) {
|
|
907
|
+
window.Sprig("removeListener", t, n);
|
|
915
908
|
}
|
|
916
909
|
removeAllListeners() {
|
|
917
910
|
window.Sprig("removeAllListeners");
|
|
918
911
|
}
|
|
919
|
-
setEmail(
|
|
920
|
-
window.Sprig("setAttribute", "!email",
|
|
912
|
+
setEmail(t) {
|
|
913
|
+
window.Sprig("setAttribute", "!email", t);
|
|
921
914
|
}
|
|
922
|
-
setUserId(
|
|
923
|
-
window.Sprig("setUserId",
|
|
915
|
+
setUserId(t) {
|
|
916
|
+
window.Sprig("setUserId", t);
|
|
924
917
|
}
|
|
925
|
-
setPartnerAnonymousId(
|
|
926
|
-
window.Sprig("setPartnerAnonymousId",
|
|
918
|
+
setPartnerAnonymousId(t) {
|
|
919
|
+
window.Sprig("setPartnerAnonymousId", t);
|
|
927
920
|
}
|
|
928
|
-
track(
|
|
929
|
-
window.Sprig("track",
|
|
921
|
+
track(t, n = {}, a = {}) {
|
|
922
|
+
window.Sprig("track", t, n, a);
|
|
930
923
|
}
|
|
931
|
-
identifyAndTrack(
|
|
932
|
-
window.Sprig("identifyAndTrack",
|
|
924
|
+
identifyAndTrack(t) {
|
|
925
|
+
window.Sprig("identifyAndTrack", t);
|
|
933
926
|
}
|
|
934
|
-
trackPageView(
|
|
935
|
-
window.Sprig("trackPageView",
|
|
927
|
+
trackPageView(t, n, a) {
|
|
928
|
+
window.Sprig("trackPageView", t, n, a);
|
|
936
929
|
}
|
|
937
|
-
applyStyles(
|
|
938
|
-
window.Sprig("applyStyles",
|
|
930
|
+
applyStyles(t) {
|
|
931
|
+
window.Sprig("applyStyles", t);
|
|
939
932
|
}
|
|
940
|
-
setWindowDimensions(
|
|
941
|
-
window.Sprig("setWindowDimensions",
|
|
933
|
+
setWindowDimensions(t, n) {
|
|
934
|
+
window.Sprig("setWindowDimensions", t, n);
|
|
942
935
|
}
|
|
943
936
|
logoutUser() {
|
|
944
937
|
window.Sprig("logoutUser");
|
|
@@ -953,30 +946,30 @@ class Ae {
|
|
|
953
946
|
window.Sprig("resumeReplayRecording");
|
|
954
947
|
}
|
|
955
948
|
}
|
|
956
|
-
const ot = { configure: (
|
|
957
|
-
if (!
|
|
958
|
-
if (
|
|
949
|
+
const ot = { configure: (r) => {
|
|
950
|
+
if (!r.envId && !r.environmentId) throw new Error("Initialization Error: Sprig configure requires an environmentId");
|
|
951
|
+
if (r.envId || (r.envId = r.environmentId ?? ""), r.installationMethod = "web-npm", window.Sprig) return window.Sprig;
|
|
959
952
|
window.Sprig = function() {
|
|
960
953
|
window.Sprig._queue.push(arguments);
|
|
961
954
|
}, Object.getOwnPropertyNames(Ae.prototype).map((n) => {
|
|
962
955
|
n !== "constructor" && (window.Sprig[n] = Ae.prototype[n]);
|
|
963
956
|
});
|
|
964
|
-
const
|
|
965
|
-
return
|
|
966
|
-
} },
|
|
957
|
+
const t = window.Sprig;
|
|
958
|
+
return t.appId = r.envId, t._queue = [], window.UserLeap = t, ar(r), window.Sprig;
|
|
959
|
+
} }, mr = { sprig: ot, SprigAPI: Ae, configure: ot.configure };
|
|
967
960
|
export {
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
961
|
+
pr as A,
|
|
962
|
+
Ft as C,
|
|
963
|
+
ur as D,
|
|
964
|
+
gr as E,
|
|
972
965
|
Ae as S,
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
966
|
+
wr as a,
|
|
967
|
+
cr as b,
|
|
968
|
+
mr as c,
|
|
969
|
+
Nt as d,
|
|
977
970
|
le as e,
|
|
978
971
|
Ce as g,
|
|
979
|
-
|
|
980
|
-
|
|
972
|
+
F as i,
|
|
973
|
+
yr as r,
|
|
981
974
|
ot as s
|
|
982
975
|
};
|