zar 0.5.2 → 0.5.4
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 +190 -190
- package/dist/zar.es.js.map +1 -1
- package/dist/zar.iife.js +1 -1
- package/dist/zar.iife.js.map +1 -1
- package/dist/zar.umd.js +1 -1
- package/dist/zar.umd.js.map +1 -1
- package/package.json +2 -1
package/dist/zar.es.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
var d = (t, e, n) => new Promise((r, i) => {
|
|
2
|
-
var a = (
|
|
2
|
+
var a = (u) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
5
|
-
} catch (
|
|
6
|
-
i(
|
|
4
|
+
c(n.next(u));
|
|
5
|
+
} catch (s) {
|
|
6
|
+
i(s);
|
|
7
7
|
}
|
|
8
|
-
}, o = (
|
|
8
|
+
}, o = (u) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
i(
|
|
10
|
+
c(n.throw(u));
|
|
11
|
+
} catch (s) {
|
|
12
|
+
i(s);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, c = (u) => u.done ? r(u.value) : Promise.resolve(u.value).then(a, o);
|
|
15
|
+
c((n = n.apply(t, e)).next());
|
|
16
16
|
});
|
|
17
|
-
function
|
|
17
|
+
function K({ app: t, plugins: e = [] } = {}) {
|
|
18
18
|
const n = {
|
|
19
19
|
app: t,
|
|
20
20
|
plugins: {},
|
|
21
|
-
page: (r = {}) =>
|
|
22
|
-
track: (r, i = {}, a) =>
|
|
21
|
+
page: (r = {}) => tt(n, r),
|
|
22
|
+
track: (r, i = {}, a) => et(
|
|
23
23
|
n,
|
|
24
24
|
a ? { event: r, properties: i, options: a } : { event: r, properties: i }
|
|
25
25
|
),
|
|
26
26
|
reset: (...r) => d(this, null, function* () {
|
|
27
|
-
return
|
|
27
|
+
return rt(n, ...r);
|
|
28
28
|
})
|
|
29
29
|
};
|
|
30
30
|
return e.forEach((r) => {
|
|
@@ -42,14 +42,14 @@ function Z({ app: t, plugins: e = [] } = {}) {
|
|
|
42
42
|
}
|
|
43
43
|
}), n;
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
function
|
|
47
|
-
return typeof window == "undefined" ? "" : window.location.href.replace(
|
|
45
|
+
const Y = /#.*$/;
|
|
46
|
+
function Z() {
|
|
47
|
+
return typeof window == "undefined" ? "" : window.location.href.replace(Y, "");
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function U(t = {}) {
|
|
50
50
|
if (typeof window == "undefined" || typeof document == "undefined")
|
|
51
51
|
return t;
|
|
52
|
-
const { title: e, referrer: n } = document, { innerWidth: r, innerHeight: i } = window, a =
|
|
52
|
+
const { title: e, referrer: n } = document, { innerWidth: r, innerHeight: i } = window, a = Z(), o = {
|
|
53
53
|
title: e,
|
|
54
54
|
url: a,
|
|
55
55
|
width: r,
|
|
@@ -57,9 +57,9 @@ function q(t = {}) {
|
|
|
57
57
|
};
|
|
58
58
|
return n && n !== "" && (o.referrer = n), Object.assign({}, o, t);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function tt(n) {
|
|
61
61
|
return d(this, arguments, function* (t, e = {}) {
|
|
62
|
-
e.type || (e.type = "page"), e.properties =
|
|
62
|
+
e.type || (e.type = "page"), e.properties = U(e.properties || {}), Object.values(t.plugins).forEach((r) => {
|
|
63
63
|
if (typeof r.pageStart == "function")
|
|
64
64
|
try {
|
|
65
65
|
const i = r.pageStart({ payload: e, config: r.config, instance: t });
|
|
@@ -76,35 +76,35 @@ function rt(n) {
|
|
|
76
76
|
return e;
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function et(n) {
|
|
80
80
|
return d(this, arguments, function* (t, e = {}) {
|
|
81
81
|
e.type || (e.type = "track");
|
|
82
|
-
const r =
|
|
82
|
+
const r = U(), i = e.properties || {};
|
|
83
83
|
i.url === void 0 && (i.url = r.url), i.referrer === void 0 && r.referrer !== void 0 && (i.referrer = r.referrer), e.properties = i;
|
|
84
|
-
const a = e.options || {}, o = a && typeof a.plugins == "object" ? a.plugins : null,
|
|
85
|
-
Object.values(t.plugins).forEach((
|
|
86
|
-
if (!u
|
|
84
|
+
const a = e.options || {}, o = a && typeof a.plugins == "object" ? a.plugins : null, c = (u) => o && o[u.name] === !1;
|
|
85
|
+
Object.values(t.plugins).forEach((u) => {
|
|
86
|
+
if (!c(u) && typeof u.trackStart == "function")
|
|
87
87
|
try {
|
|
88
|
-
const
|
|
88
|
+
const s = u.trackStart({
|
|
89
89
|
payload: e,
|
|
90
90
|
options: a,
|
|
91
|
-
config:
|
|
91
|
+
config: u.config,
|
|
92
92
|
instance: t
|
|
93
93
|
});
|
|
94
|
-
|
|
95
|
-
} catch (
|
|
94
|
+
s && (e = s);
|
|
95
|
+
} catch (s) {
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
|
-
for (const
|
|
99
|
-
if (!u
|
|
98
|
+
for (const u of Object.values(t.plugins))
|
|
99
|
+
if (!c(u) && typeof u.track == "function")
|
|
100
100
|
try {
|
|
101
|
-
yield
|
|
102
|
-
} catch (
|
|
101
|
+
yield u.track({ payload: e, options: a, instance: t, config: u.config });
|
|
102
|
+
} catch (s) {
|
|
103
103
|
}
|
|
104
104
|
return e;
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function rt(t, ...e) {
|
|
108
108
|
return d(this, null, function* () {
|
|
109
109
|
for (const n of Object.values(t.plugins))
|
|
110
110
|
if (typeof n.reset == "function")
|
|
@@ -114,27 +114,27 @@ function at(t, ...e) {
|
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function nt(t, e, n, r, i, a, o) {
|
|
118
118
|
t.fbq || (i = t.fbq = function() {
|
|
119
119
|
i.callMethod ? i.callMethod.apply(i, arguments) : i.queue.push(arguments);
|
|
120
120
|
}, t._fbq || (t._fbq = i), i.push = i, i.loaded = !0, i.version = "2.0", i.queue = [], a = e.createElement(n), a.async = !0, a.src = r, o = e.getElementsByTagName(n)[0], o.parentNode.insertBefore(a, o));
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
|
|
122
|
+
function at({ trackingId: t }) {
|
|
123
|
+
nt(
|
|
124
124
|
window,
|
|
125
125
|
document,
|
|
126
126
|
"script",
|
|
127
127
|
"https://connect.facebook.net/en_US/fbevents.js"
|
|
128
128
|
), window.fbq("init", t);
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function it(t = {}) {
|
|
131
131
|
return {
|
|
132
132
|
name: "facebook",
|
|
133
133
|
config: t,
|
|
134
134
|
initialize: function({ config: e, instance: n }) {
|
|
135
135
|
if (!e.trackingId)
|
|
136
136
|
throw new Error("No Facebook trackingId defined");
|
|
137
|
-
|
|
137
|
+
at({ trackingId: e.trackingId });
|
|
138
138
|
},
|
|
139
139
|
page: function({ payload: e, config: n, instance: r }) {
|
|
140
140
|
window.fbq("track", "PageView");
|
|
@@ -153,14 +153,14 @@ function P() {
|
|
|
153
153
|
window.dataLayer.push(arguments);
|
|
154
154
|
}
|
|
155
155
|
window.gtag = P;
|
|
156
|
-
function
|
|
156
|
+
function ot({ trackingId: t, configParams: e = {}, setParams: n = {} }) {
|
|
157
157
|
var r = "ga-gtag";
|
|
158
158
|
if (!document.getElementById(r)) {
|
|
159
159
|
var i = document.head, a = document.createElement("script");
|
|
160
160
|
a.id = r, a.type = "text/javascript", a.async = !0, a.src = "https://www.googletagmanager.com/gtag/js?id=" + t, i.insertBefore(a, i.firstChild), window.dataLayer = window.dataLayer || [], P("js", /* @__PURE__ */ new Date()), n && P("set", n), P("config", t, e);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function ut(t = {}) {
|
|
164
164
|
return {
|
|
165
165
|
name: "google-analytics-4",
|
|
166
166
|
config: t,
|
|
@@ -170,12 +170,12 @@ function ct(t = {}) {
|
|
|
170
170
|
var r = {}, i = {};
|
|
171
171
|
if (e.customDimensions) {
|
|
172
172
|
for (var a = {}, o = 0; o < e.customDimensions.length; o++) {
|
|
173
|
-
var
|
|
174
|
-
r[
|
|
173
|
+
var c = e.customDimensions[o];
|
|
174
|
+
r[c.name] = c.callback(n, e), a["dimension" + (o + 1)] = c.name;
|
|
175
175
|
}
|
|
176
176
|
i.custom_map = a;
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
ot({ trackingId: e.trackingId, configParams: r, setParams: i });
|
|
179
179
|
},
|
|
180
180
|
page: function({ payload: e, config: n, instance: r }) {
|
|
181
181
|
},
|
|
@@ -189,18 +189,18 @@ function ct(t = {}) {
|
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
var
|
|
192
|
+
var ct = new URLSearchParams(window.location.search), st = ct.get("zdbg"), q = {};
|
|
193
193
|
const I = "undefined";
|
|
194
194
|
function g() {
|
|
195
|
-
|
|
195
|
+
st == 1 && console.debug(...arguments);
|
|
196
196
|
}
|
|
197
197
|
function l(t) {
|
|
198
198
|
console.warn(t), window.Rollbar && window.Rollbar.warning(t);
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function ft(t) {
|
|
201
201
|
return t && (Object.prototype.toString.call(t) === "[object Function]" || typeof t == "function" || t instanceof Function);
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function j() {
|
|
204
204
|
try {
|
|
205
205
|
var t = navigator.userAgent || "", e = new RegExp(
|
|
206
206
|
[
|
|
@@ -218,11 +218,11 @@ function B() {
|
|
|
218
218
|
return !1;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function lt(t) {
|
|
222
222
|
document.readyState === "complete" || document.readyState === "loaded" || document.readyState === "interactive" ? t() : window.addEventListener("DOMContentLoaded", t);
|
|
223
223
|
}
|
|
224
|
-
var p =
|
|
225
|
-
function
|
|
224
|
+
var p = dt();
|
|
225
|
+
function dt() {
|
|
226
226
|
if (typeof p !== I)
|
|
227
227
|
return p;
|
|
228
228
|
p = !0;
|
|
@@ -233,15 +233,15 @@ function gt() {
|
|
|
233
233
|
}
|
|
234
234
|
return p;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
var e, n =
|
|
236
|
+
function J(t) {
|
|
237
|
+
var e, n = q[t];
|
|
238
238
|
return p ? (e = sessionStorage.getItem(t), !e && n && (e = n, sessionStorage.setItem(t, e))) : e = n, e ? JSON.parse(e) : void 0;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function wt(t, e) {
|
|
241
241
|
var n = JSON.stringify(e);
|
|
242
|
-
p && sessionStorage.setItem(t, n),
|
|
242
|
+
p && sessionStorage.setItem(t, n), q[t] = n;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function F({ method: t, url: e, data: n, json: r = !0 }) {
|
|
245
245
|
return new Promise(function(i, a) {
|
|
246
246
|
var o = new XMLHttpRequest();
|
|
247
247
|
o.open(t, e), o.withCredentials = !0, r && (o.setRequestHeader("Accept", "application/json"), o.setRequestHeader("Content-Type", "application/json")), o.onload = function() {
|
|
@@ -257,12 +257,12 @@ function G({ method: t, url: e, data: n, json: r = !0 }) {
|
|
|
257
257
|
}, n ? o.send(n) : o.send();
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function vt(t) {
|
|
261
261
|
return "?" + Object.keys(t).map(function(e) {
|
|
262
262
|
return e + "=" + encodeURIComponent(t[e]);
|
|
263
263
|
}).join("&");
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function gt(n) {
|
|
266
266
|
return d(this, arguments, function* ({ url: t, data: e }) {
|
|
267
267
|
if (window && window.navigator && typeof window.navigator.sendBeacon == "function" && typeof window.Blob == "function")
|
|
268
268
|
try {
|
|
@@ -276,25 +276,25 @@ function bt(n) {
|
|
|
276
276
|
return !1;
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function pt(r) {
|
|
280
280
|
return d(this, arguments, function* ({ url: t, params: e = null, json: n = !0 }) {
|
|
281
281
|
var i = t;
|
|
282
|
-
return e && (i = i +
|
|
282
|
+
return e && (i = i + vt(e)), yield F({ method: "GET", url: i, json: n });
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function O(i) {
|
|
286
286
|
return d(this, arguments, function* ({ url: t, data: e, json: n = !0, beacon: r = !1 }) {
|
|
287
287
|
var a = e;
|
|
288
288
|
if (n && (a = JSON.stringify(a)), r) {
|
|
289
|
-
var o = yield
|
|
289
|
+
var o = yield gt({ url: t, data: e });
|
|
290
290
|
if (o)
|
|
291
291
|
return;
|
|
292
292
|
g("Beacon failed");
|
|
293
293
|
}
|
|
294
|
-
return yield
|
|
294
|
+
return yield F({ method: "POST", url: t, data: a, json: n });
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
|
-
var
|
|
297
|
+
var D = "__zar_vid", L = "success", m = "error", bt = 30 * 1e3, ht = 10 * 1e3, A = 0, mt = 3, v = {}, R = {}, N = !1;
|
|
298
298
|
window.zarPoolData = window.zarPoolData || null;
|
|
299
299
|
window.zarPoolDLObserverDone = window.zarPoolDLObserverDone || !1;
|
|
300
300
|
window.zarPoolDataLayer = window.zarPoolDataLayer || [];
|
|
@@ -303,38 +303,38 @@ function yt() {
|
|
|
303
303
|
return Date.now().toString(36) + "." + Math.random().toString(36).substring(2);
|
|
304
304
|
}
|
|
305
305
|
function Pt(t, e, n, r) {
|
|
306
|
-
var i, a = !1, o = null, u = n(t);
|
|
307
|
-
!u || !u.id ? (i = e(),
|
|
308
|
-
var s = { id: i, t:
|
|
306
|
+
var i, a = !1, o, c = null, u = n(t);
|
|
307
|
+
!u || !u.id ? (i = e(), c = document.referrer, o = Date.now(), a = !0, g("new ID for", t, "-", i)) : (i = u.id, c = u.origReferrer, o = u.t);
|
|
308
|
+
var s = { id: i, t: o, origReferrer: c, isNew: a };
|
|
309
309
|
return r(t, s), s;
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function B() {
|
|
312
312
|
var t = Pt(
|
|
313
|
-
|
|
313
|
+
D,
|
|
314
314
|
yt,
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
J,
|
|
316
|
+
wt
|
|
317
317
|
);
|
|
318
318
|
return { vid: t };
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function G() {
|
|
321
321
|
return window.location.protocol + "://" + window.location.host + "/api/v2";
|
|
322
322
|
}
|
|
323
323
|
function V(t) {
|
|
324
|
-
return
|
|
324
|
+
return J(t);
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function $(t) {
|
|
327
327
|
var e = V(t);
|
|
328
328
|
return e ? e.id : null;
|
|
329
329
|
}
|
|
330
330
|
function S() {
|
|
331
331
|
return {
|
|
332
|
-
vid: V(
|
|
332
|
+
vid: V(D)
|
|
333
333
|
};
|
|
334
334
|
}
|
|
335
335
|
function St() {
|
|
336
336
|
return {
|
|
337
|
-
vid:
|
|
337
|
+
vid: $(D)
|
|
338
338
|
};
|
|
339
339
|
}
|
|
340
340
|
function E({ elem: t }) {
|
|
@@ -343,10 +343,10 @@ function E({ elem: t }) {
|
|
|
343
343
|
"g"
|
|
344
344
|
);
|
|
345
345
|
t.href && t.href.startsWith("tel:") && (r = t.href);
|
|
346
|
-
var a = t.innerText, o = t.innerHTML,
|
|
347
|
-
return
|
|
346
|
+
var a = t.innerText, o = t.innerHTML, c = i.exec(a);
|
|
347
|
+
return c && (e = c[0].trim(), n = e.replace("+", "").replace(/-/g, "").replace(/ /g, "").replace("(", "").replace(")", "").replace(/^1/, "")), { text: a, html: o, numberText: e, href: r, number: n };
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function z({ elems: t, number: e, force: n = !1 }) {
|
|
350
350
|
var r, i = e;
|
|
351
351
|
e.startsWith("+1") || (i = "+1" + e);
|
|
352
352
|
for (var a = 0; a < t.length; a++) {
|
|
@@ -364,13 +364,13 @@ function _({ elems: t, number: e, force: n = !1 }) {
|
|
|
364
364
|
o.number
|
|
365
365
|
) : r = o, g("overlaying", i, "on", t[a]), b.has(t[a]) || b.set(t[a], o), o.href && (t[a].href = "tel:" + i), o.numberText)
|
|
366
366
|
if (t[a].innerHTML = "", o.text) {
|
|
367
|
-
var
|
|
368
|
-
if (o.numberText.indexOf("-") > -1 && (
|
|
369
|
-
var
|
|
370
|
-
t[a].innerHTML =
|
|
367
|
+
var c = i;
|
|
368
|
+
if (o.numberText.indexOf("-") > -1 && (c = i.slice(2, 5) + "-" + i.slice(5, 8) + "-" + i.slice(8, 12)), o.html.indexOf("<img") > -1) {
|
|
369
|
+
var u = o.html.replace(o.numberText, c);
|
|
370
|
+
t[a].innerHTML = u;
|
|
371
371
|
} else {
|
|
372
|
-
var
|
|
373
|
-
t[a].appendChild(document.createTextNode(
|
|
372
|
+
var s = o.text.replace(o.numberText, c);
|
|
373
|
+
t[a].appendChild(document.createTextNode(s));
|
|
374
374
|
}
|
|
375
375
|
} else
|
|
376
376
|
t[a].appendChild(document.createTextNode(i));
|
|
@@ -378,7 +378,7 @@ function _({ elems: t, number: e, force: n = !1 }) {
|
|
|
378
378
|
g("no number text found:", t[a]);
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function _({ elems: t }) {
|
|
382
382
|
for (var e = 0; e < t.length; e++)
|
|
383
383
|
if (b.has(t[e])) {
|
|
384
384
|
var n = t[e].innerHTML, r = b.get(t[e]);
|
|
@@ -388,14 +388,14 @@ function O({ elems: t }) {
|
|
|
388
388
|
} else
|
|
389
389
|
g("element not in map:", t[e]);
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
clearInterval(
|
|
391
|
+
function H(t) {
|
|
392
|
+
clearInterval(v[t]), delete v[t];
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
for (var t in
|
|
396
|
-
|
|
394
|
+
function W() {
|
|
395
|
+
for (var t in v)
|
|
396
|
+
H(t);
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function Q(i) {
|
|
399
399
|
return d(this, arguments, function* ({
|
|
400
400
|
poolId: t,
|
|
401
401
|
apiUrl: e,
|
|
@@ -409,11 +409,11 @@ function K(i) {
|
|
|
409
409
|
properties: {
|
|
410
410
|
zar: S()
|
|
411
411
|
}
|
|
412
|
-
}, o = yield
|
|
412
|
+
}, o = yield O({ url: `${e}/number_pool`, data: a });
|
|
413
413
|
return o;
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function x() {
|
|
417
417
|
return window.zarPoolData && window.zarPoolData.status === L && window.zarPoolData.number;
|
|
418
418
|
}
|
|
419
419
|
function y() {
|
|
@@ -433,7 +433,7 @@ function T(i) {
|
|
|
433
433
|
number: n,
|
|
434
434
|
context: r
|
|
435
435
|
}) {
|
|
436
|
-
if (!
|
|
436
|
+
if (!x()) {
|
|
437
437
|
l("no valid pool data, not updating context");
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
@@ -444,7 +444,7 @@ function T(i) {
|
|
|
444
444
|
properties: {
|
|
445
445
|
zar: S()
|
|
446
446
|
}
|
|
447
|
-
}, o = yield
|
|
447
|
+
}, o = yield O({ url: `${t}/update_number`, data: a });
|
|
448
448
|
return o;
|
|
449
449
|
});
|
|
450
450
|
}
|
|
@@ -453,55 +453,55 @@ function It(r) {
|
|
|
453
453
|
var i = {
|
|
454
454
|
key: e,
|
|
455
455
|
with_contexts: n
|
|
456
|
-
}, a = yield
|
|
456
|
+
}, a = yield pt({
|
|
457
457
|
url: `${t}/number_pool_stats`,
|
|
458
458
|
params: i
|
|
459
459
|
});
|
|
460
460
|
return a;
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
|
-
function
|
|
463
|
+
function C() {
|
|
464
464
|
return d(this, arguments, function* ({
|
|
465
465
|
overlayElements: t,
|
|
466
|
-
apiUrl: e =
|
|
466
|
+
apiUrl: e = G(),
|
|
467
467
|
contextCallback: n = null,
|
|
468
|
-
|
|
469
|
-
|
|
468
|
+
initCallback: r = null,
|
|
469
|
+
checkLastRenewal: i = !0
|
|
470
470
|
} = {}) {
|
|
471
471
|
if (N)
|
|
472
472
|
return { status: m, msg: "stopped" };
|
|
473
473
|
const a = window.zarPoolData.pool_id, o = window.zarPoolData.number;
|
|
474
|
-
var
|
|
475
|
-
if (
|
|
474
|
+
var c = Date.now(), u = R[a];
|
|
475
|
+
if (i && u && c - u < ht)
|
|
476
476
|
return { status: L };
|
|
477
|
-
R[a] =
|
|
478
|
-
var
|
|
479
|
-
n && (
|
|
477
|
+
R[a] = c;
|
|
478
|
+
var s = y() || {};
|
|
479
|
+
n && (s = n(s) || {});
|
|
480
480
|
try {
|
|
481
|
-
var f = yield
|
|
482
|
-
} catch (
|
|
483
|
-
var
|
|
484
|
-
return l(
|
|
481
|
+
var f = yield Q({ poolId: a, apiUrl: e, number: o, context: s });
|
|
482
|
+
} catch (X) {
|
|
483
|
+
var w = "error getting number: " + JSON.stringify(X);
|
|
484
|
+
return l(w), A++, A >= mt && (l("max failures, stopping pool"), N = !0, W(), t && _({ elems: t })), { status: m, msg: w };
|
|
485
485
|
}
|
|
486
486
|
if (f.status === L && f.number) {
|
|
487
|
-
var
|
|
487
|
+
var h = !1;
|
|
488
488
|
f.number !== window.zarPoolData.number && (l(
|
|
489
489
|
"number changed from " + window.zarPoolData.number + " to " + f.number
|
|
490
|
-
), window.zarPoolData.number = f.number,
|
|
490
|
+
), window.zarPoolData.number = f.number, h = !0), t && z({
|
|
491
491
|
elems: t,
|
|
492
492
|
number: f.number,
|
|
493
|
-
force:
|
|
493
|
+
force: h
|
|
494
494
|
});
|
|
495
495
|
} else
|
|
496
|
-
t &&
|
|
497
|
-
return f;
|
|
496
|
+
t && _({ elems: t }), v[a] && (clearInterval(v[a]), delete v[a]);
|
|
497
|
+
return r && (f.renew = !0, r(f)), f;
|
|
498
498
|
});
|
|
499
499
|
}
|
|
500
|
-
function
|
|
501
|
-
return
|
|
500
|
+
function k(t) {
|
|
501
|
+
return ft(t) ? t() : t;
|
|
502
502
|
}
|
|
503
|
-
function
|
|
504
|
-
if (!window.zarPoolDLObserverDone &&
|
|
503
|
+
function Ot(t) {
|
|
504
|
+
if (!window.zarPoolDLObserverDone && x()) {
|
|
505
505
|
var e = window.zarPoolDataLayer.push;
|
|
506
506
|
window.zarPoolDataLayer.push = function(...r) {
|
|
507
507
|
var i = e.apply(this, r), a = y();
|
|
@@ -525,47 +525,60 @@ function M() {
|
|
|
525
525
|
return d(this, arguments, function* ({ poolData: t, poolConfig: e, apiUrl: n } = {}) {
|
|
526
526
|
var r;
|
|
527
527
|
if (N = !1, !e || !e.poolId || !e.overlayQuerySelector || !n)
|
|
528
|
-
return r = "missing pool config: " + JSON.stringify(e), l(r), e.initCallback && e.initCallback({ status: m, msg: r }),
|
|
529
|
-
var i =
|
|
528
|
+
return r = "missing pool config: " + JSON.stringify(e), l(r), e.initCallback && e.initCallback({ status: m, msg: r }), v;
|
|
529
|
+
var i = k(e.poolId);
|
|
530
530
|
if (!i)
|
|
531
|
-
return r = "no pool ID", l(r), e.initCallback && e.initCallback({ status: m, msg: r }),
|
|
531
|
+
return r = "no pool ID", l(r), e.initCallback && e.initCallback({ status: m, msg: r }), v;
|
|
532
532
|
if (!t) {
|
|
533
533
|
var a = y() || {};
|
|
534
534
|
e.contextCallback && (a = e.contextCallback(a) || {});
|
|
535
535
|
try {
|
|
536
|
-
t = yield
|
|
536
|
+
t = yield Q({ poolId: i, apiUrl: n, number: null, context: a });
|
|
537
537
|
} catch (o) {
|
|
538
|
-
return r = "error getting number on init: " + JSON.stringify(o), l(r), e.initCallback && e.initCallback({ status: m, msg: r }),
|
|
538
|
+
return r = "error getting number on init: " + JSON.stringify(o), l(r), e.initCallback && e.initCallback({ status: m, msg: r }), v;
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
|
-
if (window.zarPoolData = t,
|
|
541
|
+
if (window.zarPoolData = t, x()) {
|
|
542
542
|
R[i] = Date.now();
|
|
543
543
|
try {
|
|
544
|
-
|
|
544
|
+
Ot(n);
|
|
545
545
|
} catch (o) {
|
|
546
546
|
l("data layer error: " + JSON.stringify(o));
|
|
547
547
|
}
|
|
548
|
-
|
|
548
|
+
lt(function() {
|
|
549
549
|
var o = document.querySelectorAll(
|
|
550
550
|
e.overlayQuerySelector
|
|
551
551
|
);
|
|
552
552
|
if (!o) {
|
|
553
|
-
var
|
|
554
|
-
l(
|
|
553
|
+
var c = "No elems found for:" + e.overlayQuerySelector;
|
|
554
|
+
l(c), e.initCallback && e.initCallback({ status: m, msg: c });
|
|
555
555
|
return;
|
|
556
556
|
}
|
|
557
|
-
|
|
558
|
-
var
|
|
557
|
+
z({ elems: o, number: t.number });
|
|
558
|
+
var u = e.renewalInterval || bt, s = setInterval(function() {
|
|
559
|
+
try {
|
|
560
|
+
C({
|
|
561
|
+
overlayElements: o,
|
|
562
|
+
apiUrl: n,
|
|
563
|
+
contextCallback: e.contextCallback,
|
|
564
|
+
initCallback: e.initCallback
|
|
565
|
+
});
|
|
566
|
+
} catch (h) {
|
|
567
|
+
var w = "error on interval: " + JSON.stringify(h);
|
|
568
|
+
l(w);
|
|
569
|
+
}
|
|
570
|
+
}, u);
|
|
571
|
+
v[t.pool_id] = s, e.initCallback && e.initCallback(t);
|
|
572
|
+
var f = function(w = {}) {
|
|
559
573
|
try {
|
|
560
|
-
if (!
|
|
574
|
+
if (!x())
|
|
561
575
|
return;
|
|
562
|
-
(
|
|
576
|
+
(w.type === "vc" && document.visibilityState === "visible" || w.type === "ps" && w.persisted === !0) && C({
|
|
563
577
|
overlayElements: o,
|
|
564
578
|
apiUrl: n,
|
|
565
579
|
contextCallback: e.contextCallback,
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
}));
|
|
580
|
+
initCallback: e.initCallback
|
|
581
|
+
});
|
|
569
582
|
} catch (h) {
|
|
570
583
|
l("error on renew: " + JSON.stringify(h));
|
|
571
584
|
}
|
|
@@ -573,36 +586,23 @@ function M() {
|
|
|
573
586
|
document.addEventListener(
|
|
574
587
|
"visibilitychange",
|
|
575
588
|
function() {
|
|
576
|
-
|
|
589
|
+
f({ type: "vc" });
|
|
577
590
|
},
|
|
578
591
|
{ passive: !0 }
|
|
579
592
|
), window.addEventListener(
|
|
580
593
|
"pageshow",
|
|
581
|
-
function(
|
|
582
|
-
|
|
594
|
+
function(w) {
|
|
595
|
+
f({ type: "ps", persisted: w && w.persisted });
|
|
583
596
|
},
|
|
584
597
|
{ passive: !0 }
|
|
585
598
|
);
|
|
586
|
-
var v = setInterval(function() {
|
|
587
|
-
try {
|
|
588
|
-
U({
|
|
589
|
-
overlayElements: o,
|
|
590
|
-
apiUrl: n,
|
|
591
|
-
contextCallback: e.contextCallback
|
|
592
|
-
});
|
|
593
|
-
} catch (h) {
|
|
594
|
-
var f = "error on interval: " + JSON.stringify(h);
|
|
595
|
-
l(f);
|
|
596
|
-
}
|
|
597
|
-
}, s);
|
|
598
|
-
w[t.pool_id] = v, e.initCallback && e.initCallback(t);
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
|
-
return
|
|
601
|
+
return v;
|
|
602
602
|
});
|
|
603
603
|
}
|
|
604
|
-
function
|
|
605
|
-
return
|
|
604
|
+
function _t({ apiUrl: t, poolConfig: e }) {
|
|
605
|
+
return B(), {
|
|
606
606
|
name: "zar",
|
|
607
607
|
config: { apiUrl: t, poolConfig: e },
|
|
608
608
|
initialize: function({ config: n }) {
|
|
@@ -611,33 +611,33 @@ function Ot({ apiUrl: t, poolConfig: e }) {
|
|
|
611
611
|
return !0;
|
|
612
612
|
},
|
|
613
613
|
pageStart: function({ payload: n, config: r, instance: i }) {
|
|
614
|
-
n.properties.zar = S(), n.properties.referrer = document.referrer, n.properties.is_bot =
|
|
614
|
+
n.properties.zar = S(), n.properties.referrer = document.referrer, n.properties.is_bot = j();
|
|
615
615
|
try {
|
|
616
616
|
var a = r.poolConfig;
|
|
617
617
|
if (a && a.poolId) {
|
|
618
|
-
n.properties.pool_id =
|
|
618
|
+
n.properties.pool_id = k(a.poolId);
|
|
619
619
|
var o = y() || {};
|
|
620
620
|
a.contextCallback && (n.properties.pool_context = a.contextCallback(o) || {});
|
|
621
621
|
}
|
|
622
|
-
} catch (
|
|
623
|
-
l("error getting pool id: " + JSON.stringify(
|
|
622
|
+
} catch (c) {
|
|
623
|
+
l("error getting pool id: " + JSON.stringify(c));
|
|
624
624
|
}
|
|
625
625
|
return n;
|
|
626
626
|
},
|
|
627
627
|
page: function(o) {
|
|
628
628
|
return d(this, arguments, function* ({ payload: n, options: r, instance: i, config: a }) {
|
|
629
629
|
g("page", n, r, a);
|
|
630
|
-
for (var
|
|
630
|
+
for (var c = 0, u = 3, s; c < u; )
|
|
631
631
|
try {
|
|
632
|
-
|
|
632
|
+
s = yield O({ url: `${a.apiUrl}/page`, data: n });
|
|
633
633
|
break;
|
|
634
|
-
} catch (
|
|
635
|
-
if (
|
|
636
|
-
throw l("error posting page: " + JSON.stringify(
|
|
637
|
-
yield new Promise((
|
|
634
|
+
} catch (f) {
|
|
635
|
+
if (c++, c >= u)
|
|
636
|
+
throw l("error posting page: " + JSON.stringify(f)), f;
|
|
637
|
+
yield new Promise((w) => setTimeout(w, 1e3));
|
|
638
638
|
}
|
|
639
|
-
|
|
640
|
-
poolData:
|
|
639
|
+
s && s.pool_data && M({
|
|
640
|
+
poolData: s.pool_data,
|
|
641
641
|
poolConfig: a.poolConfig,
|
|
642
642
|
apiUrl: a.apiUrl
|
|
643
643
|
});
|
|
@@ -647,7 +647,7 @@ function Ot({ apiUrl: t, poolConfig: e }) {
|
|
|
647
647
|
return n.properties.zar = S(), n.properties.url = window.location.href, n.properties.referrer = document.referrer, n;
|
|
648
648
|
},
|
|
649
649
|
track: function({ payload: n, options: r, instance: i, config: a }) {
|
|
650
|
-
g("track", n),
|
|
650
|
+
g("track", n), O({ url: `${a.apiUrl}/track`, data: n, beacon: !0 });
|
|
651
651
|
},
|
|
652
652
|
methods: {
|
|
653
653
|
apiUrl() {
|
|
@@ -657,7 +657,7 @@ function Ot({ apiUrl: t, poolConfig: e }) {
|
|
|
657
657
|
return e;
|
|
658
658
|
},
|
|
659
659
|
initIDs() {
|
|
660
|
-
return
|
|
660
|
+
return B();
|
|
661
661
|
},
|
|
662
662
|
getIDs() {
|
|
663
663
|
return St();
|
|
@@ -666,10 +666,10 @@ function Ot({ apiUrl: t, poolConfig: e }) {
|
|
|
666
666
|
return S();
|
|
667
667
|
},
|
|
668
668
|
getVID() {
|
|
669
|
-
return
|
|
669
|
+
return $(D);
|
|
670
670
|
},
|
|
671
671
|
isBot() {
|
|
672
|
-
return
|
|
672
|
+
return j();
|
|
673
673
|
},
|
|
674
674
|
initTrackingPool({ poolConfig: n }) {
|
|
675
675
|
var r = this.instance.plugins.zar;
|
|
@@ -683,19 +683,19 @@ function Ot({ apiUrl: t, poolConfig: e }) {
|
|
|
683
683
|
var i = this.instance.plugins.zar, a = i.poolConfig();
|
|
684
684
|
return T({
|
|
685
685
|
apiUrl: this.instance.plugins.zar.apiUrl(),
|
|
686
|
-
poolId:
|
|
686
|
+
poolId: k(a.poolId),
|
|
687
687
|
number: n,
|
|
688
688
|
context: r
|
|
689
689
|
});
|
|
690
690
|
},
|
|
691
691
|
getPoolIntervals() {
|
|
692
|
-
return
|
|
692
|
+
return v;
|
|
693
693
|
},
|
|
694
694
|
clearPoolInterval({ poolId: n }) {
|
|
695
|
-
|
|
695
|
+
H(n);
|
|
696
696
|
},
|
|
697
697
|
clearPoolIntervals() {
|
|
698
|
-
|
|
698
|
+
W();
|
|
699
699
|
},
|
|
700
700
|
extractPhoneNumbers({ elems: n }) {
|
|
701
701
|
for (var r = [], i = 0; i < n.length; i++) {
|
|
@@ -705,10 +705,10 @@ function Ot({ apiUrl: t, poolConfig: e }) {
|
|
|
705
705
|
return r;
|
|
706
706
|
},
|
|
707
707
|
overlayPhoneNumber({ overlayElements: n, number: r }) {
|
|
708
|
-
|
|
708
|
+
z({ elems: n, number: r });
|
|
709
709
|
},
|
|
710
710
|
revertOverlayNumbers({ overlayElements: n }) {
|
|
711
|
-
|
|
711
|
+
_({ elems: n });
|
|
712
712
|
},
|
|
713
713
|
getPoolStats({ key: n = null, with_contexts: r = !1 }) {
|
|
714
714
|
return It({
|
|
@@ -720,28 +720,28 @@ function Ot({ apiUrl: t, poolConfig: e }) {
|
|
|
720
720
|
}
|
|
721
721
|
};
|
|
722
722
|
}
|
|
723
|
-
function
|
|
723
|
+
function kt({
|
|
724
724
|
app: t,
|
|
725
725
|
ga4Config: e = null,
|
|
726
726
|
facebookConfig: n = null,
|
|
727
727
|
apiUrl: r = null,
|
|
728
728
|
poolConfig: i = null
|
|
729
729
|
}) {
|
|
730
|
-
r || (r =
|
|
731
|
-
var a = [
|
|
732
|
-
return e && a.push(
|
|
730
|
+
r || (r = G());
|
|
731
|
+
var a = [_t({ apiUrl: r, poolConfig: i })];
|
|
732
|
+
return e && a.push(ut(e)), n && a.push(it(n)), K({ app: t, plugins: a });
|
|
733
733
|
}
|
|
734
|
-
const
|
|
734
|
+
const Dt = {
|
|
735
735
|
extractPhoneNumber: E,
|
|
736
|
-
overlayPhoneNumber:
|
|
737
|
-
revertOverlayNumbers:
|
|
736
|
+
overlayPhoneNumber: z,
|
|
737
|
+
revertOverlayNumbers: _,
|
|
738
738
|
drainPoolDataLayer: y,
|
|
739
|
-
getPoolId:
|
|
739
|
+
getPoolId: k
|
|
740
740
|
};
|
|
741
741
|
export {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
742
|
+
K as Analytics,
|
|
743
|
+
Dt as __test__,
|
|
744
|
+
kt as init,
|
|
745
|
+
_t as zar
|
|
746
746
|
};
|
|
747
747
|
//# sourceMappingURL=zar.es.js.map
|