@sprig-technologies/sprig-browser 2.32.11 → 2.33.1

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,29 +1,29 @@
1
1
  var Ut = Object.defineProperty;
2
2
  var St = (t, e, n) => e in t ? Ut(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
3
  var $ = (t, e, n) => (St(t, typeof e != "symbol" ? e + "" : e, n), n);
4
- import { g as T, s as Xe, l as D, e as w, S as g, v as Ze, m as k, b as M, h as et, E as re, D as W, c as It, r as V, i as kt, j as Et, k as _t, n as Fe, o as ze, a as xt, p as tt, d as Dt, q as rt } from "./metricsReporter-DNUK7N1y.js";
4
+ import { g as T, s as Xe, l as R, e as w, S as u, v as Ze, m as k, b as M, h as et, E as re, D as F, c as It, r as B, i as kt, j as Et, k as _t, n as Fe, o as ze, a as xt, p as tt, d as Rt, q as rt } from "./metricsReporter-Dsn4xUH7.js";
5
5
  const rr = 360, ir = "ul-app", nr = "#e6e6e6", or = "#bd282a", sr = 1030, He = () => {
6
6
  try {
7
7
  return window.parent.Intercom;
8
8
  } catch {
9
9
  return null;
10
10
  }
11
- }, We = [Object.freeze(Object.defineProperty({ __proto__: null, disable: () => {
11
+ }, Ve = [Object.freeze(Object.defineProperty({ __proto__: null, disable: () => {
12
12
  const t = He();
13
13
  t && (t.ul_wasVisible = !!document.querySelector("iframe.intercom-launcher-frame"), t.ul_wasVisible && t("update", { hide_default_launcher: !0 }));
14
14
  }, enable: () => {
15
15
  const t = He();
16
16
  t && (t.ul_wasVisible && t("update", { hide_default_launcher: !1 }), delete t.ul_wasVisible);
17
17
  } }, Symbol.toStringTag, { value: "Module" }))];
18
- class At {
18
+ class Dt {
19
19
  static disable() {
20
- We.forEach((e) => e.disable());
20
+ Ve.forEach((e) => e.disable());
21
21
  }
22
22
  static enable() {
23
- We.forEach((e) => e.enable());
23
+ Ve.forEach((e) => e.enable());
24
24
  }
25
25
  }
26
- const Ne = "ul-view-sdk-script", Rt = ["ios", "android"], q = "visitors", F = "environments";
26
+ const We = "ul-view-sdk-script", At = ["ios", "android"], q = "visitors", z = "environments";
27
27
  async function C(t, e) {
28
28
  var i, o, a;
29
29
  const { shouldDropOnRateLimit: n, ...s } = e;
@@ -32,93 +32,93 @@ async function C(t, e) {
32
32
  if (r.ok) {
33
33
  const l = (i = r.headers) == null ? void 0 : i.get("Authorization"), p = l ? l.split(" ") : void 0, d = p && p.length === 2 ? p[1] : void 0, c = (o = r.headers) == null ? void 0 : o.get("x-ul-visitor-id");
34
34
  if (window.UserLeap.userId && c === window.UserLeap.visitorId) {
35
- const m = D.getItemObject("sprig.anon.env.vid.map");
36
- m && m[window.UserLeap.envId] === c && (delete m[window.UserLeap.envId], D.setItemObject("sprig.anon.env.vid.map", m));
35
+ const y = R.getItemObject("sprig.anon.env.vid.map");
36
+ y && y[window.UserLeap.envId] === c && (delete y[window.UserLeap.envId], R.setItemObject("sprig.anon.env.vid.map", y));
37
37
  }
38
- d && c && (c !== window.UserLeap.visitorId || window.UserLeap.token !== d) && (x("token", d), x("vid", c), w.emit(g.VisitorIDUpdated, { visitorId: c }), window.UserLeap.token = d, window.UserLeap.visitorId = c);
38
+ d && c && (c !== window.UserLeap.visitorId || window.UserLeap.token !== d) && (x("token", d), x("vid", c), w.emit(u.VisitorIDUpdated, { visitorId: c }), window.UserLeap.token = d, window.UserLeap.visitorId = c);
39
39
  }
40
40
  return (a = r.json) != null && a.logMessage && console.warn(`[Sprig] ${r.json.logMessage}`), r;
41
41
  }
42
42
  function x(t, e) {
43
- const n = D.getItemObject("userleap.ids");
43
+ const n = R.getItemObject("userleap.ids");
44
44
  let s = n[window.UserLeap.envId];
45
- s ? s[t] = e : s = { [t]: e }, n[window.UserLeap.envId] = s, D.setItemObject("userleap.ids", n);
45
+ s ? s[t] = e : s = { [t]: e }, n[window.UserLeap.envId] = s, R.setItemObject("userleap.ids", n);
46
46
  }
47
- function De() {
47
+ function Re() {
48
48
  return window.previewMode ? "0" : window.UserLeap.visitorId ?? "";
49
49
  }
50
- function R(t, e, n) {
50
+ function A(t, e, n) {
51
51
  const s = [window.UserLeap._API_URL, "sdk", t];
52
52
  return e && e.forEach((r) => {
53
- s.push(r), r === F ? s.push(window.UserLeap.envId) : r === q && s.push(De());
53
+ s.push(r), r === z ? s.push(window.UserLeap.envId) : r === q && s.push(Re());
54
54
  }), n && s.push(n), s.join("/");
55
55
  }
56
56
  const X = async (t, e) => {
57
57
  var Te, je, Me;
58
- const { context: n, delay: s, forceBrandedLogo: r, endCard: i, isFeedback: o = !1, heatmap: a, locale: l, previewMode: p, productConfig: d, questions: c, responseGroupUid: m, surveyId: u, uuid: y, vid: I, sessionReplay: h, studyType: L } = t, f = T(window.UserLeap), S = ie(f), _ = ge(f);
59
- if (h)
60
- if (S)
61
- w.emit(g.ReplayCapture, { responseGroupUid: m, hasQuestions: !!(c != null && c.length), surveyId: u, uploadId: h.uploadId, replayType: h.replayDurationType ?? "before", seconds: h.replayDurationSeconds, generateVideoUploadUrlPayload: { mediaRecordingUid: Ze(), mediaType: "screen", questionId: 1, responseGroupUid: m, surveyId: u, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), visitorId: window.UserLeap.visitorId, isReplay: !0 } });
58
+ const { context: n, delay: s, forceBrandedLogo: r, endCard: i, isFeedback: o = !1, heatmap: a, locale: l, previewMode: p, productConfig: d, questions: c, responseGroupUid: y, surveyId: g, uuid: m, vid: I, sessionReplay: _, studyType: f } = t, v = T(window.UserLeap), U = ie(v), S = ge(v);
59
+ if (_)
60
+ if (U)
61
+ w.emit(u.ReplayCapture, { responseGroupUid: y, hasQuestions: !!(c != null && c.length), surveyId: g, uploadId: _.uploadId, replayType: _.replayDurationType ?? "before", seconds: _.replayDurationSeconds, generateVideoUploadUrlPayload: { mediaRecordingUid: Ze(), mediaType: "screen", questionId: 1, responseGroupUid: y, surveyId: g, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), visitorId: window.UserLeap.visitorId, isReplay: !0 } });
62
62
  else {
63
63
  if (!k.replay)
64
64
  return window.UserLeap.reportError("displayQuestions", new Error("Replay module not registered")), { success: !1, message: "Replay module not registered", surveyState: "no survey" };
65
- k.replay.scheduleOrCaptureReplay({ responseGroupId: m, surveyId: u, visitorId: I, replayParams: h, completeUploadHeaders: f, apiUrl: window.UserLeap._API_URL, triggerTimestamp: Date.now(), isStandalone: c.length === 0 });
65
+ k.replay.scheduleOrCaptureReplay({ responseGroupId: y, surveyId: g, visitorId: I, replayParams: _, completeUploadHeaders: v, apiUrl: window.UserLeap._API_URL, triggerTimestamp: Date.now(), isStandalone: c.length === 0 });
66
66
  }
67
67
  if (a) {
68
68
  if (!k.replay)
69
69
  return window.UserLeap.reportError("displayQuestions", new Error("Replay module not registered")), { success: !1, message: "Replay module not registered", surveyState: "no survey" };
70
- const { eventId: U, replayParams: J, responseGroupUid: fe, surveyId: ve } = a;
71
- await k.replay.initializeReplay({ maxReplayDurationSeconds: 300, maxInflightRequests: window.UserLeap.maxInflightReplayRequests, teardownAfter: !0 }), k.replay.tryReplayAction(() => {
70
+ const { eventId: L, replayParams: J, responseGroupUid: fe, surveyId: ve } = a;
71
+ await k.replay.initializeReplay({ maxReplayDurationSeconds: 300, maxInflightRequests: window.UserLeap.maxInflightReplayRequests, teardownAfter: !0, apiUrl: window.UserLeap._API_URL }), k.replay.tryReplayAction(() => {
72
72
  var qe;
73
- return (qe = k.replay) == null ? void 0 : qe.scheduleCapture({ apiUrl: window.UserLeap._API_URL, completeUploadHeaders: f, eventId: U, isHeatmap: !0, replayParams: J, responseGroupId: fe, surveyId: ve, triggerTimestamp: Date.now(), visitorId: I });
73
+ return (qe = k.replay) == null ? void 0 : qe.scheduleCapture({ apiUrl: window.UserLeap._API_URL, completeUploadHeaders: v, eventId: L, isHeatmap: !0, replayParams: J, responseGroupId: fe, surveyId: ve, triggerTimestamp: Date.now(), visitorId: I });
74
74
  }, "Error in scheduling/capturing replay");
75
75
  }
76
76
  if (I == null || !(c != null && c.length))
77
77
  return M.info("CannotDisplaySurvey", { vid: I }), { success: !1, message: "[Sprig] no survey found", surveyState: "no survey" };
78
78
  if (window.UserLeap.container) {
79
79
  M.info("AlreadyDisplayingSurvey");
80
- const U = "[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";
81
- return console.warn(U), { success: !1, message: U, surveyState: "no survey" };
82
- }
83
- if (I !== window.UserLeap.visitorId && y !== window.UserLeap.visitorId && !window.previewMode) {
84
- const U = "Attempted to display survey to a different visitor";
85
- return window.UserLeap.reportError("DisplaySurvey", new Error(U)), { success: !1, message: U, surveyState: "no survey" };
86
- }
87
- M.info("ShowingSurvey", { surveyId: u }), (Te = k.replay) == null || Te.RecordSurveyShown({ id: u, userAgent: window.navigator.userAgent }), At.disable(), w.emit(g.SurveyWillPresent, { name: g.SurveyWillPresent, "survey.id": u });
88
- let O, b, E, A, z = document.createElement("div");
89
- const K = (U) => {
90
- const { "view.version": J } = U;
91
- J !== f["x-ul-sdk-version"] && nt(), w.removeListener("verify.view.version", K);
80
+ const L = "[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";
81
+ return console.warn(L), { success: !1, message: L, surveyState: "no survey" };
82
+ }
83
+ if (I !== window.UserLeap.visitorId && m !== window.UserLeap.visitorId && !window.previewMode) {
84
+ const L = "Attempted to display survey to a different visitor";
85
+ return window.UserLeap.reportError("DisplaySurvey", new Error(L)), { success: !1, message: L, surveyState: "no survey" };
86
+ }
87
+ M.info("ShowingSurvey", { surveyId: g }), (Te = k.replay) == null || Te.RecordSurveyShown({ id: g, userAgent: window.navigator.userAgent }), Dt.disable(), w.emit(u.SurveyWillPresent, { name: u.SurveyWillPresent, "survey.id": g });
88
+ let O, h, E, D, H = document.createElement("div");
89
+ const K = (L) => {
90
+ const { "view.version": J } = L;
91
+ J !== v["x-ul-sdk-version"] && nt(), w.removeListener("verify.view.version", K);
92
92
  };
93
- w.on("verify.view.version", K), window.UserLeap.useMobileStyling = _, et(f) ? (O = "ul-direct-embeded-frame", b = document.head, E = window, A = !1, (() => {
94
- const U = T(window.UserLeap), J = ie(U), fe = window.UserLeap.forceDirectEmbed, ve = U["userleap-platform"] === "web";
93
+ w.on("verify.view.version", K), window.UserLeap.useMobileStyling = S, et(v) ? (O = "ul-direct-embeded-frame", h = document.head, E = window, D = !1, (() => {
94
+ const L = T(window.UserLeap), J = ie(L), fe = window.UserLeap.forceDirectEmbed, ve = L["userleap-platform"] === "web";
95
95
  return J || fe && ve;
96
- })() && (it(u, o), z.id = O, window.UserLeap.container.appendChild(z), ot(), w.emit(g.SurveyLifeCycle, { state: "presented" }), w.emit(g.SurveyPresented, { name: g.SurveyPresented, "survey.id": u }))) : { frameId: O, contentWinDocHead: b, contentWindow: E, hasOverlay: A, iframe: z } = Ct({ productConfig: d, useMobileStyling: _, surveyId: u, isFeedback: o }), window.UserLeap.frameId = O;
97
- const B = { apiURL: window.UserLeap._API_URL, cards: c, configureExitOnOverlayClick: (U) => {
98
- w.once(g.CloseSurveyOnOverlayClick, U);
99
- }, context: n, endCard: i, envId: window.UserLeap.envId, eventEmitFn: w.emit.bind(w), fontFamily: window.UserLeap.fontFamily, fontFamilyURL: window.UserLeap.fontFamilyURL, forceBrandedLogo: r, frame: z, headers: f, locale: l, mobileSDKVersion: window.UserLeap.mobileSDKVersion, previewKey: D.getItem("sprig.previewKey"), previewMode: p, productConfig: { framePosition: d == null ? void 0 : d.framePosition, desktopDisplay: d == null ? void 0 : d.desktopDisplay, placement: d == null ? void 0 : d.placement }, responseGroupUid: m, startingQuestionIdx: (je = window.UserLeap.config) == null ? void 0 : je.startingQuestionIdx, studyType: L, styleNonce: window.UserLeap.styleNonce, surveyId: u, tabTitle: document.title, trackPageViewUrl: e, ulEvents: re, upchunkLibraryURL: window.UserLeap.upchunkLibraryURL, useMobileStyling: _, userId: y, viewDocument: E == null ? void 0 : E.document, viewWindow: E, visitorAttributes: { externalUserId: window.UserLeap.userId, email: window.UserLeap.email }, ...window.UserLeap._config };
96
+ })() && (it(g, o), H.id = O, window.UserLeap.container.appendChild(H), ot(), w.emit(u.SurveyLifeCycle, { state: "presented" }), w.emit(u.SurveyPresented, { name: u.SurveyPresented, "survey.id": g }))) : { frameId: O, contentWinDocHead: h, contentWindow: E, hasOverlay: D, iframe: H } = Ct({ productConfig: d, useMobileStyling: S, surveyId: g, isFeedback: o }), window.UserLeap.frameId = O;
97
+ const N = { apiURL: window.UserLeap._API_URL, cards: c, configureExitOnOverlayClick: (L) => {
98
+ w.once(u.CloseSurveyOnOverlayClick, L);
99
+ }, context: n, endCard: i, envId: window.UserLeap.envId, eventEmitFn: w.emit.bind(w), fontFamily: window.UserLeap.fontFamily, fontFamilyURL: window.UserLeap.fontFamilyURL, forceBrandedLogo: r, frame: H, headers: v, locale: l, mobileSDKVersion: window.UserLeap.mobileSDKVersion, previewKey: R.getItem("sprig.previewKey"), previewMode: p, productConfig: { framePosition: d == null ? void 0 : d.framePosition, desktopDisplay: d == null ? void 0 : d.desktopDisplay, placement: d == null ? void 0 : d.placement }, responseGroupUid: y, startingQuestionIdx: (je = window.UserLeap.config) == null ? void 0 : je.startingQuestionIdx, studyType: f, styleNonce: window.UserLeap.styleNonce, surveyId: g, tabTitle: document.title, trackPageViewUrl: e, ulEvents: re, upchunkLibraryURL: window.UserLeap.upchunkLibraryURL, useMobileStyling: S, userId: m, viewDocument: E == null ? void 0 : E.document, viewWindow: E, visitorAttributes: { externalUserId: window.UserLeap.userId, email: window.UserLeap.email }, ...window.UserLeap._config };
100
100
  (Me = window.UserLeap._config) != null && Me.startingQuestionIdx && (window.UserLeap._config = { ...window.UserLeap._config, startingQuestionIdx: null });
101
101
  const Lt = (o ? window.UserLeap.feedbackCustomStyles : window.UserLeap.customStyles) ?? d.customStyles;
102
- B.customStyles = Lt, E && (E.__cfg = B);
103
- const me = window.UserLeap.viewSDKURL ? window.UserLeap.viewSDKURL : B.path, Oe = document.getElementById(Ne);
102
+ N.customStyles = Lt, E && (E.__cfg = N);
103
+ const ye = window.UserLeap.viewSDKURL ? window.UserLeap.viewSDKURL : N.path, Oe = document.getElementById(We);
104
104
  Oe && Oe.remove();
105
- const ye = function() {
106
- const U = document.createElement("script");
107
- return window.UserLeap.nonce && U.setAttribute("nonce", window.UserLeap.nonce), U.id = Ne, U;
105
+ const me = function() {
106
+ const L = document.createElement("script");
107
+ return window.UserLeap.nonce && L.setAttribute("nonce", window.UserLeap.nonce), L.id = We, L;
108
108
  }(), Ce = () => {
109
109
  window.UserLeap.container && Object.assign(window.UserLeap.container.style, { display: "flex" });
110
110
  };
111
- if (B.installationMethod === "web-npm" || B.installationMethod === "web-npm-bundled") {
112
- const { default: U } = await import("./view-kaPnONCv.js");
113
- U.configure(B), A && window.UserLeap.container && Ce();
111
+ if (N.installationMethod === "web-npm" || N.installationMethod === "web-npm-bundled") {
112
+ const { default: L } = await import("./view-CHGRuuXh.js");
113
+ L.configure(N), D && window.UserLeap.container && Ce();
114
114
  } else
115
- me && (ye.src = me, A && ye.addEventListener("load", () => {
115
+ ye && (me.src = ye, D && me.addEventListener("load", () => {
116
116
  window.UserLeap.container && Ce();
117
- }), E == null || E.addEventListener("error", (U) => {
118
- U.target instanceof HTMLScriptElement && U.target.src === me && window.UserLeap.reportError("loadFrameScript", new Error("Frame script failed to load"));
117
+ }), E == null || E.addEventListener("error", (L) => {
118
+ L.target instanceof HTMLScriptElement && L.target.src === ye && window.UserLeap.reportError("loadFrameScript", new Error("Frame script failed to load"));
119
119
  }, { capture: !0, once: !0 }));
120
- b == null || b.appendChild(ye);
121
- const Pe = { success: !0, surveyState: "ready", surveyId: u, responseGroupUid: m };
120
+ h == null || h.appendChild(me);
121
+ const Pe = { success: !0, surveyState: "ready", surveyId: g, responseGroupUid: y };
122
122
  return window.UserLeap.isMobileSDK && s && (Pe.delay = s), Pe;
123
123
  };
124
124
  function ge(t) {
@@ -129,9 +129,9 @@ function ge(t) {
129
129
  return ie(t) || e > 10 && e < 500;
130
130
  }
131
131
  function ie(t) {
132
- return Rt.includes(t["userleap-platform"]);
132
+ return At.includes(t["userleap-platform"]);
133
133
  }
134
- const Ae = "ul-frame";
134
+ const De = "ul-frame";
135
135
  window.UserLeap && window.Sprig && (window.Sprig._gtm ? window.Sprig = window.UserLeap : window.UserLeap = window.Sprig), window.UserLeap || (window.UserLeap = window.Sprig), window.Sprig || (window.Sprig = window.UserLeap);
136
136
  const he = "0px", it = (t, e, n) => {
137
137
  window.UserLeap.container = document.createElement("div"), window.UserLeap.container.className = "ul-container" + (e ? " ul-container-feedback" : ""), t && (window.UserLeap.container.dataset.studyId = t.toString());
@@ -143,13 +143,13 @@ const he = "0px", it = (t, e, n) => {
143
143
  const n = window.UserLeap.container;
144
144
  if (n)
145
145
  try {
146
- (s = n.parentNode) == null || s.removeChild(n), window.UserLeap.container = null, x("trackStartUrl", null), w.emit(g.SurveyLifeCycle, { state: "dismissed" }), w.emit(g.SurveyClosed, { name: g.SurveyClosed, initiator: t, "survey.id": parseInt(n.dataset.studyId), ...e && { studyType: e } });
146
+ (s = n.parentNode) == null || s.removeChild(n), window.UserLeap.container = null, x("trackStartUrl", null), w.emit(u.SurveyLifeCycle, { state: "dismissed" }), w.emit(u.SurveyClosed, { name: u.SurveyClosed, initiator: t, "survey.id": parseInt(n.dataset.studyId), ...e && { studyType: e } });
147
147
  } catch (r) {
148
148
  console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${t} ` + n), r instanceof Error && window.UserLeap.reportError("dismissActiveSurvey", r);
149
149
  }
150
150
  }, ot = () => {
151
- w.once(g.SurveyWillClose, ({ initiator: t, studyType: e }) => {
152
- w.removeAllListeners(g.CloseSurveyOnOverlayClick), nt(t, e);
151
+ w.once(u.SurveyWillClose, ({ initiator: t, studyType: e }) => {
152
+ w.removeAllListeners(u.CloseSurveyOnOverlayClick), nt(t, e);
153
153
  });
154
154
  }, Ot = (t, e, n, s) => {
155
155
  var d, c;
@@ -161,11 +161,11 @@ const he = "0px", it = (t, e, n) => {
161
161
  (d = window.UserLeap.windowDimensions) != null && d.width ? r.width = `${window.UserLeap.windowDimensions.width}px` : r.width = "100%", (c = window.UserLeap.windowDimensions) != null && c.height ? r.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px" : window.UserLeap.maxHeight ? r.maxHeight = window.UserLeap.maxHeight : r.maxHeight = document.body.clientHeight - 20 + "px", ["light", "dark"].includes(i.overlayStyleMobile) && (p = !0);
162
162
  else {
163
163
  r.width = "360px", r.maxHeight = window.UserLeap.maxHeight || "66vh";
164
- const m = () => {
164
+ const y = () => {
165
165
  p = !0, l = { margin: "auto", position: "static" };
166
166
  };
167
167
  if (s)
168
- a ? m() : l = { position: "relative", height: "300px" };
168
+ a ? y() : l = { position: "relative", height: "300px" };
169
169
  else
170
170
  switch (i.framePosition) {
171
171
  case "bottomLeft":
@@ -178,39 +178,39 @@ const he = "0px", it = (t, e, n) => {
178
178
  l = { top: 0 };
179
179
  break;
180
180
  case "center":
181
- m();
181
+ y();
182
182
  }
183
183
  }
184
- return p && ((m, u) => {
185
- const y = { position: "fixed", overflow: "auto", top: "0px", left: "0px", display: "none", height: "100%", width: "100%", transition: "background-color 0.3s ease-out", zIndex: 2147483646 }, I = u ? m.overlayStyleMobile : m.overlayStyle;
186
- y["background-color"] = I === "light" ? "rgba(255,255,255, 0.95)" : "rgba(0,0,0,0.9)", u || (y.margin = "auto"), window.UserLeap.container && Object.assign(window.UserLeap.container.style, y);
184
+ return p && ((y, g) => {
185
+ const m = { position: "fixed", overflow: "auto", top: "0px", left: "0px", display: "none", height: "100%", width: "100%", transition: "background-color 0.3s ease-out", zIndex: 2147483646 }, I = g ? y.overlayStyleMobile : y.overlayStyle;
186
+ m["background-color"] = I === "light" ? "rgba(255,255,255, 0.95)" : "rgba(0,0,0,0.9)", g || (m.margin = "auto"), window.UserLeap.container && Object.assign(window.UserLeap.container.style, m);
187
187
  })(i, n), Object.assign(t.style, r, l), p;
188
188
  }, Ct = ({ productConfig: t, useMobileStyling: e, surveyId: n, isFeedback: s }) => {
189
- var m, u;
190
- const r = Ae, i = s && t.desktopDisplay === "slider";
189
+ var y, g;
190
+ const r = De, i = s && t.desktopDisplay === "slider";
191
191
  it(n, s, i), Pt();
192
192
  const o = document.createElement("iframe");
193
193
  o.id = r, o.setAttribute("title", "Sprig User Feedback Dialog");
194
194
  const a = Ot(o, t, e, s);
195
195
  ot();
196
196
  let l = !1;
197
- o.setHeight = (y) => {
198
- parseInt(o.style.height) == y && l || (l = !0, o.style.height = `${y}px`, w.emit(g.SurveyHeight, { name: g.SurveyHeight, contentFrameHeight: y, "survey.id": n }));
197
+ o.setHeight = (m) => {
198
+ parseInt(o.style.height) == m && l || (l = !0, o.style.height = `${m}px`, w.emit(u.SurveyHeight, { name: u.SurveyHeight, contentFrameHeight: m, "survey.id": n }));
199
199
  };
200
200
  let p = !1;
201
- o.setWidth = (y) => {
202
- parseInt(o.style.width) == y && p || (p = !0, o.style.width = `${y}px`, w.emit(g.SurveyWidth, { name: g.SurveyWidth, contentFrameWidth: y, "survey.id": n }));
203
- }, (m = window.UserLeap.container) == null || m.appendChild(o), t && (e ? t.exitOnOverlayClickMobile : t.exitOnOverlayClick) && window.UserLeap.container && (window.UserLeap.container.onclick = () => {
204
- w.emit(g.CloseSurveyOnOverlayClick);
205
- }), w.emit(g.SurveyLifeCycle, { state: "presented" }), w.emit(g.SurveyPresented, { name: g.SurveyPresented, "survey.id": n });
206
- const d = (u = o.contentWindow) == null ? void 0 : u.document;
201
+ o.setWidth = (m) => {
202
+ parseInt(o.style.width) == m && p || (p = !0, o.style.width = `${m}px`, w.emit(u.SurveyWidth, { name: u.SurveyWidth, contentFrameWidth: m, "survey.id": n }));
203
+ }, (y = window.UserLeap.container) == null || y.appendChild(o), t && (e ? t.exitOnOverlayClickMobile : t.exitOnOverlayClick) && window.UserLeap.container && (window.UserLeap.container.onclick = () => {
204
+ w.emit(u.CloseSurveyOnOverlayClick);
205
+ }), w.emit(u.SurveyLifeCycle, { state: "presented" }), w.emit(u.SurveyPresented, { name: u.SurveyPresented, "survey.id": n });
206
+ const d = (g = o.contentWindow) == null ? void 0 : g.document;
207
207
  if (d && (d.open("text/html", "replace"), d.write("<!doctype html><head></head><body></body></html>"), d.close(), !e)) {
208
- const y = d.body;
209
- y.style.display = "flex", y.style.alignItems = "center";
208
+ const m = d.body;
209
+ m.style.display = "flex", m.style.alignItems = "center";
210
210
  }
211
211
  const c = d == null ? void 0 : d.head;
212
212
  return { frameId: r, contentWinDocHead: c, contentWindow: o.contentWindow, hasOverlay: a, iframe: o };
213
- }, st = { [g.SurveyFadingOut]: () => {
213
+ }, st = { [u.SurveyFadingOut]: () => {
214
214
  window.UserLeap.container && Object.assign(window.UserLeap.container.style, { "background-color": "rgba(0,0,0,0)" });
215
215
  } }, Pt = () => {
216
216
  Object.entries(st).forEach(([t, e]) => {
@@ -220,7 +220,7 @@ const he = "0px", it = (t, e, n) => {
220
220
  Object.entries(st).forEach(([t, e]) => {
221
221
  w.off(t, e);
222
222
  });
223
- }, j = (t) => !!t && t.nodeType === Node.ELEMENT_NODE, Ve = (t) => t instanceof HTMLElement || t instanceof SVGElement, se = ({ document: t, elementId: e, styleString: n, nonce: s }) => {
223
+ }, j = (t) => !!t && t.nodeType === Node.ELEMENT_NODE, Be = (t) => t instanceof HTMLElement || t instanceof SVGElement, se = ({ document: t, elementId: e, styleString: n, nonce: s }) => {
224
224
  const r = t.getElementById(e);
225
225
  if (r)
226
226
  return void (r.textContent = n);
@@ -232,7 +232,7 @@ const he = "0px", it = (t, e, n) => {
232
232
  return t;
233
233
  const s = n.scrollHeight;
234
234
  return s < 100 ? t : t - (s - 100);
235
- }, Be = (t, e) => {
235
+ }, Ne = (t, e) => {
236
236
  const n = e.querySelector(t);
237
237
  if (!j(n))
238
238
  return 0;
@@ -244,15 +244,15 @@ const he = "0px", it = (t, e, n) => {
244
244
  if (j(s) && j(r)) {
245
245
  const l = s.querySelector(".ul-card--matrix_grid"), p = !l && e && n;
246
246
  try {
247
- p && (r.style.width = "360px"), i = s.clientHeight, i += ((m) => {
248
- const u = m.querySelector(".sprig-question-body"), y = m.querySelector(".ul-card"), I = m.querySelector(".ul-card-main-content"), h = m.querySelector(".ul-footer"), L = m.querySelector(".sprig-container");
249
- let f = 0;
250
- return j(y) && (f += y.scrollHeight - y.clientHeight), j(I) && (f += I.scrollHeight - I.clientHeight), j(u) && (f += u.scrollHeight - u.clientHeight), j(h) && j(L) && L.clientHeight === 0 && (f += h.clientHeight), f;
247
+ p && (r.style.width = "360px"), i = s.clientHeight, i += ((y) => {
248
+ const g = y.querySelector(".sprig-question-body"), m = y.querySelector(".ul-card"), I = y.querySelector(".ul-card-main-content"), _ = y.querySelector(".ul-footer"), f = y.querySelector(".sprig-container");
249
+ let v = 0;
250
+ return j(m) && (v += m.scrollHeight - m.clientHeight), j(I) && (v += I.scrollHeight - I.clientHeight), j(g) && (v += g.scrollHeight - g.clientHeight), j(_) && j(f) && f.clientHeight === 0 && (v += _.clientHeight), v;
251
251
  })(t);
252
252
  const d = getComputedStyle(s);
253
253
  a = i;
254
254
  const c = parseFloat(d.marginTop) + parseFloat(d.marginBottom);
255
- i += c + (parseFloat(d.borderTopWidth) + parseFloat(d.borderBottomWidth)), l && (o = l.scrollWidth, o += Be(".ul-card__container", t), o += Be(".sprig-question-body", t));
255
+ i += c + (parseFloat(d.borderTopWidth) + parseFloat(d.borderBottomWidth)), l && (o = l.scrollWidth, o += Ne(".ul-card__container", t), o += Ne(".sprig-question-body", t));
256
256
  } finally {
257
257
  p && r.style.removeProperty("width");
258
258
  }
@@ -261,34 +261,34 @@ const he = "0px", it = (t, e, n) => {
261
261
  }, ar = (t) => {
262
262
  const e = t.querySelector(".ul-card__container");
263
263
  e && (e.scrollTop = 0);
264
- }, at = () => v, G = () => document.getElementById("sprig-feedback-container"), Se = () => document.getElementById("sprig-feedback-loading-animation"), dt = () => !!document.getElementById(Ae);
265
- let $e = !1, v = null, P = null, Re = !1, Z = null, H = null;
264
+ }, at = () => b, G = () => document.getElementById("sprig-feedback-container"), Se = () => document.getElementById("sprig-feedback-loading-animation"), dt = () => !!document.getElementById(De);
265
+ let $e = !1, b = null, P = null, Ae = !1, Z = null, V = null;
266
266
  const qt = ["bottom-left", "bottom-right", "center-left", "center-right"], ae = () => {
267
267
  var e;
268
268
  const t = window.UserLeap.container;
269
269
  return ((e = t == null ? void 0 : t.parentElement) == null ? void 0 : e.id) === "sprig-feedback-loading-container";
270
270
  }, lt = () => document.getElementById("sprig-feedback-error-container"), ct = () => {
271
- if (!v)
271
+ if (!b)
272
272
  return 0;
273
- const t = v == null ? void 0 : v.clientWidth, e = window.getComputedStyle(v);
273
+ const t = b == null ? void 0 : b.clientWidth, e = window.getComputedStyle(b);
274
274
  return t + parseInt(e.borderRightWidth || "0") + parseInt(e.borderLeftWidth || "0");
275
275
  }, de = (t) => {
276
276
  const e = G();
277
- e && (H != null && H.endsWith("right") ? e.style.right = `${t}px` : H != null && H.endsWith("left") && (e.style.left = `${t}px`));
277
+ e && (V != null && V.endsWith("right") ? e.style.right = `${t}px` : V != null && V.endsWith("left") && (e.style.left = `${t}px`));
278
278
  }, be = () => {
279
- if (v && (ae() || lt())) {
280
- w.off(g.SurveyAppeared, Y), Ie();
279
+ if (b && (ae() || lt())) {
280
+ w.off(u.SurveyAppeared, Y), Ie();
281
281
  const t = ct();
282
282
  return de(-t), !0;
283
283
  }
284
284
  return !1;
285
285
  }, Y = () => {
286
- if (!v || !P)
286
+ if (!b || !P)
287
287
  return;
288
288
  const t = Se();
289
- t && t.remove(), v.style.height = "auto", v.style.width = "auto", P.disabled = !1, Re = !1;
289
+ t && t.remove(), b.style.height = "auto", b.style.width = "auto", P.disabled = !1, Ae = !1;
290
290
  }, Ie = () => {
291
- if (v && !Se()) {
291
+ if (b && !Se()) {
292
292
  const t = (() => {
293
293
  if (Se())
294
294
  return;
@@ -302,10 +302,10 @@ const qt = ["bottom-left", "bottom-right", "center-left", "center-right"], ae =
302
302
  </div>
303
303
  `, e;
304
304
  })();
305
- t && (v.style.height = "300px", v.style.width = "360px", v.appendChild(t));
305
+ t && (b.style.height = "300px", b.style.width = "360px", b.appendChild(t));
306
306
  }
307
307
  }, Ge = () => {
308
- v && P && (de(0), P.disabled = !0, Re = !0);
308
+ b && P && (de(0), P.disabled = !0, Ae = !0);
309
309
  }, pt = async (t, e, n) => {
310
310
  const { buttonTheme: s, customStyles: r, eventId: i, placement: o, desktopDisplay: a, feedbackLabel: l, surveyUuid: p, surveyId: d } = t;
311
311
  window.UserLeap.feedbackCustomStyles = void 0;
@@ -315,48 +315,48 @@ const qt = ["bottom-left", "bottom-right", "center-left", "center-right"], ae =
315
315
  return;
316
316
  c.remove(), w.off(re.SURVEY_FADING_OUT, be);
317
317
  }
318
- Z = i, se({ document, elementId: "sprig-feedback-style", styleString: '.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.fade-in-transition{animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}#sprig-feedback-button{border-left:0;border-radius:0 8px 8px 0;display:grid;padding:8px;text-align:center;transition:all ease-in-out 1s;z-index:inherit}#sprig-feedback-button:hover{cursor:pointer}.sprig-feedback-button-label{writing-mode:vertical-lr;text-orientation:sideways}.sprig-feedback-button-right{transform:rotate(180deg)}.sprig-feedback-button-bottom{align-self:flex-end;margin-bottom:20px}.sprig-feedback-button-light{background:#efefee;color:#000;border:1px solid #e2e3e1}.sprig-feedback-button-dark{background:#000;color:#fff;border:1px solid #000000}#sprig-feedback-container{display:flex;align-items:center;position:fixed;transition:right .2s linear,left .2s linear;z-index:2147483646}.sprig-feedback-container-left{flex-flow:row-reverse}.sprig-feedback-container-center{top:50%;transform:translateY(-50%)}.sprig-feedback-container-bottom{bottom:0%;margin-bottom:15px}.sprig-feedback-loading-container{align-items:center;background-color:#fff;border:2px solid var(--feedback-border);display:flex;max-height:90vh;max-width:90vw;min-width:0px}.sprig-feedback-loading-container-left{border-left:none;border-radius:0 8px 8px 0}.sprig-feedback-loading-container-right{border-right:none;border-radius:8px 0 0 8px}#sprig-feedback-error-container{margin:auto;text-align:center;width:360px}.sprig-feedback-error-text{font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol}#sprig-feedback-loading-container .ul-container{position:relative;max-height:inherit}#sprig-feedback-loading-animation{position:absolute}.sprig-feedback-loading-container-previews iframe{max-height:inherit!important}', nonce: window.UserLeap.styleNonce }), se({ document, elementId: "ul-custom-style", styleString: r ?? "", nonce: window.UserLeap.styleNonce }), $e = a === "center-modal", H = o;
319
- const [m, u] = o.split("-");
320
- ((L) => {
321
- if (G() || !qt.includes(L))
318
+ Z = i, se({ document, elementId: "sprig-feedback-style", styleString: '.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.fade-in-transition{animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}#sprig-feedback-button{border-left:0;border-radius:0 8px 8px 0;display:grid;padding:8px;text-align:center;transition:all ease-in-out 1s;z-index:inherit}#sprig-feedback-button:hover{cursor:pointer}.sprig-feedback-button-label{writing-mode:vertical-lr;text-orientation:sideways}.sprig-feedback-button-right{transform:rotate(180deg)}.sprig-feedback-button-bottom{align-self:flex-end;margin-bottom:20px}.sprig-feedback-button-light{background:#efefee;color:#000;border:1px solid #e2e3e1}.sprig-feedback-button-dark{background:#000;color:#fff;border:1px solid #000000}#sprig-feedback-container{display:flex;align-items:center;position:fixed;transition:right .2s linear,left .2s linear;z-index:2147483646}.sprig-feedback-container-left{flex-flow:row-reverse}.sprig-feedback-container-center{top:50%;transform:translateY(-50%)}.sprig-feedback-container-bottom{bottom:0%;margin-bottom:15px}.sprig-feedback-loading-container{align-items:center;background-color:#fff;border:2px solid var(--feedback-border);display:flex;max-height:90vh;max-width:90vw;min-width:0px}.sprig-feedback-loading-container-left{border-left:none;border-radius:0 8px 8px 0}.sprig-feedback-loading-container-right{border-right:none;border-radius:8px 0 0 8px}#sprig-feedback-error-container{margin:auto;text-align:center;width:360px}.sprig-feedback-error-text{font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol}#sprig-feedback-loading-container .ul-container{position:relative;max-height:inherit}#sprig-feedback-loading-animation{position:absolute}.sprig-feedback-loading-container-previews iframe{max-height:inherit!important}', nonce: window.UserLeap.styleNonce }), se({ document, elementId: "ul-custom-style", styleString: r ?? "", nonce: window.UserLeap.styleNonce }), $e = a === "center-modal", V = o;
319
+ const [y, g] = o.split("-");
320
+ ((f) => {
321
+ if (G() || !qt.includes(f))
322
322
  return;
323
- const [f, S] = L.split("-"), _ = document.createElement("div");
324
- _.id = "sprig-feedback-container", _.classList.add(`sprig-feedback-container-${S}`, `sprig-feedback-container-${f}`), document.body.appendChild(_);
323
+ const [v, U] = f.split("-"), S = document.createElement("div");
324
+ S.id = "sprig-feedback-container", S.classList.add(`sprig-feedback-container-${U}`, `sprig-feedback-container-${v}`), document.body.appendChild(S);
325
325
  })(o), c = G(), P = document.createElement("button");
326
- const y = document.createElement("div");
327
- y.className = "sprig-feedback-button-label", y.innerText = l, P.appendChild(y), P.id = "sprig-feedback-button", P.classList.add(`sprig-feedback-button-${u}`, `sprig-feedback-button-${m}`, `sprig-feedback-button-${s}`, "fade-in-transition"), w.on(re.SURVEY_FADING_OUT, be), P.addEventListener("click", async () => {
328
- const L = document.getElementById("sprig-feedback-error-container");
326
+ const m = document.createElement("div");
327
+ m.className = "sprig-feedback-button-label", m.innerText = l, P.appendChild(m), P.id = "sprig-feedback-button", P.classList.add(`sprig-feedback-button-${g}`, `sprig-feedback-button-${y}`, `sprig-feedback-button-${s}`, "fade-in-transition"), w.on(re.SURVEY_FADING_OUT, be), P.addEventListener("click", async () => {
328
+ const f = document.getElementById("sprig-feedback-error-container");
329
329
  if (dt() || lt()) {
330
330
  if (be()) {
331
- w.emit(g.SurveyWillClose, { name: g.SurveyWillClose, initiator: W.FeedbackClosed, studyType: "feedbackButton", "survey.id": d });
332
- const S = G();
333
- L && S && (S.remove(), Z = null, v = null);
331
+ w.emit(u.SurveyCloseRequested, { name: u.SurveyCloseRequested, initiator: F.FeedbackClosed, studyType: "feedbackButton", "survey.id": d }), w.emit(u.SurveyWillClose, { name: u.SurveyWillClose, initiator: F.FeedbackClosed, studyType: "feedbackButton", "survey.id": d });
332
+ const U = G();
333
+ f && U && (U.remove(), Z = null, b = null);
334
334
  }
335
335
  return;
336
336
  }
337
- if (ge(T(window.UserLeap)) || Re || Ge(), e)
338
- return v && v.classList.add("sprig-feedback-loading-container-previews"), await X(e), void Y();
339
- const f = await (async (S) => {
340
- const _ = await C(R("1", [q], "startFeedbackStudy"), { body: JSON.stringify({ surveyUuid: S }), method: "POST" });
341
- return _.ok ? _.json : null;
337
+ if (ge(T(window.UserLeap)) || Ae || Ge(), e)
338
+ return b && b.classList.add("sprig-feedback-loading-container-previews"), await X(e), void Y();
339
+ const v = await (async (U) => {
340
+ const S = await C(A("1", [q], "startFeedbackStudy"), { body: JSON.stringify({ surveyUuid: U }), method: "POST" });
341
+ return S.ok ? S.json : null;
342
342
  })(p);
343
- if (f)
344
- w.once(g.SurveyAppeared, Y), X({ ...f, studyType: "feedbackButton" }, n);
345
- else if (v) {
346
- const S = Ft();
347
- v.appendChild(S), Y(), v.style.height = "300px", v.style.width = "360px";
343
+ if (v)
344
+ w.once(u.SurveyAppeared, Y), X({ ...v, studyType: "feedbackButton" }, n);
345
+ else if (b) {
346
+ const U = Ft();
347
+ b.appendChild(U), Y(), b.style.height = "300px", b.style.width = "360px";
348
348
  }
349
- }), c == null || c.appendChild(P), w.emit(g.FeedbackButtonLoaded, { name: g.FeedbackButtonLoaded, "survey.id": d });
350
- const { useMobileStyling: I, _config: { border: h } } = window.UserLeap;
349
+ }), c == null || c.appendChild(P), w.emit(u.FeedbackButtonLoaded, { name: u.FeedbackButtonLoaded, "survey.id": d });
350
+ const { useMobileStyling: I, _config: { border: _ } } = window.UserLeap;
351
351
  if ($e || I)
352
352
  de(0);
353
353
  else {
354
- const L = document.createElement("div");
355
- L.id = "sprig-feedback-loading-container", L.className = `sprig-feedback-loading-container sprig-feedback-loading-container-${u}`, L.style.setProperty("--feedback-border", h), v = L, Ie(), c == null || c.appendChild(L);
356
- const f = ct();
357
- de(-f);
354
+ const f = document.createElement("div");
355
+ f.id = "sprig-feedback-loading-container", f.className = `sprig-feedback-loading-container sprig-feedback-loading-container-${g}`, f.style.setProperty("--feedback-border", _), b = f, Ie(), c == null || c.appendChild(f);
356
+ const v = ct();
357
+ de(-v);
358
358
  }
359
- window.UserLeap._config.isOnQuestionsTab && e && !ae() && v && (Ge(), Ie(), v && v.classList.add("sprig-feedback-loading-container-previews"), X(e), Y());
359
+ window.UserLeap._config.isOnQuestionsTab && e && !ae() && b && (Ge(), Ie(), b && b.classList.add("sprig-feedback-loading-container-previews"), X(e), Y());
360
360
  }, Ft = () => {
361
361
  const t = document.createElement("div");
362
362
  t.id = "sprig-feedback-error-container", t.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
@@ -499,10 +499,10 @@ const Ee = (t) => {
499
499
  e.report(s / 1e3), setTimeout(() => _e(t, e), t);
500
500
  }, 0);
501
501
  };
502
- let le, ce, pe, ue, Je, N = {};
502
+ let le, ce, pe, ue, Je, W = {};
503
503
  const ne = (t, e = 1) => {
504
504
  const { name: n } = t;
505
- N[n] = (N[n] || 0) + e;
505
+ W[n] = (W[n] || 0) + e;
506
506
  }, gt = (t) => {
507
507
  let e = 1;
508
508
  return t.childNodes.forEach((n) => {
@@ -522,11 +522,11 @@ const ne = (t, e = 1) => {
522
522
  case "characterData":
523
523
  return void ne(ue);
524
524
  }
525
- }, Wt = (t) => t.forEach(Ht), Nt = () => {
526
- le.report(N[le.name] || 0), ce.report(N[ce.name] || 0), pe.report(N[pe.name] || 0), ue.report(N[ue.name] || 0), N = {};
527
- }, Vt = (t = 1e3) => {
528
- le = V("sdk_mutations_nodes_added"), ce = V("sdk_mutations_nodes_removed"), pe = V("sdk_mutations_attributes_changed"), ue = V("sdk_mutations_character_data"), Je = new MutationObserver(Wt), Je.observe(document, { attributes: !0, attributeOldValue: !0, characterData: !0, characterDataOldValue: !0, childList: !0, subtree: !0 }), setInterval(Nt, t);
529
- }, Bt = ({ isWeb: t, reportingIntervalSeconds: e, thresholds: n, postMetrics: s }) => {
525
+ }, Vt = (t) => t.forEach(Ht), Wt = () => {
526
+ le.report(W[le.name] || 0), ce.report(W[ce.name] || 0), pe.report(W[pe.name] || 0), ue.report(W[ue.name] || 0), W = {};
527
+ }, Bt = (t = 1e3) => {
528
+ le = B("sdk_mutations_nodes_added"), ce = B("sdk_mutations_nodes_removed"), pe = B("sdk_mutations_attributes_changed"), ue = B("sdk_mutations_character_data"), Je = new MutationObserver(Vt), Je.observe(document, { attributes: !0, attributeOldValue: !0, characterData: !0, characterDataOldValue: !0, childList: !0, subtree: !0 }), setInterval(Wt, t);
529
+ }, Nt = ({ isWeb: t, reportingIntervalSeconds: e, thresholds: n, postMetrics: s }) => {
530
530
  kt(n, (r, i) => {
531
531
  var o, a;
532
532
  if ((o = k.replay) != null && o.isReplayRecording()) {
@@ -534,14 +534,14 @@ const ne = (t, e = 1) => {
534
534
  (a = k.replay) == null || a.disableRecording("Threshold violated", new Error(l), { reportError: !1 }), window.UserLeap.reportError("Sdk Performance Metric threshold violated", new Error("Sdk Performance Metric threshold violated"), { metricName: i.metric, type: i.type, value: i.value }, { metricName: i.metric }), _t();
535
535
  }
536
536
  }), Et({ reportingIntervalSeconds: e, postMetrics: s }), t && (((r = 1e3) => {
537
- const i = V("sdk_event_queue_latency_seconds");
537
+ const i = B("sdk_event_queue_latency_seconds");
538
538
  _e(r, i);
539
539
  })(), ((r = 1e4) => {
540
- ut = V("sdk_dom_nodes_count"), wt = V("sdk_page_html_characters"), Ke(), setInterval(Ke, r);
541
- })(), Vt());
540
+ ut = B("sdk_dom_nodes_count"), wt = B("sdk_page_html_characters"), Ke(), setInterval(Ke, r);
541
+ })(), Bt());
542
542
  }, $t = "test", Gt = ["popState", "pushState", "replaceState"];
543
543
  let ee;
544
- const we = {}, Q = "!email", mt = "pageUrl";
544
+ const we = {}, Q = "!email", yt = "pageUrl";
545
545
  let Le = window.location.href;
546
546
  function te(t) {
547
547
  var a, l;
@@ -554,37 +554,37 @@ function te(t) {
554
554
  if (ae())
555
555
  return;
556
556
  const p = G();
557
- p && (It(Z) || (p.remove(), Z = null, v = null));
557
+ p && (It(Z) || (p.remove(), Z = null, b = null));
558
558
  })(), xt.getItem("sprig.isCapturingHeatmap") && ((l = (a = k.replay) == null ? void 0 : a.checkPendingHeatmapsUrl()) == null || l.then((p) => {
559
559
  var d;
560
560
  p && ((d = k.replay) == null || d.uploadReadyPendingCaptures(!0));
561
- })), !ae() && s && o && o !== window.location.href && t && Gt.includes(t.type) && window.UserLeap("dismissActiveSurvey", W.PageChange);
561
+ })), !ae() && s && o && o !== window.location.href && t && Gt.includes(t.type) && window.UserLeap("dismissActiveSurvey", F.PageChange);
562
562
  }
563
- const yt = { capture: !0 }, Kt = () => {
563
+ const mt = { capture: !0 }, Kt = () => {
564
564
  const t = window.UserLeap._config.interactiveEvents.filter((n) => tt(n, window.location.href)).map((n) => {
565
565
  const { name: s, properties: r } = n, { selector: i, innerText: o } = r;
566
566
  return i ? (a) => {
567
- if (Ve(a.target))
567
+ if (Be(a.target))
568
568
  try {
569
569
  a.target.closest(i) && window.UserLeap("track", s);
570
570
  } catch {
571
571
  }
572
572
  return !1;
573
- } : (a) => (Ve(a.target) && a.target.innerText === o && window.UserLeap("track", s), !1);
573
+ } : (a) => (Be(a.target) && a.target.innerText === o && window.UserLeap("track", s), !1);
574
574
  }), e = (n) => t.forEach((s) => s(n));
575
- window.UserLeap._config.interactiveEventsHandler = e, window.addEventListener("click", e, yt);
575
+ window.UserLeap._config.interactiveEventsHandler = e, window.addEventListener("click", e, mt);
576
576
  }, ft = () => {
577
- window.UserLeap._config.interactiveEventsHandler && window.removeEventListener("click", window.UserLeap._config.interactiveEventsHandler, yt), delete window.UserLeap._config.interactiveEventsHandler;
577
+ window.UserLeap._config.interactiveEventsHandler && window.removeEventListener("click", window.UserLeap._config.interactiveEventsHandler, mt), delete window.UserLeap._config.interactiveEventsHandler;
578
578
  };
579
579
  function vt() {
580
- const t = D.getItemObject("userleap.ids");
580
+ const t = R.getItemObject("userleap.ids");
581
581
  return t && t[window.UserLeap.envId] || {};
582
582
  }
583
583
  function ht() {
584
584
  if (window.previewMode)
585
585
  return;
586
- const t = D.getItemObject("sprig.anon.env.vid.map") || {}, e = t[window.UserLeap.envId];
587
- window.UserLeap.visitorId = e || Ze(), M.info("NewVid", { vid: window.UserLeap.visitorId }), x("vid", window.UserLeap.visitorId), e || (t[window.UserLeap.envId] = window.UserLeap.visitorId, D.setItemObject("sprig.anon.env.vid.map", t)), w.emit(g.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId });
586
+ const t = R.getItemObject("sprig.anon.env.vid.map") || {}, e = t[window.UserLeap.envId];
587
+ window.UserLeap.visitorId = e || Ze(), M.info("NewVid", { vid: window.UserLeap.visitorId }), x("vid", window.UserLeap.visitorId), e || (t[window.UserLeap.envId] = window.UserLeap.visitorId, R.setItemObject("sprig.anon.env.vid.map", t)), w.emit(u.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId });
588
588
  }
589
589
  function bt(t, e, n, s) {
590
590
  var r, i;
@@ -592,18 +592,18 @@ function bt(t, e, n, s) {
592
592
  if (t.endsWith("mock_snippet.html"))
593
593
  return;
594
594
  M.info("PageView", { url: t });
595
- const o = window.UserLeap._config.pageUrlEvents;
596
- let a = !1;
597
- if (o && o.length)
598
- for (let d = 0; d < o.length && (a = tt(o[d], t), !a); d++)
595
+ const o = (r = document == null ? void 0 : document.querySelector('meta[name="description"]')) == null ? void 0 : r.getAttribute("content");
596
+ (i = k.replay) == null || i.RecordPageView({ ...o && { description: o }, url: t, referrer: document.referrer, pageTitle: document.title });
597
+ const a = window.UserLeap._config.pageUrlEvents;
598
+ let l = !1;
599
+ if (a && a.length)
600
+ for (let d = 0; d < a.length && (l = tt(a[d], t), !l); d++)
599
601
  ;
600
- if (!a)
602
+ if (!l)
601
603
  return;
602
604
  window.UserLeap.debugMode && console.info("[DEBUG] Sprig trackPageView", t);
603
- const l = { url: t };
604
- s && (l.trackPageView = !0), window.UserLeap._queue.push(["track", mt, e, l, n]);
605
- const p = (r = document == null ? void 0 : document.querySelector('meta[name="description"]')) == null ? void 0 : r.getAttribute("content");
606
- (i = k.replay) == null || i.RecordPageView({ ...p && { description: p }, url: t, referrer: document.referrer, pageTitle: document.title });
605
+ const p = { url: t };
606
+ s && (p.trackPageView = !0), window.UserLeap._queue.push(["track", yt, e, p, n]);
607
607
  } catch (o) {
608
608
  o instanceof Error && (o.stack = t, window.UserLeap.reportError("trackPageView", o)), console.warn("[Sprig] (ERR-428) Failed to track page view", o);
609
609
  }
@@ -619,10 +619,10 @@ function Jt() {
619
619
  })(t.replaceState)), ["hashchange", "popstate"].forEach((e) => window.addEventListener(e, te, !0));
620
620
  }
621
621
  async function Ue(t, e) {
622
- const n = De();
622
+ const n = Re();
623
623
  t && !e && (window.UserLeap._config.mode = $t);
624
624
  const s = ge(T(window.UserLeap)), r = await C(function(i) {
625
- const o = new URL(R("1", [F], "questions"));
625
+ const o = new URL(A("1", [z], "questions"));
626
626
  return Object.entries(i || {}).forEach(([a, l]) => {
627
627
  l && o.searchParams.append(a, String(l));
628
628
  }), o.toString();
@@ -655,50 +655,50 @@ const Yt = function(t) {
655
655
  if (!window.UserLeap)
656
656
  return;
657
657
  const e = async (r = {}) => {
658
- var L, f, S, _, O;
658
+ var f, v, U, S, O;
659
659
  const { userId: i, anonymousId: o, metadata: a = {}, properties: l, showSurveyCallback: p } = r;
660
660
  let { eventName: d } = r;
661
- if (window.UserLeap.debugMode && d !== mt && console.info("[DEBUG] Sprig track", r), t.mode === "test")
661
+ if (window.UserLeap.debugMode && d !== yt && console.info("[DEBUG] Sprig track", r), t.mode === "test")
662
662
  return;
663
- const c = D.getItem("sprig.previewKey") ?? void 0;
663
+ const c = R.getItem("sprig.previewKey") ?? void 0;
664
664
  if (t.requireUserIdForTracking && !window.UserLeap.userId && !i) {
665
- const b = "[Sprig] - Skipping tracking without userId";
666
- return console.warn(b), { success: !1, message: b, surveyState: "no survey" };
665
+ const h = "[Sprig] - Skipping tracking without userId";
666
+ return console.warn(h), { success: !1, message: h, surveyState: "no survey" };
667
667
  }
668
668
  if (!d || d.trim().length === 0) {
669
669
  d = d ? String(d) : "";
670
- const b = "[Sprig] - Invalid event name " + d;
671
- return console.warn(b), { success: !1, message: b, surveyState: "no survey" };
670
+ const h = "[Sprig] - Invalid event name " + d;
671
+ return console.warn(h), { success: !1, message: h, surveyState: "no survey" };
672
672
  }
673
- const m = ee ?? window.location.href;
674
- a.url || (a.url = m), x("trackStartUrl", m), (f = (L = window.UserLeap) == null ? void 0 : L._config) != null && f.optimizelyEnabled && (ie(T(window.UserLeap)) || oe.getAndSetWebOptimizelyExperiments(), a.optimizelyExperiments = Object.assign({}, oe.getAllOptimizelyExperiments())), (_ = (S = window.UserLeap) == null ? void 0 : S._config) != null && _.launchDarklyEnabled && (a.launchDarklyFlags = ke.getAllLaunchDarklyVariations()), i && (window.UserLeap.userId = i), o && (window.UserLeap.partnerAnonymousId = o), l && (a.eventProperties = l), (O = k.replay) == null || O.RecordEvent({ name: d, url: a.url }), M.info("TrackEvent", { eventName: d });
675
- const u = window.UserLeap.delayingSurvey || dt() ? await C(R("1", [q], "events/batch"), { body: JSON.stringify({ events: [{ event: d, metadata: a }], previewKey: c }), method: "POST", shouldDropOnRateLimit: !0 }) : await C(R("1", [q], "events"), { body: JSON.stringify({ event: d, metadata: a, previewKey: c }), method: "POST", shouldDropOnRateLimit: !0 });
676
- if (!u.ok) {
677
- const b = "[Sprig] (ERR-421) Failed to track event";
678
- return u.reportError && (console.warn(b, u.error), u.error && window.UserLeap.reportError("track", u.error)), { success: !1, message: b, error: u.error, surveyState: "no survey" };
673
+ const y = ee ?? window.location.href;
674
+ a.url || (a.url = y), x("trackStartUrl", y), (v = (f = window.UserLeap) == null ? void 0 : f._config) != null && v.optimizelyEnabled && (ie(T(window.UserLeap)) || oe.getAndSetWebOptimizelyExperiments(), a.optimizelyExperiments = Object.assign({}, oe.getAllOptimizelyExperiments())), (S = (U = window.UserLeap) == null ? void 0 : U._config) != null && S.launchDarklyEnabled && (a.launchDarklyFlags = ke.getAllLaunchDarklyVariations()), i && (window.UserLeap.userId = i), o && (window.UserLeap.partnerAnonymousId = o), l && (a.eventProperties = l), (O = k.replay) == null || O.RecordEvent({ name: d, url: a.url }), M.info("TrackEvent", { eventName: d });
675
+ const g = window.UserLeap.delayingSurvey || dt() ? await C(A("1", [q], "events/batch"), { body: JSON.stringify({ events: [{ event: d, metadata: a }], previewKey: c }), method: "POST", shouldDropOnRateLimit: !0 }) : await C(A("1", [q], "events"), { body: JSON.stringify({ event: d, metadata: a, previewKey: c }), method: "POST", shouldDropOnRateLimit: !0 });
676
+ if (!g.ok) {
677
+ const h = "[Sprig] (ERR-421) Failed to track event";
678
+ return g.reportError && (console.warn(h, g.error), g.error && window.UserLeap.reportError("track", g.error)), { success: !1, message: h, error: g.error, surveyState: "no survey" };
679
679
  }
680
680
  i && x("uid", i), o && x("aid", o);
681
- const y = u.json;
682
- y.invalidPreviewKey && D.removeItem("sprig.previewKey");
681
+ const m = g.json;
682
+ m.invalidPreviewKey && R.removeItem("sprig.previewKey");
683
683
  const I = a.trackPageView ? a.url : void 0;
684
- return y != null && y.feedbackButton && pt(y.feedbackButton, void 0, I), await async function(b, E) {
685
- var z, K;
686
- let A = !0;
687
- return !(E && ((z = b == null ? void 0 : b.json) != null && z.surveyId) && (window.UserLeap.delayingSurvey = !0, A = await E(b.json.surveyId), window.UserLeap.delayingSurvey = !1, !A)) && ((K = b == null ? void 0 : b.json) != null && K.delay && !window.UserLeap.isMobileSDK && (window.UserLeap.delayingSurvey = !0, await rt(b.json.delay), window.UserLeap.delayingSurvey = !1), A);
688
- }(u, p) ? function(b) {
684
+ return m != null && m.feedbackButton && pt(m.feedbackButton, void 0, I), await async function(h, E) {
685
+ var H, K;
686
+ let D = !0;
687
+ return !(E && ((H = h == null ? void 0 : h.json) != null && H.surveyId) && (window.UserLeap.delayingSurvey = !0, D = await E(h.json.surveyId), window.UserLeap.delayingSurvey = !1, !D)) && ((K = h == null ? void 0 : h.json) != null && K.delay && !window.UserLeap.isMobileSDK && (window.UserLeap.delayingSurvey = !0, await rt(h.json.delay), window.UserLeap.delayingSurvey = !1), D);
688
+ }(g, p) ? function(h) {
689
689
  if (!window.UserLeap._config.dismissOnPageChange)
690
690
  return !0;
691
- const E = new URL(b), A = new URL(ee ?? window.location.href);
692
- return E.hostname === A.hostname && E.pathname === A.pathname;
693
- }(m) ? X(y, I) : { success: !1, message: "Study should not be displayed after page navigation", surveyState: "no survey" } : { success: !1, message: "[Sprig] Callback returned false, aborting rendering of survey", surveyState: "no survey" };
691
+ const E = new URL(h), D = new URL(ee ?? window.location.href);
692
+ return E.hostname === D.hostname && E.pathname === D.pathname;
693
+ }(y) ? X(m, I) : { success: !1, message: "Study should not be displayed after page navigation", surveyState: "no survey" } : { success: !1, message: "[Sprig] Callback returned false, aborting rendering of survey", surveyState: "no survey" };
694
694
  }, n = (r, i) => {
695
695
  var a;
696
- const o = (a = r == null ? void 0 : r.querySelector(`[id="${Ae}"]`)) == null ? void 0 : a.contentDocument;
696
+ const o = (a = r == null ? void 0 : r.querySelector(`[id="${De}"]`)) == null ? void 0 : a.contentDocument;
697
697
  o && se({ document: o, elementId: "ul-custom-style", styleString: i });
698
- }, s = { displaySurvey: async (r) => (console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."), window.UserLeap("dismissActiveSurvey", W.Override), Ue({ surveyId: r }, !0)), _previewSurvey(r) {
699
- window.UserLeap("dismissActiveSurvey", W.Override), Ue({ surveyTemplateId: r }, !1);
698
+ }, s = { displaySurvey: async (r) => (console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."), window.UserLeap("dismissActiveSurvey", F.Override), Ue({ surveyId: r }, !0)), _previewSurvey(r) {
699
+ window.UserLeap("dismissActiveSurvey", F.Override), Ue({ surveyTemplateId: r }, !1);
700
700
  }, _reviewSurvey(r) {
701
- window.UserLeap("dismissActiveSurvey", W.Override), Ue({ surveyId: r }, !1);
701
+ window.UserLeap("dismissActiveSurvey", F.Override), Ue({ surveyId: r }, !1);
702
702
  }, previewSurvey(r) {
703
703
  s._previewSurvey(r);
704
704
  }, reviewSurvey(r) {
@@ -709,8 +709,8 @@ const Yt = function(t) {
709
709
  window.UserLeap._queue.unpause();
710
710
  }, setVisitorToken() {
711
711
  console.warn("[Sprig] setVisitorToken is deprecated.");
712
- }, dismissActiveSurvey(r = W.API) {
713
- window.UserLeap.container && w.emit(g.SurveyWillClose, { name: g.SurveyWillClose, initiator: r, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) });
712
+ }, dismissActiveSurvey(r = F.API) {
713
+ window.UserLeap.container && (w.emit(u.SurveyCloseRequested, { name: u.SurveyCloseRequested, initiator: r, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }), w.emit(u.SurveyWillClose, { name: u.SurveyWillClose, initiator: r, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }));
714
714
  }, async setAttribute(r, i) {
715
715
  if (!r || !i && i !== 0 && i !== !1) {
716
716
  const o = "[Sprig] - Disregarding empty attribute / value provided";
@@ -745,7 +745,7 @@ const Yt = function(t) {
745
745
  return { success: !0 };
746
746
  const l = {};
747
747
  let p;
748
- return i && (l.userId = window.UserLeap.userId = i), o && (l.partnerAnonymousId = window.UserLeap.partnerAnonymousId = o), a && Object.keys(a).length > 0 ? (p = await C(R("1", [F, q], "attributes"), { body: JSON.stringify(a), method: "PUT" }), p.ok ? Object.assign(we, a) : p.reportError && (console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed", p.error), p.error && window.UserLeap.reportError("identifyAndSetAttributes", p.error))) : p = await C(R("1", [F, q]), { body: JSON.stringify(l), method: "PUT" }), a && a[Q] && (window.UserLeap.email = a[Q]), p.ok && (i && x("uid", i), o && x("aid", o)), { success: !!p.ok };
748
+ return i && (l.userId = window.UserLeap.userId = i), o && (l.partnerAnonymousId = window.UserLeap.partnerAnonymousId = o), a && Object.keys(a).length > 0 ? (p = await C(A("1", [z, q], "attributes"), { body: JSON.stringify(a), method: "PUT" }), p.ok ? Object.assign(we, a) : p.reportError && (console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed", p.error), p.error && window.UserLeap.reportError("identifyAndSetAttributes", p.error))) : p = await C(A("1", [z, q]), { body: JSON.stringify(l), method: "PUT" }), a && a[Q] && (window.UserLeap.email = a[Q]), p.ok && (i && x("uid", i), o && x("aid", o)), { success: !!p.ok };
749
749
  }, async removeAttributes(r) {
750
750
  if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig removeAttributes", r), t.mode === "test")
751
751
  return;
@@ -757,12 +757,12 @@ const Yt = function(t) {
757
757
  const o = "[Sprig] - Skipping tracking without userId";
758
758
  return console.warn(o), { success: !1, message: o };
759
759
  }
760
- const i = await C(R("1", [F, q], "attributes"), { body: JSON.stringify({ delete: r }), method: "DELETE" });
760
+ const i = await C(A("1", [z, q], "attributes"), { body: JSON.stringify({ delete: r }), method: "DELETE" });
761
761
  return !i.ok && i.reportError && (console.warn("[Sprig] (ERR-433) Remove attributes failed", i.error), i.error && window.UserLeap.reportError("removeAttributes", i.error)), { success: !!i.ok };
762
762
  }, async addSurveyListener(r) {
763
- w.on(g.SurveyLifeCycle, r);
763
+ w.on(u.SurveyLifeCycle, r);
764
764
  }, async removeSurveyListener(r) {
765
- w.removeListener(g.SurveyLifeCycle, r);
765
+ w.removeListener(u.SurveyLifeCycle, r);
766
766
  }, async addListener(r, i) {
767
767
  w.on(r, i);
768
768
  }, async removeListener(r, i) {
@@ -770,7 +770,7 @@ const Yt = function(t) {
770
770
  }, async removeAllListeners() {
771
771
  w.removeAllListeners();
772
772
  }, setPreviewKey(r) {
773
- r && typeof r == "string" && D.isStorageAvailable && r && D.setItem("sprig.previewKey", r);
773
+ r && typeof r == "string" && R.isStorageAvailable && r && R.setItem("sprig.previewKey", r);
774
774
  }, async setUserId(r) {
775
775
  var a;
776
776
  if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig setUserId", r), r == null) {
@@ -780,7 +780,7 @@ const Yt = function(t) {
780
780
  if (t.mode === "test" || r === window.UserLeap.userId)
781
781
  return;
782
782
  window.UserLeap.userId = r;
783
- const i = window.UserLeap.visitorId, o = await C(R("1", [F, q]), { body: JSON.stringify({ userId: r }), method: "PUT" });
783
+ const i = window.UserLeap.visitorId, o = await C(A("1", [z, q]), { body: JSON.stringify({ userId: r }), method: "PUT" });
784
784
  o.ok ? (i !== window.UserLeap.visitorId && ((a = k.replay) == null || a.clearUserReplayData()), x("uid", r)) : o.reportError && (console.warn("[Sprig] (ERR-420) Failed to set user id", o.error), o.error && window.UserLeap.reportError("setUserId", o.error));
785
785
  }, async setPartnerAnonymousId(r) {
786
786
  if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig setPartnerAnonymousId", r), r == null) {
@@ -795,19 +795,19 @@ const Yt = function(t) {
795
795
  }, applyStyles(r) {
796
796
  window.UserLeap.customStyles = r, n(window.UserLeap.container, r);
797
797
  }, setWindowDimensions(r, i) {
798
- var m, u;
798
+ var y, g;
799
799
  const o = typeof r == "string" ? parseInt(r, 10) : r, a = typeof i == "string" ? parseInt(i, 10) : i;
800
800
  isNaN(o) || isNaN(a) || (window.UserLeap.windowDimensions = { width: o, height: a });
801
801
  const l = T(window.UserLeap), p = ge(l), d = l["userleap-platform"] === "web";
802
802
  if (!window.UserLeap.frameId)
803
803
  return;
804
804
  const c = document.getElementById(window.UserLeap.frameId);
805
- c && (window.UserLeap.useMobileStyling && ((m = window.UserLeap.windowDimensions) != null && m.width && (c.style.width = `${window.UserLeap.windowDimensions.width}px`), (u = window.UserLeap.windowDimensions) != null && u.height && (c.style.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px"), c.contentDocument && (c.style.height = String(Mt(c.contentDocument, d && !p, et(l))[0]) + "px")), w.emit(g.SurveyDimensions, { name: g.SurveyDimensions, contentFrameWidth: c.clientWidth, contentFrameHeight: c.clientHeight, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }));
805
+ c && (window.UserLeap.useMobileStyling && ((y = window.UserLeap.windowDimensions) != null && y.width && (c.style.width = `${window.UserLeap.windowDimensions.width}px`), (g = window.UserLeap.windowDimensions) != null && g.height && (c.style.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px"), c.contentDocument && (c.style.height = String(Mt(c.contentDocument, d && !p, et(l))[0]) + "px")), w.emit(u.SurveyDimensions, { name: u.SurveyDimensions, contentFrameWidth: c.clientWidth, contentFrameHeight: c.clientHeight, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }));
806
806
  }, logoutUser() {
807
807
  var r;
808
- window.UserLeap.debugMode && console.info("[DEBUG] Sprig logout"), M.info("LogOut", { vid: window.UserLeap.visitorId, userId: window.UserLeap.userId }), window.UserLeap.visitorId = null, window.UserLeap.userId = null, window.UserLeap.partnerAnonymousId = null, window.UserLeap.token = null, window.UserLeap.email = null, D.removeItem("userleap.ids"), window.UserLeap._queue.isPaused() && window.UserLeap._queue.empty(), ht(), (r = k.replay) == null || r.clearUserReplayData(), window.UserLeap._queue.unpause();
808
+ window.UserLeap.debugMode && console.info("[DEBUG] Sprig logout"), M.info("LogOut", { vid: window.UserLeap.visitorId, userId: window.UserLeap.userId }), window.UserLeap.visitorId = null, window.UserLeap.userId = null, window.UserLeap.partnerAnonymousId = null, window.UserLeap.token = null, window.UserLeap.email = null, R.removeItem("userleap.ids"), window.UserLeap._queue.isPaused() && window.UserLeap._queue.empty(), ht(), (r = k.replay) == null || r.clearUserReplayData(), window.UserLeap._queue.unpause();
809
809
  }, teardown() {
810
- ["hashchange", "popstate"].forEach((r) => window.removeEventListener(r, te, !0)), window.UserLeap._config.interactiveEvents && ft(), window.UserLeap("dismissActiveSurvey", W.API), delete window.UserLeap, delete window.Sprig, delete window._Sprig;
810
+ ["hashchange", "popstate"].forEach((r) => window.removeEventListener(r, te, !0)), window.UserLeap._config.interactiveEvents && ft(), window.UserLeap("dismissActiveSurvey", F.API), delete window.UserLeap, delete window.Sprig, delete window._Sprig;
811
811
  }, integrateOptimizely(r, i = !0) {
812
812
  var o, a;
813
813
  if ((a = (o = window.UserLeap) == null ? void 0 : o._config) != null && a.optimizelyEnabled)
@@ -846,7 +846,7 @@ const Yt = function(t) {
846
846
  console.warn("[Sprig] Error with generating video upload url"), l instanceof Error && window.UserLeap.reportError("generateVideoUploadUrl", l);
847
847
  }
848
848
  }(r), _reportMetric(r, i) {
849
- Dt(r, i);
849
+ Rt(r, i);
850
850
  }, _completeSessionReplay: async ({ surveyId: r, responseGroupUuid: i, eventDigest: o }) => {
851
851
  var a;
852
852
  return k.replay ? (a = k.replay) == null ? void 0 : a._completeSessionReplay({ surveyId: r, responseGroupUuid: i, eventDigest: o, headers: T(window.UserLeap) }) : (window.UserLeap.reportError("_completeSessionReplay", new Error("Replay module not registered")), !1);
@@ -854,20 +854,20 @@ const Yt = function(t) {
854
854
  Object.assign(window.UserLeap, s);
855
855
  };
856
856
  async function Xt(t, e, n = {}, s = {}) {
857
- const r = window.__cfg && window.__cfg.mode, i = De(), o = window.UserLeap.envId, a = window.document.documentElement, l = { mode: r, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: a.clientWidth, clientHeight: a.clientHeight, location: ee ?? window.location.href, language: window.navigator.language, ...n }, p = { action: t, breadcrumbs: M.breadcrumbs, err: { message: `${e == null ? void 0 : e.name} - ${e == null ? void 0 : e.message}`, stack: e == null ? void 0 : e.stack }, meta: l, vid: i, envId: o, ...s };
858
- (await C(R("1", null, "errors"), { method: "POST", headers: { "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(p), shouldDropOnRateLimit: !0 })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", e);
857
+ const r = window.__cfg && window.__cfg.mode, i = Re(), o = window.UserLeap.envId, a = window.document.documentElement, l = { mode: r, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: a.clientWidth, clientHeight: a.clientHeight, location: ee ?? window.location.href, language: window.navigator.language, ...n }, p = { action: t, breadcrumbs: M.breadcrumbs, err: { message: `${e == null ? void 0 : e.name} - ${e == null ? void 0 : e.message}`, stack: e == null ? void 0 : e.stack }, meta: l, vid: i, envId: o, ...s };
858
+ (await C(A("1", null, "errors"), { method: "POST", headers: { "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(p), shouldDropOnRateLimit: !0 })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", e);
859
859
  }
860
860
  function Zt(t = {}) {
861
861
  var s;
862
862
  (s = window.SprigLoggerCallback) == null || s.call(window, "Initializing Sprig");
863
863
  const e = new URLSearchParams(window.location.search).get("sprigPreviewKey") ?? "";
864
864
  async function n() {
865
- var c, m, u, y, I;
865
+ var y, g, m, I, _;
866
866
  if (window.UserLeap.loaded)
867
867
  return;
868
- if ((c = window.SprigLoggerCallback) == null || c.call(window, "Loading Sprig"), window.UserLeap.reportError = Xt, window.UserLeap.loaded = !0, window.UserLeap._config = Object.assign({}, t, window.UserLeap.config), window.UserLeap.delayingSurvey = !1, window.UserLeap._config && typeof window.UserLeap._config == "object")
869
- for (const h in window.UserLeap._config)
870
- window.UserLeap[h] = window.UserLeap._config[h];
868
+ if ((y = window.SprigLoggerCallback) == null || y.call(window, "Loading Sprig"), window.UserLeap.reportError = Xt, window.UserLeap.loaded = !0, window.UserLeap._config = Object.assign({}, t, window.UserLeap.config), window.UserLeap.delayingSurvey = !1, window.UserLeap._config && typeof window.UserLeap._config == "object")
869
+ for (const f in window.UserLeap._config)
870
+ window.UserLeap[f] = window.UserLeap._config[f];
871
871
  if (!window.UserLeap.envId) {
872
872
  if (!window.UserLeap.appId)
873
873
  throw new Error("Missing Environment id");
@@ -884,28 +884,30 @@ function Zt(t = {}) {
884
884
  window.UserLeap._API_URL || (window.UserLeap._API_URL = "https://api.sprig.com");
885
885
  const a = [...window.UserLeap._queue];
886
886
  window.UserLeap._queue = new zt(window.UserLeap, []), window.UserLeap._queue.pause();
887
- for (let h = 0; h < a.length; h++)
888
- window.UserLeap._queue.push(a[h]);
887
+ for (let f = 0; f < a.length; f++)
888
+ window.UserLeap._queue.push(a[f]);
889
889
  const l = r.token;
890
890
  l ? (window.UserLeap.token = l, window.UserLeap.visitorId = r.vid ?? null, window.UserLeap.userId = r.uid ?? null, window.UserLeap.partnerAnonymousId = r.aid ?? null) : ht();
891
891
  const p = ie(T(window.UserLeap));
892
- (m = window.SprigLoggerCallback) == null || m.call(window, "Sprig fetching config");
893
- const d = await async function(h) {
894
- var _, O;
895
- const L = T(window.UserLeap);
892
+ (g = window.SprigLoggerCallback) == null || g.call(window, "Sprig fetching config");
893
+ const d = await async function(f) {
894
+ var O, h;
895
+ const v = T(window.UserLeap);
896
896
  document.addEventListener("securitypolicyviolation", Fe);
897
- const f = await Xe(R("1", [F], "config"), { headers: L });
898
- if (document.removeEventListener("securitypolicyviolation", Fe), !f.ok)
899
- return (_ = window.SprigLoggerCallback) == null || _.call(window, "Sprig config fetch failed"), f.reportError && (console.warn("[Sprig] (ERR-422) Failed to load configuration", f.error), f.error && window.UserLeap.reportError("applyRemoteConfig", f.error)), ze("Disabled: failed to fetch configuration"), h;
900
- const S = f.json;
901
- return S != null && S.disabled ? ((O = window.SprigLoggerCallback) == null || O.call(window, "Sprig config fetch disabled"), ze(`Disabled: ${S.disabled}`), { disabled: S.disabled }) : Object.assign({}, S, h);
897
+ const U = await Xe(A("1", [z], "config"), { headers: v });
898
+ if (document.removeEventListener("securitypolicyviolation", Fe), !U.ok)
899
+ return (O = window.SprigLoggerCallback) == null || O.call(window, "Sprig config fetch failed"), U.reportError && (console.warn("[Sprig] (ERR-422) Failed to load configuration", U.error), U.error && window.UserLeap.reportError("applyRemoteConfig", U.error)), ze("Disabled: failed to fetch configuration"), f;
900
+ const S = U.json;
901
+ return S != null && S.disabled ? ((h = window.SprigLoggerCallback) == null || h.call(window, "Sprig config fetch disabled"), ze(`Disabled: ${S.disabled}`), { disabled: S.disabled }) : Object.assign({}, S, f);
902
902
  }(t);
903
- (u = window.SprigLoggerCallback) == null || u.call(window, "Sprig fetched config"), Bt({ isWeb: !p, reportingIntervalSeconds: d.metricsReportingEnabled || d.mobileMetricsReportingEnabled ? d.metricsReportingIntervalSeconds : 0, thresholds: d.metricThresholds, postMetrics: async (h) => {
904
- var L;
905
- await C(R("1", [F], "metrics"), { body: h, method: "POST", headers: { "x-ul-replay-enabled": `${!!((L = k.replay) != null && L.isReplayRecording())}` }, shouldDropOnRateLimit: !0 });
906
- } }), await ((y = k.replay) == null ? void 0 : y.initializeReplay({ maxReplayDurationSeconds: d.maxReplayDurationSeconds, maxInflightRequests: window.UserLeap.maxInflightReplayRequests ?? 2, replaySettings: d.replaySettings })), Yt(d), await Qt(d), window.UserLeap._queue.unpause(), (I = window.SprigLoggerCallback) == null || I.call(window, "SdkReady"), w.emit(g.SDKReady, { mobileMetricsReportingEnabled: !!d.mobileMetricsReportingEnabled, metricsReportingInterval: d.metricsReportingIntervalSeconds || 0, metricsThresholds: d.metricThresholds || [], maxMobileReplayDurationSeconds: d.maxMobileReplayDurationSeconds, mobileReplaySettings: d.mobileReplaySettings }), w.emit(g.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId }), w.on(g.VisitorIDUpdated, () => {
907
- for (const h in we)
908
- delete we[h];
903
+ (m = window.SprigLoggerCallback) == null || m.call(window, "Sprig fetched config"), Nt({ isWeb: !p, reportingIntervalSeconds: d.metricsReportingEnabled || d.mobileMetricsReportingEnabled ? d.metricsReportingIntervalSeconds : 0, thresholds: d.metricThresholds, postMetrics: async (f) => {
904
+ var v;
905
+ await C(A("1", [z], "metrics"), { body: f, method: "POST", headers: { "x-ul-replay-enabled": `${!!((v = k.replay) != null && v.isReplayRecording())}` }, shouldDropOnRateLimit: !0 });
906
+ } });
907
+ const c = d.alwaysOnReplay ? { userAgent: window.navigator.userAgent, surveyId: d.alwaysOnReplay.surveyId, responseGroupUuid: d.alwaysOnReplay.responseGroupUuid, sdkVersion: "2.33.1", maxDurationSeconds: d.alwaysOnReplay.maxDurationSeconds } : void 0;
908
+ await ((I = k.replay) == null ? void 0 : I.initializeReplay({ maxReplayDurationSeconds: d.maxReplayDurationSeconds, maxInflightRequests: window.UserLeap.maxInflightReplayRequests ?? 2, replaySettings: d.replaySettings, apiUrl: window.UserLeap._API_URL, alwaysOnConfig: c })), Yt(d), await Qt(d), window.UserLeap._queue.unpause(), (_ = window.SprigLoggerCallback) == null || _.call(window, "SdkReady"), w.emit(u.SDKReady, { mobileMetricsReportingEnabled: !!d.mobileMetricsReportingEnabled, metricsReportingInterval: d.metricsReportingIntervalSeconds || 0, metricsThresholds: d.metricThresholds || [], maxMobileReplayDurationSeconds: d.maxMobileReplayDurationSeconds, mobileReplaySettings: d.mobileReplaySettings }), w.emit(u.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId }), w.on(u.VisitorIDUpdated, () => {
909
+ for (const f in we)
910
+ delete we[f];
909
911
  });
910
912
  }
911
913
  window.UserLeap.UPDATES = re, window.UserLeap("setPreviewKey", e), document.readyState === "complete" ? n() : window.attachEvent ? window.attachEvent("onload", n) : window.addEventListener("load", () => {
@@ -995,7 +997,7 @@ const Ye = { configure: (t) => {
995
997
  } }, dr = { sprig: Ye, SprigAPI: xe, configure: Ye.configure };
996
998
  export {
997
999
  ir as A,
998
- At as C,
1000
+ Dt as C,
999
1001
  rr as D,
1000
1002
  sr as E,
1001
1003
  xe as S,