@usermaven/nextjs 1.4.1-rc.59 → 1.4.1-rc.61

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.
Files changed (2) hide show
  1. package/lib/index.es.js +336 -335
  2. package/package.json +2 -2
package/lib/index.es.js CHANGED
@@ -8,8 +8,8 @@ const UsermavenProvider = function ({ children, client }) {
8
8
  return React.createElement(Context.Provider, { value: client }, children);
9
9
  };
10
10
 
11
- var v = /* @__PURE__ */ ((s) => (s[s.DEBUG = 0] = "DEBUG", s[s.INFO = 1] = "INFO", s[s.WARN = 2] = "WARN", s[s.ERROR = 3] = "ERROR", s))(v || {});
12
- class J {
11
+ var v = /* @__PURE__ */ ((i) => (i[i.DEBUG = 0] = "DEBUG", i[i.INFO = 1] = "INFO", i[i.WARN = 2] = "WARN", i[i.ERROR = 3] = "ERROR", i))(v || {});
12
+ class V {
13
13
  constructor(e) {
14
14
  this.level = e;
15
15
  }
@@ -26,8 +26,8 @@ class J {
26
26
  this.level <= 3 && console.error("[Usermaven Error]:", e, ...t);
27
27
  }
28
28
  }
29
- function h(s = 0) {
30
- return new J(s);
29
+ function h(i = 0) {
30
+ return new V(i);
31
31
  }
32
32
  const I = {
33
33
  logLevel: v.ERROR,
@@ -57,19 +57,18 @@ const I = {
57
57
  };
58
58
  class Q {
59
59
  constructor(e) {
60
- this.domain = e, this.cookieDomain = this.getCookieDomain(), console.log(this.cookieDomain);
60
+ this.domain = e, this.cookieDomain = this.getCookieDomain();
61
61
  }
62
- set(e, t, i = 365, n = !0, r = !1) {
63
- console.log("Setting cookie", e, t, i, n, r);
62
+ set(e, t, s = 365, n = !0, r = !1) {
64
63
  const o = /* @__PURE__ */ new Date();
65
- o.setTime(o.getTime() + i * 24 * 60 * 60 * 1e3);
64
+ o.setTime(o.getTime() + s * 24 * 60 * 60 * 1e3);
66
65
  const c = `expires=${o.toUTCString()}`, l = n ? "; Secure" : "", a = r ? "; HttpOnly" : "";
67
66
  document.cookie = `${e}=${t};${c};path=/;domain=${this.cookieDomain}${l}${a}`;
68
67
  }
69
68
  get(e) {
70
- const t = e + "=", i = document.cookie.split(";");
71
- for (let n = 0; n < i.length; n++) {
72
- let r = i[n].trim();
69
+ const t = e + "=", s = document.cookie.split(";");
70
+ for (let n = 0; n < s.length; n++) {
71
+ let r = s[n].trim();
73
72
  if (r.indexOf(t) === 0)
74
73
  return decodeURIComponent(r.substring(t.length));
75
74
  }
@@ -89,7 +88,7 @@ class Q {
89
88
  }
90
89
  isIpAddress(e) {
91
90
  const t = e.split(".");
92
- return t.length === 4 && t.every((i) => !isNaN(Number(i)));
91
+ return t.length === 4 && t.every((s) => !isNaN(Number(s)));
93
92
  }
94
93
  extractHostname(e) {
95
94
  let t;
@@ -97,110 +96,110 @@ class Q {
97
96
  }
98
97
  extractRootDomain(e) {
99
98
  let t = this.extractHostname(e);
100
- const i = t.split("."), n = i.length;
101
- return n > 2 && (i[n - 1].length == 2 ? (t = i[n - 2] + "." + i[n - 1], i[n - 2].length == 2 && (t = i[n - 3] + "." + t)) : t = i[n - 2] + "." + i[n - 1]), t;
99
+ const s = t.split("."), n = s.length;
100
+ return n > 2 && (s[n - 1].length == 2 ? (t = s[n - 2] + "." + s[n - 1], s[n - 2].length == 2 && (t = s[n - 3] + "." + t)) : t = s[n - 2] + "." + s[n - 1]), t;
102
101
  }
103
102
  extractTopLevelDomain(e) {
104
- const t = /[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i, i = e.match(t);
105
- return i ? i[0] : "";
103
+ const t = /[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i, s = e.match(t);
104
+ return s ? s[0] : "";
106
105
  }
107
106
  }
108
- const W = Object.prototype, X = W.hasOwnProperty, K = Array.prototype, b = K.forEach, $ = {};
109
- function Z(s, e, t) {
110
- if (Array.isArray(s)) {
111
- if (b && s.forEach === b)
112
- s.forEach(e, t);
113
- else if ("length" in s && s.length === +s.length) {
114
- for (let i = 0, n = s.length; i < n; i++)
115
- if (i in s && e.call(t, s[i], i) === $)
107
+ const W = Object.prototype, X = W.hasOwnProperty, K = Array.prototype, E = K.forEach, T = {};
108
+ function Z(i, e, t) {
109
+ if (Array.isArray(i)) {
110
+ if (E && i.forEach === E)
111
+ i.forEach(e, t);
112
+ else if ("length" in i && i.length === +i.length) {
113
+ for (let s = 0, n = i.length; s < n; s++)
114
+ if (s in i && e.call(t, i[s], s) === T)
116
115
  return;
117
116
  }
118
117
  }
119
118
  }
120
- const T = function(s) {
121
- return s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
122
- }, G = function(s) {
123
- for (const e in s)
124
- typeof s[e] == "function" && (s[e] = s[e].bind(s));
119
+ const A = function(i) {
120
+ return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
121
+ }, G = function(i) {
122
+ for (const e in i)
123
+ typeof i[e] == "function" && (i[e] = i[e].bind(i));
125
124
  };
126
- function A(s, e, t) {
127
- if (s != null) {
128
- if (b && Array.isArray(s) && s.forEach === b)
129
- s.forEach(e, t);
130
- else if ("length" in s && s.length === +s.length) {
131
- for (let i = 0, n = s.length; i < n; i++)
132
- if (i in s && e.call(t, s[i], i) === $)
125
+ function S(i, e, t) {
126
+ if (i != null) {
127
+ if (E && Array.isArray(i) && i.forEach === E)
128
+ i.forEach(e, t);
129
+ else if ("length" in i && i.length === +i.length) {
130
+ for (let s = 0, n = i.length; s < n; s++)
131
+ if (s in i && e.call(t, i[s], s) === T)
133
132
  return;
134
133
  } else
135
- for (const i in s)
136
- if (X.call(s, i) && e.call(t, s[i], i) === $)
134
+ for (const s in i)
135
+ if (X.call(i, s) && e.call(t, i[s], s) === T)
137
136
  return;
138
137
  }
139
138
  }
140
- const Y = function(s, ...e) {
139
+ const Y = function(i, ...e) {
141
140
  return Z(e, function(t) {
142
- for (const i in t)
143
- t[i] !== void 0 && (s[i] = t[i]);
144
- }), s;
141
+ for (const s in t)
142
+ t[s] !== void 0 && (i[s] = t[s]);
143
+ }), i;
145
144
  };
146
- function _(s, e) {
147
- return s.indexOf(e) !== -1;
145
+ function _(i, e) {
146
+ return i.indexOf(e) !== -1;
148
147
  }
149
- const D = function(s) {
148
+ const F = function(i) {
150
149
  try {
151
- return /^\s*\bfunction\b/.test(s);
150
+ return /^\s*\bfunction\b/.test(i);
152
151
  } catch {
153
152
  return !1;
154
153
  }
155
- }, j = function(s) {
156
- return s === void 0;
154
+ }, j = function(i) {
155
+ return i === void 0;
157
156
  }, p = function() {
158
- const s = function(i, n, r, o, c) {
159
- if (!i) {
157
+ const i = function(s, n, r, o, c) {
158
+ if (!s) {
160
159
  h().error("No valid element provided to register_event");
161
160
  return;
162
161
  }
163
- if (i.addEventListener && !o)
164
- i.addEventListener(n, r, !!c);
162
+ if (s.addEventListener && !o)
163
+ s.addEventListener(n, r, !!c);
165
164
  else {
166
- const l = "on" + n, a = i[l];
167
- i[l] = e(i, r, a);
165
+ const l = "on" + n, a = s[l];
166
+ s[l] = e(s, r, a);
168
167
  }
169
168
  };
170
- function e(i, n, r) {
169
+ function e(s, n, r) {
171
170
  return function(o) {
172
171
  if (o = o || t(window.event), !o)
173
172
  return;
174
173
  let c = !0, l;
175
- D(r) && (l = r(o));
176
- const a = n.call(i, o);
174
+ F(r) && (l = r(o));
175
+ const a = n.call(s, o);
177
176
  return (l === !1 || a === !1) && (c = !1), c;
178
177
  };
179
178
  }
180
- function t(i) {
181
- return i && (i.preventDefault = t.preventDefault, i.stopPropagation = t.stopPropagation), i;
179
+ function t(s) {
180
+ return s && (s.preventDefault = t.preventDefault, s.stopPropagation = t.stopPropagation), s;
182
181
  }
183
182
  return t.preventDefault = function() {
184
183
  this.returnValue = !1;
185
184
  }, t.stopPropagation = function() {
186
185
  this.cancelBubble = !0;
187
- }, s;
188
- }(), ee = function(s) {
186
+ }, i;
187
+ }(), ee = function(i) {
189
188
  return function(...e) {
190
189
  try {
191
- return s.apply(this, e);
190
+ return i.apply(this, e);
192
191
  } catch (t) {
193
192
  h().error("Implementation error. Please turn on debug and contact support@usermaven.com.", t);
194
193
  }
195
194
  };
196
- }, F = function(s) {
197
- for (const e in s)
198
- typeof s[e] == "function" && (s[e] = ee(s[e]));
195
+ }, z = function(i) {
196
+ for (const e in i)
197
+ typeof i[e] == "function" && (i[e] = ee(i[e]));
199
198
  };
200
- function R(s) {
201
- for (let e in s)
202
- (s[e] === "" || s[e] === null || s[e] === void 0 || typeof s[e] == "object" && Object.keys(s[e]).length === 0) && delete s[e];
203
- return s;
199
+ function N(i) {
200
+ for (let e in i)
201
+ (i[e] === "" || i[e] === null || i[e] === void 0 || typeof i[e] == "object" && Object.keys(i[e]).length === 0) && delete i[e];
202
+ return i;
204
203
  }
205
204
  function u() {
206
205
  try {
@@ -209,76 +208,81 @@ function u() {
209
208
  return h().warn("window is not available"), !1;
210
209
  }
211
210
  }
212
- function f(s = 5) {
213
- const e = new Uint8Array(s);
214
- return crypto.getRandomValues(e), Array.from(e, (t) => t.toString(36).padStart(2, "0")).join("").slice(0, s);
211
+ function f(i = 5) {
212
+ const e = new Uint8Array(i);
213
+ return crypto.getRandomValues(e), Array.from(e, (t) => t.toString(36).padStart(2, "0")).join("").slice(0, i);
215
214
  }
216
- function te(s) {
217
- return s.replace(
215
+ function te(i) {
216
+ return i.replace(
218
217
  /([-_][a-z])/g,
219
218
  (e) => e.toUpperCase().replace("-", "").replace("_", "")
220
219
  );
221
220
  }
222
- function S(s) {
223
- return typeof s != "object" || s === null ? s : Array.isArray(s) ? s.map(S) : Object.keys(s).reduce((e, t) => {
224
- const i = te(t);
225
- return e[i] = S(s[t]), e;
221
+ function C(i) {
222
+ return typeof i != "object" || i === null ? i : Array.isArray(i) ? i.map(C) : Object.keys(i).reduce((e, t) => {
223
+ const s = te(t);
224
+ return e[s] = C(i[t]), e;
226
225
  }, {});
227
226
  }
228
- function E(s) {
229
- switch (typeof s.className) {
227
+ function P(i) {
228
+ switch (typeof i.className) {
230
229
  case "string":
231
- return s.className;
230
+ return i.className;
232
231
  case "object":
233
- return ("baseVal" in s.className ? s.className.baseVal : null) || s.getAttribute("class") || "";
232
+ return ("baseVal" in i.className ? i.className.baseVal : null) || i.getAttribute("class") || "";
234
233
  default:
235
234
  return "";
236
235
  }
237
236
  }
238
- function N(s) {
237
+ function O(i) {
239
238
  let e = "";
240
- return M(s) && !q(s) && s.childNodes && s.childNodes.length && A(s.childNodes, function(t) {
241
- z(t) && t.textContent && (e += T(t.textContent).split(/(\s+)/).filter(x).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255));
242
- }), T(e);
239
+ return M(i) && !q(i) && i.childNodes && i.childNodes.length && S(i.childNodes, function(t) {
240
+ B(t) && t.textContent && (e += A(t.textContent).split(/(\s+)/).filter(H).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255));
241
+ }), A(e);
243
242
  }
244
- function H(s) {
245
- return !!s && s.nodeType === 1;
243
+ function R(i) {
244
+ return !!i && i.nodeType === 1;
246
245
  }
247
- function d(s, e) {
248
- return !!s && !!s.tagName && s.tagName.toLowerCase() === e.toLowerCase();
246
+ function d(i, e) {
247
+ return !!i && !!i.tagName && i.tagName.toLowerCase() === e.toLowerCase();
249
248
  }
250
- function z(s) {
251
- return !!s && s.nodeType === 3;
249
+ function B(i) {
250
+ return !!i && i.nodeType === 3;
252
251
  }
253
- function B(s) {
254
- return !!s && s.nodeType === 11;
252
+ function x(i) {
253
+ return !!i && i.nodeType === 11;
255
254
  }
256
- const C = ["a", "button", "form", "input", "select", "textarea", "label"];
257
- function ie(s, e) {
258
- if (!s || d(s, "html") || !H(s) || s.classList && s.classList.contains("um-no-capture"))
255
+ const b = ["a", "button", "form", "input", "select", "textarea", "label"];
256
+ function ie(i, e) {
257
+ if (!i || d(i, "html") || !R(i))
259
258
  return !1;
260
- let t = !1;
261
- const i = [s];
262
- let n = !0, r = s;
263
- for (; r.parentNode && !d(r, "body"); ) {
264
- if (B(r.parentNode)) {
265
- i.push(r.parentNode.host), r = r.parentNode.host;
259
+ let t = i;
260
+ for (; t && !d(t, "body"); ) {
261
+ if (t.classList && t.classList.contains("um-no-capture"))
262
+ return !1;
263
+ t.parentNode && x(t.parentNode) ? t = t.parentNode.host : t = t.parentNode;
264
+ }
265
+ let s = !1;
266
+ for (t = i; t && !d(t, "body"); ) {
267
+ if (t.parentNode && x(t.parentNode)) {
268
+ t = t.parentNode.host, t && b.indexOf(t.tagName.toLowerCase()) > -1 && (s = !0);
266
269
  continue;
267
270
  }
268
- if (n = r.parentNode || !1, !n) break;
269
- if (C.indexOf(n.tagName.toLowerCase()) > -1)
270
- t = !0;
271
+ const o = t.parentNode;
272
+ if (!o) break;
273
+ if (b.indexOf(o.tagName.toLowerCase()) > -1)
274
+ s = !0;
271
275
  else {
272
- const l = window.getComputedStyle(n);
273
- l && l.getPropertyValue("cursor") === "pointer" && (t = !0);
276
+ const c = window.getComputedStyle(o);
277
+ c && c.getPropertyValue("cursor") === "pointer" && (s = !0);
274
278
  }
275
- i.push(n), r = n;
279
+ t = o;
276
280
  }
277
- const o = window.getComputedStyle(s);
278
- if (o && o.getPropertyValue("cursor") === "pointer" && e.type === "click")
281
+ const n = window.getComputedStyle(i);
282
+ if (n && n.getPropertyValue("cursor") === "pointer" && e.type === "click")
279
283
  return !0;
280
- const c = s.tagName.toLowerCase();
281
- switch (c) {
284
+ const r = i.tagName.toLowerCase();
285
+ switch (r) {
282
286
  case "html":
283
287
  return !1;
284
288
  case "form":
@@ -289,80 +293,80 @@ function ie(s, e) {
289
293
  case "textarea":
290
294
  return e.type === "change" || e.type === "click";
291
295
  default:
292
- return t ? e.type === "click" : e.type === "click" && (C.indexOf(c) > -1 || s.getAttribute("contenteditable") === "true");
296
+ return s ? e.type === "click" : e.type === "click" && (b.indexOf(r) > -1 || i.getAttribute("contenteditable") === "true");
293
297
  }
294
298
  }
295
- function M(s) {
296
- if (!s || !H(s))
299
+ function M(i) {
300
+ if (!i || !R(i))
297
301
  return !1;
298
- if (typeof s.hasAttribute == "function") {
299
- if (s.hasAttribute(w.FORCE_CAPTURE_ATTR))
302
+ if (typeof i.hasAttribute == "function") {
303
+ if (i.hasAttribute(w.FORCE_CAPTURE_ATTR))
300
304
  return !0;
301
- if (s.hasAttribute(w.PREVENT_CAPTURE_ATTR))
305
+ if (i.hasAttribute(w.PREVENT_CAPTURE_ATTR))
302
306
  return !1;
303
307
  }
304
- let e = s;
308
+ let e = i;
305
309
  for (; e && e.parentElement && !d(e, "body"); ) {
306
- const n = E(e).split(" ");
310
+ const n = P(e).split(" ");
307
311
  if (_(n, "ph-sensitive") || _(n, "ph-no-capture"))
308
312
  return !1;
309
313
  e = e.parentElement;
310
314
  }
311
- if (_(E(s).split(" "), "ph-include"))
315
+ if (_(P(i).split(" "), "ph-include"))
312
316
  return !0;
313
- const t = s.type;
317
+ const t = i.type;
314
318
  if (typeof t == "string")
315
319
  switch (t.toLowerCase()) {
316
320
  case "hidden":
317
321
  case "password":
318
322
  return !1;
319
323
  }
320
- const i = s.name || s.id || "";
321
- return !(typeof i == "string" && /^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g, "")));
324
+ const s = i.name || i.id || "";
325
+ return !(typeof s == "string" && /^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g, "")));
322
326
  }
323
- function q(s) {
327
+ function q(i) {
324
328
  const e = ["button", "checkbox", "submit", "reset"];
325
- return !!(d(s, "input") && !e.includes(s.type) || d(s, "select") || d(s, "textarea") || s.getAttribute("contenteditable") === "true");
329
+ return !!(d(i, "input") && !e.includes(i.type) || d(i, "select") || d(i, "textarea") || i.getAttribute("contenteditable") === "true");
326
330
  }
327
- function x(s) {
328
- return !(s === null || j(s) || typeof s == "string" && (s = T(s), /^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((s || "").replace(/[- ]/g, "")) || /(^\d{3}-?\d{2}-?\d{4}$)/.test(s)));
331
+ function H(i) {
332
+ return !(i === null || j(i) || typeof i == "string" && (i = A(i), /^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((i || "").replace(/[- ]/g, "")) || /(^\d{3}-?\d{2}-?\d{4}$)/.test(i)));
329
333
  }
330
- function se(s) {
331
- return typeof s == "string" ? s.substring(0, 10) === "_ngcontent" || s.substring(0, 7) === "_nghost" : !1;
334
+ function se(i) {
335
+ return typeof i == "string" ? i.substring(0, 10) === "_ngcontent" || i.substring(0, 7) === "_nghost" : !1;
332
336
  }
333
- function P() {
337
+ function $() {
334
338
  return f(10);
335
339
  }
336
- function ne(s) {
337
- return /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(s).toLowerCase());
340
+ function ne(i) {
341
+ return /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(i).toLowerCase());
338
342
  }
339
- function re(s, e) {
343
+ function re(i, e) {
340
344
  let t;
341
- return function(...i) {
345
+ return function(...s) {
342
346
  const n = () => {
343
- clearTimeout(t), s(...i);
347
+ clearTimeout(t), i(...s);
344
348
  };
345
349
  clearTimeout(t), t = setTimeout(n, e);
346
350
  };
347
351
  }
348
- function oe(s) {
349
- const e = {}, t = s.replace(/^\?/, "").split("&");
350
- for (let i = 0; i < t.length; i++) {
351
- const n = t[i].split("=");
352
+ function oe(i) {
353
+ const e = {}, t = i.replace(/^\?/, "").split("&");
354
+ for (let s = 0; s < t.length; s++) {
355
+ const n = t[s].split("=");
352
356
  n[0] !== "" && (e[decodeURIComponent(n[0])] = decodeURIComponent(n[1] || ""));
353
357
  }
354
358
  return e;
355
359
  }
356
- function O(s) {
357
- return typeof s == "string" || s instanceof String;
360
+ function L(i) {
361
+ return typeof i == "string" || i instanceof String;
358
362
  }
359
- function k(s) {
360
- return s !== null && typeof s == "object" && s.constructor === Object;
363
+ function k(i) {
364
+ return i !== null && typeof i == "object" && i.constructor === Object;
361
365
  }
362
- function ae(s) {
363
- if (s === null)
366
+ function ae(i) {
367
+ if (i === null)
364
368
  return v.ERROR;
365
- const e = s.toUpperCase(), t = v[e];
369
+ const e = i.toUpperCase(), t = v[e];
366
370
  return t || t === 0 ? t : v.ERROR;
367
371
  }
368
372
  class ce {
@@ -377,6 +381,8 @@ class ce {
377
381
  e > this.lastScrollDepth && (this.lastScrollDepth = e, this.checkMilestones(e));
378
382
  }
379
383
  send(e = "$scroll") {
384
+ if (!this.lastScrollDepth)
385
+ return;
380
386
  const t = {
381
387
  percent: this.lastScrollDepth,
382
388
  window_height: this.getWindowHeight(),
@@ -389,8 +395,8 @@ class ce {
389
395
  this.track();
390
396
  }
391
397
  getScrollDepth() {
392
- const e = this.getWindowHeight(), t = this.getDocumentHeight(), i = this.getScrollDistance(), n = t - e;
393
- return Math.min(100, Math.floor(i / n * 100));
398
+ const e = this.getWindowHeight(), t = this.getDocumentHeight(), s = this.getScrollDistance(), n = t - e;
399
+ return Math.min(100, Math.floor(s / n * 100));
394
400
  }
395
401
  getWindowHeight() {
396
402
  return window.innerHeight || this.documentElement.clientHeight || document.body.clientHeight || 0;
@@ -409,14 +415,14 @@ class ce {
409
415
  return window.pageYOffset || this.documentElement.scrollTop || document.body.scrollTop || 0;
410
416
  }
411
417
  checkMilestones(e) {
412
- this.milestones.filter((i) => e >= i).forEach((i) => {
413
- this.send(), this.milestones = this.milestones.filter((n) => n !== i);
418
+ this.milestones.filter((s) => e >= s).forEach((s) => {
419
+ this.send(), this.milestones = this.milestones.filter((n) => n !== s);
414
420
  });
415
421
  }
416
422
  }
417
423
  const y = class y {
418
- constructor(e, t, i = h()) {
419
- this.logger = i, this.scrollDepth = null, this.client = e, this.options = t, this.scrollDepth = new ce(e), G(this), F(this);
424
+ constructor(e, t, s = h()) {
425
+ this.logger = s, this.scrollDepth = null, this.client = e, this.options = t, this.scrollDepth = new ce(e), G(this), z(this);
420
426
  }
421
427
  init() {
422
428
  if (!(document && document.body)) {
@@ -440,10 +446,10 @@ const y = class y {
440
446
  return performance.navigation && performance.navigation.type === 1;
441
447
  }
442
448
  captureEvent(e) {
443
- var i, n;
449
+ var s, n;
444
450
  let t = this.getEventTarget(e);
445
- if (z(t) && (t = t.parentNode || null), e.type === "scroll")
446
- return (i = this.scrollDepth) == null || i.track(), !0;
451
+ if (B(t) && (t = t.parentNode || null), e.type === "scroll")
452
+ return (s = this.scrollDepth) == null || s.track(), !0;
447
453
  if (e.type === "visibilitychange" && document.visibilityState === "hidden" || e.type === "popstate")
448
454
  return this.isPageRefresh() || (n = this.scrollDepth) == null || n.send(), !0;
449
455
  if (t && this.shouldCaptureElement(t, e)) {
@@ -465,31 +471,31 @@ const y = class y {
465
471
  }
466
472
  getElementList(e) {
467
473
  const t = [e];
468
- let i = e;
469
- for (; i.parentNode && !d(i, "body"); )
470
- B(i.parentNode) ? (t.push(i.parentNode.host), i = i.parentNode.host) : (t.push(i.parentNode), i = i.parentNode);
474
+ let s = e;
475
+ for (; s.parentNode && !d(s, "body"); )
476
+ x(s.parentNode) ? (t.push(s.parentNode.host), s = s.parentNode.host) : (t.push(s.parentNode), s = s.parentNode);
471
477
  return t;
472
478
  }
473
479
  getElementsJson(e, t) {
474
- const i = [];
480
+ const s = [];
475
481
  let n = null, r = !1;
476
- return A(e, (o) => {
482
+ return S(e, (o) => {
477
483
  if (d(o, "a")) {
478
484
  const l = o.getAttribute("href");
479
- l !== null && M(o) && x(l) && (n = l);
485
+ l !== null && M(o) && H(l) && (n = l);
480
486
  }
481
- const c = E(o).split(" ");
482
- _(c, "ph-no-capture") && (r = !0), i.push(this.getPropertiesFromElement(o));
483
- }), this.options.maskAllText || (i[0].$el_text = this.sanitizeText(N(e[0]))), n !== null && (i[0].attr__href = n), r ? [] : i;
487
+ const c = P(o).split(" ");
488
+ _(c, "ph-no-capture") && (r = !0), s.push(this.getPropertiesFromElement(o));
489
+ }), this.options.maskAllText || (s[0].$el_text = this.sanitizeText(O(e[0]))), n !== null && (s[0].attr__href = n), r ? [] : s;
484
490
  }
485
491
  getPropertiesFromElement(e) {
486
492
  const t = {
487
493
  tag_name: e.tagName.toLowerCase()
488
494
  };
489
- C.indexOf(t.tag_name) > -1 && !this.options.maskAllText && (t.$el_text = this.sanitizeText(N(e)));
490
- const i = E(e);
491
- i.length > 0 && (t.classes = i.split(" ").filter((c) => c !== "")), A(e.attributes, (c) => {
492
- q(e) && ["name", "id", "class"].indexOf(c.name) === -1 || !this.options.maskAllElementAttributes && x(c.value) && !se(c.name) && (t["attr__" + c.name] = this.sanitizeAttributeValue(c.name, c.value));
495
+ b.indexOf(t.tag_name) > -1 && !this.options.maskAllText && (t.$el_text = this.sanitizeText(O(e)));
496
+ const s = P(e);
497
+ s.length > 0 && (t.classes = s.split(" ").filter((c) => c !== "")), S(e.attributes, (c) => {
498
+ q(e) && ["name", "id", "class"].indexOf(c.name) === -1 || !this.options.maskAllElementAttributes && H(c.value) && !se(c.name) && (t["attr__" + c.name] = this.sanitizeAttributeValue(c.name, c.value));
493
499
  });
494
500
  let n = 1, r = 1, o = e;
495
501
  for (; o = this.previousElementSibling(o); )
@@ -501,7 +507,7 @@ const y = class y {
501
507
  return e.previousElementSibling;
502
508
  do
503
509
  e = e.previousSibling;
504
- while (e && !H(e));
510
+ while (e && !R(e));
505
511
  return e;
506
512
  }
507
513
  getDefaultProperties(e) {
@@ -537,16 +543,16 @@ const y = class y {
537
543
  encodeHtml(e) {
538
544
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
539
545
  }
540
- static enabledForProject(e, t = 10, i = 10) {
546
+ static enabledForProject(e, t = 10, s = 10) {
541
547
  if (!e)
542
548
  return !1;
543
549
  let n = 0;
544
550
  for (let r = 0; r < e.length; r++)
545
551
  n += e.charCodeAt(r);
546
- return n % t < i;
552
+ return n % t < s;
547
553
  }
548
554
  static isBrowserSupported() {
549
- return D(document.querySelectorAll);
555
+ return F(document.querySelectorAll);
550
556
  }
551
557
  };
552
558
  y.FORCE_CAPTURE_ATTR = "data-um-force-capture", y.PREVENT_CAPTURE_ATTR = "data-um-no-capture";
@@ -581,32 +587,32 @@ class le {
581
587
  }
582
588
  }
583
589
  class ue {
584
- constructor(e, t, i = h()) {
585
- this.trackingHost = e, this.logger = i, this.config = t;
590
+ constructor(e, t, s = h()) {
591
+ this.trackingHost = e, this.logger = s, this.config = t;
586
592
  }
587
593
  async send(e) {
588
- const t = this.config.key, i = this.constructUrl(t), n = new Blob([JSON.stringify(e)], { type: "application/json" });
589
- if (navigator.sendBeacon(i, n))
594
+ const t = this.config.key, s = this.constructUrl(t), n = new Blob([JSON.stringify(e)], { type: "application/json" });
595
+ if (navigator.sendBeacon(s, n))
590
596
  this.logger.debug(`Successfully queued ${e.length} event(s) via Beacon API`);
591
597
  else
592
598
  throw new Error("Failed to queue events via Beacon API");
593
599
  }
594
600
  constructUrl(e) {
595
- const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = u() ? "/api/v1/event" : "/api/v1/s2s/event";
596
- return this.config.randomizeUrl ? `${this.trackingHost}/api.${f()}?p_${f()}=${e}${t}${i}` : `${this.trackingHost}${n}?token=${e}${t}${i}`;
601
+ const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", s = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = u() ? "/api/v1/event" : "/api/v1/s2s/event";
602
+ return this.config.randomizeUrl ? `${this.trackingHost}/api.${f()}?p_${f()}=${e}${t}${s}` : `${this.trackingHost}${n}?token=${e}${t}${s}`;
597
603
  }
598
604
  // Note: Beacon API doesn't support custom headers, so we can't use them here.
599
605
  // If custom headers are crucial, you might want to fall back to XHR or Fetch in those cases.
600
606
  }
601
- class L {
602
- constructor(e, t, i = h()) {
603
- this.trackingHost = e, this.logger = i, this.config = t;
607
+ class U {
608
+ constructor(e, t, s = h()) {
609
+ this.trackingHost = e, this.logger = s, this.config = t;
604
610
  }
605
611
  async send(e) {
606
- const t = this.config.key, i = this.constructUrl(t), n = JSON.stringify(e), r = {
612
+ const t = this.config.key, s = this.constructUrl(t), n = JSON.stringify(e), r = {
607
613
  "Content-Type": "application/json",
608
614
  ...this.getCustomHeaders()
609
- }, o = await fetch(i, {
615
+ }, o = await fetch(s, {
610
616
  method: "POST",
611
617
  headers: r,
612
618
  body: n
@@ -616,8 +622,8 @@ class L {
616
622
  this.logger.debug(`Successfully sent ${e.length} event(s)`), this.postHandle(o.status, await o.text());
617
623
  }
618
624
  constructUrl(e) {
619
- const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = u() ? "/api/v1/event" : "/api/v1/s2s/event";
620
- return this.config.randomizeUrl ? `${this.trackingHost}/api.${f()}?p_${f()}=${e}${t}${i}` : `${this.trackingHost}${n}?token=${e}${t}${i}`;
625
+ const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", s = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = u() ? "/api/v1/event" : "/api/v1/s2s/event";
626
+ return this.config.randomizeUrl ? `${this.trackingHost}/api.${f()}?p_${f()}=${e}${t}${s}` : `${this.trackingHost}${n}?token=${e}${t}${s}`;
621
627
  }
622
628
  getCustomHeaders() {
623
629
  return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
@@ -627,26 +633,26 @@ class L {
627
633
  }
628
634
  }
629
635
  class he {
630
- constructor(e, t, i = h()) {
631
- this.trackingHost = e, this.logger = i, this.config = t;
636
+ constructor(e, t, s = h()) {
637
+ this.trackingHost = e, this.logger = s, this.config = t;
632
638
  }
633
639
  send(e) {
634
- return new Promise((t, i) => {
640
+ return new Promise((t, s) => {
635
641
  const n = new XMLHttpRequest(), r = this.config.key, o = this.constructUrl(r);
636
642
  n.open("POST", o, !0), n.setRequestHeader("Content-Type", "application/json");
637
643
  const c = this.getCustomHeaders();
638
644
  Object.keys(c).forEach((l) => {
639
645
  n.setRequestHeader(l, c[l]);
640
646
  }), n.onload = () => {
641
- n.status >= 200 && n.status < 300 ? (this.logger.debug(`Successfully sent ${e.length} event(s)`), t()) : i(new Error(`HTTP error! status: ${n.status}`));
647
+ n.status >= 200 && n.status < 300 ? (this.logger.debug(`Successfully sent ${e.length} event(s)`), t()) : s(new Error(`HTTP error! status: ${n.status}`));
642
648
  }, n.onerror = () => {
643
- i(new Error("Network error"));
649
+ s(new Error("Network error"));
644
650
  }, n.send(JSON.stringify(e));
645
651
  });
646
652
  }
647
653
  constructUrl(e) {
648
- const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = u() ? "/api/v1/event" : "/api/v1/s2s/event";
649
- return this.config.randomizeUrl ? `${this.trackingHost}/api.${f()}?p_${f()}=${e}${t}${i}` : `${this.trackingHost}${n}?token=${e}${t}${i}`;
654
+ const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", s = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = u() ? "/api/v1/event" : "/api/v1/s2s/event";
655
+ return this.config.randomizeUrl ? `${this.trackingHost}/api.${f()}?p_${f()}=${e}${t}${s}` : `${this.trackingHost}${n}?token=${e}${t}${s}`;
650
656
  }
651
657
  getCustomHeaders() {
652
658
  return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
@@ -655,7 +661,7 @@ class he {
655
661
  this.logger.debug(`Response received. Status: ${e}, Body: ${t}`);
656
662
  }
657
663
  }
658
- class V {
664
+ class J {
659
665
  constructor(e, t) {
660
666
  this.storage = {}, this.prefix = `usermaven_${e}_`, this.load(), this.logger = t || h();
661
667
  }
@@ -714,10 +720,10 @@ class ge {
714
720
  this.storage = {};
715
721
  }
716
722
  }
717
- class U {
723
+ class D {
718
724
  // Default to true for server-side
719
- constructor(e, t = 3, i = 1e3, n = 10, r = 1e3, o = h()) {
720
- this.transport = e, this.maxRetries = t, this.retryInterval = i, this.batchSize = n, this.batchInterval = r, this.logger = o, this.queue = [], this.processing = !1, this.batchTimeoutId = null, this.isOnline = !0, this.persistence = new V("offline_queue"), u() && (this.isOnline = navigator.onLine, this.loadQueueFromStorage(), this.initNetworkListeners(), this.scheduleBatch());
725
+ constructor(e, t = 3, s = 1e3, n = 10, r = 1e3, o = h()) {
726
+ this.transport = e, this.maxRetries = t, this.retryInterval = s, this.batchSize = n, this.batchInterval = r, this.logger = o, this.queue = [], this.processing = !1, this.batchTimeoutId = null, this.isOnline = !0, this.persistence = new J("offline_queue"), u() && (this.isOnline = navigator.onLine, this.loadQueueFromStorage(), this.initNetworkListeners(), this.scheduleBatch());
721
727
  }
722
728
  add(e) {
723
729
  const t = { payload: e, retries: 0, timestamp: Date.now() };
@@ -736,11 +742,11 @@ class U {
736
742
  async processBatch() {
737
743
  if ((!u() || this.isOnline) && !this.processing && this.queue.length > 0) {
738
744
  this.processing = !0;
739
- const e = this.queue.splice(0, this.batchSize), t = e.map((i) => i.payload);
745
+ const e = this.queue.splice(0, this.batchSize), t = e.map((s) => s.payload);
740
746
  try {
741
747
  await this.transport.send(t), this.logger.debug(`Successfully sent batch of ${e.length} payloads`), u() && this.saveQueueToStorage();
742
- } catch (i) {
743
- this.logger.error("Failed to send batch", i), await this.handleBatchFailure(e);
748
+ } catch (s) {
749
+ this.logger.error("Failed to send batch", s), await this.handleBatchFailure(e);
744
750
  }
745
751
  this.processing = !1;
746
752
  }
@@ -763,7 +769,7 @@ class U {
763
769
  }
764
770
  class de {
765
771
  constructor(e) {
766
- this.clicks = [], this.threshold = 3, this.timeWindow = 2e3, this.distanceThreshold = 30, this.client = e, this.initializeEventListener(), F(this);
772
+ this.clicks = [], this.threshold = 3, this.timeWindow = 2e3, this.distanceThreshold = 30, this.client = e, this.initializeEventListener(), z(this);
767
773
  }
768
774
  initializeEventListener() {
769
775
  document.addEventListener("click", this.handleClick.bind(this));
@@ -775,17 +781,17 @@ class de {
775
781
  shouldCaptureElement(e) {
776
782
  return !e.closest(".um-no-capture");
777
783
  }
778
- click(e, t, i) {
779
- const n = { x: e, y: t, timestamp: i };
780
- this.clicks.push(n), this.clicks = this.clicks.filter((r) => i - r.timestamp < this.timeWindow), this.clicks.length >= this.threshold && this.checkRageClick();
784
+ click(e, t, s) {
785
+ const n = { x: e, y: t, timestamp: s };
786
+ this.clicks.push(n), this.clicks = this.clicks.filter((r) => s - r.timestamp < this.timeWindow), this.clicks.length >= this.threshold && this.checkRageClick();
781
787
  }
782
788
  checkRageClick() {
783
- const e = this.clicks[0], i = (this.clicks[this.clicks.length - 1].timestamp - e.timestamp) / 1e3;
789
+ const e = this.clicks[0], s = (this.clicks[this.clicks.length - 1].timestamp - e.timestamp) / 1e3;
784
790
  this.clicks.every((r, o) => {
785
791
  if (o === 0) return !0;
786
792
  const c = this.clicks[o - 1];
787
793
  return Math.sqrt(Math.pow(r.x - c.x, 2) + Math.pow(r.y - c.y, 2)) < this.distanceThreshold;
788
- }) && this.sendRageClickEvent(i);
794
+ }) && this.sendRageClickEvent(s);
789
795
  }
790
796
  sendRageClickEvent(e) {
791
797
  const t = this.clicks[this.clicks.length - 1];
@@ -796,14 +802,14 @@ class de {
796
802
  }
797
803
  }
798
804
  class fe {
799
- constructor(e, t, i = h()) {
800
- this.trackingHost = e, this.logger = i, this.config = t;
805
+ constructor(e, t, s = h()) {
806
+ this.trackingHost = e, this.logger = s, this.config = t;
801
807
  }
802
808
  async send(e) {
803
- const t = this.config.key, i = new (void 0)(this.constructUrl(t)), n = {
804
- hostname: i.hostname,
809
+ const t = this.config.key, s = new (void 0)(this.constructUrl(t)), n = {
810
+ hostname: s.hostname,
805
811
  port: 443,
806
- path: `${i.pathname}${i.search}`,
812
+ path: `${s.pathname}${s.search}`,
807
813
  method: "POST",
808
814
  headers: {
809
815
  "Content-Type": "application/json",
@@ -824,16 +830,16 @@ class fe {
824
830
  });
825
831
  }
826
832
  constructUrl(e) {
827
- const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "";
828
- return `${this.trackingHost}/api/v1/s2s/event?token=${e}${t}${i}`;
833
+ const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", s = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "";
834
+ return `${this.trackingHost}/api/v1/s2s/event?token=${e}${t}${s}`;
829
835
  }
830
836
  getCustomHeaders() {
831
837
  return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
832
838
  }
833
839
  }
834
840
  class m {
835
- constructor(e, t = "all", i = {}) {
836
- this.instance = e, this.trackingType = t, this.options = i, document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", this.initialize.bind(this)) : this.initialize();
841
+ constructor(e, t = "all", s = {}) {
842
+ this.instance = e, this.trackingType = t, this.options = s, document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", this.initialize.bind(this)) : this.initialize();
837
843
  }
838
844
  initialize() {
839
845
  this.trackingType !== "none" && this.setupFormTracking();
@@ -845,19 +851,19 @@ class m {
845
851
  });
846
852
  }
847
853
  handleFormSubmit(e) {
848
- const t = e.target, i = this._getFormDetails(t);
849
- this.instance.track("$form", R(i)), this.options.trackFieldChanges && this.trackFieldChanges(t);
854
+ const t = e.target, s = this._getFormDetails(t);
855
+ this.instance.track("$form", N(s)), this.options.trackFieldChanges && this.trackFieldChanges(t);
850
856
  }
851
857
  trackFieldChanges(e) {
852
- e.querySelectorAll("input, select, textarea").forEach((i) => {
853
- i.addEventListener("change", (n) => {
858
+ e.querySelectorAll("input, select, textarea").forEach((s) => {
859
+ s.addEventListener("change", (n) => {
854
860
  const r = this._getFieldProps(n.target, 0);
855
- this.instance.track("$form_field_change", R(r));
861
+ this.instance.track("$form_field_change", N(r));
856
862
  });
857
863
  });
858
864
  }
859
- static getInstance(e, t = "all", i = {}) {
860
- return m.instance || (m.instance = new m(e, t, i)), m.instance;
865
+ static getInstance(e, t = "all", s = {}) {
866
+ return m.instance || (m.instance = new m(e, t, s)), m.instance;
861
867
  }
862
868
  _getFormDetails(e) {
863
869
  const t = {
@@ -867,18 +873,18 @@ class m {
867
873
  form_method: e.method,
868
874
  form_class: e.className,
869
875
  form_attributes: this._getElementAttributes(e)
870
- }, i = e.querySelectorAll("input, select, textarea");
871
- return Array.from(i).filter((r) => !r.classList.contains("um-no-capture")).forEach((r, o) => {
876
+ }, s = e.querySelectorAll("input, select, textarea");
877
+ return Array.from(s).filter((r) => !r.classList.contains("um-no-capture")).forEach((r, o) => {
872
878
  const c = this._getFieldProps(r, o);
873
879
  Object.assign(t, c);
874
880
  }), t;
875
881
  }
876
882
  _getFieldProps(e, t) {
877
- const i = Object.keys(e.dataset).length ? JSON.stringify(e.dataset) : void 0, n = this.getSafeText(e);
883
+ const s = Object.keys(e.dataset).length ? JSON.stringify(e.dataset) : void 0, n = this.getSafeText(e);
878
884
  return {
879
885
  [`field_${t + 1}_tag`]: e.tagName.toLowerCase(),
880
886
  [`field_${t + 1}_type`]: e instanceof HTMLInputElement ? e.type : void 0,
881
- [`field_${t + 1}_data_attributes`]: i,
887
+ [`field_${t + 1}_data_attributes`]: s,
882
888
  [`field_${t + 1}_id`]: e.id,
883
889
  [`field_${t + 1}_value`]: n,
884
890
  [`field_${t + 1}_class`]: e.className,
@@ -887,12 +893,7 @@ class m {
887
893
  };
888
894
  }
889
895
  _getElementAttributes(e) {
890
- const t = {};
891
- for (let i = 0; i < e.attributes.length; i++) {
892
- const n = e.attributes[i];
893
- n.name !== "value" && !n.name.startsWith("data-") && (t[n.name] = n.value);
894
- }
895
- return t;
896
+ return Object.keys(e.dataset).length ? JSON.parse(JSON.stringify(e.dataset)) : {};
896
897
  }
897
898
  getSafeText(e) {
898
899
  let t = "";
@@ -915,7 +916,7 @@ class m {
915
916
  _trim(e) {
916
917
  if (typeof String.prototype.trim == "function")
917
918
  return e.trim();
918
- let t = 0, i = e.length - 1;
919
+ let t = 0, s = e.length - 1;
919
920
  const n = [
920
921
  " ",
921
922
  `
@@ -943,16 +944,16 @@ class m {
943
944
  " ",
944
945
  " "
945
946
  ].join("");
946
- for (; t <= i && n.indexOf(e[t]) > -1; )
947
+ for (; t <= s && n.indexOf(e[t]) > -1; )
947
948
  t++;
948
- for (; i >= t && n.indexOf(e[i]) > -1; )
949
- i--;
950
- return e.slice(t, i + 1);
949
+ for (; s >= t && n.indexOf(e[s]) > -1; )
950
+ s--;
951
+ return e.slice(t, s + 1);
951
952
  }
952
953
  }
953
954
  class pe {
954
955
  constructor(e) {
955
- this.config = this.mergeConfig(e, I), this.logger = h(this.config.logLevel), this.namespace = e.namespace || "usermaven", this.transport = this.initializeTransport(this.config), this.persistence = this.initializePersistence(), this.retryQueue = new U(
956
+ this.config = this.mergeConfig(e, I), this.logger = h(this.config.logLevel), this.namespace = e.namespace || "usermaven", this.transport = this.initializeTransport(this.config), this.persistence = this.initializePersistence(), this.retryQueue = new D(
956
957
  this.transport,
957
958
  this.config.maxSendAttempts || 3,
958
959
  this.config.minSendTimeout || 1e3,
@@ -977,14 +978,14 @@ class pe {
977
978
  * @param defaultConfig
978
979
  */
979
980
  mergeConfig(e, t) {
980
- const i = JSON.parse(JSON.stringify(e));
981
- let n = { ...t, ...i };
981
+ const s = JSON.parse(JSON.stringify(e));
982
+ let n = { ...t, ...s };
982
983
  return Object.keys(t).forEach((r) => {
983
984
  k(t[r]) && (n[r] = this.mergeConfig(e[r], t[r]));
984
985
  }), n;
985
986
  }
986
987
  init(e) {
987
- this.config = { ...this.config, ...e }, this.logger = h(this.config.logLevel), this.namespace = e.namespace || this.namespace, this.transport = this.initializeTransport(e), this.persistence = this.initializePersistence(), this.retryQueue = new U(
988
+ this.config = { ...this.config, ...e }, this.logger = h(this.config.logLevel), this.namespace = e.namespace || this.namespace, this.transport = this.initializeTransport(e), this.persistence = this.initializePersistence(), this.retryQueue = new D(
988
989
  this.transport,
989
990
  this.config.maxSendAttempts || 3,
990
991
  this.config.minSendTimeout || 1e3,
@@ -997,10 +998,10 @@ class pe {
997
998
  manageCrossDomainLinking() {
998
999
  if (!this.config.crossDomainLinking || !this.config.domains)
999
1000
  return;
1000
- const e = this.config.domains.split(",").map((i) => i.trim()), t = this.config.cookieName || `${this.namespace}_id_${this.config.key}`;
1001
- document.addEventListener("click", (i) => {
1001
+ const e = this.config.domains.split(",").map((s) => s.trim()), t = this.config.cookieName || `${this.namespace}_id_${this.config.key}`;
1002
+ document.addEventListener("click", (s) => {
1002
1003
  var c;
1003
- const n = this.findClosestLink(i.target);
1004
+ const n = this.findClosestLink(s.target);
1004
1005
  if (!n) return;
1005
1006
  const r = n.getAttribute("href");
1006
1007
  if (!r || !r.startsWith("http")) return;
@@ -1019,47 +1020,47 @@ class pe {
1019
1020
  initializeTransport(e) {
1020
1021
  if (!u())
1021
1022
  return new fe(e.trackingHost, e);
1022
- const t = "XMLHttpRequest" in window, i = typeof fetch < "u", n = typeof navigator < "u" && "sendBeacon" in navigator;
1023
+ const t = "XMLHttpRequest" in window, s = typeof fetch < "u", n = typeof navigator < "u" && "sendBeacon" in navigator;
1023
1024
  if (e.useBeaconApi && n)
1024
1025
  return new ue(e.trackingHost, e, this.logger);
1025
- if (e.forceUseFetch && i)
1026
- return new L(e.trackingHost, e, this.logger);
1026
+ if (e.forceUseFetch && s)
1027
+ return new U(e.trackingHost, e, this.logger);
1027
1028
  if (t)
1028
1029
  return new he(e.trackingHost, e, this.logger);
1029
- if (i)
1030
- return new L(e.trackingHost, e, this.logger);
1030
+ if (s)
1031
+ return new U(e.trackingHost, e, this.logger);
1031
1032
  throw new Error("No suitable transport method available");
1032
1033
  }
1033
1034
  initializePersistence() {
1034
- return this.config.disableEventPersistence || !u() ? new ge() : new V(`${this.namespace}_${this.config.key}`, this.logger);
1035
+ return this.config.disableEventPersistence || !u() ? new ge() : new J(`${this.namespace}_${this.config.key}`, this.logger);
1035
1036
  }
1036
1037
  getOrCreateAnonymousId() {
1037
- var i, n;
1038
+ var s, n;
1038
1039
  if (!u())
1039
- return P();
1040
+ return $();
1040
1041
  if (this.config.privacyPolicy === "strict" || this.config.cookiePolicy === "strict")
1041
1042
  return this.generateFingerprint();
1042
1043
  const e = this.config.cookieName || `${this.namespace}_id_${this.config.key}`;
1043
- let t = (i = this.cookieManager) == null ? void 0 : i.get(e);
1044
+ let t = (s = this.cookieManager) == null ? void 0 : s.get(e);
1044
1045
  if (!t) {
1045
1046
  if (this.config.crossDomainLinking) {
1046
1047
  const c = new URLSearchParams(window.location.search).get("_um"), a = window.location.hash.substring(1).split("~"), g = a.length > 1 ? a[1] : void 0;
1047
- t = c || g || P();
1048
+ t = c || g || $();
1048
1049
  }
1049
- t || (t = P());
1050
+ t || (t = $());
1050
1051
  const r = 365 * 10;
1051
1052
  (n = this.cookieManager) == null || n.set(e, t, r, document.location.protocol !== "http:", !1);
1052
1053
  }
1053
1054
  return t;
1054
1055
  }
1055
1056
  generateFingerprint() {
1056
- const e = navigator.userAgent, t = `${screen.width}x${screen.height}`, i = screen.colorDepth, n = Intl.DateTimeFormat().resolvedOptions().timeZone, r = `${e}|${t}|${i}|${n}`;
1057
+ const e = navigator.userAgent, t = `${screen.width}x${screen.height}`, s = screen.colorDepth, n = Intl.DateTimeFormat().resolvedOptions().timeZone, r = `${e}|${t}|${s}|${n}`;
1057
1058
  return this.hashString(r);
1058
1059
  }
1059
1060
  hashString(e) {
1060
1061
  let t = 0;
1061
- for (let i = 0; i < e.length; i++) {
1062
- const n = e.charCodeAt(i);
1062
+ for (let s = 0; s < e.length; s++) {
1063
+ const n = e.charCodeAt(s);
1063
1064
  t = (t << 5) - t + n, t = t & t;
1064
1065
  }
1065
1066
  return t.toString(36);
@@ -1069,10 +1070,10 @@ class pe {
1069
1070
  throw new Error("User data must be an object");
1070
1071
  if (e.email && !ne(e.email))
1071
1072
  throw new Error("Invalid email provided");
1072
- if (!e.id || !O(e.id))
1073
+ if (!e.id || !L(e.id))
1073
1074
  throw new Error("User ID must be a string");
1074
- const i = e.id;
1075
- if (this.persistence.set("userId", i), this.persistence.set("userProps", e), !t) {
1075
+ const s = e.id;
1076
+ if (this.persistence.set("userId", s), this.persistence.set("userProps", e), !t) {
1076
1077
  const n = {
1077
1078
  ...e,
1078
1079
  anonymous_id: this.anonymousId
@@ -1081,17 +1082,17 @@ class pe {
1081
1082
  }
1082
1083
  this.logger.info("User identified:", e);
1083
1084
  }
1084
- track(e, t, i = !1) {
1085
- this.trackInternal(e, t, i);
1085
+ track(e, t, s = !1) {
1086
+ this.trackInternal(e, t, s);
1086
1087
  }
1087
- trackInternal(e, t, i = !1) {
1088
- if (!O(e))
1088
+ trackInternal(e, t, s = !1) {
1089
+ if (!L(e))
1089
1090
  throw new Error("Event name must be a string");
1090
1091
  if (t !== void 0 && (typeof t != "object" || t === null || Array.isArray(t)))
1091
1092
  throw new Error("Event payload must be a non-null object and not an array");
1092
1093
  const n = this.createEventPayload(e, t);
1093
1094
  try {
1094
- if (i) {
1095
+ if (s) {
1095
1096
  this.transport.send(n), this.logger.debug(`Event sent: ${e}`, [n]);
1096
1097
  return;
1097
1098
  }
@@ -1113,14 +1114,14 @@ class pe {
1113
1114
  this.persistence.set("companyProps", e), t || await this.track("group", e), this.logger.info("Company identified:", e);
1114
1115
  }
1115
1116
  createEventPayload(e, t) {
1116
- const i = this.persistence.get("userProps") || {}, n = this.persistence.get("companyProps") || void 0, r = this.persistence.get("userId"), o = this.persistence.get("global_props") || {}, c = this.persistence.get(`props_${e}`) || {};
1117
+ const s = this.persistence.get("userProps") || {}, n = this.persistence.get("companyProps") || void 0, r = this.persistence.get("userId"), o = this.persistence.get("global_props") || {}, c = this.persistence.get(`props_${e}`) || {};
1117
1118
  let l = t || {};
1118
1119
  const a = {
1119
1120
  event_id: "",
1120
1121
  user: {
1121
1122
  anonymous_id: this.anonymousId,
1122
1123
  id: r,
1123
- ...i
1124
+ ...s
1124
1125
  },
1125
1126
  ...n && { company: n },
1126
1127
  ids: this.getThirdPartyIds(),
@@ -1144,8 +1145,8 @@ class pe {
1144
1145
  }
1145
1146
  processAutocaptureAttributes(e) {
1146
1147
  let t = {};
1147
- const i = e.$elements || [];
1148
- return i.length && (t = { ...i[0] }), t.el_text = t.$el_text || "", t.event_type = e.$event_type || "", ["$ce_version", "$event_type", "$initial_referrer", "$initial_referring_domain", "$referrer", "$referring_domain", "$elements"].forEach((n) => {
1148
+ const s = e.$elements || [];
1149
+ return s.length && (t = { ...s[0] }), t.el_text = t.$el_text || "", t.event_type = e.$event_type || "", ["$ce_version", "$event_type", "$initial_referrer", "$initial_referring_domain", "$referrer", "$referring_domain", "$elements"].forEach((n) => {
1149
1150
  delete t[n];
1150
1151
  }), delete t.$el_text, delete t.nth_child, delete t.nth_of_type, t;
1151
1152
  }
@@ -1177,7 +1178,7 @@ class pe {
1177
1178
  setupPageLeaveTracking() {
1178
1179
  if (!u()) return;
1179
1180
  let e = !1, t = !1;
1180
- const i = () => {
1181
+ const s = () => {
1181
1182
  !e && !t && (e = !0, this.track("$pageleave", {
1182
1183
  url: window.location.href,
1183
1184
  referrer: document.referrer,
@@ -1189,12 +1190,12 @@ class pe {
1189
1190
  t = !1;
1190
1191
  }, 100);
1191
1192
  }), document.addEventListener("visibilitychange", () => {
1192
- document.visibilityState === "hidden" && !t && i();
1193
+ document.visibilityState === "hidden" && !t && s();
1193
1194
  });
1194
1195
  const n = history.pushState;
1195
1196
  history.pushState = function() {
1196
- return i(), n.apply(this, arguments);
1197
- }, window.addEventListener("popstate", i);
1197
+ return s(), n.apply(this, arguments);
1198
+ }, window.addEventListener("popstate", s);
1198
1199
  }
1199
1200
  getConfig() {
1200
1201
  return this.config;
@@ -1212,17 +1213,17 @@ class pe {
1212
1213
  set(e, t) {
1213
1214
  if (!k(e))
1214
1215
  throw new Error("Properties must be an object");
1215
- const i = t == null ? void 0 : t.eventType, n = (t == null ? void 0 : t.persist) ?? !0;
1216
- if (i) {
1217
- let r = this.persistence.get(`props_${i}`) || {};
1218
- r = { ...r, ...e }, this.persistence.set(`props_${i}`, r);
1216
+ const s = t == null ? void 0 : t.eventType, n = (t == null ? void 0 : t.persist) ?? !0;
1217
+ if (s) {
1218
+ let r = this.persistence.get(`props_${s}`) || {};
1219
+ r = { ...r, ...e }, this.persistence.set(`props_${s}`, r);
1219
1220
  } else {
1220
1221
  let r = this.persistence.get("global_props") || {};
1221
1222
  r = { ...r, ...e }, this.persistence.set("global_props", r);
1222
1223
  }
1223
1224
  n && this.persistence.save(), this.logger.debug("Properties set", {
1224
1225
  properties: e,
1225
- eventType: i || "global",
1226
+ eventType: s || "global",
1226
1227
  persist: n
1227
1228
  });
1228
1229
  }
@@ -1232,100 +1233,100 @@ class pe {
1232
1233
  t.id = e, this.persistence.set("userProps", t), this.persistence.save();
1233
1234
  }
1234
1235
  unset(e, t) {
1235
- const i = t == null ? void 0 : t.eventType, n = (t == null ? void 0 : t.persist) ?? !0;
1236
- if (i) {
1237
- let r = this.persistence.get(`props_${i}`) || {};
1238
- delete r[e], this.persistence.set(`props_${i}`, r);
1236
+ const s = t == null ? void 0 : t.eventType, n = (t == null ? void 0 : t.persist) ?? !0;
1237
+ if (s) {
1238
+ let r = this.persistence.get(`props_${s}`) || {};
1239
+ delete r[e], this.persistence.set(`props_${s}`, r);
1239
1240
  } else {
1240
1241
  let r = this.persistence.get("global_props") || {};
1241
1242
  delete r[e], this.persistence.set("global_props", r);
1242
1243
  }
1243
- n && this.persistence.save(), this.logger.debug(`Property unset: ${e}`, `Event type: ${i || "global"}`);
1244
+ n && this.persistence.save(), this.logger.debug(`Property unset: ${e}`, `Event type: ${s || "global"}`);
1244
1245
  }
1245
1246
  }
1246
- function me(s) {
1247
- const e = JSON.parse(JSON.stringify(s)), t = S(e), i = { ...I, ...t };
1248
- if (!i.key)
1247
+ function me(i) {
1248
+ const e = JSON.parse(JSON.stringify(i)), t = C(e), s = { ...I, ...t };
1249
+ if (!s.key)
1249
1250
  throw new Error("API key is required!");
1250
- if (!i.trackingHost)
1251
+ if (!s.trackingHost)
1251
1252
  throw new Error("Tracking host is required!");
1252
- return new pe(i);
1253
+ return new pe(s);
1253
1254
  }
1254
- function ye(s) {
1255
+ function ye(i) {
1255
1256
  var n;
1256
1257
  const e = {
1257
- key: s.getAttribute("data-key") || void 0,
1258
- trackingHost: s.getAttribute("data-tracking-host") || "https://events.usermaven.com",
1259
- logLevel: ae(s.getAttribute("data-log-level")),
1260
- autocapture: s.getAttribute("data-autocapture") === "true",
1261
- formTracking: s.getAttribute("data-form-tracking") === "true" ? "all" : !1,
1262
- autoPageview: s.getAttribute("data-auto-pageview") === "true",
1263
- useBeaconApi: s.getAttribute("data-use-beacon-api") === "true",
1264
- forceUseFetch: s.getAttribute("data-force-use-fetch") === "true",
1265
- gaHook: s.getAttribute("data-ga-hook") === "true",
1266
- segmentHook: s.getAttribute("data-segment-hook") === "true",
1267
- randomizeUrl: s.getAttribute("data-randomize-url") === "true",
1268
- capture3rdPartyCookies: s.getAttribute("data-capture-3rd-party-cookies") === "false" ? !1 : void 0,
1269
- idMethod: s.getAttribute("data-id-method") || void 0,
1270
- privacyPolicy: s.getAttribute("data-privacy-policy") === "strict" ? "strict" : void 0,
1271
- ipPolicy: s.getAttribute("data-ip-policy") || void 0,
1272
- cookiePolicy: s.getAttribute("data-cookie-policy") || void 0,
1273
- minSendTimeout: parseInt(s.getAttribute("data-min-send-timeout") || "", 10) || void 0,
1274
- maxSendTimeout: parseInt(s.getAttribute("data-max-send-timeout") || "", 10) || void 0,
1275
- maxSendAttempts: parseInt(s.getAttribute("data-max-send-attempts") || "", 10) || void 0,
1276
- propertiesStringMaxLength: parseInt(s.getAttribute("data-properties-string-max-length") || "", 10) || null,
1277
- propertyBlacklist: ((n = s.getAttribute("data-property-blacklist")) == null ? void 0 : n.split(",")) || void 0,
1278
- exclude: s.getAttribute("data-exclude") || void 0,
1279
- namespace: s.getAttribute("data-namespace") || void 0,
1280
- crossDomainLinking: s.getAttribute("data-cross-domain-linking") !== "false",
1281
- domains: s.getAttribute("data-domains") || void 0,
1282
- maskAllText: s.getAttribute("data-mask-all-text") === "true",
1283
- maskAllElementAttributes: s.getAttribute("data-mask-all-element-attributes") === "true"
1284
- }, t = me(e), i = e.namespace || "usermaven";
1285
- u() && t.pageview(), we(i, t);
1258
+ key: i.getAttribute("data-key") || void 0,
1259
+ trackingHost: i.getAttribute("data-tracking-host") || "https://events.usermaven.com",
1260
+ logLevel: ae(i.getAttribute("data-log-level")),
1261
+ autocapture: i.getAttribute("data-autocapture") === "true",
1262
+ formTracking: i.getAttribute("data-form-tracking") === "false" ? !1 : i.getAttribute("data-form-tracking") === "true" ? "all" : i.getAttribute("data-form-tracking"),
1263
+ autoPageview: i.getAttribute("data-auto-pageview") === "true",
1264
+ useBeaconApi: i.getAttribute("data-use-beacon-api") === "true",
1265
+ forceUseFetch: i.getAttribute("data-force-use-fetch") === "true",
1266
+ gaHook: i.getAttribute("data-ga-hook") === "true",
1267
+ segmentHook: i.getAttribute("data-segment-hook") === "true",
1268
+ randomizeUrl: i.getAttribute("data-randomize-url") === "true",
1269
+ capture3rdPartyCookies: i.getAttribute("data-capture-3rd-party-cookies") === "false" ? !1 : void 0,
1270
+ idMethod: i.getAttribute("data-id-method") || void 0,
1271
+ privacyPolicy: i.getAttribute("data-privacy-policy") === "strict" ? "strict" : void 0,
1272
+ ipPolicy: i.getAttribute("data-ip-policy") || void 0,
1273
+ cookiePolicy: i.getAttribute("data-cookie-policy") || void 0,
1274
+ minSendTimeout: parseInt(i.getAttribute("data-min-send-timeout") || "", 10) || void 0,
1275
+ maxSendTimeout: parseInt(i.getAttribute("data-max-send-timeout") || "", 10) || void 0,
1276
+ maxSendAttempts: parseInt(i.getAttribute("data-max-send-attempts") || "", 10) || void 0,
1277
+ propertiesStringMaxLength: parseInt(i.getAttribute("data-properties-string-max-length") || "", 10) || null,
1278
+ propertyBlacklist: ((n = i.getAttribute("data-property-blacklist")) == null ? void 0 : n.split(",")) || void 0,
1279
+ exclude: i.getAttribute("data-exclude") || void 0,
1280
+ namespace: i.getAttribute("data-namespace") || void 0,
1281
+ crossDomainLinking: i.getAttribute("data-cross-domain-linking") !== "false",
1282
+ domains: i.getAttribute("data-domains") || void 0,
1283
+ maskAllText: i.getAttribute("data-mask-all-text") === "true",
1284
+ maskAllElementAttributes: i.getAttribute("data-mask-all-element-attributes") === "true"
1285
+ }, t = me(e), s = e.namespace || "usermaven";
1286
+ u() && t.pageview(), we(s, t);
1286
1287
  }
1287
- function we(s, e) {
1288
+ function we(i, e) {
1288
1289
  let t = !1;
1289
- const i = [], n = [];
1290
+ const s = [], n = [];
1290
1291
  function r() {
1291
- for (; i.length > 0; ) {
1292
- const a = i.shift();
1293
- a && window[s].apply(null, a);
1292
+ for (; s.length > 0; ) {
1293
+ const a = s.shift();
1294
+ a && window[i].apply(null, a);
1294
1295
  }
1295
1296
  }
1296
1297
  function o() {
1297
1298
  n.forEach((a) => a()), n.length = 0;
1298
1299
  }
1299
- window[s] = function(...a) {
1300
+ window[i] = function(...a) {
1300
1301
  const g = a[0];
1301
1302
  if (g === "onLoad") {
1302
1303
  typeof a[1] == "function" && (t ? a[1]() : n.push(a[1]));
1303
1304
  return;
1304
1305
  }
1305
1306
  if (!t) {
1306
- i.push(a);
1307
+ s.push(a);
1307
1308
  return;
1308
1309
  }
1309
1310
  if (typeof e[g] == "function")
1310
1311
  return e[g].apply(e, a.slice(1));
1311
1312
  console.error(`Method ${g} not found on UsermavenClient`);
1312
1313
  };
1313
- const c = `${s}Q`, l = window[c] || [];
1314
+ const c = `${i}Q`, l = window[c] || [];
1314
1315
  for (window[c] = l, l.push = function(...a) {
1315
- return window[s].apply(null, a), Array.prototype.push.apply(this, a);
1316
+ return window[i].apply(null, a), Array.prototype.push.apply(this, a);
1316
1317
  }, setTimeout(() => {
1317
- t = !0, r(), o(), console.log(`Usermaven client for namespace ${s} is ready`);
1318
+ t = !0, r(), o(), console.log(`Usermaven client for namespace ${i} is ready`);
1318
1319
  }, 0); l.length > 0; ) {
1319
1320
  const a = l.shift();
1320
- a && i.push(a);
1321
+ a && s.push(a);
1321
1322
  }
1322
1323
  }
1323
- u() && function(s, e) {
1324
- const t = s.currentScript;
1325
- function i() {
1324
+ u() && function(i, e) {
1325
+ const t = i.currentScript;
1326
+ function s() {
1326
1327
  t && t.src.includes("lib.js") && ye(t);
1327
1328
  }
1328
- typeof e < "u" && (s.readyState === "loading" ? s.addEventListener("DOMContentLoaded", i) : i());
1329
+ typeof e < "u" && (i.readyState === "loading" ? i.addEventListener("DOMContentLoaded", s) : s());
1329
1330
  }(document, window);
1330
1331
 
1331
1332
  function createClient(params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usermaven/nextjs",
3
- "version": "1.4.1-rc.59",
3
+ "version": "1.4.1-rc.61",
4
4
  "description": "Usermaven JavaScript SDK for NextJS",
5
5
  "author": "Usermaven <hello@usermaven.com>",
6
6
  "license": "MIT",
@@ -18,7 +18,7 @@
18
18
  "access": "public"
19
19
  },
20
20
  "dependencies": {
21
- "@usermaven/sdk-js": "1.4.1-rc.59",
21
+ "@usermaven/sdk-js": "1.4.1-rc.61",
22
22
  "cookie": "^0.5.0"
23
23
  },
24
24
  "peerDependencies": {