zar 0.5.0 → 0.5.2
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 +551 -787
- 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 +1 -1
package/dist/zar.es.js
CHANGED
|
@@ -1,983 +1,747 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
function Analytics({ app, plugins = [] } = {}) {
|
|
22
|
-
const instance = {
|
|
23
|
-
app,
|
|
1
|
+
var d = (t, e, n) => new Promise((r, i) => {
|
|
2
|
+
var a = (s) => {
|
|
3
|
+
try {
|
|
4
|
+
u(n.next(s));
|
|
5
|
+
} catch (c) {
|
|
6
|
+
i(c);
|
|
7
|
+
}
|
|
8
|
+
}, o = (s) => {
|
|
9
|
+
try {
|
|
10
|
+
u(n.throw(s));
|
|
11
|
+
} catch (c) {
|
|
12
|
+
i(c);
|
|
13
|
+
}
|
|
14
|
+
}, u = (s) => s.done ? r(s.value) : Promise.resolve(s.value).then(a, o);
|
|
15
|
+
u((n = n.apply(t, e)).next());
|
|
16
|
+
});
|
|
17
|
+
function Z({ app: t, plugins: e = [] } = {}) {
|
|
18
|
+
const n = {
|
|
19
|
+
app: t,
|
|
24
20
|
plugins: {},
|
|
25
|
-
page: (
|
|
26
|
-
track: (
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
page: (r = {}) => rt(n, r),
|
|
22
|
+
track: (r, i = {}, a) => nt(
|
|
23
|
+
n,
|
|
24
|
+
a ? { event: r, properties: i, options: a } : { event: r, properties: i }
|
|
25
|
+
),
|
|
26
|
+
reset: (...r) => d(this, null, function* () {
|
|
27
|
+
return at(n, ...r);
|
|
29
28
|
})
|
|
30
29
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
p.methods[k] = bound;
|
|
41
|
-
p[k] = bound;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
instance.plugins[p.name] = p;
|
|
46
|
-
});
|
|
47
|
-
plugins.forEach((p) => {
|
|
30
|
+
return e.forEach((r) => {
|
|
31
|
+
!r || !r.name || (r.instance = n, r.methods && Object.keys(r.methods).forEach((i) => {
|
|
32
|
+
const a = r.methods[i];
|
|
33
|
+
if (typeof a == "function") {
|
|
34
|
+
const o = a.bind(r);
|
|
35
|
+
r.methods[i] = o, r[i] = o;
|
|
36
|
+
}
|
|
37
|
+
}), n.plugins[r.name] = r);
|
|
38
|
+
}), e.forEach((r) => {
|
|
48
39
|
try {
|
|
49
|
-
|
|
50
|
-
} catch (
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const { innerWidth, innerHeight } = window;
|
|
67
|
-
const url = currentUrl();
|
|
68
|
-
const page = {
|
|
69
|
-
title,
|
|
70
|
-
url,
|
|
71
|
-
width: innerWidth,
|
|
72
|
-
height: innerHeight
|
|
40
|
+
r.initialize && r.initialize({ config: r.config, instance: n });
|
|
41
|
+
} catch (i) {
|
|
42
|
+
}
|
|
43
|
+
}), n;
|
|
44
|
+
}
|
|
45
|
+
const tt = /#.*$/;
|
|
46
|
+
function et() {
|
|
47
|
+
return typeof window == "undefined" ? "" : window.location.href.replace(tt, "");
|
|
48
|
+
}
|
|
49
|
+
function q(t = {}) {
|
|
50
|
+
if (typeof window == "undefined" || typeof document == "undefined")
|
|
51
|
+
return t;
|
|
52
|
+
const { title: e, referrer: n } = document, { innerWidth: r, innerHeight: i } = window, a = et(), o = {
|
|
53
|
+
title: e,
|
|
54
|
+
url: a,
|
|
55
|
+
width: r,
|
|
56
|
+
height: i
|
|
73
57
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return
|
|
78
|
-
}
|
|
79
|
-
|
|
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") {
|
|
58
|
+
return n && n !== "" && (o.referrer = n), Object.assign({}, o, t);
|
|
59
|
+
}
|
|
60
|
+
function rt(n) {
|
|
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) => {
|
|
63
|
+
if (typeof r.pageStart == "function")
|
|
86
64
|
try {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} catch (_) {
|
|
65
|
+
const i = r.pageStart({ payload: e, config: r.config, instance: t });
|
|
66
|
+
i && (e = i);
|
|
67
|
+
} catch (i) {
|
|
91
68
|
}
|
|
92
|
-
}
|
|
93
69
|
});
|
|
94
|
-
for (const
|
|
95
|
-
if (typeof
|
|
70
|
+
for (const r of Object.values(t.plugins))
|
|
71
|
+
if (typeof r.page == "function")
|
|
96
72
|
try {
|
|
97
|
-
yield
|
|
98
|
-
} catch (
|
|
73
|
+
yield r.page({ payload: e, options: {}, instance: t, config: r.config });
|
|
74
|
+
} catch (i) {
|
|
99
75
|
}
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
return payload;
|
|
76
|
+
return e;
|
|
103
77
|
});
|
|
104
78
|
}
|
|
105
|
-
function
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
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") {
|
|
79
|
+
function nt(n) {
|
|
80
|
+
return d(this, arguments, function* (t, e = {}) {
|
|
81
|
+
e.type || (e.type = "track");
|
|
82
|
+
const r = q(), i = e.properties || {};
|
|
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")
|
|
124
87
|
try {
|
|
125
|
-
const
|
|
126
|
-
payload,
|
|
127
|
-
options,
|
|
128
|
-
config:
|
|
129
|
-
instance
|
|
88
|
+
const c = s.trackStart({
|
|
89
|
+
payload: e,
|
|
90
|
+
options: a,
|
|
91
|
+
config: s.config,
|
|
92
|
+
instance: t
|
|
130
93
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
} catch (_) {
|
|
94
|
+
c && (e = c);
|
|
95
|
+
} catch (c) {
|
|
134
96
|
}
|
|
135
|
-
}
|
|
136
97
|
});
|
|
137
|
-
for (const
|
|
138
|
-
if (
|
|
139
|
-
continue;
|
|
140
|
-
if (typeof p.track === "function") {
|
|
98
|
+
for (const s of Object.values(t.plugins))
|
|
99
|
+
if (!u(s) && typeof s.track == "function")
|
|
141
100
|
try {
|
|
142
|
-
yield
|
|
143
|
-
} catch (
|
|
101
|
+
yield s.track({ payload: e, options: a, instance: t, config: s.config });
|
|
102
|
+
} catch (c) {
|
|
144
103
|
}
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
return payload;
|
|
104
|
+
return e;
|
|
148
105
|
});
|
|
149
106
|
}
|
|
150
|
-
function
|
|
151
|
-
return
|
|
152
|
-
for (const
|
|
153
|
-
if (typeof
|
|
107
|
+
function at(t, ...e) {
|
|
108
|
+
return d(this, null, function* () {
|
|
109
|
+
for (const n of Object.values(t.plugins))
|
|
110
|
+
if (typeof n.reset == "function")
|
|
154
111
|
try {
|
|
155
|
-
yield
|
|
156
|
-
} catch (
|
|
112
|
+
yield n.reset(...e);
|
|
113
|
+
} catch (r) {
|
|
157
114
|
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
115
|
});
|
|
161
116
|
}
|
|
162
|
-
function
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
n =
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
t.src = v;
|
|
177
|
-
s = b.getElementsByTagName(e)[0];
|
|
178
|
-
s.parentNode.insertBefore(t, s);
|
|
179
|
-
}
|
|
180
|
-
function facebookInit({ trackingId }) {
|
|
181
|
-
facebookScriptInit(window, document, "script", "https://connect.facebook.net/en_US/fbevents.js");
|
|
182
|
-
window.fbq("init", trackingId);
|
|
183
|
-
}
|
|
184
|
-
function facebook(pluginConfig = {}) {
|
|
117
|
+
function it(t, e, n, r, i, a, o) {
|
|
118
|
+
t.fbq || (i = t.fbq = function() {
|
|
119
|
+
i.callMethod ? i.callMethod.apply(i, arguments) : i.queue.push(arguments);
|
|
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
|
+
}
|
|
122
|
+
function ot({ trackingId: t }) {
|
|
123
|
+
it(
|
|
124
|
+
window,
|
|
125
|
+
document,
|
|
126
|
+
"script",
|
|
127
|
+
"https://connect.facebook.net/en_US/fbevents.js"
|
|
128
|
+
), window.fbq("init", t);
|
|
129
|
+
}
|
|
130
|
+
function ut(t = {}) {
|
|
185
131
|
return {
|
|
186
132
|
name: "facebook",
|
|
187
|
-
config:
|
|
188
|
-
initialize: function({ config, instance }) {
|
|
189
|
-
if (!
|
|
133
|
+
config: t,
|
|
134
|
+
initialize: function({ config: e, instance: n }) {
|
|
135
|
+
if (!e.trackingId)
|
|
190
136
|
throw new Error("No Facebook trackingId defined");
|
|
191
|
-
|
|
137
|
+
ot({ trackingId: e.trackingId });
|
|
192
138
|
},
|
|
193
|
-
page: function({ payload, config, instance }) {
|
|
139
|
+
page: function({ payload: e, config: n, instance: r }) {
|
|
194
140
|
window.fbq("track", "PageView");
|
|
195
141
|
},
|
|
196
|
-
track: function({ payload, config, instance }) {
|
|
197
|
-
window.fbq("trackCustom",
|
|
142
|
+
track: function({ payload: e, config: n, instance: r }) {
|
|
143
|
+
window.fbq("trackCustom", e.event, e.properties);
|
|
198
144
|
},
|
|
199
|
-
identify: function({ payload, config }) {
|
|
145
|
+
identify: function({ payload: e, config: n }) {
|
|
200
146
|
},
|
|
201
147
|
loaded: function() {
|
|
202
148
|
return !!window.fbq;
|
|
203
149
|
}
|
|
204
150
|
};
|
|
205
151
|
}
|
|
206
|
-
function
|
|
152
|
+
function P() {
|
|
207
153
|
window.dataLayer.push(arguments);
|
|
208
154
|
}
|
|
209
|
-
window.gtag =
|
|
210
|
-
function
|
|
211
|
-
var
|
|
212
|
-
if (document.getElementById(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
var script = document.createElement("script");
|
|
216
|
-
script.id = scriptId;
|
|
217
|
-
script.type = "text/javascript";
|
|
218
|
-
script.async = true;
|
|
219
|
-
script.src = "https://www.googletagmanager.com/gtag/js?id=" + trackingId;
|
|
220
|
-
head.insertBefore(script, head.firstChild);
|
|
221
|
-
window.dataLayer = window.dataLayer || [];
|
|
222
|
-
gtag("js", new Date());
|
|
223
|
-
if (setParams) {
|
|
224
|
-
gtag("set", setParams);
|
|
155
|
+
window.gtag = P;
|
|
156
|
+
function st({ trackingId: t, configParams: e = {}, setParams: n = {} }) {
|
|
157
|
+
var r = "ga-gtag";
|
|
158
|
+
if (!document.getElementById(r)) {
|
|
159
|
+
var i = document.head, a = document.createElement("script");
|
|
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);
|
|
225
161
|
}
|
|
226
|
-
gtag("config", trackingId, configParams);
|
|
227
162
|
}
|
|
228
|
-
function
|
|
163
|
+
function ct(t = {}) {
|
|
229
164
|
return {
|
|
230
165
|
name: "google-analytics-4",
|
|
231
|
-
config:
|
|
232
|
-
initialize: function({ config, instance }) {
|
|
233
|
-
if (!
|
|
166
|
+
config: t,
|
|
167
|
+
initialize: function({ config: e, instance: n }) {
|
|
168
|
+
if (!e.trackingId)
|
|
234
169
|
throw new Error("No GA trackingId defined");
|
|
235
|
-
var
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
var customDim = config.customDimensions[i];
|
|
241
|
-
configParams[customDim.name] = customDim.callback(instance, config);
|
|
242
|
-
customMap["dimension" + (i + 1)] = customDim.name;
|
|
170
|
+
var r = {}, i = {};
|
|
171
|
+
if (e.customDimensions) {
|
|
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;
|
|
243
175
|
}
|
|
244
|
-
|
|
176
|
+
i.custom_map = a;
|
|
245
177
|
}
|
|
246
|
-
|
|
178
|
+
st({ trackingId: e.trackingId, configParams: r, setParams: i });
|
|
247
179
|
},
|
|
248
|
-
page: function({ payload, config, instance }) {
|
|
180
|
+
page: function({ payload: e, config: n, instance: r }) {
|
|
249
181
|
},
|
|
250
|
-
track: function({ payload, config, instance }) {
|
|
251
|
-
|
|
182
|
+
track: function({ payload: e, config: n, instance: r }) {
|
|
183
|
+
P("event", e.event, e.properties);
|
|
252
184
|
},
|
|
253
|
-
identify: function({ payload, config }) {
|
|
185
|
+
identify: function({ payload: e, config: n }) {
|
|
254
186
|
},
|
|
255
187
|
loaded: function() {
|
|
256
188
|
return !!window.gtag;
|
|
257
189
|
}
|
|
258
190
|
};
|
|
259
191
|
}
|
|
260
|
-
var
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
console.debug(...arguments);
|
|
268
|
-
}
|
|
269
|
-
function warn(msg) {
|
|
270
|
-
console.warn(msg);
|
|
271
|
-
if (window.Rollbar) {
|
|
272
|
-
window.Rollbar.warning(msg);
|
|
273
|
-
}
|
|
192
|
+
var ft = new URLSearchParams(window.location.search), lt = ft.get("zdbg"), J = {};
|
|
193
|
+
const I = "undefined";
|
|
194
|
+
function g() {
|
|
195
|
+
lt == 1 && console.debug(...arguments);
|
|
196
|
+
}
|
|
197
|
+
function l(t) {
|
|
198
|
+
console.warn(t), window.Rollbar && window.Rollbar.warning(t);
|
|
274
199
|
}
|
|
275
|
-
function
|
|
276
|
-
return
|
|
200
|
+
function dt(t) {
|
|
201
|
+
return t && (Object.prototype.toString.call(t) === "[object Function]" || typeof t == "function" || t instanceof Function);
|
|
277
202
|
}
|
|
278
|
-
function
|
|
203
|
+
function B() {
|
|
279
204
|
try {
|
|
280
|
-
var
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
return
|
|
205
|
+
var t = navigator.userAgent || "", e = new RegExp(
|
|
206
|
+
[
|
|
207
|
+
/bot/,
|
|
208
|
+
/spider/,
|
|
209
|
+
/crawl/,
|
|
210
|
+
/mediapartners/,
|
|
211
|
+
/Google-Read-Aloud/,
|
|
212
|
+
/semrush/
|
|
213
|
+
].map((n) => n.source).join("|"),
|
|
214
|
+
"i"
|
|
215
|
+
);
|
|
216
|
+
return e.test(t);
|
|
217
|
+
} catch (n) {
|
|
218
|
+
return !1;
|
|
292
219
|
}
|
|
293
220
|
}
|
|
294
|
-
function
|
|
295
|
-
|
|
296
|
-
func();
|
|
297
|
-
} else {
|
|
298
|
-
window.addEventListener("DOMContentLoaded", func);
|
|
299
|
-
}
|
|
221
|
+
function wt(t) {
|
|
222
|
+
document.readyState === "complete" || document.readyState === "loaded" || document.readyState === "interactive" ? t() : window.addEventListener("DOMContentLoaded", t);
|
|
300
223
|
}
|
|
301
|
-
var
|
|
302
|
-
function
|
|
303
|
-
if (typeof
|
|
304
|
-
return
|
|
305
|
-
|
|
306
|
-
supportsSessionStorage = true;
|
|
224
|
+
var p = gt();
|
|
225
|
+
function gt() {
|
|
226
|
+
if (typeof p !== I)
|
|
227
|
+
return p;
|
|
228
|
+
p = !0;
|
|
307
229
|
try {
|
|
308
|
-
sessionStorage.setItem(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
supportsSessionStorage = false;
|
|
230
|
+
sessionStorage.setItem(I, I), sessionStorage.removeItem(I);
|
|
231
|
+
} catch (t) {
|
|
232
|
+
p = !1;
|
|
312
233
|
}
|
|
313
|
-
return
|
|
314
|
-
}
|
|
315
|
-
function getSessionStorage(key) {
|
|
316
|
-
var value;
|
|
317
|
-
var globalValue = zarGlobal[key];
|
|
318
|
-
if (supportsSessionStorage) {
|
|
319
|
-
value = sessionStorage.getItem(key);
|
|
320
|
-
if (!value && globalValue) {
|
|
321
|
-
value = globalValue;
|
|
322
|
-
sessionStorage.setItem(key, value);
|
|
323
|
-
}
|
|
324
|
-
} else {
|
|
325
|
-
value = globalValue;
|
|
326
|
-
}
|
|
327
|
-
return value ? JSON.parse(value) : void 0;
|
|
234
|
+
return p;
|
|
328
235
|
}
|
|
329
|
-
function
|
|
330
|
-
var
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
if (json) {
|
|
348
|
-
resolve(JSON.parse(xhr.response));
|
|
349
|
-
} else {
|
|
350
|
-
resolve(xhr.response);
|
|
351
|
-
}
|
|
352
|
-
} else {
|
|
353
|
-
reject({
|
|
354
|
-
status: this.status,
|
|
355
|
-
message: xhr.statusText
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
xhr.onerror = function() {
|
|
360
|
-
reject({
|
|
236
|
+
function F(t) {
|
|
237
|
+
var e, n = J[t];
|
|
238
|
+
return p ? (e = sessionStorage.getItem(t), !e && n && (e = n, sessionStorage.setItem(t, e))) : e = n, e ? JSON.parse(e) : void 0;
|
|
239
|
+
}
|
|
240
|
+
function vt(t, e) {
|
|
241
|
+
var n = JSON.stringify(e);
|
|
242
|
+
p && sessionStorage.setItem(t, n), J[t] = n;
|
|
243
|
+
}
|
|
244
|
+
function G({ method: t, url: e, data: n, json: r = !0 }) {
|
|
245
|
+
return new Promise(function(i, a) {
|
|
246
|
+
var o = new XMLHttpRequest();
|
|
247
|
+
o.open(t, e), o.withCredentials = !0, r && (o.setRequestHeader("Accept", "application/json"), o.setRequestHeader("Content-Type", "application/json")), o.onload = function() {
|
|
248
|
+
this.status >= 200 && this.status < 300 ? i(r ? JSON.parse(o.response) : o.response) : a({
|
|
249
|
+
status: this.status,
|
|
250
|
+
message: o.statusText
|
|
251
|
+
});
|
|
252
|
+
}, o.onerror = function() {
|
|
253
|
+
a({
|
|
361
254
|
status: this.status,
|
|
362
255
|
message: "Network Error"
|
|
363
256
|
});
|
|
364
|
-
};
|
|
365
|
-
if (data) {
|
|
366
|
-
xhr.send(data);
|
|
367
|
-
} else {
|
|
368
|
-
xhr.send();
|
|
369
|
-
}
|
|
257
|
+
}, n ? o.send(n) : o.send();
|
|
370
258
|
});
|
|
371
259
|
}
|
|
372
|
-
function
|
|
373
|
-
return "?" + Object.keys(
|
|
374
|
-
return
|
|
260
|
+
function pt(t) {
|
|
261
|
+
return "?" + Object.keys(t).map(function(e) {
|
|
262
|
+
return e + "=" + encodeURIComponent(t[e]);
|
|
375
263
|
}).join("&");
|
|
376
264
|
}
|
|
377
|
-
function
|
|
378
|
-
return
|
|
379
|
-
if (window && window.navigator && typeof window.navigator.sendBeacon
|
|
265
|
+
function bt(n) {
|
|
266
|
+
return d(this, arguments, function* ({ url: t, data: e }) {
|
|
267
|
+
if (window && window.navigator && typeof window.navigator.sendBeacon == "function" && typeof window.Blob == "function")
|
|
380
268
|
try {
|
|
381
|
-
const
|
|
269
|
+
const r = new Blob([JSON.stringify(e)], {
|
|
382
270
|
type: "text/plain; charset=UTF-8"
|
|
383
271
|
});
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
return false;
|
|
388
|
-
} catch (e) {
|
|
389
|
-
warn("postBeacon:");
|
|
390
|
-
return false;
|
|
272
|
+
return !!window.navigator.sendBeacon(t, r);
|
|
273
|
+
} catch (r) {
|
|
274
|
+
return l("postBeacon:"), !1;
|
|
391
275
|
}
|
|
392
|
-
|
|
393
|
-
return false;
|
|
276
|
+
return !1;
|
|
394
277
|
});
|
|
395
278
|
}
|
|
396
|
-
function
|
|
397
|
-
return
|
|
398
|
-
var
|
|
399
|
-
|
|
400
|
-
finalUrl = finalUrl + formatParams(params);
|
|
401
|
-
}
|
|
402
|
-
return yield makeRequest({ method: "GET", url: finalUrl, json });
|
|
279
|
+
function ht(r) {
|
|
280
|
+
return d(this, arguments, function* ({ url: t, params: e = null, json: n = !0 }) {
|
|
281
|
+
var i = t;
|
|
282
|
+
return e && (i = i + pt(e)), yield G({ method: "GET", url: i, json: n });
|
|
403
283
|
});
|
|
404
284
|
}
|
|
405
|
-
function
|
|
406
|
-
return
|
|
407
|
-
var
|
|
408
|
-
if (
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
if (beacon) {
|
|
412
|
-
var res = yield postBeacon({ url, data });
|
|
413
|
-
if (res) {
|
|
285
|
+
function x(i) {
|
|
286
|
+
return d(this, arguments, function* ({ url: t, data: e, json: n = !0, beacon: r = !1 }) {
|
|
287
|
+
var a = e;
|
|
288
|
+
if (n && (a = JSON.stringify(a)), r) {
|
|
289
|
+
var o = yield bt({ url: t, data: e });
|
|
290
|
+
if (o)
|
|
414
291
|
return;
|
|
415
|
-
|
|
416
|
-
dbg("Beacon failed");
|
|
292
|
+
g("Beacon failed");
|
|
417
293
|
}
|
|
418
|
-
return yield
|
|
294
|
+
return yield G({ method: "POST", url: t, data: a, json: n });
|
|
419
295
|
});
|
|
420
296
|
}
|
|
421
|
-
var
|
|
422
|
-
var NUMBER_POOL_SUCCESS = "success";
|
|
423
|
-
var NUMBER_POOL_ERROR = "error";
|
|
424
|
-
var NUMBER_POOL_RENEWAL_TIME_MS = 30 * 1e3;
|
|
425
|
-
var getNumberFailureCount = 0;
|
|
426
|
-
var MAX_GET_NUMBER_FAILURES = 3;
|
|
427
|
-
var poolIntervals = {};
|
|
297
|
+
var k = "__zar_vid", L = "success", m = "error", $ = 30 * 1e3, C = 0, mt = 3, w = {}, R = {}, N = !1;
|
|
428
298
|
window.zarPoolData = window.zarPoolData || null;
|
|
429
|
-
window.zarPoolDLObserverDone = window.zarPoolDLObserverDone ||
|
|
299
|
+
window.zarPoolDLObserverDone = window.zarPoolDLObserverDone || !1;
|
|
430
300
|
window.zarPoolDataLayer = window.zarPoolDataLayer || [];
|
|
431
|
-
var
|
|
432
|
-
function
|
|
301
|
+
var b = /* @__PURE__ */ new Map();
|
|
302
|
+
function yt() {
|
|
433
303
|
return Date.now().toString(36) + "." + Math.random().toString(36).substring(2);
|
|
434
304
|
}
|
|
435
|
-
function
|
|
436
|
-
var
|
|
437
|
-
|
|
438
|
-
var
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
return result;
|
|
452
|
-
}
|
|
453
|
-
function initIDs() {
|
|
454
|
-
var vidResult = initId(VID_KEY, generateVisitId, getSessionStorage, setSessionStorage);
|
|
455
|
-
return { vid: vidResult };
|
|
456
|
-
}
|
|
457
|
-
function getDefaultApiUrl() {
|
|
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 };
|
|
309
|
+
return r(t, s), s;
|
|
310
|
+
}
|
|
311
|
+
function A() {
|
|
312
|
+
var t = Pt(
|
|
313
|
+
k,
|
|
314
|
+
yt,
|
|
315
|
+
F,
|
|
316
|
+
vt
|
|
317
|
+
);
|
|
318
|
+
return { vid: t };
|
|
319
|
+
}
|
|
320
|
+
function H() {
|
|
458
321
|
return window.location.protocol + "://" + window.location.host + "/api/v2";
|
|
459
322
|
}
|
|
460
|
-
function
|
|
461
|
-
return
|
|
323
|
+
function V(t) {
|
|
324
|
+
return F(t);
|
|
462
325
|
}
|
|
463
|
-
function
|
|
464
|
-
var
|
|
465
|
-
return
|
|
326
|
+
function W(t) {
|
|
327
|
+
var e = V(t);
|
|
328
|
+
return e ? e.id : null;
|
|
466
329
|
}
|
|
467
|
-
function
|
|
330
|
+
function S() {
|
|
468
331
|
return {
|
|
469
|
-
vid:
|
|
332
|
+
vid: V(k)
|
|
470
333
|
};
|
|
471
334
|
}
|
|
472
|
-
function
|
|
335
|
+
function St() {
|
|
473
336
|
return {
|
|
474
|
-
vid:
|
|
337
|
+
vid: W(k)
|
|
475
338
|
};
|
|
476
339
|
}
|
|
477
|
-
function
|
|
478
|
-
var
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
var
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
var origNum;
|
|
496
|
-
var overlayNum = number;
|
|
497
|
-
if (!number.startsWith("+1")) {
|
|
498
|
-
overlayNum = "+1" + number;
|
|
499
|
-
}
|
|
500
|
-
for (var i = 0; i < elems.length; i++) {
|
|
501
|
-
if (numberOverlayMap.has(elems[i])) {
|
|
502
|
-
if (force) {
|
|
503
|
-
origNum = numberOverlayMap.get(elems[i]);
|
|
504
|
-
} else {
|
|
505
|
-
dbg("element already in overlay map:", elems[i]);
|
|
340
|
+
function E({ elem: t }) {
|
|
341
|
+
var e = null, n = null, r = null, i = new RegExp(
|
|
342
|
+
"\\+?\\(?\\d*\\)? ?\\(?\\d+\\)?\\d*([\\s./-]?\\d{2,})+",
|
|
343
|
+
"g"
|
|
344
|
+
);
|
|
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 };
|
|
348
|
+
}
|
|
349
|
+
function _({ elems: t, number: e, force: n = !1 }) {
|
|
350
|
+
var r, i = e;
|
|
351
|
+
e.startsWith("+1") || (i = "+1" + e);
|
|
352
|
+
for (var a = 0; a < t.length; a++) {
|
|
353
|
+
if (b.has(t[a]))
|
|
354
|
+
if (n)
|
|
355
|
+
r = b.get(t[a]);
|
|
356
|
+
else {
|
|
357
|
+
g("element already in overlay map:", t[a]);
|
|
506
358
|
continue;
|
|
507
359
|
}
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
if (elemNum.href) {
|
|
520
|
-
elems[i].href = "tel:" + overlayNum;
|
|
521
|
-
}
|
|
522
|
-
if (elemNum.numberText) {
|
|
523
|
-
elems[i].innerHTML = "";
|
|
524
|
-
if (elemNum.text) {
|
|
525
|
-
var overlay = overlayNum;
|
|
526
|
-
if (elemNum.numberText.indexOf("-") > -1) {
|
|
527
|
-
overlay = overlayNum.slice(2, 5) + "-" + overlayNum.slice(5, 8) + "-" + overlayNum.slice(8, 12);
|
|
528
|
-
}
|
|
529
|
-
if (elemNum.html.indexOf("<img") > -1) {
|
|
530
|
-
var numberHtml = elemNum.html.replace(elemNum.numberText, overlay);
|
|
531
|
-
elems[i].innerHTML = numberHtml;
|
|
360
|
+
var o = E({ elem: t[a] });
|
|
361
|
+
if (r ? !n && o.number && r.number && r.number !== o.number && l(
|
|
362
|
+
"overlaying multiple numbers with a single number",
|
|
363
|
+
r.number,
|
|
364
|
+
o.number
|
|
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
|
+
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;
|
|
532
371
|
} else {
|
|
533
|
-
var
|
|
534
|
-
|
|
372
|
+
var c = o.text.replace(o.numberText, u);
|
|
373
|
+
t[a].appendChild(document.createTextNode(c));
|
|
535
374
|
}
|
|
536
|
-
} else
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
dbg("no number text found:", elems[i]);
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
function revertOverlayNumbers({ 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]);
|
|
549
|
-
dbg("orig:", origElemData);
|
|
550
|
-
var origHTML = origElemData.html;
|
|
551
|
-
dbg("reverting", currentHTML, "to", origHTML);
|
|
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
|
-
}
|
|
559
|
-
if (origElemData.href) {
|
|
560
|
-
elems[i].setAttribute("href", origElemData.href);
|
|
561
|
-
}
|
|
562
|
-
numberOverlayMap.delete(elems[i]);
|
|
563
|
-
} else {
|
|
564
|
-
dbg("element not in map:", elems[i]);
|
|
565
|
-
}
|
|
375
|
+
} else
|
|
376
|
+
t[a].appendChild(document.createTextNode(i));
|
|
377
|
+
else
|
|
378
|
+
g("no number text found:", t[a]);
|
|
566
379
|
}
|
|
567
380
|
}
|
|
568
|
-
function
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
381
|
+
function O({ elems: t }) {
|
|
382
|
+
for (var e = 0; e < t.length; e++)
|
|
383
|
+
if (b.has(t[e])) {
|
|
384
|
+
var n = t[e].innerHTML, r = b.get(t[e]);
|
|
385
|
+
g("orig:", r);
|
|
386
|
+
var i = r.html;
|
|
387
|
+
g("reverting", n, "to", i), i != null && i !== "" ? t[e].innerHTML = i : r.text !== void 0 && r.text !== null ? t[e].textContent = r.text : t[e].textContent = "", r.href && t[e].setAttribute("href", r.href), b.delete(t[e]);
|
|
388
|
+
} else
|
|
389
|
+
g("element not in map:", t[e]);
|
|
390
|
+
}
|
|
391
|
+
function Q(t) {
|
|
392
|
+
clearInterval(w[t]), delete w[t];
|
|
393
|
+
}
|
|
394
|
+
function X() {
|
|
395
|
+
for (var t in w)
|
|
396
|
+
Q(t);
|
|
397
|
+
}
|
|
398
|
+
function K(i) {
|
|
399
|
+
return d(this, arguments, function* ({
|
|
400
|
+
poolId: t,
|
|
401
|
+
apiUrl: e,
|
|
402
|
+
number: n = null,
|
|
403
|
+
context: r = null
|
|
583
404
|
}) {
|
|
584
|
-
var
|
|
585
|
-
pool_id:
|
|
586
|
-
number,
|
|
587
|
-
context,
|
|
405
|
+
var a = {
|
|
406
|
+
pool_id: t,
|
|
407
|
+
number: n,
|
|
408
|
+
context: r,
|
|
588
409
|
properties: {
|
|
589
|
-
zar:
|
|
410
|
+
zar: S()
|
|
590
411
|
}
|
|
591
|
-
};
|
|
592
|
-
|
|
593
|
-
return resp;
|
|
412
|
+
}, o = yield x({ url: `${e}/number_pool`, data: a });
|
|
413
|
+
return o;
|
|
594
414
|
});
|
|
595
415
|
}
|
|
596
|
-
function
|
|
597
|
-
return window.zarPoolData && window.zarPoolData.status ===
|
|
416
|
+
function D() {
|
|
417
|
+
return window.zarPoolData && window.zarPoolData.status === L && window.zarPoolData.number;
|
|
598
418
|
}
|
|
599
|
-
function
|
|
600
|
-
if (!window.zarPoolDataLayer || !Array.isArray(window.zarPoolDataLayer) || window.zarPoolDataLayer.length === 0)
|
|
419
|
+
function y() {
|
|
420
|
+
if (!window.zarPoolDataLayer || !Array.isArray(window.zarPoolDataLayer) || window.zarPoolDataLayer.length === 0)
|
|
601
421
|
return null;
|
|
422
|
+
for (var t = {}, e = 0; e < window.zarPoolDataLayer.length; e++) {
|
|
423
|
+
var n = window.zarPoolDataLayer[e];
|
|
424
|
+
for (var r in n)
|
|
425
|
+
Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
|
|
602
426
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
window.zarPoolDataLayer.length = 0;
|
|
613
|
-
return mergedObject;
|
|
614
|
-
}
|
|
615
|
-
function updateTrackingNumberContext(_0) {
|
|
616
|
-
return __async(this, arguments, function* ({
|
|
617
|
-
apiUrl,
|
|
618
|
-
poolId,
|
|
619
|
-
number,
|
|
620
|
-
context
|
|
427
|
+
return window.zarPoolDataLayer.length = 0, t;
|
|
428
|
+
}
|
|
429
|
+
function T(i) {
|
|
430
|
+
return d(this, arguments, function* ({
|
|
431
|
+
apiUrl: t,
|
|
432
|
+
poolId: e,
|
|
433
|
+
number: n,
|
|
434
|
+
context: r
|
|
621
435
|
}) {
|
|
622
|
-
if (!
|
|
623
|
-
|
|
436
|
+
if (!D()) {
|
|
437
|
+
l("no valid pool data, not updating context");
|
|
624
438
|
return;
|
|
625
439
|
}
|
|
626
|
-
var
|
|
627
|
-
pool_id:
|
|
628
|
-
number,
|
|
629
|
-
context,
|
|
440
|
+
var a = {
|
|
441
|
+
pool_id: e,
|
|
442
|
+
number: n,
|
|
443
|
+
context: r,
|
|
630
444
|
properties: {
|
|
631
|
-
zar:
|
|
445
|
+
zar: S()
|
|
632
446
|
}
|
|
633
|
-
};
|
|
634
|
-
|
|
635
|
-
return resp;
|
|
447
|
+
}, o = yield x({ url: `${t}/update_number`, data: a });
|
|
448
|
+
return o;
|
|
636
449
|
});
|
|
637
450
|
}
|
|
638
|
-
function
|
|
639
|
-
return
|
|
640
|
-
var
|
|
641
|
-
key,
|
|
642
|
-
with_contexts
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
params
|
|
451
|
+
function It(r) {
|
|
452
|
+
return d(this, arguments, function* ({ apiUrl: t, key: e = null, with_contexts: n = !1 }) {
|
|
453
|
+
var i = {
|
|
454
|
+
key: e,
|
|
455
|
+
with_contexts: n
|
|
456
|
+
}, a = yield ht({
|
|
457
|
+
url: `${t}/number_pool_stats`,
|
|
458
|
+
params: i
|
|
647
459
|
});
|
|
648
|
-
return
|
|
460
|
+
return a;
|
|
649
461
|
});
|
|
650
462
|
}
|
|
651
|
-
function
|
|
652
|
-
return
|
|
653
|
-
overlayElements,
|
|
654
|
-
apiUrl =
|
|
655
|
-
contextCallback = null
|
|
463
|
+
function U() {
|
|
464
|
+
return d(this, arguments, function* ({
|
|
465
|
+
overlayElements: t,
|
|
466
|
+
apiUrl: e = H(),
|
|
467
|
+
contextCallback: n = null,
|
|
468
|
+
checkLastRenewal: r = !1,
|
|
469
|
+
renewalInterval: i = $
|
|
656
470
|
} = {}) {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
471
|
+
if (N)
|
|
472
|
+
return { status: m, msg: "stopped" };
|
|
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)
|
|
476
|
+
return { status: L };
|
|
477
|
+
R[a] = u;
|
|
478
|
+
var v = y() || {};
|
|
479
|
+
n && (v = n(v) || {});
|
|
663
480
|
try {
|
|
664
|
-
var
|
|
665
|
-
} catch (
|
|
666
|
-
var
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
warn("number changed from " + window.zarPoolData.number + " to " + resp.number);
|
|
682
|
-
window.zarPoolData.number = resp.number;
|
|
683
|
-
force = true;
|
|
684
|
-
}
|
|
685
|
-
if (overlayElements) {
|
|
686
|
-
overlayPhoneNumber({
|
|
687
|
-
elems: overlayElements,
|
|
688
|
-
number: resp.number,
|
|
689
|
-
force
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
} else {
|
|
693
|
-
if (overlayElements) {
|
|
694
|
-
revertOverlayNumbers({ elems: overlayElements });
|
|
695
|
-
}
|
|
696
|
-
if (poolIntervals[poolId]) {
|
|
697
|
-
clearInterval(poolIntervals[poolId]);
|
|
698
|
-
delete poolIntervals[poolId];
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
return resp;
|
|
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 };
|
|
485
|
+
}
|
|
486
|
+
if (f.status === L && f.number) {
|
|
487
|
+
var j = !1;
|
|
488
|
+
f.number !== window.zarPoolData.number && (l(
|
|
489
|
+
"number changed from " + window.zarPoolData.number + " to " + f.number
|
|
490
|
+
), window.zarPoolData.number = f.number, j = !0), t && _({
|
|
491
|
+
elems: t,
|
|
492
|
+
number: f.number,
|
|
493
|
+
force: j
|
|
494
|
+
});
|
|
495
|
+
} else
|
|
496
|
+
t && O({ elems: t }), w[a] && (clearInterval(w[a]), delete w[a]);
|
|
497
|
+
return f;
|
|
702
498
|
});
|
|
703
499
|
}
|
|
704
|
-
function
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
var
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
}
|
|
723
|
-
updateTrackingNumberContext({
|
|
724
|
-
apiUrl,
|
|
725
|
-
poolId: window.zarPoolData.pool_id,
|
|
726
|
-
number: window.zarPoolData.number,
|
|
727
|
-
context: context2
|
|
728
|
-
});
|
|
729
|
-
return result;
|
|
730
|
-
};
|
|
731
|
-
var context = drainPoolDataLayer();
|
|
732
|
-
if (context) {
|
|
733
|
-
updateTrackingNumberContext({
|
|
734
|
-
apiUrl,
|
|
500
|
+
function z(t) {
|
|
501
|
+
return dt(t) ? t() : t;
|
|
502
|
+
}
|
|
503
|
+
function xt(t) {
|
|
504
|
+
if (!window.zarPoolDLObserverDone && D()) {
|
|
505
|
+
var e = window.zarPoolDataLayer.push;
|
|
506
|
+
window.zarPoolDataLayer.push = function(...r) {
|
|
507
|
+
var i = e.apply(this, r), a = y();
|
|
508
|
+
return a && T({
|
|
509
|
+
apiUrl: t,
|
|
510
|
+
poolId: window.zarPoolData.pool_id,
|
|
511
|
+
number: window.zarPoolData.number,
|
|
512
|
+
context: a
|
|
513
|
+
}), i;
|
|
514
|
+
};
|
|
515
|
+
var n = y();
|
|
516
|
+
n && T({
|
|
517
|
+
apiUrl: t,
|
|
735
518
|
poolId: window.zarPoolData.pool_id,
|
|
736
519
|
number: window.zarPoolData.number,
|
|
737
|
-
context
|
|
738
|
-
});
|
|
520
|
+
context: n
|
|
521
|
+
}), window.zarPoolDLObserverDone = !0;
|
|
739
522
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
function
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
}
|
|
753
|
-
var poolId = getPoolId(poolConfig.poolId);
|
|
754
|
-
if (!poolId) {
|
|
755
|
-
msg = "no pool ID";
|
|
756
|
-
warn(msg);
|
|
757
|
-
if (poolConfig.initCallback) {
|
|
758
|
-
poolConfig.initCallback({ status: NUMBER_POOL_ERROR, msg });
|
|
759
|
-
}
|
|
760
|
-
return poolIntervals;
|
|
761
|
-
}
|
|
762
|
-
if (!poolData) {
|
|
763
|
-
var context = drainPoolDataLayer() || {};
|
|
764
|
-
if (poolConfig.contextCallback) {
|
|
765
|
-
context = poolConfig.contextCallback(context) || {};
|
|
766
|
-
}
|
|
523
|
+
}
|
|
524
|
+
function M() {
|
|
525
|
+
return d(this, arguments, function* ({ poolData: t, poolConfig: e, apiUrl: n } = {}) {
|
|
526
|
+
var r;
|
|
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);
|
|
530
|
+
if (!i)
|
|
531
|
+
return r = "no pool ID", l(r), e.initCallback && e.initCallback({ status: m, msg: r }), w;
|
|
532
|
+
if (!t) {
|
|
533
|
+
var a = y() || {};
|
|
534
|
+
e.contextCallback && (a = e.contextCallback(a) || {});
|
|
767
535
|
try {
|
|
768
|
-
|
|
769
|
-
} catch (
|
|
770
|
-
|
|
771
|
-
warn(msg);
|
|
772
|
-
if (poolConfig.initCallback) {
|
|
773
|
-
poolConfig.initCallback({ status: NUMBER_POOL_ERROR, msg });
|
|
774
|
-
}
|
|
775
|
-
return poolIntervals;
|
|
536
|
+
t = yield K({ poolId: i, apiUrl: n, number: null, context: a });
|
|
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;
|
|
776
539
|
}
|
|
777
540
|
}
|
|
778
|
-
window.zarPoolData =
|
|
779
|
-
|
|
541
|
+
if (window.zarPoolData = t, D()) {
|
|
542
|
+
R[i] = Date.now();
|
|
780
543
|
try {
|
|
781
|
-
|
|
782
|
-
} catch (
|
|
783
|
-
|
|
544
|
+
xt(n);
|
|
545
|
+
} catch (o) {
|
|
546
|
+
l("data layer error: " + JSON.stringify(o));
|
|
784
547
|
}
|
|
785
|
-
|
|
786
|
-
var
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
}
|
|
548
|
+
wt(function() {
|
|
549
|
+
var o = document.querySelectorAll(
|
|
550
|
+
e.overlayQuerySelector
|
|
551
|
+
);
|
|
552
|
+
if (!o) {
|
|
553
|
+
var u = "No elems found for:" + e.overlayQuerySelector;
|
|
554
|
+
l(u), e.initCallback && e.initCallback({ status: m, msg: u });
|
|
793
555
|
return;
|
|
794
556
|
}
|
|
795
|
-
|
|
796
|
-
var
|
|
557
|
+
_({ elems: o, number: t.number });
|
|
558
|
+
var s = e.renewalInterval || $, c = function(f = {}) {
|
|
559
|
+
try {
|
|
560
|
+
if (!D())
|
|
561
|
+
return;
|
|
562
|
+
(f.type === "vc" && document.visibilityState === "visible" || f.type === "ps" && f.persisted === !0) && (console.log("renew on", f.type), U({
|
|
563
|
+
overlayElements: o,
|
|
564
|
+
apiUrl: n,
|
|
565
|
+
contextCallback: e.contextCallback,
|
|
566
|
+
checkLastRenewal: !0,
|
|
567
|
+
renewalInterval: s
|
|
568
|
+
}));
|
|
569
|
+
} catch (h) {
|
|
570
|
+
l("error on renew: " + JSON.stringify(h));
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
document.addEventListener(
|
|
574
|
+
"visibilitychange",
|
|
575
|
+
function() {
|
|
576
|
+
c({ type: "vc" });
|
|
577
|
+
},
|
|
578
|
+
{ passive: !0 }
|
|
579
|
+
), window.addEventListener(
|
|
580
|
+
"pageshow",
|
|
581
|
+
function(f) {
|
|
582
|
+
c({ type: "ps", persisted: f && f.persisted });
|
|
583
|
+
},
|
|
584
|
+
{ passive: !0 }
|
|
585
|
+
);
|
|
586
|
+
var v = setInterval(function() {
|
|
797
587
|
try {
|
|
798
|
-
|
|
799
|
-
overlayElements,
|
|
800
|
-
apiUrl,
|
|
801
|
-
contextCallback:
|
|
588
|
+
U({
|
|
589
|
+
overlayElements: o,
|
|
590
|
+
apiUrl: n,
|
|
591
|
+
contextCallback: e.contextCallback
|
|
802
592
|
});
|
|
803
|
-
} catch (
|
|
804
|
-
var
|
|
805
|
-
|
|
593
|
+
} catch (h) {
|
|
594
|
+
var f = "error on interval: " + JSON.stringify(h);
|
|
595
|
+
l(f);
|
|
806
596
|
}
|
|
807
|
-
},
|
|
808
|
-
|
|
809
|
-
if (poolConfig.initCallback) {
|
|
810
|
-
poolConfig.initCallback(poolData);
|
|
811
|
-
}
|
|
597
|
+
}, s);
|
|
598
|
+
w[t.pool_id] = v, e.initCallback && e.initCallback(t);
|
|
812
599
|
});
|
|
813
600
|
}
|
|
814
|
-
return
|
|
601
|
+
return w;
|
|
815
602
|
});
|
|
816
603
|
}
|
|
817
|
-
function
|
|
818
|
-
|
|
819
|
-
return {
|
|
604
|
+
function Ot({ apiUrl: t, poolConfig: e }) {
|
|
605
|
+
return A(), {
|
|
820
606
|
name: "zar",
|
|
821
|
-
config: { apiUrl, poolConfig },
|
|
822
|
-
initialize: function({ config }) {
|
|
607
|
+
config: { apiUrl: t, poolConfig: e },
|
|
608
|
+
initialize: function({ config: n }) {
|
|
823
609
|
},
|
|
824
610
|
loaded: function() {
|
|
825
|
-
return
|
|
611
|
+
return !0;
|
|
826
612
|
},
|
|
827
|
-
pageStart: function({ payload, config, instance }) {
|
|
828
|
-
|
|
829
|
-
payload.properties.referrer = document.referrer;
|
|
830
|
-
payload.properties.is_bot = isBot();
|
|
613
|
+
pageStart: function({ payload: n, config: r, instance: i }) {
|
|
614
|
+
n.properties.zar = S(), n.properties.referrer = document.referrer, n.properties.is_bot = B();
|
|
831
615
|
try {
|
|
832
|
-
var
|
|
833
|
-
if (
|
|
834
|
-
|
|
835
|
-
var
|
|
836
|
-
|
|
837
|
-
payload.properties.pool_context = pcfg.contextCallback(context) || {};
|
|
838
|
-
}
|
|
616
|
+
var a = r.poolConfig;
|
|
617
|
+
if (a && a.poolId) {
|
|
618
|
+
n.properties.pool_id = z(a.poolId);
|
|
619
|
+
var o = y() || {};
|
|
620
|
+
a.contextCallback && (n.properties.pool_context = a.contextCallback(o) || {});
|
|
839
621
|
}
|
|
840
|
-
} catch (
|
|
841
|
-
|
|
622
|
+
} catch (u) {
|
|
623
|
+
l("error getting pool id: " + JSON.stringify(u));
|
|
842
624
|
}
|
|
843
|
-
return
|
|
625
|
+
return n;
|
|
844
626
|
},
|
|
845
|
-
page: function(
|
|
846
|
-
return
|
|
847
|
-
|
|
848
|
-
var
|
|
849
|
-
var maxTries = 3;
|
|
850
|
-
var res;
|
|
851
|
-
while (tries < maxTries) {
|
|
627
|
+
page: function(o) {
|
|
628
|
+
return d(this, arguments, function* ({ payload: n, options: r, instance: i, config: a }) {
|
|
629
|
+
g("page", n, r, a);
|
|
630
|
+
for (var u = 0, s = 3, c; u < s; )
|
|
852
631
|
try {
|
|
853
|
-
|
|
632
|
+
c = yield x({ url: `${a.apiUrl}/page`, data: n });
|
|
854
633
|
break;
|
|
855
|
-
} catch (
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
throw e;
|
|
860
|
-
}
|
|
861
|
-
yield new Promise((r) => setTimeout(r, 1e3));
|
|
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));
|
|
862
638
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
apiUrl: config.apiUrl
|
|
869
|
-
});
|
|
870
|
-
}
|
|
639
|
+
c && c.pool_data && M({
|
|
640
|
+
poolData: c.pool_data,
|
|
641
|
+
poolConfig: a.poolConfig,
|
|
642
|
+
apiUrl: a.apiUrl
|
|
643
|
+
});
|
|
871
644
|
});
|
|
872
645
|
},
|
|
873
|
-
trackStart: function({ payload, config, instance }) {
|
|
874
|
-
|
|
875
|
-
payload.properties.url = window.location.href;
|
|
876
|
-
payload.properties.referrer = document.referrer;
|
|
877
|
-
return payload;
|
|
646
|
+
trackStart: function({ payload: n, config: r, instance: i }) {
|
|
647
|
+
return n.properties.zar = S(), n.properties.url = window.location.href, n.properties.referrer = document.referrer, n;
|
|
878
648
|
},
|
|
879
|
-
track: function({ payload, options, instance, config }) {
|
|
880
|
-
|
|
881
|
-
httpPost({ url: `${config.apiUrl}/track`, data: payload, beacon: true });
|
|
649
|
+
track: function({ payload: n, options: r, instance: i, config: a }) {
|
|
650
|
+
g("track", n), x({ url: `${a.apiUrl}/track`, data: n, beacon: !0 });
|
|
882
651
|
},
|
|
883
652
|
methods: {
|
|
884
653
|
apiUrl() {
|
|
885
|
-
return
|
|
654
|
+
return t;
|
|
886
655
|
},
|
|
887
656
|
poolConfig() {
|
|
888
|
-
return
|
|
657
|
+
return e;
|
|
889
658
|
},
|
|
890
659
|
initIDs() {
|
|
891
|
-
return
|
|
660
|
+
return A();
|
|
892
661
|
},
|
|
893
662
|
getIDs() {
|
|
894
|
-
return
|
|
663
|
+
return St();
|
|
895
664
|
},
|
|
896
665
|
getStorage() {
|
|
897
|
-
return
|
|
666
|
+
return S();
|
|
898
667
|
},
|
|
899
668
|
getVID() {
|
|
900
|
-
return
|
|
669
|
+
return W(k);
|
|
901
670
|
},
|
|
902
671
|
isBot() {
|
|
903
|
-
return
|
|
672
|
+
return B();
|
|
904
673
|
},
|
|
905
|
-
initTrackingPool({ poolConfig:
|
|
906
|
-
var
|
|
907
|
-
return
|
|
674
|
+
initTrackingPool({ poolConfig: n }) {
|
|
675
|
+
var r = this.instance.plugins.zar;
|
|
676
|
+
return M({
|
|
908
677
|
poolData: null,
|
|
909
|
-
poolConfig: Object.assign(
|
|
910
|
-
apiUrl:
|
|
678
|
+
poolConfig: Object.assign(r.poolConfig(), n || {}),
|
|
679
|
+
apiUrl: r.apiUrl()
|
|
911
680
|
});
|
|
912
681
|
},
|
|
913
|
-
updateTrackingNumberContext({ number, context }) {
|
|
914
|
-
var
|
|
915
|
-
|
|
916
|
-
return updateTrackingNumberContext({
|
|
682
|
+
updateTrackingNumberContext({ number: n, context: r }) {
|
|
683
|
+
var i = this.instance.plugins.zar, a = i.poolConfig();
|
|
684
|
+
return T({
|
|
917
685
|
apiUrl: this.instance.plugins.zar.apiUrl(),
|
|
918
|
-
poolId:
|
|
919
|
-
number,
|
|
920
|
-
context
|
|
686
|
+
poolId: z(a.poolId),
|
|
687
|
+
number: n,
|
|
688
|
+
context: r
|
|
921
689
|
});
|
|
922
690
|
},
|
|
923
691
|
getPoolIntervals() {
|
|
924
|
-
return
|
|
692
|
+
return w;
|
|
925
693
|
},
|
|
926
|
-
clearPoolInterval({ poolId }) {
|
|
927
|
-
|
|
694
|
+
clearPoolInterval({ poolId: n }) {
|
|
695
|
+
Q(n);
|
|
928
696
|
},
|
|
929
697
|
clearPoolIntervals() {
|
|
930
|
-
|
|
698
|
+
X();
|
|
931
699
|
},
|
|
932
|
-
extractPhoneNumbers({ elems }) {
|
|
933
|
-
var
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
res.push(elemRes);
|
|
700
|
+
extractPhoneNumbers({ elems: n }) {
|
|
701
|
+
for (var r = [], i = 0; i < n.length; i++) {
|
|
702
|
+
var a = E({ elem: n[i] });
|
|
703
|
+
r.push(a);
|
|
937
704
|
}
|
|
938
|
-
return
|
|
705
|
+
return r;
|
|
939
706
|
},
|
|
940
|
-
overlayPhoneNumber({ overlayElements, number }) {
|
|
941
|
-
|
|
707
|
+
overlayPhoneNumber({ overlayElements: n, number: r }) {
|
|
708
|
+
_({ elems: n, number: r });
|
|
942
709
|
},
|
|
943
|
-
revertOverlayNumbers({ overlayElements }) {
|
|
944
|
-
|
|
710
|
+
revertOverlayNumbers({ overlayElements: n }) {
|
|
711
|
+
O({ elems: n });
|
|
945
712
|
},
|
|
946
|
-
getPoolStats({ key = null, with_contexts =
|
|
947
|
-
return
|
|
713
|
+
getPoolStats({ key: n = null, with_contexts: r = !1 }) {
|
|
714
|
+
return It({
|
|
948
715
|
apiUrl: this.instance.plugins.zar.apiUrl(),
|
|
949
|
-
key,
|
|
950
|
-
with_contexts
|
|
716
|
+
key: n,
|
|
717
|
+
with_contexts: r
|
|
951
718
|
});
|
|
952
719
|
}
|
|
953
720
|
}
|
|
954
721
|
};
|
|
955
722
|
}
|
|
956
|
-
function
|
|
957
|
-
app,
|
|
958
|
-
ga4Config = null,
|
|
959
|
-
facebookConfig = null,
|
|
960
|
-
apiUrl = null,
|
|
961
|
-
poolConfig = null
|
|
723
|
+
function zt({
|
|
724
|
+
app: t,
|
|
725
|
+
ga4Config: e = null,
|
|
726
|
+
facebookConfig: n = null,
|
|
727
|
+
apiUrl: r = null,
|
|
728
|
+
poolConfig: i = null
|
|
962
729
|
}) {
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
drainPoolDataLayer,
|
|
980
|
-
getPoolId
|
|
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 });
|
|
733
|
+
}
|
|
734
|
+
const kt = {
|
|
735
|
+
extractPhoneNumber: E,
|
|
736
|
+
overlayPhoneNumber: _,
|
|
737
|
+
revertOverlayNumbers: O,
|
|
738
|
+
drainPoolDataLayer: y,
|
|
739
|
+
getPoolId: z
|
|
740
|
+
};
|
|
741
|
+
export {
|
|
742
|
+
Z as Analytics,
|
|
743
|
+
kt as __test__,
|
|
744
|
+
zt as init,
|
|
745
|
+
Ot as zar
|
|
981
746
|
};
|
|
982
|
-
export { Analytics, __test__, init, zar };
|
|
983
747
|
//# sourceMappingURL=zar.es.js.map
|