@sprig-technologies/sprig-browser 2.32.5 → 2.32.6

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