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 CHANGED
@@ -1,30 +1,30 @@
1
1
  var d = (t, e, n) => new Promise((r, i) => {
2
- var a = (s) => {
2
+ var a = (u) => {
3
3
  try {
4
- u(n.next(s));
5
- } catch (c) {
6
- i(c);
4
+ c(n.next(u));
5
+ } catch (s) {
6
+ i(s);
7
7
  }
8
- }, o = (s) => {
8
+ }, o = (u) => {
9
9
  try {
10
- u(n.throw(s));
11
- } catch (c) {
12
- i(c);
10
+ c(n.throw(u));
11
+ } catch (s) {
12
+ i(s);
13
13
  }
14
- }, u = (s) => s.done ? r(s.value) : Promise.resolve(s.value).then(a, o);
15
- u((n = n.apply(t, e)).next());
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 Z({ app: t, plugins: e = [] } = {}) {
17
+ function K({ app: t, plugins: e = [] } = {}) {
18
18
  const n = {
19
19
  app: t,
20
20
  plugins: {},
21
- page: (r = {}) => rt(n, r),
22
- track: (r, i = {}, a) => nt(
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 at(n, ...r);
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 tt = /#.*$/;
46
- function et() {
47
- return typeof window == "undefined" ? "" : window.location.href.replace(tt, "");
45
+ const Y = /#.*$/;
46
+ function Z() {
47
+ return typeof window == "undefined" ? "" : window.location.href.replace(Y, "");
48
48
  }
49
- function q(t = {}) {
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 = et(), o = {
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 rt(n) {
60
+ function tt(n) {
61
61
  return d(this, arguments, function* (t, e = {}) {
62
- e.type || (e.type = "page"), e.properties = q(e.properties || {}), Object.values(t.plugins).forEach((r) => {
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 nt(n) {
79
+ function et(n) {
80
80
  return d(this, arguments, function* (t, e = {}) {
81
81
  e.type || (e.type = "track");
82
- const r = q(), i = e.properties || {};
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, u = (s) => o && o[s.name] === !1;
85
- Object.values(t.plugins).forEach((s) => {
86
- if (!u(s) && typeof s.trackStart == "function")
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 c = s.trackStart({
88
+ const s = u.trackStart({
89
89
  payload: e,
90
90
  options: a,
91
- config: s.config,
91
+ config: u.config,
92
92
  instance: t
93
93
  });
94
- c && (e = c);
95
- } catch (c) {
94
+ s && (e = s);
95
+ } catch (s) {
96
96
  }
97
97
  });
98
- for (const s of Object.values(t.plugins))
99
- if (!u(s) && typeof s.track == "function")
98
+ for (const u of Object.values(t.plugins))
99
+ if (!c(u) && typeof u.track == "function")
100
100
  try {
101
- yield s.track({ payload: e, options: a, instance: t, config: s.config });
102
- } catch (c) {
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 at(t, ...e) {
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 it(t, e, n, r, i, a, o) {
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 ot({ trackingId: t }) {
123
- it(
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 ut(t = {}) {
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
- ot({ trackingId: e.trackingId });
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 st({ trackingId: t, configParams: e = {}, setParams: n = {} }) {
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 ct(t = {}) {
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 u = e.customDimensions[o];
174
- r[u.name] = u.callback(n, e), a["dimension" + (o + 1)] = u.name;
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
- st({ trackingId: e.trackingId, configParams: r, setParams: i });
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 ft = new URLSearchParams(window.location.search), lt = ft.get("zdbg"), J = {};
192
+ var ct = new URLSearchParams(window.location.search), st = ct.get("zdbg"), q = {};
193
193
  const I = "undefined";
194
194
  function g() {
195
- lt == 1 && console.debug(...arguments);
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 dt(t) {
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 B() {
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 wt(t) {
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 = gt();
225
- function gt() {
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 F(t) {
237
- var e, n = J[t];
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 vt(t, e) {
240
+ function wt(t, e) {
241
241
  var n = JSON.stringify(e);
242
- p && sessionStorage.setItem(t, n), J[t] = n;
242
+ p && sessionStorage.setItem(t, n), q[t] = n;
243
243
  }
244
- function G({ method: t, url: e, data: n, json: r = !0 }) {
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 pt(t) {
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 bt(n) {
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 ht(r) {
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 + pt(e)), yield G({ method: "GET", url: i, json: n });
282
+ return e && (i = i + vt(e)), yield F({ method: "GET", url: i, json: n });
283
283
  });
284
284
  }
285
- function x(i) {
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 bt({ url: t, data: e });
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 G({ method: "POST", url: t, data: a, json: n });
294
+ return yield F({ method: "POST", url: t, data: a, json: n });
295
295
  });
296
296
  }
297
- var k = "__zar_vid", L = "success", m = "error", $ = 30 * 1e3, C = 0, mt = 3, w = {}, R = {}, N = !1;
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(), o = document.referrer, a = !0, g("new ID for", t, "-", i)) : (i = u.id, o = u.origReferrer);
308
- var s = { id: i, t: Date.now(), origReferrer: o, isNew: a };
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 A() {
311
+ function B() {
312
312
  var t = Pt(
313
- k,
313
+ D,
314
314
  yt,
315
- F,
316
- vt
315
+ J,
316
+ wt
317
317
  );
318
318
  return { vid: t };
319
319
  }
320
- function H() {
320
+ function G() {
321
321
  return window.location.protocol + "://" + window.location.host + "/api/v2";
322
322
  }
323
323
  function V(t) {
324
- return F(t);
324
+ return J(t);
325
325
  }
326
- function W(t) {
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(k)
332
+ vid: V(D)
333
333
  };
334
334
  }
335
335
  function St() {
336
336
  return {
337
- vid: W(k)
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, u = i.exec(a);
347
- return u && (e = u[0].trim(), n = e.replace("+", "").replace(/-/g, "").replace(/ /g, "").replace("(", "").replace(")", "").replace(/^1/, "")), { text: a, html: o, numberText: e, href: r, number: n };
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 _({ elems: t, number: e, force: n = !1 }) {
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 u = i;
368
- if (o.numberText.indexOf("-") > -1 && (u = i.slice(2, 5) + "-" + i.slice(5, 8) + "-" + i.slice(8, 12)), o.html.indexOf("<img") > -1) {
369
- var s = o.html.replace(o.numberText, u);
370
- t[a].innerHTML = s;
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 c = o.text.replace(o.numberText, u);
373
- t[a].appendChild(document.createTextNode(c));
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 O({ elems: t }) {
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 Q(t) {
392
- clearInterval(w[t]), delete w[t];
391
+ function H(t) {
392
+ clearInterval(v[t]), delete v[t];
393
393
  }
394
- function X() {
395
- for (var t in w)
396
- Q(t);
394
+ function W() {
395
+ for (var t in v)
396
+ H(t);
397
397
  }
398
- function K(i) {
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 x({ url: `${e}/number_pool`, data: a });
412
+ }, o = yield O({ url: `${e}/number_pool`, data: a });
413
413
  return o;
414
414
  });
415
415
  }
416
- function D() {
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 (!D()) {
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 x({ url: `${t}/update_number`, data: a });
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 ht({
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 U() {
463
+ function C() {
464
464
  return d(this, arguments, function* ({
465
465
  overlayElements: t,
466
- apiUrl: e = H(),
466
+ apiUrl: e = G(),
467
467
  contextCallback: n = null,
468
- checkLastRenewal: r = !1,
469
- renewalInterval: i = $
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 u = Date.now(), s = R[a], c = 3 * 1e3;
475
- if (r && s && u - s < i + c)
474
+ var c = Date.now(), u = R[a];
475
+ if (i && u && c - u < ht)
476
476
  return { status: L };
477
- R[a] = u;
478
- var v = y() || {};
479
- n && (v = n(v) || {});
477
+ R[a] = c;
478
+ var s = y() || {};
479
+ n && (s = n(s) || {});
480
480
  try {
481
- var f = yield K({ poolId: a, apiUrl: e, number: o, context: v });
482
- } catch (Y) {
483
- var h = "error getting number: " + JSON.stringify(Y);
484
- return l(h), C++, C >= mt && (l("max failures, stopping pool"), N = !0, X(), t && O({ elems: t })), { status: m, msg: h };
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 j = !1;
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, j = !0), t && _({
490
+ ), window.zarPoolData.number = f.number, h = !0), t && z({
491
491
  elems: t,
492
492
  number: f.number,
493
- force: j
493
+ force: h
494
494
  });
495
495
  } else
496
- t && O({ elems: t }), w[a] && (clearInterval(w[a]), delete w[a]);
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 z(t) {
501
- return dt(t) ? t() : t;
500
+ function k(t) {
501
+ return ft(t) ? t() : t;
502
502
  }
503
- function xt(t) {
504
- if (!window.zarPoolDLObserverDone && D()) {
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 }), w;
529
- var i = z(e.poolId);
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 }), w;
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 K({ poolId: i, apiUrl: n, number: null, context: a });
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 }), w;
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, D()) {
541
+ if (window.zarPoolData = t, x()) {
542
542
  R[i] = Date.now();
543
543
  try {
544
- xt(n);
544
+ Ot(n);
545
545
  } catch (o) {
546
546
  l("data layer error: " + JSON.stringify(o));
547
547
  }
548
- wt(function() {
548
+ lt(function() {
549
549
  var o = document.querySelectorAll(
550
550
  e.overlayQuerySelector
551
551
  );
552
552
  if (!o) {
553
- var u = "No elems found for:" + e.overlayQuerySelector;
554
- l(u), e.initCallback && e.initCallback({ status: m, msg: u });
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
- _({ elems: o, number: t.number });
558
- var s = e.renewalInterval || $, c = function(f = {}) {
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 (!D())
574
+ if (!x())
561
575
  return;
562
- (f.type === "vc" && document.visibilityState === "visible" || f.type === "ps" && f.persisted === !0) && (console.log("renew on", f.type), U({
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
- checkLastRenewal: !0,
567
- renewalInterval: s
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
- c({ type: "vc" });
589
+ f({ type: "vc" });
577
590
  },
578
591
  { passive: !0 }
579
592
  ), window.addEventListener(
580
593
  "pageshow",
581
- function(f) {
582
- c({ type: "ps", persisted: f && f.persisted });
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 w;
601
+ return v;
602
602
  });
603
603
  }
604
- function Ot({ apiUrl: t, poolConfig: e }) {
605
- return A(), {
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 = B();
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 = z(a.poolId);
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 (u) {
623
- l("error getting pool id: " + JSON.stringify(u));
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 u = 0, s = 3, c; u < s; )
630
+ for (var c = 0, u = 3, s; c < u; )
631
631
  try {
632
- c = yield x({ url: `${a.apiUrl}/page`, data: n });
632
+ s = yield O({ url: `${a.apiUrl}/page`, data: n });
633
633
  break;
634
- } catch (v) {
635
- if (u++, u >= s)
636
- throw l("error posting page: " + JSON.stringify(v)), v;
637
- yield new Promise((f) => setTimeout(f, 1e3));
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
- c && c.pool_data && M({
640
- poolData: c.pool_data,
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), x({ url: `${a.apiUrl}/track`, data: n, beacon: !0 });
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 A();
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 W(k);
669
+ return $(D);
670
670
  },
671
671
  isBot() {
672
- return B();
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: z(a.poolId),
686
+ poolId: k(a.poolId),
687
687
  number: n,
688
688
  context: r
689
689
  });
690
690
  },
691
691
  getPoolIntervals() {
692
- return w;
692
+ return v;
693
693
  },
694
694
  clearPoolInterval({ poolId: n }) {
695
- Q(n);
695
+ H(n);
696
696
  },
697
697
  clearPoolIntervals() {
698
- X();
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
- _({ elems: n, number: r });
708
+ z({ elems: n, number: r });
709
709
  },
710
710
  revertOverlayNumbers({ overlayElements: n }) {
711
- O({ elems: n });
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 zt({
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 = H());
731
- var a = [Ot({ apiUrl: r, poolConfig: i })];
732
- return e && a.push(ct(e)), n && a.push(ut(n)), Z({ app: t, plugins: a });
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 kt = {
734
+ const Dt = {
735
735
  extractPhoneNumber: E,
736
- overlayPhoneNumber: _,
737
- revertOverlayNumbers: O,
736
+ overlayPhoneNumber: z,
737
+ revertOverlayNumbers: _,
738
738
  drainPoolDataLayer: y,
739
- getPoolId: z
739
+ getPoolId: k
740
740
  };
741
741
  export {
742
- Z as Analytics,
743
- kt as __test__,
744
- zt as init,
745
- Ot as zar
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