@usermaven/nextjs 1.5.10-rc.111 → 1.5.10-rc.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.es.js +389 -323
- 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 k = /* @__PURE__ */ ((
|
|
12
|
-
class
|
|
11
|
+
var k = /* @__PURE__ */ ((s) => (s[s.DEBUG = 0] = "DEBUG", s[s.INFO = 1] = "INFO", s[s.WARN = 2] = "WARN", s[s.ERROR = 3] = "ERROR", s))(k || {});
|
|
12
|
+
class se {
|
|
13
13
|
constructor(e) {
|
|
14
14
|
this.level = e;
|
|
15
15
|
}
|
|
@@ -26,8 +26,8 @@ class ne {
|
|
|
26
26
|
this.level <= 3 && console.error("[Usermaven Error]:", e, ...t);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return new
|
|
29
|
+
function g(s = 0) {
|
|
30
|
+
return new se(s);
|
|
31
31
|
}
|
|
32
32
|
const Z = {
|
|
33
33
|
logLevel: k.ERROR,
|
|
@@ -61,20 +61,20 @@ const Z = {
|
|
|
61
61
|
maskAllText: !1,
|
|
62
62
|
maskAllElementAttributes: !1
|
|
63
63
|
};
|
|
64
|
-
class
|
|
64
|
+
class ne {
|
|
65
65
|
constructor(e) {
|
|
66
66
|
this.domain = e, this.cookieDomain = this.getCookieDomain();
|
|
67
67
|
}
|
|
68
|
-
set(e, t, i = 365,
|
|
68
|
+
set(e, t, i = 365, n = !0, r = !1) {
|
|
69
69
|
const o = /* @__PURE__ */ new Date();
|
|
70
70
|
o.setTime(o.getTime() + i * 24 * 60 * 60 * 1e3);
|
|
71
|
-
const a = `expires=${o.toUTCString()}`, l =
|
|
71
|
+
const a = `expires=${o.toUTCString()}`, l = n ? "; Secure" : "", c = r ? "; HttpOnly" : "";
|
|
72
72
|
document.cookie = `${e}=${t};${a};path=/;domain=${this.cookieDomain}${l}${c}`;
|
|
73
73
|
}
|
|
74
74
|
get(e) {
|
|
75
75
|
const t = e + "=", i = document.cookie.split(";");
|
|
76
|
-
for (let
|
|
77
|
-
let r = i[
|
|
76
|
+
for (let n = 0; n < i.length; n++) {
|
|
77
|
+
let r = i[n].trim();
|
|
78
78
|
if (r.indexOf(t) === 0)
|
|
79
79
|
return decodeURIComponent(r.substring(t.length));
|
|
80
80
|
}
|
|
@@ -102,83 +102,83 @@ class se {
|
|
|
102
102
|
}
|
|
103
103
|
extractRootDomain(e) {
|
|
104
104
|
let t = this.extractHostname(e);
|
|
105
|
-
const i = t.split("."),
|
|
106
|
-
return
|
|
105
|
+
const i = t.split("."), n = i.length;
|
|
106
|
+
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;
|
|
107
107
|
}
|
|
108
108
|
extractTopLevelDomain(e) {
|
|
109
109
|
const t = /[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i, i = e.match(t);
|
|
110
110
|
return i ? i[0] : "";
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
const re = Object.prototype, oe = re.hasOwnProperty, ae = Array.prototype,
|
|
114
|
-
function ce(
|
|
115
|
-
if (Array.isArray(
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
else if ("length" in
|
|
119
|
-
for (let i = 0,
|
|
120
|
-
if (i in
|
|
113
|
+
const re = Object.prototype, oe = re.hasOwnProperty, ae = Array.prototype, T = ae.forEach, U = {};
|
|
114
|
+
function ce(s, e, t) {
|
|
115
|
+
if (Array.isArray(s)) {
|
|
116
|
+
if (T && s.forEach === T)
|
|
117
|
+
s.forEach(e, t);
|
|
118
|
+
else if ("length" in s && s.length === +s.length) {
|
|
119
|
+
for (let i = 0, n = s.length; i < n; i++)
|
|
120
|
+
if (i in s && e.call(t, s[i], i) === U)
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
const
|
|
126
|
-
return
|
|
127
|
-
}, le = function(
|
|
128
|
-
for (const e in
|
|
129
|
-
typeof
|
|
125
|
+
const B = function(s) {
|
|
126
|
+
return s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
127
|
+
}, le = function(s) {
|
|
128
|
+
for (const e in s)
|
|
129
|
+
typeof s[e] == "function" && (s[e] = s[e].bind(s));
|
|
130
130
|
};
|
|
131
|
-
function w(
|
|
132
|
-
if (
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
else if ("length" in
|
|
136
|
-
for (let i = 0,
|
|
137
|
-
if (i in
|
|
131
|
+
function w(s, e, t) {
|
|
132
|
+
if (s != null) {
|
|
133
|
+
if (T && Array.isArray(s) && s.forEach === T)
|
|
134
|
+
s.forEach(e, t);
|
|
135
|
+
else if ("length" in s && s.length === +s.length) {
|
|
136
|
+
for (let i = 0, n = s.length; i < n; i++)
|
|
137
|
+
if (i in s && e.call(t, s[i], i) === U)
|
|
138
138
|
return;
|
|
139
139
|
} else
|
|
140
|
-
for (const i in
|
|
141
|
-
if (oe.call(
|
|
140
|
+
for (const i in s)
|
|
141
|
+
if (oe.call(s, i) && e.call(t, s[i], i) === U)
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
const ue = function(
|
|
145
|
+
const ue = function(s, ...e) {
|
|
146
146
|
return ce(e, function(t) {
|
|
147
147
|
for (const i in t)
|
|
148
|
-
t[i] !== void 0 && (
|
|
149
|
-
}),
|
|
148
|
+
t[i] !== void 0 && (s[i] = t[i]);
|
|
149
|
+
}), s;
|
|
150
150
|
};
|
|
151
|
-
function
|
|
152
|
-
return
|
|
151
|
+
function A(s, e) {
|
|
152
|
+
return s.indexOf(e) !== -1;
|
|
153
153
|
}
|
|
154
|
-
const he = function(
|
|
154
|
+
const he = function(s) {
|
|
155
155
|
try {
|
|
156
|
-
return /^\s*\bfunction\b/.test(
|
|
156
|
+
return /^\s*\bfunction\b/.test(s);
|
|
157
157
|
} catch {
|
|
158
158
|
return !1;
|
|
159
159
|
}
|
|
160
|
-
}, de = function(
|
|
161
|
-
return
|
|
160
|
+
}, de = function(s) {
|
|
161
|
+
return s === void 0;
|
|
162
162
|
}, E = function() {
|
|
163
|
-
const
|
|
163
|
+
const s = function(i, n, r, o, a) {
|
|
164
164
|
if (!i) {
|
|
165
|
-
|
|
165
|
+
g().error("No valid element provided to register_event");
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
if (i.addEventListener && !o)
|
|
169
|
-
i.addEventListener(
|
|
169
|
+
i.addEventListener(n, r, !!a);
|
|
170
170
|
else {
|
|
171
|
-
const l = "on" +
|
|
171
|
+
const l = "on" + n, c = i[l];
|
|
172
172
|
i[l] = e(i, r, c);
|
|
173
173
|
}
|
|
174
174
|
};
|
|
175
|
-
function e(i,
|
|
175
|
+
function e(i, n, r) {
|
|
176
176
|
return function(o) {
|
|
177
177
|
if (o = o || t(window.event), !o)
|
|
178
178
|
return;
|
|
179
179
|
let a = !0, l;
|
|
180
180
|
he(r) && (l = r(o));
|
|
181
|
-
const c =
|
|
181
|
+
const c = n.call(i, o);
|
|
182
182
|
return (l === !1 || c === !1) && (a = !1), a;
|
|
183
183
|
};
|
|
184
184
|
}
|
|
@@ -189,80 +189,80 @@ const he = function(n) {
|
|
|
189
189
|
this.returnValue = !1;
|
|
190
190
|
}, t.stopPropagation = function() {
|
|
191
191
|
this.cancelBubble = !0;
|
|
192
|
-
},
|
|
193
|
-
}(),
|
|
192
|
+
}, s;
|
|
193
|
+
}(), ge = function(s) {
|
|
194
194
|
return function(...e) {
|
|
195
195
|
try {
|
|
196
|
-
return
|
|
196
|
+
return s.apply(this, e);
|
|
197
197
|
} catch (t) {
|
|
198
|
-
|
|
198
|
+
g().error(
|
|
199
199
|
"Implementation error. Please turn on debug and contact support@usermaven.com.",
|
|
200
200
|
t
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
|
-
}, Y = function(
|
|
205
|
-
for (const e in
|
|
206
|
-
typeof
|
|
204
|
+
}, Y = function(s) {
|
|
205
|
+
for (const e in s)
|
|
206
|
+
typeof s[e] == "function" && (s[e] = ge(s[e]));
|
|
207
207
|
};
|
|
208
|
-
function
|
|
209
|
-
for (let e in
|
|
210
|
-
(
|
|
211
|
-
return
|
|
208
|
+
function M(s) {
|
|
209
|
+
for (let e in s)
|
|
210
|
+
(s[e] === "" || s[e] === null || s[e] === void 0 || typeof s[e] == "object" && Object.keys(s[e]).length === 0) && delete s[e];
|
|
211
|
+
return s;
|
|
212
212
|
}
|
|
213
213
|
function h() {
|
|
214
214
|
try {
|
|
215
215
|
return typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0;
|
|
216
216
|
} catch {
|
|
217
|
-
return
|
|
217
|
+
return g().warn("window is not available"), !1;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
function v(
|
|
221
|
-
const e = new Uint8Array(
|
|
222
|
-
return crypto.getRandomValues(e), Array.from(e, (t) => t.toString(36).padStart(2, "0")).join("").slice(0,
|
|
220
|
+
function v(s = 5) {
|
|
221
|
+
const e = new Uint8Array(s);
|
|
222
|
+
return crypto.getRandomValues(e), Array.from(e, (t) => t.toString(36).padStart(2, "0")).join("").slice(0, s);
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
return
|
|
224
|
+
function fe(s) {
|
|
225
|
+
return s.replace(
|
|
226
226
|
/([-_][a-z])/g,
|
|
227
227
|
(e) => e.toUpperCase().replace("-", "").replace("_", "")
|
|
228
228
|
);
|
|
229
229
|
}
|
|
230
|
-
function
|
|
231
|
-
return typeof
|
|
230
|
+
function F(s) {
|
|
231
|
+
return typeof s != "object" || s === null ? s : Array.isArray(s) ? s.map(F) : Object.keys(s).reduce(
|
|
232
232
|
(e, t) => {
|
|
233
|
-
const i =
|
|
234
|
-
return e[i] =
|
|
233
|
+
const i = fe(t);
|
|
234
|
+
return e[i] = F(s[t]), e;
|
|
235
235
|
},
|
|
236
236
|
{}
|
|
237
237
|
);
|
|
238
238
|
}
|
|
239
|
-
function x(
|
|
240
|
-
switch (typeof
|
|
239
|
+
function x(s) {
|
|
240
|
+
switch (typeof s.className) {
|
|
241
241
|
case "string":
|
|
242
|
-
return
|
|
242
|
+
return s.className;
|
|
243
243
|
case "object":
|
|
244
|
-
return ("baseVal" in
|
|
244
|
+
return ("baseVal" in s.className ? s.className.baseVal : null) || s.getAttribute("class") || "";
|
|
245
245
|
default:
|
|
246
246
|
return "";
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function V(s) {
|
|
250
250
|
let e = "";
|
|
251
|
-
return
|
|
252
|
-
j(t) && t.textContent && (e +=
|
|
253
|
-
}),
|
|
251
|
+
return q(s) && !ee(s) && s.childNodes && s.childNodes.length && w(s.childNodes, function(t) {
|
|
252
|
+
j(t) && t.textContent && (e += B(t.textContent).split(/(\s+)/).filter($).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255));
|
|
253
|
+
}), B(e);
|
|
254
254
|
}
|
|
255
|
-
function G(
|
|
256
|
-
return !!
|
|
255
|
+
function G(s) {
|
|
256
|
+
return !!s && s.nodeType === 1;
|
|
257
257
|
}
|
|
258
|
-
function y(
|
|
259
|
-
return !!
|
|
258
|
+
function y(s, e) {
|
|
259
|
+
return !!s && !!s.tagName && s.tagName.toLowerCase() === e.toLowerCase();
|
|
260
260
|
}
|
|
261
|
-
function j(
|
|
262
|
-
return !!
|
|
261
|
+
function j(s) {
|
|
262
|
+
return !!s && s.nodeType === 3;
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
return !!
|
|
264
|
+
function Q(s) {
|
|
265
|
+
return !!s && s.nodeType === 11;
|
|
266
266
|
}
|
|
267
267
|
const C = [
|
|
268
268
|
"a",
|
|
@@ -273,18 +273,18 @@ const C = [
|
|
|
273
273
|
"textarea",
|
|
274
274
|
"label"
|
|
275
275
|
];
|
|
276
|
-
function pe(
|
|
277
|
-
if (!
|
|
276
|
+
function pe(s, e) {
|
|
277
|
+
if (!s || y(s, "html") || !G(s))
|
|
278
278
|
return !1;
|
|
279
|
-
let t =
|
|
279
|
+
let t = s;
|
|
280
280
|
for (; t && !y(t, "body"); ) {
|
|
281
281
|
if (t.classList && t.classList.contains("um-no-capture"))
|
|
282
282
|
return !1;
|
|
283
|
-
t.parentNode &&
|
|
283
|
+
t.parentNode && Q(t.parentNode) ? t = t.parentNode.host : t = t.parentNode;
|
|
284
284
|
}
|
|
285
285
|
let i = !1;
|
|
286
|
-
for (t =
|
|
287
|
-
if (t.parentNode &&
|
|
286
|
+
for (t = s; t && !y(t, "body"); ) {
|
|
287
|
+
if (t.parentNode && Q(t.parentNode)) {
|
|
288
288
|
t = t.parentNode.host, t && C.indexOf(t.tagName.toLowerCase()) > -1 && (i = !0);
|
|
289
289
|
continue;
|
|
290
290
|
}
|
|
@@ -298,10 +298,10 @@ function pe(n, e) {
|
|
|
298
298
|
}
|
|
299
299
|
t = o;
|
|
300
300
|
}
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
301
|
+
const n = window.getComputedStyle(s);
|
|
302
|
+
if (n && n.getPropertyValue("cursor") === "pointer" && e.type === "click")
|
|
303
303
|
return !0;
|
|
304
|
-
const r =
|
|
304
|
+
const r = s.tagName.toLowerCase();
|
|
305
305
|
switch (r) {
|
|
306
306
|
case "html":
|
|
307
307
|
return !1;
|
|
@@ -313,18 +313,18 @@ function pe(n, e) {
|
|
|
313
313
|
case "textarea":
|
|
314
314
|
return e.type === "change" || e.type === "click";
|
|
315
315
|
default:
|
|
316
|
-
return i ? e.type === "click" : e.type === "click" && (C.indexOf(r) > -1 ||
|
|
316
|
+
return i ? e.type === "click" : e.type === "click" && (C.indexOf(r) > -1 || s.getAttribute("contenteditable") === "true");
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
for (let i =
|
|
321
|
-
const
|
|
322
|
-
if (
|
|
319
|
+
function q(s) {
|
|
320
|
+
for (let i = s; i.parentNode && !y(i, "body"); i = i.parentNode) {
|
|
321
|
+
const n = x(i).split(" ");
|
|
322
|
+
if (A(n, "ph-sensitive") || A(n, "ph-no-capture"))
|
|
323
323
|
return !1;
|
|
324
324
|
}
|
|
325
|
-
if (
|
|
325
|
+
if (A(x(s).split(" "), "ph-include"))
|
|
326
326
|
return !0;
|
|
327
|
-
const e =
|
|
327
|
+
const e = s.type || "";
|
|
328
328
|
if (typeof e == "string")
|
|
329
329
|
switch (e.toLowerCase()) {
|
|
330
330
|
case "hidden":
|
|
@@ -332,59 +332,59 @@ function B(n) {
|
|
|
332
332
|
case "password":
|
|
333
333
|
return !1;
|
|
334
334
|
}
|
|
335
|
-
const t =
|
|
335
|
+
const t = s.name || s.id || "";
|
|
336
336
|
return !(typeof t == "string" && /^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(t.replace(/[^a-zA-Z0-9]/g, "")));
|
|
337
337
|
}
|
|
338
|
-
function ee(
|
|
338
|
+
function ee(s) {
|
|
339
339
|
const e = ["button", "checkbox", "submit", "reset"];
|
|
340
|
-
return !!(y(
|
|
340
|
+
return !!(y(s, "input") && !e.includes(s.type) || y(s, "select") || y(s, "textarea") || s.getAttribute("contenteditable") === "true");
|
|
341
341
|
}
|
|
342
|
-
function
|
|
343
|
-
return !(
|
|
342
|
+
function $(s) {
|
|
343
|
+
return !(s === null || de(s) || typeof s == "string" && (s = B(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)));
|
|
344
344
|
}
|
|
345
|
-
function me(
|
|
346
|
-
return typeof
|
|
345
|
+
function me(s) {
|
|
346
|
+
return typeof s == "string" ? s.substring(0, 10) === "_ngcontent" || s.substring(0, 7) === "_nghost" : !1;
|
|
347
347
|
}
|
|
348
348
|
function R() {
|
|
349
349
|
return v(10);
|
|
350
350
|
}
|
|
351
|
-
function J(
|
|
352
|
-
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(
|
|
351
|
+
function J(s) {
|
|
352
|
+
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());
|
|
353
353
|
}
|
|
354
|
-
function ye(
|
|
354
|
+
function ye(s, e) {
|
|
355
355
|
let t;
|
|
356
356
|
return function(...i) {
|
|
357
|
-
const
|
|
358
|
-
clearTimeout(t),
|
|
357
|
+
const n = () => {
|
|
358
|
+
clearTimeout(t), s(...i);
|
|
359
359
|
};
|
|
360
|
-
clearTimeout(t), t = setTimeout(
|
|
360
|
+
clearTimeout(t), t = setTimeout(n, e);
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
|
-
function we(
|
|
364
|
-
const e = {}, t =
|
|
363
|
+
function we(s) {
|
|
364
|
+
const e = {}, t = s.replace(/^\?/, "").split("&");
|
|
365
365
|
for (let i = 0; i < t.length; i++) {
|
|
366
|
-
const
|
|
367
|
-
|
|
366
|
+
const n = t[i].split("=");
|
|
367
|
+
n[0] !== "" && (e[decodeURIComponent(n[0])] = decodeURIComponent(n[1] || ""));
|
|
368
368
|
}
|
|
369
369
|
return e;
|
|
370
370
|
}
|
|
371
|
-
function L(
|
|
372
|
-
return typeof
|
|
371
|
+
function L(s) {
|
|
372
|
+
return typeof s == "string" || s instanceof String;
|
|
373
373
|
}
|
|
374
|
-
function P(
|
|
375
|
-
return
|
|
374
|
+
function P(s) {
|
|
375
|
+
return s !== null && typeof s == "object" && s.constructor === Object;
|
|
376
376
|
}
|
|
377
|
-
function ke(
|
|
378
|
-
if (
|
|
377
|
+
function ke(s) {
|
|
378
|
+
if (s === null)
|
|
379
379
|
return k.ERROR;
|
|
380
|
-
const e =
|
|
380
|
+
const e = s.toUpperCase(), t = k[e];
|
|
381
381
|
return t || t === 0 ? t : k.ERROR;
|
|
382
382
|
}
|
|
383
383
|
const ve = () => {
|
|
384
|
-
let
|
|
385
|
-
return typeof window < "u" && window.localStorage && (
|
|
384
|
+
let s = "false";
|
|
385
|
+
return typeof window < "u" && window.localStorage && (s = localStorage.getItem("um_exclusion")), !(s == null || s === "false");
|
|
386
386
|
};
|
|
387
|
-
class
|
|
387
|
+
class be {
|
|
388
388
|
constructor(e) {
|
|
389
389
|
this.maxScrollDepth = 0, this.milestones = [25, 50, 75, 90], this.lastScrollDepth = 0, this.client = e, this.documentElement = document.documentElement, this.debouncedHandleScroll = ye(this.handleScroll.bind(this), 250), this.initializeEventListener();
|
|
390
390
|
}
|
|
@@ -410,8 +410,8 @@ class _e {
|
|
|
410
410
|
this.track();
|
|
411
411
|
}
|
|
412
412
|
getScrollDepth() {
|
|
413
|
-
const e = this.getWindowHeight(), t = this.getDocumentHeight(), i = this.getScrollDistance(),
|
|
414
|
-
return Math.min(100, Math.floor(i /
|
|
413
|
+
const e = this.getWindowHeight(), t = this.getDocumentHeight(), i = this.getScrollDistance(), n = t - e;
|
|
414
|
+
return Math.min(100, Math.floor(i / n * 100));
|
|
415
415
|
}
|
|
416
416
|
getWindowHeight() {
|
|
417
417
|
return window.innerHeight || this.documentElement.clientHeight || document.body.clientHeight || 0;
|
|
@@ -433,16 +433,16 @@ class _e {
|
|
|
433
433
|
this.milestones.filter(
|
|
434
434
|
(i) => e >= i
|
|
435
435
|
).forEach((i) => {
|
|
436
|
-
this.send(), this.milestones = this.milestones.filter((
|
|
436
|
+
this.send(), this.milestones = this.milestones.filter((n) => n !== i);
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
439
|
destroy() {
|
|
440
440
|
window.removeEventListener("scroll", this.debouncedHandleScroll);
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
const
|
|
444
|
-
constructor(e, t, i =
|
|
445
|
-
this.logger = i, this.scrollDepth = null, this.customProperties = [], this.domHandlersAttached = !1, this.client = e, this.options = t, this.scrollDepth = new
|
|
443
|
+
const N = class N {
|
|
444
|
+
constructor(e, t, i = g()) {
|
|
445
|
+
this.logger = i, this.scrollDepth = null, this.customProperties = [], this.domHandlersAttached = !1, this.client = e, this.options = t, this.scrollDepth = new be(e), le(this), Y(this);
|
|
446
446
|
}
|
|
447
447
|
isBrowserSupported() {
|
|
448
448
|
return typeof document < "u" && typeof document.addEventListener == "function";
|
|
@@ -479,17 +479,17 @@ const I = class I {
|
|
|
479
479
|
return performance.navigation && performance.navigation.type === 1;
|
|
480
480
|
}
|
|
481
481
|
captureEvent(e) {
|
|
482
|
-
var i,
|
|
482
|
+
var i, n;
|
|
483
483
|
let t = this.getEventTarget(e);
|
|
484
484
|
if (j(t) && (t = t.parentNode || null), e.type === "scroll")
|
|
485
485
|
return (i = this.scrollDepth) == null || i.track(), !0;
|
|
486
486
|
if (e.type === "visibilitychange" && document.visibilityState === "hidden" || e.type === "popstate")
|
|
487
|
-
return this.isPageRefresh() || (
|
|
487
|
+
return this.isPageRefresh() || (n = this.scrollDepth) == null || n.send(), !0;
|
|
488
488
|
if (t && pe(t, e)) {
|
|
489
489
|
const r = [t];
|
|
490
490
|
let o = t;
|
|
491
491
|
for (; o.parentNode && !y(o, "body"); ) {
|
|
492
|
-
if (
|
|
492
|
+
if (Q(o.parentNode)) {
|
|
493
493
|
r.push(o.parentNode.host), o = o.parentNode.host;
|
|
494
494
|
continue;
|
|
495
495
|
}
|
|
@@ -498,17 +498,17 @@ const I = class I {
|
|
|
498
498
|
const a = [];
|
|
499
499
|
let l, c = !1;
|
|
500
500
|
if (w(r, (p) => {
|
|
501
|
-
const
|
|
502
|
-
p.tagName.toLowerCase() === "a" && (l = p.getAttribute("href"), l =
|
|
501
|
+
const b = q(p);
|
|
502
|
+
p.tagName.toLowerCase() === "a" && (l = p.getAttribute("href"), l = b && $(l) && l);
|
|
503
503
|
const u = x(p).split(" ");
|
|
504
|
-
|
|
504
|
+
A(u, "ph-no-capture") && (c = !0), a.push(
|
|
505
505
|
this.getPropertiesFromElement(
|
|
506
506
|
p,
|
|
507
507
|
this.options.maskAllElementAttributes ?? !1,
|
|
508
508
|
this.options.maskAllText ?? !1
|
|
509
509
|
)
|
|
510
510
|
);
|
|
511
|
-
}), this.options.maskAllText || (a[0].$el_text =
|
|
511
|
+
}), this.options.maskAllText || (a[0].$el_text = V(t)), l && (a[0].attr__href = l), c)
|
|
512
512
|
return !1;
|
|
513
513
|
const d = ue(
|
|
514
514
|
this.getDefaultProperties(e.type),
|
|
@@ -523,10 +523,10 @@ const I = class I {
|
|
|
523
523
|
getCustomProperties(e) {
|
|
524
524
|
const t = {};
|
|
525
525
|
return w(this.customProperties, (i) => {
|
|
526
|
-
w(i.event_selectors, (
|
|
527
|
-
const r = document.querySelectorAll(
|
|
526
|
+
w(i.event_selectors, (n) => {
|
|
527
|
+
const r = document.querySelectorAll(n);
|
|
528
528
|
w(r, (o) => {
|
|
529
|
-
|
|
529
|
+
A(e, o) && q(o) && (t[i.name] = this.extractCustomPropertyValue(i));
|
|
530
530
|
});
|
|
531
531
|
});
|
|
532
532
|
}), t;
|
|
@@ -536,8 +536,8 @@ const I = class I {
|
|
|
536
536
|
return w(
|
|
537
537
|
document.querySelectorAll(e.css_selector),
|
|
538
538
|
function(i) {
|
|
539
|
-
let
|
|
540
|
-
["input", "select"].indexOf(i.tagName.toLowerCase()) > -1 ?
|
|
539
|
+
let n;
|
|
540
|
+
["input", "select"].indexOf(i.tagName.toLowerCase()) > -1 ? n = i.value : i.textContent && (n = i.textContent), $(n) && t.push(n);
|
|
541
541
|
}
|
|
542
542
|
), t.join(", ");
|
|
543
543
|
}
|
|
@@ -546,15 +546,15 @@ const I = class I {
|
|
|
546
546
|
return typeof e.target > "u" ? e.srcElement || null : (t = e.target) != null && t.shadowRoot ? e.composedPath()[0] || null : e.target || null;
|
|
547
547
|
}
|
|
548
548
|
getPropertiesFromElement(e, t, i) {
|
|
549
|
-
const
|
|
550
|
-
tag_name:
|
|
549
|
+
const n = e.tagName.toLowerCase(), r = {
|
|
550
|
+
tag_name: n
|
|
551
551
|
};
|
|
552
|
-
C.indexOf(
|
|
552
|
+
C.indexOf(n) > -1 && !i && (r.$el_text = V(e));
|
|
553
553
|
const o = x(e);
|
|
554
554
|
o.length > 0 && (r.classes = o.split(" ").filter(function(d) {
|
|
555
555
|
return d !== "";
|
|
556
556
|
})), w(e.attributes, function(d) {
|
|
557
|
-
ee(e) && ["name", "id", "class"].indexOf(d.name) === -1 || !t &&
|
|
557
|
+
ee(e) && ["name", "id", "class"].indexOf(d.name) === -1 || !t && $(d.value) && !me(d.name) && (r["attr__" + d.name] = d.value);
|
|
558
558
|
});
|
|
559
559
|
let a = 1, l = 1, c = e;
|
|
560
560
|
for (; c = this.previousElementSibling(c); )
|
|
@@ -584,15 +584,15 @@ const I = class I {
|
|
|
584
584
|
static enabledForProject(e, t = 10, i = 10) {
|
|
585
585
|
if (!e)
|
|
586
586
|
return !1;
|
|
587
|
-
let
|
|
587
|
+
let n = 0;
|
|
588
588
|
for (let r = 0; r < e.length; r++)
|
|
589
|
-
|
|
590
|
-
return
|
|
589
|
+
n += e.charCodeAt(r);
|
|
590
|
+
return n % t < i;
|
|
591
591
|
}
|
|
592
592
|
};
|
|
593
|
-
|
|
594
|
-
let H =
|
|
595
|
-
class
|
|
593
|
+
N.FORCE_CAPTURE_ATTR = "data-um-force-capture", N.PREVENT_CAPTURE_ATTR = "data-um-no-capture";
|
|
594
|
+
let H = N;
|
|
595
|
+
class _e {
|
|
596
596
|
constructor(e) {
|
|
597
597
|
this.client = e, this.lastPageUrl = window.location.href, this.trackInitialPageview(), this.initializePageviewTracking();
|
|
598
598
|
}
|
|
@@ -622,14 +622,14 @@ class be {
|
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
624
|
class Ee {
|
|
625
|
-
constructor(e, t, i =
|
|
625
|
+
constructor(e, t, i = g()) {
|
|
626
626
|
this.trackingHost = e, this.logger = i, this.config = t;
|
|
627
627
|
}
|
|
628
628
|
async send(e) {
|
|
629
|
-
const t = this.config.key, i = this.constructUrl(t),
|
|
629
|
+
const t = this.config.key, i = this.constructUrl(t), n = new Blob([JSON.stringify(e)], {
|
|
630
630
|
type: "application/json"
|
|
631
631
|
});
|
|
632
|
-
if (navigator.sendBeacon(i,
|
|
632
|
+
if (navigator.sendBeacon(i, n))
|
|
633
633
|
this.logger.debug(
|
|
634
634
|
`Successfully queued ${e.length} event(s) via Beacon API`
|
|
635
635
|
);
|
|
@@ -637,32 +637,32 @@ class Ee {
|
|
|
637
637
|
throw new Error("Failed to queue events via Beacon API");
|
|
638
638
|
}
|
|
639
639
|
constructUrl(e) {
|
|
640
|
-
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "",
|
|
641
|
-
return this.config.randomizeUrl ? `${this.trackingHost}/api.${v()}?p_${v()}=${e}${t}${i}` : `${this.trackingHost}${
|
|
640
|
+
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = h() ? "/api/v1/event" : "/api/v1/s2s/event";
|
|
641
|
+
return this.config.randomizeUrl ? `${this.trackingHost}/api.${v()}?p_${v()}=${e}${t}${i}` : `${this.trackingHost}${n}?token=${e}${t}${i}`;
|
|
642
642
|
}
|
|
643
643
|
// Note: Beacon API doesn't support custom headers, so we can't use them here.
|
|
644
644
|
// If custom headers are crucial, you might want to fall back to XHR or Fetch in those cases.
|
|
645
645
|
}
|
|
646
646
|
class W {
|
|
647
|
-
constructor(e, t, i =
|
|
647
|
+
constructor(e, t, i = g()) {
|
|
648
648
|
this.trackingHost = e, this.logger = i, this.config = t;
|
|
649
649
|
}
|
|
650
650
|
async send(e) {
|
|
651
|
-
const t = this.config.key, i = this.constructUrl(t),
|
|
651
|
+
const t = this.config.key, i = this.constructUrl(t), n = JSON.stringify(e), r = {
|
|
652
652
|
"Content-Type": "application/json",
|
|
653
653
|
...this.getCustomHeaders()
|
|
654
654
|
}, o = await fetch(i, {
|
|
655
655
|
method: "POST",
|
|
656
656
|
headers: r,
|
|
657
|
-
body:
|
|
657
|
+
body: n
|
|
658
658
|
});
|
|
659
659
|
if (!o.ok)
|
|
660
660
|
throw new Error(`HTTP error! status: ${o.status}`);
|
|
661
661
|
this.logger.debug(`Successfully sent ${e.length} event(s)`), this.postHandle(o.status, await o.text());
|
|
662
662
|
}
|
|
663
663
|
constructUrl(e) {
|
|
664
|
-
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "",
|
|
665
|
-
return this.config.randomizeUrl ? `${this.trackingHost}/api.${v()}?p_${v()}=${e}${t}${i}` : `${this.trackingHost}${
|
|
664
|
+
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = h() ? "/api/v1/event" : "/api/v1/s2s/event";
|
|
665
|
+
return this.config.randomizeUrl ? `${this.trackingHost}/api.${v()}?p_${v()}=${e}${t}${i}` : `${this.trackingHost}${n}?token=${e}${t}${i}`;
|
|
666
666
|
}
|
|
667
667
|
getCustomHeaders() {
|
|
668
668
|
return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
|
|
@@ -672,26 +672,26 @@ class W {
|
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
674
|
class Pe {
|
|
675
|
-
constructor(e, t, i =
|
|
675
|
+
constructor(e, t, i = g()) {
|
|
676
676
|
this.trackingHost = e, this.logger = i, this.config = t;
|
|
677
677
|
}
|
|
678
678
|
send(e) {
|
|
679
679
|
return new Promise((t, i) => {
|
|
680
|
-
const
|
|
681
|
-
|
|
680
|
+
const n = new XMLHttpRequest(), r = this.config.key, o = this.constructUrl(r);
|
|
681
|
+
n.open("POST", o, !0), n.setRequestHeader("Content-Type", "application/json");
|
|
682
682
|
const a = this.getCustomHeaders();
|
|
683
683
|
Object.keys(a).forEach((l) => {
|
|
684
|
-
|
|
685
|
-
}),
|
|
686
|
-
|
|
687
|
-
},
|
|
684
|
+
n.setRequestHeader(l, a[l]);
|
|
685
|
+
}), n.onload = () => {
|
|
686
|
+
n.status >= 200 && n.status < 300 ? (this.logger.debug(`Successfully sent ${e.length} event(s)`), t()) : i(new Error(`HTTP error! status: ${n.status}`));
|
|
687
|
+
}, n.onerror = () => {
|
|
688
688
|
i(new Error("Network error"));
|
|
689
|
-
},
|
|
689
|
+
}, n.send(JSON.stringify(e));
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
692
|
constructUrl(e) {
|
|
693
|
-
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "",
|
|
694
|
-
return this.config.randomizeUrl ? `${this.trackingHost}/api.${v()}?p_${v()}=${e}${t}${i}` : `${this.trackingHost}${
|
|
693
|
+
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = h() ? "/api/v1/event" : "/api/v1/s2s/event";
|
|
694
|
+
return this.config.randomizeUrl ? `${this.trackingHost}/api.${v()}?p_${v()}=${e}${t}${i}` : `${this.trackingHost}${n}?token=${e}${t}${i}`;
|
|
695
695
|
}
|
|
696
696
|
getCustomHeaders() {
|
|
697
697
|
return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
|
|
@@ -702,7 +702,7 @@ class Pe {
|
|
|
702
702
|
}
|
|
703
703
|
class te {
|
|
704
704
|
constructor(e, t) {
|
|
705
|
-
this.storage = {}, this.prefix = `usermaven_${e}_`, this.
|
|
705
|
+
this.storage = {}, this.storageDisabled = !1, this.quotaErrorLogged = !1, this.prefix = `usermaven_${e}_`, this.logger = t || g(), this.load();
|
|
706
706
|
}
|
|
707
707
|
set(e, t) {
|
|
708
708
|
this.storage[e] = t, this.save();
|
|
@@ -716,16 +716,8 @@ class te {
|
|
|
716
716
|
clear() {
|
|
717
717
|
this.storage = {}, this.save();
|
|
718
718
|
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
this.logger.warn("localStorage is not available in this environment");
|
|
722
|
-
return;
|
|
723
|
-
}
|
|
724
|
-
try {
|
|
725
|
-
localStorage.setItem(this.prefix + "data", JSON.stringify(this.storage));
|
|
726
|
-
} catch (e) {
|
|
727
|
-
this.logger.error("Error saving to localStorage:", e);
|
|
728
|
-
}
|
|
719
|
+
isStorageEnabled() {
|
|
720
|
+
return !this.storageDisabled;
|
|
729
721
|
}
|
|
730
722
|
load() {
|
|
731
723
|
if (!h()) {
|
|
@@ -736,11 +728,32 @@ class te {
|
|
|
736
728
|
const e = localStorage.getItem(this.prefix + "data");
|
|
737
729
|
e && (this.storage = JSON.parse(e));
|
|
738
730
|
} catch (e) {
|
|
739
|
-
this.logger.error("Error loading from localStorage:", e);
|
|
731
|
+
this.isQuotaError(e) ? (this.storageDisabled = !0, this.logQuotaOnce(e)) : this.logger.error("Error loading from localStorage:", e);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
save() {
|
|
735
|
+
if (!h())
|
|
736
|
+
return this.logger.warn("localStorage is not available in this environment"), !1;
|
|
737
|
+
if (this.storageDisabled)
|
|
738
|
+
return !1;
|
|
739
|
+
try {
|
|
740
|
+
return localStorage.setItem(this.prefix + "data", JSON.stringify(this.storage)), !0;
|
|
741
|
+
} catch (e) {
|
|
742
|
+
return this.isQuotaError(e) ? (this.storageDisabled = !0, this.logQuotaOnce(e)) : this.logger.error("Error saving to localStorage:", e), !1;
|
|
740
743
|
}
|
|
741
744
|
}
|
|
745
|
+
isQuotaError(e) {
|
|
746
|
+
const t = e == null ? void 0 : e.name;
|
|
747
|
+
return t === "QuotaExceededError" || t === "NS_ERROR_DOM_QUOTA_REACHED" || (e == null ? void 0 : e.code) === 22 || (e == null ? void 0 : e.code) === 1014;
|
|
748
|
+
}
|
|
749
|
+
logQuotaOnce(e) {
|
|
750
|
+
this.quotaErrorLogged || (this.quotaErrorLogged = !0, this.logger.error(
|
|
751
|
+
"localStorage quota exceeded; persisting disabled. Continuing with in-memory storage only.",
|
|
752
|
+
e
|
|
753
|
+
));
|
|
754
|
+
}
|
|
742
755
|
}
|
|
743
|
-
class
|
|
756
|
+
class Se {
|
|
744
757
|
constructor() {
|
|
745
758
|
this.storage = {};
|
|
746
759
|
}
|
|
@@ -760,15 +773,18 @@ class Ae {
|
|
|
760
773
|
}
|
|
761
774
|
}
|
|
762
775
|
class K {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
this.transport = e, this.maxRetries = t, this.retryInterval = i, this.batchSize = s, this.batchInterval = r, this.logger = o, this.queue = [], this.processing = !1, this.batchTimeoutId = null, this.isOnline = !0, this.persistence = new te(
|
|
776
|
+
constructor(e, t = 3, i = 1e3, n = 10, r = 1e3, o = g(), a = "default", l = 1e3, c = 25e5) {
|
|
777
|
+
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.totalQueueBytes = 0, this.persistence = new te(
|
|
766
778
|
`offline_queue_${a}`
|
|
767
|
-
), h() && (this.isOnline = navigator.onLine, this.loadQueueFromStorage(), this.initNetworkListeners(), this.scheduleBatch());
|
|
779
|
+
), this.maxQueueItems = l, this.maxQueueBytes = c, h() && (this.isOnline = navigator.onLine, this.loadQueueFromStorage(), this.initNetworkListeners(), this.scheduleBatch());
|
|
768
780
|
}
|
|
769
781
|
add(e) {
|
|
770
|
-
const t = {
|
|
771
|
-
|
|
782
|
+
const t = {
|
|
783
|
+
payload: e,
|
|
784
|
+
retries: 0,
|
|
785
|
+
timestamp: Date.now()
|
|
786
|
+
};
|
|
787
|
+
t.bytes = this.estimateItemBytes(t), this.queue.push(t), this.totalQueueBytes += t.bytes, this.enforceQueueLimits(), h() ? this.saveQueueToStorage() : this.processBatch();
|
|
772
788
|
}
|
|
773
789
|
initNetworkListeners() {
|
|
774
790
|
h() && (window.addEventListener("online", () => {
|
|
@@ -786,7 +802,12 @@ class K {
|
|
|
786
802
|
async processBatch() {
|
|
787
803
|
if ((!h() || this.isOnline) && !this.processing && this.queue.length > 0) {
|
|
788
804
|
this.processing = !0;
|
|
789
|
-
const e = this.queue.splice(0, this.batchSize)
|
|
805
|
+
const e = this.queue.splice(0, this.batchSize);
|
|
806
|
+
this.totalQueueBytes = Math.max(
|
|
807
|
+
0,
|
|
808
|
+
this.totalQueueBytes - e.reduce((i, n) => i + (n.bytes || 0), 0)
|
|
809
|
+
);
|
|
810
|
+
const t = e.map((i) => i.payload);
|
|
790
811
|
try {
|
|
791
812
|
await this.transport.send(t), this.logger.debug(
|
|
792
813
|
`Successfully sent batch of ${e.length} payloads`
|
|
@@ -800,23 +821,68 @@ class K {
|
|
|
800
821
|
}
|
|
801
822
|
async handleBatchFailure(e) {
|
|
802
823
|
for (const t of e)
|
|
803
|
-
t.retries < this.maxRetries ? (t.retries++, this.queue.unshift(t), this.logger.warn(`Retry attempt ${t.retries} for payload`)) : this.logger.error(
|
|
824
|
+
t.retries < this.maxRetries ? (t.retries++, this.queue.unshift(t), this.totalQueueBytes += t.bytes || this.estimateItemBytes(t), this.enforceQueueLimits(), this.logger.warn(`Retry attempt ${t.retries} for payload`)) : this.logger.error(
|
|
804
825
|
"Max retries reached, discarding payload",
|
|
805
826
|
t.payload
|
|
806
827
|
);
|
|
807
828
|
h() && (this.saveQueueToStorage(), await new Promise((t) => setTimeout(t, this.retryInterval)));
|
|
808
829
|
}
|
|
830
|
+
enforceQueueLimits() {
|
|
831
|
+
if (this.maxQueueItems > 0 && this.queue.length > this.maxQueueItems) {
|
|
832
|
+
const e = this.queue.length - this.maxQueueItems, t = this.queue.splice(0, e);
|
|
833
|
+
this.totalQueueBytes = Math.max(
|
|
834
|
+
0,
|
|
835
|
+
this.totalQueueBytes - t.reduce((i, n) => i + (n.bytes || 0), 0)
|
|
836
|
+
), this.logger.warn(
|
|
837
|
+
`Retry queue exceeded ${this.maxQueueItems} items; dropped ${t.length} oldest payload(s)`
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
if (this.maxQueueBytes > 0 && this.totalQueueBytes > this.maxQueueBytes && this.queue.length > 0) {
|
|
841
|
+
let e = 0;
|
|
842
|
+
for (; this.totalQueueBytes > this.maxQueueBytes && this.queue.length > 1; ) {
|
|
843
|
+
const t = this.queue.shift();
|
|
844
|
+
t && (this.totalQueueBytes -= t.bytes || this.estimateItemBytes(t), e++);
|
|
845
|
+
}
|
|
846
|
+
this.totalQueueBytes = Math.max(0, this.totalQueueBytes), e > 0 && this.logger.warn(
|
|
847
|
+
`Retry queue exceeded ${this.maxQueueBytes} bytes; dropped ${e} oldest payload(s)`
|
|
848
|
+
);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
estimateItemBytes(e) {
|
|
852
|
+
const t = { ...e };
|
|
853
|
+
delete t.bytes;
|
|
854
|
+
try {
|
|
855
|
+
return JSON.stringify(t).length;
|
|
856
|
+
} catch {
|
|
857
|
+
return 0;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
809
860
|
loadQueueFromStorage() {
|
|
810
861
|
if (h()) {
|
|
811
862
|
const e = this.persistence.get("queue");
|
|
812
|
-
|
|
863
|
+
if (!e) return;
|
|
864
|
+
try {
|
|
865
|
+
const t = JSON.parse(e);
|
|
866
|
+
this.queue = t.map((i) => ({
|
|
867
|
+
...i,
|
|
868
|
+
bytes: i.bytes || this.estimateItemBytes(i)
|
|
869
|
+
})), this.totalQueueBytes = this.queue.reduce(
|
|
870
|
+
(i, n) => i + (n.bytes || 0),
|
|
871
|
+
0
|
|
872
|
+
), this.enforceQueueLimits();
|
|
873
|
+
} catch (t) {
|
|
874
|
+
this.logger.error("Failed to parse stored queue", t), this.queue = [], this.totalQueueBytes = 0;
|
|
875
|
+
}
|
|
813
876
|
}
|
|
814
877
|
}
|
|
815
878
|
saveQueueToStorage() {
|
|
816
|
-
|
|
879
|
+
if (h()) {
|
|
880
|
+
const e = this.queue.map(({ bytes: t, ...i }) => i);
|
|
881
|
+
this.persistence.set("queue", JSON.stringify(e));
|
|
882
|
+
}
|
|
817
883
|
}
|
|
818
884
|
}
|
|
819
|
-
class
|
|
885
|
+
class Ae {
|
|
820
886
|
constructor(e) {
|
|
821
887
|
this.clicks = [], this.threshold = 3, this.timeWindow = 2e3, this.distanceThreshold = 30, this.client = e, this.initializeEventListener(), Y(this);
|
|
822
888
|
}
|
|
@@ -831,8 +897,8 @@ class Se {
|
|
|
831
897
|
return !e.closest(".um-no-capture");
|
|
832
898
|
}
|
|
833
899
|
click(e, t, i) {
|
|
834
|
-
const
|
|
835
|
-
this.clicks.push(
|
|
900
|
+
const n = { x: e, y: t, timestamp: i };
|
|
901
|
+
this.clicks.push(n), this.clicks = this.clicks.filter(
|
|
836
902
|
(r) => i - r.timestamp < this.timeWindow
|
|
837
903
|
), this.clicks.length >= this.threshold && this.checkRageClick();
|
|
838
904
|
}
|
|
@@ -855,11 +921,11 @@ class Se {
|
|
|
855
921
|
}
|
|
856
922
|
}
|
|
857
923
|
class Ce {
|
|
858
|
-
constructor(e, t, i =
|
|
924
|
+
constructor(e, t, i = g()) {
|
|
859
925
|
this.trackingHost = e, this.logger = i, this.config = t;
|
|
860
926
|
}
|
|
861
927
|
async send(e) {
|
|
862
|
-
const t = this.config.key, i = new (void 0)(this.constructUrl(t)),
|
|
928
|
+
const t = this.config.key, i = new (void 0)(this.constructUrl(t)), n = {
|
|
863
929
|
hostname: i.hostname,
|
|
864
930
|
port: 443,
|
|
865
931
|
path: `${i.pathname}${i.search}`,
|
|
@@ -870,7 +936,7 @@ class Ce {
|
|
|
870
936
|
}
|
|
871
937
|
};
|
|
872
938
|
return new Promise((r, o) => {
|
|
873
|
-
const a = (void 0)(
|
|
939
|
+
const a = (void 0)(n, (l) => {
|
|
874
940
|
l.on("data", (c) => {
|
|
875
941
|
}), l.on("end", () => {
|
|
876
942
|
const c = l.statusCode || 0;
|
|
@@ -890,7 +956,7 @@ class Ce {
|
|
|
890
956
|
return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
|
|
891
957
|
}
|
|
892
958
|
}
|
|
893
|
-
class
|
|
959
|
+
class S {
|
|
894
960
|
constructor(e, t = "all", i = {}) {
|
|
895
961
|
this.instance = e, this.trackingType = t, this.options = i, document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", this.initialize.bind(this)) : this.initialize();
|
|
896
962
|
}
|
|
@@ -905,17 +971,17 @@ class A {
|
|
|
905
971
|
}
|
|
906
972
|
handleFormSubmit(e) {
|
|
907
973
|
const t = e.target, i = this._getFormDetails(t);
|
|
908
|
-
this.instance.track("$form",
|
|
974
|
+
this.instance.track("$form", M(i)), this.options.trackFieldChanges && this.trackFieldChanges(t);
|
|
909
975
|
}
|
|
910
976
|
trackFieldChanges(e) {
|
|
911
977
|
e.querySelectorAll("input, select, textarea").forEach((i) => {
|
|
912
|
-
i.addEventListener("change", (
|
|
978
|
+
i.addEventListener("change", (n) => {
|
|
913
979
|
const r = this._getFieldProps(
|
|
914
|
-
|
|
980
|
+
n.target
|
|
915
981
|
);
|
|
916
982
|
this.instance.track(
|
|
917
983
|
"$form_field_change",
|
|
918
|
-
|
|
984
|
+
M({
|
|
919
985
|
form_id: e.id,
|
|
920
986
|
form_name: e.name || "",
|
|
921
987
|
field: r
|
|
@@ -925,7 +991,7 @@ class A {
|
|
|
925
991
|
});
|
|
926
992
|
}
|
|
927
993
|
static getInstance(e, t = "all", i = {}) {
|
|
928
|
-
return
|
|
994
|
+
return S.instance || (S.instance = new S(e, t, i)), S.instance;
|
|
929
995
|
}
|
|
930
996
|
_getFormDetails(e) {
|
|
931
997
|
const t = {
|
|
@@ -973,8 +1039,8 @@ class A {
|
|
|
973
1039
|
getSafeText(e) {
|
|
974
1040
|
let t = "";
|
|
975
1041
|
return "value" in e && e.type !== "password" ? t = e.value : e.hasChildNodes() ? t = Array.from(e.childNodes).filter(
|
|
976
|
-
(
|
|
977
|
-
).map((
|
|
1042
|
+
(n) => n.nodeType === Node.TEXT_NODE
|
|
1043
|
+
).map((n) => n.textContent).join("") : t = e.textContent || "", this._scrubPotentiallySensitiveValues(t);
|
|
978
1044
|
}
|
|
979
1045
|
_scrubPotentiallySensitiveValues(e) {
|
|
980
1046
|
return this._shouldCaptureValue(e) ? e : "<redacted>";
|
|
@@ -992,7 +1058,7 @@ class A {
|
|
|
992
1058
|
if (typeof String.prototype.trim == "function")
|
|
993
1059
|
return e.trim();
|
|
994
1060
|
let t = 0, i = e.length - 1;
|
|
995
|
-
const
|
|
1061
|
+
const n = [
|
|
996
1062
|
" ",
|
|
997
1063
|
`
|
|
998
1064
|
`,
|
|
@@ -1019,16 +1085,16 @@ class A {
|
|
|
1019
1085
|
" ",
|
|
1020
1086
|
" "
|
|
1021
1087
|
].join("");
|
|
1022
|
-
for (; t <= i &&
|
|
1088
|
+
for (; t <= i && n.indexOf(e[t]) > -1; )
|
|
1023
1089
|
t++;
|
|
1024
|
-
for (; i >= t &&
|
|
1090
|
+
for (; i >= t && n.indexOf(e[i]) > -1; )
|
|
1025
1091
|
i--;
|
|
1026
1092
|
return e.slice(t, i + 1);
|
|
1027
1093
|
}
|
|
1028
1094
|
}
|
|
1029
|
-
class
|
|
1095
|
+
class I {
|
|
1030
1096
|
constructor(e) {
|
|
1031
|
-
this.config = this.mergeConfig(e, Z), this.logger =
|
|
1097
|
+
this.config = this.mergeConfig(e, Z), this.logger = g(this.config.logLevel), this.namespace = e.namespace || "default", this.transport = this.initializeTransport(this.config), this.persistence = this.initializePersistence(), this.retryQueue = new K(
|
|
1032
1098
|
this.transport,
|
|
1033
1099
|
this.config.maxSendAttempts || 3,
|
|
1034
1100
|
this.config.minSendTimeout || 1e3,
|
|
@@ -1042,9 +1108,9 @@ class N {
|
|
|
1042
1108
|
);
|
|
1043
1109
|
}
|
|
1044
1110
|
initializeBrowserFeatures() {
|
|
1045
|
-
if (this.cookieManager = new
|
|
1111
|
+
if (this.cookieManager = new ne(this.config.cookieDomain), this.config.autocapture && H.enabledForProject(this.config.key) && !this.config.disableAutocaptureListenerRegistration && (this.autoCapture = new H(this, this.config, this.logger), this.autoCapture.init()), this.config.formTracking) {
|
|
1046
1112
|
const e = this.config.formTracking === !0 ? "all" : this.config.formTracking;
|
|
1047
|
-
this.formTracking =
|
|
1113
|
+
this.formTracking = S.getInstance(
|
|
1048
1114
|
this,
|
|
1049
1115
|
e || "none",
|
|
1050
1116
|
{
|
|
@@ -1052,7 +1118,7 @@ class N {
|
|
|
1052
1118
|
}
|
|
1053
1119
|
);
|
|
1054
1120
|
}
|
|
1055
|
-
this.config.autoPageview && (this.pageviewTracking = new
|
|
1121
|
+
this.config.autoPageview && (this.pageviewTracking = new _e(this)), this.config.crossDomainLinking && this.manageCrossDomainLinking(), this.config.rageClick && (this.rageClick = new Ae(this)), this.setupPageLeaveTracking();
|
|
1056
1122
|
}
|
|
1057
1123
|
/**
|
|
1058
1124
|
* Recursively merge the provided configuration with the existing defaultConfig
|
|
@@ -1061,13 +1127,13 @@ class N {
|
|
|
1061
1127
|
*/
|
|
1062
1128
|
mergeConfig(e, t) {
|
|
1063
1129
|
const i = JSON.parse(JSON.stringify(e));
|
|
1064
|
-
let
|
|
1130
|
+
let n = { ...t, ...i };
|
|
1065
1131
|
return Object.keys(t).forEach((r) => {
|
|
1066
|
-
P(t[r]) && (
|
|
1067
|
-
}),
|
|
1132
|
+
P(t[r]) && (n[r] = this.mergeConfig(e[r], t[r]));
|
|
1133
|
+
}), n;
|
|
1068
1134
|
}
|
|
1069
1135
|
init(e) {
|
|
1070
|
-
this.config = { ...this.config, ...e }, this.logger =
|
|
1136
|
+
this.config = { ...this.config, ...e }, this.logger = g(this.config.logLevel), this.namespace = e.namespace || this.namespace, this.transport = this.initializeTransport(e), this.persistence = this.initializePersistence(), this.retryQueue = new K(
|
|
1071
1137
|
this.transport,
|
|
1072
1138
|
this.config.maxSendAttempts || 3,
|
|
1073
1139
|
this.config.minSendTimeout || 1e3,
|
|
@@ -1086,14 +1152,14 @@ class N {
|
|
|
1086
1152
|
const e = this.config.domains.split(",").map((i) => i.trim()), t = this.config.cookieName || `__eventn_id_${this.config.key}`;
|
|
1087
1153
|
document.addEventListener("click", (i) => {
|
|
1088
1154
|
var a;
|
|
1089
|
-
const
|
|
1090
|
-
if (!
|
|
1091
|
-
const r =
|
|
1155
|
+
const n = this.findClosestLink(i.target);
|
|
1156
|
+
if (!n) return;
|
|
1157
|
+
const r = n.getAttribute("href");
|
|
1092
1158
|
if (!r || !r.startsWith("http")) return;
|
|
1093
1159
|
const o = new URL(r);
|
|
1094
1160
|
if (o.hostname !== window.location.hostname && e.includes(o.hostname)) {
|
|
1095
1161
|
const l = (a = this.cookieManager) == null ? void 0 : a.get(t);
|
|
1096
|
-
l && (o.searchParams.append("_um", l),
|
|
1162
|
+
l && (o.searchParams.append("_um", l), n.setAttribute("href", o.toString()));
|
|
1097
1163
|
}
|
|
1098
1164
|
}), this.logger.debug("Cross-domain linking initialized");
|
|
1099
1165
|
}
|
|
@@ -1106,14 +1172,14 @@ class N {
|
|
|
1106
1172
|
const t = "https://events.usermaven.com";
|
|
1107
1173
|
if (!h())
|
|
1108
1174
|
return new Ce(e.trackingHost || t, e);
|
|
1109
|
-
const i = "XMLHttpRequest" in window,
|
|
1175
|
+
const i = "XMLHttpRequest" in window, n = typeof fetch < "u", r = typeof navigator < "u" && "sendBeacon" in navigator;
|
|
1110
1176
|
if (e.useBeaconApi && r)
|
|
1111
1177
|
return new Ee(
|
|
1112
1178
|
e.trackingHost || t,
|
|
1113
1179
|
e,
|
|
1114
1180
|
this.logger
|
|
1115
1181
|
);
|
|
1116
|
-
if (e.forceUseFetch &&
|
|
1182
|
+
if (e.forceUseFetch && n)
|
|
1117
1183
|
return new W(
|
|
1118
1184
|
e.trackingHost || t,
|
|
1119
1185
|
e,
|
|
@@ -1125,7 +1191,7 @@ class N {
|
|
|
1125
1191
|
e,
|
|
1126
1192
|
this.logger
|
|
1127
1193
|
);
|
|
1128
|
-
if (
|
|
1194
|
+
if (n)
|
|
1129
1195
|
return new W(
|
|
1130
1196
|
e.trackingHost || t,
|
|
1131
1197
|
e,
|
|
@@ -1134,13 +1200,13 @@ class N {
|
|
|
1134
1200
|
throw new Error("No suitable transport method available");
|
|
1135
1201
|
}
|
|
1136
1202
|
initializePersistence() {
|
|
1137
|
-
return this.config.disableEventPersistence || !h() ? new
|
|
1203
|
+
return this.config.disableEventPersistence || !h() ? new Se() : new te(
|
|
1138
1204
|
`${this.namespace}_${this.config.key}`,
|
|
1139
1205
|
this.logger
|
|
1140
1206
|
);
|
|
1141
1207
|
}
|
|
1142
1208
|
getOrCreateAnonymousId() {
|
|
1143
|
-
var i,
|
|
1209
|
+
var i, n;
|
|
1144
1210
|
if (!h())
|
|
1145
1211
|
return R();
|
|
1146
1212
|
if (this.config.privacyPolicy === "strict" || this.config.cookiePolicy === "strict")
|
|
@@ -1154,7 +1220,7 @@ class N {
|
|
|
1154
1220
|
}
|
|
1155
1221
|
t || (t = R());
|
|
1156
1222
|
const r = 365 * 10;
|
|
1157
|
-
(
|
|
1223
|
+
(n = this.cookieManager) == null || n.set(
|
|
1158
1224
|
e,
|
|
1159
1225
|
t,
|
|
1160
1226
|
r,
|
|
@@ -1173,11 +1239,11 @@ class N {
|
|
|
1173
1239
|
throw new Error("User ID must be a string");
|
|
1174
1240
|
const i = e.id;
|
|
1175
1241
|
if (this.persistence.set("userId", i), this.persistence.set("userProps", e), !t) {
|
|
1176
|
-
const
|
|
1242
|
+
const n = {
|
|
1177
1243
|
...e,
|
|
1178
1244
|
anonymous_id: this.anonymousId
|
|
1179
1245
|
};
|
|
1180
|
-
await this.track("user_identify",
|
|
1246
|
+
await this.track("user_identify", n);
|
|
1181
1247
|
}
|
|
1182
1248
|
this.logger.info("User identified:", e);
|
|
1183
1249
|
}
|
|
@@ -1194,12 +1260,12 @@ class N {
|
|
|
1194
1260
|
this.logger.error("Lead event requires a valid email attribute");
|
|
1195
1261
|
return;
|
|
1196
1262
|
}
|
|
1197
|
-
const
|
|
1198
|
-
if (!
|
|
1263
|
+
const n = i.trim();
|
|
1264
|
+
if (!n || !J(n)) {
|
|
1199
1265
|
this.logger.error("Lead event requires a valid email attribute");
|
|
1200
1266
|
return;
|
|
1201
1267
|
}
|
|
1202
|
-
e.email =
|
|
1268
|
+
e.email = n, this.track("lead", e, t);
|
|
1203
1269
|
}
|
|
1204
1270
|
trackInternal(e, t, i = !1) {
|
|
1205
1271
|
if (ve()) {
|
|
@@ -1238,7 +1304,7 @@ class N {
|
|
|
1238
1304
|
this.persistence.set("companyProps", e), t || await this.track("group", e), this.logger.info("Company identified:", e);
|
|
1239
1305
|
}
|
|
1240
1306
|
createEventPayload(e, t) {
|
|
1241
|
-
const i = this.persistence.get("userProps") || {},
|
|
1307
|
+
const i = this.persistence.get("userProps") || {}, n = this.persistence.get("companyProps") || (i == null ? void 0 : i.company) || {}, r = this.persistence.get("userId"), o = this.persistence.get("global_props") || {}, a = this.persistence.get(`props_${e}`) || {};
|
|
1242
1308
|
let l = t || {};
|
|
1243
1309
|
const c = {
|
|
1244
1310
|
event_id: "",
|
|
@@ -1247,7 +1313,7 @@ class N {
|
|
|
1247
1313
|
id: r,
|
|
1248
1314
|
...i
|
|
1249
1315
|
},
|
|
1250
|
-
...
|
|
1316
|
+
...n && { company: n },
|
|
1251
1317
|
ids: this.getThirdPartyIds(),
|
|
1252
1318
|
utc_time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1253
1319
|
local_tz_offset: (/* @__PURE__ */ new Date()).getTimezoneOffset(),
|
|
@@ -1279,8 +1345,8 @@ class N {
|
|
|
1279
1345
|
"$referrer",
|
|
1280
1346
|
"$referring_domain",
|
|
1281
1347
|
"$elements"
|
|
1282
|
-
].forEach((
|
|
1283
|
-
delete t[
|
|
1348
|
+
].forEach((n) => {
|
|
1349
|
+
delete t[n];
|
|
1284
1350
|
}), delete t.$el_text, delete t.nth_child, delete t.nth_of_type, t;
|
|
1285
1351
|
}
|
|
1286
1352
|
getCookie(e) {
|
|
@@ -1303,8 +1369,8 @@ class N {
|
|
|
1303
1369
|
"utm_campaign",
|
|
1304
1370
|
"utm_term",
|
|
1305
1371
|
"utm_content"
|
|
1306
|
-
].forEach((
|
|
1307
|
-
t[
|
|
1372
|
+
].forEach((n) => {
|
|
1373
|
+
t[n] && (e[n.replace("utm_", "")] = t[n]);
|
|
1308
1374
|
}), e;
|
|
1309
1375
|
}
|
|
1310
1376
|
pageview() {
|
|
@@ -1337,9 +1403,9 @@ class N {
|
|
|
1337
1403
|
}), document.addEventListener("visibilitychange", () => {
|
|
1338
1404
|
document.visibilityState === "hidden" && !t && i();
|
|
1339
1405
|
});
|
|
1340
|
-
const
|
|
1406
|
+
const n = history.pushState;
|
|
1341
1407
|
history.pushState = function() {
|
|
1342
|
-
return i(),
|
|
1408
|
+
return i(), n.apply(this, arguments);
|
|
1343
1409
|
}, window.addEventListener("popstate", i);
|
|
1344
1410
|
}
|
|
1345
1411
|
getConfig() {
|
|
@@ -1361,7 +1427,7 @@ class N {
|
|
|
1361
1427
|
set(e, t) {
|
|
1362
1428
|
if (!P(e))
|
|
1363
1429
|
throw new Error("Properties must be an object");
|
|
1364
|
-
const i = t == null ? void 0 : t.eventType,
|
|
1430
|
+
const i = t == null ? void 0 : t.eventType, n = (t == null ? void 0 : t.persist) ?? !0;
|
|
1365
1431
|
if (i) {
|
|
1366
1432
|
let r = this.persistence.get(`props_${i}`) || {};
|
|
1367
1433
|
r = { ...r, ...e }, this.persistence.set(`props_${i}`, r);
|
|
@@ -1369,10 +1435,10 @@ class N {
|
|
|
1369
1435
|
let r = this.persistence.get("global_props") || {};
|
|
1370
1436
|
r = { ...r, ...e }, this.persistence.set("global_props", r);
|
|
1371
1437
|
}
|
|
1372
|
-
|
|
1438
|
+
n && this.persistence.save(), this.logger.debug("Properties set", {
|
|
1373
1439
|
properties: e,
|
|
1374
1440
|
eventType: i || "global",
|
|
1375
|
-
persist:
|
|
1441
|
+
persist: n
|
|
1376
1442
|
});
|
|
1377
1443
|
}
|
|
1378
1444
|
setUserId(e) {
|
|
@@ -1381,7 +1447,7 @@ class N {
|
|
|
1381
1447
|
t.id = e, this.persistence.set("userProps", t), this.persistence.save();
|
|
1382
1448
|
}
|
|
1383
1449
|
unset(e, t) {
|
|
1384
|
-
const i = t == null ? void 0 : t.eventType,
|
|
1450
|
+
const i = t == null ? void 0 : t.eventType, n = (t == null ? void 0 : t.persist) ?? !0;
|
|
1385
1451
|
if (i) {
|
|
1386
1452
|
let r = this.persistence.get(`props_${i}`) || {};
|
|
1387
1453
|
delete r[e], this.persistence.set(`props_${i}`, r);
|
|
@@ -1389,7 +1455,7 @@ class N {
|
|
|
1389
1455
|
let r = this.persistence.get("global_props") || {};
|
|
1390
1456
|
delete r[e], this.persistence.set("global_props", r);
|
|
1391
1457
|
}
|
|
1392
|
-
|
|
1458
|
+
n && this.persistence.save(), this.logger.debug(
|
|
1393
1459
|
`Property unset: ${e}`,
|
|
1394
1460
|
`Event type: ${i || "global"}`
|
|
1395
1461
|
);
|
|
@@ -1398,12 +1464,12 @@ class N {
|
|
|
1398
1464
|
function ie() {
|
|
1399
1465
|
return typeof window < "u" && typeof window.define == "function" && window.define.amd;
|
|
1400
1466
|
}
|
|
1401
|
-
function
|
|
1467
|
+
function $e() {
|
|
1402
1468
|
return ie() ? window.define : void 0;
|
|
1403
1469
|
}
|
|
1404
|
-
const
|
|
1405
|
-
function O(
|
|
1406
|
-
const e = JSON.parse(JSON.stringify(
|
|
1470
|
+
const Te = "__USERMAVEN_AUTOCAPTURE_INITIALIZED__";
|
|
1471
|
+
function O(s) {
|
|
1472
|
+
const e = JSON.parse(JSON.stringify(s)), t = F(e), i = {
|
|
1407
1473
|
...Z,
|
|
1408
1474
|
...t
|
|
1409
1475
|
};
|
|
@@ -1411,64 +1477,64 @@ function O(n) {
|
|
|
1411
1477
|
throw new Error("API key is required!");
|
|
1412
1478
|
if (!i.trackingHost)
|
|
1413
1479
|
throw new Error("Tracking host is required!");
|
|
1414
|
-
const
|
|
1480
|
+
const n = i.key || "", r = `${Te}${n}`;
|
|
1415
1481
|
return h() && i.autocapture && window[r] && (console.warn(
|
|
1416
1482
|
"Usermaven: Autocapture already initialized in another instance, skipping duplicate initialization."
|
|
1417
|
-
), i.disableAutocaptureListenerRegistration = !0), h() && i.autocapture && !i.disableAutocaptureListenerRegistration && (window[r] = !0), new
|
|
1483
|
+
), i.disableAutocaptureListenerRegistration = !0), h() && i.autocapture && !i.disableAutocaptureListenerRegistration && (window[r] = !0), new I(i);
|
|
1418
1484
|
}
|
|
1419
|
-
function xe(
|
|
1420
|
-
var
|
|
1485
|
+
function xe(s) {
|
|
1486
|
+
var n;
|
|
1421
1487
|
const e = {
|
|
1422
|
-
key:
|
|
1423
|
-
trackingHost:
|
|
1424
|
-
logLevel: ke(
|
|
1425
|
-
autocapture:
|
|
1426
|
-
formTracking:
|
|
1427
|
-
autoPageview:
|
|
1428
|
-
useBeaconApi:
|
|
1429
|
-
forceUseFetch:
|
|
1430
|
-
gaHook:
|
|
1431
|
-
segmentHook:
|
|
1432
|
-
randomizeUrl:
|
|
1433
|
-
capture3rdPartyCookies:
|
|
1434
|
-
idMethod:
|
|
1435
|
-
privacyPolicy:
|
|
1436
|
-
ipPolicy:
|
|
1437
|
-
cookiePolicy:
|
|
1438
|
-
minSendTimeout: parseInt(
|
|
1439
|
-
maxSendTimeout: parseInt(
|
|
1440
|
-
maxSendAttempts: parseInt(
|
|
1488
|
+
key: s.getAttribute("data-key") || void 0,
|
|
1489
|
+
trackingHost: s.getAttribute("data-tracking-host") || "https://events.usermaven.com",
|
|
1490
|
+
logLevel: ke(s.getAttribute("data-log-level")),
|
|
1491
|
+
autocapture: s.getAttribute("data-autocapture") === "true",
|
|
1492
|
+
formTracking: s.getAttribute("data-form-tracking") === "false" ? !1 : s.getAttribute("data-form-tracking") === "true" ? "all" : s.getAttribute("data-form-tracking"),
|
|
1493
|
+
autoPageview: s.getAttribute("data-auto-pageview") === "true",
|
|
1494
|
+
useBeaconApi: s.getAttribute("data-use-beacon-api") === "true",
|
|
1495
|
+
forceUseFetch: s.getAttribute("data-force-use-fetch") === "true",
|
|
1496
|
+
gaHook: s.getAttribute("data-ga-hook") === "true",
|
|
1497
|
+
segmentHook: s.getAttribute("data-segment-hook") === "true",
|
|
1498
|
+
randomizeUrl: s.getAttribute("data-randomize-url") === "true",
|
|
1499
|
+
capture3rdPartyCookies: s.getAttribute("data-capture-3rd-party-cookies") === "false" ? !1 : void 0,
|
|
1500
|
+
idMethod: s.getAttribute("data-id-method") || void 0,
|
|
1501
|
+
privacyPolicy: s.getAttribute("data-privacy-policy") === "strict" ? "strict" : void 0,
|
|
1502
|
+
ipPolicy: s.getAttribute("data-ip-policy") || void 0,
|
|
1503
|
+
cookiePolicy: s.getAttribute("data-cookie-policy") || void 0,
|
|
1504
|
+
minSendTimeout: parseInt(s.getAttribute("data-min-send-timeout") || "", 10) || void 0,
|
|
1505
|
+
maxSendTimeout: parseInt(s.getAttribute("data-max-send-timeout") || "", 10) || void 0,
|
|
1506
|
+
maxSendAttempts: parseInt(s.getAttribute("data-max-send-attempts") || "", 10) || void 0,
|
|
1441
1507
|
propertiesStringMaxLength: parseInt(
|
|
1442
|
-
|
|
1508
|
+
s.getAttribute("data-properties-string-max-length") || "",
|
|
1443
1509
|
10
|
|
1444
1510
|
) || null,
|
|
1445
|
-
propertyBlacklist: ((
|
|
1446
|
-
exclude:
|
|
1447
|
-
namespace:
|
|
1448
|
-
crossDomainLinking:
|
|
1449
|
-
domains:
|
|
1450
|
-
maskAllText:
|
|
1451
|
-
maskAllElementAttributes:
|
|
1511
|
+
propertyBlacklist: ((n = s.getAttribute("data-property-blacklist")) == null ? void 0 : n.split(",")) || void 0,
|
|
1512
|
+
exclude: s.getAttribute("data-exclude") || void 0,
|
|
1513
|
+
namespace: s.getAttribute("data-namespace") || void 0,
|
|
1514
|
+
crossDomainLinking: s.getAttribute("data-cross-domain-linking") !== "false",
|
|
1515
|
+
domains: s.getAttribute("data-domains") || void 0,
|
|
1516
|
+
maskAllText: s.getAttribute("data-mask-all-text") === "true",
|
|
1517
|
+
maskAllElementAttributes: s.getAttribute("data-mask-all-element-attributes") === "true"
|
|
1452
1518
|
};
|
|
1453
1519
|
e.privacyPolicy === "strict" && (e.cookiePolicy = "strict", e.ipPolicy = "strict"), e.cookiePolicy === "comply" && e.useBeaconApi && (e.cookiePolicy = "strict");
|
|
1454
1520
|
const t = O(e), i = e.namespace || "usermaven";
|
|
1455
1521
|
return h() && t.pageview(), He(i, t), t;
|
|
1456
1522
|
}
|
|
1457
|
-
function He(
|
|
1523
|
+
function He(s, e) {
|
|
1458
1524
|
let t = !1;
|
|
1459
|
-
const i = [],
|
|
1525
|
+
const i = [], n = [];
|
|
1460
1526
|
function r() {
|
|
1461
1527
|
for (; i.length > 0; ) {
|
|
1462
1528
|
const u = i.shift();
|
|
1463
1529
|
if (u) {
|
|
1464
|
-
const
|
|
1465
|
-
if (
|
|
1530
|
+
const f = u[u.length - 1];
|
|
1531
|
+
if (f && typeof f.resolve == "function") {
|
|
1466
1532
|
const m = u.pop();
|
|
1467
1533
|
try {
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1470
|
-
} catch (
|
|
1471
|
-
m.reject(
|
|
1534
|
+
const _ = a.apply(null, u);
|
|
1535
|
+
_ && typeof _.then == "function" ? _.then(m.resolve).catch(m.reject) : m.resolve(_);
|
|
1536
|
+
} catch (_) {
|
|
1537
|
+
m.reject(_);
|
|
1472
1538
|
}
|
|
1473
1539
|
} else
|
|
1474
1540
|
try {
|
|
@@ -1480,21 +1546,21 @@ function He(n, e) {
|
|
|
1480
1546
|
}
|
|
1481
1547
|
}
|
|
1482
1548
|
function o() {
|
|
1483
|
-
|
|
1549
|
+
n.forEach((u) => u()), n.length = 0;
|
|
1484
1550
|
}
|
|
1485
1551
|
function a(...u) {
|
|
1486
|
-
const
|
|
1487
|
-
if (
|
|
1488
|
-
typeof u[1] == "function" && (t ? u[1]() :
|
|
1552
|
+
const f = u[0];
|
|
1553
|
+
if (f === "onLoad") {
|
|
1554
|
+
typeof u[1] == "function" && (t ? u[1]() : n.push(u[1]));
|
|
1489
1555
|
return;
|
|
1490
1556
|
}
|
|
1491
1557
|
if (!t) {
|
|
1492
1558
|
i.push(u);
|
|
1493
1559
|
return;
|
|
1494
1560
|
}
|
|
1495
|
-
if (typeof e[
|
|
1496
|
-
return e[
|
|
1497
|
-
console.error(`Method ${
|
|
1561
|
+
if (typeof e[f] == "function")
|
|
1562
|
+
return e[f].apply(e, u.slice(1));
|
|
1563
|
+
console.error(`Method ${f} not found on UsermavenClient`);
|
|
1498
1564
|
}
|
|
1499
1565
|
const l = ["id", "group", "reset"], c = [
|
|
1500
1566
|
"track",
|
|
@@ -1506,56 +1572,56 @@ function He(n, e) {
|
|
|
1506
1572
|
"setUserId"
|
|
1507
1573
|
];
|
|
1508
1574
|
[...l, ...c].forEach((u) => {
|
|
1509
|
-
a[u] = function(...
|
|
1575
|
+
a[u] = function(...f) {
|
|
1510
1576
|
if (!t) {
|
|
1511
1577
|
if (l.includes(u))
|
|
1512
|
-
return new Promise((
|
|
1513
|
-
i.push([u, ...
|
|
1578
|
+
return new Promise((z, m) => {
|
|
1579
|
+
i.push([u, ...f, { resolve: z, reject: m }]);
|
|
1514
1580
|
});
|
|
1515
|
-
i.push([u, ...
|
|
1581
|
+
i.push([u, ...f]);
|
|
1516
1582
|
return;
|
|
1517
1583
|
}
|
|
1518
1584
|
if (typeof e[u] == "function")
|
|
1519
|
-
return e[u].apply(e,
|
|
1585
|
+
return e[u].apply(e, f);
|
|
1520
1586
|
};
|
|
1521
1587
|
}), a.getConfig = function() {
|
|
1522
1588
|
return t ? e.getConfig() : (console.warn("Usermaven client not ready yet"), null);
|
|
1523
|
-
}, window[
|
|
1524
|
-
const p = `${
|
|
1525
|
-
for (window[p] =
|
|
1589
|
+
}, window[s] = a;
|
|
1590
|
+
const p = `${s}Q`, b = window[p] || [];
|
|
1591
|
+
for (window[p] = b, b.push = function(...u) {
|
|
1526
1592
|
return a.apply(null, u), Array.prototype.push.apply(this, u);
|
|
1527
1593
|
}, setTimeout(() => {
|
|
1528
|
-
t = !0, r(), o(), console.log(`Usermaven client for namespace ${
|
|
1529
|
-
}, 0);
|
|
1530
|
-
const u =
|
|
1594
|
+
t = !0, r(), o(), console.log(`Usermaven client for namespace ${s} is ready`);
|
|
1595
|
+
}, 0); b.length > 0; ) {
|
|
1596
|
+
const u = b.shift();
|
|
1531
1597
|
u && i.push(u);
|
|
1532
1598
|
}
|
|
1533
1599
|
}
|
|
1534
|
-
let X = !1,
|
|
1600
|
+
let X = !1, D = null;
|
|
1535
1601
|
if (h()) {
|
|
1536
|
-
const
|
|
1537
|
-
|
|
1602
|
+
const s = $e();
|
|
1603
|
+
s && s("usermaven", [], function() {
|
|
1538
1604
|
return {
|
|
1539
1605
|
usermavenClient: O,
|
|
1540
|
-
UsermavenClient:
|
|
1606
|
+
UsermavenClient: I,
|
|
1541
1607
|
LogLevel: k,
|
|
1542
1608
|
// Expose the script tag client if it exists
|
|
1543
|
-
getScriptTagClient: () =>
|
|
1609
|
+
getScriptTagClient: () => D
|
|
1544
1610
|
};
|
|
1545
|
-
}), typeof window < "u" && (window.usermavenClient = O, window.UsermavenClient =
|
|
1611
|
+
}), typeof window < "u" && (window.usermavenClient = O, window.UsermavenClient = I, window.usermavenScriptTagClient = () => D), function(e, t) {
|
|
1546
1612
|
const i = e.currentScript;
|
|
1547
|
-
function
|
|
1613
|
+
function n() {
|
|
1548
1614
|
return X || !i || !i.hasAttribute("data-key") || i.getAttribute("data-no-auto-init") === "true" ? !1 : i.src.includes("lib.js");
|
|
1549
1615
|
}
|
|
1550
1616
|
function r() {
|
|
1551
|
-
|
|
1617
|
+
n() && (console.log("[Usermaven] Auto-initializing from script tag"), D = xe(i), X = !0);
|
|
1552
1618
|
}
|
|
1553
1619
|
typeof t < "u" && i && (e.readyState === "loading" ? e.addEventListener("DOMContentLoaded", r) : r());
|
|
1554
1620
|
}(document, window);
|
|
1555
1621
|
}
|
|
1556
1622
|
typeof module < "u" && module.exports && !ie() && (module.exports = {
|
|
1557
1623
|
usermavenClient: O,
|
|
1558
|
-
UsermavenClient:
|
|
1624
|
+
UsermavenClient: I,
|
|
1559
1625
|
Config: void 0,
|
|
1560
1626
|
UserProps: void 0,
|
|
1561
1627
|
EventPayload: void 0,
|