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