zar 0.4.3 → 0.5.0
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/dist/zar.es.js +203 -1304
- package/dist/zar.es.js.map +1 -1
- package/dist/zar.iife.js +1 -2
- package/dist/zar.iife.js.map +1 -1
- package/dist/zar.umd.js +1 -2
- package/dist/zar.umd.js.map +1 -1
- package/package.json +10 -8
package/dist/zar.es.js
CHANGED
|
@@ -3,1262 +3,179 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3
3
|
var fulfilled = (value) => {
|
|
4
4
|
try {
|
|
5
5
|
step(generator.next(value));
|
|
6
|
-
} catch (
|
|
7
|
-
reject(
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
var rejected = (value) => {
|
|
11
11
|
try {
|
|
12
12
|
step(generator.throw(value));
|
|
13
|
-
} catch (
|
|
14
|
-
reject(
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
var step = (
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
18
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
typeof Deno != "undefined" && Deno.core !== void 0;
|
|
31
|
-
$$1 && window.name === "nodejs" || typeof navigator != "undefined" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
32
|
-
function M$1(n2, t2) {
|
|
33
|
-
return t2.charAt(0)[n2]() + t2.slice(1);
|
|
34
|
-
}
|
|
35
|
-
var U$1 = M$1.bind(null, "toUpperCase"), H$1 = M$1.bind(null, "toLowerCase");
|
|
36
|
-
function J$2(n2) {
|
|
37
|
-
return Y$1(n2) ? U$1("null") : typeof n2 == "object" ? yn(n2) : Object.prototype.toString.call(n2).slice(8, -1);
|
|
38
|
-
}
|
|
39
|
-
function R$1(n2, t2) {
|
|
40
|
-
t2 === void 0 && (t2 = true);
|
|
41
|
-
var e2 = J$2(n2);
|
|
42
|
-
return t2 ? H$1(e2) : e2;
|
|
43
|
-
}
|
|
44
|
-
function V$1(n2, t2) {
|
|
45
|
-
return typeof t2 === n2;
|
|
46
|
-
}
|
|
47
|
-
var W$1 = V$1.bind(null, "function"), q$1 = V$1.bind(null, "string"), I$2 = V$1.bind(null, "undefined");
|
|
48
|
-
var Q$1 = V$1.bind(null, "boolean");
|
|
49
|
-
V$1.bind(null, "symbol");
|
|
50
|
-
function Y$1(n2) {
|
|
51
|
-
return n2 === null;
|
|
52
|
-
}
|
|
53
|
-
function nn(n2) {
|
|
54
|
-
return R$1(n2) === "number" && !isNaN(n2);
|
|
55
|
-
}
|
|
56
|
-
function rn(n2) {
|
|
57
|
-
return R$1(n2) === "array";
|
|
58
|
-
}
|
|
59
|
-
function on(n2) {
|
|
60
|
-
if (!un(n2))
|
|
61
|
-
return false;
|
|
62
|
-
for (var t2 = n2; Object.getPrototypeOf(t2) !== null; )
|
|
63
|
-
t2 = Object.getPrototypeOf(t2);
|
|
64
|
-
return Object.getPrototypeOf(n2) === t2;
|
|
65
|
-
}
|
|
66
|
-
function un(n2) {
|
|
67
|
-
return n2 && (typeof n2 == "object" || n2 !== null);
|
|
68
|
-
}
|
|
69
|
-
function yn(n2) {
|
|
70
|
-
return W$1(n2.constructor) ? n2.constructor.name : null;
|
|
71
|
-
}
|
|
72
|
-
function hn(n2) {
|
|
73
|
-
return n2 instanceof Error || q$1(n2.message) && n2.constructor && nn(n2.constructor.stackTraceLimit);
|
|
74
|
-
}
|
|
75
|
-
function On(n2, t2) {
|
|
76
|
-
if (typeof t2 != "object" || Y$1(t2))
|
|
77
|
-
return false;
|
|
78
|
-
if (t2 instanceof n2)
|
|
79
|
-
return true;
|
|
80
|
-
var e2 = R$1(new n2(""));
|
|
81
|
-
if (hn(t2))
|
|
82
|
-
for (; t2; ) {
|
|
83
|
-
if (R$1(t2) === e2)
|
|
84
|
-
return true;
|
|
85
|
-
t2 = Object.getPrototypeOf(t2);
|
|
86
|
-
}
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
On.bind(null, TypeError);
|
|
90
|
-
On.bind(null, SyntaxError);
|
|
91
|
-
function $n(n2, t2) {
|
|
92
|
-
var e2 = n2 instanceof Element || n2 instanceof HTMLDocument;
|
|
93
|
-
return e2 && t2 ? Tn(n2, t2) : e2;
|
|
94
|
-
}
|
|
95
|
-
function Tn(n2, t2) {
|
|
96
|
-
return t2 === void 0 && (t2 = ""), n2 && n2.nodeName === t2.toUpperCase();
|
|
97
|
-
}
|
|
98
|
-
function _n(n2) {
|
|
99
|
-
var t2 = [].slice.call(arguments, 1);
|
|
100
|
-
return function() {
|
|
101
|
-
return n2.apply(void 0, [].slice.call(arguments).concat(t2));
|
|
21
|
+
function Analytics({ app, plugins = [] } = {}) {
|
|
22
|
+
const instance = {
|
|
23
|
+
app,
|
|
24
|
+
plugins: {},
|
|
25
|
+
page: (payload = {}) => runPage(instance, payload),
|
|
26
|
+
track: (event, properties = {}, options) => runTrack(instance, options ? { event, properties, options } : { event, properties }),
|
|
27
|
+
reset: (...args) => __async(this, null, function* () {
|
|
28
|
+
return runReset(instance, ...args);
|
|
29
|
+
})
|
|
102
30
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if ($$1) {
|
|
117
|
-
var r2 = navigator, t2 = r2.languages;
|
|
118
|
-
return r2.userLanguage || (t2 && t2.length ? t2[0] : r2.language);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
function a$3() {
|
|
122
|
-
try {
|
|
123
|
-
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
124
|
-
} catch (e2) {
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
function s(r2) {
|
|
128
|
-
return function(e2) {
|
|
129
|
-
for (var r3, t2 = /* @__PURE__ */ Object.create(null), o2 = /([^&=]+)=?([^&]*)/g; r3 = o2.exec(e2); ) {
|
|
130
|
-
var a2 = n$1(r3[1]), i2 = n$1(r3[2]);
|
|
131
|
-
a2.substring(a2.length - 2) === "[]" ? (t2[a2 = a2.substring(0, a2.length - 2)] || (t2[a2] = [])).push(i2) : t2[a2] = i2 === "" || i2;
|
|
132
|
-
}
|
|
133
|
-
for (var u2 in t2) {
|
|
134
|
-
var c2 = u2.split("[");
|
|
135
|
-
c2.length > 1 && (m(t2, c2.map(function(e3) {
|
|
136
|
-
return e3.replace(/[?[\]\\ ]/g, "");
|
|
137
|
-
}), t2[u2]), delete t2[u2]);
|
|
138
|
-
}
|
|
139
|
-
return t2;
|
|
140
|
-
}(function(r3) {
|
|
141
|
-
if (r3) {
|
|
142
|
-
var t2 = r3.match(/\?(.*)/);
|
|
143
|
-
return t2 && t2[1] ? t2[1].split("#")[0] : "";
|
|
144
|
-
}
|
|
145
|
-
return $$1 && window.location.search.substring(1);
|
|
146
|
-
}(r2));
|
|
147
|
-
}
|
|
148
|
-
function m(e2, r2, t2) {
|
|
149
|
-
for (var n2 = r2.length - 1, o2 = 0; o2 < n2; ++o2) {
|
|
150
|
-
var a2 = r2[o2];
|
|
151
|
-
if (a2 === "__proto__" || a2 === "constructor")
|
|
152
|
-
break;
|
|
153
|
-
a2 in e2 || (e2[a2] = {}), e2 = e2[a2];
|
|
154
|
-
}
|
|
155
|
-
e2[r2[n2]] = t2;
|
|
156
|
-
}
|
|
157
|
-
function y$1() {
|
|
158
|
-
for (var e2 = "", r2 = 0, t2 = 4294967295 * Math.random() | 0; r2++ < 36; ) {
|
|
159
|
-
var n2 = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[r2 - 1], o2 = 15 & t2;
|
|
160
|
-
e2 += n2 == "-" || n2 == "4" ? n2 : (n2 == "x" ? o2 : 3 & o2 | 8).toString(16), t2 = r2 % 8 == 0 ? 4294967295 * Math.random() | 0 : t2 >> 4;
|
|
161
|
-
}
|
|
162
|
-
return e2;
|
|
163
|
-
}
|
|
164
|
-
var l = "global", o = j$1 + "global" + j$1, n = typeof self === o$2 && self.self === self && self || typeof global === o$2 && global.global === global && global || void 0;
|
|
165
|
-
function a$2(t2) {
|
|
166
|
-
return n[o][t2];
|
|
167
|
-
}
|
|
168
|
-
function f(t2, e2) {
|
|
169
|
-
return n[o][t2] = e2;
|
|
170
|
-
}
|
|
171
|
-
function i$2(t2) {
|
|
172
|
-
delete n[o][t2];
|
|
173
|
-
}
|
|
174
|
-
function u$1(t2, e2, r2) {
|
|
175
|
-
var l2;
|
|
176
|
-
try {
|
|
177
|
-
if (b$2(t2)) {
|
|
178
|
-
var o2 = window[t2];
|
|
179
|
-
l2 = o2[e2].bind(o2);
|
|
180
|
-
}
|
|
181
|
-
} catch (t3) {
|
|
182
|
-
}
|
|
183
|
-
return l2 || r2;
|
|
184
|
-
}
|
|
185
|
-
n[o] || (n[o] = {});
|
|
186
|
-
var c$1 = {};
|
|
187
|
-
function b$2(t2) {
|
|
188
|
-
if (typeof c$1[t2] !== e)
|
|
189
|
-
return c$1[t2];
|
|
190
|
-
try {
|
|
191
|
-
var e$1 = window[t2];
|
|
192
|
-
e$1.setItem(e, e), e$1.removeItem(e);
|
|
193
|
-
} catch (e2) {
|
|
194
|
-
return c$1[t2] = false;
|
|
195
|
-
}
|
|
196
|
-
return c$1[t2] = true;
|
|
197
|
-
}
|
|
198
|
-
function v() {
|
|
199
|
-
return v = Object.assign || function(e2) {
|
|
200
|
-
for (var n2 = 1; n2 < arguments.length; n2++) {
|
|
201
|
-
var t2 = arguments[n2];
|
|
202
|
-
for (var r2 in t2)
|
|
203
|
-
Object.prototype.hasOwnProperty.call(t2, r2) && (e2[r2] = t2[r2]);
|
|
31
|
+
plugins.forEach((p) => {
|
|
32
|
+
if (!p || !p.name)
|
|
33
|
+
return;
|
|
34
|
+
p.instance = instance;
|
|
35
|
+
if (p.methods) {
|
|
36
|
+
Object.keys(p.methods).forEach((k) => {
|
|
37
|
+
const fn = p.methods[k];
|
|
38
|
+
if (typeof fn === "function") {
|
|
39
|
+
const bound = fn.bind(p);
|
|
40
|
+
p.methods[k] = bound;
|
|
41
|
+
p[k] = bound;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
204
44
|
}
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
var y = "function", b$1 = "undefined", I$1 = "@@redux/" + Math.random().toString(36), w = /* @__PURE__ */ function() {
|
|
209
|
-
return typeof Symbol === y && Symbol.observable || "@@observable";
|
|
210
|
-
}(), E$1 = " != " + y;
|
|
211
|
-
function P(e2, n2, t2) {
|
|
212
|
-
var r2;
|
|
213
|
-
if (typeof n2 === y && typeof t2 === b$1 && (t2 = n2, n2 = void 0), typeof t2 !== b$1) {
|
|
214
|
-
if (typeof t2 !== y)
|
|
215
|
-
throw new Error("enhancer" + E$1);
|
|
216
|
-
return t2(P)(e2, n2);
|
|
217
|
-
}
|
|
218
|
-
if (typeof e2 !== y)
|
|
219
|
-
throw new Error("reducer" + E$1);
|
|
220
|
-
var i2 = e2, a2 = n2, o2 = [], u2 = o2, c2 = false;
|
|
221
|
-
function s2() {
|
|
222
|
-
u2 === o2 && (u2 = o2.slice());
|
|
223
|
-
}
|
|
224
|
-
function f2() {
|
|
225
|
-
return a2;
|
|
226
|
-
}
|
|
227
|
-
function d2(e3) {
|
|
228
|
-
if (typeof e3 !== y)
|
|
229
|
-
throw new Error("Listener" + E$1);
|
|
230
|
-
var n3 = true;
|
|
231
|
-
return s2(), u2.push(e3), function() {
|
|
232
|
-
if (n3) {
|
|
233
|
-
n3 = false, s2();
|
|
234
|
-
var t3 = u2.indexOf(e3);
|
|
235
|
-
u2.splice(t3, 1);
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
function p(e3) {
|
|
240
|
-
if (!on(e3))
|
|
241
|
-
throw new Error("Act != obj");
|
|
242
|
-
if (typeof e3.type === b$1)
|
|
243
|
-
throw new Error("ActType " + b$1);
|
|
244
|
-
if (c2)
|
|
245
|
-
throw new Error("Dispatch in reducer");
|
|
45
|
+
instance.plugins[p.name] = p;
|
|
46
|
+
});
|
|
47
|
+
plugins.forEach((p) => {
|
|
246
48
|
try {
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
c2 = false;
|
|
49
|
+
p.initialize && p.initialize({ config: p.config, instance });
|
|
50
|
+
} catch (_) {
|
|
250
51
|
}
|
|
251
|
-
for (var n3 = o2 = u2, t3 = 0; t3 < n3.length; t3++)
|
|
252
|
-
(0, n3[t3])();
|
|
253
|
-
return e3;
|
|
254
|
-
}
|
|
255
|
-
return p({ type: "@@redux/INIT" }), (r2 = { dispatch: p, subscribe: d2, getState: f2, replaceReducer: function(e3) {
|
|
256
|
-
if (typeof e3 !== y)
|
|
257
|
-
throw new Error("next reducer" + E$1);
|
|
258
|
-
i2 = e3, p({ type: "@@redux/INIT" });
|
|
259
|
-
} })[w] = function() {
|
|
260
|
-
var e3, n3 = d2;
|
|
261
|
-
return (e3 = { subscribe: function(e4) {
|
|
262
|
-
if (typeof e4 != "object")
|
|
263
|
-
throw new TypeError("Observer != obj");
|
|
264
|
-
function t3() {
|
|
265
|
-
e4.next && e4.next(f2());
|
|
266
|
-
}
|
|
267
|
-
return t3(), { unsubscribe: n3(t3) };
|
|
268
|
-
} })[w] = function() {
|
|
269
|
-
return this;
|
|
270
|
-
}, e3;
|
|
271
|
-
}, r2;
|
|
272
|
-
}
|
|
273
|
-
function S(e2, n2) {
|
|
274
|
-
var t2 = n2 && n2.type;
|
|
275
|
-
return "action " + (t2 && t2.toString() || "?") + "reducer " + e2 + " returns " + b$1;
|
|
276
|
-
}
|
|
277
|
-
function N$1() {
|
|
278
|
-
var e2 = [].slice.call(arguments);
|
|
279
|
-
return e2.length === 0 ? function(e3) {
|
|
280
|
-
return e3;
|
|
281
|
-
} : e2.length === 1 ? e2[0] : e2.reduce(function(e3, n2) {
|
|
282
|
-
return function() {
|
|
283
|
-
return e3(n2.apply(void 0, [].slice.call(arguments)));
|
|
284
|
-
};
|
|
285
52
|
});
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
53
|
+
return instance;
|
|
54
|
+
}
|
|
55
|
+
const hashRegex = /#.*$/;
|
|
56
|
+
function currentUrl() {
|
|
57
|
+
if (typeof window === "undefined")
|
|
58
|
+
return "";
|
|
59
|
+
return window.location.href.replace(hashRegex, "");
|
|
60
|
+
}
|
|
61
|
+
function getPageData(pageData = {}) {
|
|
62
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
63
|
+
return pageData;
|
|
64
|
+
}
|
|
65
|
+
const { title, referrer } = document;
|
|
66
|
+
const { innerWidth, innerHeight } = window;
|
|
67
|
+
const url = currentUrl();
|
|
68
|
+
const page = {
|
|
69
|
+
title,
|
|
70
|
+
url,
|
|
71
|
+
width: innerWidth,
|
|
72
|
+
height: innerHeight
|
|
298
73
|
};
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
},
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
return
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
if (l2.length) {
|
|
317
|
-
var f2 = a2.an_uid, d2 = a2.an_event, p = l2.reduce(function(e3, n3) {
|
|
318
|
-
if (n3.match(U) || n3.match(/^(d|g)clid/)) {
|
|
319
|
-
var t3 = n3.replace(U, "");
|
|
320
|
-
e3.campaign[t3 === "campaign" ? "name" : t3] = a2[n3];
|
|
321
|
-
}
|
|
322
|
-
return n3.match(V) && (e3.props[n3.replace(V, "")] = a2[n3]), n3.match(L$1) && (e3.traits[n3.replace(L$1, "")] = a2[n3]), e3;
|
|
323
|
-
}, { campaign: {}, props: {}, traits: {} });
|
|
324
|
-
t2.dispatch(v({ type: q.params, raw: a2 }, p, f2 ? { userId: f2 } : {})), f2 && setTimeout(function() {
|
|
325
|
-
return e2.identify(f2, p.traits);
|
|
326
|
-
}, 0), d2 && setTimeout(function() {
|
|
327
|
-
return e2.track(d2, p.props);
|
|
328
|
-
}, 0), Object.keys(p.campaign).length && t2.dispatch({ type: q.campaign, campaign: p.campaign });
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
return r2(i2);
|
|
332
|
-
};
|
|
333
|
-
};
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
function R(e2) {
|
|
337
|
-
return function(n2, t2) {
|
|
338
|
-
if (n2 === void 0 && (n2 = {}), t2 === void 0 && (t2 = {}), t2.type === q.setItemEnd) {
|
|
339
|
-
if (t2.key === A$1)
|
|
340
|
-
return v({}, n2, { anonymousId: t2.value });
|
|
341
|
-
if (t2.key === _)
|
|
342
|
-
return v({}, n2, { userId: t2.value });
|
|
343
|
-
}
|
|
344
|
-
switch (t2.type) {
|
|
345
|
-
case q.identify:
|
|
346
|
-
return Object.assign({}, n2, { userId: t2.userId, traits: v({}, n2.traits, t2.traits) });
|
|
347
|
-
case q.reset:
|
|
348
|
-
return [_, A$1, x$1].forEach(function(n3) {
|
|
349
|
-
e2.removeItem(n3);
|
|
350
|
-
}), Object.assign({}, n2, { userId: null, anonymousId: null, traits: {} });
|
|
351
|
-
default:
|
|
352
|
-
return n2;
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
function $(e2) {
|
|
357
|
-
return { userId: e2.getItem(_), anonymousId: e2.getItem(A$1), traits: e2.getItem(x$1) };
|
|
358
|
-
}
|
|
359
|
-
var D = function(e2) {
|
|
360
|
-
return j$1 + "TEMP" + j$1 + e2;
|
|
361
|
-
};
|
|
362
|
-
function B(n2) {
|
|
363
|
-
var t2 = n2.storage, r2 = t2.setItem, i2 = t2.removeItem, a2 = t2.getItem;
|
|
364
|
-
return function(n3) {
|
|
365
|
-
return function(t3) {
|
|
366
|
-
return function(u2) {
|
|
367
|
-
var c2 = u2.userId, s2 = u2.traits, l2 = u2.options;
|
|
368
|
-
if (u2.type === q.reset && ([_, x$1, A$1].forEach(function(e2) {
|
|
369
|
-
i2(e2);
|
|
370
|
-
}), [j, T, "traits"].forEach(function(e2) {
|
|
371
|
-
i$2(D(e2));
|
|
372
|
-
})), u2.type === q.identify) {
|
|
373
|
-
a2(A$1) || r2(A$1, y$1());
|
|
374
|
-
var f2 = a2(_), d2 = a2(x$1) || {};
|
|
375
|
-
f2 && f2 !== c2 && n3.dispatch({ type: q.userIdChanged, old: { userId: f2, traits: d2 }, new: { userId: c2, traits: s2 }, options: l2 }), c2 && r2(_, c2), s2 && r2(x$1, v({}, d2, s2));
|
|
74
|
+
if (referrer && referrer !== "") {
|
|
75
|
+
page.referrer = referrer;
|
|
76
|
+
}
|
|
77
|
+
return Object.assign({}, page, pageData);
|
|
78
|
+
}
|
|
79
|
+
function runPage(_0) {
|
|
80
|
+
return __async(this, arguments, function* (instance, payload = {}) {
|
|
81
|
+
if (!payload.type)
|
|
82
|
+
payload.type = "page";
|
|
83
|
+
payload.properties = getPageData(payload.properties || {});
|
|
84
|
+
Object.values(instance.plugins).forEach((p) => {
|
|
85
|
+
if (typeof p.pageStart === "function") {
|
|
86
|
+
try {
|
|
87
|
+
const next = p.pageStart({ payload, config: p.config, instance });
|
|
88
|
+
if (next)
|
|
89
|
+
payload = next;
|
|
90
|
+
} catch (_) {
|
|
376
91
|
}
|
|
377
|
-
|
|
378
|
-
};
|
|
379
|
-
};
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
var X = {};
|
|
383
|
-
function J$1(e2, n2) {
|
|
384
|
-
X[e2] && W$1(X[e2]) && (X[e2](n2), delete X[e2]);
|
|
385
|
-
}
|
|
386
|
-
function W(e2, n2, t2) {
|
|
387
|
-
return new Promise(function(r2, i2) {
|
|
388
|
-
return n2() ? r2(e2) : t2 < 1 ? i2(v({}, e2, { queue: true })) : new Promise(function(e3) {
|
|
389
|
-
return setTimeout(e3, 10);
|
|
390
|
-
}).then(function(a2) {
|
|
391
|
-
return W(e2, n2, t2 - 10).then(r2, i2);
|
|
92
|
+
}
|
|
392
93
|
});
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
var c2 = o2.actions.reduce(function(e3, n3, t3) {
|
|
399
|
-
return a2[n3.plugin].loaded ? (e3.process.push(n3), e3.processIndex.push(t3)) : (e3.requeue.push(n3), e3.requeueIndex.push(t3)), e3;
|
|
400
|
-
}, { processIndex: [], process: [], requeue: [], requeueIndex: [] });
|
|
401
|
-
if (c2.processIndex && c2.processIndex.length) {
|
|
402
|
-
c2.processIndex.forEach(function(n3) {
|
|
403
|
-
var i3 = o2.actions[n3], c3 = i3.plugin, s3 = i3.payload.type, l2 = r2[c3][s3];
|
|
404
|
-
if (l2 && W$1(l2)) {
|
|
405
|
-
var f2 = function(e3, n4) {
|
|
406
|
-
return e3 === void 0 && (e3 = {}), n4 === void 0 && (n4 = {}), [j, T].reduce(function(t3, r3) {
|
|
407
|
-
return e3.hasOwnProperty(r3) && n4[r3] && n4[r3] !== e3[r3] && (t3[r3] = n4[r3]), t3;
|
|
408
|
-
}, e3);
|
|
409
|
-
}(i3.payload, u2);
|
|
410
|
-
l2({ payload: f2, config: a2[c3].config, instance: t2 });
|
|
411
|
-
var p = s3 + ":" + c3;
|
|
412
|
-
e2.dispatch(v({}, f2, { type: p, _: { called: p, from: "queueDrain" } }));
|
|
94
|
+
for (const p of Object.values(instance.plugins)) {
|
|
95
|
+
if (typeof p.page === "function") {
|
|
96
|
+
try {
|
|
97
|
+
yield p.page({ payload, options: {}, instance, config: p.config });
|
|
98
|
+
} catch (_) {
|
|
413
99
|
}
|
|
414
|
-
}
|
|
415
|
-
var s2 = o2.actions.filter(function(e3, n3) {
|
|
416
|
-
return !~c2.processIndex.indexOf(n3);
|
|
417
|
-
});
|
|
418
|
-
o2.actions = s2;
|
|
100
|
+
}
|
|
419
101
|
}
|
|
420
|
-
|
|
102
|
+
return payload;
|
|
103
|
+
});
|
|
421
104
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
};
|
|
442
|
-
}(o3, u3, n3, i3, t3) : function(e4, n4) {
|
|
443
|
-
return function() {
|
|
444
|
-
throw new Error(e4.type + " action not cancellable. Remove abort in " + n4);
|
|
445
|
-
};
|
|
446
|
-
}(t3, u3);
|
|
447
|
-
return { payload: ue(t3), instance: e3, config: a3 || {}, abort: c3 };
|
|
448
|
-
};
|
|
449
|
-
}(r2, g2), y2 = n2.exact.reduce(function(e3, n3) {
|
|
450
|
-
var t3 = n3.pluginName, r3 = n3.methodName, i3 = false;
|
|
451
|
-
return r3.match(/^initialize/) || r3.match(/^reset/) || (i3 = !s2[t3].loaded), f2.offline && r3.match(/^(page|track|identify)/) && (i3 = true), e3["" + t3] = i3, e3;
|
|
452
|
-
}, {});
|
|
453
|
-
return Promise.resolve(n2.exact.reduce(function(e3, i3, o3) {
|
|
454
|
-
var u3 = i3.pluginName;
|
|
455
|
-
return Promise.resolve(e3).then(function(e4) {
|
|
456
|
-
function i4() {
|
|
457
|
-
return Promise.resolve(e4);
|
|
458
|
-
}
|
|
459
|
-
var o4 = function() {
|
|
460
|
-
if (n2.namespaced && n2.namespaced[u3])
|
|
461
|
-
return Promise.resolve(n2.namespaced[u3].reduce(function(e5, n3, t3) {
|
|
462
|
-
return Promise.resolve(e5).then(function(e6) {
|
|
463
|
-
return n3.method && W$1(n3.method) ? (function(e7, n4) {
|
|
464
|
-
var t5 = oe(e7);
|
|
465
|
-
if (t5 && t5.name === n4) {
|
|
466
|
-
var r3 = oe(t5.method);
|
|
467
|
-
throw new Error([n4 + " plugin is calling method " + e7, "Plugins cant call self", "Use " + t5.method + " " + (r3 ? "or " + r3.method : "") + " in " + n4 + " plugin insteadof " + e7].join("\n"));
|
|
468
|
-
}
|
|
469
|
-
}(n3.methodName, n3.pluginName), Promise.resolve(n3.method({ payload: e6, instance: r2, abort: (t4 = e6, i5 = u3, o5 = n3.pluginName, function(e7, n4) {
|
|
470
|
-
return v({}, t4, { abort: { reason: e7, plugins: n4 || [i5], caller: p, from: o5 || i5 } });
|
|
471
|
-
}), config: Z(n3.pluginName, s2, a2), plugins: s2 })).then(function(n4) {
|
|
472
|
-
var t5 = on(n4) ? n4 : {};
|
|
473
|
-
return Promise.resolve(v({}, e6, t5));
|
|
474
|
-
})) : e6;
|
|
475
|
-
var t4, i5, o5;
|
|
476
|
-
});
|
|
477
|
-
}, Promise.resolve(t2))).then(function(n3) {
|
|
478
|
-
e4[u3] = n3;
|
|
479
|
-
});
|
|
480
|
-
e4[u3] = t2;
|
|
481
|
-
}();
|
|
482
|
-
return o4 && o4.then ? o4.then(i4) : i4();
|
|
483
|
-
});
|
|
484
|
-
}, Promise.resolve({}))).then(function(e3) {
|
|
485
|
-
return Promise.resolve(n2.exact.reduce(function(t3, i3, o3) {
|
|
105
|
+
function runTrack(_0) {
|
|
106
|
+
return __async(this, arguments, function* (instance, payload = {}) {
|
|
107
|
+
if (!payload.type)
|
|
108
|
+
payload.type = "track";
|
|
109
|
+
const base = getPageData();
|
|
110
|
+
const props = payload.properties || {};
|
|
111
|
+
if (props.url === void 0)
|
|
112
|
+
props.url = base.url;
|
|
113
|
+
if (props.referrer === void 0 && base.referrer !== void 0) {
|
|
114
|
+
props.referrer = base.referrer;
|
|
115
|
+
}
|
|
116
|
+
payload.properties = props;
|
|
117
|
+
const options = payload.options || {};
|
|
118
|
+
const perCallPlugins = options && typeof options.plugins === "object" ? options.plugins : null;
|
|
119
|
+
const isDisabled = (p) => perCallPlugins && perCallPlugins[p.name] === false;
|
|
120
|
+
Object.values(instance.plugins).forEach((p) => {
|
|
121
|
+
if (isDisabled(p))
|
|
122
|
+
return;
|
|
123
|
+
if (typeof p.trackStart === "function") {
|
|
486
124
|
try {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
if (te(n3, f3))
|
|
493
|
-
return c3 && Y({ data: n3, method: p, instance: r2, store: u2 }), Promise.resolve(n3);
|
|
494
|
-
if (y2.hasOwnProperty(f3) && y2[f3] === true)
|
|
495
|
-
return u2.dispatch({ type: "queue", plugin: f3, payload: t4, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(n3);
|
|
496
|
-
var i4 = h2(e3[f3], a2[f3]);
|
|
497
|
-
return Promise.resolve(d2[p]({ abort: i4.abort, payload: t4, instance: r2, config: Z(f3, s2, a2), plugins: s2 })).then(function(i5) {
|
|
498
|
-
var a3 = on(i5) ? i5 : {}, o4 = v({}, n3, a3), c4 = e3[f3];
|
|
499
|
-
if (te(c4, f3))
|
|
500
|
-
Y({ data: c4, method: p, instance: r2, pluginName: f3, store: u2 });
|
|
501
|
-
else {
|
|
502
|
-
var s3 = p + ":" + f3;
|
|
503
|
-
(s3.match(/:/g) || []).length < 2 && !p.match(K) && !p.match(Q) && r2.dispatch(v({}, m2 ? o4 : t4, { type: s3, _: { called: s3, from: "submethod" } }));
|
|
504
|
-
}
|
|
505
|
-
return Promise.resolve(o4);
|
|
506
|
-
});
|
|
125
|
+
const next = p.trackStart({
|
|
126
|
+
payload,
|
|
127
|
+
options,
|
|
128
|
+
config: p.config,
|
|
129
|
+
instance
|
|
507
130
|
});
|
|
508
|
-
|
|
509
|
-
|
|
131
|
+
if (next)
|
|
132
|
+
payload = next;
|
|
133
|
+
} catch (_) {
|
|
510
134
|
}
|
|
511
|
-
}
|
|
512
|
-
if (!(p.match(G$1) || p.match(/^registerPlugin/) || p.match(Q) || p.match(K) || p.match(/^params/) || p.match(/^userIdChanged/))) {
|
|
513
|
-
if (c2.plugins.includes(p), e4._ && e4._.originalAction === p)
|
|
514
|
-
return e4;
|
|
515
|
-
var t3 = v({}, e4, { _: { originalAction: e4.type, called: e4.type, from: "engineEnd" } });
|
|
516
|
-
re(e4, n2.exact.length) && !p.match(/End$/) && (t3 = v({}, t3, { type: e4.type + "Aborted" })), u2.dispatch(t3);
|
|
517
|
-
}
|
|
518
|
-
return e4;
|
|
519
|
-
});
|
|
135
|
+
}
|
|
520
136
|
});
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
function Y(e2) {
|
|
526
|
-
var n2 = e2.pluginName, t2 = e2.method + "Aborted" + (n2 ? ":" + n2 : "");
|
|
527
|
-
e2.store.dispatch(v({}, e2.data, { type: t2, _: { called: t2, from: "abort" } }));
|
|
528
|
-
}
|
|
529
|
-
function Z(e2, n2, t2) {
|
|
530
|
-
var r2 = n2[e2] || t2[e2];
|
|
531
|
-
return r2 && r2.config ? r2.config : {};
|
|
532
|
-
}
|
|
533
|
-
function ee(e2, n2) {
|
|
534
|
-
return n2.reduce(function(n3, t2) {
|
|
535
|
-
return t2[e2] ? n3.concat({ methodName: e2, pluginName: t2.name, method: t2[e2] }) : n3;
|
|
536
|
-
}, []);
|
|
537
|
-
}
|
|
538
|
-
function ne(e2, n2) {
|
|
539
|
-
var t2 = e2.replace(G$1, ""), r2 = n2 ? ":" + n2 : "";
|
|
540
|
-
return ["" + e2 + r2, "" + t2 + r2, t2 + "End" + r2];
|
|
541
|
-
}
|
|
542
|
-
function te(e2, n2) {
|
|
543
|
-
var t2 = e2.abort;
|
|
544
|
-
return !!t2 && (t2 === true || ae(t2, n2) || t2 && ae(t2.plugins, n2));
|
|
545
|
-
}
|
|
546
|
-
function re(e2, n2) {
|
|
547
|
-
var t2 = e2.abort;
|
|
548
|
-
if (!t2)
|
|
549
|
-
return false;
|
|
550
|
-
if (t2 === true || q$1(t2))
|
|
551
|
-
return true;
|
|
552
|
-
var r2 = t2.plugins;
|
|
553
|
-
return ie(t2) && t2.length === n2 || ie(r2) && r2.length === n2;
|
|
554
|
-
}
|
|
555
|
-
function ie(e2) {
|
|
556
|
-
return Array.isArray(e2);
|
|
557
|
-
}
|
|
558
|
-
function ae(e2, n2) {
|
|
559
|
-
return !(!e2 || !ie(e2)) && e2.includes(n2);
|
|
560
|
-
}
|
|
561
|
-
function oe(e2) {
|
|
562
|
-
var n2 = e2.match(/(.*):(.*)/);
|
|
563
|
-
return !!n2 && { method: n2[1], name: n2[2] };
|
|
564
|
-
}
|
|
565
|
-
function ue(e2) {
|
|
566
|
-
return Object.keys(e2).reduce(function(n2, t2) {
|
|
567
|
-
return t2 === "type" || (n2[t2] = on(e2[t2]) ? Object.assign({}, e2[t2]) : e2[t2]), n2;
|
|
568
|
-
}, {});
|
|
569
|
-
}
|
|
570
|
-
function ce(e2, n2, t2) {
|
|
571
|
-
var r2 = {};
|
|
572
|
-
return function(i2) {
|
|
573
|
-
return function(a2) {
|
|
574
|
-
return function(o2) {
|
|
137
|
+
for (const p of Object.values(instance.plugins)) {
|
|
138
|
+
if (isDisabled(p))
|
|
139
|
+
continue;
|
|
140
|
+
if (typeof p.track === "function") {
|
|
575
141
|
try {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}, s2 = o2.type, l2 = o2.plugins, f2 = o2;
|
|
579
|
-
if (o2.abort)
|
|
580
|
-
return Promise.resolve(a2(o2));
|
|
581
|
-
if (s2 === q.enablePlugin && i2.dispatch({ type: q.initializeStart, plugins: l2, disabled: [], fromEnable: true, meta: o2.meta }), s2 === q.disablePlugin && setTimeout(function() {
|
|
582
|
-
return J$1(o2.meta.rid, { payload: o2 });
|
|
583
|
-
}, 0), s2 === q.initializeEnd) {
|
|
584
|
-
var m2 = n2(), g2 = Object.keys(m2), h2 = g2.filter(function(e3) {
|
|
585
|
-
return l2.includes(e3);
|
|
586
|
-
}).map(function(e3) {
|
|
587
|
-
return m2[e3];
|
|
588
|
-
}), y2 = [], b2 = [], I2 = o2.disabled, w2 = h2.map(function(e3) {
|
|
589
|
-
var n3 = e3.name;
|
|
590
|
-
return W(e3, e3.loaded, 1e4).then(function(t3) {
|
|
591
|
-
return r2[n3] || (i2.dispatch({ type: q.pluginReadyType(n3), name: n3, events: Object.keys(e3).filter(function(e4) {
|
|
592
|
-
return !M.includes(e4);
|
|
593
|
-
}) }), r2[n3] = true), y2 = y2.concat(n3), e3;
|
|
594
|
-
}).catch(function(e4) {
|
|
595
|
-
if (e4 instanceof Error)
|
|
596
|
-
throw new Error(e4);
|
|
597
|
-
return b2 = b2.concat(e4.name), e4;
|
|
598
|
-
});
|
|
599
|
-
});
|
|
600
|
-
Promise.all(w2).then(function(e3) {
|
|
601
|
-
var n3 = { plugins: y2, failed: b2, disabled: I2 };
|
|
602
|
-
setTimeout(function() {
|
|
603
|
-
g2.length === w2.length + I2.length && i2.dispatch(v({}, { type: q.ready }, n3));
|
|
604
|
-
}, 0);
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
var E2 = function() {
|
|
608
|
-
if (s2 !== q.bootstrap)
|
|
609
|
-
return /^ready:([^:]*)$/.test(s2) && setTimeout(function() {
|
|
610
|
-
return H(i2, n2, e2);
|
|
611
|
-
}, 0), Promise.resolve(function(e3, n3, t3, r3, i3) {
|
|
612
|
-
try {
|
|
613
|
-
var a3 = W$1(n3) ? n3() : n3, o3 = e3.type, u3 = o3.replace(G$1, "");
|
|
614
|
-
if (e3._ && e3._.called)
|
|
615
|
-
return Promise.resolve(e3);
|
|
616
|
-
var c3 = t3.getState(), s3 = (m3 = a3, (g3 = c3.plugins) === void 0 && (g3 = {}), (h3 = e3.options) === void 0 && (h3 = {}), Object.keys(m3).filter(function(e4) {
|
|
617
|
-
var n4 = h3.plugins || {};
|
|
618
|
-
return Q$1(n4[e4]) ? n4[e4] : n4.all !== false && (!g3[e4] || g3[e4].enabled !== false);
|
|
619
|
-
}).map(function(e4) {
|
|
620
|
-
return m3[e4];
|
|
621
|
-
}));
|
|
622
|
-
o3 === q.initializeStart && e3.fromEnable && (s3 = Object.keys(c3.plugins).filter(function(n4) {
|
|
623
|
-
var t4 = c3.plugins[n4];
|
|
624
|
-
return e3.plugins.includes(n4) && !t4.initialized;
|
|
625
|
-
}).map(function(e4) {
|
|
626
|
-
return a3[e4];
|
|
627
|
-
}));
|
|
628
|
-
var l3 = s3.map(function(e4) {
|
|
629
|
-
return e4.name;
|
|
630
|
-
}), f3 = function(e4, n4, t4) {
|
|
631
|
-
var r4 = ne(e4).map(function(e5) {
|
|
632
|
-
return ee(e5, n4);
|
|
633
|
-
});
|
|
634
|
-
return n4.reduce(function(t5, r5) {
|
|
635
|
-
var i4 = r5.name, a4 = ne(e4, i4).map(function(e5) {
|
|
636
|
-
return ee(e5, n4);
|
|
637
|
-
}), o4 = a4[0], u4 = a4[1], c4 = a4[2];
|
|
638
|
-
return o4.length && (t5.beforeNS[i4] = o4), u4.length && (t5.duringNS[i4] = u4), c4.length && (t5.afterNS[i4] = c4), t5;
|
|
639
|
-
}, { before: r4[0], beforeNS: {}, during: r4[1], duringNS: {}, after: r4[2], afterNS: {} });
|
|
640
|
-
}(o3, s3);
|
|
641
|
-
return Promise.resolve(F$1({ action: e3, data: { exact: f3.before, namespaced: f3.beforeNS }, state: c3, allPlugins: a3, allMatches: f3, instance: t3, store: r3, EVENTS: i3 })).then(function(e4) {
|
|
642
|
-
function n4() {
|
|
643
|
-
var n5 = function() {
|
|
644
|
-
if (o3.match(G$1))
|
|
645
|
-
return Promise.resolve(F$1({ action: v({}, s4, { type: u3 + "End" }), data: { exact: f3.after, namespaced: f3.afterNS }, state: c3, allPlugins: a3, allMatches: f3, instance: t3, store: r3, EVENTS: i3 })).then(function(e5) {
|
|
646
|
-
e5.meta && e5.meta.hasCallback && J$1(e5.meta.rid, { payload: e5 });
|
|
647
|
-
});
|
|
648
|
-
}();
|
|
649
|
-
return n5 && n5.then ? n5.then(function() {
|
|
650
|
-
return e4;
|
|
651
|
-
}) : e4;
|
|
652
|
-
}
|
|
653
|
-
if (re(e4, l3.length))
|
|
654
|
-
return e4;
|
|
655
|
-
var s4, d2 = function() {
|
|
656
|
-
if (o3 !== u3)
|
|
657
|
-
return Promise.resolve(F$1({ action: v({}, e4, { type: u3 }), data: { exact: f3.during, namespaced: f3.duringNS }, state: c3, allPlugins: a3, allMatches: f3, instance: t3, store: r3, EVENTS: i3 })).then(function(e5) {
|
|
658
|
-
s4 = e5;
|
|
659
|
-
});
|
|
660
|
-
s4 = e4;
|
|
661
|
-
}();
|
|
662
|
-
return d2 && d2.then ? d2.then(n4) : n4();
|
|
663
|
-
});
|
|
664
|
-
} catch (e4) {
|
|
665
|
-
return Promise.reject(e4);
|
|
666
|
-
}
|
|
667
|
-
var m3, g3, h3;
|
|
668
|
-
}(o2, n2, e2, i2, t2)).then(function(e3) {
|
|
669
|
-
var n3 = a2(e3);
|
|
670
|
-
return u2 = 1, n3;
|
|
671
|
-
});
|
|
672
|
-
}();
|
|
673
|
-
return Promise.resolve(E2 && E2.then ? E2.then(c2) : c2(E2));
|
|
674
|
-
} catch (e3) {
|
|
675
|
-
return Promise.reject(e3);
|
|
676
|
-
}
|
|
677
|
-
};
|
|
678
|
-
};
|
|
679
|
-
};
|
|
680
|
-
}
|
|
681
|
-
function se(e2) {
|
|
682
|
-
return function(n2) {
|
|
683
|
-
return function(n3) {
|
|
684
|
-
return function(t2) {
|
|
685
|
-
var r2 = t2.type, i2 = t2.key, a2 = t2.value, o2 = t2.options;
|
|
686
|
-
if (r2 === q.setItem || r2 === q.removeItem) {
|
|
687
|
-
if (t2.abort)
|
|
688
|
-
return n3(t2);
|
|
689
|
-
r2 === q.setItem ? e2.setItem(i2, a2, o2) : e2.removeItem(i2, o2);
|
|
142
|
+
yield p.track({ payload, options, instance, config: p.config });
|
|
143
|
+
} catch (_) {
|
|
690
144
|
}
|
|
691
|
-
return n3(t2);
|
|
692
|
-
};
|
|
693
|
-
};
|
|
694
|
-
};
|
|
695
|
-
}
|
|
696
|
-
var le = function() {
|
|
697
|
-
var e2 = this;
|
|
698
|
-
this.before = [], this.after = [], this.addMiddleware = function(n2, t2) {
|
|
699
|
-
e2[t2] = e2[t2].concat(n2);
|
|
700
|
-
}, this.removeMiddleware = function(n2, t2) {
|
|
701
|
-
var r2 = e2[t2].findIndex(function(e3) {
|
|
702
|
-
return e3 === n2;
|
|
703
|
-
});
|
|
704
|
-
r2 !== -1 && (e2[t2] = [].concat(e2[t2].slice(0, r2), e2[t2].slice(r2 + 1)));
|
|
705
|
-
}, this.dynamicMiddlewares = function(n2) {
|
|
706
|
-
return function(t2) {
|
|
707
|
-
return function(r2) {
|
|
708
|
-
return function(i2) {
|
|
709
|
-
var a2 = { getState: t2.getState, dispatch: function(e3) {
|
|
710
|
-
return t2.dispatch(e3);
|
|
711
|
-
} }, o2 = e2[n2].map(function(e3) {
|
|
712
|
-
return e3(a2);
|
|
713
|
-
});
|
|
714
|
-
return N$1.apply(void 0, o2)(r2)(i2);
|
|
715
|
-
};
|
|
716
|
-
};
|
|
717
|
-
};
|
|
718
|
-
};
|
|
719
|
-
};
|
|
720
|
-
function fe(e2) {
|
|
721
|
-
return function(n2, t2) {
|
|
722
|
-
n2 === void 0 && (n2 = {});
|
|
723
|
-
var r2 = {};
|
|
724
|
-
if (t2.type === "initialize:aborted")
|
|
725
|
-
return n2;
|
|
726
|
-
if (/^registerPlugin:([^:]*)$/.test(t2.type)) {
|
|
727
|
-
var i2 = de(t2.type, "registerPlugin"), a2 = e2()[i2];
|
|
728
|
-
if (!a2 || !i2)
|
|
729
|
-
return n2;
|
|
730
|
-
var o2 = t2.enabled;
|
|
731
|
-
return r2[i2] = { enabled: o2, initialized: !!o2 && Boolean(!a2.initialize), loaded: !!o2 && Boolean(a2.loaded()), config: a2.config || {} }, v({}, n2, r2);
|
|
732
|
-
}
|
|
733
|
-
if (/^initialize:([^:]*)$/.test(t2.type)) {
|
|
734
|
-
var u2 = de(t2.type, q.initialize), c2 = e2()[u2];
|
|
735
|
-
return c2 && u2 ? (r2[u2] = v({}, n2[u2], { initialized: true, loaded: Boolean(c2.loaded()) }), v({}, n2, r2)) : n2;
|
|
736
|
-
}
|
|
737
|
-
if (/^ready:([^:]*)$/.test(t2.type))
|
|
738
|
-
return r2[t2.name] = v({}, n2[t2.name], { loaded: true }), v({}, n2, r2);
|
|
739
|
-
switch (t2.type) {
|
|
740
|
-
case q.disablePlugin:
|
|
741
|
-
return v({}, n2, pe(t2.plugins, false, n2));
|
|
742
|
-
case q.enablePlugin:
|
|
743
|
-
return v({}, n2, pe(t2.plugins, true, n2));
|
|
744
|
-
default:
|
|
745
|
-
return n2;
|
|
746
|
-
}
|
|
747
|
-
};
|
|
748
|
-
}
|
|
749
|
-
function de(e2, n2) {
|
|
750
|
-
return e2.substring(n2.length + 1, e2.length);
|
|
751
|
-
}
|
|
752
|
-
function pe(e2, n2, t2) {
|
|
753
|
-
return e2.reduce(function(e3, r2) {
|
|
754
|
-
return e3[r2] = v({}, t2[r2], { enabled: n2 }), e3;
|
|
755
|
-
}, t2);
|
|
756
|
-
}
|
|
757
|
-
function me(e2) {
|
|
758
|
-
try {
|
|
759
|
-
return JSON.parse(JSON.stringify(e2));
|
|
760
|
-
} catch (e3) {
|
|
761
|
-
}
|
|
762
|
-
return e2;
|
|
763
|
-
}
|
|
764
|
-
var ge = { last: {}, history: [] };
|
|
765
|
-
function he(e2, n2) {
|
|
766
|
-
e2 === void 0 && (e2 = ge);
|
|
767
|
-
var t2 = n2.options, r2 = n2.meta;
|
|
768
|
-
if (n2.type === q.track) {
|
|
769
|
-
var i2 = me(v({ event: n2.event, properties: n2.properties }, Object.keys(t2).length && { options: t2 }, { meta: r2 }));
|
|
770
|
-
return v({}, e2, { last: i2, history: e2.history.concat(i2) });
|
|
771
|
-
}
|
|
772
|
-
return e2;
|
|
773
|
-
}
|
|
774
|
-
var ve = { actions: [] };
|
|
775
|
-
function ye(e2, n2) {
|
|
776
|
-
e2 === void 0 && (e2 = ve);
|
|
777
|
-
var t2 = n2.payload;
|
|
778
|
-
switch (n2.type) {
|
|
779
|
-
case "queue":
|
|
780
|
-
var r2;
|
|
781
|
-
return r2 = t2 && t2.type && t2.type === q.identify ? [n2].concat(e2.actions) : e2.actions.concat(n2), v({}, e2, { actions: r2 });
|
|
782
|
-
case "dequeue":
|
|
783
|
-
return [];
|
|
784
|
-
default:
|
|
785
|
-
return e2;
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
var be = /#.*$/;
|
|
789
|
-
function Ie(e2) {
|
|
790
|
-
var n2 = /(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e2);
|
|
791
|
-
return "/" + (n2 && n2[3] ? n2[3].split("?")[0].replace(be, "") : "");
|
|
792
|
-
}
|
|
793
|
-
var we, Ee, Pe, Se, Ne = function(e2) {
|
|
794
|
-
if (e2 === void 0 && (e2 = {}), !$$1)
|
|
795
|
-
return e2;
|
|
796
|
-
var n2 = document, t2 = n2.title, r2 = n2.referrer, i2 = window, a2 = i2.location, o2 = i2.innerWidth, u2 = i2.innerHeight, c2 = a2.hash, s2 = a2.search, l2 = function(e3) {
|
|
797
|
-
var n3 = function() {
|
|
798
|
-
if ($$1) {
|
|
799
|
-
for (var e4, n4 = document.getElementsByTagName("link"), t3 = 0; e4 = n4[t3]; t3++)
|
|
800
|
-
if (e4.getAttribute("rel") === "canonical")
|
|
801
|
-
return e4.getAttribute("href");
|
|
802
145
|
}
|
|
803
|
-
}
|
|
804
|
-
return
|
|
805
|
-
}(s2), f2 = { title: t2, url: l2, path: Ie(l2), hash: c2, search: s2, width: o2, height: u2 };
|
|
806
|
-
return r2 && r2 !== "" && (f2.referrer = r2), v({}, f2, e2);
|
|
807
|
-
}, Oe = { last: {}, history: [] };
|
|
808
|
-
function Ae(e2, n2) {
|
|
809
|
-
e2 === void 0 && (e2 = Oe);
|
|
810
|
-
var t2 = n2.options;
|
|
811
|
-
if (n2.type === q.page) {
|
|
812
|
-
var r2 = me(v({ properties: n2.properties, meta: n2.meta }, Object.keys(t2).length && { options: t2 }));
|
|
813
|
-
return v({}, e2, { last: r2, history: e2.history.concat(r2) });
|
|
814
|
-
}
|
|
815
|
-
return e2;
|
|
816
|
-
}
|
|
817
|
-
we = function() {
|
|
818
|
-
if (!$$1)
|
|
819
|
-
return false;
|
|
820
|
-
var e2 = navigator.appVersion;
|
|
821
|
-
return ~e2.indexOf("Win") ? "Windows" : ~e2.indexOf("Mac") ? "MacOS" : ~e2.indexOf("X11") ? "UNIX" : ~e2.indexOf("Linux") ? "Linux" : "Unknown OS";
|
|
822
|
-
}(), Ee = $$1 ? document.referrer : null, Pe = o$1(), Se = a$3();
|
|
823
|
-
var _e = { initialized: false, sessionId: y$1(), app: null, version: null, debug: false, offline: !!$$1 && !navigator.onLine, os: { name: we }, userAgent: $$1 ? navigator.userAgent : "node", library: { name: "analytics", version: "0.11.0" }, timezone: Se, locale: Pe, campaign: {}, referrer: Ee };
|
|
824
|
-
function xe(e2, n2) {
|
|
825
|
-
e2 === void 0 && (e2 = _e);
|
|
826
|
-
var t2 = e2.initialized, r2 = n2.campaign;
|
|
827
|
-
switch (n2.type) {
|
|
828
|
-
case q.campaign:
|
|
829
|
-
return v({}, e2, { campaign: r2 });
|
|
830
|
-
case q.offline:
|
|
831
|
-
return v({}, e2, { offline: true });
|
|
832
|
-
case q.online:
|
|
833
|
-
return v({}, e2, { offline: false });
|
|
834
|
-
default:
|
|
835
|
-
return t2 ? e2 : v({}, _e, e2, { initialized: true });
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
var ke = ["plugins", "reducers", "storage"];
|
|
839
|
-
function je(e2, n2, t2) {
|
|
840
|
-
if ($$1) {
|
|
841
|
-
var r2 = window[(t2 ? "add" : "remove") + "EventListener"];
|
|
842
|
-
e2.split(" ").forEach(function(e3) {
|
|
843
|
-
r2(e3, n2);
|
|
844
|
-
});
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
function Te(e2) {
|
|
848
|
-
var n2 = je.bind(null, "online offline", function(n3) {
|
|
849
|
-
return Promise.resolve(!navigator.onLine).then(e2);
|
|
146
|
+
}
|
|
147
|
+
return payload;
|
|
850
148
|
});
|
|
851
|
-
return n2(true), function(e3) {
|
|
852
|
-
return n2(false);
|
|
853
|
-
};
|
|
854
|
-
}
|
|
855
|
-
function ze() {
|
|
856
|
-
return f("analytics", []), function(e2) {
|
|
857
|
-
return function(n$12, t2, r2) {
|
|
858
|
-
var i2 = e2(n$12, t2, r2), a2 = i2.dispatch;
|
|
859
|
-
return Object.assign(i2, { dispatch: function(e3) {
|
|
860
|
-
return n[o].analytics.push(e3.action || e3), a2(e3);
|
|
861
|
-
} });
|
|
862
|
-
};
|
|
863
|
-
};
|
|
864
149
|
}
|
|
865
|
-
function
|
|
866
|
-
return function() {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
}
|
|
873
|
-
function Ue(n2, t2, r2) {
|
|
874
|
-
n2 === void 0 && (n2 = {});
|
|
875
|
-
var i2, a2, o2 = y$1();
|
|
876
|
-
return t2 && (X[o2] = (i2 = t2, a2 = function(e2) {
|
|
877
|
-
for (var n3, t3 = e2 || Array.prototype.slice.call(arguments), r3 = 0; r3 < t3.length; r3++)
|
|
878
|
-
if (W$1(t3[r3])) {
|
|
879
|
-
n3 = t3[r3];
|
|
880
|
-
break;
|
|
881
|
-
}
|
|
882
|
-
return n3;
|
|
883
|
-
}(r2), function(e2) {
|
|
884
|
-
a2 && a2(e2), i2(e2);
|
|
885
|
-
})), v({}, n2, { rid: o2, ts: new Date().getTime() }, t2 ? { hasCallback: true } : {});
|
|
886
|
-
}
|
|
887
|
-
function Ve(n2) {
|
|
888
|
-
n2 === void 0 && (n2 = {});
|
|
889
|
-
var t2 = n2.reducers || {}, c2 = n2.initialUser || {}, s$1 = (n2.plugins || []).reduce(function(e2, n3) {
|
|
890
|
-
if (W$1(n3))
|
|
891
|
-
return e2.middlewares = e2.middlewares.concat(n3), e2;
|
|
892
|
-
if (n3.NAMESPACE && (n3.name = n3.NAMESPACE), !n3.name)
|
|
893
|
-
throw new Error("https://lytics.dev/errors/1");
|
|
894
|
-
var t3 = n3.EVENTS ? Object.keys(n3.EVENTS).map(function(e3) {
|
|
895
|
-
return n3.EVENTS[e3];
|
|
896
|
-
}) : [];
|
|
897
|
-
e2.pluginEnabled[n3.name] = !(n3.enabled === false || n3.config && n3.config.enabled === false), delete n3.enabled, n3.methods && (e2.methods[n3.name] = Object.keys(n3.methods).reduce(function(e3, t4) {
|
|
898
|
-
var r3;
|
|
899
|
-
return e3[t4] = (r3 = n3.methods[t4], function() {
|
|
900
|
-
for (var e4 = Array.prototype.slice.call(arguments), n4 = new Array(r3.length), t5 = 0; t5 < e4.length; t5++)
|
|
901
|
-
n4[t5] = e4[t5];
|
|
902
|
-
return n4[n4.length] = K2, r3.apply({ instance: K2 }, n4);
|
|
903
|
-
}), e3;
|
|
904
|
-
}, {}), delete n3.methods);
|
|
905
|
-
var r2 = Object.keys(n3).concat(t3), i2 = new Set(e2.events.concat(r2));
|
|
906
|
-
if (e2.events = Array.from(i2), e2.pluginsArray = e2.pluginsArray.concat(n3), e2.plugins[n3.name])
|
|
907
|
-
throw new Error(n3.name + "AlreadyLoaded");
|
|
908
|
-
return e2.plugins[n3.name] = n3, e2.plugins[n3.name].loaded || (e2.plugins[n3.name].loaded = function() {
|
|
909
|
-
return true;
|
|
910
|
-
}), e2;
|
|
911
|
-
}, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), f$1 = n2.storage ? n2.storage : { getItem: a$2, setItem: f, removeItem: i$2 }, p = function(e2) {
|
|
912
|
-
return function(n3, t3, r2) {
|
|
913
|
-
return t3.getState("user")[n3] || (r2 && on(r2) && r2[n3] ? r2[n3] : $(e2)[n3] || a$2(D(n3)) || null);
|
|
914
|
-
};
|
|
915
|
-
}(f$1), h2 = s$1.plugins, w2 = s$1.events.filter(function(e2) {
|
|
916
|
-
return !M.includes(e2);
|
|
917
|
-
}).sort(), E2 = new Set(w2.concat(z).filter(function(e2) {
|
|
918
|
-
return !M.includes(e2);
|
|
919
|
-
})), _2 = Array.from(E2).sort(), x2 = function() {
|
|
920
|
-
return h2;
|
|
921
|
-
}, k2 = new le(), U2 = k2.addMiddleware, V2 = k2.removeMiddleware, L2 = k2.dynamicMiddlewares, X2 = function() {
|
|
922
|
-
throw new Error("Abort disabled inListener");
|
|
923
|
-
}, J2 = s(), W2 = $(f$1), F2 = v({}, W2, c2, J2.an_uid ? { userId: J2.an_uid } : {}, J2.an_aid ? { anonymousId: J2.an_aid } : {});
|
|
924
|
-
F2.anonymousId || (F2.anonymousId = y$1());
|
|
925
|
-
var G2 = v({ enable: function(e2, n3) {
|
|
926
|
-
return new Promise(function(t3) {
|
|
927
|
-
oe2.dispatch({ type: q.enablePlugin, plugins: qe(e2), _: { originalAction: q.enablePlugin } }, t3, [n3]);
|
|
928
|
-
});
|
|
929
|
-
}, disable: function(e2, n3) {
|
|
930
|
-
return new Promise(function(t3) {
|
|
931
|
-
oe2.dispatch({ type: q.disablePlugin, plugins: qe(e2), _: { originalAction: q.disablePlugin } }, t3, [n3]);
|
|
932
|
-
});
|
|
933
|
-
} }, s$1.methods), K2 = { identify: function(e2, n3, t3, r2) {
|
|
934
|
-
try {
|
|
935
|
-
var i2 = q$1(e2) ? e2 : null, a2 = on(e2) ? e2 : n3, o2 = t3 || {}, c3 = K2.user();
|
|
936
|
-
f(D(j), i2);
|
|
937
|
-
var s2 = i2 || a2.userId || p(j, K2, a2);
|
|
938
|
-
return Promise.resolve(new Promise(function(e3) {
|
|
939
|
-
oe2.dispatch(v({ type: q.identifyStart, userId: s2, traits: a2 || {}, options: o2, anonymousId: c3.anonymousId }, c3.id && c3.id !== i2 && { previousId: c3.id }), e3, [n3, t3, r2]);
|
|
940
|
-
}));
|
|
941
|
-
} catch (e3) {
|
|
942
|
-
return Promise.reject(e3);
|
|
943
|
-
}
|
|
944
|
-
}, track: function(e2, n3, t3, r2) {
|
|
945
|
-
try {
|
|
946
|
-
var i2 = on(e2) ? e2.event : e2;
|
|
947
|
-
if (!i2 || !q$1(i2))
|
|
948
|
-
throw new Error("EventMissing");
|
|
949
|
-
var a2 = on(e2) ? e2 : n3 || {}, o2 = on(t3) ? t3 : {};
|
|
950
|
-
return Promise.resolve(new Promise(function(e3) {
|
|
951
|
-
oe2.dispatch({ type: q.trackStart, event: i2, properties: a2, options: o2, userId: p(j, K2, n3), anonymousId: p(T, K2, n3) }, e3, [n3, t3, r2]);
|
|
952
|
-
}));
|
|
953
|
-
} catch (e3) {
|
|
954
|
-
return Promise.reject(e3);
|
|
955
|
-
}
|
|
956
|
-
}, page: function(e2, n3, t3) {
|
|
957
|
-
try {
|
|
958
|
-
var r2 = on(e2) ? e2 : {}, i2 = on(n3) ? n3 : {};
|
|
959
|
-
return Promise.resolve(new Promise(function(a2) {
|
|
960
|
-
oe2.dispatch({ type: q.pageStart, properties: Ne(r2), options: i2, userId: p(j, K2, r2), anonymousId: p(T, K2, r2) }, a2, [e2, n3, t3]);
|
|
961
|
-
}));
|
|
962
|
-
} catch (e3) {
|
|
963
|
-
return Promise.reject(e3);
|
|
964
|
-
}
|
|
965
|
-
}, user: function(e2) {
|
|
966
|
-
if (e2 === j || e2 === "id")
|
|
967
|
-
return p(j, K2);
|
|
968
|
-
if (e2 === T || e2 === "anonId")
|
|
969
|
-
return p(T, K2);
|
|
970
|
-
var n3 = K2.getState("user");
|
|
971
|
-
return e2 ? i$3(n3, e2) : n3;
|
|
972
|
-
}, reset: function(e2) {
|
|
973
|
-
return new Promise(function(n3) {
|
|
974
|
-
oe2.dispatch({ type: q.resetStart }, n3, e2);
|
|
975
|
-
});
|
|
976
|
-
}, ready: function(e2) {
|
|
977
|
-
return K2.on(q.ready, e2);
|
|
978
|
-
}, on: function(e2, n3) {
|
|
979
|
-
if (!e2 || !W$1(n3))
|
|
980
|
-
return false;
|
|
981
|
-
if (e2 === q.bootstrap)
|
|
982
|
-
throw new Error(".on disabled for " + e2);
|
|
983
|
-
var t3 = /Start$|Start:/;
|
|
984
|
-
if (e2 === "*") {
|
|
985
|
-
var r2 = function(e3) {
|
|
986
|
-
return function(e4) {
|
|
987
|
-
return function(r3) {
|
|
988
|
-
return r3.type.match(t3) && n3({ payload: r3, instance: K2, plugins: h2 }), e4(r3);
|
|
989
|
-
};
|
|
990
|
-
};
|
|
991
|
-
}, i2 = function(e3) {
|
|
992
|
-
return function(e4) {
|
|
993
|
-
return function(r3) {
|
|
994
|
-
return r3.type.match(t3) || n3({ payload: r3, instance: K2, plugins: h2 }), e4(r3);
|
|
995
|
-
};
|
|
996
|
-
};
|
|
997
|
-
};
|
|
998
|
-
return U2(r2, Le), U2(i2, Ce), function() {
|
|
999
|
-
V2(r2, Le), V2(i2, Ce);
|
|
1000
|
-
};
|
|
1001
|
-
}
|
|
1002
|
-
var a2 = e2.match(t3) ? Le : Ce, o2 = function(t4) {
|
|
1003
|
-
return function(t5) {
|
|
1004
|
-
return function(r3) {
|
|
1005
|
-
return r3.type === e2 && n3({ payload: r3, instance: K2, plugins: h2, abort: X2 }), t5(r3);
|
|
1006
|
-
};
|
|
1007
|
-
};
|
|
1008
|
-
};
|
|
1009
|
-
return U2(o2, a2), function() {
|
|
1010
|
-
return V2(o2, a2);
|
|
1011
|
-
};
|
|
1012
|
-
}, once: function(e2, n3) {
|
|
1013
|
-
if (!e2 || !W$1(n3))
|
|
1014
|
-
return false;
|
|
1015
|
-
if (e2 === q.bootstrap)
|
|
1016
|
-
throw new Error(".once disabled for " + e2);
|
|
1017
|
-
var t3 = K2.on(e2, function(e3) {
|
|
1018
|
-
n3({ payload: e3.payload, instance: K2, plugins: h2, abort: X2 }), t3();
|
|
1019
|
-
});
|
|
1020
|
-
return t3;
|
|
1021
|
-
}, getState: function(e2) {
|
|
1022
|
-
var n3 = oe2.getState();
|
|
1023
|
-
return e2 ? i$3(n3, e2) : Object.assign({}, n3);
|
|
1024
|
-
}, dispatch: function(e2) {
|
|
1025
|
-
var n3 = q$1(e2) ? { type: e2 } : e2;
|
|
1026
|
-
if (z.includes(n3.type))
|
|
1027
|
-
throw new Error("reserved action " + n3.type);
|
|
1028
|
-
var t3 = v({}, n3, { _: v({ originalAction: n3.type }, e2._ || {}) });
|
|
1029
|
-
oe2.dispatch(t3);
|
|
1030
|
-
}, enablePlugin: G2.enable, disablePlugin: G2.disable, plugins: G2, storage: { getItem: f$1.getItem, setItem: function(e2, n3, t3) {
|
|
1031
|
-
oe2.dispatch({ type: q.setItemStart, key: e2, value: n3, options: t3 });
|
|
1032
|
-
}, removeItem: function(e2, n3) {
|
|
1033
|
-
oe2.dispatch({ type: q.removeItemStart, key: e2, options: n3 });
|
|
1034
|
-
} }, setAnonymousId: function(e2, n3) {
|
|
1035
|
-
K2.storage.setItem(A$1, e2, n3);
|
|
1036
|
-
}, events: { core: z, plugins: w2 } }, Q2 = s$1.middlewares.concat([function(e2) {
|
|
1037
|
-
return function(e3) {
|
|
1038
|
-
return function(n3) {
|
|
1039
|
-
return n3.meta || (n3.meta = Ue()), e3(n3);
|
|
1040
|
-
};
|
|
1041
|
-
};
|
|
1042
|
-
}, L2(Le), ce(K2, x2, { all: _2, plugins: w2 }), se(f$1), C$1(K2), B(K2), L2(Ce)]), Y2 = { context: xe, user: R(f$1), page: Ae, track: he, plugins: fe(x2), queue: ye }, Z2 = N$1, ee2 = N$1;
|
|
1043
|
-
if ($$1 && n2.debug) {
|
|
1044
|
-
var ne2 = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
|
1045
|
-
ne2 && (Z2 = ne2({ trace: true, traceLimit: 25 })), ee2 = function() {
|
|
1046
|
-
return arguments.length === 0 ? ze() : on(typeof arguments[0]) ? Me() : Me().apply(null, arguments);
|
|
1047
|
-
};
|
|
1048
|
-
}
|
|
1049
|
-
var te2, re2 = function(e2) {
|
|
1050
|
-
return Object.keys(e2).reduce(function(n3, t3) {
|
|
1051
|
-
return ke.includes(t3) || (n3[t3] = e2[t3]), n3;
|
|
1052
|
-
}, {});
|
|
1053
|
-
}(n2), ie2 = s$1.pluginsArray.reduce(function(e2, n3) {
|
|
1054
|
-
var t3 = n3.name, r2 = n3.config, i2 = n3.loaded, a2 = s$1.pluginEnabled[t3];
|
|
1055
|
-
return e2[t3] = { enabled: a2, initialized: !!a2 && Boolean(!n3.initialize), loaded: Boolean(i2()), config: r2 || {} }, e2;
|
|
1056
|
-
}, {}), ae2 = { context: re2, user: F2, plugins: ie2 }, oe2 = P(function(e2) {
|
|
1057
|
-
for (var n3 = Object.keys(e2), t3 = {}, r2 = 0; r2 < n3.length; r2++) {
|
|
1058
|
-
var i2 = n3[r2];
|
|
1059
|
-
typeof e2[i2] === y && (t3[i2] = e2[i2]);
|
|
1060
|
-
}
|
|
1061
|
-
var a2, o2 = Object.keys(t3);
|
|
1062
|
-
try {
|
|
1063
|
-
!function(e3) {
|
|
1064
|
-
Object.keys(e3).forEach(function(n4) {
|
|
1065
|
-
var t4 = e3[n4];
|
|
1066
|
-
if (typeof t4(void 0, { type: "@@redux/INIT" }) === b$1 || typeof t4(void 0, { type: I$1 }) === b$1)
|
|
1067
|
-
throw new Error("reducer " + n4 + " " + b$1);
|
|
1068
|
-
});
|
|
1069
|
-
}(t3);
|
|
1070
|
-
} catch (e3) {
|
|
1071
|
-
a2 = e3;
|
|
1072
|
-
}
|
|
1073
|
-
return function(e3, n4) {
|
|
1074
|
-
if (e3 === void 0 && (e3 = {}), a2)
|
|
1075
|
-
throw a2;
|
|
1076
|
-
for (var r3 = false, i3 = {}, u2 = 0; u2 < o2.length; u2++) {
|
|
1077
|
-
var c3 = o2[u2], s2 = e3[c3], l2 = (0, t3[c3])(s2, n4);
|
|
1078
|
-
if (typeof l2 === b$1) {
|
|
1079
|
-
var f2 = S(c3, n4);
|
|
1080
|
-
throw new Error(f2);
|
|
150
|
+
function runReset(instance, ...args) {
|
|
151
|
+
return __async(this, null, function* () {
|
|
152
|
+
for (const p of Object.values(instance.plugins)) {
|
|
153
|
+
if (typeof p.reset === "function") {
|
|
154
|
+
try {
|
|
155
|
+
yield p.reset(...args);
|
|
156
|
+
} catch (_) {
|
|
1081
157
|
}
|
|
1082
|
-
i3[c3] = l2, r3 = r3 || l2 !== s2;
|
|
1083
158
|
}
|
|
1084
|
-
|
|
1085
|
-
};
|
|
1086
|
-
}(v({}, Y2, t2)), ae2, ee2(Z2(O$1.apply(void 0, Q2))));
|
|
1087
|
-
oe2.dispatch = (te2 = oe2.dispatch, function(e2, n3, t3) {
|
|
1088
|
-
var r2 = v({}, e2, { meta: Ue(e2.meta, n3, qe(t3)) });
|
|
1089
|
-
return te2.apply(null, [r2]);
|
|
1090
|
-
});
|
|
1091
|
-
var ue2 = Object.keys(h2);
|
|
1092
|
-
oe2.dispatch({ type: q.bootstrap, plugins: ue2, config: re2, params: J2, user: F2, initialUser: c2, persistedUser: W2 });
|
|
1093
|
-
var de2 = ue2.filter(function(e2) {
|
|
1094
|
-
return s$1.pluginEnabled[e2];
|
|
1095
|
-
}), pe2 = ue2.filter(function(e2) {
|
|
1096
|
-
return !s$1.pluginEnabled[e2];
|
|
159
|
+
}
|
|
1097
160
|
});
|
|
1098
|
-
return oe2.dispatch({ type: q.registerPlugins, plugins: ue2, enabled: s$1.pluginEnabled }), s$1.pluginsArray.map(function(e2, n3) {
|
|
1099
|
-
var t3 = e2.bootstrap, r2 = e2.config, i2 = e2.name;
|
|
1100
|
-
t3 && W$1(t3) && t3({ instance: K2, config: r2, payload: e2 }), oe2.dispatch({ type: q.registerPluginType(i2), name: i2, enabled: s$1.pluginEnabled[i2], plugin: e2 }), s$1.pluginsArray.length === n3 + 1 && oe2.dispatch({ type: q.initializeStart, plugins: de2, disabled: pe2 });
|
|
1101
|
-
}), Te(function(e2) {
|
|
1102
|
-
oe2.dispatch({ type: e2 ? q.offline : q.online });
|
|
1103
|
-
}), function(e2, n3, t3) {
|
|
1104
|
-
setInterval(function() {
|
|
1105
|
-
return H(e2, n3, t3);
|
|
1106
|
-
}, 3e3);
|
|
1107
|
-
}(oe2, x2, K2), K2;
|
|
1108
|
-
}
|
|
1109
|
-
var Le = "before", Ce = "after";
|
|
1110
|
-
var t = "cookie", i$1 = a$1(), r$1 = d$1, c = d$1;
|
|
1111
|
-
function u(o2) {
|
|
1112
|
-
return i$1 ? d$1(o2, "", -1) : i$2(o2);
|
|
1113
|
-
}
|
|
1114
|
-
function a$1() {
|
|
1115
|
-
if (i$1 !== void 0)
|
|
1116
|
-
return i$1;
|
|
1117
|
-
var e2 = "cookiecookie";
|
|
1118
|
-
try {
|
|
1119
|
-
d$1(e2, e2), i$1 = document.cookie.indexOf(e2) !== -1, u(e2);
|
|
1120
|
-
} catch (e3) {
|
|
1121
|
-
i$1 = false;
|
|
1122
|
-
}
|
|
1123
|
-
return i$1;
|
|
1124
|
-
}
|
|
1125
|
-
function d$1(e2, t2, r2, c2, u2, a2) {
|
|
1126
|
-
if (typeof window != "undefined") {
|
|
1127
|
-
var d2 = arguments.length > 1;
|
|
1128
|
-
return i$1 === false && (d2 ? f(e2, t2) : a$2(e2)), d2 ? document.cookie = e2 + "=" + encodeURIComponent(t2) + (r2 ? "; expires=" + new Date(+new Date() + 1e3 * r2).toUTCString() + (c2 ? "; path=" + c2 : "") + (u2 ? "; domain=" + u2 : "") + (a2 ? "; secure" : "") : "") : decodeURIComponent((("; " + document.cookie).split("; " + e2 + "=")[1] || "").split(";")[0]);
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
var r = "localStorage", g = b$2.bind(null, "localStorage");
|
|
1132
|
-
u$1("localStorage", "getItem", a$2);
|
|
1133
|
-
u$1("localStorage", "setItem", f);
|
|
1134
|
-
u$1("localStorage", "removeItem", i$2);
|
|
1135
|
-
var a = "sessionStorage", i = b$2.bind(null, "sessionStorage");
|
|
1136
|
-
u$1("sessionStorage", "getItem", a$2);
|
|
1137
|
-
u$1("sessionStorage", "setItem", f);
|
|
1138
|
-
u$1("sessionStorage", "removeItem", i$2);
|
|
1139
|
-
function I(t2) {
|
|
1140
|
-
var o2 = t2;
|
|
1141
|
-
try {
|
|
1142
|
-
if ((o2 = JSON.parse(t2)) === "true")
|
|
1143
|
-
return true;
|
|
1144
|
-
if (o2 === "false")
|
|
1145
|
-
return false;
|
|
1146
|
-
if (on(o2))
|
|
1147
|
-
return o2;
|
|
1148
|
-
parseFloat(o2) === o2 && (o2 = parseFloat(o2));
|
|
1149
|
-
} catch (t3) {
|
|
1150
|
-
}
|
|
1151
|
-
if (o2 !== null && o2 !== "")
|
|
1152
|
-
return o2;
|
|
1153
|
-
}
|
|
1154
|
-
var k = g(), O = i(), x = a$1();
|
|
1155
|
-
function C(o2, e2) {
|
|
1156
|
-
if (o2) {
|
|
1157
|
-
var r2 = A(e2), a2 = !N(r2), i2 = d(r2) ? I(localStorage.getItem(o2)) : void 0;
|
|
1158
|
-
if (a2 && !I$2(i2))
|
|
1159
|
-
return i2;
|
|
1160
|
-
var n2 = h(r2) ? I(r$1(o2)) : void 0;
|
|
1161
|
-
if (a2 && n2)
|
|
1162
|
-
return n2;
|
|
1163
|
-
var l2 = E(r2) ? I(sessionStorage.getItem(o2)) : void 0;
|
|
1164
|
-
if (a2 && l2)
|
|
1165
|
-
return l2;
|
|
1166
|
-
var u2 = a$2(o2);
|
|
1167
|
-
return a2 ? u2 : { localStorage: i2, sessionStorage: l2, cookie: n2, global: u2 };
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
function L(r$2, a$12, l$1) {
|
|
1171
|
-
if (r$2 && !I$2(a$12)) {
|
|
1172
|
-
var u2 = {}, g2 = A(l$1), m2 = JSON.stringify(a$12), S2 = !N(g2);
|
|
1173
|
-
return d(g2) && (u2[r] = F(r, a$12, I(localStorage.getItem(r$2))), localStorage.setItem(r$2, m2), S2) ? u2[r] : h(g2) && (u2[t] = F(t, a$12, I(r$1(r$2))), c(r$2, m2), S2) ? u2[t] : E(g2) && (u2[a] = F(a, a$12, I(sessionStorage.getItem(r$2))), sessionStorage.setItem(r$2, m2), S2) ? u2[a] : (u2[l] = F(l, a$12, a$2(r$2)), f(r$2, a$12), S2 ? u2[l] : u2);
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
function b(t$1, e2) {
|
|
1177
|
-
if (t$1) {
|
|
1178
|
-
var a$12 = A(e2), s2 = C(t$1, m$1), n2 = {};
|
|
1179
|
-
return !I$2(s2.localStorage) && d(a$12) && (localStorage.removeItem(t$1), n2[r] = s2.localStorage), !I$2(s2.cookie) && h(a$12) && (u(t$1), n2[t] = s2.cookie), !I$2(s2.sessionStorage) && E(a$12) && (sessionStorage.removeItem(t$1), n2[a] = s2.sessionStorage), !I$2(s2.global) && G(a$12, l) && (i$2(t$1), n2[l] = s2.global), n2;
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
function A(t2) {
|
|
1183
|
-
return t2 ? q$1(t2) ? t2 : t2.storage : g$1;
|
|
1184
|
-
}
|
|
1185
|
-
function d(t2) {
|
|
1186
|
-
return k && G(t2, r);
|
|
1187
|
-
}
|
|
1188
|
-
function h(t$1) {
|
|
1189
|
-
return x && G(t$1, t);
|
|
1190
|
-
}
|
|
1191
|
-
function E(t2) {
|
|
1192
|
-
return O && G(t2, a);
|
|
1193
161
|
}
|
|
1194
|
-
function
|
|
1195
|
-
|
|
1196
|
-
}
|
|
1197
|
-
function G(t2, o2) {
|
|
1198
|
-
return t2 === g$1 || t2 === o2 || N(t2);
|
|
1199
|
-
}
|
|
1200
|
-
function F(t2, o2, e2) {
|
|
1201
|
-
return { location: t2, current: o2, previous: e2 };
|
|
1202
|
-
}
|
|
1203
|
-
var J = { setItem: L, getItem: C, removeItem: b };
|
|
1204
|
-
function _defineProperty(obj, key, value) {
|
|
1205
|
-
if (key in obj) {
|
|
1206
|
-
Object.defineProperty(obj, key, {
|
|
1207
|
-
value,
|
|
1208
|
-
enumerable: true,
|
|
1209
|
-
configurable: true,
|
|
1210
|
-
writable: true
|
|
1211
|
-
});
|
|
1212
|
-
} else {
|
|
1213
|
-
obj[key] = value;
|
|
1214
|
-
}
|
|
1215
|
-
return obj;
|
|
1216
|
-
}
|
|
1217
|
-
function ownKeys(object, enumerableOnly) {
|
|
1218
|
-
var keys = Object.keys(object);
|
|
1219
|
-
if (Object.getOwnPropertySymbols) {
|
|
1220
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
1221
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
1222
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1223
|
-
})), keys.push.apply(keys, symbols);
|
|
1224
|
-
}
|
|
1225
|
-
return keys;
|
|
1226
|
-
}
|
|
1227
|
-
function _objectSpread2(target) {
|
|
1228
|
-
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
1229
|
-
var source = arguments[i2] != null ? arguments[i2] : {};
|
|
1230
|
-
i2 % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
1231
|
-
_defineProperty(target, key, source[key]);
|
|
1232
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
1233
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1234
|
-
});
|
|
1235
|
-
}
|
|
1236
|
-
return target;
|
|
1237
|
-
}
|
|
1238
|
-
function analyticsLib() {
|
|
1239
|
-
var opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1240
|
-
var defaultSettings = {
|
|
1241
|
-
storage: J
|
|
1242
|
-
};
|
|
1243
|
-
return Ve(_objectSpread2(_objectSpread2({}, defaultSettings), opts));
|
|
1244
|
-
}
|
|
1245
|
-
function facebookScriptInit(f2, b2, e2, v2, n2, t2, s2) {
|
|
1246
|
-
if (f2.fbq)
|
|
162
|
+
function facebookScriptInit(f, b, e, v, n, t, s) {
|
|
163
|
+
if (f.fbq)
|
|
1247
164
|
return;
|
|
1248
|
-
|
|
1249
|
-
|
|
165
|
+
n = f.fbq = function() {
|
|
166
|
+
n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
|
|
1250
167
|
};
|
|
1251
|
-
if (!
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
168
|
+
if (!f._fbq)
|
|
169
|
+
f._fbq = n;
|
|
170
|
+
n.push = n;
|
|
171
|
+
n.loaded = true;
|
|
172
|
+
n.version = "2.0";
|
|
173
|
+
n.queue = [];
|
|
174
|
+
t = b.createElement(e);
|
|
175
|
+
t.async = true;
|
|
176
|
+
t.src = v;
|
|
177
|
+
s = b.getElementsByTagName(e)[0];
|
|
178
|
+
s.parentNode.insertBefore(t, s);
|
|
1262
179
|
}
|
|
1263
180
|
function facebookInit({ trackingId }) {
|
|
1264
181
|
facebookScriptInit(window, document, "script", "https://connect.facebook.net/en_US/fbevents.js");
|
|
@@ -1277,7 +194,7 @@ function facebook(pluginConfig = {}) {
|
|
|
1277
194
|
window.fbq("track", "PageView");
|
|
1278
195
|
},
|
|
1279
196
|
track: function({ payload, config, instance }) {
|
|
1280
|
-
window.fbq("
|
|
197
|
+
window.fbq("trackCustom", payload.event, payload.properties);
|
|
1281
198
|
},
|
|
1282
199
|
identify: function({ payload, config }) {
|
|
1283
200
|
},
|
|
@@ -1319,10 +236,10 @@ function googleAnalytics4(pluginConfig = {}) {
|
|
|
1319
236
|
var setParams = {};
|
|
1320
237
|
if (config.customDimensions) {
|
|
1321
238
|
var customMap = {};
|
|
1322
|
-
for (var
|
|
1323
|
-
var customDim = config.customDimensions[
|
|
239
|
+
for (var i = 0; i < config.customDimensions.length; i++) {
|
|
240
|
+
var customDim = config.customDimensions[i];
|
|
1324
241
|
configParams[customDim.name] = customDim.callback(instance, config);
|
|
1325
|
-
customMap["dimension" + (
|
|
242
|
+
customMap["dimension" + (i + 1)] = customDim.name;
|
|
1326
243
|
}
|
|
1327
244
|
setParams["custom_map"] = customMap;
|
|
1328
245
|
}
|
|
@@ -1368,9 +285,9 @@ function isBot() {
|
|
|
1368
285
|
/mediapartners/,
|
|
1369
286
|
/Google-Read-Aloud/,
|
|
1370
287
|
/semrush/
|
|
1371
|
-
].map((
|
|
288
|
+
].map((r) => r.source).join("|"), "i");
|
|
1372
289
|
return bots.test(ua);
|
|
1373
|
-
} catch (
|
|
290
|
+
} catch (e) {
|
|
1374
291
|
return false;
|
|
1375
292
|
}
|
|
1376
293
|
}
|
|
@@ -1390,7 +307,7 @@ function hasSessionStorage() {
|
|
|
1390
307
|
try {
|
|
1391
308
|
sessionStorage.setItem(undef, undef);
|
|
1392
309
|
sessionStorage.removeItem(undef);
|
|
1393
|
-
} catch (
|
|
310
|
+
} catch (e) {
|
|
1394
311
|
supportsSessionStorage = false;
|
|
1395
312
|
}
|
|
1396
313
|
return supportsSessionStorage;
|
|
@@ -1416,27 +333,6 @@ function setSessionStorage(key, value) {
|
|
|
1416
333
|
}
|
|
1417
334
|
zarGlobal[key] = value_str;
|
|
1418
335
|
}
|
|
1419
|
-
function hasAdBlock() {
|
|
1420
|
-
var fakeAd = document.createElement("div");
|
|
1421
|
-
fakeAd.innerHTML = " ";
|
|
1422
|
-
fakeAd.className = "pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links";
|
|
1423
|
-
fakeAd.setAttribute("style", "width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;");
|
|
1424
|
-
try {
|
|
1425
|
-
document.body.appendChild(fakeAd);
|
|
1426
|
-
if (document.body.getAttribute("abp") !== null || fakeAd.offsetHeight === 0 || fakeAd.clientHeight === 0) {
|
|
1427
|
-
return true;
|
|
1428
|
-
}
|
|
1429
|
-
if (typeof getComputedStyle !== "undefined") {
|
|
1430
|
-
var css = window.getComputedStyle(fakeAd, null);
|
|
1431
|
-
if (css && (css.getPropertyValue("display") === "none" || css.getPropertyValue("visibility") === "hidden")) {
|
|
1432
|
-
return true;
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
document.body.removeChild(fakeAd);
|
|
1436
|
-
} catch (e2) {
|
|
1437
|
-
}
|
|
1438
|
-
return false;
|
|
1439
|
-
}
|
|
1440
336
|
function makeRequest({ method, url, data, json = true }) {
|
|
1441
337
|
return new Promise(function(resolve, reject) {
|
|
1442
338
|
var xhr = new XMLHttpRequest();
|
|
@@ -1482,12 +378,14 @@ function postBeacon(_0) {
|
|
|
1482
378
|
return __async(this, arguments, function* ({ url, data }) {
|
|
1483
379
|
if (window && window.navigator && typeof window.navigator.sendBeacon === "function" && typeof window.Blob === "function") {
|
|
1484
380
|
try {
|
|
1485
|
-
const blob = new Blob([JSON.stringify(data)], {
|
|
381
|
+
const blob = new Blob([JSON.stringify(data)], {
|
|
382
|
+
type: "text/plain; charset=UTF-8"
|
|
383
|
+
});
|
|
1486
384
|
if (window.navigator.sendBeacon(url, blob)) {
|
|
1487
385
|
return true;
|
|
1488
386
|
}
|
|
1489
387
|
return false;
|
|
1490
|
-
} catch (
|
|
388
|
+
} catch (e) {
|
|
1491
389
|
warn("postBeacon:");
|
|
1492
390
|
return false;
|
|
1493
391
|
}
|
|
@@ -1599,30 +497,30 @@ function overlayPhoneNumber({ elems, number, force = false }) {
|
|
|
1599
497
|
if (!number.startsWith("+1")) {
|
|
1600
498
|
overlayNum = "+1" + number;
|
|
1601
499
|
}
|
|
1602
|
-
for (var
|
|
1603
|
-
if (numberOverlayMap.has(elems[
|
|
500
|
+
for (var i = 0; i < elems.length; i++) {
|
|
501
|
+
if (numberOverlayMap.has(elems[i])) {
|
|
1604
502
|
if (force) {
|
|
1605
|
-
origNum = numberOverlayMap.get(elems[
|
|
503
|
+
origNum = numberOverlayMap.get(elems[i]);
|
|
1606
504
|
} else {
|
|
1607
|
-
dbg("element already in overlay map:", elems[
|
|
505
|
+
dbg("element already in overlay map:", elems[i]);
|
|
1608
506
|
continue;
|
|
1609
507
|
}
|
|
1610
508
|
}
|
|
1611
|
-
var elemNum = extractPhoneNumber({ elem: elems[
|
|
509
|
+
var elemNum = extractPhoneNumber({ elem: elems[i] });
|
|
1612
510
|
if (!origNum) {
|
|
1613
511
|
origNum = elemNum;
|
|
1614
512
|
} else if (!force && elemNum.number && origNum.number && origNum.number !== elemNum.number) {
|
|
1615
513
|
warn("overlaying multiple numbers with a single number", origNum.number, elemNum.number);
|
|
1616
514
|
}
|
|
1617
|
-
dbg("overlaying", overlayNum, "on", elems[
|
|
1618
|
-
if (!numberOverlayMap.has(elems[
|
|
1619
|
-
numberOverlayMap.set(elems[
|
|
515
|
+
dbg("overlaying", overlayNum, "on", elems[i]);
|
|
516
|
+
if (!numberOverlayMap.has(elems[i])) {
|
|
517
|
+
numberOverlayMap.set(elems[i], elemNum);
|
|
1620
518
|
}
|
|
1621
519
|
if (elemNum.href) {
|
|
1622
|
-
elems[
|
|
520
|
+
elems[i].href = "tel:" + overlayNum;
|
|
1623
521
|
}
|
|
1624
522
|
if (elemNum.numberText) {
|
|
1625
|
-
elems[
|
|
523
|
+
elems[i].innerHTML = "";
|
|
1626
524
|
if (elemNum.text) {
|
|
1627
525
|
var overlay = overlayNum;
|
|
1628
526
|
if (elemNum.numberText.indexOf("-") > -1) {
|
|
@@ -1630,34 +528,40 @@ function overlayPhoneNumber({ elems, number, force = false }) {
|
|
|
1630
528
|
}
|
|
1631
529
|
if (elemNum.html.indexOf("<img") > -1) {
|
|
1632
530
|
var numberHtml = elemNum.html.replace(elemNum.numberText, overlay);
|
|
1633
|
-
elems[
|
|
531
|
+
elems[i].innerHTML = numberHtml;
|
|
1634
532
|
} else {
|
|
1635
533
|
var numberText = elemNum.text.replace(elemNum.numberText, overlay);
|
|
1636
|
-
elems[
|
|
534
|
+
elems[i].appendChild(document.createTextNode(numberText));
|
|
1637
535
|
}
|
|
1638
536
|
} else {
|
|
1639
|
-
elems[
|
|
537
|
+
elems[i].appendChild(document.createTextNode(overlayNum));
|
|
1640
538
|
}
|
|
1641
539
|
} else {
|
|
1642
|
-
dbg("no number text found:", elems[
|
|
540
|
+
dbg("no number text found:", elems[i]);
|
|
1643
541
|
}
|
|
1644
542
|
}
|
|
1645
543
|
}
|
|
1646
544
|
function revertOverlayNumbers({ elems }) {
|
|
1647
|
-
for (var
|
|
1648
|
-
if (numberOverlayMap.has(elems[
|
|
1649
|
-
var currentHTML = elems[
|
|
1650
|
-
var origElemData = numberOverlayMap.get(elems[
|
|
545
|
+
for (var i = 0; i < elems.length; i++) {
|
|
546
|
+
if (numberOverlayMap.has(elems[i])) {
|
|
547
|
+
var currentHTML = elems[i].innerHTML;
|
|
548
|
+
var origElemData = numberOverlayMap.get(elems[i]);
|
|
1651
549
|
dbg("orig:", origElemData);
|
|
1652
550
|
var origHTML = origElemData.html;
|
|
1653
551
|
dbg("reverting", currentHTML, "to", origHTML);
|
|
1654
|
-
|
|
552
|
+
if (origHTML !== void 0 && origHTML !== null && origHTML !== "") {
|
|
553
|
+
elems[i].innerHTML = origHTML;
|
|
554
|
+
} else if (origElemData.text !== void 0 && origElemData.text !== null) {
|
|
555
|
+
elems[i].textContent = origElemData.text;
|
|
556
|
+
} else {
|
|
557
|
+
elems[i].textContent = "";
|
|
558
|
+
}
|
|
1655
559
|
if (origElemData.href) {
|
|
1656
|
-
elems[
|
|
560
|
+
elems[i].setAttribute("href", origElemData.href);
|
|
1657
561
|
}
|
|
1658
|
-
numberOverlayMap.delete(elems[
|
|
562
|
+
numberOverlayMap.delete(elems[i]);
|
|
1659
563
|
} else {
|
|
1660
|
-
dbg("element not in map:", elems[
|
|
564
|
+
dbg("element not in map:", elems[i]);
|
|
1661
565
|
}
|
|
1662
566
|
}
|
|
1663
567
|
}
|
|
@@ -1697,8 +601,8 @@ function drainPoolDataLayer() {
|
|
|
1697
601
|
return null;
|
|
1698
602
|
}
|
|
1699
603
|
var mergedObject = {};
|
|
1700
|
-
for (var
|
|
1701
|
-
var obj = window.zarPoolDataLayer[
|
|
604
|
+
for (var i = 0; i < window.zarPoolDataLayer.length; i++) {
|
|
605
|
+
var obj = window.zarPoolDataLayer[i];
|
|
1702
606
|
for (var key in obj) {
|
|
1703
607
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
1704
608
|
mergedObject[key] = obj[key];
|
|
@@ -1758,8 +662,8 @@ function renewTrackingPool() {
|
|
|
1758
662
|
const number = window.zarPoolData.number;
|
|
1759
663
|
try {
|
|
1760
664
|
var resp = yield getPoolNumber({ poolId, apiUrl, number, context });
|
|
1761
|
-
} catch (
|
|
1762
|
-
var msg = "error getting number: " + JSON.stringify(
|
|
665
|
+
} catch (e) {
|
|
666
|
+
var msg = "error getting number: " + JSON.stringify(e);
|
|
1763
667
|
warn(msg);
|
|
1764
668
|
getNumberFailureCount++;
|
|
1765
669
|
if (getNumberFailureCount >= MAX_GET_NUMBER_FAILURES) {
|
|
@@ -1862,8 +766,8 @@ function initTrackingPool() {
|
|
|
1862
766
|
}
|
|
1863
767
|
try {
|
|
1864
768
|
poolData = yield getPoolNumber({ poolId, apiUrl, number: null, context });
|
|
1865
|
-
} catch (
|
|
1866
|
-
msg = "error getting number on init: " + JSON.stringify(
|
|
769
|
+
} catch (e) {
|
|
770
|
+
msg = "error getting number on init: " + JSON.stringify(e);
|
|
1867
771
|
warn(msg);
|
|
1868
772
|
if (poolConfig.initCallback) {
|
|
1869
773
|
poolConfig.initCallback({ status: NUMBER_POOL_ERROR, msg });
|
|
@@ -1875,8 +779,8 @@ function initTrackingPool() {
|
|
|
1875
779
|
if (poolActive()) {
|
|
1876
780
|
try {
|
|
1877
781
|
initPoolDataLayerObserver(apiUrl);
|
|
1878
|
-
} catch (
|
|
1879
|
-
warn("data layer observer error: " + JSON.stringify(
|
|
782
|
+
} catch (e) {
|
|
783
|
+
warn("data layer observer error: " + JSON.stringify(e));
|
|
1880
784
|
}
|
|
1881
785
|
afterDOMContentLoaded(function() {
|
|
1882
786
|
var overlayElements = document.querySelectorAll(poolConfig.overlayQuerySelector);
|
|
@@ -1896,8 +800,8 @@ function initTrackingPool() {
|
|
|
1896
800
|
apiUrl,
|
|
1897
801
|
contextCallback: poolConfig.contextCallback
|
|
1898
802
|
});
|
|
1899
|
-
} catch (
|
|
1900
|
-
var msg3 = "error on interval: " + JSON.stringify(
|
|
803
|
+
} catch (e) {
|
|
804
|
+
var msg3 = "error on interval: " + JSON.stringify(e);
|
|
1901
805
|
warn(msg3);
|
|
1902
806
|
}
|
|
1903
807
|
}, poolConfig.renewalInterval || NUMBER_POOL_RENEWAL_TIME_MS);
|
|
@@ -1924,15 +828,6 @@ function zar({ apiUrl, poolConfig }) {
|
|
|
1924
828
|
payload.properties.zar = getStorage();
|
|
1925
829
|
payload.properties.referrer = document.referrer;
|
|
1926
830
|
payload.properties.is_bot = isBot();
|
|
1927
|
-
if ("hash" in payload.properties) {
|
|
1928
|
-
delete payload.properties["hash"];
|
|
1929
|
-
}
|
|
1930
|
-
if ("path" in payload.properties) {
|
|
1931
|
-
delete payload.properties["path"];
|
|
1932
|
-
}
|
|
1933
|
-
if ("search" in payload.properties) {
|
|
1934
|
-
delete payload.properties["search"];
|
|
1935
|
-
}
|
|
1936
831
|
try {
|
|
1937
832
|
var pcfg = config.poolConfig;
|
|
1938
833
|
if (pcfg && pcfg.poolId) {
|
|
@@ -1942,8 +837,8 @@ function zar({ apiUrl, poolConfig }) {
|
|
|
1942
837
|
payload.properties.pool_context = pcfg.contextCallback(context) || {};
|
|
1943
838
|
}
|
|
1944
839
|
}
|
|
1945
|
-
} catch (
|
|
1946
|
-
warn("error getting pool id: " + JSON.stringify(
|
|
840
|
+
} catch (e) {
|
|
841
|
+
warn("error getting pool id: " + JSON.stringify(e));
|
|
1947
842
|
}
|
|
1948
843
|
return payload;
|
|
1949
844
|
},
|
|
@@ -1957,13 +852,13 @@ function zar({ apiUrl, poolConfig }) {
|
|
|
1957
852
|
try {
|
|
1958
853
|
res = yield httpPost({ url: `${config.apiUrl}/page`, data: payload });
|
|
1959
854
|
break;
|
|
1960
|
-
} catch (
|
|
855
|
+
} catch (e) {
|
|
1961
856
|
tries++;
|
|
1962
857
|
if (tries >= maxTries) {
|
|
1963
|
-
warn("error posting page: " + JSON.stringify(
|
|
1964
|
-
throw
|
|
858
|
+
warn("error posting page: " + JSON.stringify(e));
|
|
859
|
+
throw e;
|
|
1965
860
|
}
|
|
1966
|
-
yield new Promise((
|
|
861
|
+
yield new Promise((r) => setTimeout(r, 1e3));
|
|
1967
862
|
}
|
|
1968
863
|
}
|
|
1969
864
|
if (res && res.pool_data) {
|
|
@@ -2004,9 +899,6 @@ function zar({ apiUrl, poolConfig }) {
|
|
|
2004
899
|
getVID() {
|
|
2005
900
|
return getID(VID_KEY);
|
|
2006
901
|
},
|
|
2007
|
-
hasAdBlock() {
|
|
2008
|
-
return hasAdBlock();
|
|
2009
|
-
},
|
|
2010
902
|
isBot() {
|
|
2011
903
|
return isBot();
|
|
2012
904
|
},
|
|
@@ -2039,8 +931,8 @@ function zar({ apiUrl, poolConfig }) {
|
|
|
2039
931
|
},
|
|
2040
932
|
extractPhoneNumbers({ elems }) {
|
|
2041
933
|
var res = [];
|
|
2042
|
-
for (var
|
|
2043
|
-
var elemRes = extractPhoneNumber({ elem: elems[
|
|
934
|
+
for (var i = 0; i < elems.length; i++) {
|
|
935
|
+
var elemRes = extractPhoneNumber({ elem: elems[i] });
|
|
2044
936
|
res.push(elemRes);
|
|
2045
937
|
}
|
|
2046
938
|
return res;
|
|
@@ -2078,7 +970,14 @@ function init({
|
|
|
2078
970
|
if (facebookConfig) {
|
|
2079
971
|
plugins.push(facebook(facebookConfig));
|
|
2080
972
|
}
|
|
2081
|
-
return
|
|
973
|
+
return Analytics({ app, plugins });
|
|
2082
974
|
}
|
|
2083
|
-
|
|
975
|
+
const __test__ = {
|
|
976
|
+
extractPhoneNumber,
|
|
977
|
+
overlayPhoneNumber,
|
|
978
|
+
revertOverlayNumbers,
|
|
979
|
+
drainPoolDataLayer,
|
|
980
|
+
getPoolId
|
|
981
|
+
};
|
|
982
|
+
export { Analytics, __test__, init, zar };
|
|
2084
983
|
//# sourceMappingURL=zar.es.js.map
|