@usermaven/react 1.5.10-rc.112 → 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 +305 -268
- package/package.json +2 -2
package/lib/index.es.js
CHANGED
|
@@ -8,7 +8,7 @@ const UsermavenProvider = ({ children, client }) => {
|
|
|
8
8
|
return React.createElement(Context.Provider, { value: client }, children);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
var
|
|
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
12
|
class se {
|
|
13
13
|
constructor(e) {
|
|
14
14
|
this.level = e;
|
|
@@ -26,11 +26,11 @@ class se {
|
|
|
26
26
|
this.level <= 3 && console.error("[Usermaven Error]:", e, ...t);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function p(s = 0) {
|
|
30
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",
|
|
@@ -68,8 +68,8 @@ class ne {
|
|
|
68
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(";");
|
|
@@ -110,35 +110,35 @@ class ne {
|
|
|
110
110
|
return i ? i[0] : "";
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
const re = Object.prototype, oe = re.hasOwnProperty, ae = Array.prototype,
|
|
113
|
+
const re = Object.prototype, oe = re.hasOwnProperty, ae = Array.prototype, I = ae.forEach, F = {};
|
|
114
114
|
function ce(s, e, t) {
|
|
115
115
|
if (Array.isArray(s)) {
|
|
116
|
-
if (
|
|
116
|
+
if (I && s.forEach === I)
|
|
117
117
|
s.forEach(e, t);
|
|
118
118
|
else if ("length" in s && s.length === +s.length) {
|
|
119
119
|
for (let i = 0, n = s.length; i < n; i++)
|
|
120
|
-
if (i in s && e.call(t, s[i], i) ===
|
|
120
|
+
if (i in s && e.call(t, s[i], i) === F)
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
const
|
|
125
|
+
const v = function(s) {
|
|
126
126
|
return s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
127
127
|
}, le = function(s) {
|
|
128
128
|
for (const e in s)
|
|
129
129
|
typeof s[e] == "function" && (s[e] = s[e].bind(s));
|
|
130
130
|
};
|
|
131
|
-
function
|
|
131
|
+
function k(s, e, t) {
|
|
132
132
|
if (s != null) {
|
|
133
|
-
if (
|
|
133
|
+
if (I && Array.isArray(s) && s.forEach === I)
|
|
134
134
|
s.forEach(e, t);
|
|
135
135
|
else if ("length" in s && s.length === +s.length) {
|
|
136
136
|
for (let i = 0, n = s.length; i < n; i++)
|
|
137
|
-
if (i in s && e.call(t, s[i], i) ===
|
|
137
|
+
if (i in s && e.call(t, s[i], i) === F)
|
|
138
138
|
return;
|
|
139
139
|
} else
|
|
140
140
|
for (const i in s)
|
|
141
|
-
if (oe.call(s, i) && e.call(t, s[i], i) ===
|
|
141
|
+
if (oe.call(s, i) && e.call(t, s[i], i) === F)
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -148,7 +148,7 @@ const ue = function(s, ...e) {
|
|
|
148
148
|
t[i] !== void 0 && (s[i] = t[i]);
|
|
149
149
|
}), s;
|
|
150
150
|
};
|
|
151
|
-
function
|
|
151
|
+
function $(s, e) {
|
|
152
152
|
return s.indexOf(e) !== -1;
|
|
153
153
|
}
|
|
154
154
|
const he = function(s) {
|
|
@@ -159,27 +159,27 @@ const he = function(s) {
|
|
|
159
159
|
}
|
|
160
160
|
}, de = function(s) {
|
|
161
161
|
return s === void 0;
|
|
162
|
-
},
|
|
162
|
+
}, A = function() {
|
|
163
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
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
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) {
|
|
@@ -190,53 +190,53 @@ const he = function(s) {
|
|
|
190
190
|
}, t.stopPropagation = function() {
|
|
191
191
|
this.cancelBubble = !0;
|
|
192
192
|
}, s;
|
|
193
|
-
}(),
|
|
193
|
+
}(), fe = function(s) {
|
|
194
194
|
return function(...e) {
|
|
195
195
|
try {
|
|
196
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
|
-
},
|
|
204
|
+
}, G = function(s) {
|
|
205
205
|
for (const e in s)
|
|
206
|
-
typeof s[e] == "function" && (s[e] =
|
|
206
|
+
typeof s[e] == "function" && (s[e] = fe(s[e]));
|
|
207
207
|
};
|
|
208
|
-
function
|
|
208
|
+
function V(s) {
|
|
209
209
|
for (let e in s)
|
|
210
210
|
(s[e] === "" || s[e] === null || s[e] === void 0 || typeof s[e] == "object" && Object.keys(s[e]).length === 0) && delete s[e];
|
|
211
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
|
|
220
|
+
function E(s = 5) {
|
|
221
221
|
const e = new Uint8Array(s);
|
|
222
222
|
return crypto.getRandomValues(e), Array.from(e, (t) => t.toString(36).padStart(2, "0")).join("").slice(0, s);
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function ge(s) {
|
|
225
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 s != "object" || s === null ? s : Array.isArray(s) ? s.map(
|
|
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
|
-
const i =
|
|
234
|
-
return e[i] =
|
|
233
|
+
const i = ge(t);
|
|
234
|
+
return e[i] = Q(s[t]), e;
|
|
235
235
|
},
|
|
236
236
|
{}
|
|
237
237
|
);
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function O(s) {
|
|
240
240
|
switch (typeof s.className) {
|
|
241
241
|
case "string":
|
|
242
242
|
return s.className;
|
|
@@ -246,25 +246,25 @@ function x(s) {
|
|
|
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
|
|
255
|
+
function b(s) {
|
|
256
256
|
return !!s && s.nodeType === 1;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function w(s, e) {
|
|
259
259
|
return !!s && !!s.tagName && s.tagName.toLowerCase() === e.toLowerCase();
|
|
260
260
|
}
|
|
261
261
|
function j(s) {
|
|
262
262
|
return !!s && s.nodeType === 3;
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function q(s) {
|
|
265
265
|
return !!s && s.nodeType === 11;
|
|
266
266
|
}
|
|
267
|
-
const
|
|
267
|
+
const T = [
|
|
268
268
|
"a",
|
|
269
269
|
"button",
|
|
270
270
|
"form",
|
|
@@ -274,34 +274,36 @@ const C = [
|
|
|
274
274
|
"label"
|
|
275
275
|
];
|
|
276
276
|
function pe(s, e) {
|
|
277
|
-
|
|
277
|
+
var o, a;
|
|
278
|
+
if (!s || w(s, "html") || !b(s))
|
|
278
279
|
return !1;
|
|
279
280
|
let t = s;
|
|
280
|
-
for (; t && !
|
|
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 = s; 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
302
|
const n = window.getComputedStyle(s);
|
|
302
303
|
if (n && n.getPropertyValue("cursor") === "pointer" && e.type === "click")
|
|
303
304
|
return !0;
|
|
304
|
-
const r = s.tagName.toLowerCase();
|
|
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,16 +315,16 @@ function pe(s, 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 = s; i.parentNode && !
|
|
321
|
-
const n =
|
|
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
329
|
const e = s.type || "";
|
|
328
330
|
if (typeof e == "string")
|
|
@@ -337,21 +339,49 @@ function q(s) {
|
|
|
337
339
|
}
|
|
338
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 !(s === null || de(s) || typeof s == "string" && (s =
|
|
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
347
|
function me(s) {
|
|
346
348
|
return typeof s == "string" ? s.substring(0, 10) === "_ngcontent" || s.substring(0, 7) === "_nghost" : !1;
|
|
347
349
|
}
|
|
348
|
-
function
|
|
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;
|
|
350
377
|
}
|
|
351
|
-
function
|
|
378
|
+
function x() {
|
|
379
|
+
return E(10);
|
|
380
|
+
}
|
|
381
|
+
function W(s) {
|
|
352
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
387
|
const n = () => {
|
|
@@ -360,7 +390,7 @@ function ye(s, e) {
|
|
|
360
390
|
clearTimeout(t), t = setTimeout(n, e);
|
|
361
391
|
};
|
|
362
392
|
}
|
|
363
|
-
function
|
|
393
|
+
function ke(s) {
|
|
364
394
|
const e = {}, t = s.replace(/^\?/, "").split("&");
|
|
365
395
|
for (let i = 0; i < t.length; i++) {
|
|
366
396
|
const n = t[i].split("=");
|
|
@@ -368,25 +398,25 @@ function we(s) {
|
|
|
368
398
|
}
|
|
369
399
|
return e;
|
|
370
400
|
}
|
|
371
|
-
function
|
|
401
|
+
function U(s) {
|
|
372
402
|
return typeof s == "string" || s instanceof String;
|
|
373
403
|
}
|
|
374
|
-
function
|
|
404
|
+
function S(s) {
|
|
375
405
|
return s !== null && typeof s == "object" && s.constructor === Object;
|
|
376
406
|
}
|
|
377
|
-
function
|
|
407
|
+
function ve(s) {
|
|
378
408
|
if (s === null)
|
|
379
|
-
return
|
|
380
|
-
const e = s.toUpperCase(), t =
|
|
381
|
-
return t || t === 0 ? t :
|
|
409
|
+
return _.ERROR;
|
|
410
|
+
const e = s.toUpperCase(), t = _[e];
|
|
411
|
+
return t || t === 0 ? t : _.ERROR;
|
|
382
412
|
}
|
|
383
|
-
const
|
|
413
|
+
const be = () => {
|
|
384
414
|
let s = "false";
|
|
385
415
|
return typeof window < "u" && window.localStorage && (s = localStorage.getItem("um_exclusion")), !(s == null || s === "false");
|
|
386
416
|
};
|
|
387
|
-
class
|
|
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);
|
|
@@ -440,9 +470,9 @@ class be {
|
|
|
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
|
|
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 N = class N {
|
|
|
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) {
|
|
@@ -485,59 +515,66 @@ const N = class N {
|
|
|
485
515
|
return (i = this.scrollDepth) == null || i.track(), !0;
|
|
486
516
|
if (e.type === "visibilitychange" && document.visibilityState === "hidden" || e.type === "popstate")
|
|
487
517
|
return this.isPageRefresh() || (n = this.scrollDepth) == null || n.send(), !0;
|
|
488
|
-
if (t && pe(t, e)) {
|
|
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
|
-
|
|
562
|
+
return k(this.customProperties, (i) => {
|
|
563
|
+
k(i.event_selectors, (n) => {
|
|
527
564
|
const r = document.querySelectorAll(n);
|
|
528
|
-
|
|
529
|
-
|
|
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
576
|
let n;
|
|
540
|
-
["input", "select"].indexOf(i.tagName.toLowerCase()) > -1 ? n = i.value : i.textContent && (n = i.textContent),
|
|
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
|
}
|
|
@@ -549,17 +586,17 @@ const N = class N {
|
|
|
549
586
|
const n = e.tagName.toLowerCase(), r = {
|
|
550
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 N = class N {
|
|
|
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
|
}
|
|
@@ -590,9 +627,9 @@ const N = class N {
|
|
|
590
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,8 +658,8 @@ class _e {
|
|
|
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) {
|
|
@@ -637,14 +674,14 @@ 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}` : "", n =
|
|
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) {
|
|
@@ -661,8 +698,8 @@ class W {
|
|
|
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}` : "", n =
|
|
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,8 +708,8 @@ 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) {
|
|
@@ -680,8 +717,8 @@ class Pe {
|
|
|
680
717
|
const n = new XMLHttpRequest(), r = this.config.key, o = this.constructUrl(r);
|
|
681
718
|
n.open("POST", o, !0), n.setRequestHeader("Content-Type", "application/json");
|
|
682
719
|
const a = this.getCustomHeaders();
|
|
683
|
-
Object.keys(a).forEach((
|
|
684
|
-
n.setRequestHeader(
|
|
720
|
+
Object.keys(a).forEach((c) => {
|
|
721
|
+
n.setRequestHeader(c, a[c]);
|
|
685
722
|
}), n.onload = () => {
|
|
686
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}`));
|
|
687
724
|
}, n.onerror = () => {
|
|
@@ -690,8 +727,8 @@ class Pe {
|
|
|
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}` : "", n =
|
|
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.storageDisabled = !1, this.quotaErrorLogged = !1, this.prefix = `usermaven_${e}_`, this.logger = t ||
|
|
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();
|
|
@@ -720,7 +757,7 @@ class te {
|
|
|
720
757
|
return !this.storageDisabled;
|
|
721
758
|
}
|
|
722
759
|
load() {
|
|
723
|
-
if (!
|
|
760
|
+
if (!d()) {
|
|
724
761
|
this.logger.warn("localStorage is not available in this environment");
|
|
725
762
|
return;
|
|
726
763
|
}
|
|
@@ -732,7 +769,7 @@ class te {
|
|
|
732
769
|
}
|
|
733
770
|
}
|
|
734
771
|
save() {
|
|
735
|
-
if (!
|
|
772
|
+
if (!d())
|
|
736
773
|
return this.logger.warn("localStorage is not available in this environment"), !1;
|
|
737
774
|
if (this.storageDisabled)
|
|
738
775
|
return !1;
|
|
@@ -772,11 +809,11 @@ class Se {
|
|
|
772
809
|
this.storage = {};
|
|
773
810
|
}
|
|
774
811
|
}
|
|
775
|
-
class
|
|
776
|
-
constructor(e, t = 3, i = 1e3, n = 10, r = 1e3, o =
|
|
812
|
+
class X {
|
|
813
|
+
constructor(e, t = 3, i = 1e3, n = 10, r = 1e3, o = p(), a = "default", c = 1e3, h = 25e5) {
|
|
777
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(
|
|
778
815
|
`offline_queue_${a}`
|
|
779
|
-
), this.maxQueueItems =
|
|
816
|
+
), this.maxQueueItems = c, this.maxQueueBytes = h, d() && (this.isOnline = navigator.onLine, this.loadQueueFromStorage(), this.initNetworkListeners(), this.scheduleBatch());
|
|
780
817
|
}
|
|
781
818
|
add(e) {
|
|
782
819
|
const t = {
|
|
@@ -784,23 +821,23 @@ class K {
|
|
|
784
821
|
retries: 0,
|
|
785
822
|
timestamp: Date.now()
|
|
786
823
|
};
|
|
787
|
-
t.bytes = this.estimateItemBytes(t), this.queue.push(t), this.totalQueueBytes += t.bytes, this.enforceQueueLimits(),
|
|
824
|
+
t.bytes = this.estimateItemBytes(t), this.queue.push(t), this.totalQueueBytes += t.bytes, this.enforceQueueLimits(), d() ? this.saveQueueToStorage() : this.processBatch();
|
|
788
825
|
}
|
|
789
826
|
initNetworkListeners() {
|
|
790
|
-
|
|
827
|
+
d() && (window.addEventListener("online", () => {
|
|
791
828
|
this.isOnline = !0, this.processBatch();
|
|
792
829
|
}), window.addEventListener("offline", () => {
|
|
793
830
|
this.isOnline = !1;
|
|
794
831
|
}));
|
|
795
832
|
}
|
|
796
833
|
scheduleBatch() {
|
|
797
|
-
|
|
834
|
+
d() && (this.batchTimeoutId !== null && clearTimeout(this.batchTimeoutId), this.batchTimeoutId = window.setTimeout(
|
|
798
835
|
() => this.processBatch(),
|
|
799
836
|
this.batchInterval
|
|
800
837
|
));
|
|
801
838
|
}
|
|
802
839
|
async processBatch() {
|
|
803
|
-
if ((!
|
|
840
|
+
if ((!d() || this.isOnline) && !this.processing && this.queue.length > 0) {
|
|
804
841
|
this.processing = !0;
|
|
805
842
|
const e = this.queue.splice(0, this.batchSize);
|
|
806
843
|
this.totalQueueBytes = Math.max(
|
|
@@ -811,13 +848,13 @@ class K {
|
|
|
811
848
|
try {
|
|
812
849
|
await this.transport.send(t), this.logger.debug(
|
|
813
850
|
`Successfully sent batch of ${e.length} payloads`
|
|
814
|
-
),
|
|
851
|
+
), d() && this.saveQueueToStorage();
|
|
815
852
|
} catch (i) {
|
|
816
853
|
this.logger.error("Failed to send batch", i), await this.handleBatchFailure(e);
|
|
817
854
|
}
|
|
818
855
|
this.processing = !1;
|
|
819
856
|
}
|
|
820
|
-
|
|
857
|
+
d() && this.scheduleBatch();
|
|
821
858
|
}
|
|
822
859
|
async handleBatchFailure(e) {
|
|
823
860
|
for (const t of e)
|
|
@@ -825,7 +862,7 @@ class K {
|
|
|
825
862
|
"Max retries reached, discarding payload",
|
|
826
863
|
t.payload
|
|
827
864
|
);
|
|
828
|
-
|
|
865
|
+
d() && (this.saveQueueToStorage(), await new Promise((t) => setTimeout(t, this.retryInterval)));
|
|
829
866
|
}
|
|
830
867
|
enforceQueueLimits() {
|
|
831
868
|
if (this.maxQueueItems > 0 && this.queue.length > this.maxQueueItems) {
|
|
@@ -858,7 +895,7 @@ class K {
|
|
|
858
895
|
}
|
|
859
896
|
}
|
|
860
897
|
loadQueueFromStorage() {
|
|
861
|
-
if (
|
|
898
|
+
if (d()) {
|
|
862
899
|
const e = this.persistence.get("queue");
|
|
863
900
|
if (!e) return;
|
|
864
901
|
try {
|
|
@@ -876,15 +913,15 @@ class K {
|
|
|
876
913
|
}
|
|
877
914
|
}
|
|
878
915
|
saveQueueToStorage() {
|
|
879
|
-
if (
|
|
916
|
+
if (d()) {
|
|
880
917
|
const e = this.queue.map(({ bytes: t, ...i }) => i);
|
|
881
918
|
this.persistence.set("queue", JSON.stringify(e));
|
|
882
919
|
}
|
|
883
920
|
}
|
|
884
921
|
}
|
|
885
|
-
class
|
|
922
|
+
class Ce {
|
|
886
923
|
constructor(e) {
|
|
887
|
-
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);
|
|
888
925
|
}
|
|
889
926
|
initializeEventListener() {
|
|
890
927
|
document.addEventListener("click", this.handleClick.bind(this));
|
|
@@ -920,8 +957,8 @@ class Ae {
|
|
|
920
957
|
}), this.clicks = [];
|
|
921
958
|
}
|
|
922
959
|
}
|
|
923
|
-
class
|
|
924
|
-
constructor(e, t, i =
|
|
960
|
+
class $e {
|
|
961
|
+
constructor(e, t, i = p()) {
|
|
925
962
|
this.trackingHost = e, this.logger = i, this.config = t;
|
|
926
963
|
}
|
|
927
964
|
async send(e) {
|
|
@@ -936,15 +973,15 @@ class Ce {
|
|
|
936
973
|
}
|
|
937
974
|
};
|
|
938
975
|
return new Promise((r, o) => {
|
|
939
|
-
const a = (void 0)(n, (
|
|
940
|
-
|
|
941
|
-
}),
|
|
942
|
-
const
|
|
943
|
-
|
|
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}`));
|
|
944
981
|
});
|
|
945
982
|
});
|
|
946
|
-
a.on("error", (
|
|
947
|
-
o(
|
|
983
|
+
a.on("error", (c) => {
|
|
984
|
+
o(c);
|
|
948
985
|
}), a.write(JSON.stringify(e)), a.end();
|
|
949
986
|
});
|
|
950
987
|
}
|
|
@@ -956,7 +993,7 @@ class Ce {
|
|
|
956
993
|
return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
|
|
957
994
|
}
|
|
958
995
|
}
|
|
959
|
-
class
|
|
996
|
+
class C {
|
|
960
997
|
constructor(e, t = "all", i = {}) {
|
|
961
998
|
this.instance = e, this.trackingType = t, this.options = i, document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", this.initialize.bind(this)) : this.initialize();
|
|
962
999
|
}
|
|
@@ -971,7 +1008,7 @@ class S {
|
|
|
971
1008
|
}
|
|
972
1009
|
handleFormSubmit(e) {
|
|
973
1010
|
const t = e.target, i = this._getFormDetails(t);
|
|
974
|
-
this.instance.track("$form",
|
|
1011
|
+
this.instance.track("$form", V(i)), this.options.trackFieldChanges && this.trackFieldChanges(t);
|
|
975
1012
|
}
|
|
976
1013
|
trackFieldChanges(e) {
|
|
977
1014
|
e.querySelectorAll("input, select, textarea").forEach((i) => {
|
|
@@ -981,7 +1018,7 @@ class S {
|
|
|
981
1018
|
);
|
|
982
1019
|
this.instance.track(
|
|
983
1020
|
"$form_field_change",
|
|
984
|
-
|
|
1021
|
+
V({
|
|
985
1022
|
form_id: e.id,
|
|
986
1023
|
form_name: e.name || "",
|
|
987
1024
|
field: r
|
|
@@ -991,7 +1028,7 @@ class S {
|
|
|
991
1028
|
});
|
|
992
1029
|
}
|
|
993
1030
|
static getInstance(e, t = "all", i = {}) {
|
|
994
|
-
return
|
|
1031
|
+
return C.instance || (C.instance = new C(e, t, i)), C.instance;
|
|
995
1032
|
}
|
|
996
1033
|
_getFormDetails(e) {
|
|
997
1034
|
const t = {
|
|
@@ -1092,9 +1129,9 @@ class S {
|
|
|
1092
1129
|
return e.slice(t, i + 1);
|
|
1093
1130
|
}
|
|
1094
1131
|
}
|
|
1095
|
-
class
|
|
1132
|
+
class R {
|
|
1096
1133
|
constructor(e) {
|
|
1097
|
-
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(
|
|
1098
1135
|
this.transport,
|
|
1099
1136
|
this.config.maxSendAttempts || 3,
|
|
1100
1137
|
this.config.minSendTimeout || 1e3,
|
|
@@ -1103,14 +1140,14 @@ class I {
|
|
|
1103
1140
|
// Reduced interval to .2 second
|
|
1104
1141
|
this.logger,
|
|
1105
1142
|
this.namespace
|
|
1106
|
-
),
|
|
1143
|
+
), d() && this.initializeBrowserFeatures(), this.anonymousId = this.getOrCreateAnonymousId(), this.logger.info(
|
|
1107
1144
|
`Usermaven client initialized for namespace: ${this.namespace}`
|
|
1108
1145
|
);
|
|
1109
1146
|
}
|
|
1110
1147
|
initializeBrowserFeatures() {
|
|
1111
|
-
if (this.cookieManager = new ne(this.config.cookieDomain), this.config.autocapture &&
|
|
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) {
|
|
1112
1149
|
const e = this.config.formTracking === !0 ? "all" : this.config.formTracking;
|
|
1113
|
-
this.formTracking =
|
|
1150
|
+
this.formTracking = C.getInstance(
|
|
1114
1151
|
this,
|
|
1115
1152
|
e || "none",
|
|
1116
1153
|
{
|
|
@@ -1118,7 +1155,7 @@ class I {
|
|
|
1118
1155
|
}
|
|
1119
1156
|
);
|
|
1120
1157
|
}
|
|
1121
|
-
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();
|
|
1122
1159
|
}
|
|
1123
1160
|
/**
|
|
1124
1161
|
* Recursively merge the provided configuration with the existing defaultConfig
|
|
@@ -1129,11 +1166,11 @@ class I {
|
|
|
1129
1166
|
const i = JSON.parse(JSON.stringify(e));
|
|
1130
1167
|
let n = { ...t, ...i };
|
|
1131
1168
|
return Object.keys(t).forEach((r) => {
|
|
1132
|
-
|
|
1169
|
+
S(t[r]) && (n[r] = this.mergeConfig(e[r], t[r]));
|
|
1133
1170
|
}), n;
|
|
1134
1171
|
}
|
|
1135
1172
|
init(e) {
|
|
1136
|
-
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(
|
|
1137
1174
|
this.transport,
|
|
1138
1175
|
this.config.maxSendAttempts || 3,
|
|
1139
1176
|
this.config.minSendTimeout || 1e3,
|
|
@@ -1142,7 +1179,7 @@ class I {
|
|
|
1142
1179
|
// Reduced interval to .25 second
|
|
1143
1180
|
this.logger,
|
|
1144
1181
|
this.namespace
|
|
1145
|
-
),
|
|
1182
|
+
), d() && this.initializeBrowserFeatures(), this.anonymousId = this.getOrCreateAnonymousId(), this.logger.info(
|
|
1146
1183
|
`Usermaven client reinitialized for namespace: ${this.namespace}`
|
|
1147
1184
|
);
|
|
1148
1185
|
}
|
|
@@ -1158,8 +1195,8 @@ class I {
|
|
|
1158
1195
|
if (!r || !r.startsWith("http")) return;
|
|
1159
1196
|
const o = new URL(r);
|
|
1160
1197
|
if (o.hostname !== window.location.hostname && e.includes(o.hostname)) {
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1198
|
+
const c = (a = this.cookieManager) == null ? void 0 : a.get(t);
|
|
1199
|
+
c && (o.searchParams.append("_um", c), n.setAttribute("href", o.toString()));
|
|
1163
1200
|
}
|
|
1164
1201
|
}), this.logger.debug("Cross-domain linking initialized");
|
|
1165
1202
|
}
|
|
@@ -1170,29 +1207,29 @@ class I {
|
|
|
1170
1207
|
}
|
|
1171
1208
|
initializeTransport(e) {
|
|
1172
1209
|
const t = "https://events.usermaven.com";
|
|
1173
|
-
if (!
|
|
1174
|
-
return new
|
|
1210
|
+
if (!d())
|
|
1211
|
+
return new $e(e.trackingHost || t, e);
|
|
1175
1212
|
const i = "XMLHttpRequest" in window, n = typeof fetch < "u", r = typeof navigator < "u" && "sendBeacon" in navigator;
|
|
1176
1213
|
if (e.useBeaconApi && r)
|
|
1177
|
-
return new
|
|
1214
|
+
return new Pe(
|
|
1178
1215
|
e.trackingHost || t,
|
|
1179
1216
|
e,
|
|
1180
1217
|
this.logger
|
|
1181
1218
|
);
|
|
1182
1219
|
if (e.forceUseFetch && n)
|
|
1183
|
-
return new
|
|
1220
|
+
return new K(
|
|
1184
1221
|
e.trackingHost || t,
|
|
1185
1222
|
e,
|
|
1186
1223
|
this.logger
|
|
1187
1224
|
);
|
|
1188
1225
|
if (i)
|
|
1189
|
-
return new
|
|
1226
|
+
return new Ae(
|
|
1190
1227
|
e.trackingHost || t,
|
|
1191
1228
|
e,
|
|
1192
1229
|
this.logger
|
|
1193
1230
|
);
|
|
1194
1231
|
if (n)
|
|
1195
|
-
return new
|
|
1232
|
+
return new K(
|
|
1196
1233
|
e.trackingHost || t,
|
|
1197
1234
|
e,
|
|
1198
1235
|
this.logger
|
|
@@ -1200,25 +1237,25 @@ class I {
|
|
|
1200
1237
|
throw new Error("No suitable transport method available");
|
|
1201
1238
|
}
|
|
1202
1239
|
initializePersistence() {
|
|
1203
|
-
return this.config.disableEventPersistence || !
|
|
1240
|
+
return this.config.disableEventPersistence || !d() ? new Se() : new te(
|
|
1204
1241
|
`${this.namespace}_${this.config.key}`,
|
|
1205
1242
|
this.logger
|
|
1206
1243
|
);
|
|
1207
1244
|
}
|
|
1208
1245
|
getOrCreateAnonymousId() {
|
|
1209
1246
|
var i, n;
|
|
1210
|
-
if (!
|
|
1211
|
-
return
|
|
1247
|
+
if (!d())
|
|
1248
|
+
return x();
|
|
1212
1249
|
if (this.config.privacyPolicy === "strict" || this.config.cookiePolicy === "strict")
|
|
1213
1250
|
return "";
|
|
1214
1251
|
const e = this.config.cookieName || `__eventn_id_${this.config.key}`;
|
|
1215
1252
|
let t = (i = this.cookieManager) == null ? void 0 : i.get(e);
|
|
1216
1253
|
if (!t) {
|
|
1217
1254
|
if (this.config.crossDomainLinking) {
|
|
1218
|
-
const a = new URLSearchParams(window.location.search).get("_um"),
|
|
1219
|
-
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();
|
|
1220
1257
|
}
|
|
1221
|
-
t || (t =
|
|
1258
|
+
t || (t = x());
|
|
1222
1259
|
const r = 365 * 10;
|
|
1223
1260
|
(n = this.cookieManager) == null || n.set(
|
|
1224
1261
|
e,
|
|
@@ -1231,11 +1268,11 @@ class I {
|
|
|
1231
1268
|
return t;
|
|
1232
1269
|
}
|
|
1233
1270
|
async id(e, t = !1) {
|
|
1234
|
-
if (!
|
|
1271
|
+
if (!S(e))
|
|
1235
1272
|
throw new Error("User data must be an object");
|
|
1236
|
-
if (e.email && !
|
|
1273
|
+
if (e.email && !W(e.email))
|
|
1237
1274
|
throw new Error("Invalid email provided");
|
|
1238
|
-
if (!e.id || !
|
|
1275
|
+
if (!e.id || !U(e.id))
|
|
1239
1276
|
throw new Error("User ID must be a string");
|
|
1240
1277
|
const i = e.id;
|
|
1241
1278
|
if (this.persistence.set("userId", i), this.persistence.set("userProps", e), !t) {
|
|
@@ -1251,28 +1288,28 @@ class I {
|
|
|
1251
1288
|
this.trackInternal(e, t, i);
|
|
1252
1289
|
}
|
|
1253
1290
|
lead(e, t = !1) {
|
|
1254
|
-
if (!
|
|
1291
|
+
if (!S(e))
|
|
1255
1292
|
throw new Error(
|
|
1256
1293
|
"Lead payload must be a non-null object and not an array"
|
|
1257
1294
|
);
|
|
1258
1295
|
const i = e.email;
|
|
1259
|
-
if (!
|
|
1296
|
+
if (!U(i)) {
|
|
1260
1297
|
this.logger.error("Lead event requires a valid email attribute");
|
|
1261
1298
|
return;
|
|
1262
1299
|
}
|
|
1263
1300
|
const n = i.trim();
|
|
1264
|
-
if (!n || !
|
|
1301
|
+
if (!n || !W(n)) {
|
|
1265
1302
|
this.logger.error("Lead event requires a valid email attribute");
|
|
1266
1303
|
return;
|
|
1267
1304
|
}
|
|
1268
1305
|
e.email = n, this.track("lead", e, t);
|
|
1269
1306
|
}
|
|
1270
1307
|
trackInternal(e, t, i = !1) {
|
|
1271
|
-
if (
|
|
1308
|
+
if (be()) {
|
|
1272
1309
|
this.logger.debug("Tracking disabled due to um_exclusion setting");
|
|
1273
1310
|
return;
|
|
1274
1311
|
}
|
|
1275
|
-
if (!
|
|
1312
|
+
if (!U(e))
|
|
1276
1313
|
throw new Error("Event name must be a string");
|
|
1277
1314
|
if (t !== void 0 && (typeof t != "object" || t === null || Array.isArray(t)))
|
|
1278
1315
|
throw new Error(
|
|
@@ -1290,12 +1327,12 @@ class I {
|
|
|
1290
1327
|
}
|
|
1291
1328
|
}
|
|
1292
1329
|
rawTrack(e) {
|
|
1293
|
-
if (!
|
|
1330
|
+
if (!S(e))
|
|
1294
1331
|
throw new Error("Event payload must be an object");
|
|
1295
1332
|
this.track("raw", e);
|
|
1296
1333
|
}
|
|
1297
1334
|
async group(e, t = !1) {
|
|
1298
|
-
if (!
|
|
1335
|
+
if (!S(e))
|
|
1299
1336
|
throw new Error("Company properties must be an object");
|
|
1300
1337
|
if (!e.id || !e.name || !e.created_at)
|
|
1301
1338
|
throw new Error(
|
|
@@ -1304,16 +1341,16 @@ class I {
|
|
|
1304
1341
|
this.persistence.set("companyProps", e), t || await this.track("group", e), this.logger.info("Company identified:", e);
|
|
1305
1342
|
}
|
|
1306
1343
|
createEventPayload(e, t) {
|
|
1307
|
-
const i = this.persistence.get("userProps") || {},
|
|
1308
|
-
let
|
|
1309
|
-
const
|
|
1310
|
-
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(),
|
|
1311
1348
|
user: {
|
|
1312
1349
|
anonymous_id: this.anonymousId,
|
|
1313
|
-
id:
|
|
1314
|
-
...
|
|
1350
|
+
id: a,
|
|
1351
|
+
...r
|
|
1315
1352
|
},
|
|
1316
|
-
...
|
|
1353
|
+
...o && { company: o },
|
|
1317
1354
|
ids: this.getThirdPartyIds(),
|
|
1318
1355
|
utc_time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1319
1356
|
local_tz_offset: (/* @__PURE__ */ new Date()).getTimezoneOffset(),
|
|
@@ -1321,18 +1358,18 @@ class I {
|
|
|
1321
1358
|
src: "usermaven",
|
|
1322
1359
|
event_type: e,
|
|
1323
1360
|
namespace: this.namespace,
|
|
1324
|
-
...
|
|
1325
|
-
...
|
|
1361
|
+
...c,
|
|
1362
|
+
...h
|
|
1326
1363
|
};
|
|
1327
1364
|
if (e === "$autocapture") {
|
|
1328
|
-
const
|
|
1365
|
+
const g = this.processAutocaptureAttributes(
|
|
1329
1366
|
t || {}
|
|
1330
1367
|
);
|
|
1331
|
-
|
|
1332
|
-
} else e !== "user_identify" && e !== "group" && (Array.isArray(this.config.propertyBlacklist) && this.config.propertyBlacklist.forEach((
|
|
1333
|
-
delete
|
|
1334
|
-
}),
|
|
1335
|
-
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;
|
|
1336
1373
|
}
|
|
1337
1374
|
processAutocaptureAttributes(e) {
|
|
1338
1375
|
let t = {};
|
|
@@ -1355,14 +1392,14 @@ class I {
|
|
|
1355
1392
|
}
|
|
1356
1393
|
getThirdPartyIds() {
|
|
1357
1394
|
const e = {};
|
|
1358
|
-
if (
|
|
1395
|
+
if (d()) {
|
|
1359
1396
|
const t = this.getCookie("_fbp");
|
|
1360
1397
|
t && (e.fbp = t);
|
|
1361
1398
|
}
|
|
1362
1399
|
return e;
|
|
1363
1400
|
}
|
|
1364
1401
|
getUtmParams() {
|
|
1365
|
-
const e = {}, t =
|
|
1402
|
+
const e = {}, t = ke(window.location.search);
|
|
1366
1403
|
return [
|
|
1367
1404
|
"utm_source",
|
|
1368
1405
|
"utm_medium",
|
|
@@ -1374,7 +1411,7 @@ class I {
|
|
|
1374
1411
|
}), e;
|
|
1375
1412
|
}
|
|
1376
1413
|
pageview() {
|
|
1377
|
-
|
|
1414
|
+
d() ? this.track(
|
|
1378
1415
|
"pageview",
|
|
1379
1416
|
{
|
|
1380
1417
|
url: window.location.href,
|
|
@@ -1387,7 +1424,7 @@ class I {
|
|
|
1387
1424
|
);
|
|
1388
1425
|
}
|
|
1389
1426
|
setupPageLeaveTracking() {
|
|
1390
|
-
if (!
|
|
1427
|
+
if (!d()) return;
|
|
1391
1428
|
let e = !1, t = !1;
|
|
1392
1429
|
const i = () => {
|
|
1393
1430
|
!e && !t && (e = !0, this.track("$pageleave", {
|
|
@@ -1425,7 +1462,7 @@ class I {
|
|
|
1425
1462
|
});
|
|
1426
1463
|
}
|
|
1427
1464
|
set(e, t) {
|
|
1428
|
-
if (!
|
|
1465
|
+
if (!S(e))
|
|
1429
1466
|
throw new Error("Properties must be an object");
|
|
1430
1467
|
const i = t == null ? void 0 : t.eventType, n = (t == null ? void 0 : t.persist) ?? !0;
|
|
1431
1468
|
if (i) {
|
|
@@ -1464,13 +1501,13 @@ class I {
|
|
|
1464
1501
|
function ie() {
|
|
1465
1502
|
return typeof window < "u" && typeof window.define == "function" && window.define.amd;
|
|
1466
1503
|
}
|
|
1467
|
-
function
|
|
1504
|
+
function xe() {
|
|
1468
1505
|
return ie() ? window.define : void 0;
|
|
1469
1506
|
}
|
|
1470
1507
|
const Te = "__USERMAVEN_AUTOCAPTURE_INITIALIZED__";
|
|
1471
|
-
function
|
|
1472
|
-
const e = JSON.parse(JSON.stringify(s)), t =
|
|
1473
|
-
...
|
|
1508
|
+
function L(s) {
|
|
1509
|
+
const e = JSON.parse(JSON.stringify(s)), t = Q(e), i = {
|
|
1510
|
+
...Y,
|
|
1474
1511
|
...t
|
|
1475
1512
|
};
|
|
1476
1513
|
if (!i.key)
|
|
@@ -1478,16 +1515,16 @@ function O(s) {
|
|
|
1478
1515
|
if (!i.trackingHost)
|
|
1479
1516
|
throw new Error("Tracking host is required!");
|
|
1480
1517
|
const n = i.key || "", r = `${Te}${n}`;
|
|
1481
|
-
return
|
|
1518
|
+
return d() && i.autocapture && window[r] && (console.warn(
|
|
1482
1519
|
"Usermaven: Autocapture already initialized in another instance, skipping duplicate initialization."
|
|
1483
|
-
), i.disableAutocaptureListenerRegistration = !0),
|
|
1520
|
+
), i.disableAutocaptureListenerRegistration = !0), d() && i.autocapture && !i.disableAutocaptureListenerRegistration && (window[r] = !0), new R(i);
|
|
1484
1521
|
}
|
|
1485
|
-
function
|
|
1522
|
+
function He(s) {
|
|
1486
1523
|
var n;
|
|
1487
1524
|
const e = {
|
|
1488
1525
|
key: s.getAttribute("data-key") || void 0,
|
|
1489
1526
|
trackingHost: s.getAttribute("data-tracking-host") || "https://events.usermaven.com",
|
|
1490
|
-
logLevel:
|
|
1527
|
+
logLevel: ve(s.getAttribute("data-log-level")),
|
|
1491
1528
|
autocapture: s.getAttribute("data-autocapture") === "true",
|
|
1492
1529
|
formTracking: s.getAttribute("data-form-tracking") === "false" ? !1 : s.getAttribute("data-form-tracking") === "true" ? "all" : s.getAttribute("data-form-tracking"),
|
|
1493
1530
|
autoPageview: s.getAttribute("data-auto-pageview") === "true",
|
|
@@ -1517,30 +1554,30 @@ function xe(s) {
|
|
|
1517
1554
|
maskAllElementAttributes: s.getAttribute("data-mask-all-element-attributes") === "true"
|
|
1518
1555
|
};
|
|
1519
1556
|
e.privacyPolicy === "strict" && (e.cookiePolicy = "strict", e.ipPolicy = "strict"), e.cookiePolicy === "comply" && e.useBeaconApi && (e.cookiePolicy = "strict");
|
|
1520
|
-
const t =
|
|
1521
|
-
return
|
|
1557
|
+
const t = L(e), i = e.namespace || "usermaven";
|
|
1558
|
+
return d() && t.pageview(), Ie(i, t), t;
|
|
1522
1559
|
}
|
|
1523
|
-
function
|
|
1560
|
+
function Ie(s, e) {
|
|
1524
1561
|
let t = !1;
|
|
1525
1562
|
const i = [], n = [];
|
|
1526
1563
|
function r() {
|
|
1527
1564
|
for (; i.length > 0; ) {
|
|
1528
1565
|
const u = i.shift();
|
|
1529
1566
|
if (u) {
|
|
1530
|
-
const
|
|
1531
|
-
if (
|
|
1532
|
-
const
|
|
1567
|
+
const m = u[u.length - 1];
|
|
1568
|
+
if (m && typeof m.resolve == "function") {
|
|
1569
|
+
const y = u.pop();
|
|
1533
1570
|
try {
|
|
1534
|
-
const
|
|
1535
|
-
|
|
1536
|
-
} catch (
|
|
1537
|
-
|
|
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);
|
|
1538
1575
|
}
|
|
1539
1576
|
} else
|
|
1540
1577
|
try {
|
|
1541
1578
|
a.apply(null, u);
|
|
1542
|
-
} catch (
|
|
1543
|
-
console.error("Usermaven: Error processing queued command:",
|
|
1579
|
+
} catch (y) {
|
|
1580
|
+
console.error("Usermaven: Error processing queued command:", y);
|
|
1544
1581
|
}
|
|
1545
1582
|
}
|
|
1546
1583
|
}
|
|
@@ -1549,8 +1586,8 @@ function He(s, e) {
|
|
|
1549
1586
|
n.forEach((u) => u()), n.length = 0;
|
|
1550
1587
|
}
|
|
1551
1588
|
function a(...u) {
|
|
1552
|
-
const
|
|
1553
|
-
if (
|
|
1589
|
+
const m = u[0];
|
|
1590
|
+
if (m === "onLoad") {
|
|
1554
1591
|
typeof u[1] == "function" && (t ? u[1]() : n.push(u[1]));
|
|
1555
1592
|
return;
|
|
1556
1593
|
}
|
|
@@ -1558,11 +1595,11 @@ function He(s, e) {
|
|
|
1558
1595
|
i.push(u);
|
|
1559
1596
|
return;
|
|
1560
1597
|
}
|
|
1561
|
-
if (typeof e[
|
|
1562
|
-
return e[
|
|
1563
|
-
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`);
|
|
1564
1601
|
}
|
|
1565
|
-
const
|
|
1602
|
+
const c = ["id", "group", "reset"], h = [
|
|
1566
1603
|
"track",
|
|
1567
1604
|
"lead",
|
|
1568
1605
|
"pageview",
|
|
@@ -1571,66 +1608,66 @@ function He(s, e) {
|
|
|
1571
1608
|
"rawTrack",
|
|
1572
1609
|
"setUserId"
|
|
1573
1610
|
];
|
|
1574
|
-
[...
|
|
1575
|
-
a[u] = function(...
|
|
1611
|
+
[...c, ...h].forEach((u) => {
|
|
1612
|
+
a[u] = function(...m) {
|
|
1576
1613
|
if (!t) {
|
|
1577
|
-
if (
|
|
1578
|
-
return new Promise((
|
|
1579
|
-
i.push([u, ...
|
|
1614
|
+
if (c.includes(u))
|
|
1615
|
+
return new Promise((M, y) => {
|
|
1616
|
+
i.push([u, ...m, { resolve: M, reject: y }]);
|
|
1580
1617
|
});
|
|
1581
|
-
i.push([u, ...
|
|
1618
|
+
i.push([u, ...m]);
|
|
1582
1619
|
return;
|
|
1583
1620
|
}
|
|
1584
1621
|
if (typeof e[u] == "function")
|
|
1585
|
-
return e[u].apply(e,
|
|
1622
|
+
return e[u].apply(e, m);
|
|
1586
1623
|
};
|
|
1587
1624
|
}), a.getConfig = function() {
|
|
1588
1625
|
return t ? e.getConfig() : (console.warn("Usermaven client not ready yet"), null);
|
|
1589
1626
|
}, window[s] = a;
|
|
1590
|
-
const
|
|
1591
|
-
for (window[
|
|
1627
|
+
const l = `${s}Q`, g = window[l] || [];
|
|
1628
|
+
for (window[l] = g, g.push = function(...u) {
|
|
1592
1629
|
return a.apply(null, u), Array.prototype.push.apply(this, u);
|
|
1593
1630
|
}, setTimeout(() => {
|
|
1594
1631
|
t = !0, r(), o(), console.log(`Usermaven client for namespace ${s} is ready`);
|
|
1595
|
-
}, 0);
|
|
1596
|
-
const u =
|
|
1632
|
+
}, 0); g.length > 0; ) {
|
|
1633
|
+
const u = g.shift();
|
|
1597
1634
|
u && i.push(u);
|
|
1598
1635
|
}
|
|
1599
1636
|
}
|
|
1600
|
-
let
|
|
1601
|
-
if (
|
|
1602
|
-
const s =
|
|
1637
|
+
let Z = !1, B = null;
|
|
1638
|
+
if (d()) {
|
|
1639
|
+
const s = xe();
|
|
1603
1640
|
s && s("usermaven", [], function() {
|
|
1604
1641
|
return {
|
|
1605
|
-
usermavenClient:
|
|
1606
|
-
UsermavenClient:
|
|
1607
|
-
LogLevel:
|
|
1642
|
+
usermavenClient: L,
|
|
1643
|
+
UsermavenClient: R,
|
|
1644
|
+
LogLevel: _,
|
|
1608
1645
|
// Expose the script tag client if it exists
|
|
1609
|
-
getScriptTagClient: () =>
|
|
1646
|
+
getScriptTagClient: () => B
|
|
1610
1647
|
};
|
|
1611
|
-
}), typeof window < "u" && (window.usermavenClient =
|
|
1648
|
+
}), typeof window < "u" && (window.usermavenClient = L, window.UsermavenClient = R, window.usermavenScriptTagClient = () => B), function(e, t) {
|
|
1612
1649
|
const i = e.currentScript;
|
|
1613
1650
|
function n() {
|
|
1614
|
-
return
|
|
1651
|
+
return Z || !i || !i.hasAttribute("data-key") || i.getAttribute("data-no-auto-init") === "true" ? !1 : i.src.includes("lib.js");
|
|
1615
1652
|
}
|
|
1616
1653
|
function r() {
|
|
1617
|
-
n() && (console.log("[Usermaven] Auto-initializing from script tag"),
|
|
1654
|
+
n() && (console.log("[Usermaven] Auto-initializing from script tag"), B = He(i), Z = !0);
|
|
1618
1655
|
}
|
|
1619
1656
|
typeof t < "u" && i && (e.readyState === "loading" ? e.addEventListener("DOMContentLoaded", r) : r());
|
|
1620
1657
|
}(document, window);
|
|
1621
1658
|
}
|
|
1622
1659
|
typeof module < "u" && module.exports && !ie() && (module.exports = {
|
|
1623
|
-
usermavenClient:
|
|
1624
|
-
UsermavenClient:
|
|
1660
|
+
usermavenClient: L,
|
|
1661
|
+
UsermavenClient: R,
|
|
1625
1662
|
Config: void 0,
|
|
1626
1663
|
UserProps: void 0,
|
|
1627
1664
|
EventPayload: void 0,
|
|
1628
|
-
LogLevel:
|
|
1665
|
+
LogLevel: _,
|
|
1629
1666
|
ClientProperties: void 0
|
|
1630
1667
|
});
|
|
1631
1668
|
|
|
1632
1669
|
function createClient(params) {
|
|
1633
|
-
return
|
|
1670
|
+
return L(params);
|
|
1634
1671
|
}
|
|
1635
1672
|
|
|
1636
1673
|
function useUsermaven() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usermaven/react",
|
|
3
|
-
"version": "1.5.10-rc.
|
|
3
|
+
"version": "1.5.10-rc.116",
|
|
4
4
|
"description": "Usermaven JavaScript SDK for React",
|
|
5
5
|
"author": "Usermaven <hello@usermaven.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@usermaven/sdk-js": "1.5.10-rc.
|
|
21
|
+
"@usermaven/sdk-js": "1.5.10-rc.116"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "15.x || 16.x || 17.x || 18.x || 19.x",
|