@usermaven/nextjs 1.5.10-rc.111 → 1.5.10-rc.116
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 +548 -445
- 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
|
|
12
|
-
class
|
|
11
|
+
var _ = /* @__PURE__ */ ((s) => (s[s.DEBUG = 0] = "DEBUG", s[s.INFO = 1] = "INFO", s[s.WARN = 2] = "WARN", s[s.ERROR = 3] = "ERROR", s))(_ || {});
|
|
12
|
+
class se {
|
|
13
13
|
constructor(e) {
|
|
14
14
|
this.level = e;
|
|
15
15
|
}
|
|
@@ -26,11 +26,11 @@ class ne {
|
|
|
26
26
|
this.level <= 3 && console.error("[Usermaven Error]:", e, ...t);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return new
|
|
29
|
+
function p(s = 0) {
|
|
30
|
+
return new se(s);
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
logLevel:
|
|
32
|
+
const Y = {
|
|
33
|
+
logLevel: _.ERROR,
|
|
34
34
|
useBeaconApi: !1,
|
|
35
35
|
forceUseFetch: !1,
|
|
36
36
|
trackingHost: "t.usermaven.com",
|
|
@@ -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()}`,
|
|
72
|
-
document.cookie = `${e}=${t};${a};path=/;domain=${this.cookieDomain}${
|
|
71
|
+
const a = `expires=${o.toUTCString()}`, c = n ? "; Secure" : "", h = r ? "; HttpOnly" : "";
|
|
72
|
+
document.cookie = `${e}=${t};${a};path=/;domain=${this.cookieDomain}${c}${h}`;
|
|
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,84 +102,84 @@ 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, I = ae.forEach, F = {};
|
|
114
|
+
function ce(s, e, t) {
|
|
115
|
+
if (Array.isArray(s)) {
|
|
116
|
+
if (I && s.forEach === I)
|
|
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) === F)
|
|
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 v = 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
|
|
132
|
-
if (
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
else if ("length" in
|
|
136
|
-
for (let i = 0,
|
|
137
|
-
if (i in
|
|
131
|
+
function k(s, e, t) {
|
|
132
|
+
if (s != null) {
|
|
133
|
+
if (I && Array.isArray(s) && s.forEach === I)
|
|
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) === F)
|
|
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) === F)
|
|
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 $(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
|
|
162
|
-
},
|
|
163
|
-
const
|
|
160
|
+
}, de = function(s) {
|
|
161
|
+
return s === void 0;
|
|
162
|
+
}, A = function() {
|
|
163
|
+
const s = function(i, n, r, o, a) {
|
|
164
164
|
if (!i) {
|
|
165
|
-
|
|
165
|
+
p().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
|
|
172
|
-
i[
|
|
171
|
+
const c = "on" + n, h = i[c];
|
|
172
|
+
i[c] = e(i, r, h);
|
|
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
|
-
let a = !0,
|
|
180
|
-
he(r) && (
|
|
181
|
-
const
|
|
182
|
-
return (
|
|
179
|
+
let a = !0, c;
|
|
180
|
+
he(r) && (c = r(o));
|
|
181
|
+
const h = n.call(i, o);
|
|
182
|
+
return (c === !1 || h === !1) && (a = !1), a;
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
185
|
function t(i) {
|
|
@@ -189,82 +189,82 @@ const he = function(n) {
|
|
|
189
189
|
this.returnValue = !1;
|
|
190
190
|
}, t.stopPropagation = function() {
|
|
191
191
|
this.cancelBubble = !0;
|
|
192
|
-
},
|
|
193
|
-
}(), fe = function(
|
|
192
|
+
}, s;
|
|
193
|
+
}(), fe = function(s) {
|
|
194
194
|
return function(...e) {
|
|
195
195
|
try {
|
|
196
|
-
return
|
|
196
|
+
return s.apply(this, e);
|
|
197
197
|
} catch (t) {
|
|
198
|
-
|
|
198
|
+
p().error(
|
|
199
199
|
"Implementation error. Please turn on debug and contact support@usermaven.com.",
|
|
200
200
|
t
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
|
-
},
|
|
205
|
-
for (const e in
|
|
206
|
-
typeof
|
|
204
|
+
}, G = function(s) {
|
|
205
|
+
for (const e in s)
|
|
206
|
+
typeof s[e] == "function" && (s[e] = fe(s[e]));
|
|
207
207
|
};
|
|
208
|
-
function V(
|
|
209
|
-
for (let e in
|
|
210
|
-
(
|
|
211
|
-
return
|
|
208
|
+
function V(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
|
-
function
|
|
213
|
+
function d() {
|
|
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 p().warn("window is not available"), !1;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
function
|
|
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 E(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 ge(
|
|
225
|
-
return
|
|
224
|
+
function ge(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 Q(s) {
|
|
231
|
+
return typeof s != "object" || s === null ? s : Array.isArray(s) ? s.map(Q) : Object.keys(s).reduce(
|
|
232
232
|
(e, t) => {
|
|
233
233
|
const i = ge(t);
|
|
234
|
-
return e[i] =
|
|
234
|
+
return e[i] = Q(s[t]), e;
|
|
235
235
|
},
|
|
236
236
|
{}
|
|
237
237
|
);
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
switch (typeof
|
|
239
|
+
function O(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 J(s) {
|
|
250
250
|
let e = "";
|
|
251
|
-
return
|
|
252
|
-
j(t) && t.textContent && (e +=
|
|
253
|
-
}),
|
|
251
|
+
return z(s) && !ee(s) && s.childNodes && s.childNodes.length && k(s.childNodes, function(t) {
|
|
252
|
+
j(t) && t.textContent && (e += v(t.textContent).split(/(\s+)/).filter(H).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255));
|
|
253
|
+
}), v(e);
|
|
254
254
|
}
|
|
255
|
-
function
|
|
256
|
-
return !!
|
|
255
|
+
function b(s) {
|
|
256
|
+
return !!s && s.nodeType === 1;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
259
|
-
return !!
|
|
258
|
+
function w(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
|
-
const
|
|
267
|
+
const T = [
|
|
268
268
|
"a",
|
|
269
269
|
"button",
|
|
270
270
|
"form",
|
|
@@ -273,35 +273,37 @@ const C = [
|
|
|
273
273
|
"textarea",
|
|
274
274
|
"label"
|
|
275
275
|
];
|
|
276
|
-
function pe(
|
|
277
|
-
|
|
276
|
+
function pe(s, e) {
|
|
277
|
+
var o, a;
|
|
278
|
+
if (!s || w(s, "html") || !b(s))
|
|
278
279
|
return !1;
|
|
279
|
-
let t =
|
|
280
|
-
for (; t && !
|
|
280
|
+
let t = s;
|
|
281
|
+
for (; t && !w(t, "body"); ) {
|
|
281
282
|
if (t.classList && t.classList.contains("um-no-capture"))
|
|
282
283
|
return !1;
|
|
283
|
-
t.parentNode &&
|
|
284
|
+
t.parentNode && q(t.parentNode) ? t = t.parentNode.host : t = t.parentNode;
|
|
284
285
|
}
|
|
285
286
|
let i = !1;
|
|
286
|
-
for (t =
|
|
287
|
-
if (t.parentNode &&
|
|
288
|
-
t = t.parentNode.host, t &&
|
|
287
|
+
for (t = s; t && !w(t, "body"); ) {
|
|
288
|
+
if (t.parentNode && q(t.parentNode)) {
|
|
289
|
+
t = t.parentNode.host, t && b(t) && T.indexOf(t.tagName.toLowerCase()) > -1 && (i = !0);
|
|
289
290
|
continue;
|
|
290
291
|
}
|
|
291
|
-
const
|
|
292
|
-
if (!
|
|
293
|
-
if (
|
|
292
|
+
const c = t.parentNode;
|
|
293
|
+
if (!c || !b(c)) break;
|
|
294
|
+
if (T.indexOf(c.tagName.toLowerCase()) > -1)
|
|
294
295
|
i = !0;
|
|
295
296
|
else {
|
|
296
|
-
const
|
|
297
|
-
|
|
297
|
+
const h = window.getComputedStyle(c);
|
|
298
|
+
h && h.getPropertyValue("cursor") === "pointer" && (i = !0);
|
|
298
299
|
}
|
|
299
|
-
t =
|
|
300
|
+
t = c;
|
|
300
301
|
}
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
302
|
+
const n = window.getComputedStyle(s);
|
|
303
|
+
if (n && n.getPropertyValue("cursor") === "pointer" && e.type === "click")
|
|
303
304
|
return !0;
|
|
304
|
-
const r =
|
|
305
|
+
const r = (a = (o = s.tagName) == null ? void 0 : o.toLowerCase) == null ? void 0 : a.call(o);
|
|
306
|
+
if (!r) return !1;
|
|
305
307
|
switch (r) {
|
|
306
308
|
case "html":
|
|
307
309
|
return !1;
|
|
@@ -313,18 +315,18 @@ function pe(n, e) {
|
|
|
313
315
|
case "textarea":
|
|
314
316
|
return e.type === "change" || e.type === "click";
|
|
315
317
|
default:
|
|
316
|
-
return i ? e.type === "click" : e.type === "click" && (
|
|
318
|
+
return i ? e.type === "click" : e.type === "click" && (T.indexOf(r) > -1 || s.getAttribute("contenteditable") === "true");
|
|
317
319
|
}
|
|
318
320
|
}
|
|
319
|
-
function
|
|
320
|
-
for (let i =
|
|
321
|
-
const
|
|
322
|
-
if (
|
|
321
|
+
function z(s) {
|
|
322
|
+
for (let i = s; i.parentNode && !w(i, "body"); i = i.parentNode) {
|
|
323
|
+
const n = O(i).split(" ");
|
|
324
|
+
if ($(n, "ph-sensitive") || $(n, "ph-no-capture"))
|
|
323
325
|
return !1;
|
|
324
326
|
}
|
|
325
|
-
if (
|
|
327
|
+
if ($(O(s).split(" "), "ph-include"))
|
|
326
328
|
return !0;
|
|
327
|
-
const e =
|
|
329
|
+
const e = s.type || "";
|
|
328
330
|
if (typeof e == "string")
|
|
329
331
|
switch (e.toLowerCase()) {
|
|
330
332
|
case "hidden":
|
|
@@ -332,61 +334,89 @@ function B(n) {
|
|
|
332
334
|
case "password":
|
|
333
335
|
return !1;
|
|
334
336
|
}
|
|
335
|
-
const t =
|
|
337
|
+
const t = s.name || s.id || "";
|
|
336
338
|
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
339
|
}
|
|
338
|
-
function ee(
|
|
340
|
+
function ee(s) {
|
|
339
341
|
const e = ["button", "checkbox", "submit", "reset"];
|
|
340
|
-
return !!(
|
|
342
|
+
return !!(w(s, "input") && !e.includes(s.type) || w(s, "select") || w(s, "textarea") || s.getAttribute("contenteditable") === "true");
|
|
341
343
|
}
|
|
342
|
-
function
|
|
343
|
-
return !(
|
|
344
|
+
function H(s) {
|
|
345
|
+
return !(s === null || de(s) || typeof s == "string" && (s = v(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
346
|
}
|
|
345
|
-
function me(
|
|
346
|
-
return typeof
|
|
347
|
+
function me(s) {
|
|
348
|
+
return typeof s == "string" ? s.substring(0, 10) === "_ngcontent" || s.substring(0, 7) === "_nghost" : !1;
|
|
349
|
+
}
|
|
350
|
+
function ye(s) {
|
|
351
|
+
if (!s)
|
|
352
|
+
return !1;
|
|
353
|
+
const e = s.$el_text;
|
|
354
|
+
if (typeof e == "string" && v(e).length > 0)
|
|
355
|
+
return !0;
|
|
356
|
+
const t = s.classes;
|
|
357
|
+
if (Array.isArray(t) && t.some((n) => v(n).length > 0))
|
|
358
|
+
return !0;
|
|
359
|
+
const i = [
|
|
360
|
+
"attr__id",
|
|
361
|
+
"attr__name",
|
|
362
|
+
"attr__class",
|
|
363
|
+
"attr__aria-label",
|
|
364
|
+
"attr__aria-labelledby",
|
|
365
|
+
"attr__label",
|
|
366
|
+
"attr__href"
|
|
367
|
+
];
|
|
368
|
+
for (const n of i) {
|
|
369
|
+
const r = s[n];
|
|
370
|
+
if (typeof r == "string" && v(r).length > 0)
|
|
371
|
+
return !0;
|
|
372
|
+
}
|
|
373
|
+
for (const [n, r] of Object.entries(s))
|
|
374
|
+
if (n.startsWith("attr__data-") && typeof r == "string" && v(r).length > 0)
|
|
375
|
+
return !0;
|
|
376
|
+
return !1;
|
|
347
377
|
}
|
|
348
|
-
function
|
|
349
|
-
return
|
|
378
|
+
function x() {
|
|
379
|
+
return E(10);
|
|
350
380
|
}
|
|
351
|
-
function
|
|
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(
|
|
381
|
+
function W(s) {
|
|
382
|
+
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
383
|
}
|
|
354
|
-
function
|
|
384
|
+
function we(s, e) {
|
|
355
385
|
let t;
|
|
356
386
|
return function(...i) {
|
|
357
|
-
const
|
|
358
|
-
clearTimeout(t),
|
|
387
|
+
const n = () => {
|
|
388
|
+
clearTimeout(t), s(...i);
|
|
359
389
|
};
|
|
360
|
-
clearTimeout(t), t = setTimeout(
|
|
390
|
+
clearTimeout(t), t = setTimeout(n, e);
|
|
361
391
|
};
|
|
362
392
|
}
|
|
363
|
-
function
|
|
364
|
-
const e = {}, t =
|
|
393
|
+
function ke(s) {
|
|
394
|
+
const e = {}, t = s.replace(/^\?/, "").split("&");
|
|
365
395
|
for (let i = 0; i < t.length; i++) {
|
|
366
|
-
const
|
|
367
|
-
|
|
396
|
+
const n = t[i].split("=");
|
|
397
|
+
n[0] !== "" && (e[decodeURIComponent(n[0])] = decodeURIComponent(n[1] || ""));
|
|
368
398
|
}
|
|
369
399
|
return e;
|
|
370
400
|
}
|
|
371
|
-
function
|
|
372
|
-
return typeof
|
|
401
|
+
function U(s) {
|
|
402
|
+
return typeof s == "string" || s instanceof String;
|
|
373
403
|
}
|
|
374
|
-
function
|
|
375
|
-
return
|
|
404
|
+
function S(s) {
|
|
405
|
+
return s !== null && typeof s == "object" && s.constructor === Object;
|
|
376
406
|
}
|
|
377
|
-
function
|
|
378
|
-
if (
|
|
379
|
-
return
|
|
380
|
-
const e =
|
|
381
|
-
return t || t === 0 ? t :
|
|
407
|
+
function ve(s) {
|
|
408
|
+
if (s === null)
|
|
409
|
+
return _.ERROR;
|
|
410
|
+
const e = s.toUpperCase(), t = _[e];
|
|
411
|
+
return t || t === 0 ? t : _.ERROR;
|
|
382
412
|
}
|
|
383
|
-
const
|
|
384
|
-
let
|
|
385
|
-
return typeof window < "u" && window.localStorage && (
|
|
413
|
+
const be = () => {
|
|
414
|
+
let s = "false";
|
|
415
|
+
return typeof window < "u" && window.localStorage && (s = localStorage.getItem("um_exclusion")), !(s == null || s === "false");
|
|
386
416
|
};
|
|
387
417
|
class _e {
|
|
388
418
|
constructor(e) {
|
|
389
|
-
this.maxScrollDepth = 0, this.milestones = [25, 50, 75, 90], this.lastScrollDepth = 0, this.client = e, this.documentElement = document.documentElement, this.debouncedHandleScroll =
|
|
419
|
+
this.maxScrollDepth = 0, this.milestones = [25, 50, 75, 90], this.lastScrollDepth = 0, this.client = e, this.documentElement = document.documentElement, this.debouncedHandleScroll = we(this.handleScroll.bind(this), 250), this.initializeEventListener();
|
|
390
420
|
}
|
|
391
421
|
initializeEventListener() {
|
|
392
422
|
window.addEventListener("scroll", this.debouncedHandleScroll);
|
|
@@ -410,8 +440,8 @@ class _e {
|
|
|
410
440
|
this.track();
|
|
411
441
|
}
|
|
412
442
|
getScrollDepth() {
|
|
413
|
-
const e = this.getWindowHeight(), t = this.getDocumentHeight(), i = this.getScrollDistance(),
|
|
414
|
-
return Math.min(100, Math.floor(i /
|
|
443
|
+
const e = this.getWindowHeight(), t = this.getDocumentHeight(), i = this.getScrollDistance(), n = t - e;
|
|
444
|
+
return Math.min(100, Math.floor(i / n * 100));
|
|
415
445
|
}
|
|
416
446
|
getWindowHeight() {
|
|
417
447
|
return window.innerHeight || this.documentElement.clientHeight || document.body.clientHeight || 0;
|
|
@@ -433,16 +463,16 @@ class _e {
|
|
|
433
463
|
this.milestones.filter(
|
|
434
464
|
(i) => e >= i
|
|
435
465
|
).forEach((i) => {
|
|
436
|
-
this.send(), this.milestones = this.milestones.filter((
|
|
466
|
+
this.send(), this.milestones = this.milestones.filter((n) => n !== i);
|
|
437
467
|
});
|
|
438
468
|
}
|
|
439
469
|
destroy() {
|
|
440
470
|
window.removeEventListener("scroll", this.debouncedHandleScroll);
|
|
441
471
|
}
|
|
442
472
|
}
|
|
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 _e(e), le(this),
|
|
473
|
+
const D = class D {
|
|
474
|
+
constructor(e, t, i = p()) {
|
|
475
|
+
this.logger = i, this.scrollDepth = null, this.customProperties = [], this.domHandlersAttached = !1, this.client = e, this.options = t, this.scrollDepth = new _e(e), le(this), G(this);
|
|
446
476
|
}
|
|
447
477
|
isBrowserSupported() {
|
|
448
478
|
return typeof document < "u" && typeof document.addEventListener == "function";
|
|
@@ -468,7 +498,7 @@ const I = class I {
|
|
|
468
498
|
const e = (t) => {
|
|
469
499
|
t = t || window.event, this.captureEvent(t);
|
|
470
500
|
};
|
|
471
|
-
|
|
501
|
+
A(document, "submit", e, !1, !0), A(document, "change", e, !1, !0), A(document, "click", e, !1, !0), A(document, "visibilitychange", e, !1, !0), A(document, "scroll", e, !1, !0), A(window, "popstate", e, !1, !0);
|
|
472
502
|
}
|
|
473
503
|
isPageRefresh() {
|
|
474
504
|
if ("PerformanceNavigationTiming" in window) {
|
|
@@ -479,65 +509,72 @@ const I = class I {
|
|
|
479
509
|
return performance.navigation && performance.navigation.type === 1;
|
|
480
510
|
}
|
|
481
511
|
captureEvent(e) {
|
|
482
|
-
var i,
|
|
512
|
+
var i, n;
|
|
483
513
|
let t = this.getEventTarget(e);
|
|
484
514
|
if (j(t) && (t = t.parentNode || null), e.type === "scroll")
|
|
485
515
|
return (i = this.scrollDepth) == null || i.track(), !0;
|
|
486
516
|
if (e.type === "visibilitychange" && document.visibilityState === "hidden" || e.type === "popstate")
|
|
487
|
-
return this.isPageRefresh() || (
|
|
488
|
-
if (t && pe(t, e)) {
|
|
517
|
+
return this.isPageRefresh() || (n = this.scrollDepth) == null || n.send(), !0;
|
|
518
|
+
if (!(!t || !b(t)) && t && pe(t, e)) {
|
|
489
519
|
const r = [t];
|
|
490
520
|
let o = t;
|
|
491
|
-
for (; o.parentNode && !
|
|
492
|
-
if (
|
|
493
|
-
|
|
521
|
+
for (; o != null && o.parentNode && !w(o, "body"); ) {
|
|
522
|
+
if (q(o == null ? void 0 : o.parentNode)) {
|
|
523
|
+
const g = (o == null ? void 0 : o.parentNode).host;
|
|
524
|
+
g && b(g) && r.push(g), o = g;
|
|
494
525
|
continue;
|
|
495
526
|
}
|
|
496
|
-
|
|
527
|
+
const l = o == null ? void 0 : o.parentNode;
|
|
528
|
+
if (!l || !b(l)) break;
|
|
529
|
+
r.push(l), o = l;
|
|
497
530
|
}
|
|
498
531
|
const a = [];
|
|
499
|
-
let
|
|
500
|
-
if (
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
const
|
|
504
|
-
|
|
532
|
+
let c, h = !1;
|
|
533
|
+
if (k(r, (l) => {
|
|
534
|
+
if (!l.tagName)
|
|
535
|
+
return;
|
|
536
|
+
const g = z(l);
|
|
537
|
+
l.tagName.toLowerCase() === "a" && (c = l.getAttribute("href"), c = g && H(c) && c);
|
|
538
|
+
const u = O(l).split(" ");
|
|
539
|
+
$(u, "ph-no-capture") && (h = !0), a.push(
|
|
505
540
|
this.getPropertiesFromElement(
|
|
506
|
-
|
|
541
|
+
l,
|
|
507
542
|
this.options.maskAllElementAttributes ?? !1,
|
|
508
543
|
this.options.maskAllText ?? !1
|
|
509
544
|
)
|
|
510
545
|
);
|
|
511
|
-
}), this.options.maskAllText || (a[0].$el_text =
|
|
546
|
+
}), this.options.maskAllText || (a[0].$el_text = J(t)), c && (a[0].attr__href = c), h)
|
|
512
547
|
return !1;
|
|
513
|
-
|
|
548
|
+
if (!ye(a[0]))
|
|
549
|
+
return this.logger.debug("Dropping autocapture event without identifiers."), !1;
|
|
550
|
+
const f = ue(
|
|
514
551
|
this.getDefaultProperties(e.type),
|
|
515
552
|
{
|
|
516
553
|
$elements: a
|
|
517
554
|
},
|
|
518
555
|
this.getCustomProperties(r)
|
|
519
556
|
);
|
|
520
|
-
return this.client.track("$autocapture",
|
|
557
|
+
return this.client.track("$autocapture", f), !0;
|
|
521
558
|
}
|
|
522
559
|
}
|
|
523
560
|
getCustomProperties(e) {
|
|
524
561
|
const t = {};
|
|
525
|
-
return
|
|
526
|
-
|
|
527
|
-
const r = document.querySelectorAll(
|
|
528
|
-
|
|
529
|
-
|
|
562
|
+
return k(this.customProperties, (i) => {
|
|
563
|
+
k(i.event_selectors, (n) => {
|
|
564
|
+
const r = document.querySelectorAll(n);
|
|
565
|
+
k(r, (o) => {
|
|
566
|
+
$(e, o) && z(o) && (t[i.name] = this.extractCustomPropertyValue(i));
|
|
530
567
|
});
|
|
531
568
|
});
|
|
532
569
|
}), t;
|
|
533
570
|
}
|
|
534
571
|
extractCustomPropertyValue(e) {
|
|
535
572
|
const t = [];
|
|
536
|
-
return
|
|
573
|
+
return k(
|
|
537
574
|
document.querySelectorAll(e.css_selector),
|
|
538
575
|
function(i) {
|
|
539
|
-
let
|
|
540
|
-
["input", "select"].indexOf(i.tagName.toLowerCase()) > -1 ?
|
|
576
|
+
let n;
|
|
577
|
+
["input", "select"].indexOf(i.tagName.toLowerCase()) > -1 ? n = i.value : i.textContent && (n = i.textContent), H(n) && t.push(n);
|
|
541
578
|
}
|
|
542
579
|
), t.join(", ");
|
|
543
580
|
}
|
|
@@ -546,20 +583,20 @@ const I = class I {
|
|
|
546
583
|
return typeof e.target > "u" ? e.srcElement || null : (t = e.target) != null && t.shadowRoot ? e.composedPath()[0] || null : e.target || null;
|
|
547
584
|
}
|
|
548
585
|
getPropertiesFromElement(e, t, i) {
|
|
549
|
-
const
|
|
550
|
-
tag_name:
|
|
586
|
+
const n = e.tagName.toLowerCase(), r = {
|
|
587
|
+
tag_name: n
|
|
551
588
|
};
|
|
552
|
-
|
|
553
|
-
const o =
|
|
554
|
-
o.length > 0 && (r.classes = o.split(" ").filter(function(
|
|
555
|
-
return
|
|
556
|
-
})),
|
|
557
|
-
ee(e) && ["name", "id", "class"].indexOf(
|
|
589
|
+
T.indexOf(n) > -1 && !i && (r.$el_text = J(e));
|
|
590
|
+
const o = O(e);
|
|
591
|
+
o.length > 0 && (r.classes = o.split(" ").filter(function(f) {
|
|
592
|
+
return f !== "";
|
|
593
|
+
})), k(e.attributes, function(f) {
|
|
594
|
+
ee(e) && ["name", "id", "class"].indexOf(f.name) === -1 || !t && H(f.value) && !me(f.name) && (r["attr__" + f.name] = f.value);
|
|
558
595
|
});
|
|
559
|
-
let a = 1,
|
|
560
|
-
for (;
|
|
561
|
-
a++,
|
|
562
|
-
return r.nth_child = a, r.nth_of_type =
|
|
596
|
+
let a = 1, c = 1, h = e;
|
|
597
|
+
for (; h = this.previousElementSibling(h); )
|
|
598
|
+
a++, h.tagName === e.tagName && c++;
|
|
599
|
+
return r.nth_child = a, r.nth_of_type = c, r;
|
|
563
600
|
}
|
|
564
601
|
previousElementSibling(e) {
|
|
565
602
|
if (e.previousElementSibling)
|
|
@@ -568,7 +605,7 @@ const I = class I {
|
|
|
568
605
|
let t = e;
|
|
569
606
|
do
|
|
570
607
|
t = t.previousSibling;
|
|
571
|
-
while (t && !
|
|
608
|
+
while (t && !b(t));
|
|
572
609
|
return t;
|
|
573
610
|
}
|
|
574
611
|
}
|
|
@@ -584,15 +621,15 @@ const I = class I {
|
|
|
584
621
|
static enabledForProject(e, t = 10, i = 10) {
|
|
585
622
|
if (!e)
|
|
586
623
|
return !1;
|
|
587
|
-
let
|
|
624
|
+
let n = 0;
|
|
588
625
|
for (let r = 0; r < e.length; r++)
|
|
589
|
-
|
|
590
|
-
return
|
|
626
|
+
n += e.charCodeAt(r);
|
|
627
|
+
return n % t < i;
|
|
591
628
|
}
|
|
592
629
|
};
|
|
593
|
-
|
|
594
|
-
let
|
|
595
|
-
class
|
|
630
|
+
D.FORCE_CAPTURE_ATTR = "data-um-force-capture", D.PREVENT_CAPTURE_ATTR = "data-um-no-capture";
|
|
631
|
+
let N = D;
|
|
632
|
+
class Ee {
|
|
596
633
|
constructor(e) {
|
|
597
634
|
this.client = e, this.lastPageUrl = window.location.href, this.trackInitialPageview(), this.initializePageviewTracking();
|
|
598
635
|
}
|
|
@@ -621,15 +658,15 @@ class be {
|
|
|
621
658
|
}));
|
|
622
659
|
}
|
|
623
660
|
}
|
|
624
|
-
class
|
|
625
|
-
constructor(e, t, i =
|
|
661
|
+
class Pe {
|
|
662
|
+
constructor(e, t, i = p()) {
|
|
626
663
|
this.trackingHost = e, this.logger = i, this.config = t;
|
|
627
664
|
}
|
|
628
665
|
async send(e) {
|
|
629
|
-
const t = this.config.key, i = this.constructUrl(t),
|
|
666
|
+
const t = this.config.key, i = this.constructUrl(t), n = new Blob([JSON.stringify(e)], {
|
|
630
667
|
type: "application/json"
|
|
631
668
|
});
|
|
632
|
-
if (navigator.sendBeacon(i,
|
|
669
|
+
if (navigator.sendBeacon(i, n))
|
|
633
670
|
this.logger.debug(
|
|
634
671
|
`Successfully queued ${e.length} event(s) via Beacon API`
|
|
635
672
|
);
|
|
@@ -637,32 +674,32 @@ class Ee {
|
|
|
637
674
|
throw new Error("Failed to queue events via Beacon API");
|
|
638
675
|
}
|
|
639
676
|
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.${
|
|
677
|
+
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = d() ? "/api/v1/event" : "/api/v1/s2s/event";
|
|
678
|
+
return this.config.randomizeUrl ? `${this.trackingHost}/api.${E()}?p_${E()}=${e}${t}${i}` : `${this.trackingHost}${n}?token=${e}${t}${i}`;
|
|
642
679
|
}
|
|
643
680
|
// Note: Beacon API doesn't support custom headers, so we can't use them here.
|
|
644
681
|
// If custom headers are crucial, you might want to fall back to XHR or Fetch in those cases.
|
|
645
682
|
}
|
|
646
|
-
class
|
|
647
|
-
constructor(e, t, i =
|
|
683
|
+
class K {
|
|
684
|
+
constructor(e, t, i = p()) {
|
|
648
685
|
this.trackingHost = e, this.logger = i, this.config = t;
|
|
649
686
|
}
|
|
650
687
|
async send(e) {
|
|
651
|
-
const t = this.config.key, i = this.constructUrl(t),
|
|
688
|
+
const t = this.config.key, i = this.constructUrl(t), n = JSON.stringify(e), r = {
|
|
652
689
|
"Content-Type": "application/json",
|
|
653
690
|
...this.getCustomHeaders()
|
|
654
691
|
}, o = await fetch(i, {
|
|
655
692
|
method: "POST",
|
|
656
693
|
headers: r,
|
|
657
|
-
body:
|
|
694
|
+
body: n
|
|
658
695
|
});
|
|
659
696
|
if (!o.ok)
|
|
660
697
|
throw new Error(`HTTP error! status: ${o.status}`);
|
|
661
698
|
this.logger.debug(`Successfully sent ${e.length} event(s)`), this.postHandle(o.status, await o.text());
|
|
662
699
|
}
|
|
663
700
|
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.${
|
|
701
|
+
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = d() ? "/api/v1/event" : "/api/v1/s2s/event";
|
|
702
|
+
return this.config.randomizeUrl ? `${this.trackingHost}/api.${E()}?p_${E()}=${e}${t}${i}` : `${this.trackingHost}${n}?token=${e}${t}${i}`;
|
|
666
703
|
}
|
|
667
704
|
getCustomHeaders() {
|
|
668
705
|
return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
|
|
@@ -671,27 +708,27 @@ class W {
|
|
|
671
708
|
this.logger.debug(`Response received. Status: ${e}, Body: ${t}`);
|
|
672
709
|
}
|
|
673
710
|
}
|
|
674
|
-
class
|
|
675
|
-
constructor(e, t, i =
|
|
711
|
+
class Ae {
|
|
712
|
+
constructor(e, t, i = p()) {
|
|
676
713
|
this.trackingHost = e, this.logger = i, this.config = t;
|
|
677
714
|
}
|
|
678
715
|
send(e) {
|
|
679
716
|
return new Promise((t, i) => {
|
|
680
|
-
const
|
|
681
|
-
|
|
717
|
+
const n = new XMLHttpRequest(), r = this.config.key, o = this.constructUrl(r);
|
|
718
|
+
n.open("POST", o, !0), n.setRequestHeader("Content-Type", "application/json");
|
|
682
719
|
const a = this.getCustomHeaders();
|
|
683
|
-
Object.keys(a).forEach((
|
|
684
|
-
|
|
685
|
-
}),
|
|
686
|
-
|
|
687
|
-
},
|
|
720
|
+
Object.keys(a).forEach((c) => {
|
|
721
|
+
n.setRequestHeader(c, a[c]);
|
|
722
|
+
}), n.onload = () => {
|
|
723
|
+
n.status >= 200 && n.status < 300 ? (this.logger.debug(`Successfully sent ${e.length} event(s)`), t()) : i(new Error(`HTTP error! status: ${n.status}`));
|
|
724
|
+
}, n.onerror = () => {
|
|
688
725
|
i(new Error("Network error"));
|
|
689
|
-
},
|
|
726
|
+
}, n.send(JSON.stringify(e));
|
|
690
727
|
});
|
|
691
728
|
}
|
|
692
729
|
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.${
|
|
730
|
+
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = d() ? "/api/v1/event" : "/api/v1/s2s/event";
|
|
731
|
+
return this.config.randomizeUrl ? `${this.trackingHost}/api.${E()}?p_${E()}=${e}${t}${i}` : `${this.trackingHost}${n}?token=${e}${t}${i}`;
|
|
695
732
|
}
|
|
696
733
|
getCustomHeaders() {
|
|
697
734
|
return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
|
|
@@ -702,7 +739,7 @@ class Pe {
|
|
|
702
739
|
}
|
|
703
740
|
class te {
|
|
704
741
|
constructor(e, t) {
|
|
705
|
-
this.storage = {}, this.prefix = `usermaven_${e}_`, this.
|
|
742
|
+
this.storage = {}, this.storageDisabled = !1, this.quotaErrorLogged = !1, this.prefix = `usermaven_${e}_`, this.logger = t || p(), this.load();
|
|
706
743
|
}
|
|
707
744
|
set(e, t) {
|
|
708
745
|
this.storage[e] = t, this.save();
|
|
@@ -716,19 +753,11 @@ class te {
|
|
|
716
753
|
clear() {
|
|
717
754
|
this.storage = {}, this.save();
|
|
718
755
|
}
|
|
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
|
-
}
|
|
756
|
+
isStorageEnabled() {
|
|
757
|
+
return !this.storageDisabled;
|
|
729
758
|
}
|
|
730
759
|
load() {
|
|
731
|
-
if (!
|
|
760
|
+
if (!d()) {
|
|
732
761
|
this.logger.warn("localStorage is not available in this environment");
|
|
733
762
|
return;
|
|
734
763
|
}
|
|
@@ -736,11 +765,32 @@ class te {
|
|
|
736
765
|
const e = localStorage.getItem(this.prefix + "data");
|
|
737
766
|
e && (this.storage = JSON.parse(e));
|
|
738
767
|
} catch (e) {
|
|
739
|
-
this.logger.error("Error loading from localStorage:", e);
|
|
768
|
+
this.isQuotaError(e) ? (this.storageDisabled = !0, this.logQuotaOnce(e)) : this.logger.error("Error loading from localStorage:", e);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
save() {
|
|
772
|
+
if (!d())
|
|
773
|
+
return this.logger.warn("localStorage is not available in this environment"), !1;
|
|
774
|
+
if (this.storageDisabled)
|
|
775
|
+
return !1;
|
|
776
|
+
try {
|
|
777
|
+
return localStorage.setItem(this.prefix + "data", JSON.stringify(this.storage)), !0;
|
|
778
|
+
} catch (e) {
|
|
779
|
+
return this.isQuotaError(e) ? (this.storageDisabled = !0, this.logQuotaOnce(e)) : this.logger.error("Error saving to localStorage:", e), !1;
|
|
740
780
|
}
|
|
741
781
|
}
|
|
782
|
+
isQuotaError(e) {
|
|
783
|
+
const t = e == null ? void 0 : e.name;
|
|
784
|
+
return t === "QuotaExceededError" || t === "NS_ERROR_DOM_QUOTA_REACHED" || (e == null ? void 0 : e.code) === 22 || (e == null ? void 0 : e.code) === 1014;
|
|
785
|
+
}
|
|
786
|
+
logQuotaOnce(e) {
|
|
787
|
+
this.quotaErrorLogged || (this.quotaErrorLogged = !0, this.logger.error(
|
|
788
|
+
"localStorage quota exceeded; persisting disabled. Continuing with in-memory storage only.",
|
|
789
|
+
e
|
|
790
|
+
));
|
|
791
|
+
}
|
|
742
792
|
}
|
|
743
|
-
class
|
|
793
|
+
class Se {
|
|
744
794
|
constructor() {
|
|
745
795
|
this.storage = {};
|
|
746
796
|
}
|
|
@@ -759,66 +809,119 @@ class Ae {
|
|
|
759
809
|
this.storage = {};
|
|
760
810
|
}
|
|
761
811
|
}
|
|
762
|
-
class
|
|
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(
|
|
812
|
+
class X {
|
|
813
|
+
constructor(e, t = 3, i = 1e3, n = 10, r = 1e3, o = p(), a = "default", c = 1e3, h = 25e5) {
|
|
814
|
+
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
815
|
`offline_queue_${a}`
|
|
767
|
-
), h() && (this.isOnline = navigator.onLine, this.loadQueueFromStorage(), this.initNetworkListeners(), this.scheduleBatch());
|
|
816
|
+
), this.maxQueueItems = c, this.maxQueueBytes = h, d() && (this.isOnline = navigator.onLine, this.loadQueueFromStorage(), this.initNetworkListeners(), this.scheduleBatch());
|
|
768
817
|
}
|
|
769
818
|
add(e) {
|
|
770
|
-
const t = {
|
|
771
|
-
|
|
819
|
+
const t = {
|
|
820
|
+
payload: e,
|
|
821
|
+
retries: 0,
|
|
822
|
+
timestamp: Date.now()
|
|
823
|
+
};
|
|
824
|
+
t.bytes = this.estimateItemBytes(t), this.queue.push(t), this.totalQueueBytes += t.bytes, this.enforceQueueLimits(), d() ? this.saveQueueToStorage() : this.processBatch();
|
|
772
825
|
}
|
|
773
826
|
initNetworkListeners() {
|
|
774
|
-
|
|
827
|
+
d() && (window.addEventListener("online", () => {
|
|
775
828
|
this.isOnline = !0, this.processBatch();
|
|
776
829
|
}), window.addEventListener("offline", () => {
|
|
777
830
|
this.isOnline = !1;
|
|
778
831
|
}));
|
|
779
832
|
}
|
|
780
833
|
scheduleBatch() {
|
|
781
|
-
|
|
834
|
+
d() && (this.batchTimeoutId !== null && clearTimeout(this.batchTimeoutId), this.batchTimeoutId = window.setTimeout(
|
|
782
835
|
() => this.processBatch(),
|
|
783
836
|
this.batchInterval
|
|
784
837
|
));
|
|
785
838
|
}
|
|
786
839
|
async processBatch() {
|
|
787
|
-
if ((!
|
|
840
|
+
if ((!d() || this.isOnline) && !this.processing && this.queue.length > 0) {
|
|
788
841
|
this.processing = !0;
|
|
789
|
-
const e = this.queue.splice(0, this.batchSize)
|
|
842
|
+
const e = this.queue.splice(0, this.batchSize);
|
|
843
|
+
this.totalQueueBytes = Math.max(
|
|
844
|
+
0,
|
|
845
|
+
this.totalQueueBytes - e.reduce((i, n) => i + (n.bytes || 0), 0)
|
|
846
|
+
);
|
|
847
|
+
const t = e.map((i) => i.payload);
|
|
790
848
|
try {
|
|
791
849
|
await this.transport.send(t), this.logger.debug(
|
|
792
850
|
`Successfully sent batch of ${e.length} payloads`
|
|
793
|
-
),
|
|
851
|
+
), d() && this.saveQueueToStorage();
|
|
794
852
|
} catch (i) {
|
|
795
853
|
this.logger.error("Failed to send batch", i), await this.handleBatchFailure(e);
|
|
796
854
|
}
|
|
797
855
|
this.processing = !1;
|
|
798
856
|
}
|
|
799
|
-
|
|
857
|
+
d() && this.scheduleBatch();
|
|
800
858
|
}
|
|
801
859
|
async handleBatchFailure(e) {
|
|
802
860
|
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(
|
|
861
|
+
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
862
|
"Max retries reached, discarding payload",
|
|
805
863
|
t.payload
|
|
806
864
|
);
|
|
807
|
-
|
|
865
|
+
d() && (this.saveQueueToStorage(), await new Promise((t) => setTimeout(t, this.retryInterval)));
|
|
866
|
+
}
|
|
867
|
+
enforceQueueLimits() {
|
|
868
|
+
if (this.maxQueueItems > 0 && this.queue.length > this.maxQueueItems) {
|
|
869
|
+
const e = this.queue.length - this.maxQueueItems, t = this.queue.splice(0, e);
|
|
870
|
+
this.totalQueueBytes = Math.max(
|
|
871
|
+
0,
|
|
872
|
+
this.totalQueueBytes - t.reduce((i, n) => i + (n.bytes || 0), 0)
|
|
873
|
+
), this.logger.warn(
|
|
874
|
+
`Retry queue exceeded ${this.maxQueueItems} items; dropped ${t.length} oldest payload(s)`
|
|
875
|
+
);
|
|
876
|
+
}
|
|
877
|
+
if (this.maxQueueBytes > 0 && this.totalQueueBytes > this.maxQueueBytes && this.queue.length > 0) {
|
|
878
|
+
let e = 0;
|
|
879
|
+
for (; this.totalQueueBytes > this.maxQueueBytes && this.queue.length > 1; ) {
|
|
880
|
+
const t = this.queue.shift();
|
|
881
|
+
t && (this.totalQueueBytes -= t.bytes || this.estimateItemBytes(t), e++);
|
|
882
|
+
}
|
|
883
|
+
this.totalQueueBytes = Math.max(0, this.totalQueueBytes), e > 0 && this.logger.warn(
|
|
884
|
+
`Retry queue exceeded ${this.maxQueueBytes} bytes; dropped ${e} oldest payload(s)`
|
|
885
|
+
);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
estimateItemBytes(e) {
|
|
889
|
+
const t = { ...e };
|
|
890
|
+
delete t.bytes;
|
|
891
|
+
try {
|
|
892
|
+
return JSON.stringify(t).length;
|
|
893
|
+
} catch {
|
|
894
|
+
return 0;
|
|
895
|
+
}
|
|
808
896
|
}
|
|
809
897
|
loadQueueFromStorage() {
|
|
810
|
-
if (
|
|
898
|
+
if (d()) {
|
|
811
899
|
const e = this.persistence.get("queue");
|
|
812
|
-
|
|
900
|
+
if (!e) return;
|
|
901
|
+
try {
|
|
902
|
+
const t = JSON.parse(e);
|
|
903
|
+
this.queue = t.map((i) => ({
|
|
904
|
+
...i,
|
|
905
|
+
bytes: i.bytes || this.estimateItemBytes(i)
|
|
906
|
+
})), this.totalQueueBytes = this.queue.reduce(
|
|
907
|
+
(i, n) => i + (n.bytes || 0),
|
|
908
|
+
0
|
|
909
|
+
), this.enforceQueueLimits();
|
|
910
|
+
} catch (t) {
|
|
911
|
+
this.logger.error("Failed to parse stored queue", t), this.queue = [], this.totalQueueBytes = 0;
|
|
912
|
+
}
|
|
813
913
|
}
|
|
814
914
|
}
|
|
815
915
|
saveQueueToStorage() {
|
|
816
|
-
|
|
916
|
+
if (d()) {
|
|
917
|
+
const e = this.queue.map(({ bytes: t, ...i }) => i);
|
|
918
|
+
this.persistence.set("queue", JSON.stringify(e));
|
|
919
|
+
}
|
|
817
920
|
}
|
|
818
921
|
}
|
|
819
|
-
class
|
|
922
|
+
class Ce {
|
|
820
923
|
constructor(e) {
|
|
821
|
-
this.clicks = [], this.threshold = 3, this.timeWindow = 2e3, this.distanceThreshold = 30, this.client = e, this.initializeEventListener(),
|
|
924
|
+
this.clicks = [], this.threshold = 3, this.timeWindow = 2e3, this.distanceThreshold = 30, this.client = e, this.initializeEventListener(), G(this);
|
|
822
925
|
}
|
|
823
926
|
initializeEventListener() {
|
|
824
927
|
document.addEventListener("click", this.handleClick.bind(this));
|
|
@@ -831,8 +934,8 @@ class Se {
|
|
|
831
934
|
return !e.closest(".um-no-capture");
|
|
832
935
|
}
|
|
833
936
|
click(e, t, i) {
|
|
834
|
-
const
|
|
835
|
-
this.clicks.push(
|
|
937
|
+
const n = { x: e, y: t, timestamp: i };
|
|
938
|
+
this.clicks.push(n), this.clicks = this.clicks.filter(
|
|
836
939
|
(r) => i - r.timestamp < this.timeWindow
|
|
837
940
|
), this.clicks.length >= this.threshold && this.checkRageClick();
|
|
838
941
|
}
|
|
@@ -854,12 +957,12 @@ class Se {
|
|
|
854
957
|
}), this.clicks = [];
|
|
855
958
|
}
|
|
856
959
|
}
|
|
857
|
-
class
|
|
858
|
-
constructor(e, t, i =
|
|
960
|
+
class $e {
|
|
961
|
+
constructor(e, t, i = p()) {
|
|
859
962
|
this.trackingHost = e, this.logger = i, this.config = t;
|
|
860
963
|
}
|
|
861
964
|
async send(e) {
|
|
862
|
-
const t = this.config.key, i = new (void 0)(this.constructUrl(t)),
|
|
965
|
+
const t = this.config.key, i = new (void 0)(this.constructUrl(t)), n = {
|
|
863
966
|
hostname: i.hostname,
|
|
864
967
|
port: 443,
|
|
865
968
|
path: `${i.pathname}${i.search}`,
|
|
@@ -870,15 +973,15 @@ class Ce {
|
|
|
870
973
|
}
|
|
871
974
|
};
|
|
872
975
|
return new Promise((r, o) => {
|
|
873
|
-
const a = (void 0)(
|
|
874
|
-
|
|
875
|
-
}),
|
|
876
|
-
const
|
|
877
|
-
|
|
976
|
+
const a = (void 0)(n, (c) => {
|
|
977
|
+
c.on("data", (h) => {
|
|
978
|
+
}), c.on("end", () => {
|
|
979
|
+
const h = c.statusCode || 0;
|
|
980
|
+
h >= 200 && h < 300 ? (this.logger.debug(`Successfully sent ${e.length} event(s)`), r()) : o(new Error(`HTTP error! status: ${h}`));
|
|
878
981
|
});
|
|
879
982
|
});
|
|
880
|
-
a.on("error", (
|
|
881
|
-
o(
|
|
983
|
+
a.on("error", (c) => {
|
|
984
|
+
o(c);
|
|
882
985
|
}), a.write(JSON.stringify(e)), a.end();
|
|
883
986
|
});
|
|
884
987
|
}
|
|
@@ -890,7 +993,7 @@ class Ce {
|
|
|
890
993
|
return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
|
|
891
994
|
}
|
|
892
995
|
}
|
|
893
|
-
class
|
|
996
|
+
class C {
|
|
894
997
|
constructor(e, t = "all", i = {}) {
|
|
895
998
|
this.instance = e, this.trackingType = t, this.options = i, document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", this.initialize.bind(this)) : this.initialize();
|
|
896
999
|
}
|
|
@@ -909,9 +1012,9 @@ class A {
|
|
|
909
1012
|
}
|
|
910
1013
|
trackFieldChanges(e) {
|
|
911
1014
|
e.querySelectorAll("input, select, textarea").forEach((i) => {
|
|
912
|
-
i.addEventListener("change", (
|
|
1015
|
+
i.addEventListener("change", (n) => {
|
|
913
1016
|
const r = this._getFieldProps(
|
|
914
|
-
|
|
1017
|
+
n.target
|
|
915
1018
|
);
|
|
916
1019
|
this.instance.track(
|
|
917
1020
|
"$form_field_change",
|
|
@@ -925,7 +1028,7 @@ class A {
|
|
|
925
1028
|
});
|
|
926
1029
|
}
|
|
927
1030
|
static getInstance(e, t = "all", i = {}) {
|
|
928
|
-
return
|
|
1031
|
+
return C.instance || (C.instance = new C(e, t, i)), C.instance;
|
|
929
1032
|
}
|
|
930
1033
|
_getFormDetails(e) {
|
|
931
1034
|
const t = {
|
|
@@ -973,8 +1076,8 @@ class A {
|
|
|
973
1076
|
getSafeText(e) {
|
|
974
1077
|
let t = "";
|
|
975
1078
|
return "value" in e && e.type !== "password" ? t = e.value : e.hasChildNodes() ? t = Array.from(e.childNodes).filter(
|
|
976
|
-
(
|
|
977
|
-
).map((
|
|
1079
|
+
(n) => n.nodeType === Node.TEXT_NODE
|
|
1080
|
+
).map((n) => n.textContent).join("") : t = e.textContent || "", this._scrubPotentiallySensitiveValues(t);
|
|
978
1081
|
}
|
|
979
1082
|
_scrubPotentiallySensitiveValues(e) {
|
|
980
1083
|
return this._shouldCaptureValue(e) ? e : "<redacted>";
|
|
@@ -992,7 +1095,7 @@ class A {
|
|
|
992
1095
|
if (typeof String.prototype.trim == "function")
|
|
993
1096
|
return e.trim();
|
|
994
1097
|
let t = 0, i = e.length - 1;
|
|
995
|
-
const
|
|
1098
|
+
const n = [
|
|
996
1099
|
" ",
|
|
997
1100
|
`
|
|
998
1101
|
`,
|
|
@@ -1019,16 +1122,16 @@ class A {
|
|
|
1019
1122
|
" ",
|
|
1020
1123
|
" "
|
|
1021
1124
|
].join("");
|
|
1022
|
-
for (; t <= i &&
|
|
1125
|
+
for (; t <= i && n.indexOf(e[t]) > -1; )
|
|
1023
1126
|
t++;
|
|
1024
|
-
for (; i >= t &&
|
|
1127
|
+
for (; i >= t && n.indexOf(e[i]) > -1; )
|
|
1025
1128
|
i--;
|
|
1026
1129
|
return e.slice(t, i + 1);
|
|
1027
1130
|
}
|
|
1028
1131
|
}
|
|
1029
|
-
class
|
|
1132
|
+
class R {
|
|
1030
1133
|
constructor(e) {
|
|
1031
|
-
this.config = this.mergeConfig(e,
|
|
1134
|
+
this.config = this.mergeConfig(e, Y), this.logger = p(this.config.logLevel), this.namespace = e.namespace || "default", this.transport = this.initializeTransport(this.config), this.persistence = this.initializePersistence(), this.retryQueue = new X(
|
|
1032
1135
|
this.transport,
|
|
1033
1136
|
this.config.maxSendAttempts || 3,
|
|
1034
1137
|
this.config.minSendTimeout || 1e3,
|
|
@@ -1037,14 +1140,14 @@ class N {
|
|
|
1037
1140
|
// Reduced interval to .2 second
|
|
1038
1141
|
this.logger,
|
|
1039
1142
|
this.namespace
|
|
1040
|
-
),
|
|
1143
|
+
), d() && this.initializeBrowserFeatures(), this.anonymousId = this.getOrCreateAnonymousId(), this.logger.info(
|
|
1041
1144
|
`Usermaven client initialized for namespace: ${this.namespace}`
|
|
1042
1145
|
);
|
|
1043
1146
|
}
|
|
1044
1147
|
initializeBrowserFeatures() {
|
|
1045
|
-
if (this.cookieManager = new
|
|
1148
|
+
if (this.cookieManager = new ne(this.config.cookieDomain), this.config.autocapture && N.enabledForProject(this.config.key) && !this.config.disableAutocaptureListenerRegistration && (this.autoCapture = new N(this, this.config, this.logger), this.autoCapture.init()), this.config.formTracking) {
|
|
1046
1149
|
const e = this.config.formTracking === !0 ? "all" : this.config.formTracking;
|
|
1047
|
-
this.formTracking =
|
|
1150
|
+
this.formTracking = C.getInstance(
|
|
1048
1151
|
this,
|
|
1049
1152
|
e || "none",
|
|
1050
1153
|
{
|
|
@@ -1052,7 +1155,7 @@ class N {
|
|
|
1052
1155
|
}
|
|
1053
1156
|
);
|
|
1054
1157
|
}
|
|
1055
|
-
this.config.autoPageview && (this.pageviewTracking = new
|
|
1158
|
+
this.config.autoPageview && (this.pageviewTracking = new Ee(this)), this.config.crossDomainLinking && this.manageCrossDomainLinking(), this.config.rageClick && (this.rageClick = new Ce(this)), this.setupPageLeaveTracking();
|
|
1056
1159
|
}
|
|
1057
1160
|
/**
|
|
1058
1161
|
* Recursively merge the provided configuration with the existing defaultConfig
|
|
@@ -1061,13 +1164,13 @@ class N {
|
|
|
1061
1164
|
*/
|
|
1062
1165
|
mergeConfig(e, t) {
|
|
1063
1166
|
const i = JSON.parse(JSON.stringify(e));
|
|
1064
|
-
let
|
|
1167
|
+
let n = { ...t, ...i };
|
|
1065
1168
|
return Object.keys(t).forEach((r) => {
|
|
1066
|
-
|
|
1067
|
-
}),
|
|
1169
|
+
S(t[r]) && (n[r] = this.mergeConfig(e[r], t[r]));
|
|
1170
|
+
}), n;
|
|
1068
1171
|
}
|
|
1069
1172
|
init(e) {
|
|
1070
|
-
this.config = { ...this.config, ...e }, this.logger =
|
|
1173
|
+
this.config = { ...this.config, ...e }, this.logger = p(this.config.logLevel), this.namespace = e.namespace || this.namespace, this.transport = this.initializeTransport(e), this.persistence = this.initializePersistence(), this.retryQueue = new X(
|
|
1071
1174
|
this.transport,
|
|
1072
1175
|
this.config.maxSendAttempts || 3,
|
|
1073
1176
|
this.config.minSendTimeout || 1e3,
|
|
@@ -1076,7 +1179,7 @@ class N {
|
|
|
1076
1179
|
// Reduced interval to .25 second
|
|
1077
1180
|
this.logger,
|
|
1078
1181
|
this.namespace
|
|
1079
|
-
),
|
|
1182
|
+
), d() && this.initializeBrowserFeatures(), this.anonymousId = this.getOrCreateAnonymousId(), this.logger.info(
|
|
1080
1183
|
`Usermaven client reinitialized for namespace: ${this.namespace}`
|
|
1081
1184
|
);
|
|
1082
1185
|
}
|
|
@@ -1086,14 +1189,14 @@ class N {
|
|
|
1086
1189
|
const e = this.config.domains.split(",").map((i) => i.trim()), t = this.config.cookieName || `__eventn_id_${this.config.key}`;
|
|
1087
1190
|
document.addEventListener("click", (i) => {
|
|
1088
1191
|
var a;
|
|
1089
|
-
const
|
|
1090
|
-
if (!
|
|
1091
|
-
const r =
|
|
1192
|
+
const n = this.findClosestLink(i.target);
|
|
1193
|
+
if (!n) return;
|
|
1194
|
+
const r = n.getAttribute("href");
|
|
1092
1195
|
if (!r || !r.startsWith("http")) return;
|
|
1093
1196
|
const o = new URL(r);
|
|
1094
1197
|
if (o.hostname !== window.location.hostname && e.includes(o.hostname)) {
|
|
1095
|
-
const
|
|
1096
|
-
|
|
1198
|
+
const c = (a = this.cookieManager) == null ? void 0 : a.get(t);
|
|
1199
|
+
c && (o.searchParams.append("_um", c), n.setAttribute("href", o.toString()));
|
|
1097
1200
|
}
|
|
1098
1201
|
}), this.logger.debug("Cross-domain linking initialized");
|
|
1099
1202
|
}
|
|
@@ -1104,29 +1207,29 @@ class N {
|
|
|
1104
1207
|
}
|
|
1105
1208
|
initializeTransport(e) {
|
|
1106
1209
|
const t = "https://events.usermaven.com";
|
|
1107
|
-
if (!
|
|
1108
|
-
return new
|
|
1109
|
-
const i = "XMLHttpRequest" in window,
|
|
1210
|
+
if (!d())
|
|
1211
|
+
return new $e(e.trackingHost || t, e);
|
|
1212
|
+
const i = "XMLHttpRequest" in window, n = typeof fetch < "u", r = typeof navigator < "u" && "sendBeacon" in navigator;
|
|
1110
1213
|
if (e.useBeaconApi && r)
|
|
1111
|
-
return new
|
|
1214
|
+
return new Pe(
|
|
1112
1215
|
e.trackingHost || t,
|
|
1113
1216
|
e,
|
|
1114
1217
|
this.logger
|
|
1115
1218
|
);
|
|
1116
|
-
if (e.forceUseFetch &&
|
|
1117
|
-
return new
|
|
1219
|
+
if (e.forceUseFetch && n)
|
|
1220
|
+
return new K(
|
|
1118
1221
|
e.trackingHost || t,
|
|
1119
1222
|
e,
|
|
1120
1223
|
this.logger
|
|
1121
1224
|
);
|
|
1122
1225
|
if (i)
|
|
1123
|
-
return new
|
|
1226
|
+
return new Ae(
|
|
1124
1227
|
e.trackingHost || t,
|
|
1125
1228
|
e,
|
|
1126
1229
|
this.logger
|
|
1127
1230
|
);
|
|
1128
|
-
if (
|
|
1129
|
-
return new
|
|
1231
|
+
if (n)
|
|
1232
|
+
return new K(
|
|
1130
1233
|
e.trackingHost || t,
|
|
1131
1234
|
e,
|
|
1132
1235
|
this.logger
|
|
@@ -1134,27 +1237,27 @@ class N {
|
|
|
1134
1237
|
throw new Error("No suitable transport method available");
|
|
1135
1238
|
}
|
|
1136
1239
|
initializePersistence() {
|
|
1137
|
-
return this.config.disableEventPersistence || !
|
|
1240
|
+
return this.config.disableEventPersistence || !d() ? new Se() : new te(
|
|
1138
1241
|
`${this.namespace}_${this.config.key}`,
|
|
1139
1242
|
this.logger
|
|
1140
1243
|
);
|
|
1141
1244
|
}
|
|
1142
1245
|
getOrCreateAnonymousId() {
|
|
1143
|
-
var i,
|
|
1144
|
-
if (!
|
|
1145
|
-
return
|
|
1246
|
+
var i, n;
|
|
1247
|
+
if (!d())
|
|
1248
|
+
return x();
|
|
1146
1249
|
if (this.config.privacyPolicy === "strict" || this.config.cookiePolicy === "strict")
|
|
1147
1250
|
return "";
|
|
1148
1251
|
const e = this.config.cookieName || `__eventn_id_${this.config.key}`;
|
|
1149
1252
|
let t = (i = this.cookieManager) == null ? void 0 : i.get(e);
|
|
1150
1253
|
if (!t) {
|
|
1151
1254
|
if (this.config.crossDomainLinking) {
|
|
1152
|
-
const a = new URLSearchParams(window.location.search).get("_um"),
|
|
1153
|
-
t = a ||
|
|
1255
|
+
const a = new URLSearchParams(window.location.search).get("_um"), h = window.location.hash.substring(1).split("~"), f = h.length > 1 ? h[1] : void 0;
|
|
1256
|
+
t = a || f || x();
|
|
1154
1257
|
}
|
|
1155
|
-
t || (t =
|
|
1258
|
+
t || (t = x());
|
|
1156
1259
|
const r = 365 * 10;
|
|
1157
|
-
(
|
|
1260
|
+
(n = this.cookieManager) == null || n.set(
|
|
1158
1261
|
e,
|
|
1159
1262
|
t,
|
|
1160
1263
|
r,
|
|
@@ -1165,19 +1268,19 @@ class N {
|
|
|
1165
1268
|
return t;
|
|
1166
1269
|
}
|
|
1167
1270
|
async id(e, t = !1) {
|
|
1168
|
-
if (!
|
|
1271
|
+
if (!S(e))
|
|
1169
1272
|
throw new Error("User data must be an object");
|
|
1170
|
-
if (e.email && !
|
|
1273
|
+
if (e.email && !W(e.email))
|
|
1171
1274
|
throw new Error("Invalid email provided");
|
|
1172
|
-
if (!e.id || !
|
|
1275
|
+
if (!e.id || !U(e.id))
|
|
1173
1276
|
throw new Error("User ID must be a string");
|
|
1174
1277
|
const i = e.id;
|
|
1175
1278
|
if (this.persistence.set("userId", i), this.persistence.set("userProps", e), !t) {
|
|
1176
|
-
const
|
|
1279
|
+
const n = {
|
|
1177
1280
|
...e,
|
|
1178
1281
|
anonymous_id: this.anonymousId
|
|
1179
1282
|
};
|
|
1180
|
-
await this.track("user_identify",
|
|
1283
|
+
await this.track("user_identify", n);
|
|
1181
1284
|
}
|
|
1182
1285
|
this.logger.info("User identified:", e);
|
|
1183
1286
|
}
|
|
@@ -1185,28 +1288,28 @@ class N {
|
|
|
1185
1288
|
this.trackInternal(e, t, i);
|
|
1186
1289
|
}
|
|
1187
1290
|
lead(e, t = !1) {
|
|
1188
|
-
if (!
|
|
1291
|
+
if (!S(e))
|
|
1189
1292
|
throw new Error(
|
|
1190
1293
|
"Lead payload must be a non-null object and not an array"
|
|
1191
1294
|
);
|
|
1192
1295
|
const i = e.email;
|
|
1193
|
-
if (!
|
|
1296
|
+
if (!U(i)) {
|
|
1194
1297
|
this.logger.error("Lead event requires a valid email attribute");
|
|
1195
1298
|
return;
|
|
1196
1299
|
}
|
|
1197
|
-
const
|
|
1198
|
-
if (!
|
|
1300
|
+
const n = i.trim();
|
|
1301
|
+
if (!n || !W(n)) {
|
|
1199
1302
|
this.logger.error("Lead event requires a valid email attribute");
|
|
1200
1303
|
return;
|
|
1201
1304
|
}
|
|
1202
|
-
e.email =
|
|
1305
|
+
e.email = n, this.track("lead", e, t);
|
|
1203
1306
|
}
|
|
1204
1307
|
trackInternal(e, t, i = !1) {
|
|
1205
|
-
if (
|
|
1308
|
+
if (be()) {
|
|
1206
1309
|
this.logger.debug("Tracking disabled due to um_exclusion setting");
|
|
1207
1310
|
return;
|
|
1208
1311
|
}
|
|
1209
|
-
if (!
|
|
1312
|
+
if (!U(e))
|
|
1210
1313
|
throw new Error("Event name must be a string");
|
|
1211
1314
|
if (t !== void 0 && (typeof t != "object" || t === null || Array.isArray(t)))
|
|
1212
1315
|
throw new Error(
|
|
@@ -1224,12 +1327,12 @@ class N {
|
|
|
1224
1327
|
}
|
|
1225
1328
|
}
|
|
1226
1329
|
rawTrack(e) {
|
|
1227
|
-
if (!
|
|
1330
|
+
if (!S(e))
|
|
1228
1331
|
throw new Error("Event payload must be an object");
|
|
1229
1332
|
this.track("raw", e);
|
|
1230
1333
|
}
|
|
1231
1334
|
async group(e, t = !1) {
|
|
1232
|
-
if (!
|
|
1335
|
+
if (!S(e))
|
|
1233
1336
|
throw new Error("Company properties must be an object");
|
|
1234
1337
|
if (!e.id || !e.name || !e.created_at)
|
|
1235
1338
|
throw new Error(
|
|
@@ -1238,16 +1341,16 @@ class N {
|
|
|
1238
1341
|
this.persistence.set("companyProps", e), t || await this.track("group", e), this.logger.info("Company identified:", e);
|
|
1239
1342
|
}
|
|
1240
1343
|
createEventPayload(e, t) {
|
|
1241
|
-
const i = this.persistence.get("userProps") || {},
|
|
1242
|
-
let
|
|
1243
|
-
const
|
|
1244
|
-
event_id:
|
|
1344
|
+
const { event_id: i, ...n } = t || {}, r = this.persistence.get("userProps") || {}, o = this.persistence.get("companyProps") || (r == null ? void 0 : r.company) || {}, a = this.persistence.get("userId"), c = this.persistence.get("global_props") || {}, h = this.persistence.get(`props_${e}`) || {};
|
|
1345
|
+
let f = n;
|
|
1346
|
+
const l = {
|
|
1347
|
+
event_id: i || x(),
|
|
1245
1348
|
user: {
|
|
1246
1349
|
anonymous_id: this.anonymousId,
|
|
1247
|
-
id:
|
|
1248
|
-
...
|
|
1350
|
+
id: a,
|
|
1351
|
+
...r
|
|
1249
1352
|
},
|
|
1250
|
-
...
|
|
1353
|
+
...o && { company: o },
|
|
1251
1354
|
ids: this.getThirdPartyIds(),
|
|
1252
1355
|
utc_time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1253
1356
|
local_tz_offset: (/* @__PURE__ */ new Date()).getTimezoneOffset(),
|
|
@@ -1255,18 +1358,18 @@ class N {
|
|
|
1255
1358
|
src: "usermaven",
|
|
1256
1359
|
event_type: e,
|
|
1257
1360
|
namespace: this.namespace,
|
|
1258
|
-
...
|
|
1259
|
-
...
|
|
1361
|
+
...c,
|
|
1362
|
+
...h
|
|
1260
1363
|
};
|
|
1261
1364
|
if (e === "$autocapture") {
|
|
1262
|
-
const
|
|
1365
|
+
const g = this.processAutocaptureAttributes(
|
|
1263
1366
|
t || {}
|
|
1264
1367
|
);
|
|
1265
|
-
|
|
1266
|
-
} else e !== "user_identify" && e !== "group" && (Array.isArray(this.config.propertyBlacklist) && this.config.propertyBlacklist.forEach((
|
|
1267
|
-
delete
|
|
1268
|
-
}),
|
|
1269
|
-
return
|
|
1368
|
+
l.autocapture_attributes = g;
|
|
1369
|
+
} else e !== "user_identify" && e !== "group" && (Array.isArray(this.config.propertyBlacklist) && this.config.propertyBlacklist.forEach((g) => {
|
|
1370
|
+
delete f[g];
|
|
1371
|
+
}), l.event_attributes = f);
|
|
1372
|
+
return d() && (l.referer = document.referrer, l.url = window.location.href, l.page_title = document.title, l.doc_path = window.location.pathname, l.doc_host = window.location.hostname, l.doc_search = window.location.search, l.screen_resolution = `${window.screen.width}x${window.screen.height}`, l.vp_size = `${window.innerWidth}x${window.innerHeight}`, l.user_agent = navigator.userAgent, l.user_language = navigator.language, l.doc_encoding = document.characterSet, l.utm = this.getUtmParams()), l;
|
|
1270
1373
|
}
|
|
1271
1374
|
processAutocaptureAttributes(e) {
|
|
1272
1375
|
let t = {};
|
|
@@ -1279,8 +1382,8 @@ class N {
|
|
|
1279
1382
|
"$referrer",
|
|
1280
1383
|
"$referring_domain",
|
|
1281
1384
|
"$elements"
|
|
1282
|
-
].forEach((
|
|
1283
|
-
delete t[
|
|
1385
|
+
].forEach((n) => {
|
|
1386
|
+
delete t[n];
|
|
1284
1387
|
}), delete t.$el_text, delete t.nth_child, delete t.nth_of_type, t;
|
|
1285
1388
|
}
|
|
1286
1389
|
getCookie(e) {
|
|
@@ -1289,26 +1392,26 @@ class N {
|
|
|
1289
1392
|
}
|
|
1290
1393
|
getThirdPartyIds() {
|
|
1291
1394
|
const e = {};
|
|
1292
|
-
if (
|
|
1395
|
+
if (d()) {
|
|
1293
1396
|
const t = this.getCookie("_fbp");
|
|
1294
1397
|
t && (e.fbp = t);
|
|
1295
1398
|
}
|
|
1296
1399
|
return e;
|
|
1297
1400
|
}
|
|
1298
1401
|
getUtmParams() {
|
|
1299
|
-
const e = {}, t =
|
|
1402
|
+
const e = {}, t = ke(window.location.search);
|
|
1300
1403
|
return [
|
|
1301
1404
|
"utm_source",
|
|
1302
1405
|
"utm_medium",
|
|
1303
1406
|
"utm_campaign",
|
|
1304
1407
|
"utm_term",
|
|
1305
1408
|
"utm_content"
|
|
1306
|
-
].forEach((
|
|
1307
|
-
t[
|
|
1409
|
+
].forEach((n) => {
|
|
1410
|
+
t[n] && (e[n.replace("utm_", "")] = t[n]);
|
|
1308
1411
|
}), e;
|
|
1309
1412
|
}
|
|
1310
1413
|
pageview() {
|
|
1311
|
-
|
|
1414
|
+
d() ? this.track(
|
|
1312
1415
|
"pageview",
|
|
1313
1416
|
{
|
|
1314
1417
|
url: window.location.href,
|
|
@@ -1321,7 +1424,7 @@ class N {
|
|
|
1321
1424
|
);
|
|
1322
1425
|
}
|
|
1323
1426
|
setupPageLeaveTracking() {
|
|
1324
|
-
if (!
|
|
1427
|
+
if (!d()) return;
|
|
1325
1428
|
let e = !1, t = !1;
|
|
1326
1429
|
const i = () => {
|
|
1327
1430
|
!e && !t && (e = !0, this.track("$pageleave", {
|
|
@@ -1337,9 +1440,9 @@ class N {
|
|
|
1337
1440
|
}), document.addEventListener("visibilitychange", () => {
|
|
1338
1441
|
document.visibilityState === "hidden" && !t && i();
|
|
1339
1442
|
});
|
|
1340
|
-
const
|
|
1443
|
+
const n = history.pushState;
|
|
1341
1444
|
history.pushState = function() {
|
|
1342
|
-
return i(),
|
|
1445
|
+
return i(), n.apply(this, arguments);
|
|
1343
1446
|
}, window.addEventListener("popstate", i);
|
|
1344
1447
|
}
|
|
1345
1448
|
getConfig() {
|
|
@@ -1359,9 +1462,9 @@ class N {
|
|
|
1359
1462
|
});
|
|
1360
1463
|
}
|
|
1361
1464
|
set(e, t) {
|
|
1362
|
-
if (!
|
|
1465
|
+
if (!S(e))
|
|
1363
1466
|
throw new Error("Properties must be an object");
|
|
1364
|
-
const i = t == null ? void 0 : t.eventType,
|
|
1467
|
+
const i = t == null ? void 0 : t.eventType, n = (t == null ? void 0 : t.persist) ?? !0;
|
|
1365
1468
|
if (i) {
|
|
1366
1469
|
let r = this.persistence.get(`props_${i}`) || {};
|
|
1367
1470
|
r = { ...r, ...e }, this.persistence.set(`props_${i}`, r);
|
|
@@ -1369,10 +1472,10 @@ class N {
|
|
|
1369
1472
|
let r = this.persistence.get("global_props") || {};
|
|
1370
1473
|
r = { ...r, ...e }, this.persistence.set("global_props", r);
|
|
1371
1474
|
}
|
|
1372
|
-
|
|
1475
|
+
n && this.persistence.save(), this.logger.debug("Properties set", {
|
|
1373
1476
|
properties: e,
|
|
1374
1477
|
eventType: i || "global",
|
|
1375
|
-
persist:
|
|
1478
|
+
persist: n
|
|
1376
1479
|
});
|
|
1377
1480
|
}
|
|
1378
1481
|
setUserId(e) {
|
|
@@ -1381,7 +1484,7 @@ class N {
|
|
|
1381
1484
|
t.id = e, this.persistence.set("userProps", t), this.persistence.save();
|
|
1382
1485
|
}
|
|
1383
1486
|
unset(e, t) {
|
|
1384
|
-
const i = t == null ? void 0 : t.eventType,
|
|
1487
|
+
const i = t == null ? void 0 : t.eventType, n = (t == null ? void 0 : t.persist) ?? !0;
|
|
1385
1488
|
if (i) {
|
|
1386
1489
|
let r = this.persistence.get(`props_${i}`) || {};
|
|
1387
1490
|
delete r[e], this.persistence.set(`props_${i}`, r);
|
|
@@ -1389,7 +1492,7 @@ class N {
|
|
|
1389
1492
|
let r = this.persistence.get("global_props") || {};
|
|
1390
1493
|
delete r[e], this.persistence.set("global_props", r);
|
|
1391
1494
|
}
|
|
1392
|
-
|
|
1495
|
+
n && this.persistence.save(), this.logger.debug(
|
|
1393
1496
|
`Property unset: ${e}`,
|
|
1394
1497
|
`Event type: ${i || "global"}`
|
|
1395
1498
|
);
|
|
@@ -1398,105 +1501,105 @@ class N {
|
|
|
1398
1501
|
function ie() {
|
|
1399
1502
|
return typeof window < "u" && typeof window.define == "function" && window.define.amd;
|
|
1400
1503
|
}
|
|
1401
|
-
function
|
|
1504
|
+
function xe() {
|
|
1402
1505
|
return ie() ? window.define : void 0;
|
|
1403
1506
|
}
|
|
1404
|
-
const
|
|
1405
|
-
function
|
|
1406
|
-
const e = JSON.parse(JSON.stringify(
|
|
1407
|
-
...
|
|
1507
|
+
const Te = "__USERMAVEN_AUTOCAPTURE_INITIALIZED__";
|
|
1508
|
+
function L(s) {
|
|
1509
|
+
const e = JSON.parse(JSON.stringify(s)), t = Q(e), i = {
|
|
1510
|
+
...Y,
|
|
1408
1511
|
...t
|
|
1409
1512
|
};
|
|
1410
1513
|
if (!i.key)
|
|
1411
1514
|
throw new Error("API key is required!");
|
|
1412
1515
|
if (!i.trackingHost)
|
|
1413
1516
|
throw new Error("Tracking host is required!");
|
|
1414
|
-
const
|
|
1415
|
-
return
|
|
1517
|
+
const n = i.key || "", r = `${Te}${n}`;
|
|
1518
|
+
return d() && i.autocapture && window[r] && (console.warn(
|
|
1416
1519
|
"Usermaven: Autocapture already initialized in another instance, skipping duplicate initialization."
|
|
1417
|
-
), i.disableAutocaptureListenerRegistration = !0),
|
|
1520
|
+
), i.disableAutocaptureListenerRegistration = !0), d() && i.autocapture && !i.disableAutocaptureListenerRegistration && (window[r] = !0), new R(i);
|
|
1418
1521
|
}
|
|
1419
|
-
function
|
|
1420
|
-
var
|
|
1522
|
+
function He(s) {
|
|
1523
|
+
var n;
|
|
1421
1524
|
const e = {
|
|
1422
|
-
key:
|
|
1423
|
-
trackingHost:
|
|
1424
|
-
logLevel:
|
|
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(
|
|
1525
|
+
key: s.getAttribute("data-key") || void 0,
|
|
1526
|
+
trackingHost: s.getAttribute("data-tracking-host") || "https://events.usermaven.com",
|
|
1527
|
+
logLevel: ve(s.getAttribute("data-log-level")),
|
|
1528
|
+
autocapture: s.getAttribute("data-autocapture") === "true",
|
|
1529
|
+
formTracking: s.getAttribute("data-form-tracking") === "false" ? !1 : s.getAttribute("data-form-tracking") === "true" ? "all" : s.getAttribute("data-form-tracking"),
|
|
1530
|
+
autoPageview: s.getAttribute("data-auto-pageview") === "true",
|
|
1531
|
+
useBeaconApi: s.getAttribute("data-use-beacon-api") === "true",
|
|
1532
|
+
forceUseFetch: s.getAttribute("data-force-use-fetch") === "true",
|
|
1533
|
+
gaHook: s.getAttribute("data-ga-hook") === "true",
|
|
1534
|
+
segmentHook: s.getAttribute("data-segment-hook") === "true",
|
|
1535
|
+
randomizeUrl: s.getAttribute("data-randomize-url") === "true",
|
|
1536
|
+
capture3rdPartyCookies: s.getAttribute("data-capture-3rd-party-cookies") === "false" ? !1 : void 0,
|
|
1537
|
+
idMethod: s.getAttribute("data-id-method") || void 0,
|
|
1538
|
+
privacyPolicy: s.getAttribute("data-privacy-policy") === "strict" ? "strict" : void 0,
|
|
1539
|
+
ipPolicy: s.getAttribute("data-ip-policy") || void 0,
|
|
1540
|
+
cookiePolicy: s.getAttribute("data-cookie-policy") || void 0,
|
|
1541
|
+
minSendTimeout: parseInt(s.getAttribute("data-min-send-timeout") || "", 10) || void 0,
|
|
1542
|
+
maxSendTimeout: parseInt(s.getAttribute("data-max-send-timeout") || "", 10) || void 0,
|
|
1543
|
+
maxSendAttempts: parseInt(s.getAttribute("data-max-send-attempts") || "", 10) || void 0,
|
|
1441
1544
|
propertiesStringMaxLength: parseInt(
|
|
1442
|
-
|
|
1545
|
+
s.getAttribute("data-properties-string-max-length") || "",
|
|
1443
1546
|
10
|
|
1444
1547
|
) || null,
|
|
1445
|
-
propertyBlacklist: ((
|
|
1446
|
-
exclude:
|
|
1447
|
-
namespace:
|
|
1448
|
-
crossDomainLinking:
|
|
1449
|
-
domains:
|
|
1450
|
-
maskAllText:
|
|
1451
|
-
maskAllElementAttributes:
|
|
1548
|
+
propertyBlacklist: ((n = s.getAttribute("data-property-blacklist")) == null ? void 0 : n.split(",")) || void 0,
|
|
1549
|
+
exclude: s.getAttribute("data-exclude") || void 0,
|
|
1550
|
+
namespace: s.getAttribute("data-namespace") || void 0,
|
|
1551
|
+
crossDomainLinking: s.getAttribute("data-cross-domain-linking") !== "false",
|
|
1552
|
+
domains: s.getAttribute("data-domains") || void 0,
|
|
1553
|
+
maskAllText: s.getAttribute("data-mask-all-text") === "true",
|
|
1554
|
+
maskAllElementAttributes: s.getAttribute("data-mask-all-element-attributes") === "true"
|
|
1452
1555
|
};
|
|
1453
1556
|
e.privacyPolicy === "strict" && (e.cookiePolicy = "strict", e.ipPolicy = "strict"), e.cookiePolicy === "comply" && e.useBeaconApi && (e.cookiePolicy = "strict");
|
|
1454
|
-
const t =
|
|
1455
|
-
return
|
|
1557
|
+
const t = L(e), i = e.namespace || "usermaven";
|
|
1558
|
+
return d() && t.pageview(), Ie(i, t), t;
|
|
1456
1559
|
}
|
|
1457
|
-
function
|
|
1560
|
+
function Ie(s, e) {
|
|
1458
1561
|
let t = !1;
|
|
1459
|
-
const i = [],
|
|
1562
|
+
const i = [], n = [];
|
|
1460
1563
|
function r() {
|
|
1461
1564
|
for (; i.length > 0; ) {
|
|
1462
1565
|
const u = i.shift();
|
|
1463
1566
|
if (u) {
|
|
1464
|
-
const
|
|
1465
|
-
if (
|
|
1466
|
-
const
|
|
1567
|
+
const m = u[u.length - 1];
|
|
1568
|
+
if (m && typeof m.resolve == "function") {
|
|
1569
|
+
const y = u.pop();
|
|
1467
1570
|
try {
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1470
|
-
} catch (
|
|
1471
|
-
|
|
1571
|
+
const P = a.apply(null, u);
|
|
1572
|
+
P && typeof P.then == "function" ? P.then(y.resolve).catch(y.reject) : y.resolve(P);
|
|
1573
|
+
} catch (P) {
|
|
1574
|
+
y.reject(P);
|
|
1472
1575
|
}
|
|
1473
1576
|
} else
|
|
1474
1577
|
try {
|
|
1475
1578
|
a.apply(null, u);
|
|
1476
|
-
} catch (
|
|
1477
|
-
console.error("Usermaven: Error processing queued command:",
|
|
1579
|
+
} catch (y) {
|
|
1580
|
+
console.error("Usermaven: Error processing queued command:", y);
|
|
1478
1581
|
}
|
|
1479
1582
|
}
|
|
1480
1583
|
}
|
|
1481
1584
|
}
|
|
1482
1585
|
function o() {
|
|
1483
|
-
|
|
1586
|
+
n.forEach((u) => u()), n.length = 0;
|
|
1484
1587
|
}
|
|
1485
1588
|
function a(...u) {
|
|
1486
|
-
const
|
|
1487
|
-
if (
|
|
1488
|
-
typeof u[1] == "function" && (t ? u[1]() :
|
|
1589
|
+
const m = u[0];
|
|
1590
|
+
if (m === "onLoad") {
|
|
1591
|
+
typeof u[1] == "function" && (t ? u[1]() : n.push(u[1]));
|
|
1489
1592
|
return;
|
|
1490
1593
|
}
|
|
1491
1594
|
if (!t) {
|
|
1492
1595
|
i.push(u);
|
|
1493
1596
|
return;
|
|
1494
1597
|
}
|
|
1495
|
-
if (typeof e[
|
|
1496
|
-
return e[
|
|
1497
|
-
console.error(`Method ${
|
|
1598
|
+
if (typeof e[m] == "function")
|
|
1599
|
+
return e[m].apply(e, u.slice(1));
|
|
1600
|
+
console.error(`Method ${m} not found on UsermavenClient`);
|
|
1498
1601
|
}
|
|
1499
|
-
const
|
|
1602
|
+
const c = ["id", "group", "reset"], h = [
|
|
1500
1603
|
"track",
|
|
1501
1604
|
"lead",
|
|
1502
1605
|
"pageview",
|
|
@@ -1505,61 +1608,61 @@ function He(n, e) {
|
|
|
1505
1608
|
"rawTrack",
|
|
1506
1609
|
"setUserId"
|
|
1507
1610
|
];
|
|
1508
|
-
[...
|
|
1509
|
-
a[u] = function(...
|
|
1611
|
+
[...c, ...h].forEach((u) => {
|
|
1612
|
+
a[u] = function(...m) {
|
|
1510
1613
|
if (!t) {
|
|
1511
|
-
if (
|
|
1512
|
-
return new Promise((
|
|
1513
|
-
i.push([u, ...
|
|
1614
|
+
if (c.includes(u))
|
|
1615
|
+
return new Promise((M, y) => {
|
|
1616
|
+
i.push([u, ...m, { resolve: M, reject: y }]);
|
|
1514
1617
|
});
|
|
1515
|
-
i.push([u, ...
|
|
1618
|
+
i.push([u, ...m]);
|
|
1516
1619
|
return;
|
|
1517
1620
|
}
|
|
1518
1621
|
if (typeof e[u] == "function")
|
|
1519
|
-
return e[u].apply(e,
|
|
1622
|
+
return e[u].apply(e, m);
|
|
1520
1623
|
};
|
|
1521
1624
|
}), a.getConfig = function() {
|
|
1522
1625
|
return t ? e.getConfig() : (console.warn("Usermaven client not ready yet"), null);
|
|
1523
|
-
}, window[
|
|
1524
|
-
const
|
|
1525
|
-
for (window[
|
|
1626
|
+
}, window[s] = a;
|
|
1627
|
+
const l = `${s}Q`, g = window[l] || [];
|
|
1628
|
+
for (window[l] = g, g.push = function(...u) {
|
|
1526
1629
|
return a.apply(null, u), Array.prototype.push.apply(this, u);
|
|
1527
1630
|
}, setTimeout(() => {
|
|
1528
|
-
t = !0, r(), o(), console.log(`Usermaven client for namespace ${
|
|
1529
|
-
}, 0);
|
|
1530
|
-
const u =
|
|
1631
|
+
t = !0, r(), o(), console.log(`Usermaven client for namespace ${s} is ready`);
|
|
1632
|
+
}, 0); g.length > 0; ) {
|
|
1633
|
+
const u = g.shift();
|
|
1531
1634
|
u && i.push(u);
|
|
1532
1635
|
}
|
|
1533
1636
|
}
|
|
1534
|
-
let
|
|
1535
|
-
if (
|
|
1536
|
-
const
|
|
1537
|
-
|
|
1637
|
+
let Z = !1, B = null;
|
|
1638
|
+
if (d()) {
|
|
1639
|
+
const s = xe();
|
|
1640
|
+
s && s("usermaven", [], function() {
|
|
1538
1641
|
return {
|
|
1539
|
-
usermavenClient:
|
|
1540
|
-
UsermavenClient:
|
|
1541
|
-
LogLevel:
|
|
1642
|
+
usermavenClient: L,
|
|
1643
|
+
UsermavenClient: R,
|
|
1644
|
+
LogLevel: _,
|
|
1542
1645
|
// Expose the script tag client if it exists
|
|
1543
|
-
getScriptTagClient: () =>
|
|
1646
|
+
getScriptTagClient: () => B
|
|
1544
1647
|
};
|
|
1545
|
-
}), typeof window < "u" && (window.usermavenClient =
|
|
1648
|
+
}), typeof window < "u" && (window.usermavenClient = L, window.UsermavenClient = R, window.usermavenScriptTagClient = () => B), function(e, t) {
|
|
1546
1649
|
const i = e.currentScript;
|
|
1547
|
-
function
|
|
1548
|
-
return
|
|
1650
|
+
function n() {
|
|
1651
|
+
return Z || !i || !i.hasAttribute("data-key") || i.getAttribute("data-no-auto-init") === "true" ? !1 : i.src.includes("lib.js");
|
|
1549
1652
|
}
|
|
1550
1653
|
function r() {
|
|
1551
|
-
|
|
1654
|
+
n() && (console.log("[Usermaven] Auto-initializing from script tag"), B = He(i), Z = !0);
|
|
1552
1655
|
}
|
|
1553
1656
|
typeof t < "u" && i && (e.readyState === "loading" ? e.addEventListener("DOMContentLoaded", r) : r());
|
|
1554
1657
|
}(document, window);
|
|
1555
1658
|
}
|
|
1556
1659
|
typeof module < "u" && module.exports && !ie() && (module.exports = {
|
|
1557
|
-
usermavenClient:
|
|
1558
|
-
UsermavenClient:
|
|
1660
|
+
usermavenClient: L,
|
|
1661
|
+
UsermavenClient: R,
|
|
1559
1662
|
Config: void 0,
|
|
1560
1663
|
UserProps: void 0,
|
|
1561
1664
|
EventPayload: void 0,
|
|
1562
|
-
LogLevel:
|
|
1665
|
+
LogLevel: _,
|
|
1563
1666
|
ClientProperties: void 0
|
|
1564
1667
|
});
|
|
1565
1668
|
|
|
@@ -1567,7 +1670,7 @@ function createClient(params) {
|
|
|
1567
1670
|
if (typeof window === 'undefined') {
|
|
1568
1671
|
return null;
|
|
1569
1672
|
}
|
|
1570
|
-
return
|
|
1673
|
+
return L(params);
|
|
1571
1674
|
}
|
|
1572
1675
|
|
|
1573
1676
|
/******************************************************************************
|