@sprig-technologies/sprig-browser 2.38.0 → 2.39.0
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-DkkPEdxY.cjs +1 -0
- package/dist/conversational-styles-FqFq9n7G.js +4 -0
- package/dist/conversational-ui-CJhN0LJK.js +615 -0
- package/dist/conversational-ui-Dfd7UJ-H.cjs +1 -0
- package/dist/{core-CYOlhSpx.js → core-BFvjNMlE.js} +403 -403
- package/dist/core-_Z8BkMvO.cjs +12 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +14 -0
- package/dist/core.js +2 -2
- package/dist/getAttributedUrl-B6IiqzoK.js +1076 -0
- package/dist/getAttributedUrl-CsC-pdfo.cjs +669 -0
- package/dist/index-DA4zJIRr.cjs +1 -0
- package/dist/index-DW3YeTpg.js +678 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-DuZDhNKr.js → metricsReporter-Bm14xa4G.js} +1 -1
- package/dist/{metricsReporter-Dwax9lmE.cjs → metricsReporter-BtpOP9Ry.cjs} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/view-DA2mrBDJ.js +1477 -0
- package/dist/view-DSmDY1mu.cjs +1 -0
- package/package.json +1 -1
- package/dist/core-KnMHq__4.cjs +0 -12
- package/dist/view-8D-Qx964.js +0 -3164
- package/dist/view-Bwbl2vpc.cjs +0 -669
|
@@ -1,280 +1,280 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { l as
|
|
5
|
-
const
|
|
1
|
+
var Et = Object.defineProperty;
|
|
2
|
+
var _t = (t, r, n) => r in t ? Et(t, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[r] = n;
|
|
3
|
+
var B = (t, r, n) => _t(t, typeof r != "symbol" ? r + "" : r, n);
|
|
4
|
+
import { l as D, g as T, s as rt, e as g, S as u, v as it, m as U, b as F, h as nt, E as re, D as M, c as Rt, r as G, i as xt, j as Dt, k as At, n as We, o as Be, d as Ot, a as Ct, p as ot, q as st } from "./metricsReporter-Bm14xa4G.js";
|
|
5
|
+
const sr = 360, ar = "ul-app", dr = "#e6e6e6", lr = "#bd282a", cr = 1030, Ne = () => {
|
|
6
6
|
try {
|
|
7
7
|
return window.parent.Intercom;
|
|
8
8
|
} catch {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
},
|
|
12
|
-
const t =
|
|
11
|
+
}, $e = [Object.freeze(Object.defineProperty({ __proto__: null, disable: () => {
|
|
12
|
+
const t = Ne();
|
|
13
13
|
t && (t.ul_wasVisible = !!document.querySelector("iframe.intercom-launcher-frame"), t.ul_wasVisible && t("update", { hide_default_launcher: !0 }));
|
|
14
14
|
}, enable: () => {
|
|
15
|
-
const t =
|
|
15
|
+
const t = Ne();
|
|
16
16
|
t && (t.ul_wasVisible && t("update", { hide_default_launcher: !1 }), delete t.ul_wasVisible);
|
|
17
17
|
} }, Symbol.toStringTag, { value: "Module" }))];
|
|
18
|
-
class
|
|
18
|
+
class Pt {
|
|
19
19
|
static disable() {
|
|
20
|
-
|
|
20
|
+
$e.forEach((r) => r.disable());
|
|
21
21
|
}
|
|
22
22
|
static enable() {
|
|
23
|
-
|
|
23
|
+
$e.forEach((r) => r.enable());
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
async function
|
|
26
|
+
const Ge = "ul-view-sdk-script", Tt = /* @__PURE__ */ new Set(["ios", "android"]), H = "visitors", V = "environments";
|
|
27
|
+
async function C(t, r) {
|
|
28
28
|
var i, o, a;
|
|
29
29
|
const { shouldDropOnRateLimit: n, ...s } = r;
|
|
30
|
-
s.headers = Object.assign(
|
|
31
|
-
const e = await
|
|
30
|
+
s.headers = Object.assign(T(window.UserLeap), s.headers);
|
|
31
|
+
const e = await rt(t, { ...s, shouldDropOnRateLimit: n });
|
|
32
32
|
if (e.ok) {
|
|
33
|
-
const l = (i = e.headers) == null ? void 0 : i.get("Authorization"),
|
|
34
|
-
if (window.UserLeap.userId &&
|
|
35
|
-
const
|
|
36
|
-
|
|
33
|
+
const l = (i = e.headers) == null ? void 0 : i.get("Authorization"), c = l ? l.split(" ") : void 0, d = c && c.length === 2 ? c[1] : void 0, p = (o = e.headers) == null ? void 0 : o.get("x-ul-visitor-id");
|
|
34
|
+
if (window.UserLeap.userId && p === window.UserLeap.visitorId) {
|
|
35
|
+
const m = D.getItemObject("sprig.anon.env.vid.map");
|
|
36
|
+
m && m[window.UserLeap.envId] === p && (delete m[window.UserLeap.envId], D.setItemObject("sprig.anon.env.vid.map", m));
|
|
37
37
|
}
|
|
38
|
-
d &&
|
|
38
|
+
d && p && (p !== window.UserLeap.visitorId || window.UserLeap.token !== d) && (x("token", d), x("vid", p), g.emit(u.VisitorIDUpdated, { visitorId: p }), window.UserLeap.token = d, window.UserLeap.visitorId = p);
|
|
39
39
|
}
|
|
40
40
|
return (a = e.json) != null && a.logMessage && console.warn(`[Sprig] ${e.json.logMessage}`), e;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const n =
|
|
42
|
+
function x(t, r) {
|
|
43
|
+
const n = D.getItemObject("userleap.ids");
|
|
44
44
|
let s = n[window.UserLeap.envId];
|
|
45
|
-
s ? s[t] = r : s = { [t]: r }, n[window.UserLeap.envId] = s,
|
|
45
|
+
s ? s[t] = r : s = { [t]: r }, n[window.UserLeap.envId] = s, D.setItemObject("userleap.ids", n);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Ae() {
|
|
48
48
|
return window.previewMode ? "0" : window.UserLeap.visitorId ?? "";
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function O(t, r, n) {
|
|
51
51
|
const s = [window.UserLeap._API_URL, "sdk", t];
|
|
52
52
|
return r && r.forEach((e) => {
|
|
53
|
-
s.push(e), e ===
|
|
53
|
+
s.push(e), e === V ? s.push(window.UserLeap.envId) : e === H && s.push(Ae());
|
|
54
54
|
}), n && s.push(n), s.join("/");
|
|
55
55
|
}
|
|
56
56
|
const X = async (t, r, n) => {
|
|
57
|
-
var
|
|
58
|
-
const { context: s, delay: e,
|
|
59
|
-
if (
|
|
57
|
+
var Fe, ze, He;
|
|
58
|
+
const { context: s, delay: e, avatars: i, forceBrandedLogo: o, endCard: a, isFeedback: l = !1, heatmap: c, locale: d, layout: p, previewMode: m, productConfig: y, questions: w, responseGroupUid: k, surveyId: f, uuid: b, vid: v, sessionReplay: L, studyType: E } = t, R = T(window.UserLeap), I = ie(R), j = me(R);
|
|
59
|
+
if (L) if (I) g.emit(u.ReplayCapture, { responseGroupUid: k, hasQuestions: !!(w != null && w.length), surveyId: f, uploadId: L.uploadId, replayType: L.replayDurationType ?? "before", seconds: L.replayDurationSeconds, generateVideoUploadUrlPayload: { mediaRecordingUid: it(), mediaType: "screen", questionId: 1, responseGroupUid: k, surveyId: f, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), visitorId: window.UserLeap.visitorId, isReplay: !0 } });
|
|
60
60
|
else {
|
|
61
|
-
if (!
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
if (
|
|
65
|
-
if (!
|
|
66
|
-
const { eventId:
|
|
67
|
-
await
|
|
68
|
-
var
|
|
69
|
-
return (
|
|
61
|
+
if (!U.replay) return window.UserLeap.reportError("displayQuestions", new Error("Replay module not registered")), { success: !1, message: "Replay module not registered", surveyState: "no survey" };
|
|
62
|
+
U.replay.scheduleOrCaptureReplay({ responseGroupId: k, surveyId: f, visitorId: v, replayParams: L, completeUploadHeaders: R, apiUrl: window.UserLeap._API_URL, triggerTimestamp: Date.now(), isStandalone: w.length === 0 });
|
|
63
|
+
}
|
|
64
|
+
if (c) {
|
|
65
|
+
if (!U.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: W, responseGroupUid: he, surveyId: be } = c;
|
|
67
|
+
await U.replay.initializeReplay({ maxReplayDurationSeconds: 300, maxInflightRequests: window.UserLeap.maxInflightReplayRequests, teardownAfter: !0, apiUrl: window.UserLeap._API_URL, replaySettings: n }), U.replay.tryReplayAction(() => {
|
|
68
|
+
var Ve;
|
|
69
|
+
return (Ve = U.replay) == null ? void 0 : Ve.scheduleCapture({ apiUrl: window.UserLeap._API_URL, completeUploadHeaders: R, eventId: S, isHeatmap: !0, replayParams: W, responseGroupId: he, surveyId: be, triggerTimestamp: Date.now(), visitorId: v });
|
|
70
70
|
}, "Error in scheduling/capturing replay");
|
|
71
71
|
}
|
|
72
|
-
if (
|
|
72
|
+
if (v == null || !(w != null && w.length)) return F.info("CannotDisplaySurvey", { vid: v }), { success: !1, message: "[Sprig] no survey found", surveyState: "no survey" };
|
|
73
73
|
if (window.UserLeap.container) {
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
return console.warn(
|
|
77
|
-
}
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
return window.UserLeap.reportError("DisplaySurvey", new Error(
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
let
|
|
84
|
-
const
|
|
85
|
-
const { "view.version":
|
|
86
|
-
|
|
74
|
+
F.info("AlreadyDisplayingSurvey");
|
|
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 (v !== window.UserLeap.visitorId && b !== 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
|
+
F.info("ShowingSurvey", { surveyId: f }), (Fe = U.replay) == null || Fe.RecordSurveyShown({ id: f, userAgent: window.navigator.userAgent }), Pt.disable(), g.emit(u.SurveyWillPresent, { name: u.SurveyWillPresent, "survey.id": f });
|
|
83
|
+
let A, z, _, ne, oe = document.createElement("div");
|
|
84
|
+
const Te = (S) => {
|
|
85
|
+
const { "view.version": W } = S;
|
|
86
|
+
W !== R["x-ul-sdk-version"] && dt(), g.removeListener("verify.view.version", Te);
|
|
87
87
|
};
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
return
|
|
91
|
-
})() && (
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
}, context: s, endCard:
|
|
95
|
-
(
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
return window.UserLeap.nonce &&
|
|
103
|
-
}(),
|
|
88
|
+
g.on("verify.view.version", Te), window.UserLeap.useMobileStyling = j, nt(R) ? (A = "ul-direct-embeded-frame", z = document.head, _ = window, ne = !1, (() => {
|
|
89
|
+
const S = T(window.UserLeap), W = ie(S), he = window.UserLeap.forceDirectEmbed, be = S["userleap-platform"] === "web";
|
|
90
|
+
return W || he && be;
|
|
91
|
+
})() && (at(f, l), oe.id = A, window.UserLeap.container.appendChild(oe), lt(), g.emit(u.SurveyLifeCycle, { state: "presented" }), g.emit(u.SurveyPresented, { name: u.SurveyPresented, "survey.id": f }))) : { frameId: A, contentWinDocHead: z, contentWindow: _, hasOverlay: ne, iframe: oe } = qt({ productConfig: y, useMobileStyling: j, surveyId: f, isFeedback: l }), window.UserLeap.frameId = A;
|
|
92
|
+
const K = { apiURL: window.UserLeap._API_URL, avatars: i, cards: w, configureExitOnOverlayClick: (S) => {
|
|
93
|
+
g.once(u.CloseSurveyOnOverlayClick, S);
|
|
94
|
+
}, context: s, endCard: a, envId: window.UserLeap.envId, eventEmitFn: g.emit.bind(g), fontFamily: window.UserLeap.fontFamily, fontFamilyURL: window.UserLeap.fontFamilyURL, forceBrandedLogo: o, frame: oe, headers: R, layout: p, locale: d, mobileSDKVersion: window.UserLeap.mobileSDKVersion, previewKey: D.getItem("sprig.previewKey"), previewMode: m, productConfig: { framePosition: y == null ? void 0 : y.framePosition, desktopDisplay: y == null ? void 0 : y.desktopDisplay, placement: y == null ? void 0 : y.placement }, responseGroupUid: k, startingQuestionIdx: (ze = window.UserLeap.config) == null ? void 0 : ze.startingQuestionIdx, studyType: E, styleNonce: window.UserLeap.styleNonce, surveyId: f, tabTitle: document.title, trackPageViewUrl: r, ulEvents: re, upchunkLibraryURL: window.UserLeap.upchunkLibraryURL, useMobileStyling: j, userId: b, viewDocument: _ == null ? void 0 : _.document, viewWindow: _, visitorAttributes: { externalUserId: window.UserLeap.userId, email: window.UserLeap.email }, ...window.UserLeap._config };
|
|
95
|
+
(He = window.UserLeap._config) != null && He.startingQuestionIdx && (window.UserLeap._config = { ...window.UserLeap._config, startingQuestionIdx: null });
|
|
96
|
+
const kt = (l ? window.UserLeap.feedbackCustomStyles : window.UserLeap.customStyles) ?? y.customStyles;
|
|
97
|
+
K.customStyles = kt, _ && (_.__cfg = K);
|
|
98
|
+
const fe = window.UserLeap.viewSDKURL ? window.UserLeap.viewSDKURL : K.path, je = document.getElementById(Ge);
|
|
99
|
+
je && je.remove();
|
|
100
|
+
const ve = function() {
|
|
101
|
+
const S = document.createElement("script");
|
|
102
|
+
return window.UserLeap.nonce && S.setAttribute("nonce", window.UserLeap.nonce), S.id = Ge, S;
|
|
103
|
+
}(), qe = () => {
|
|
104
104
|
window.UserLeap.container && Object.assign(window.UserLeap.container.style, { display: "flex" });
|
|
105
105
|
};
|
|
106
|
-
if (
|
|
107
|
-
const { default:
|
|
108
|
-
|
|
109
|
-
} else
|
|
110
|
-
window.UserLeap.container &&
|
|
111
|
-
}),
|
|
112
|
-
|
|
106
|
+
if (K.installationMethod === "web-npm" || K.installationMethod === "web-npm-bundled") {
|
|
107
|
+
const { default: S } = await import("./view-DA2mrBDJ.js").then((W) => W.v);
|
|
108
|
+
S.configure(K), ne && window.UserLeap.container && qe();
|
|
109
|
+
} else fe && (ve.src = fe, ne && ve.addEventListener("load", () => {
|
|
110
|
+
window.UserLeap.container && qe();
|
|
111
|
+
}), _ == null || _.addEventListener("error", (S) => {
|
|
112
|
+
S.target instanceof HTMLScriptElement && S.target.src === fe && 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
|
+
z == null || z.appendChild(ve);
|
|
115
|
+
const Me = { success: !0, surveyState: "ready", surveyId: f, responseGroupUid: k };
|
|
116
|
+
return window.UserLeap.isMobileSDK && e && (Me.delay = e), Me;
|
|
117
117
|
};
|
|
118
|
-
function
|
|
118
|
+
function me(t) {
|
|
119
119
|
var n;
|
|
120
120
|
if (window.UserLeap.useMobileStyling !== void 0) return window.UserLeap.useMobileStyling;
|
|
121
121
|
const r = ((n = window.UserLeap.windowDimensions) == null ? void 0 : n.width) ?? document.body.clientWidth;
|
|
122
122
|
return ie(t) || r > 10 && r < 500;
|
|
123
123
|
}
|
|
124
124
|
function ie(t) {
|
|
125
|
-
return
|
|
125
|
+
return Tt.has(t["userleap-platform"]);
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const pr = (t) => t["userleap-platform"] === "ios", Oe = "ul-frame";
|
|
128
128
|
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);
|
|
129
|
-
const
|
|
129
|
+
const Le = "0px", at = (t, r, n) => {
|
|
130
130
|
window.UserLeap.container = document.createElement("div"), window.UserLeap.container.className = "ul-container" + (r ? " ul-container-feedback" : ""), t && (window.UserLeap.container.dataset.studyId = t.toString());
|
|
131
|
-
const s =
|
|
131
|
+
const s = pt();
|
|
132
132
|
n && s && !window.UserLeap.useMobileStyling ? s.appendChild(window.UserLeap.container) : document.body.appendChild(window.UserLeap.container);
|
|
133
|
-
},
|
|
133
|
+
}, dt = (t, r) => {
|
|
134
134
|
var s;
|
|
135
|
-
|
|
135
|
+
Ft();
|
|
136
136
|
const n = window.UserLeap.container;
|
|
137
137
|
if (n) try {
|
|
138
|
-
(s = n.parentNode) == null || s.removeChild(n), window.UserLeap.container = null,
|
|
138
|
+
(s = n.parentNode) == null || s.removeChild(n), window.UserLeap.container = null, x("trackStartUrl", null), g.emit(u.SurveyLifeCycle, { state: "dismissed" }), g.emit(u.SurveyClosed, { name: u.SurveyClosed, initiator: t, "survey.id": parseInt(n.dataset.studyId), ...r && { studyType: r } });
|
|
139
139
|
} catch (e) {
|
|
140
140
|
console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${t} ` + n), e instanceof Error && window.UserLeap.reportError("dismissActiveSurvey", e);
|
|
141
141
|
}
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
}, lt = () => {
|
|
143
|
+
g.once(u.SurveyWillClose, ({ initiator: t, studyType: r }) => {
|
|
144
|
+
g.removeAllListeners(u.CloseSurveyOnOverlayClick), dt(t, r);
|
|
145
145
|
});
|
|
146
|
-
},
|
|
147
|
-
var d,
|
|
148
|
-
const e = { position: "fixed", bottom: "0px", right:
|
|
146
|
+
}, jt = (t, r, n, s) => {
|
|
147
|
+
var d, p;
|
|
148
|
+
const e = { position: "fixed", bottom: "0px", right: Le, 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({}, r, window.UserLeap), { desktopDisplay: o } = r || {}, a = o === "center-modal";
|
|
149
149
|
let l;
|
|
150
150
|
a && (i.framePosition = "center");
|
|
151
|
-
let
|
|
152
|
-
if (n) (d = window.UserLeap.windowDimensions) != null && d.width ? e.width = `${window.UserLeap.windowDimensions.width}px` : e.width = "100%", (
|
|
151
|
+
let c = !1;
|
|
152
|
+
if (n) (d = window.UserLeap.windowDimensions) != null && d.width ? e.width = `${window.UserLeap.windowDimensions.width}px` : e.width = "100%", (p = window.UserLeap.windowDimensions) != null && p.height ? e.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px" : window.UserLeap.maxHeight ? e.maxHeight = window.UserLeap.maxHeight : e.maxHeight = document.body.clientHeight - 20 + "px", ["light", "dark"].includes(i.overlayStyleMobile) && (c = !0);
|
|
153
153
|
else {
|
|
154
154
|
e.width = "360px", e.maxHeight = window.UserLeap.maxHeight || "66vh";
|
|
155
|
-
const
|
|
156
|
-
|
|
155
|
+
const m = () => {
|
|
156
|
+
c = !0, l = { margin: "auto", position: "static" };
|
|
157
157
|
};
|
|
158
|
-
if (s) a ?
|
|
158
|
+
if (s) a ? m() : l = { position: "relative", height: "300px" };
|
|
159
159
|
else switch (i.framePosition) {
|
|
160
160
|
case "bottomLeft":
|
|
161
|
-
l = { left:
|
|
161
|
+
l = { left: Le };
|
|
162
162
|
break;
|
|
163
163
|
case "topLeft":
|
|
164
|
-
l = { left:
|
|
164
|
+
l = { left: Le, top: 0 };
|
|
165
165
|
break;
|
|
166
166
|
case "topRight":
|
|
167
167
|
l = { top: 0 };
|
|
168
168
|
break;
|
|
169
169
|
case "center":
|
|
170
|
-
|
|
170
|
+
m();
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
return
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
})(i, n), Object.assign(t.style, e, l),
|
|
177
|
-
},
|
|
178
|
-
var
|
|
179
|
-
const e =
|
|
180
|
-
|
|
173
|
+
return c && ((m, y) => {
|
|
174
|
+
const w = { position: "fixed", overflow: "auto", top: "0px", left: "0px", display: "none", height: "100%", width: "100%", transition: "background-color 0.3s ease-out", zIndex: 2147483646 }, k = y ? m.overlayStyleMobile : m.overlayStyle;
|
|
175
|
+
w["background-color"] = k === "light" ? "rgba(255,255,255, 0.95)" : "rgba(0,0,0,0.9)", y || (w.margin = "auto"), window.UserLeap.container && Object.assign(window.UserLeap.container.style, w);
|
|
176
|
+
})(i, n), Object.assign(t.style, e, l), c;
|
|
177
|
+
}, qt = ({ productConfig: t, useMobileStyling: r, surveyId: n, isFeedback: s }) => {
|
|
178
|
+
var m, y;
|
|
179
|
+
const e = Oe, i = s && t.desktopDisplay === "slider";
|
|
180
|
+
at(n, s, i), Mt();
|
|
181
181
|
const o = document.createElement("iframe");
|
|
182
182
|
o.id = e, o.setAttribute("title", "Sprig User Feedback Dialog");
|
|
183
|
-
const a =
|
|
184
|
-
|
|
183
|
+
const a = jt(o, t, r, s);
|
|
184
|
+
lt();
|
|
185
185
|
let l = !1;
|
|
186
|
-
o.setHeight = (
|
|
187
|
-
parseInt(o.style.height) ==
|
|
186
|
+
o.setHeight = (w) => {
|
|
187
|
+
parseInt(o.style.height) == w && l || (l = !0, o.style.height = `${w}px`, g.emit(u.SurveyHeight, { name: u.SurveyHeight, contentFrameHeight: w, "survey.id": n }));
|
|
188
188
|
};
|
|
189
|
-
let
|
|
190
|
-
o.setWidth = (
|
|
191
|
-
parseInt(o.style.width) ==
|
|
192
|
-
}, (
|
|
193
|
-
|
|
194
|
-
}),
|
|
195
|
-
const d = (
|
|
189
|
+
let c = !1;
|
|
190
|
+
o.setWidth = (w) => {
|
|
191
|
+
parseInt(o.style.width) == w && c || (c = !0, o.style.width = `${w}px`, g.emit(u.SurveyWidth, { name: u.SurveyWidth, contentFrameWidth: w, "survey.id": n }));
|
|
192
|
+
}, (m = window.UserLeap.container) == null || m.appendChild(o), t && (r ? t.exitOnOverlayClickMobile : t.exitOnOverlayClick) && window.UserLeap.container && (window.UserLeap.container.onclick = () => {
|
|
193
|
+
g.emit(u.CloseSurveyOnOverlayClick);
|
|
194
|
+
}), g.emit(u.SurveyLifeCycle, { state: "presented" }), g.emit(u.SurveyPresented, { name: u.SurveyPresented, "survey.id": n });
|
|
195
|
+
const d = (y = o.contentWindow) == null ? void 0 : y.document;
|
|
196
196
|
if (d && (d.open("text/html", "replace"), d.write("<!doctype html><head></head><body></body></html>"), d.close(), !r)) {
|
|
197
|
-
const
|
|
198
|
-
|
|
197
|
+
const w = d.body;
|
|
198
|
+
w.style.display = "flex", w.style.alignItems = "center";
|
|
199
199
|
}
|
|
200
|
-
const
|
|
201
|
-
return { frameId: e, contentWinDocHead:
|
|
202
|
-
},
|
|
200
|
+
const p = d == null ? void 0 : d.head;
|
|
201
|
+
return { frameId: e, contentWinDocHead: p, contentWindow: o.contentWindow, hasOverlay: a, iframe: o };
|
|
202
|
+
}, ct = { [u.SurveyFadingOut]: () => {
|
|
203
203
|
window.UserLeap.container && Object.assign(window.UserLeap.container.style, { "background-color": "rgba(0,0,0,0)" });
|
|
204
|
-
} },
|
|
205
|
-
Object.entries(
|
|
206
|
-
|
|
204
|
+
} }, Mt = () => {
|
|
205
|
+
Object.entries(ct).forEach(([t, r]) => {
|
|
206
|
+
g.on(t, r);
|
|
207
207
|
});
|
|
208
|
-
},
|
|
209
|
-
Object.entries(
|
|
210
|
-
|
|
208
|
+
}, Ft = () => {
|
|
209
|
+
Object.entries(ct).forEach(([t, r]) => {
|
|
210
|
+
g.off(t, r);
|
|
211
211
|
});
|
|
212
|
-
},
|
|
212
|
+
}, q = (t) => !!t && t.nodeType === Node.ELEMENT_NODE, Ke = (t) => t instanceof HTMLElement || t instanceof SVGElement, de = ({ document: t, elementId: r, styleString: n, nonce: s }) => {
|
|
213
213
|
const e = t.getElementById(r);
|
|
214
214
|
if (e) return void (e.textContent = n);
|
|
215
215
|
const i = t.createElement("style");
|
|
216
216
|
s && (i.nonce = s), i.textContent = n, i.id = r, t.head.appendChild(i);
|
|
217
|
-
},
|
|
217
|
+
}, zt = (t, r) => {
|
|
218
218
|
const n = r.querySelector(".sprig-question-body");
|
|
219
|
-
if (!
|
|
219
|
+
if (!q(n)) return t;
|
|
220
220
|
const s = n.scrollHeight;
|
|
221
221
|
return s < 100 ? t : t - (s - 100);
|
|
222
|
-
},
|
|
222
|
+
}, Je = (t, r) => {
|
|
223
223
|
const n = r.querySelector(t);
|
|
224
|
-
if (!
|
|
224
|
+
if (!q(n)) return 0;
|
|
225
225
|
const s = getComputedStyle(n);
|
|
226
226
|
return parseFloat(s.paddingLeft) + parseFloat(s.paddingRight) + (parseFloat(s.marginLeft) + parseFloat(s.marginRight)) + (parseFloat(s.borderLeftWidth) + parseFloat(s.borderRightWidth));
|
|
227
|
-
},
|
|
227
|
+
}, Ht = (t, r, n) => {
|
|
228
228
|
const s = t.querySelector(".ul-card__container"), e = t.querySelector(".ul-app");
|
|
229
229
|
let i = 600, o = 360, a = 0;
|
|
230
|
-
if (
|
|
231
|
-
const l = s.querySelector(".ul-card--matrix_grid"),
|
|
230
|
+
if (q(s) && q(e)) {
|
|
231
|
+
const l = s.querySelector(".ul-card--matrix_grid"), c = !l && r && n;
|
|
232
232
|
try {
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
let
|
|
236
|
-
return
|
|
233
|
+
c && (e.style.width = "360px"), i = s.clientHeight, i += ((m) => {
|
|
234
|
+
const y = m.querySelector(".sprig-question-body"), w = m.querySelector(".ul-card"), k = m.querySelector(".ul-card-main-content"), f = m.querySelector(".ul-footer"), b = m.querySelector(".sprig-container");
|
|
235
|
+
let v = 0;
|
|
236
|
+
return q(w) && (v += w.scrollHeight - w.clientHeight), q(k) && (v += k.scrollHeight - k.clientHeight), q(y) && (v += y.scrollHeight - y.clientHeight), q(f) && q(b) && b.clientHeight === 0 && (v += f.clientHeight), v;
|
|
237
237
|
})(t);
|
|
238
238
|
const d = getComputedStyle(s);
|
|
239
239
|
a = i;
|
|
240
|
-
const
|
|
241
|
-
i +=
|
|
240
|
+
const p = parseFloat(d.marginTop) + parseFloat(d.marginBottom);
|
|
241
|
+
i += p + (parseFloat(d.borderTopWidth) + parseFloat(d.borderBottomWidth)), l && (o = l.scrollWidth, o += Je(".ul-card__container", t), o += Je(".sprig-question-body", t));
|
|
242
242
|
} finally {
|
|
243
|
-
|
|
243
|
+
c && e.style.removeProperty("width");
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
return [i + 1, o,
|
|
247
|
-
},
|
|
246
|
+
return [i + 1, o, zt(a, t)];
|
|
247
|
+
}, ur = (t) => {
|
|
248
248
|
const r = t.querySelector(".ul-card__container");
|
|
249
249
|
r && (r.scrollTop = 0);
|
|
250
|
-
},
|
|
251
|
-
let
|
|
252
|
-
const
|
|
250
|
+
}, pt = () => h, J = () => document.getElementById("sprig-feedback-container"), ke = () => document.getElementById("sprig-feedback-loading-animation"), ut = () => !!document.getElementById(Oe);
|
|
251
|
+
let Qe = !1, h = null, P = null, Ce = !1, Z = null, N = null;
|
|
252
|
+
const Vt = ["bottom-left", "bottom-right", "center-left", "center-right"], le = () => {
|
|
253
253
|
var r;
|
|
254
254
|
const t = window.UserLeap.container;
|
|
255
255
|
return ((r = t == null ? void 0 : t.parentElement) == null ? void 0 : r.id) === "sprig-feedback-loading-container";
|
|
256
|
-
},
|
|
256
|
+
}, wt = () => document.getElementById("sprig-feedback-error-container"), gt = () => {
|
|
257
257
|
if (!h) return 0;
|
|
258
258
|
const t = h == null ? void 0 : h.clientWidth, r = window.getComputedStyle(h);
|
|
259
259
|
return t + parseInt(r.borderRightWidth || "0") + parseInt(r.borderLeftWidth || "0");
|
|
260
|
-
},
|
|
261
|
-
const r =
|
|
262
|
-
r && (
|
|
263
|
-
},
|
|
264
|
-
if (h && (
|
|
265
|
-
|
|
266
|
-
const t =
|
|
267
|
-
return
|
|
260
|
+
}, ce = (t) => {
|
|
261
|
+
const r = J();
|
|
262
|
+
r && (N != null && N.endsWith("right") ? r.style.right = `${t}px` : N != null && N.endsWith("left") && (r.style.left = `${t}px`));
|
|
263
|
+
}, Ue = () => {
|
|
264
|
+
if (h && (le() || wt())) {
|
|
265
|
+
g.off(u.SurveyAppeared, Y), Ee();
|
|
266
|
+
const t = gt();
|
|
267
|
+
return ce(-t), !0;
|
|
268
268
|
}
|
|
269
269
|
return !1;
|
|
270
270
|
}, Y = () => {
|
|
271
|
-
if (!h || !
|
|
272
|
-
const t =
|
|
273
|
-
t && t.remove(), h.style.height = "auto", h.style.width = "auto",
|
|
274
|
-
},
|
|
275
|
-
if (h && !
|
|
271
|
+
if (!h || !P) return;
|
|
272
|
+
const t = ke();
|
|
273
|
+
t && t.remove(), h.style.height = "auto", h.style.width = "auto", P.disabled = !1, Ce = !1;
|
|
274
|
+
}, Ee = () => {
|
|
275
|
+
if (h && !ke()) {
|
|
276
276
|
const t = (() => {
|
|
277
|
-
if (
|
|
277
|
+
if (ke()) return;
|
|
278
278
|
const r = document.createElement("div");
|
|
279
279
|
return r.className = "ul-loading-spinner-container", r.id = "sprig-feedback-loading-animation", r.role = "progressbar", r.setAttribute("aria-live", "polite"), r.setAttribute("aria-busy", "true"), r.setAttribute("aria-label", "Processing..."), r.innerHTML = `
|
|
280
280
|
<div class="ul-loading-spinner">
|
|
@@ -287,55 +287,55 @@ const zt = ["bottom-left", "bottom-right", "center-left", "center-right"], ae =
|
|
|
287
287
|
})();
|
|
288
288
|
t && (h.style.height = "300px", h.style.width = "360px", h.appendChild(t));
|
|
289
289
|
}
|
|
290
|
-
},
|
|
291
|
-
h &&
|
|
292
|
-
},
|
|
293
|
-
const { buttonTheme: s, customStyles: e, eventId: i, placement: o, desktopDisplay: a, feedbackLabel: l, surveyUuid:
|
|
290
|
+
}, Ye = () => {
|
|
291
|
+
h && P && (ce(0), P.disabled = !0, Ce = !0);
|
|
292
|
+
}, yt = async (t, r, n) => {
|
|
293
|
+
const { buttonTheme: s, customStyles: e, eventId: i, placement: o, desktopDisplay: a, feedbackLabel: l, surveyUuid: c, surveyId: d } = t;
|
|
294
294
|
window.UserLeap.feedbackCustomStyles = void 0;
|
|
295
|
-
let
|
|
296
|
-
if (
|
|
295
|
+
let p = J();
|
|
296
|
+
if (p) {
|
|
297
297
|
if (!r && i === Z) return;
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
Z = i,
|
|
301
|
-
const [
|
|
302
|
-
((
|
|
303
|
-
if (
|
|
304
|
-
const [
|
|
305
|
-
|
|
306
|
-
})(o),
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
311
|
-
if (
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
|
|
298
|
+
p.remove(), g.off(re.SURVEY_FADING_OUT, Ue);
|
|
299
|
+
}
|
|
300
|
+
Z = i, de({ 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 }), de({ document, elementId: "ul-custom-style", styleString: e ?? "", nonce: window.UserLeap.styleNonce }), Qe = a === "center-modal", N = o;
|
|
301
|
+
const [m, y] = o.split("-");
|
|
302
|
+
((b) => {
|
|
303
|
+
if (J() || !Vt.includes(b)) return;
|
|
304
|
+
const [v, L] = b.split("-"), E = document.createElement("div");
|
|
305
|
+
E.id = "sprig-feedback-container", E.classList.add(`sprig-feedback-container-${L}`, `sprig-feedback-container-${v}`), document.body.appendChild(E);
|
|
306
|
+
})(o), p = J(), P = document.createElement("button");
|
|
307
|
+
const w = document.createElement("div");
|
|
308
|
+
w.className = "sprig-feedback-button-label", w.innerText = l, P.appendChild(w), P.id = "sprig-feedback-button", P.classList.add(`sprig-feedback-button-${y}`, `sprig-feedback-button-${m}`, `sprig-feedback-button-${s}`, "fade-in-transition"), g.on(re.SURVEY_FADING_OUT, Ue), P.addEventListener("click", async () => {
|
|
309
|
+
const b = document.getElementById("sprig-feedback-error-container");
|
|
310
|
+
if (ut() || wt()) {
|
|
311
|
+
if (Ue()) {
|
|
312
|
+
g.emit(u.SurveyCloseRequested, { name: u.SurveyCloseRequested, initiator: M.FeedbackClosed, studyType: "feedbackButton", "survey.id": d }), g.emit(u.SurveyWillClose, { name: u.SurveyWillClose, initiator: M.FeedbackClosed, studyType: "feedbackButton", "survey.id": d });
|
|
313
|
+
const L = J();
|
|
314
|
+
b && L && (L.remove(), Z = null, h = null);
|
|
315
315
|
}
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
318
|
-
if (
|
|
319
|
-
const
|
|
320
|
-
const
|
|
321
|
-
return
|
|
322
|
-
})(
|
|
323
|
-
if (
|
|
318
|
+
if (me(T(window.UserLeap)) || Ce || Ye(), r) return h && h.classList.add("sprig-feedback-loading-container-previews"), await X(r), void Y();
|
|
319
|
+
const v = await (async (L) => {
|
|
320
|
+
const E = await C(O("1", [H], "startFeedbackStudy"), { body: JSON.stringify({ surveyUuid: L }), method: "POST" });
|
|
321
|
+
return E.ok ? E.json : null;
|
|
322
|
+
})(c);
|
|
323
|
+
if (v) g.once(u.SurveyAppeared, Y), X({ ...v, studyType: "feedbackButton" }, n);
|
|
324
324
|
else if (h) {
|
|
325
|
-
const
|
|
326
|
-
h.appendChild(
|
|
325
|
+
const L = Wt();
|
|
326
|
+
h.appendChild(L), Y(), h.style.height = "300px", h.style.width = "360px";
|
|
327
327
|
}
|
|
328
|
-
}),
|
|
329
|
-
const { useMobileStyling:
|
|
330
|
-
if (
|
|
328
|
+
}), p == null || p.appendChild(P), g.emit(u.FeedbackButtonLoaded, { name: u.FeedbackButtonLoaded, "survey.id": d });
|
|
329
|
+
const { useMobileStyling: k, _config: { border: f } } = window.UserLeap;
|
|
330
|
+
if (Qe || k) ce(0);
|
|
331
331
|
else {
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
const
|
|
335
|
-
|
|
332
|
+
const b = document.createElement("div");
|
|
333
|
+
b.id = "sprig-feedback-loading-container", b.className = `sprig-feedback-loading-container sprig-feedback-loading-container-${y}`, b.style.setProperty("--feedback-border", f), h = b, Ee(), p == null || p.appendChild(b);
|
|
334
|
+
const v = gt();
|
|
335
|
+
ce(-v);
|
|
336
336
|
}
|
|
337
|
-
window.UserLeap._config.isOnQuestionsTab && r && !
|
|
338
|
-
},
|
|
337
|
+
window.UserLeap._config.isOnQuestionsTab && r && !le() && h && (Ye(), Ee(), h && h.classList.add("sprig-feedback-loading-container-previews"), X(r), Y());
|
|
338
|
+
}, Wt = () => {
|
|
339
339
|
const t = document.createElement("div");
|
|
340
340
|
t.id = "sprig-feedback-error-container", t.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
|
|
341
341
|
<circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
|
|
@@ -344,9 +344,9 @@ const zt = ["bottom-left", "bottom-right", "center-left", "center-right"], ae =
|
|
|
344
344
|
</svg>`;
|
|
345
345
|
const r = document.createElement("h3");
|
|
346
346
|
return r.className = "sprig-feedback-error-text", r.innerText = "There was an error while loading the survey", t.appendChild(r), t;
|
|
347
|
-
},
|
|
347
|
+
}, _e = new class {
|
|
348
348
|
constructor() {
|
|
349
|
-
|
|
349
|
+
B(this, "_ldData", {});
|
|
350
350
|
}
|
|
351
351
|
getAllLaunchDarklyVariations() {
|
|
352
352
|
return this._ldData;
|
|
@@ -361,10 +361,10 @@ const zt = ["bottom-left", "bottom-right", "center-left", "center-right"], ae =
|
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
}();
|
|
364
|
-
Object.freeze(
|
|
365
|
-
const
|
|
364
|
+
Object.freeze(_e);
|
|
365
|
+
const ae = new class {
|
|
366
366
|
constructor() {
|
|
367
|
-
|
|
367
|
+
B(this, "_optimizelyData", {});
|
|
368
368
|
}
|
|
369
369
|
setOptimizelyExperiment(t, r = !0) {
|
|
370
370
|
if (!t || typeof t != "object") return !1;
|
|
@@ -409,12 +409,12 @@ const oe = new class {
|
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
}();
|
|
412
|
-
Object.freeze(
|
|
413
|
-
class
|
|
412
|
+
Object.freeze(ae);
|
|
413
|
+
class Bt {
|
|
414
414
|
constructor(r, n) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
415
|
+
B(this, "paused");
|
|
416
|
+
B(this, "queue");
|
|
417
|
+
B(this, "ul");
|
|
418
418
|
this.ul = r, this.paused = !1, this.queue = [], this.flush(n);
|
|
419
419
|
}
|
|
420
420
|
flush(r) {
|
|
@@ -457,122 +457,122 @@ class Vt {
|
|
|
457
457
|
this.queue.length = 0;
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
let
|
|
461
|
-
const
|
|
460
|
+
let mt, ft;
|
|
461
|
+
const Re = (t) => {
|
|
462
462
|
let r = 0, n = t.firstElementChild;
|
|
463
|
-
for (; n; ) r +=
|
|
463
|
+
for (; n; ) r += Re(n), n.shadowRoot && (r += Re(n.shadowRoot)), n = n.nextElementSibling, r++;
|
|
464
464
|
return r;
|
|
465
|
-
},
|
|
466
|
-
|
|
467
|
-
},
|
|
465
|
+
}, Xe = () => {
|
|
466
|
+
mt.report(Re(document.body)), ft.report(document.documentElement.innerHTML.length);
|
|
467
|
+
}, xe = (t, r) => {
|
|
468
468
|
const n = performance.now();
|
|
469
|
-
document.hidden ? setTimeout(() =>
|
|
469
|
+
document.hidden ? setTimeout(() => xe(t, r), t) : setTimeout(() => {
|
|
470
470
|
const s = performance.now() - n;
|
|
471
|
-
r.report(s / 1e3), setTimeout(() =>
|
|
471
|
+
r.report(s / 1e3), setTimeout(() => xe(t, r), t);
|
|
472
472
|
}, 0);
|
|
473
473
|
};
|
|
474
|
-
let
|
|
475
|
-
const
|
|
474
|
+
let pe, ue, we, ge, Ze, $ = {};
|
|
475
|
+
const se = (t, r = 1) => {
|
|
476
476
|
const { name: n } = t;
|
|
477
|
-
|
|
478
|
-
},
|
|
477
|
+
$[n] = ($[n] || 0) + r;
|
|
478
|
+
}, vt = (t) => {
|
|
479
479
|
let r = 1;
|
|
480
480
|
return t.childNodes.forEach((n) => {
|
|
481
|
-
r +=
|
|
481
|
+
r += vt(n);
|
|
482
482
|
}), r;
|
|
483
|
-
},
|
|
483
|
+
}, et = (t) => {
|
|
484
484
|
let r = 0;
|
|
485
485
|
return t.forEach((n) => {
|
|
486
|
-
r +=
|
|
486
|
+
r += vt(n);
|
|
487
487
|
}), r;
|
|
488
|
-
},
|
|
488
|
+
}, Nt = (t) => {
|
|
489
489
|
switch (t.type) {
|
|
490
490
|
case "childList":
|
|
491
|
-
return
|
|
491
|
+
return se(pe, et(t.addedNodes)), void se(ue, et(t.removedNodes));
|
|
492
492
|
case "attributes":
|
|
493
|
-
return void
|
|
493
|
+
return void se(we);
|
|
494
494
|
case "characterData":
|
|
495
|
-
return void
|
|
496
|
-
}
|
|
497
|
-
},
|
|
498
|
-
|
|
499
|
-
},
|
|
500
|
-
|
|
501
|
-
},
|
|
502
|
-
|
|
495
|
+
return void se(ge);
|
|
496
|
+
}
|
|
497
|
+
}, $t = (t) => t.forEach(Nt), Gt = () => {
|
|
498
|
+
pe.report($[pe.name] || 0), ue.report($[ue.name] || 0), we.report($[we.name] || 0), ge.report($[ge.name] || 0), $ = {};
|
|
499
|
+
}, Kt = (t = 1e3) => {
|
|
500
|
+
pe = G("sdk_mutations_nodes_added"), ue = G("sdk_mutations_nodes_removed"), we = G("sdk_mutations_attributes_changed"), ge = G("sdk_mutations_character_data"), Ze = new MutationObserver($t), Ze.observe(document, { attributes: !0, attributeOldValue: !0, characterData: !0, characterDataOldValue: !0, childList: !0, subtree: !0 }), setInterval(Gt, t);
|
|
501
|
+
}, Jt = ({ isWeb: t, reportingIntervalSeconds: r, thresholds: n, postMetrics: s }) => {
|
|
502
|
+
xt(n, (e, i) => {
|
|
503
503
|
var o, a;
|
|
504
|
-
if ((o =
|
|
504
|
+
if ((o = U.replay) != null && o.isReplayRecording()) {
|
|
505
505
|
const l = `Value: ${e} on ${i.metric} violated threshold of ${i.type} ${i.value}`;
|
|
506
|
-
(a =
|
|
506
|
+
(a = U.replay) == null || a.disableRecording("Threshold violated", new Error(l), { reportError: !1 }), window.UserLeap.reportError("Sdk Performance Metric threshold violated", new Error("Sdk Performance Metric threshold violated"), { metricName: i.metric, type: i.type, value: i.value }, { metricName: i.metric }), At();
|
|
507
507
|
}
|
|
508
|
-
}),
|
|
509
|
-
const i =
|
|
510
|
-
|
|
508
|
+
}), Dt({ reportingIntervalSeconds: r, postMetrics: s }), t && (((e = 1e3) => {
|
|
509
|
+
const i = G("sdk_event_queue_latency_seconds");
|
|
510
|
+
xe(e, i);
|
|
511
511
|
})(), ((e = 1e4) => {
|
|
512
|
-
|
|
513
|
-
})(),
|
|
514
|
-
},
|
|
515
|
-
let
|
|
516
|
-
const
|
|
517
|
-
let
|
|
512
|
+
mt = G("sdk_dom_nodes_count"), ft = G("sdk_page_html_characters"), Xe(), setInterval(Xe, e);
|
|
513
|
+
})(), Kt());
|
|
514
|
+
}, Qt = "test", Yt = ["popState", "pushState", "replaceState"];
|
|
515
|
+
let Pe, ee;
|
|
516
|
+
const ye = {}, Q = "!email", ht = "pageUrl";
|
|
517
|
+
let Se = window.location.href;
|
|
518
518
|
function te(t) {
|
|
519
519
|
var a, l;
|
|
520
520
|
const { pageUrlEvents: r, interactiveEvents: n, dismissOnPageChange: s, platform: e } = window.UserLeap._config;
|
|
521
521
|
if (e && e !== "web") return;
|
|
522
|
-
|
|
523
|
-
const i =
|
|
524
|
-
r &&
|
|
525
|
-
if (
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
})(),
|
|
522
|
+
Se !== window.location.href && F.navigation("LocationChange", { from: Se, to: window.location.href }), Se = window.location.href;
|
|
523
|
+
const i = Ut().trackStartUrl, o = i ? String(i) : null;
|
|
524
|
+
r && It(window.location.href), n && (Lt(), Xt()), pt() && (() => {
|
|
525
|
+
if (le()) return;
|
|
526
|
+
const c = J();
|
|
527
|
+
c && (Rt(Z) || (c.remove(), Z = null, h = null));
|
|
528
|
+
})(), Ct.getItem("sprig.isCapturingHeatmap") && ((l = (a = U.replay) == null ? void 0 : a.checkPendingHeatmapsUrl()) == null || l.then((c) => {
|
|
529
529
|
var d;
|
|
530
|
-
|
|
531
|
-
})), !
|
|
530
|
+
c && ((d = U.replay) == null || d.uploadReadyPendingCaptures(!0));
|
|
531
|
+
})), !le() && s && o && o !== window.location.href && t && Yt.includes(t.type) && window.UserLeap("dismissActiveSurvey", M.PageChange);
|
|
532
532
|
}
|
|
533
|
-
const
|
|
534
|
-
const t = window.UserLeap._config.interactiveEvents.filter((n) =>
|
|
533
|
+
const bt = { capture: !0 }, Xt = () => {
|
|
534
|
+
const t = window.UserLeap._config.interactiveEvents.filter((n) => ot(n, window.location.href)).map((n) => {
|
|
535
535
|
const { name: s, properties: e } = n, { selector: i, innerText: o } = e;
|
|
536
536
|
return i ? (a) => {
|
|
537
|
-
if (
|
|
537
|
+
if (Ke(a.target)) try {
|
|
538
538
|
a.target.closest(i) && window.UserLeap("track", s);
|
|
539
539
|
} catch {
|
|
540
540
|
}
|
|
541
541
|
return !1;
|
|
542
|
-
} : (a) => (
|
|
542
|
+
} : (a) => (Ke(a.target) && a.target.innerText === o && window.UserLeap("track", s), !1);
|
|
543
543
|
}), r = (n) => t.forEach((s) => s(n));
|
|
544
|
-
window.UserLeap._config.interactiveEventsHandler = r, window.addEventListener("click", r,
|
|
545
|
-
},
|
|
546
|
-
window.UserLeap._config.interactiveEventsHandler && window.removeEventListener("click", window.UserLeap._config.interactiveEventsHandler,
|
|
544
|
+
window.UserLeap._config.interactiveEventsHandler = r, window.addEventListener("click", r, bt);
|
|
545
|
+
}, Lt = () => {
|
|
546
|
+
window.UserLeap._config.interactiveEventsHandler && window.removeEventListener("click", window.UserLeap._config.interactiveEventsHandler, bt), delete window.UserLeap._config.interactiveEventsHandler;
|
|
547
547
|
};
|
|
548
|
-
function
|
|
549
|
-
const t =
|
|
548
|
+
function Ut() {
|
|
549
|
+
const t = D.getItemObject("userleap.ids");
|
|
550
550
|
return t && t[window.UserLeap.envId] || {};
|
|
551
551
|
}
|
|
552
|
-
function
|
|
552
|
+
function St() {
|
|
553
553
|
if (window.previewMode) return;
|
|
554
|
-
const t =
|
|
555
|
-
window.UserLeap.visitorId = r ||
|
|
554
|
+
const t = D.getItemObject("sprig.anon.env.vid.map") || {}, r = t[window.UserLeap.envId];
|
|
555
|
+
window.UserLeap.visitorId = r || it(), F.info("NewVid", { vid: window.UserLeap.visitorId }), x("vid", window.UserLeap.visitorId), r || (t[window.UserLeap.envId] = window.UserLeap.visitorId, D.setItemObject("sprig.anon.env.vid.map", t)), g.emit(u.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId });
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function It(t, r, n, s) {
|
|
558
558
|
var e, i;
|
|
559
559
|
try {
|
|
560
560
|
if (t.endsWith("mock_snippet.html")) return;
|
|
561
|
-
|
|
561
|
+
F.info("PageView", { url: t });
|
|
562
562
|
const o = (e = document == null ? void 0 : document.querySelector('meta[name="description"]')) == null ? void 0 : e.getAttribute("content");
|
|
563
|
-
(i =
|
|
563
|
+
(i = U.replay) == null || i.RecordPageView({ ...o && { description: o }, url: t, referrer: document.referrer, pageTitle: document.title });
|
|
564
564
|
const a = window.UserLeap._config.pageUrlEvents;
|
|
565
565
|
let l = !1;
|
|
566
|
-
if (a && a.length) for (let d = 0; d < a.length && (l =
|
|
566
|
+
if (a && a.length) for (let d = 0; d < a.length && (l = ot(a[d], t), !l); d++) ;
|
|
567
567
|
if (!l) return;
|
|
568
568
|
window.UserLeap.debugMode && console.info("[DEBUG] Sprig trackPageView", t);
|
|
569
|
-
const
|
|
570
|
-
s && (
|
|
569
|
+
const c = { url: t };
|
|
570
|
+
s && (c.trackPageView = !0), window.UserLeap._queue.push(["track", ht, r, c, n]);
|
|
571
571
|
} catch (o) {
|
|
572
572
|
o instanceof Error && (o.stack = t, window.UserLeap.reportError("trackPageView", o)), console.warn("[Sprig] (ERR-428) Failed to track page view", o);
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
|
-
function
|
|
575
|
+
function Zt() {
|
|
576
576
|
const t = "Backbone" in window && window.Backbone && window.Backbone.history ? window.Backbone.history : window.history;
|
|
577
577
|
"pushState" in t && (t.pushState = /* @__PURE__ */ ((r) => function(...n) {
|
|
578
578
|
const s = r.apply(this, n), e = new Event("pushState");
|
|
@@ -582,23 +582,23 @@ function Yt() {
|
|
|
582
582
|
return window.dispatchEvent(e), te(e), s;
|
|
583
583
|
})(t.replaceState)), ["hashchange", "popstate"].forEach((r) => window.addEventListener(r, te, !0));
|
|
584
584
|
}
|
|
585
|
-
async function
|
|
586
|
-
const n =
|
|
587
|
-
t && !r && (window.UserLeap._config.mode =
|
|
588
|
-
const s =
|
|
589
|
-
const o = new URL(
|
|
585
|
+
async function Ie(t, r) {
|
|
586
|
+
const n = Ae();
|
|
587
|
+
t && !r && (window.UserLeap._config.mode = Qt);
|
|
588
|
+
const s = me(T(window.UserLeap)), e = await C(function(i) {
|
|
589
|
+
const o = new URL(O("1", [V], "questions"));
|
|
590
590
|
return Object.entries(i || {}).forEach(([a, l]) => {
|
|
591
591
|
l && o.searchParams.append(a, String(l));
|
|
592
592
|
}), o.toString();
|
|
593
593
|
}({ desktopDisplay: window.UserLeap._config.desktopDisplay, isMobile: s, previewLanguage: window.UserLeap._config.previewLanguage, surveyid: t == null ? void 0 : t.surveyId, surveytemplateid: t == null ? void 0 : t.surveyTemplateId, vid: n }), { shouldDropOnRateLimit: !0 });
|
|
594
594
|
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" };
|
|
595
|
-
if (e.json.delay && await
|
|
595
|
+
if (e.json.delay && await st(e.json.delay), !e.json.isFeedback) return X(e.json, ee, Pe);
|
|
596
596
|
{
|
|
597
|
-
const { feedbackLabel: i, productConfig: o, surveyUuid: a, feedbackCustomStyles: l } = e.json, { buttonTheme:
|
|
598
|
-
|
|
597
|
+
const { feedbackLabel: i, productConfig: o, surveyUuid: a, feedbackCustomStyles: l } = e.json, { buttonTheme: c, placement: d, desktopDisplay: p } = o;
|
|
598
|
+
yt({ customStyles: l, buttonTheme: c, desktopDisplay: p, eventId: 0, feedbackLabel: i, placement: d, surveyUuid: a, surveyId: t == null ? void 0 : t.surveyId }, e.json);
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
|
-
function
|
|
601
|
+
function er(t) {
|
|
602
602
|
if (!t) return;
|
|
603
603
|
window.UserLeap._config = t, t.mute && window.UserLeap._queue.pause();
|
|
604
604
|
const { interactiveEvents: r, pageUrlEvents: n, dismissOnPageChange: s } = t;
|
|
@@ -610,53 +610,53 @@ function Xt(t) {
|
|
|
610
610
|
const a = e[i];
|
|
611
611
|
e[i] = e[o], e[o] = a;
|
|
612
612
|
}
|
|
613
|
-
}(r), (r || n || s) && (
|
|
613
|
+
}(r), (r || n || s) && (Zt(), te());
|
|
614
614
|
}
|
|
615
|
-
const
|
|
615
|
+
const tr = function(t) {
|
|
616
616
|
if (!window.UserLeap) return;
|
|
617
617
|
const r = async (e = {}) => {
|
|
618
|
-
var v, L,
|
|
619
|
-
const { userId: i, anonymousId: o, metadata: a = {}, properties: l, showSurveyCallback:
|
|
618
|
+
var b, v, L, E, R;
|
|
619
|
+
const { userId: i, anonymousId: o, metadata: a = {}, properties: l, showSurveyCallback: c } = e;
|
|
620
620
|
let { eventName: d } = e;
|
|
621
|
-
if (window.UserLeap.debugMode && d !==
|
|
622
|
-
const
|
|
621
|
+
if (window.UserLeap.debugMode && d !== ht && console.info("[DEBUG] Sprig track", e), t.mode === "test") return;
|
|
622
|
+
const p = D.getItem("sprig.previewKey") ?? void 0;
|
|
623
623
|
if (t.requireUserIdForTracking && !window.UserLeap.userId && !i) {
|
|
624
|
-
const
|
|
625
|
-
return console.warn(
|
|
624
|
+
const I = "[Sprig] - Skipping tracking without userId";
|
|
625
|
+
return console.warn(I), { success: !1, message: I, surveyState: "no survey" };
|
|
626
626
|
}
|
|
627
627
|
if (!d || d.trim().length === 0) {
|
|
628
628
|
d = d ? String(d) : "";
|
|
629
|
-
const
|
|
630
|
-
return console.warn(
|
|
629
|
+
const I = "[Sprig] - Invalid event name " + d;
|
|
630
|
+
return console.warn(I), { success: !1, message: I, surveyState: "no survey" };
|
|
631
631
|
}
|
|
632
|
-
const
|
|
633
|
-
a.url || (a.url =
|
|
634
|
-
const
|
|
635
|
-
if (!
|
|
636
|
-
const
|
|
637
|
-
return
|
|
632
|
+
const m = ee ?? window.location.href;
|
|
633
|
+
a.url || (a.url = m), x("trackStartUrl", m), (v = (b = window.UserLeap) == null ? void 0 : b._config) != null && v.optimizelyEnabled && (ie(T(window.UserLeap)) || ae.getAndSetWebOptimizelyExperiments(), a.optimizelyExperiments = Object.assign({}, ae.getAllOptimizelyExperiments())), (E = (L = window.UserLeap) == null ? void 0 : L._config) != null && E.launchDarklyEnabled && (a.launchDarklyFlags = _e.getAllLaunchDarklyVariations()), i && (window.UserLeap.userId = i), o && (window.UserLeap.partnerAnonymousId = o), l && (a.eventProperties = l), (R = U.replay) == null || R.RecordEvent({ name: d, url: a.url }), F.info("TrackEvent", { eventName: d });
|
|
634
|
+
const y = window.UserLeap.delayingSurvey || ut() ? await C(O("1", [H], "events/batch"), { body: JSON.stringify({ events: [{ event: d, metadata: a }], previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 }) : await C(O("1", [H], "events"), { body: JSON.stringify({ event: d, metadata: a, previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 });
|
|
635
|
+
if (!y.ok) {
|
|
636
|
+
const I = "[Sprig] (ERR-421) Failed to track event";
|
|
637
|
+
return y.reportError && (console.warn(I, y.error), y.error && window.UserLeap.reportError("track", y.error)), { success: !1, message: I, error: y.error, surveyState: "no survey" };
|
|
638
638
|
}
|
|
639
|
-
i &&
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
const
|
|
643
|
-
return
|
|
644
|
-
var
|
|
645
|
-
let
|
|
646
|
-
return !(
|
|
647
|
-
}(
|
|
639
|
+
i && x("uid", i), o && x("aid", o);
|
|
640
|
+
const w = y.json;
|
|
641
|
+
w.invalidPreviewKey && D.removeItem("sprig.previewKey");
|
|
642
|
+
const k = a.trackPageView ? a.url : void 0;
|
|
643
|
+
return w != null && w.feedbackButton && yt(w.feedbackButton, void 0, k), await async function(I, j) {
|
|
644
|
+
var z, _;
|
|
645
|
+
let A = !0;
|
|
646
|
+
return !(j && ((z = I == null ? void 0 : I.json) != null && z.surveyId) && (window.UserLeap.delayingSurvey = !0, A = await j(I.json.surveyId), window.UserLeap.delayingSurvey = !1, !A)) && ((_ = I == null ? void 0 : I.json) != null && _.delay && !window.UserLeap.isMobileSDK && (window.UserLeap.delayingSurvey = !0, await st(I.json.delay), window.UserLeap.delayingSurvey = !1), A);
|
|
647
|
+
}(y, c) ? function(I) {
|
|
648
648
|
if (!window.UserLeap._config.dismissOnPageChange) return !0;
|
|
649
|
-
const
|
|
650
|
-
return
|
|
651
|
-
}(
|
|
649
|
+
const j = new URL(I), A = new URL(ee ?? window.location.href);
|
|
650
|
+
return j.hostname === A.hostname && j.pathname === A.pathname;
|
|
651
|
+
}(m) ? X(w, k, Pe) : { 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" };
|
|
652
652
|
}, n = (e, i) => {
|
|
653
653
|
var a;
|
|
654
|
-
const o = (a = e == null ? void 0 : e.querySelector(`[id="${
|
|
655
|
-
o &&
|
|
656
|
-
}, s = { displaySurvey: async (e) => (console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."), window.UserLeap("dismissActiveSurvey", M.Override),
|
|
657
|
-
window.UserLeap("dismissActiveSurvey", M.Override),
|
|
654
|
+
const o = (a = e == null ? void 0 : e.querySelector(`[id="${Oe}"]`)) == null ? void 0 : a.contentDocument;
|
|
655
|
+
o && de({ document: o, elementId: "ul-custom-style", styleString: i });
|
|
656
|
+
}, s = { displaySurvey: async (e) => (console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."), window.UserLeap("dismissActiveSurvey", M.Override), Ie({ surveyId: e }, !0)), _previewSurvey(e) {
|
|
657
|
+
window.UserLeap("dismissActiveSurvey", M.Override), Ie({ surveyTemplateId: e }, !1);
|
|
658
658
|
}, _reviewSurvey(e) {
|
|
659
|
-
window.UserLeap("dismissActiveSurvey", M.Override),
|
|
659
|
+
window.UserLeap("dismissActiveSurvey", M.Override), Ie({ surveyId: e }, !1);
|
|
660
660
|
}, previewSurvey(e) {
|
|
661
661
|
s._previewSurvey(e);
|
|
662
662
|
}, reviewSurvey(e) {
|
|
@@ -668,7 +668,7 @@ const Zt = function(t) {
|
|
|
668
668
|
}, setVisitorToken() {
|
|
669
669
|
console.warn("[Sprig] setVisitorToken is deprecated.");
|
|
670
670
|
}, dismissActiveSurvey(e = M.API) {
|
|
671
|
-
window.UserLeap.container && (e === M.Closed && window.Sprig.trackHistory && window.Sprig.trackHistory({ event: "closed" }),
|
|
671
|
+
window.UserLeap.container && (e === M.Closed && window.Sprig.trackHistory && window.Sprig.trackHistory({ event: "closed" }), g.emit(u.SurveyCloseRequested, { name: u.SurveyCloseRequested, initiator: e, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }), g.emit(u.SurveyWillClose, { name: u.SurveyWillClose, initiator: e, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }));
|
|
672
672
|
}, async setAttribute(e, i) {
|
|
673
673
|
if (!e || !i && i !== 0 && i !== !1) {
|
|
674
674
|
const o = "[Sprig] - Disregarding empty attribute / value provided";
|
|
@@ -695,12 +695,12 @@ const Zt = function(t) {
|
|
|
695
695
|
if (a) {
|
|
696
696
|
a.email && !a[Q] && (a[Q] = a.email, delete a.email);
|
|
697
697
|
const d = Object.keys(a);
|
|
698
|
-
for (const
|
|
698
|
+
for (const p of d) a[p] === ye[p] && delete a[p];
|
|
699
699
|
}
|
|
700
700
|
if (!(a && Object.keys(a).length !== 0 || i && window.UserLeap.userId !== i || o && window.UserLeap.partnerAnonymousId !== o)) return { success: !0 };
|
|
701
701
|
const l = {};
|
|
702
|
-
let
|
|
703
|
-
return i && (l.userId = window.UserLeap.userId = i), o && (l.partnerAnonymousId = window.UserLeap.partnerAnonymousId = o), a && Object.keys(a).length > 0 ? (
|
|
702
|
+
let c;
|
|
703
|
+
return i && (l.userId = window.UserLeap.userId = i), o && (l.partnerAnonymousId = window.UserLeap.partnerAnonymousId = o), a && Object.keys(a).length > 0 ? (c = await C(O("1", [V, H], "attributes"), { body: JSON.stringify(a), method: "PUT" }), c.ok ? Object.assign(ye, a) : c.reportError && (console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed", c.error), c.error && window.UserLeap.reportError("identifyAndSetAttributes", c.error))) : c = await C(O("1", [V, H]), { body: JSON.stringify(l), method: "PUT" }), a && a[Q] && (window.UserLeap.email = a[Q]), c.ok && (i && x("uid", i), o && x("aid", o)), { success: !!c.ok };
|
|
704
704
|
}, async removeAttributes(e) {
|
|
705
705
|
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig removeAttributes", e), t.mode === "test") return;
|
|
706
706
|
if (e == null || e.length === 0) {
|
|
@@ -711,20 +711,20 @@ const Zt = function(t) {
|
|
|
711
711
|
const o = "[Sprig] - Skipping tracking without userId";
|
|
712
712
|
return console.warn(o), { success: !1, message: o };
|
|
713
713
|
}
|
|
714
|
-
const i = await O(
|
|
714
|
+
const i = await C(O("1", [V, H], "attributes"), { body: JSON.stringify({ delete: e }), method: "DELETE" });
|
|
715
715
|
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 };
|
|
716
716
|
}, async addSurveyListener(e) {
|
|
717
|
-
|
|
717
|
+
g.on(u.SurveyLifeCycle, e);
|
|
718
718
|
}, async removeSurveyListener(e) {
|
|
719
|
-
|
|
719
|
+
g.removeListener(u.SurveyLifeCycle, e);
|
|
720
720
|
}, async addListener(e, i) {
|
|
721
|
-
|
|
721
|
+
g.on(e, i);
|
|
722
722
|
}, async removeListener(e, i) {
|
|
723
|
-
|
|
723
|
+
g.removeListener(e, i);
|
|
724
724
|
}, async removeAllListeners() {
|
|
725
|
-
|
|
725
|
+
g.removeAllListeners();
|
|
726
726
|
}, setPreviewKey(e) {
|
|
727
|
-
e && typeof e == "string" &&
|
|
727
|
+
e && typeof e == "string" && D.isStorageAvailable && e && D.setItem("sprig.previewKey", e);
|
|
728
728
|
}, async setUserId(e) {
|
|
729
729
|
var a;
|
|
730
730
|
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig setUserId", e), e == null) {
|
|
@@ -733,38 +733,38 @@ const Zt = function(t) {
|
|
|
733
733
|
}
|
|
734
734
|
if (t.mode === "test" || e === window.UserLeap.userId) return;
|
|
735
735
|
window.UserLeap.userId = e;
|
|
736
|
-
const i = window.UserLeap.visitorId, o = await O(
|
|
737
|
-
o.ok ? (i !== window.UserLeap.visitorId && ((a =
|
|
736
|
+
const i = window.UserLeap.visitorId, o = await C(O("1", [V, H]), { body: JSON.stringify({ userId: e }), method: "PUT" });
|
|
737
|
+
o.ok ? (i !== window.UserLeap.visitorId && ((a = U.replay) == null || a.clearUserReplayData()), x("uid", e)) : o.reportError && (console.warn("[Sprig] (ERR-420) Failed to set user id", o.error), o.error && window.UserLeap.reportError("setUserId", o.error));
|
|
738
738
|
}, async setPartnerAnonymousId(e) {
|
|
739
739
|
if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig setPartnerAnonymousId", e), e == null) {
|
|
740
740
|
const i = `[Sprig] - Invalid partnerAnonymousId ${e}`;
|
|
741
741
|
return console.warn(i), { success: !1, message: i };
|
|
742
742
|
}
|
|
743
|
-
return window.UserLeap.partnerAnonymousId = e,
|
|
743
|
+
return window.UserLeap.partnerAnonymousId = e, x("aid", e), { success: !0 };
|
|
744
744
|
}, track: async (e, i, o = {}, a = void 0) => r({ eventName: e, properties: i, metadata: o, showSurveyCallback: a }), identifyAndTrack: async (e) => await r(e), trackPageView(e, i = void 0, o = void 0, a = !0) {
|
|
745
|
-
ee = e,
|
|
745
|
+
ee = e, It(e, i, o, a);
|
|
746
746
|
}, applyFeedbackStyles({ button: e = "", view: i = "" }) {
|
|
747
|
-
window.UserLeap.feedbackCustomStyles = i, document.getElementById("sprig-feedback-style") &&
|
|
747
|
+
window.UserLeap.feedbackCustomStyles = i, document.getElementById("sprig-feedback-style") && de({ document, elementId: "ul-custom-style", styleString: e, nonce: window.UserLeap.styleNonce }), n(document.querySelector(".ul-container-feedback"), i);
|
|
748
748
|
}, applyStyles(e) {
|
|
749
749
|
window.UserLeap.customStyles = e, n(window.UserLeap.container, e);
|
|
750
750
|
}, setWindowDimensions(e, i) {
|
|
751
|
-
var
|
|
751
|
+
var m, y;
|
|
752
752
|
const o = typeof e == "string" ? parseInt(e, 10) : e, a = typeof i == "string" ? parseInt(i, 10) : i;
|
|
753
753
|
isNaN(o) || isNaN(a) || (window.UserLeap.windowDimensions = { width: o, height: a });
|
|
754
|
-
const l =
|
|
754
|
+
const l = T(window.UserLeap), c = me(l), d = l["userleap-platform"] === "web";
|
|
755
755
|
if (!window.UserLeap.frameId) return;
|
|
756
|
-
const
|
|
757
|
-
|
|
756
|
+
const p = document.getElementById(window.UserLeap.frameId);
|
|
757
|
+
p && (window.UserLeap.useMobileStyling && ((m = window.UserLeap.windowDimensions) != null && m.width && (p.style.width = `${window.UserLeap.windowDimensions.width}px`), (y = window.UserLeap.windowDimensions) != null && y.height && (p.style.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px"), p.contentDocument && (p.style.height = String(Ht(p.contentDocument, d && !c, nt(l))[0]) + "px")), g.emit(u.SurveyDimensions, { name: u.SurveyDimensions, contentFrameWidth: p.clientWidth, contentFrameHeight: p.clientHeight, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }));
|
|
758
758
|
}, logoutUser() {
|
|
759
759
|
var e;
|
|
760
|
-
window.UserLeap.debugMode && console.info("[DEBUG] Sprig logout"),
|
|
760
|
+
window.UserLeap.debugMode && console.info("[DEBUG] Sprig logout"), F.info("LogOut", { vid: window.UserLeap.visitorId, userId: window.UserLeap.userId }), window.UserLeap.visitorId = null, window.UserLeap.userId = null, window.UserLeap.partnerAnonymousId = null, window.UserLeap.token = null, window.UserLeap.email = null, D.removeItem("userleap.ids"), window.UserLeap._queue.isPaused() && window.UserLeap._queue.empty(), St(), (e = U.replay) == null || e.clearUserReplayData(), window.UserLeap._queue.unpause();
|
|
761
761
|
}, teardown() {
|
|
762
|
-
["hashchange", "popstate"].forEach((e) => window.removeEventListener(e, te, !0)), window.UserLeap._config.interactiveEvents &&
|
|
762
|
+
["hashchange", "popstate"].forEach((e) => window.removeEventListener(e, te, !0)), window.UserLeap._config.interactiveEvents && Lt(), window.UserLeap("dismissActiveSurvey", M.API), delete window.UserLeap, delete window.Sprig, delete window._Sprig;
|
|
763
763
|
}, integrateOptimizely(e, i = !0) {
|
|
764
764
|
var o, a;
|
|
765
765
|
if ((a = (o = window.UserLeap) == null ? void 0 : o._config) != null && a.optimizelyEnabled) try {
|
|
766
766
|
const l = typeof e == "string" ? JSON.parse(e) : e;
|
|
767
|
-
|
|
767
|
+
ae.setOptimizelyExperiment(l, i);
|
|
768
768
|
} catch (l) {
|
|
769
769
|
console.warn("[Sprig] Error with integrating Optimizely data"), l instanceof Error && window.UserLeap.reportError("integrateOptimizely", l);
|
|
770
770
|
}
|
|
@@ -773,12 +773,12 @@ const Zt = function(t) {
|
|
|
773
773
|
var i, o;
|
|
774
774
|
if (!((o = (i = window.UserLeap) == null ? void 0 : i._config) != null && o.optimizelyEnabled)) return void console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");
|
|
775
775
|
e.notificationCenter.addNotificationListener("ACTIVATE:experiment, user_id,attributes, variation, event", ({ experiment: a, variation: l }) => {
|
|
776
|
-
const
|
|
777
|
-
window.UserLeap("integrateOptimizely",
|
|
776
|
+
const c = { experiments: [{ id: a.id, variation: l.key }] };
|
|
777
|
+
window.UserLeap("integrateOptimizely", c, !1);
|
|
778
778
|
});
|
|
779
779
|
}, importLaunchDarklyData(e) {
|
|
780
780
|
var i, o;
|
|
781
|
-
(o = (i = window.UserLeap) == null ? void 0 : i._config) != null && o.launchDarklyEnabled ?
|
|
781
|
+
(o = (i = window.UserLeap) == null ? void 0 : i._config) != null && o.launchDarklyEnabled ? _e.setLDFlagsVariations(e) : console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");
|
|
782
782
|
}, setVisitorAttribute: (e, i) => (console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"), s.setAttribute(e, i)), setEmail: async (e) => s.setAttribute(Q, e), setVisitorEmail: async (e) => (console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"), s.setEmail(e)), _generateVideoUploadUrl: async (e) => async function(i) {
|
|
783
783
|
var a;
|
|
784
784
|
if (!i) return;
|
|
@@ -786,84 +786,84 @@ const Zt = function(t) {
|
|
|
786
786
|
try {
|
|
787
787
|
const l = await fetch(o, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(i) });
|
|
788
788
|
if (l.ok) {
|
|
789
|
-
const
|
|
790
|
-
return (a =
|
|
789
|
+
const c = await l.json();
|
|
790
|
+
return (a = c == null ? void 0 : c.upload) == null ? void 0 : a.url;
|
|
791
791
|
}
|
|
792
792
|
return null;
|
|
793
793
|
} catch (l) {
|
|
794
794
|
console.warn("[Sprig] Error with generating video upload url"), l instanceof Error && window.UserLeap.reportError("generateVideoUploadUrl", l);
|
|
795
795
|
}
|
|
796
796
|
}(e), _reportMetric(e, i) {
|
|
797
|
-
|
|
797
|
+
Ot(e, i);
|
|
798
798
|
}, _completeSessionReplay: async ({ surveyId: e, responseGroupUuid: i, eventDigest: o }) => {
|
|
799
799
|
var a;
|
|
800
|
-
return
|
|
800
|
+
return U.replay ? (a = U.replay) == null ? void 0 : a._completeSessionReplay({ surveyId: e, responseGroupUuid: i, eventDigest: o, headers: T(window.UserLeap) }) : (window.UserLeap.reportError("_completeSessionReplay", new Error("Replay module not registered")), !1);
|
|
801
801
|
}, pauseReplayRecording() {
|
|
802
802
|
var e, i, o, a;
|
|
803
|
-
(i = (e =
|
|
803
|
+
(i = (e = U.replay) == null ? void 0 : e.isReplayPaused) != null && i.call(e) || ((a = (o = U.replay) == null ? void 0 : o.recordReplayPaused) == null || a.call(o));
|
|
804
804
|
}, resumeReplayRecording() {
|
|
805
|
-
var e, i, o, a, l,
|
|
806
|
-
(i = (e =
|
|
805
|
+
var e, i, o, a, l, c;
|
|
806
|
+
(i = (e = U.replay) == null ? void 0 : e.isReplayPaused) != null && i.call(e) && ((a = (o = U.replay) == null ? void 0 : o.recordReplayResumed) == null || a.call(o), (c = (l = U.replay) == null ? void 0 : l.recordFullSnapshot) == null || c.call(l));
|
|
807
807
|
} };
|
|
808
808
|
Object.assign(window.UserLeap, s);
|
|
809
809
|
};
|
|
810
|
-
async function
|
|
811
|
-
const e = window.__cfg && window.__cfg.mode, i =
|
|
812
|
-
(await O(
|
|
810
|
+
async function rr(t, r, n = {}, s = {}) {
|
|
811
|
+
const e = window.__cfg && window.__cfg.mode, i = Ae(), o = window.UserLeap.envId, a = window.document.documentElement, l = { mode: e, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: a.clientWidth, clientHeight: a.clientHeight, location: ee ?? window.location.href, language: window.navigator.language, ...n }, c = { action: t, breadcrumbs: F.breadcrumbs, err: { message: `${r == null ? void 0 : r.name} - ${r == null ? void 0 : r.message}`, stack: r == null ? void 0 : r.stack }, meta: l, vid: i, envId: o, ...s };
|
|
812
|
+
(await C(O("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", r);
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function ir(t = {}) {
|
|
815
815
|
var s;
|
|
816
816
|
(s = window.SprigLoggerCallback) == null || s.call(window, "Initializing Sprig");
|
|
817
817
|
const r = new URLSearchParams(window.location.search).get("sprigPreviewKey") ?? "";
|
|
818
818
|
async function n() {
|
|
819
|
-
var
|
|
819
|
+
var p, m, y, w, k;
|
|
820
820
|
if (window.UserLeap.loaded) return;
|
|
821
|
-
if ((
|
|
821
|
+
if ((p = window.SprigLoggerCallback) == null || p.call(window, "Loading Sprig"), window.UserLeap.reportError = rr, window.UserLeap.loaded = !0, window.UserLeap._config = Object.assign({}, t, window.UserLeap.config), window.UserLeap.delayingSurvey = !1, window.UserLeap._config && typeof window.UserLeap._config == "object") for (const f in window.UserLeap._config) window.UserLeap[f] = window.UserLeap._config[f];
|
|
822
822
|
if (window.Sprig.outstandingTransactionLimit !== void 0 && (t.outstandingTransactionLimit = window.Sprig.outstandingTransactionLimit), !window.UserLeap.envId) {
|
|
823
823
|
if (!window.UserLeap.appId) throw new Error("Missing Environment id");
|
|
824
824
|
window.UserLeap.envId = window.UserLeap.appId;
|
|
825
825
|
}
|
|
826
826
|
window.UserLeap.debugMode && console.info("[DEBUG] Sprig debug mode enabled");
|
|
827
|
-
const e =
|
|
827
|
+
const e = Ut(), i = window.UserLeap.sampleRate;
|
|
828
828
|
let o = e.sampled;
|
|
829
829
|
if (i) {
|
|
830
|
-
if (o === null && (o = Math.random() < i,
|
|
831
|
-
} else o !== null &&
|
|
830
|
+
if (o === null && (o = Math.random() < i, x("sampled", o)), !o) return;
|
|
831
|
+
} else o !== null && x("sampled", null);
|
|
832
832
|
window.UserLeap._API_URL || (window.UserLeap._API_URL = "https://api.sprig.com");
|
|
833
833
|
const a = [...window.UserLeap._queue];
|
|
834
|
-
window.UserLeap._queue = new
|
|
834
|
+
window.UserLeap._queue = new Bt(window.UserLeap, []), window.UserLeap._queue.pause();
|
|
835
835
|
for (let f = 0; f < a.length; f++) window.UserLeap._queue.push(a[f]);
|
|
836
836
|
const l = e.token;
|
|
837
|
-
l ? (window.UserLeap.token = l, window.UserLeap.visitorId = e.vid ?? null, window.UserLeap.userId = e.uid ?? null, window.UserLeap.partnerAnonymousId = e.aid ?? null) :
|
|
838
|
-
const
|
|
839
|
-
(
|
|
837
|
+
l ? (window.UserLeap.token = l, window.UserLeap.visitorId = e.vid ?? null, window.UserLeap.userId = e.uid ?? null, window.UserLeap.partnerAnonymousId = e.aid ?? null) : St();
|
|
838
|
+
const c = ie(T(window.UserLeap));
|
|
839
|
+
(m = window.SprigLoggerCallback) == null || m.call(window, "Sprig fetching config");
|
|
840
840
|
const d = await async function(f) {
|
|
841
|
-
var
|
|
842
|
-
const
|
|
843
|
-
document.addEventListener("securitypolicyviolation",
|
|
844
|
-
const
|
|
845
|
-
if (document.removeEventListener("securitypolicyviolation",
|
|
846
|
-
const
|
|
847
|
-
return
|
|
841
|
+
var E, R;
|
|
842
|
+
const b = T(window.UserLeap);
|
|
843
|
+
document.addEventListener("securitypolicyviolation", We);
|
|
844
|
+
const v = await rt(O("1", [V], "config"), { headers: b });
|
|
845
|
+
if (document.removeEventListener("securitypolicyviolation", We), !v.ok) return (E = window.SprigLoggerCallback) == null || E.call(window, "Sprig config fetch failed"), v.reportError && (console.warn("[Sprig] (ERR-422) Failed to load configuration", v.error), v.error && window.UserLeap.reportError("applyRemoteConfig", v.error)), Be("Disabled: failed to fetch configuration"), f;
|
|
846
|
+
const L = v.json;
|
|
847
|
+
return L != null && L.disabled ? ((R = window.SprigLoggerCallback) == null || R.call(window, "Sprig config fetch disabled"), Be(`Disabled: ${L.disabled}`), { disabled: L.disabled }) : Object.assign({}, L, f);
|
|
848
848
|
}(t);
|
|
849
|
-
if ((
|
|
850
|
-
var
|
|
851
|
-
await O(
|
|
852
|
-
} }), !
|
|
853
|
-
const f = d.alwaysOnReplay ? { userAgent: window.navigator.userAgent, surveyId: d.alwaysOnReplay.surveyId, responseGroupUuid: d.alwaysOnReplay.responseGroupUuid, sdkVersion: "2.
|
|
854
|
-
await ((
|
|
849
|
+
if ((y = window.SprigLoggerCallback) == null || y.call(window, "Sprig fetched config"), Jt({ isWeb: !c, reportingIntervalSeconds: d.metricsReportingEnabled || d.mobileMetricsReportingEnabled ? d.metricsReportingIntervalSeconds : 0, thresholds: d.metricThresholds, postMetrics: async (f) => {
|
|
850
|
+
var b;
|
|
851
|
+
await C(O("1", [V], "metrics"), { body: f, method: "POST", headers: { "x-ul-replay-enabled": `${!!((b = U.replay) != null && b.isReplayRecording())}` }, shouldDropOnRateLimit: !0 });
|
|
852
|
+
} }), !c) {
|
|
853
|
+
const f = d.alwaysOnReplay ? { userAgent: window.navigator.userAgent, surveyId: d.alwaysOnReplay.surveyId, responseGroupUuid: d.alwaysOnReplay.responseGroupUuid, sdkVersion: "2.39.0", maxDurationSeconds: d.alwaysOnReplay.maxDurationSeconds } : void 0;
|
|
854
|
+
await ((w = U.replay) == null ? void 0 : w.initializeReplay({ maxReplayDurationSeconds: d.maxReplayDurationSeconds, maxInflightRequests: window.UserLeap.maxInflightReplayRequests ?? 2, replaySettings: d.replaySettings, apiUrl: window.UserLeap._API_URL, alwaysOnConfig: f })), Pe = d.replaySettings;
|
|
855
855
|
}
|
|
856
|
-
|
|
857
|
-
for (const f in
|
|
856
|
+
tr(d), await er(d), window.UserLeap._queue.unpause(), (k = window.SprigLoggerCallback) == null || k.call(window, "SdkReady"), g.emit(u.SDKReady, { mobileMetricsReportingEnabled: !!d.mobileMetricsReportingEnabled, metricsReportingInterval: d.metricsReportingIntervalSeconds || 0, metricsThresholds: d.metricThresholds || [], maxMobileReplayDurationSeconds: d.maxMobileReplayDurationSeconds, mobileReplaySettings: d.mobileReplaySettings }), g.emit(u.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId }), g.on(u.VisitorIDUpdated, () => {
|
|
857
|
+
for (const f in ye) delete ye[f];
|
|
858
858
|
});
|
|
859
859
|
}
|
|
860
860
|
window.UserLeap.UPDATES = re, window.UserLeap("setPreviewKey", r), document.readyState === "complete" ? n() : window.attachEvent ? window.attachEvent("onload", n) : window.addEventListener("load", () => {
|
|
861
861
|
n();
|
|
862
862
|
}, !1);
|
|
863
863
|
}
|
|
864
|
-
class
|
|
864
|
+
class De {
|
|
865
865
|
constructor() {
|
|
866
|
-
|
|
866
|
+
B(this, "UPDATES", re);
|
|
867
867
|
}
|
|
868
868
|
displaySurvey(r) {
|
|
869
869
|
window.Sprig("displaySurvey", r);
|
|
@@ -935,30 +935,30 @@ class Re {
|
|
|
935
935
|
window.Sprig("resumeReplayRecording");
|
|
936
936
|
}
|
|
937
937
|
}
|
|
938
|
-
const
|
|
938
|
+
const tt = { configure: (t) => {
|
|
939
939
|
if (!t.envId && !t.environmentId) throw new Error("Initialization Error: Sprig configure requires an environmentId");
|
|
940
940
|
if (t.envId || (t.envId = t.environmentId ?? ""), t.installationMethod = "web-npm", window.Sprig) return window.Sprig;
|
|
941
941
|
window.Sprig = function() {
|
|
942
942
|
window.Sprig._queue.push(arguments);
|
|
943
|
-
}, Object.getOwnPropertyNames(
|
|
944
|
-
n !== "constructor" && (window.Sprig[n] =
|
|
943
|
+
}, Object.getOwnPropertyNames(De.prototype).map((n) => {
|
|
944
|
+
n !== "constructor" && (window.Sprig[n] = De.prototype[n]);
|
|
945
945
|
});
|
|
946
946
|
const r = window.Sprig;
|
|
947
|
-
return r.appId = t.envId, r._queue = [], window.UserLeap = r,
|
|
948
|
-
} },
|
|
947
|
+
return r.appId = t.envId, r._queue = [], window.UserLeap = r, ir(t), window.Sprig;
|
|
948
|
+
} }, wr = { sprig: tt, SprigAPI: De, configure: tt.configure };
|
|
949
949
|
export {
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
950
|
+
ar as A,
|
|
951
|
+
Pt as C,
|
|
952
|
+
dr as D,
|
|
953
|
+
cr as E,
|
|
954
|
+
De as S,
|
|
955
|
+
lr as a,
|
|
956
|
+
pr as b,
|
|
957
|
+
wr as c,
|
|
958
958
|
sr as d,
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
959
|
+
Ht as e,
|
|
960
|
+
de as f,
|
|
961
|
+
q as i,
|
|
962
|
+
ur as r,
|
|
963
|
+
tt as s
|
|
964
964
|
};
|