@usermaven/react 1.5.5-rc.97 → 1.5.6-rc.101
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 +383 -370
- package/package.json +3 -3
package/lib/index.es.js
CHANGED
|
@@ -8,8 +8,8 @@ const UsermavenProvider = ({ children, client }) => {
|
|
|
8
8
|
return React.createElement(Context.Provider, { value: client }, children);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
var p = /* @__PURE__ */ ((
|
|
12
|
-
class
|
|
11
|
+
var p = /* @__PURE__ */ ((n) => (n[n.DEBUG = 0] = "DEBUG", n[n.INFO = 1] = "INFO", n[n.WARN = 2] = "WARN", n[n.ERROR = 3] = "ERROR", n))(p || {});
|
|
12
|
+
class G {
|
|
13
13
|
constructor(e) {
|
|
14
14
|
this.level = e;
|
|
15
15
|
}
|
|
@@ -26,8 +26,8 @@ class Z {
|
|
|
26
26
|
this.level <= 3 && console.error("[Usermaven Error]:", e, ...t);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function d(
|
|
30
|
-
return new
|
|
29
|
+
function d(n = 0) {
|
|
30
|
+
return new G(n);
|
|
31
31
|
}
|
|
32
32
|
const q = {
|
|
33
33
|
logLevel: p.ERROR,
|
|
@@ -37,7 +37,7 @@ const q = {
|
|
|
37
37
|
autocapture: !1,
|
|
38
38
|
rageClick: !1,
|
|
39
39
|
formTracking: !1,
|
|
40
|
-
autoPageview: !
|
|
40
|
+
autoPageview: !0,
|
|
41
41
|
disableEventPersistence: !1,
|
|
42
42
|
gaHook: !1,
|
|
43
43
|
segmentHook: !1,
|
|
@@ -59,16 +59,16 @@ class j {
|
|
|
59
59
|
constructor(e) {
|
|
60
60
|
this.domain = e, this.cookieDomain = this.getCookieDomain();
|
|
61
61
|
}
|
|
62
|
-
set(e, t,
|
|
62
|
+
set(e, t, i = 365, s = !0, r = !1) {
|
|
63
63
|
const o = /* @__PURE__ */ new Date();
|
|
64
|
-
o.setTime(o.getTime() +
|
|
65
|
-
const c = `expires=${o.toUTCString()}`, l =
|
|
64
|
+
o.setTime(o.getTime() + i * 24 * 60 * 60 * 1e3);
|
|
65
|
+
const c = `expires=${o.toUTCString()}`, l = s ? "; Secure" : "", a = r ? "; HttpOnly" : "";
|
|
66
66
|
document.cookie = `${e}=${t};${c};path=/;domain=${this.cookieDomain}${l}${a}`;
|
|
67
67
|
}
|
|
68
68
|
get(e) {
|
|
69
|
-
const t = e + "=",
|
|
70
|
-
for (let
|
|
71
|
-
let r = s
|
|
69
|
+
const t = e + "=", i = document.cookie.split(";");
|
|
70
|
+
for (let s = 0; s < i.length; s++) {
|
|
71
|
+
let r = i[s].trim();
|
|
72
72
|
if (r.indexOf(t) === 0)
|
|
73
73
|
return decodeURIComponent(r.substring(t.length));
|
|
74
74
|
}
|
|
@@ -88,7 +88,7 @@ class j {
|
|
|
88
88
|
}
|
|
89
89
|
isIpAddress(e) {
|
|
90
90
|
const t = e.split(".");
|
|
91
|
-
return t.length === 4 && t.every((
|
|
91
|
+
return t.length === 4 && t.every((i) => !isNaN(Number(i)));
|
|
92
92
|
}
|
|
93
93
|
extractHostname(e) {
|
|
94
94
|
let t;
|
|
@@ -96,110 +96,110 @@ class j {
|
|
|
96
96
|
}
|
|
97
97
|
extractRootDomain(e) {
|
|
98
98
|
let t = this.extractHostname(e);
|
|
99
|
-
const
|
|
100
|
-
return
|
|
99
|
+
const i = t.split("."), s = i.length;
|
|
100
|
+
return s > 2 && (i[s - 1].length == 2 ? (t = i[s - 2] + "." + i[s - 1], i[s - 2].length == 2 && (t = i[s - 3] + "." + t)) : t = i[s - 2] + "." + i[s - 1]), t;
|
|
101
101
|
}
|
|
102
102
|
extractTopLevelDomain(e) {
|
|
103
|
-
const t = /[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,
|
|
104
|
-
return
|
|
103
|
+
const t = /[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i, i = e.match(t);
|
|
104
|
+
return i ? i[0] : "";
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
const ee = Object.prototype, te = ee.hasOwnProperty, ie = Array.prototype,
|
|
108
|
-
function
|
|
109
|
-
if (Array.isArray(
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
else if ("length" in
|
|
113
|
-
for (let
|
|
114
|
-
if (
|
|
107
|
+
const ee = Object.prototype, te = ee.hasOwnProperty, ie = Array.prototype, P = ie.forEach, N = {};
|
|
108
|
+
function ne(n, e, t) {
|
|
109
|
+
if (Array.isArray(n)) {
|
|
110
|
+
if (P && n.forEach === P)
|
|
111
|
+
n.forEach(e, t);
|
|
112
|
+
else if ("length" in n && n.length === +n.length) {
|
|
113
|
+
for (let i = 0, s = n.length; i < s; i++)
|
|
114
|
+
if (i in n && e.call(t, n[i], i) === N)
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
const
|
|
120
|
-
return
|
|
121
|
-
},
|
|
122
|
-
for (const e in
|
|
123
|
-
typeof
|
|
119
|
+
const R = function(n) {
|
|
120
|
+
return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
121
|
+
}, se = function(n) {
|
|
122
|
+
for (const e in n)
|
|
123
|
+
typeof n[e] == "function" && (n[e] = n[e].bind(n));
|
|
124
124
|
};
|
|
125
|
-
function g(
|
|
126
|
-
if (
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
else if ("length" in
|
|
130
|
-
for (let
|
|
131
|
-
if (
|
|
125
|
+
function g(n, e, t) {
|
|
126
|
+
if (n != null) {
|
|
127
|
+
if (P && Array.isArray(n) && n.forEach === P)
|
|
128
|
+
n.forEach(e, t);
|
|
129
|
+
else if ("length" in n && n.length === +n.length) {
|
|
130
|
+
for (let i = 0, s = n.length; i < s; i++)
|
|
131
|
+
if (i in n && e.call(t, n[i], i) === N)
|
|
132
132
|
return;
|
|
133
133
|
} else
|
|
134
|
-
for (const
|
|
135
|
-
if (te.call(
|
|
134
|
+
for (const i in n)
|
|
135
|
+
if (te.call(n, i) && e.call(t, n[i], i) === N)
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
const re = function(
|
|
140
|
-
return
|
|
141
|
-
for (const
|
|
142
|
-
t[
|
|
143
|
-
}),
|
|
139
|
+
const re = function(n, ...e) {
|
|
140
|
+
return ne(e, function(t) {
|
|
141
|
+
for (const i in t)
|
|
142
|
+
t[i] !== void 0 && (n[i] = t[i]);
|
|
143
|
+
}), n;
|
|
144
144
|
};
|
|
145
|
-
function _(
|
|
146
|
-
return
|
|
145
|
+
function _(n, e) {
|
|
146
|
+
return n.indexOf(e) !== -1;
|
|
147
147
|
}
|
|
148
|
-
const oe = function(
|
|
148
|
+
const oe = function(n) {
|
|
149
149
|
try {
|
|
150
|
-
return /^\s*\bfunction\b/.test(
|
|
150
|
+
return /^\s*\bfunction\b/.test(n);
|
|
151
151
|
} catch {
|
|
152
152
|
return !1;
|
|
153
153
|
}
|
|
154
|
-
}, ae = function(
|
|
155
|
-
return
|
|
154
|
+
}, ae = function(n) {
|
|
155
|
+
return n === void 0;
|
|
156
156
|
}, y = function() {
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
157
|
+
const n = function(i, s, r, o, c) {
|
|
158
|
+
if (!i) {
|
|
159
159
|
d().error("No valid element provided to register_event");
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
if (
|
|
163
|
-
|
|
162
|
+
if (i.addEventListener && !o)
|
|
163
|
+
i.addEventListener(s, r, !!c);
|
|
164
164
|
else {
|
|
165
|
-
const l = "on" +
|
|
166
|
-
|
|
165
|
+
const l = "on" + s, a = i[l];
|
|
166
|
+
i[l] = e(i, r, a);
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
|
-
function e(
|
|
169
|
+
function e(i, s, r) {
|
|
170
170
|
return function(o) {
|
|
171
171
|
if (o = o || t(window.event), !o)
|
|
172
172
|
return;
|
|
173
173
|
let c = !0, l;
|
|
174
174
|
oe(r) && (l = r(o));
|
|
175
|
-
const a =
|
|
175
|
+
const a = s.call(i, o);
|
|
176
176
|
return (l === !1 || a === !1) && (c = !1), c;
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
|
-
function t(
|
|
180
|
-
return
|
|
179
|
+
function t(i) {
|
|
180
|
+
return i && (i.preventDefault = t.preventDefault, i.stopPropagation = t.stopPropagation), i;
|
|
181
181
|
}
|
|
182
182
|
return t.preventDefault = function() {
|
|
183
183
|
this.returnValue = !1;
|
|
184
184
|
}, t.stopPropagation = function() {
|
|
185
185
|
this.cancelBubble = !0;
|
|
186
|
-
},
|
|
187
|
-
}(), ce = function(
|
|
186
|
+
}, n;
|
|
187
|
+
}(), ce = function(n) {
|
|
188
188
|
return function(...e) {
|
|
189
189
|
try {
|
|
190
|
-
return
|
|
190
|
+
return n.apply(this, e);
|
|
191
191
|
} catch (t) {
|
|
192
192
|
d().error("Implementation error. Please turn on debug and contact support@usermaven.com.", t);
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
|
-
}, V = function(
|
|
196
|
-
for (const e in
|
|
197
|
-
typeof
|
|
195
|
+
}, V = function(n) {
|
|
196
|
+
for (const e in n)
|
|
197
|
+
typeof n[e] == "function" && (n[e] = ce(n[e]));
|
|
198
198
|
};
|
|
199
|
-
function
|
|
200
|
-
for (let e in
|
|
201
|
-
(
|
|
202
|
-
return
|
|
199
|
+
function U(n) {
|
|
200
|
+
for (let e in n)
|
|
201
|
+
(n[e] === "" || n[e] === null || n[e] === void 0 || typeof n[e] == "object" && Object.keys(n[e]).length === 0) && delete n[e];
|
|
202
|
+
return n;
|
|
203
203
|
}
|
|
204
204
|
function u() {
|
|
205
205
|
try {
|
|
@@ -208,80 +208,80 @@ function u() {
|
|
|
208
208
|
return d().warn("window is not available"), !1;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
function m(
|
|
212
|
-
const e = new Uint8Array(
|
|
213
|
-
return crypto.getRandomValues(e), Array.from(e, (t) => t.toString(36).padStart(2, "0")).join("").slice(0,
|
|
211
|
+
function m(n = 5) {
|
|
212
|
+
const e = new Uint8Array(n);
|
|
213
|
+
return crypto.getRandomValues(e), Array.from(e, (t) => t.toString(36).padStart(2, "0")).join("").slice(0, n);
|
|
214
214
|
}
|
|
215
|
-
function le(
|
|
216
|
-
return
|
|
215
|
+
function le(n) {
|
|
216
|
+
return n.replace(
|
|
217
217
|
/([-_][a-z])/g,
|
|
218
218
|
(e) => e.toUpperCase().replace("-", "").replace("_", "")
|
|
219
219
|
);
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
return typeof
|
|
223
|
-
const
|
|
224
|
-
return e[
|
|
221
|
+
function I(n) {
|
|
222
|
+
return typeof n != "object" || n === null ? n : Array.isArray(n) ? n.map(I) : Object.keys(n).reduce((e, t) => {
|
|
223
|
+
const i = le(t);
|
|
224
|
+
return e[i] = I(n[t]), e;
|
|
225
225
|
}, {});
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
switch (typeof
|
|
227
|
+
function A(n) {
|
|
228
|
+
switch (typeof n.className) {
|
|
229
229
|
case "string":
|
|
230
|
-
return
|
|
230
|
+
return n.className;
|
|
231
231
|
case "object":
|
|
232
|
-
return ("baseVal" in
|
|
232
|
+
return ("baseVal" in n.className ? n.className.baseVal : null) || n.getAttribute("class") || "";
|
|
233
233
|
default:
|
|
234
234
|
return "";
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function D(n) {
|
|
238
238
|
let e = "";
|
|
239
|
-
return L(
|
|
240
|
-
Q(t) && t.textContent && (e +=
|
|
241
|
-
}),
|
|
239
|
+
return L(n) && !W(n) && n.childNodes && n.childNodes.length && g(n.childNodes, function(t) {
|
|
240
|
+
Q(t) && t.textContent && (e += R(t.textContent).split(/(\s+)/).filter(E).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255));
|
|
241
|
+
}), R(e);
|
|
242
242
|
}
|
|
243
|
-
function J(
|
|
244
|
-
return !!
|
|
243
|
+
function J(n) {
|
|
244
|
+
return !!n && n.nodeType === 1;
|
|
245
245
|
}
|
|
246
|
-
function f(
|
|
247
|
-
return !!
|
|
246
|
+
function f(n, e) {
|
|
247
|
+
return !!n && !!n.tagName && n.tagName.toLowerCase() === e.toLowerCase();
|
|
248
248
|
}
|
|
249
|
-
function Q(
|
|
250
|
-
return !!
|
|
249
|
+
function Q(n) {
|
|
250
|
+
return !!n && n.nodeType === 3;
|
|
251
251
|
}
|
|
252
|
-
function
|
|
253
|
-
return !!
|
|
252
|
+
function O(n) {
|
|
253
|
+
return !!n && n.nodeType === 11;
|
|
254
254
|
}
|
|
255
255
|
const b = ["a", "button", "form", "input", "select", "textarea", "label"];
|
|
256
|
-
function ue(
|
|
257
|
-
if (!
|
|
256
|
+
function ue(n, e) {
|
|
257
|
+
if (!n || f(n, "html") || !J(n))
|
|
258
258
|
return !1;
|
|
259
|
-
let t =
|
|
259
|
+
let t = n;
|
|
260
260
|
for (; t && !f(t, "body"); ) {
|
|
261
261
|
if (t.classList && t.classList.contains("um-no-capture"))
|
|
262
262
|
return !1;
|
|
263
|
-
t.parentNode &&
|
|
263
|
+
t.parentNode && O(t.parentNode) ? t = t.parentNode.host : t = t.parentNode;
|
|
264
264
|
}
|
|
265
|
-
let
|
|
266
|
-
for (t =
|
|
267
|
-
if (t.parentNode &&
|
|
268
|
-
t = t.parentNode.host, t && b.indexOf(t.tagName.toLowerCase()) > -1 && (
|
|
265
|
+
let i = !1;
|
|
266
|
+
for (t = n; t && !f(t, "body"); ) {
|
|
267
|
+
if (t.parentNode && O(t.parentNode)) {
|
|
268
|
+
t = t.parentNode.host, t && b.indexOf(t.tagName.toLowerCase()) > -1 && (i = !0);
|
|
269
269
|
continue;
|
|
270
270
|
}
|
|
271
271
|
const o = t.parentNode;
|
|
272
272
|
if (!o) break;
|
|
273
273
|
if (b.indexOf(o.tagName.toLowerCase()) > -1)
|
|
274
|
-
|
|
274
|
+
i = !0;
|
|
275
275
|
else {
|
|
276
276
|
const c = window.getComputedStyle(o);
|
|
277
|
-
c && c.getPropertyValue("cursor") === "pointer" && (
|
|
277
|
+
c && c.getPropertyValue("cursor") === "pointer" && (i = !0);
|
|
278
278
|
}
|
|
279
279
|
t = o;
|
|
280
280
|
}
|
|
281
|
-
const
|
|
282
|
-
if (
|
|
281
|
+
const s = window.getComputedStyle(n);
|
|
282
|
+
if (s && s.getPropertyValue("cursor") === "pointer" && e.type === "click")
|
|
283
283
|
return !0;
|
|
284
|
-
const r =
|
|
284
|
+
const r = n.tagName.toLowerCase();
|
|
285
285
|
switch (r) {
|
|
286
286
|
case "html":
|
|
287
287
|
return !1;
|
|
@@ -293,18 +293,18 @@ function ue(i, e) {
|
|
|
293
293
|
case "textarea":
|
|
294
294
|
return e.type === "change" || e.type === "click";
|
|
295
295
|
default:
|
|
296
|
-
return
|
|
296
|
+
return i ? e.type === "click" : e.type === "click" && (b.indexOf(r) > -1 || n.getAttribute("contenteditable") === "true");
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
function L(
|
|
300
|
-
for (let
|
|
301
|
-
const
|
|
302
|
-
if (_(
|
|
299
|
+
function L(n) {
|
|
300
|
+
for (let i = n; i.parentNode && !f(i, "body"); i = i.parentNode) {
|
|
301
|
+
const s = A(i).split(" ");
|
|
302
|
+
if (_(s, "ph-sensitive") || _(s, "ph-no-capture"))
|
|
303
303
|
return !1;
|
|
304
304
|
}
|
|
305
|
-
if (_(
|
|
305
|
+
if (_(A(n).split(" "), "ph-include"))
|
|
306
306
|
return !0;
|
|
307
|
-
const e =
|
|
307
|
+
const e = n.type || "";
|
|
308
308
|
if (typeof e == "string")
|
|
309
309
|
switch (e.toLowerCase()) {
|
|
310
310
|
case "hidden":
|
|
@@ -312,57 +312,57 @@ function L(i) {
|
|
|
312
312
|
case "password":
|
|
313
313
|
return !1;
|
|
314
314
|
}
|
|
315
|
-
const t =
|
|
315
|
+
const t = n.name || n.id || "";
|
|
316
316
|
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, "")));
|
|
317
317
|
}
|
|
318
|
-
function W(
|
|
318
|
+
function W(n) {
|
|
319
319
|
const e = ["button", "checkbox", "submit", "reset"];
|
|
320
|
-
return !!(f(
|
|
320
|
+
return !!(f(n, "input") && !e.includes(n.type) || f(n, "select") || f(n, "textarea") || n.getAttribute("contenteditable") === "true");
|
|
321
321
|
}
|
|
322
|
-
function
|
|
323
|
-
return !(
|
|
322
|
+
function E(n) {
|
|
323
|
+
return !(n === null || ae(n) || typeof n == "string" && (n = R(n), /^(?:(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((n || "").replace(/[- ]/g, "")) || /(^\d{3}-?\d{2}-?\d{4}$)/.test(n)));
|
|
324
324
|
}
|
|
325
|
-
function he(
|
|
326
|
-
return typeof
|
|
325
|
+
function he(n) {
|
|
326
|
+
return typeof n == "string" ? n.substring(0, 10) === "_ngcontent" || n.substring(0, 7) === "_nghost" : !1;
|
|
327
327
|
}
|
|
328
328
|
function x() {
|
|
329
329
|
return m(10);
|
|
330
330
|
}
|
|
331
|
-
function de(
|
|
332
|
-
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(
|
|
331
|
+
function de(n) {
|
|
332
|
+
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(n).toLowerCase());
|
|
333
333
|
}
|
|
334
|
-
function fe(
|
|
334
|
+
function fe(n, e) {
|
|
335
335
|
let t;
|
|
336
|
-
return function(...
|
|
337
|
-
const
|
|
338
|
-
clearTimeout(t),
|
|
336
|
+
return function(...i) {
|
|
337
|
+
const s = () => {
|
|
338
|
+
clearTimeout(t), n(...i);
|
|
339
339
|
};
|
|
340
|
-
clearTimeout(t), t = setTimeout(
|
|
340
|
+
clearTimeout(t), t = setTimeout(s, e);
|
|
341
341
|
};
|
|
342
342
|
}
|
|
343
|
-
function ge(
|
|
344
|
-
const e = {}, t =
|
|
345
|
-
for (let
|
|
346
|
-
const
|
|
347
|
-
|
|
343
|
+
function ge(n) {
|
|
344
|
+
const e = {}, t = n.replace(/^\?/, "").split("&");
|
|
345
|
+
for (let i = 0; i < t.length; i++) {
|
|
346
|
+
const s = t[i].split("=");
|
|
347
|
+
s[0] !== "" && (e[decodeURIComponent(s[0])] = decodeURIComponent(s[1] || ""));
|
|
348
348
|
}
|
|
349
349
|
return e;
|
|
350
350
|
}
|
|
351
|
-
function F(
|
|
352
|
-
return typeof
|
|
351
|
+
function F(n) {
|
|
352
|
+
return typeof n == "string" || n instanceof String;
|
|
353
353
|
}
|
|
354
|
-
function v(
|
|
355
|
-
return
|
|
354
|
+
function v(n) {
|
|
355
|
+
return n !== null && typeof n == "object" && n.constructor === Object;
|
|
356
356
|
}
|
|
357
|
-
function pe(
|
|
358
|
-
if (
|
|
357
|
+
function pe(n) {
|
|
358
|
+
if (n === null)
|
|
359
359
|
return p.ERROR;
|
|
360
|
-
const e =
|
|
360
|
+
const e = n.toUpperCase(), t = p[e];
|
|
361
361
|
return t || t === 0 ? t : p.ERROR;
|
|
362
362
|
}
|
|
363
363
|
const me = () => {
|
|
364
|
-
let
|
|
365
|
-
return typeof window < "u" && window.localStorage && (
|
|
364
|
+
let n = "false";
|
|
365
|
+
return typeof window < "u" && window.localStorage && (n = localStorage.getItem("um_exclusion")), !(n == null || n === "false");
|
|
366
366
|
};
|
|
367
367
|
class ye {
|
|
368
368
|
constructor(e) {
|
|
@@ -390,8 +390,8 @@ class ye {
|
|
|
390
390
|
this.track();
|
|
391
391
|
}
|
|
392
392
|
getScrollDepth() {
|
|
393
|
-
const e = this.getWindowHeight(), t = this.getDocumentHeight(),
|
|
394
|
-
return Math.min(100, Math.floor(
|
|
393
|
+
const e = this.getWindowHeight(), t = this.getDocumentHeight(), i = this.getScrollDistance(), s = t - e;
|
|
394
|
+
return Math.min(100, Math.floor(i / s * 100));
|
|
395
395
|
}
|
|
396
396
|
getWindowHeight() {
|
|
397
397
|
return window.innerHeight || this.documentElement.clientHeight || document.body.clientHeight || 0;
|
|
@@ -410,21 +410,32 @@ class ye {
|
|
|
410
410
|
return window.pageYOffset || this.documentElement.scrollTop || document.body.scrollTop || 0;
|
|
411
411
|
}
|
|
412
412
|
checkMilestones(e) {
|
|
413
|
-
this.milestones.filter((
|
|
414
|
-
this.send(), this.milestones = this.milestones.filter((
|
|
413
|
+
this.milestones.filter((i) => e >= i).forEach((i) => {
|
|
414
|
+
this.send(), this.milestones = this.milestones.filter((s) => s !== i);
|
|
415
415
|
});
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
const
|
|
419
|
-
constructor(e, t,
|
|
420
|
-
this.logger =
|
|
418
|
+
const T = class T {
|
|
419
|
+
constructor(e, t, i = d()) {
|
|
420
|
+
this.logger = i, this.scrollDepth = null, this.customProperties = [], this.domHandlersAttached = !1, this.client = e, this.options = t, this.scrollDepth = new ye(e), se(this), V(this);
|
|
421
|
+
}
|
|
422
|
+
isBrowserSupported() {
|
|
423
|
+
return typeof document < "u" && typeof document.addEventListener == "function";
|
|
421
424
|
}
|
|
422
425
|
init() {
|
|
426
|
+
if (!this.isBrowserSupported()) {
|
|
427
|
+
this.logger.debug("Browser not supported for autocapture");
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (this.domHandlersAttached) {
|
|
431
|
+
this.logger.debug("Autocapture already initialized.");
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
423
434
|
if (!(document && document.body)) {
|
|
424
435
|
this.logger.debug("Document not ready yet, trying again in 500 milliseconds..."), setTimeout(() => this.init(), 500);
|
|
425
436
|
return;
|
|
426
437
|
}
|
|
427
|
-
this.addDomEventHandlers();
|
|
438
|
+
this.addDomEventHandlers(), this.domHandlersAttached = !0;
|
|
428
439
|
}
|
|
429
440
|
addDomEventHandlers() {
|
|
430
441
|
const e = (t) => {
|
|
@@ -441,17 +452,17 @@ const A = class A {
|
|
|
441
452
|
return performance.navigation && performance.navigation.type === 1;
|
|
442
453
|
}
|
|
443
454
|
captureEvent(e) {
|
|
444
|
-
var
|
|
455
|
+
var i, s;
|
|
445
456
|
let t = this.getEventTarget(e);
|
|
446
457
|
if (Q(t) && (t = t.parentNode || null), e.type === "scroll")
|
|
447
|
-
return (
|
|
458
|
+
return (i = this.scrollDepth) == null || i.track(), !0;
|
|
448
459
|
if (e.type === "visibilitychange" && document.visibilityState === "hidden" || e.type === "popstate")
|
|
449
|
-
return this.isPageRefresh() || (
|
|
460
|
+
return this.isPageRefresh() || (s = this.scrollDepth) == null || s.send(), !0;
|
|
450
461
|
if (t && ue(t, e)) {
|
|
451
462
|
const r = [t];
|
|
452
463
|
let o = t;
|
|
453
464
|
for (; o.parentNode && !f(o, "body"); ) {
|
|
454
|
-
if (
|
|
465
|
+
if (O(o.parentNode)) {
|
|
455
466
|
r.push(o.parentNode.host), o = o.parentNode.host;
|
|
456
467
|
continue;
|
|
457
468
|
}
|
|
@@ -460,9 +471,9 @@ const A = class A {
|
|
|
460
471
|
const c = [];
|
|
461
472
|
let l, a = !1;
|
|
462
473
|
if (g(r, (k) => {
|
|
463
|
-
const
|
|
464
|
-
k.tagName.toLowerCase() === "a" && (l = k.getAttribute("href"), l =
|
|
465
|
-
const Y =
|
|
474
|
+
const Z = L(k);
|
|
475
|
+
k.tagName.toLowerCase() === "a" && (l = k.getAttribute("href"), l = Z && E(l) && l);
|
|
476
|
+
const Y = A(k).split(" ");
|
|
466
477
|
_(Y, "ph-no-capture") && (a = !0), c.push(
|
|
467
478
|
this.getPropertiesFromElement(
|
|
468
479
|
k,
|
|
@@ -470,7 +481,7 @@ const A = class A {
|
|
|
470
481
|
this.options.maskAllText ?? !1
|
|
471
482
|
)
|
|
472
483
|
);
|
|
473
|
-
}), this.options.maskAllText || (c[0].$el_text =
|
|
484
|
+
}), this.options.maskAllText || (c[0].$el_text = D(t)), l && (c[0].attr__href = l), a)
|
|
474
485
|
return !1;
|
|
475
486
|
const h = re(
|
|
476
487
|
this.getDefaultProperties(e.type),
|
|
@@ -484,36 +495,36 @@ const A = class A {
|
|
|
484
495
|
}
|
|
485
496
|
getCustomProperties(e) {
|
|
486
497
|
const t = {};
|
|
487
|
-
return g(this.customProperties, (
|
|
488
|
-
g(
|
|
489
|
-
const r = document.querySelectorAll(
|
|
498
|
+
return g(this.customProperties, (i) => {
|
|
499
|
+
g(i.event_selectors, (s) => {
|
|
500
|
+
const r = document.querySelectorAll(s);
|
|
490
501
|
g(r, (o) => {
|
|
491
|
-
_(e, o) && L(o) && (t[
|
|
502
|
+
_(e, o) && L(o) && (t[i.name] = this.extractCustomPropertyValue(i));
|
|
492
503
|
});
|
|
493
504
|
});
|
|
494
505
|
}), t;
|
|
495
506
|
}
|
|
496
507
|
extractCustomPropertyValue(e) {
|
|
497
508
|
const t = [];
|
|
498
|
-
return g(document.querySelectorAll(e.css_selector), function(
|
|
499
|
-
let
|
|
500
|
-
["input", "select"].indexOf(
|
|
509
|
+
return g(document.querySelectorAll(e.css_selector), function(i) {
|
|
510
|
+
let s;
|
|
511
|
+
["input", "select"].indexOf(i.tagName.toLowerCase()) > -1 ? s = i.value : i.textContent && (s = i.textContent), E(s) && t.push(s);
|
|
501
512
|
}), t.join(", ");
|
|
502
513
|
}
|
|
503
514
|
getEventTarget(e) {
|
|
504
515
|
var t;
|
|
505
516
|
return typeof e.target > "u" ? e.srcElement || null : (t = e.target) != null && t.shadowRoot ? e.composedPath()[0] || null : e.target || null;
|
|
506
517
|
}
|
|
507
|
-
getPropertiesFromElement(e, t,
|
|
508
|
-
const
|
|
509
|
-
tag_name:
|
|
518
|
+
getPropertiesFromElement(e, t, i) {
|
|
519
|
+
const s = e.tagName.toLowerCase(), r = {
|
|
520
|
+
tag_name: s
|
|
510
521
|
};
|
|
511
|
-
b.indexOf(
|
|
512
|
-
const o =
|
|
522
|
+
b.indexOf(s) > -1 && !i && (r.$el_text = D(e));
|
|
523
|
+
const o = A(e);
|
|
513
524
|
o.length > 0 && (r.classes = o.split(" ").filter(function(h) {
|
|
514
525
|
return h !== "";
|
|
515
526
|
})), g(e.attributes, function(h) {
|
|
516
|
-
W(e) && ["name", "id", "class"].indexOf(h.name) === -1 || !t &&
|
|
527
|
+
W(e) && ["name", "id", "class"].indexOf(h.name) === -1 || !t && E(h.value) && !he(h.name) && (r["attr__" + h.name] = h.value);
|
|
517
528
|
});
|
|
518
529
|
let c = 1, l = 1, a = e;
|
|
519
530
|
for (; a = this.previousElementSibling(a); )
|
|
@@ -540,17 +551,17 @@ const A = class A {
|
|
|
540
551
|
encodeHtml(e) {
|
|
541
552
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
542
553
|
}
|
|
543
|
-
static enabledForProject(e, t = 10,
|
|
554
|
+
static enabledForProject(e, t = 10, i = 10) {
|
|
544
555
|
if (!e)
|
|
545
556
|
return !1;
|
|
546
|
-
let
|
|
557
|
+
let s = 0;
|
|
547
558
|
for (let r = 0; r < e.length; r++)
|
|
548
|
-
|
|
549
|
-
return
|
|
559
|
+
s += e.charCodeAt(r);
|
|
560
|
+
return s % t < i;
|
|
550
561
|
}
|
|
551
562
|
};
|
|
552
|
-
|
|
553
|
-
let
|
|
563
|
+
T.FORCE_CAPTURE_ATTR = "data-um-force-capture", T.PREVENT_CAPTURE_ATTR = "data-um-no-capture";
|
|
564
|
+
let $ = T;
|
|
554
565
|
class we {
|
|
555
566
|
constructor(e) {
|
|
556
567
|
this.client = e, this.lastPageUrl = window.location.href, this.trackInitialPageview(), this.initializePageviewTracking();
|
|
@@ -581,43 +592,43 @@ class we {
|
|
|
581
592
|
}
|
|
582
593
|
}
|
|
583
594
|
class ke {
|
|
584
|
-
constructor(e, t,
|
|
585
|
-
this.trackingHost = e, this.logger =
|
|
595
|
+
constructor(e, t, i = d()) {
|
|
596
|
+
this.trackingHost = e, this.logger = i, this.config = t;
|
|
586
597
|
}
|
|
587
598
|
async send(e) {
|
|
588
|
-
const t = this.config.key,
|
|
589
|
-
if (navigator.sendBeacon(
|
|
599
|
+
const t = this.config.key, i = this.constructUrl(t), s = new Blob([JSON.stringify(e)], { type: "application/json" });
|
|
600
|
+
if (navigator.sendBeacon(i, s))
|
|
590
601
|
this.logger.debug(`Successfully queued ${e.length} event(s) via Beacon API`);
|
|
591
602
|
else
|
|
592
603
|
throw new Error("Failed to queue events via Beacon API");
|
|
593
604
|
}
|
|
594
605
|
constructUrl(e) {
|
|
595
|
-
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "",
|
|
596
|
-
return this.config.randomizeUrl ? `${this.trackingHost}/api.${m()}?p_${m()}=${e}${t}${
|
|
606
|
+
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", s = u() ? "/api/v1/event" : "/api/v1/s2s/event";
|
|
607
|
+
return this.config.randomizeUrl ? `${this.trackingHost}/api.${m()}?p_${m()}=${e}${t}${i}` : `${this.trackingHost}${s}?token=${e}${t}${i}`;
|
|
597
608
|
}
|
|
598
609
|
// Note: Beacon API doesn't support custom headers, so we can't use them here.
|
|
599
610
|
// If custom headers are crucial, you might want to fall back to XHR or Fetch in those cases.
|
|
600
611
|
}
|
|
601
612
|
class z {
|
|
602
|
-
constructor(e, t,
|
|
603
|
-
this.trackingHost = e, this.logger =
|
|
613
|
+
constructor(e, t, i = d()) {
|
|
614
|
+
this.trackingHost = e, this.logger = i, this.config = t;
|
|
604
615
|
}
|
|
605
616
|
async send(e) {
|
|
606
|
-
const t = this.config.key,
|
|
617
|
+
const t = this.config.key, i = this.constructUrl(t), s = JSON.stringify(e), r = {
|
|
607
618
|
"Content-Type": "application/json",
|
|
608
619
|
...this.getCustomHeaders()
|
|
609
|
-
}, o = await fetch(
|
|
620
|
+
}, o = await fetch(i, {
|
|
610
621
|
method: "POST",
|
|
611
622
|
headers: r,
|
|
612
|
-
body:
|
|
623
|
+
body: s
|
|
613
624
|
});
|
|
614
625
|
if (!o.ok)
|
|
615
626
|
throw new Error(`HTTP error! status: ${o.status}`);
|
|
616
627
|
this.logger.debug(`Successfully sent ${e.length} event(s)`), this.postHandle(o.status, await o.text());
|
|
617
628
|
}
|
|
618
629
|
constructUrl(e) {
|
|
619
|
-
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "",
|
|
620
|
-
return this.config.randomizeUrl ? `${this.trackingHost}/api.${m()}?p_${m()}=${e}${t}${
|
|
630
|
+
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", s = u() ? "/api/v1/event" : "/api/v1/s2s/event";
|
|
631
|
+
return this.config.randomizeUrl ? `${this.trackingHost}/api.${m()}?p_${m()}=${e}${t}${i}` : `${this.trackingHost}${s}?token=${e}${t}${i}`;
|
|
621
632
|
}
|
|
622
633
|
getCustomHeaders() {
|
|
623
634
|
return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
|
|
@@ -627,26 +638,26 @@ class z {
|
|
|
627
638
|
}
|
|
628
639
|
}
|
|
629
640
|
class ve {
|
|
630
|
-
constructor(e, t,
|
|
631
|
-
this.trackingHost = e, this.logger =
|
|
641
|
+
constructor(e, t, i = d()) {
|
|
642
|
+
this.trackingHost = e, this.logger = i, this.config = t;
|
|
632
643
|
}
|
|
633
644
|
send(e) {
|
|
634
|
-
return new Promise((t,
|
|
635
|
-
const
|
|
636
|
-
|
|
645
|
+
return new Promise((t, i) => {
|
|
646
|
+
const s = new XMLHttpRequest(), r = this.config.key, o = this.constructUrl(r);
|
|
647
|
+
s.open("POST", o, !0), s.setRequestHeader("Content-Type", "application/json");
|
|
637
648
|
const c = this.getCustomHeaders();
|
|
638
649
|
Object.keys(c).forEach((l) => {
|
|
639
|
-
|
|
640
|
-
}),
|
|
641
|
-
|
|
642
|
-
},
|
|
643
|
-
|
|
644
|
-
},
|
|
650
|
+
s.setRequestHeader(l, c[l]);
|
|
651
|
+
}), s.onload = () => {
|
|
652
|
+
s.status >= 200 && s.status < 300 ? (this.logger.debug(`Successfully sent ${e.length} event(s)`), t()) : i(new Error(`HTTP error! status: ${s.status}`));
|
|
653
|
+
}, s.onerror = () => {
|
|
654
|
+
i(new Error("Network error"));
|
|
655
|
+
}, s.send(JSON.stringify(e));
|
|
645
656
|
});
|
|
646
657
|
}
|
|
647
658
|
constructUrl(e) {
|
|
648
|
-
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "",
|
|
649
|
-
return this.config.randomizeUrl ? `${this.trackingHost}/api.${m()}?p_${m()}=${e}${t}${
|
|
659
|
+
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", s = u() ? "/api/v1/event" : "/api/v1/s2s/event";
|
|
660
|
+
return this.config.randomizeUrl ? `${this.trackingHost}/api.${m()}?p_${m()}=${e}${t}${i}` : `${this.trackingHost}${s}?token=${e}${t}${i}`;
|
|
650
661
|
}
|
|
651
662
|
getCustomHeaders() {
|
|
652
663
|
return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
|
|
@@ -655,7 +666,7 @@ class ve {
|
|
|
655
666
|
this.logger.debug(`Response received. Status: ${e}, Body: ${t}`);
|
|
656
667
|
}
|
|
657
668
|
}
|
|
658
|
-
class
|
|
669
|
+
class K {
|
|
659
670
|
constructor(e, t) {
|
|
660
671
|
this.storage = {}, this.prefix = `usermaven_${e}_`, this.load(), this.logger = t || d();
|
|
661
672
|
}
|
|
@@ -714,10 +725,10 @@ class _e {
|
|
|
714
725
|
this.storage = {};
|
|
715
726
|
}
|
|
716
727
|
}
|
|
717
|
-
class
|
|
728
|
+
class B {
|
|
718
729
|
// Default to true for server-side
|
|
719
|
-
constructor(e, t = 3,
|
|
720
|
-
this.transport = e, this.maxRetries = t, this.retryInterval =
|
|
730
|
+
constructor(e, t = 3, i = 1e3, s = 10, r = 1e3, o = d(), c = "default") {
|
|
731
|
+
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 K(`offline_queue_${c}`), u() && (this.isOnline = navigator.onLine, this.loadQueueFromStorage(), this.initNetworkListeners(), this.scheduleBatch());
|
|
721
732
|
}
|
|
722
733
|
add(e) {
|
|
723
734
|
const t = { payload: e, retries: 0, timestamp: Date.now() };
|
|
@@ -736,11 +747,11 @@ class M {
|
|
|
736
747
|
async processBatch() {
|
|
737
748
|
if ((!u() || this.isOnline) && !this.processing && this.queue.length > 0) {
|
|
738
749
|
this.processing = !0;
|
|
739
|
-
const e = this.queue.splice(0, this.batchSize), t = e.map((
|
|
750
|
+
const e = this.queue.splice(0, this.batchSize), t = e.map((i) => i.payload);
|
|
740
751
|
try {
|
|
741
752
|
await this.transport.send(t), this.logger.debug(`Successfully sent batch of ${e.length} payloads`), u() && this.saveQueueToStorage();
|
|
742
|
-
} catch (
|
|
743
|
-
this.logger.error("Failed to send batch",
|
|
753
|
+
} catch (i) {
|
|
754
|
+
this.logger.error("Failed to send batch", i), await this.handleBatchFailure(e);
|
|
744
755
|
}
|
|
745
756
|
this.processing = !1;
|
|
746
757
|
}
|
|
@@ -775,17 +786,17 @@ class be {
|
|
|
775
786
|
shouldCaptureElement(e) {
|
|
776
787
|
return !e.closest(".um-no-capture");
|
|
777
788
|
}
|
|
778
|
-
click(e, t,
|
|
779
|
-
const
|
|
780
|
-
this.clicks.push(
|
|
789
|
+
click(e, t, i) {
|
|
790
|
+
const s = { x: e, y: t, timestamp: i };
|
|
791
|
+
this.clicks.push(s), this.clicks = this.clicks.filter((r) => i - r.timestamp < this.timeWindow), this.clicks.length >= this.threshold && this.checkRageClick();
|
|
781
792
|
}
|
|
782
793
|
checkRageClick() {
|
|
783
|
-
const e = this.clicks[0],
|
|
794
|
+
const e = this.clicks[0], i = (this.clicks[this.clicks.length - 1].timestamp - e.timestamp) / 1e3;
|
|
784
795
|
this.clicks.every((r, o) => {
|
|
785
796
|
if (o === 0) return !0;
|
|
786
797
|
const c = this.clicks[o - 1];
|
|
787
798
|
return Math.sqrt(Math.pow(r.x - c.x, 2) + Math.pow(r.y - c.y, 2)) < this.distanceThreshold;
|
|
788
|
-
}) && this.sendRageClickEvent(
|
|
799
|
+
}) && this.sendRageClickEvent(i);
|
|
789
800
|
}
|
|
790
801
|
sendRageClickEvent(e) {
|
|
791
802
|
const t = this.clicks[this.clicks.length - 1];
|
|
@@ -795,15 +806,15 @@ class be {
|
|
|
795
806
|
}), this.clicks = [];
|
|
796
807
|
}
|
|
797
808
|
}
|
|
798
|
-
class
|
|
799
|
-
constructor(e, t,
|
|
800
|
-
this.trackingHost = e, this.logger =
|
|
809
|
+
class Ee {
|
|
810
|
+
constructor(e, t, i = d()) {
|
|
811
|
+
this.trackingHost = e, this.logger = i, this.config = t;
|
|
801
812
|
}
|
|
802
813
|
async send(e) {
|
|
803
|
-
const t = this.config.key,
|
|
804
|
-
hostname:
|
|
814
|
+
const t = this.config.key, i = new (void 0)(this.constructUrl(t)), s = {
|
|
815
|
+
hostname: i.hostname,
|
|
805
816
|
port: 443,
|
|
806
|
-
path: `${
|
|
817
|
+
path: `${i.pathname}${i.search}`,
|
|
807
818
|
method: "POST",
|
|
808
819
|
headers: {
|
|
809
820
|
"Content-Type": "application/json",
|
|
@@ -811,7 +822,7 @@ class Pe {
|
|
|
811
822
|
}
|
|
812
823
|
};
|
|
813
824
|
return new Promise((r, o) => {
|
|
814
|
-
const c = (void 0)(
|
|
825
|
+
const c = (void 0)(s, (l) => {
|
|
815
826
|
l.on("data", (a) => {
|
|
816
827
|
}), l.on("end", () => {
|
|
817
828
|
const a = l.statusCode || 0;
|
|
@@ -824,16 +835,16 @@ class Pe {
|
|
|
824
835
|
});
|
|
825
836
|
}
|
|
826
837
|
constructUrl(e) {
|
|
827
|
-
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "",
|
|
828
|
-
return `${this.trackingHost}/api/v1/s2s/event?token=${e}${t}${
|
|
838
|
+
const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "";
|
|
839
|
+
return `${this.trackingHost}/api/v1/s2s/event?token=${e}${t}${i}`;
|
|
829
840
|
}
|
|
830
841
|
getCustomHeaders() {
|
|
831
842
|
return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
|
|
832
843
|
}
|
|
833
844
|
}
|
|
834
845
|
class w {
|
|
835
|
-
constructor(e, t = "all",
|
|
836
|
-
this.instance = e, this.trackingType = t, this.options =
|
|
846
|
+
constructor(e, t = "all", i = {}) {
|
|
847
|
+
this.instance = e, this.trackingType = t, this.options = i, document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", this.initialize.bind(this)) : this.initialize();
|
|
837
848
|
}
|
|
838
849
|
initialize() {
|
|
839
850
|
this.trackingType !== "none" && this.setupFormTracking();
|
|
@@ -845,19 +856,19 @@ class w {
|
|
|
845
856
|
});
|
|
846
857
|
}
|
|
847
858
|
handleFormSubmit(e) {
|
|
848
|
-
const t = e.target,
|
|
849
|
-
this.instance.track("$form",
|
|
859
|
+
const t = e.target, i = this._getFormDetails(t);
|
|
860
|
+
this.instance.track("$form", U(i)), this.options.trackFieldChanges && this.trackFieldChanges(t);
|
|
850
861
|
}
|
|
851
862
|
trackFieldChanges(e) {
|
|
852
|
-
e.querySelectorAll("input, select, textarea").forEach((
|
|
853
|
-
|
|
854
|
-
const r = this._getFieldProps(
|
|
855
|
-
this.instance.track("$form_field_change",
|
|
863
|
+
e.querySelectorAll("input, select, textarea").forEach((i) => {
|
|
864
|
+
i.addEventListener("change", (s) => {
|
|
865
|
+
const r = this._getFieldProps(s.target, 0);
|
|
866
|
+
this.instance.track("$form_field_change", U(r));
|
|
856
867
|
});
|
|
857
868
|
});
|
|
858
869
|
}
|
|
859
|
-
static getInstance(e, t = "all",
|
|
860
|
-
return w.instance || (w.instance = new w(e, t,
|
|
870
|
+
static getInstance(e, t = "all", i = {}) {
|
|
871
|
+
return w.instance || (w.instance = new w(e, t, i)), w.instance;
|
|
861
872
|
}
|
|
862
873
|
_getFormDetails(e) {
|
|
863
874
|
const t = {
|
|
@@ -867,20 +878,20 @@ class w {
|
|
|
867
878
|
form_method: e.method,
|
|
868
879
|
form_class: e.className,
|
|
869
880
|
form_attributes: this._getElementAttributes(e)
|
|
870
|
-
},
|
|
871
|
-
return Array.from(
|
|
881
|
+
}, i = e.querySelectorAll("input, select, textarea");
|
|
882
|
+
return Array.from(i).filter((r) => !r.classList.contains("um-no-capture")).forEach((r, o) => {
|
|
872
883
|
const c = this._getFieldProps(r, o);
|
|
873
884
|
Object.assign(t, c);
|
|
874
885
|
}), t;
|
|
875
886
|
}
|
|
876
887
|
_getFieldProps(e, t) {
|
|
877
|
-
const
|
|
888
|
+
const i = Object.keys(e.dataset).length ? JSON.stringify(e.dataset) : void 0, s = this.getSafeText(e);
|
|
878
889
|
return {
|
|
879
890
|
[`field_${t + 1}_tag`]: e.tagName.toLowerCase(),
|
|
880
891
|
[`field_${t + 1}_type`]: e instanceof HTMLInputElement ? e.type : void 0,
|
|
881
|
-
[`field_${t + 1}_data_attributes`]:
|
|
892
|
+
[`field_${t + 1}_data_attributes`]: i,
|
|
882
893
|
[`field_${t + 1}_id`]: e.id,
|
|
883
|
-
[`field_${t + 1}_value`]:
|
|
894
|
+
[`field_${t + 1}_value`]: s,
|
|
884
895
|
[`field_${t + 1}_class`]: e.className,
|
|
885
896
|
[`field_${t + 1}_name`]: e.name,
|
|
886
897
|
[`field_${t + 1}_attributes`]: this._getElementAttributes(e)
|
|
@@ -892,8 +903,8 @@ class w {
|
|
|
892
903
|
getSafeText(e) {
|
|
893
904
|
let t = "";
|
|
894
905
|
return "value" in e && e.type !== "password" ? t = e.value : e.hasChildNodes() ? t = Array.from(e.childNodes).filter(
|
|
895
|
-
(
|
|
896
|
-
).map((
|
|
906
|
+
(s) => s.nodeType === Node.TEXT_NODE
|
|
907
|
+
).map((s) => s.textContent).join("") : t = e.textContent || "", this._scrubPotentiallySensitiveValues(t);
|
|
897
908
|
}
|
|
898
909
|
_scrubPotentiallySensitiveValues(e) {
|
|
899
910
|
return this._shouldCaptureValue(e) ? e : "<redacted>";
|
|
@@ -910,8 +921,8 @@ class w {
|
|
|
910
921
|
_trim(e) {
|
|
911
922
|
if (typeof String.prototype.trim == "function")
|
|
912
923
|
return e.trim();
|
|
913
|
-
let t = 0,
|
|
914
|
-
const
|
|
924
|
+
let t = 0, i = e.length - 1;
|
|
925
|
+
const s = [
|
|
915
926
|
" ",
|
|
916
927
|
`
|
|
917
928
|
`,
|
|
@@ -938,16 +949,16 @@ class w {
|
|
|
938
949
|
" ",
|
|
939
950
|
" "
|
|
940
951
|
].join("");
|
|
941
|
-
for (; t <=
|
|
952
|
+
for (; t <= i && s.indexOf(e[t]) > -1; )
|
|
942
953
|
t++;
|
|
943
|
-
for (;
|
|
944
|
-
|
|
945
|
-
return e.slice(t,
|
|
954
|
+
for (; i >= t && s.indexOf(e[i]) > -1; )
|
|
955
|
+
i--;
|
|
956
|
+
return e.slice(t, i + 1);
|
|
946
957
|
}
|
|
947
958
|
}
|
|
948
|
-
class
|
|
959
|
+
class S {
|
|
949
960
|
constructor(e) {
|
|
950
|
-
this.config = this.mergeConfig(e, q), this.logger = d(this.config.logLevel), this.namespace = e.namespace || "default", this.transport = this.initializeTransport(this.config), this.persistence = this.initializePersistence(), this.retryQueue = new
|
|
961
|
+
this.config = this.mergeConfig(e, q), this.logger = d(this.config.logLevel), this.namespace = e.namespace || "default", this.transport = this.initializeTransport(this.config), this.persistence = this.initializePersistence(), this.retryQueue = new B(
|
|
951
962
|
this.transport,
|
|
952
963
|
this.config.maxSendAttempts || 3,
|
|
953
964
|
this.config.minSendTimeout || 1e3,
|
|
@@ -959,7 +970,7 @@ class C {
|
|
|
959
970
|
), u() && this.initializeBrowserFeatures(), this.anonymousId = this.getOrCreateAnonymousId(), this.logger.info(`Usermaven client initialized for namespace: ${this.namespace}`);
|
|
960
971
|
}
|
|
961
972
|
initializeBrowserFeatures() {
|
|
962
|
-
if (this.cookieManager = new j(this.config.cookieDomain), this.config.autocapture &&
|
|
973
|
+
if (this.cookieManager = new j(this.config.cookieDomain), this.config.autocapture && $.enabledForProject(this.config.key) && !this.config.disableAutocaptureListenerRegistration && (this.autoCapture = new $(this, this.config, this.logger), this.autoCapture.init()), this.config.formTracking) {
|
|
963
974
|
const e = this.config.formTracking === !0 ? "all" : this.config.formTracking;
|
|
964
975
|
this.formTracking = w.getInstance(this, e || "none", {
|
|
965
976
|
trackFieldChanges: !1
|
|
@@ -973,14 +984,14 @@ class C {
|
|
|
973
984
|
* @param defaultConfig
|
|
974
985
|
*/
|
|
975
986
|
mergeConfig(e, t) {
|
|
976
|
-
const
|
|
977
|
-
let
|
|
987
|
+
const i = JSON.parse(JSON.stringify(e));
|
|
988
|
+
let s = { ...t, ...i };
|
|
978
989
|
return Object.keys(t).forEach((r) => {
|
|
979
|
-
v(t[r]) && (
|
|
980
|
-
}),
|
|
990
|
+
v(t[r]) && (s[r] = this.mergeConfig(e[r], t[r]));
|
|
991
|
+
}), s;
|
|
981
992
|
}
|
|
982
993
|
init(e) {
|
|
983
|
-
this.config = { ...this.config, ...e }, this.logger = d(this.config.logLevel), this.namespace = e.namespace || this.namespace, this.transport = this.initializeTransport(e), this.persistence = this.initializePersistence(), this.retryQueue = new
|
|
994
|
+
this.config = { ...this.config, ...e }, this.logger = d(this.config.logLevel), this.namespace = e.namespace || this.namespace, this.transport = this.initializeTransport(e), this.persistence = this.initializePersistence(), this.retryQueue = new B(
|
|
984
995
|
this.transport,
|
|
985
996
|
this.config.maxSendAttempts || 3,
|
|
986
997
|
this.config.minSendTimeout || 1e3,
|
|
@@ -994,17 +1005,17 @@ class C {
|
|
|
994
1005
|
manageCrossDomainLinking() {
|
|
995
1006
|
if (!this.config.crossDomainLinking || !this.config.domains)
|
|
996
1007
|
return;
|
|
997
|
-
const e = this.config.domains.split(",").map((
|
|
998
|
-
document.addEventListener("click", (
|
|
1008
|
+
const e = this.config.domains.split(",").map((i) => i.trim()), t = this.config.cookieName || `__eventn_id_${this.config.key}`;
|
|
1009
|
+
document.addEventListener("click", (i) => {
|
|
999
1010
|
var c;
|
|
1000
|
-
const
|
|
1001
|
-
if (!
|
|
1002
|
-
const r =
|
|
1011
|
+
const s = this.findClosestLink(i.target);
|
|
1012
|
+
if (!s) return;
|
|
1013
|
+
const r = s.getAttribute("href");
|
|
1003
1014
|
if (!r || !r.startsWith("http")) return;
|
|
1004
1015
|
const o = new URL(r);
|
|
1005
1016
|
if (o.hostname !== window.location.hostname && e.includes(o.hostname)) {
|
|
1006
1017
|
const l = (c = this.cookieManager) == null ? void 0 : c.get(t);
|
|
1007
|
-
l && (o.searchParams.append("_um", l),
|
|
1018
|
+
l && (o.searchParams.append("_um", l), s.setAttribute("href", o.toString()));
|
|
1008
1019
|
}
|
|
1009
1020
|
}), this.logger.debug("Cross-domain linking initialized");
|
|
1010
1021
|
}
|
|
@@ -1016,29 +1027,29 @@ class C {
|
|
|
1016
1027
|
initializeTransport(e) {
|
|
1017
1028
|
const t = "https://events.usermaven.com";
|
|
1018
1029
|
if (!u())
|
|
1019
|
-
return new
|
|
1020
|
-
const
|
|
1030
|
+
return new Ee(e.trackingHost || t, e);
|
|
1031
|
+
const i = "XMLHttpRequest" in window, s = typeof fetch < "u", r = typeof navigator < "u" && "sendBeacon" in navigator;
|
|
1021
1032
|
if (e.useBeaconApi && r)
|
|
1022
1033
|
return new ke(e.trackingHost || t, e, this.logger);
|
|
1023
|
-
if (e.forceUseFetch &&
|
|
1034
|
+
if (e.forceUseFetch && s)
|
|
1024
1035
|
return new z(e.trackingHost || t, e, this.logger);
|
|
1025
|
-
if (
|
|
1036
|
+
if (i)
|
|
1026
1037
|
return new ve(e.trackingHost || t, e, this.logger);
|
|
1027
|
-
if (
|
|
1038
|
+
if (s)
|
|
1028
1039
|
return new z(e.trackingHost || t, e, this.logger);
|
|
1029
1040
|
throw new Error("No suitable transport method available");
|
|
1030
1041
|
}
|
|
1031
1042
|
initializePersistence() {
|
|
1032
|
-
return this.config.disableEventPersistence || !u() ? new _e() : new
|
|
1043
|
+
return this.config.disableEventPersistence || !u() ? new _e() : new K(`${this.namespace}_${this.config.key}`, this.logger);
|
|
1033
1044
|
}
|
|
1034
1045
|
getOrCreateAnonymousId() {
|
|
1035
|
-
var
|
|
1046
|
+
var i, s;
|
|
1036
1047
|
if (!u())
|
|
1037
1048
|
return x();
|
|
1038
1049
|
if (this.config.privacyPolicy === "strict" || this.config.cookiePolicy === "strict")
|
|
1039
1050
|
return "";
|
|
1040
1051
|
const e = this.config.cookieName || `__eventn_id_${this.config.key}`;
|
|
1041
|
-
let t = (
|
|
1052
|
+
let t = (i = this.cookieManager) == null ? void 0 : i.get(e);
|
|
1042
1053
|
if (!t) {
|
|
1043
1054
|
if (this.config.crossDomainLinking) {
|
|
1044
1055
|
const c = new URLSearchParams(window.location.search).get("_um"), a = window.location.hash.substring(1).split("~"), h = a.length > 1 ? a[1] : void 0;
|
|
@@ -1046,7 +1057,7 @@ class C {
|
|
|
1046
1057
|
}
|
|
1047
1058
|
t || (t = x());
|
|
1048
1059
|
const r = 365 * 10;
|
|
1049
|
-
(
|
|
1060
|
+
(s = this.cookieManager) == null || s.set(e, t, r, document.location.protocol !== "http:", !1);
|
|
1050
1061
|
}
|
|
1051
1062
|
return t;
|
|
1052
1063
|
}
|
|
@@ -1057,20 +1068,20 @@ class C {
|
|
|
1057
1068
|
throw new Error("Invalid email provided");
|
|
1058
1069
|
if (!e.id || !F(e.id))
|
|
1059
1070
|
throw new Error("User ID must be a string");
|
|
1060
|
-
const
|
|
1061
|
-
if (this.persistence.set("userId",
|
|
1062
|
-
const
|
|
1071
|
+
const i = e.id;
|
|
1072
|
+
if (this.persistence.set("userId", i), this.persistence.set("userProps", e), !t) {
|
|
1073
|
+
const s = {
|
|
1063
1074
|
...e,
|
|
1064
1075
|
anonymous_id: this.anonymousId
|
|
1065
1076
|
};
|
|
1066
|
-
await this.track("user_identify",
|
|
1077
|
+
await this.track("user_identify", s);
|
|
1067
1078
|
}
|
|
1068
1079
|
this.logger.info("User identified:", e);
|
|
1069
1080
|
}
|
|
1070
|
-
track(e, t,
|
|
1071
|
-
this.trackInternal(e, t,
|
|
1081
|
+
track(e, t, i = !1) {
|
|
1082
|
+
this.trackInternal(e, t, i);
|
|
1072
1083
|
}
|
|
1073
|
-
trackInternal(e, t,
|
|
1084
|
+
trackInternal(e, t, i = !1) {
|
|
1074
1085
|
if (me()) {
|
|
1075
1086
|
this.logger.debug("Tracking disabled due to um_exclusion setting");
|
|
1076
1087
|
return;
|
|
@@ -1081,7 +1092,7 @@ class C {
|
|
|
1081
1092
|
throw new Error("Event payload must be a non-null object and not an array");
|
|
1082
1093
|
const r = this.createEventPayload(e, t);
|
|
1083
1094
|
try {
|
|
1084
|
-
if (
|
|
1095
|
+
if (i) {
|
|
1085
1096
|
this.transport.send(r), this.logger.debug(`Event sent: ${e}`, [r]);
|
|
1086
1097
|
return;
|
|
1087
1098
|
}
|
|
@@ -1103,16 +1114,16 @@ class C {
|
|
|
1103
1114
|
this.persistence.set("companyProps", e), t || await this.track("group", e), this.logger.info("Company identified:", e);
|
|
1104
1115
|
}
|
|
1105
1116
|
createEventPayload(e, t) {
|
|
1106
|
-
const
|
|
1117
|
+
const i = this.persistence.get("userProps") || {}, s = this.persistence.get("companyProps") || (i == null ? void 0 : i.company) || {}, r = this.persistence.get("userId"), o = this.persistence.get("global_props") || {}, c = this.persistence.get(`props_${e}`) || {};
|
|
1107
1118
|
let l = t || {};
|
|
1108
1119
|
const a = {
|
|
1109
1120
|
event_id: "",
|
|
1110
1121
|
user: {
|
|
1111
1122
|
anonymous_id: this.anonymousId,
|
|
1112
1123
|
id: r,
|
|
1113
|
-
...
|
|
1124
|
+
...i
|
|
1114
1125
|
},
|
|
1115
|
-
...
|
|
1126
|
+
...s && { company: s },
|
|
1116
1127
|
ids: this.getThirdPartyIds(),
|
|
1117
1128
|
utc_time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1118
1129
|
local_tz_offset: (/* @__PURE__ */ new Date()).getTimezoneOffset(),
|
|
@@ -1133,9 +1144,9 @@ class C {
|
|
|
1133
1144
|
}
|
|
1134
1145
|
processAutocaptureAttributes(e) {
|
|
1135
1146
|
let t = {};
|
|
1136
|
-
const
|
|
1137
|
-
return
|
|
1138
|
-
delete t[
|
|
1147
|
+
const i = e.$elements || [];
|
|
1148
|
+
return i.length && (t = { ...i[0] }), t.el_text = t.$el_text || "", t.event_type = e.$event_type || "", ["$ce_version", "$event_type", "$initial_referrer", "$initial_referring_domain", "$referrer", "$referring_domain", "$elements"].forEach((s) => {
|
|
1149
|
+
delete t[s];
|
|
1139
1150
|
}), delete t.$el_text, delete t.nth_child, delete t.nth_of_type, t;
|
|
1140
1151
|
}
|
|
1141
1152
|
getCookie(e) {
|
|
@@ -1152,8 +1163,8 @@ class C {
|
|
|
1152
1163
|
}
|
|
1153
1164
|
getUtmParams() {
|
|
1154
1165
|
const e = {}, t = ge(window.location.search);
|
|
1155
|
-
return ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"].forEach((
|
|
1156
|
-
t[
|
|
1166
|
+
return ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"].forEach((s) => {
|
|
1167
|
+
t[s] && (e[s.replace("utm_", "")] = t[s]);
|
|
1157
1168
|
}), e;
|
|
1158
1169
|
}
|
|
1159
1170
|
pageview() {
|
|
@@ -1166,7 +1177,7 @@ class C {
|
|
|
1166
1177
|
setupPageLeaveTracking() {
|
|
1167
1178
|
if (!u()) return;
|
|
1168
1179
|
let e = !1, t = !1;
|
|
1169
|
-
const
|
|
1180
|
+
const i = () => {
|
|
1170
1181
|
!e && !t && (e = !0, this.track("$pageleave", {
|
|
1171
1182
|
url: window.location.href,
|
|
1172
1183
|
referrer: document.referrer,
|
|
@@ -1178,12 +1189,12 @@ class C {
|
|
|
1178
1189
|
t = !1;
|
|
1179
1190
|
}, 100);
|
|
1180
1191
|
}), document.addEventListener("visibilitychange", () => {
|
|
1181
|
-
document.visibilityState === "hidden" && !t &&
|
|
1192
|
+
document.visibilityState === "hidden" && !t && i();
|
|
1182
1193
|
});
|
|
1183
|
-
const
|
|
1194
|
+
const s = history.pushState;
|
|
1184
1195
|
history.pushState = function() {
|
|
1185
|
-
return
|
|
1186
|
-
}, window.addEventListener("popstate",
|
|
1196
|
+
return i(), s.apply(this, arguments);
|
|
1197
|
+
}, window.addEventListener("popstate", i);
|
|
1187
1198
|
}
|
|
1188
1199
|
getConfig() {
|
|
1189
1200
|
return this.config;
|
|
@@ -1201,18 +1212,18 @@ class C {
|
|
|
1201
1212
|
set(e, t) {
|
|
1202
1213
|
if (!v(e))
|
|
1203
1214
|
throw new Error("Properties must be an object");
|
|
1204
|
-
const
|
|
1205
|
-
if (
|
|
1206
|
-
let r = this.persistence.get(`props_${
|
|
1207
|
-
r = { ...r, ...e }, this.persistence.set(`props_${
|
|
1215
|
+
const i = t == null ? void 0 : t.eventType, s = (t == null ? void 0 : t.persist) ?? !0;
|
|
1216
|
+
if (i) {
|
|
1217
|
+
let r = this.persistence.get(`props_${i}`) || {};
|
|
1218
|
+
r = { ...r, ...e }, this.persistence.set(`props_${i}`, r);
|
|
1208
1219
|
} else {
|
|
1209
1220
|
let r = this.persistence.get("global_props") || {};
|
|
1210
1221
|
r = { ...r, ...e }, this.persistence.set("global_props", r);
|
|
1211
1222
|
}
|
|
1212
|
-
|
|
1223
|
+
s && this.persistence.save(), this.logger.debug("Properties set", {
|
|
1213
1224
|
properties: e,
|
|
1214
|
-
eventType:
|
|
1215
|
-
persist:
|
|
1225
|
+
eventType: i || "global",
|
|
1226
|
+
persist: s
|
|
1216
1227
|
});
|
|
1217
1228
|
}
|
|
1218
1229
|
setUserId(e) {
|
|
@@ -1221,127 +1232,129 @@ class C {
|
|
|
1221
1232
|
t.id = e, this.persistence.set("userProps", t), this.persistence.save();
|
|
1222
1233
|
}
|
|
1223
1234
|
unset(e, t) {
|
|
1224
|
-
const
|
|
1225
|
-
if (
|
|
1226
|
-
let r = this.persistence.get(`props_${
|
|
1227
|
-
delete r[e], this.persistence.set(`props_${
|
|
1235
|
+
const i = t == null ? void 0 : t.eventType, s = (t == null ? void 0 : t.persist) ?? !0;
|
|
1236
|
+
if (i) {
|
|
1237
|
+
let r = this.persistence.get(`props_${i}`) || {};
|
|
1238
|
+
delete r[e], this.persistence.set(`props_${i}`, r);
|
|
1228
1239
|
} else {
|
|
1229
1240
|
let r = this.persistence.get("global_props") || {};
|
|
1230
1241
|
delete r[e], this.persistence.set("global_props", r);
|
|
1231
1242
|
}
|
|
1232
|
-
|
|
1243
|
+
s && this.persistence.save(), this.logger.debug(`Property unset: ${e}`, `Event type: ${i || "global"}`);
|
|
1233
1244
|
}
|
|
1234
1245
|
}
|
|
1235
|
-
function
|
|
1246
|
+
function X() {
|
|
1236
1247
|
return typeof window < "u" && typeof window.define == "function" && window.define.amd;
|
|
1237
1248
|
}
|
|
1238
|
-
function
|
|
1239
|
-
return
|
|
1249
|
+
function Pe() {
|
|
1250
|
+
return X() ? window.define : void 0;
|
|
1240
1251
|
}
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1252
|
+
const Ae = "__USERMAVEN_AUTOCAPTURE_INITIALIZED__";
|
|
1253
|
+
function C(n) {
|
|
1254
|
+
const e = JSON.parse(JSON.stringify(n)), t = I(e), i = { ...q, ...t };
|
|
1255
|
+
if (!i.key)
|
|
1244
1256
|
throw new Error("API key is required!");
|
|
1245
|
-
if (!
|
|
1257
|
+
if (!i.trackingHost)
|
|
1246
1258
|
throw new Error("Tracking host is required!");
|
|
1247
|
-
|
|
1259
|
+
const s = i.key || "", r = `${Ae}${s}`;
|
|
1260
|
+
return u() && i.autocapture && window[r] && (console.warn("Usermaven: Autocapture already initialized in another instance, skipping duplicate initialization."), i.disableAutocaptureListenerRegistration = !0), u() && i.autocapture && !i.disableAutocaptureListenerRegistration && (window[r] = !0), new S(i);
|
|
1248
1261
|
}
|
|
1249
|
-
function $e(
|
|
1250
|
-
var
|
|
1262
|
+
function $e(n) {
|
|
1263
|
+
var s;
|
|
1251
1264
|
const e = {
|
|
1252
|
-
key:
|
|
1253
|
-
trackingHost:
|
|
1254
|
-
logLevel: pe(
|
|
1255
|
-
autocapture:
|
|
1256
|
-
formTracking:
|
|
1257
|
-
autoPageview:
|
|
1258
|
-
useBeaconApi:
|
|
1259
|
-
forceUseFetch:
|
|
1260
|
-
gaHook:
|
|
1261
|
-
segmentHook:
|
|
1262
|
-
randomizeUrl:
|
|
1263
|
-
capture3rdPartyCookies:
|
|
1264
|
-
idMethod:
|
|
1265
|
-
privacyPolicy:
|
|
1266
|
-
ipPolicy:
|
|
1267
|
-
cookiePolicy:
|
|
1268
|
-
minSendTimeout: parseInt(
|
|
1269
|
-
maxSendTimeout: parseInt(
|
|
1270
|
-
maxSendAttempts: parseInt(
|
|
1271
|
-
propertiesStringMaxLength: parseInt(
|
|
1272
|
-
propertyBlacklist: ((
|
|
1273
|
-
exclude:
|
|
1274
|
-
namespace:
|
|
1275
|
-
crossDomainLinking:
|
|
1276
|
-
domains:
|
|
1277
|
-
maskAllText:
|
|
1278
|
-
maskAllElementAttributes:
|
|
1265
|
+
key: n.getAttribute("data-key") || void 0,
|
|
1266
|
+
trackingHost: n.getAttribute("data-tracking-host") || "https://events.usermaven.com",
|
|
1267
|
+
logLevel: pe(n.getAttribute("data-log-level")),
|
|
1268
|
+
autocapture: n.getAttribute("data-autocapture") === "true",
|
|
1269
|
+
formTracking: n.getAttribute("data-form-tracking") === "false" ? !1 : n.getAttribute("data-form-tracking") === "true" ? "all" : n.getAttribute("data-form-tracking"),
|
|
1270
|
+
autoPageview: n.getAttribute("data-auto-pageview") === "true",
|
|
1271
|
+
useBeaconApi: n.getAttribute("data-use-beacon-api") === "true",
|
|
1272
|
+
forceUseFetch: n.getAttribute("data-force-use-fetch") === "true",
|
|
1273
|
+
gaHook: n.getAttribute("data-ga-hook") === "true",
|
|
1274
|
+
segmentHook: n.getAttribute("data-segment-hook") === "true",
|
|
1275
|
+
randomizeUrl: n.getAttribute("data-randomize-url") === "true",
|
|
1276
|
+
capture3rdPartyCookies: n.getAttribute("data-capture-3rd-party-cookies") === "false" ? !1 : void 0,
|
|
1277
|
+
idMethod: n.getAttribute("data-id-method") || void 0,
|
|
1278
|
+
privacyPolicy: n.getAttribute("data-privacy-policy") === "strict" ? "strict" : void 0,
|
|
1279
|
+
ipPolicy: n.getAttribute("data-ip-policy") || void 0,
|
|
1280
|
+
cookiePolicy: n.getAttribute("data-cookie-policy") || void 0,
|
|
1281
|
+
minSendTimeout: parseInt(n.getAttribute("data-min-send-timeout") || "", 10) || void 0,
|
|
1282
|
+
maxSendTimeout: parseInt(n.getAttribute("data-max-send-timeout") || "", 10) || void 0,
|
|
1283
|
+
maxSendAttempts: parseInt(n.getAttribute("data-max-send-attempts") || "", 10) || void 0,
|
|
1284
|
+
propertiesStringMaxLength: parseInt(n.getAttribute("data-properties-string-max-length") || "", 10) || null,
|
|
1285
|
+
propertyBlacklist: ((s = n.getAttribute("data-property-blacklist")) == null ? void 0 : s.split(",")) || void 0,
|
|
1286
|
+
exclude: n.getAttribute("data-exclude") || void 0,
|
|
1287
|
+
namespace: n.getAttribute("data-namespace") || void 0,
|
|
1288
|
+
crossDomainLinking: n.getAttribute("data-cross-domain-linking") !== "false",
|
|
1289
|
+
domains: n.getAttribute("data-domains") || void 0,
|
|
1290
|
+
maskAllText: n.getAttribute("data-mask-all-text") === "true",
|
|
1291
|
+
maskAllElementAttributes: n.getAttribute("data-mask-all-element-attributes") === "true"
|
|
1279
1292
|
};
|
|
1280
1293
|
e.privacyPolicy === "strict" && (e.cookiePolicy = "strict", e.ipPolicy = "strict"), e.cookiePolicy === "comply" && e.useBeaconApi && (e.cookiePolicy = "strict");
|
|
1281
|
-
const t =
|
|
1282
|
-
return u() && e.autoPageview !== !1 && t.pageview(), Se(
|
|
1294
|
+
const t = C(e), i = e.namespace || "usermaven";
|
|
1295
|
+
return u() && e.autoPageview !== !1 && t.pageview(), Se(i, t), t;
|
|
1283
1296
|
}
|
|
1284
|
-
function Se(
|
|
1297
|
+
function Se(n, e) {
|
|
1285
1298
|
let t = !1;
|
|
1286
|
-
const
|
|
1299
|
+
const i = [], s = [];
|
|
1287
1300
|
function r() {
|
|
1288
|
-
for (;
|
|
1289
|
-
const a =
|
|
1290
|
-
a && window[
|
|
1301
|
+
for (; i.length > 0; ) {
|
|
1302
|
+
const a = i.shift();
|
|
1303
|
+
a && window[n].apply(null, a);
|
|
1291
1304
|
}
|
|
1292
1305
|
}
|
|
1293
1306
|
function o() {
|
|
1294
|
-
|
|
1307
|
+
s.forEach((a) => a()), s.length = 0;
|
|
1295
1308
|
}
|
|
1296
|
-
window[
|
|
1309
|
+
window[n] = function(...a) {
|
|
1297
1310
|
const h = a[0];
|
|
1298
1311
|
if (h === "onLoad") {
|
|
1299
|
-
typeof a[1] == "function" && (t ? a[1]() :
|
|
1312
|
+
typeof a[1] == "function" && (t ? a[1]() : s.push(a[1]));
|
|
1300
1313
|
return;
|
|
1301
1314
|
}
|
|
1302
1315
|
if (!t) {
|
|
1303
|
-
|
|
1316
|
+
i.push(a);
|
|
1304
1317
|
return;
|
|
1305
1318
|
}
|
|
1306
1319
|
if (typeof e[h] == "function")
|
|
1307
1320
|
return e[h].apply(e, a.slice(1));
|
|
1308
1321
|
console.error(`Method ${h} not found on UsermavenClient`);
|
|
1309
1322
|
};
|
|
1310
|
-
const c = `${
|
|
1323
|
+
const c = `${n}Q`, l = window[c] || [];
|
|
1311
1324
|
for (window[c] = l, l.push = function(...a) {
|
|
1312
|
-
return window[
|
|
1325
|
+
return window[n].apply(null, a), Array.prototype.push.apply(this, a);
|
|
1313
1326
|
}, setTimeout(() => {
|
|
1314
|
-
t = !0, r(), o(), console.log(`Usermaven client for namespace ${
|
|
1327
|
+
t = !0, r(), o(), console.log(`Usermaven client for namespace ${n} is ready`);
|
|
1315
1328
|
}, 0); l.length > 0; ) {
|
|
1316
1329
|
const a = l.shift();
|
|
1317
|
-
a &&
|
|
1330
|
+
a && i.push(a);
|
|
1318
1331
|
}
|
|
1319
1332
|
}
|
|
1320
|
-
let
|
|
1333
|
+
let M = !1, H = null;
|
|
1321
1334
|
if (u()) {
|
|
1322
|
-
const
|
|
1323
|
-
|
|
1335
|
+
const n = Pe();
|
|
1336
|
+
n && n("usermaven", [], function() {
|
|
1324
1337
|
return {
|
|
1325
|
-
usermavenClient:
|
|
1326
|
-
UsermavenClient:
|
|
1338
|
+
usermavenClient: C,
|
|
1339
|
+
UsermavenClient: S,
|
|
1327
1340
|
LogLevel: p,
|
|
1328
1341
|
// Expose the script tag client if it exists
|
|
1329
1342
|
getScriptTagClient: () => H
|
|
1330
1343
|
};
|
|
1331
|
-
}), typeof window < "u" && (window.usermavenClient =
|
|
1332
|
-
const
|
|
1333
|
-
function
|
|
1334
|
-
return
|
|
1344
|
+
}), typeof window < "u" && (window.usermavenClient = C, window.UsermavenClient = S, window.usermavenScriptTagClient = () => H), function(e, t) {
|
|
1345
|
+
const i = e.currentScript;
|
|
1346
|
+
function s() {
|
|
1347
|
+
return M || !i || !i.hasAttribute("data-key") || i.getAttribute("data-no-auto-init") === "true" ? !1 : i.src.includes("lib.js");
|
|
1335
1348
|
}
|
|
1336
1349
|
function r() {
|
|
1337
|
-
|
|
1350
|
+
s() && (console.log("[Usermaven] Auto-initializing from script tag"), H = $e(i), M = !0);
|
|
1338
1351
|
}
|
|
1339
|
-
typeof t < "u" &&
|
|
1352
|
+
typeof t < "u" && i && (e.readyState === "loading" ? e.addEventListener("DOMContentLoaded", r) : r());
|
|
1340
1353
|
}(document, window);
|
|
1341
1354
|
}
|
|
1342
|
-
typeof module < "u" && module.exports && !
|
|
1343
|
-
usermavenClient:
|
|
1344
|
-
UsermavenClient:
|
|
1355
|
+
typeof module < "u" && module.exports && !X() && (module.exports = {
|
|
1356
|
+
usermavenClient: C,
|
|
1357
|
+
UsermavenClient: S,
|
|
1345
1358
|
Config: void 0,
|
|
1346
1359
|
UserProps: void 0,
|
|
1347
1360
|
EventPayload: void 0,
|
|
@@ -1350,7 +1363,7 @@ typeof module < "u" && module.exports && !K() && (module.exports = {
|
|
|
1350
1363
|
});
|
|
1351
1364
|
|
|
1352
1365
|
function createClient(params) {
|
|
1353
|
-
return
|
|
1366
|
+
return C(params);
|
|
1354
1367
|
}
|
|
1355
1368
|
|
|
1356
1369
|
function useUsermaven() {
|