zar 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/zar.es.js +1142 -3448
- package/dist/zar.es.js.map +1 -1
- package/dist/zar.iife.js +2 -4
- package/dist/zar.iife.js.map +1 -1
- package/dist/zar.umd.js +2 -4
- package/dist/zar.umd.js.map +1 -1
- package/package.json +3 -4
package/dist/zar.es.js
CHANGED
|
@@ -18,95 +18,107 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18
18
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
function
|
|
21
|
+
function i$3(t2, e2, l2, n2, r2) {
|
|
22
22
|
for (e2 = e2.split ? e2.split(".") : e2, n2 = 0; n2 < e2.length; n2++)
|
|
23
23
|
t2 = t2 ? t2[e2[n2]] : r2;
|
|
24
24
|
return t2 === r2 ? l2 : t2;
|
|
25
25
|
}
|
|
26
|
-
var F$
|
|
27
|
-
F$
|
|
28
|
-
var $$
|
|
29
|
-
F$
|
|
26
|
+
var e = "undefined", o$2 = "object", g$1 = "any", m$1 = "*", j$1 = "__", F$2 = typeof process != "undefined" ? process : {};
|
|
27
|
+
F$2.env && F$2.env.NODE_ENV || "";
|
|
28
|
+
var $$1 = typeof window != "undefined";
|
|
29
|
+
F$2.versions != null && F$2.versions.node != null;
|
|
30
30
|
typeof Deno != "undefined" && Deno.core !== void 0;
|
|
31
|
-
$$
|
|
32
|
-
function M$
|
|
31
|
+
$$1 && window.name === "nodejs" || typeof navigator != "undefined" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
32
|
+
function M$1(n2, t2) {
|
|
33
33
|
return t2.charAt(0)[n2]() + t2.slice(1);
|
|
34
34
|
}
|
|
35
|
-
var U$
|
|
36
|
-
function J$
|
|
37
|
-
return Y$
|
|
35
|
+
var U$1 = M$1.bind(null, "toUpperCase"), H$1 = M$1.bind(null, "toLowerCase");
|
|
36
|
+
function J$2(n2) {
|
|
37
|
+
return Y$1(n2) ? U$1("null") : typeof n2 == "object" ? yn(n2) : Object.prototype.toString.call(n2).slice(8, -1);
|
|
38
38
|
}
|
|
39
|
-
function R$
|
|
39
|
+
function R$1(n2, t2) {
|
|
40
40
|
t2 === void 0 && (t2 = true);
|
|
41
|
-
var e2 = J$
|
|
42
|
-
return t2 ? H$
|
|
41
|
+
var e2 = J$2(n2);
|
|
42
|
+
return t2 ? H$1(e2) : e2;
|
|
43
43
|
}
|
|
44
|
-
function V$
|
|
44
|
+
function V$1(n2, t2) {
|
|
45
45
|
return typeof t2 === n2;
|
|
46
46
|
}
|
|
47
|
-
var W$
|
|
48
|
-
V$
|
|
49
|
-
V$
|
|
50
|
-
|
|
51
|
-
function Y$4(n2) {
|
|
47
|
+
var W$1 = V$1.bind(null, "function"), q$1 = V$1.bind(null, "string"), I$2 = V$1.bind(null, "undefined");
|
|
48
|
+
var Q$1 = V$1.bind(null, "boolean");
|
|
49
|
+
V$1.bind(null, "symbol");
|
|
50
|
+
function Y$1(n2) {
|
|
52
51
|
return n2 === null;
|
|
53
52
|
}
|
|
54
|
-
function nn
|
|
55
|
-
return R$
|
|
53
|
+
function nn(n2) {
|
|
54
|
+
return R$1(n2) === "number" && !isNaN(n2);
|
|
55
|
+
}
|
|
56
|
+
function rn(n2) {
|
|
57
|
+
return R$1(n2) === "array";
|
|
56
58
|
}
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
+
function on(n2) {
|
|
60
|
+
if (!un(n2))
|
|
61
|
+
return false;
|
|
62
|
+
for (var t2 = n2; Object.getPrototypeOf(t2) !== null; )
|
|
63
|
+
t2 = Object.getPrototypeOf(t2);
|
|
64
|
+
return Object.getPrototypeOf(n2) === t2;
|
|
65
|
+
}
|
|
66
|
+
function un(n2) {
|
|
67
|
+
return n2 && (typeof n2 == "object" || n2 !== null);
|
|
68
|
+
}
|
|
69
|
+
function yn(n2) {
|
|
70
|
+
return W$1(n2.constructor) ? n2.constructor.name : null;
|
|
59
71
|
}
|
|
60
|
-
function hn
|
|
61
|
-
return n2 instanceof Error || q$
|
|
72
|
+
function hn(n2) {
|
|
73
|
+
return n2 instanceof Error || q$1(n2.message) && n2.constructor && nn(n2.constructor.stackTraceLimit);
|
|
62
74
|
}
|
|
63
|
-
function On
|
|
64
|
-
if (typeof t2 != "object" || Y$
|
|
75
|
+
function On(n2, t2) {
|
|
76
|
+
if (typeof t2 != "object" || Y$1(t2))
|
|
65
77
|
return false;
|
|
66
78
|
if (t2 instanceof n2)
|
|
67
79
|
return true;
|
|
68
|
-
var e2 = R$
|
|
69
|
-
if (hn
|
|
80
|
+
var e2 = R$1(new n2(""));
|
|
81
|
+
if (hn(t2))
|
|
70
82
|
for (; t2; ) {
|
|
71
|
-
if (R$
|
|
83
|
+
if (R$1(t2) === e2)
|
|
72
84
|
return true;
|
|
73
85
|
t2 = Object.getPrototypeOf(t2);
|
|
74
86
|
}
|
|
75
87
|
return false;
|
|
76
88
|
}
|
|
77
|
-
On
|
|
78
|
-
On
|
|
79
|
-
function $n
|
|
89
|
+
On.bind(null, TypeError);
|
|
90
|
+
On.bind(null, SyntaxError);
|
|
91
|
+
function $n(n2, t2) {
|
|
80
92
|
var e2 = n2 instanceof Element || n2 instanceof HTMLDocument;
|
|
81
|
-
return e2 && t2 ? Tn
|
|
93
|
+
return e2 && t2 ? Tn(n2, t2) : e2;
|
|
82
94
|
}
|
|
83
|
-
function Tn
|
|
95
|
+
function Tn(n2, t2) {
|
|
84
96
|
return t2 === void 0 && (t2 = ""), n2 && n2.nodeName === t2.toUpperCase();
|
|
85
97
|
}
|
|
86
|
-
function _n
|
|
98
|
+
function _n(n2) {
|
|
87
99
|
var t2 = [].slice.call(arguments, 1);
|
|
88
100
|
return function() {
|
|
89
101
|
return n2.apply(void 0, [].slice.call(arguments).concat(t2));
|
|
90
102
|
};
|
|
91
103
|
}
|
|
92
|
-
_n
|
|
93
|
-
_n
|
|
94
|
-
_n
|
|
95
|
-
_n
|
|
96
|
-
function n$
|
|
104
|
+
_n($n, "form");
|
|
105
|
+
_n($n, "button");
|
|
106
|
+
_n($n, "input");
|
|
107
|
+
_n($n, "select");
|
|
108
|
+
function n$1(e2) {
|
|
97
109
|
try {
|
|
98
110
|
return decodeURIComponent(e2.replace(/\+/g, " "));
|
|
99
111
|
} catch (e3) {
|
|
100
112
|
return null;
|
|
101
113
|
}
|
|
102
114
|
}
|
|
103
|
-
function o$
|
|
104
|
-
if ($$
|
|
115
|
+
function o$1() {
|
|
116
|
+
if ($$1) {
|
|
105
117
|
var r2 = navigator, t2 = r2.languages;
|
|
106
118
|
return r2.userLanguage || (t2 && t2.length ? t2[0] : r2.language);
|
|
107
119
|
}
|
|
108
120
|
}
|
|
109
|
-
function a$
|
|
121
|
+
function a$3() {
|
|
110
122
|
try {
|
|
111
123
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
112
124
|
} catch (e2) {
|
|
@@ -115,7 +127,7 @@ function a$5() {
|
|
|
115
127
|
function s(r2) {
|
|
116
128
|
return function(e2) {
|
|
117
129
|
for (var r3, t2 = /* @__PURE__ */ Object.create(null), o2 = /([^&=]+)=?([^&]*)/g; r3 = o2.exec(e2); ) {
|
|
118
|
-
var a2 = n$
|
|
130
|
+
var a2 = n$1(r3[1]), i2 = n$1(r3[2]);
|
|
119
131
|
a2.substring(a2.length - 2) === "[]" ? (t2[a2 = a2.substring(0, a2.length - 2)] || (t2[a2] = [])).push(i2) : t2[a2] = i2 === "" || i2;
|
|
120
132
|
}
|
|
121
133
|
for (var u2 in t2) {
|
|
@@ -130,7 +142,7 @@ function s(r2) {
|
|
|
130
142
|
var t2 = r3.match(/\?(.*)/);
|
|
131
143
|
return t2 && t2[1] ? t2[1].split("#")[0] : "";
|
|
132
144
|
}
|
|
133
|
-
return $$
|
|
145
|
+
return $$1 && window.location.search.substring(1);
|
|
134
146
|
}(r2));
|
|
135
147
|
}
|
|
136
148
|
function m(e2, r2, t2) {
|
|
@@ -149,3244 +161,989 @@ function y$1() {
|
|
|
149
161
|
}
|
|
150
162
|
return e2;
|
|
151
163
|
}
|
|
152
|
-
var
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
F$3.versions != null && F$3.versions.node != null;
|
|
156
|
-
typeof Deno != "undefined" && Deno.core !== void 0;
|
|
157
|
-
$$4 && window.name === "nodejs" || typeof navigator != "undefined" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
158
|
-
function M$4(n2, t2) {
|
|
159
|
-
return t2.charAt(0)[n2]() + t2.slice(1);
|
|
160
|
-
}
|
|
161
|
-
var U$3 = M$4.bind(null, "toUpperCase"), H$4 = M$4.bind(null, "toLowerCase");
|
|
162
|
-
function J$3(n2) {
|
|
163
|
-
return Y$3(n2) ? U$3("null") : typeof n2 == "object" ? yn$3(n2) : Object.prototype.toString.call(n2).slice(8, -1);
|
|
164
|
-
}
|
|
165
|
-
function R$3(n2, t2) {
|
|
166
|
-
t2 === void 0 && (t2 = true);
|
|
167
|
-
var e2 = J$3(n2);
|
|
168
|
-
return t2 ? H$4(e2) : e2;
|
|
169
|
-
}
|
|
170
|
-
function V$3(n2, t2) {
|
|
171
|
-
return typeof t2 === n2;
|
|
172
|
-
}
|
|
173
|
-
var W$3 = V$3.bind(null, "function"), q$3 = V$3.bind(null, "string");
|
|
174
|
-
V$3.bind(null, "undefined");
|
|
175
|
-
V$3.bind(null, "boolean");
|
|
176
|
-
V$3.bind(null, "symbol");
|
|
177
|
-
function Y$3(n2) {
|
|
178
|
-
return n2 === null;
|
|
179
|
-
}
|
|
180
|
-
function nn$3(n2) {
|
|
181
|
-
return R$3(n2) === "number" && !isNaN(n2);
|
|
164
|
+
var l = "global", o = j$1 + "global" + j$1, n = typeof self === o$2 && self.self === self && self || typeof global === o$2 && global.global === global && global || void 0;
|
|
165
|
+
function a$2(t2) {
|
|
166
|
+
return n[o][t2];
|
|
182
167
|
}
|
|
183
|
-
function
|
|
184
|
-
return
|
|
168
|
+
function f(t2, e2) {
|
|
169
|
+
return n[o][t2] = e2;
|
|
185
170
|
}
|
|
186
|
-
function
|
|
187
|
-
|
|
171
|
+
function i$2(t2) {
|
|
172
|
+
delete n[o][t2];
|
|
188
173
|
}
|
|
189
|
-
function
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (hn$3(t2))
|
|
196
|
-
for (; t2; ) {
|
|
197
|
-
if (R$3(t2) === e2)
|
|
198
|
-
return true;
|
|
199
|
-
t2 = Object.getPrototypeOf(t2);
|
|
174
|
+
function u$1(t2, e2, r2) {
|
|
175
|
+
var l2;
|
|
176
|
+
try {
|
|
177
|
+
if (b$2(t2)) {
|
|
178
|
+
var o2 = window[t2];
|
|
179
|
+
l2 = o2[e2].bind(o2);
|
|
200
180
|
}
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
On$3.bind(null, TypeError);
|
|
204
|
-
On$3.bind(null, SyntaxError);
|
|
205
|
-
function $n$3(n2, t2) {
|
|
206
|
-
var e2 = n2 instanceof Element || n2 instanceof HTMLDocument;
|
|
207
|
-
return e2 && t2 ? Tn$3(n2, t2) : e2;
|
|
208
|
-
}
|
|
209
|
-
function Tn$3(n2, t2) {
|
|
210
|
-
return t2 === void 0 && (t2 = ""), n2 && n2.nodeName === t2.toUpperCase();
|
|
211
|
-
}
|
|
212
|
-
function _n$3(n2) {
|
|
213
|
-
var t2 = [].slice.call(arguments, 1);
|
|
214
|
-
return function() {
|
|
215
|
-
return n2.apply(void 0, [].slice.call(arguments).concat(t2));
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
_n$3($n$3, "form");
|
|
219
|
-
_n$3($n$3, "button");
|
|
220
|
-
_n$3($n$3, "input");
|
|
221
|
-
_n$3($n$3, "select");
|
|
222
|
-
var o$6 = j$3 + "global" + j$3, n$4 = typeof self === o$7 && self.self === self && self || typeof global === o$7 && global.global === global && global || void 0;
|
|
223
|
-
function a$4(t2) {
|
|
224
|
-
return n$4[o$6][t2];
|
|
225
|
-
}
|
|
226
|
-
function f$4(t2, e2) {
|
|
227
|
-
return n$4[o$6][t2] = e2;
|
|
228
|
-
}
|
|
229
|
-
function i$4(t2) {
|
|
230
|
-
delete n$4[o$6][t2];
|
|
231
|
-
}
|
|
232
|
-
n$4[o$6] || (n$4[o$6] = {});
|
|
233
|
-
var n$3, f$3 = "any", l$1 = "*", p = "__", h$1 = typeof process != "undefined" ? process : {};
|
|
234
|
-
((n$3 = h$1.env) == null ? void 0 : n$3.NODE_ENV) || "";
|
|
235
|
-
var z = typeof window != "undefined";
|
|
236
|
-
h$1.versions != null && h$1.versions.node != null;
|
|
237
|
-
typeof Deno != "undefined" && Deno.core !== void 0;
|
|
238
|
-
z && window.name === "nodejs" || typeof navigator != "undefined" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
239
|
-
function C$1(n2, e2) {
|
|
240
|
-
return typeof e2 === n2;
|
|
241
|
-
}
|
|
242
|
-
var _ = C$1.bind(null, "function"), L$1 = C$1.bind(null, "string"), $$3 = C$1.bind(null, "undefined"), x$1 = C$1.bind(null, "boolean");
|
|
243
|
-
function G(n2) {
|
|
244
|
-
return Object.prototype.toString.call(n2) === "[object Array]";
|
|
245
|
-
}
|
|
246
|
-
function H$3(n2) {
|
|
247
|
-
return n2 && (typeof n2 == "object" || n2 !== null);
|
|
248
|
-
}
|
|
249
|
-
function M$3(n2) {
|
|
250
|
-
if (!H$3(n2))
|
|
251
|
-
return false;
|
|
252
|
-
for (var e2 = n2; Object.getPrototypeOf(e2) !== null; )
|
|
253
|
-
e2 = Object.getPrototypeOf(e2);
|
|
254
|
-
return Object.getPrototypeOf(n2) === e2;
|
|
255
|
-
}
|
|
256
|
-
function _arrayLikeToArray(arr, len) {
|
|
257
|
-
if (len == null || len > arr.length)
|
|
258
|
-
len = arr.length;
|
|
259
|
-
for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) {
|
|
260
|
-
arr2[i2] = arr[i2];
|
|
181
|
+
} catch (t3) {
|
|
261
182
|
}
|
|
262
|
-
return
|
|
263
|
-
}
|
|
264
|
-
function _arrayWithoutHoles(arr) {
|
|
265
|
-
if (Array.isArray(arr))
|
|
266
|
-
return _arrayLikeToArray(arr);
|
|
267
|
-
}
|
|
268
|
-
function _iterableToArray(iter) {
|
|
269
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
270
|
-
return Array.from(iter);
|
|
271
|
-
}
|
|
272
|
-
function _unsupportedIterableToArray(o2, minLen) {
|
|
273
|
-
if (!o2)
|
|
274
|
-
return;
|
|
275
|
-
if (typeof o2 === "string")
|
|
276
|
-
return _arrayLikeToArray(o2, minLen);
|
|
277
|
-
var n2 = Object.prototype.toString.call(o2).slice(8, -1);
|
|
278
|
-
if (n2 === "Object" && o2.constructor)
|
|
279
|
-
n2 = o2.constructor.name;
|
|
280
|
-
if (n2 === "Map" || n2 === "Set")
|
|
281
|
-
return Array.from(o2);
|
|
282
|
-
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2))
|
|
283
|
-
return _arrayLikeToArray(o2, minLen);
|
|
284
|
-
}
|
|
285
|
-
function _nonIterableSpread() {
|
|
286
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
287
|
-
}
|
|
288
|
-
function _toConsumableArray(arr) {
|
|
289
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
290
|
-
}
|
|
291
|
-
function _typeof(obj) {
|
|
292
|
-
"@babel/helpers - typeof";
|
|
293
|
-
return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
|
|
294
|
-
return typeof obj2;
|
|
295
|
-
} : function(obj2) {
|
|
296
|
-
return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
297
|
-
}, _typeof(obj);
|
|
183
|
+
return l2 || r2;
|
|
298
184
|
}
|
|
299
|
-
|
|
185
|
+
n[o] || (n[o] = {});
|
|
186
|
+
var c$1 = {};
|
|
187
|
+
function b$2(t2) {
|
|
188
|
+
if (typeof c$1[t2] !== e)
|
|
189
|
+
return c$1[t2];
|
|
300
190
|
try {
|
|
301
|
-
var
|
|
302
|
-
|
|
303
|
-
} catch (
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
191
|
+
var e$1 = window[t2];
|
|
192
|
+
e$1.setItem(e, e), e$1.removeItem(e);
|
|
193
|
+
} catch (e2) {
|
|
194
|
+
return c$1[t2] = false;
|
|
195
|
+
}
|
|
196
|
+
return c$1[t2] = true;
|
|
197
|
+
}
|
|
198
|
+
function v() {
|
|
199
|
+
return v = Object.assign || function(e2) {
|
|
200
|
+
for (var n2 = 1; n2 < arguments.length; n2++) {
|
|
201
|
+
var t2 = arguments[n2];
|
|
202
|
+
for (var r2 in t2)
|
|
203
|
+
Object.prototype.hasOwnProperty.call(t2, r2) && (e2[r2] = t2[r2]);
|
|
204
|
+
}
|
|
205
|
+
return e2;
|
|
206
|
+
}, v.apply(this, arguments);
|
|
207
|
+
}
|
|
208
|
+
var y = "function", b$1 = "undefined", I$1 = "@@redux/" + Math.random().toString(36), w = /* @__PURE__ */ function() {
|
|
209
|
+
return typeof Symbol === y && Symbol.observable || "@@observable";
|
|
210
|
+
}(), E$1 = " != " + y;
|
|
211
|
+
function P(e2, n2, t2) {
|
|
212
|
+
var r2;
|
|
213
|
+
if (typeof n2 === y && typeof t2 === b$1 && (t2 = n2, n2 = void 0), typeof t2 !== b$1) {
|
|
214
|
+
if (typeof t2 !== y)
|
|
215
|
+
throw new Error("enhancer" + E$1);
|
|
216
|
+
return t2(P)(e2, n2);
|
|
217
|
+
}
|
|
218
|
+
if (typeof e2 !== y)
|
|
219
|
+
throw new Error("reducer" + E$1);
|
|
220
|
+
var i2 = e2, a2 = n2, o2 = [], u2 = o2, c2 = false;
|
|
221
|
+
function s2() {
|
|
222
|
+
u2 === o2 && (u2 = o2.slice());
|
|
223
|
+
}
|
|
224
|
+
function f2() {
|
|
225
|
+
return a2;
|
|
226
|
+
}
|
|
227
|
+
function d2(e3) {
|
|
228
|
+
if (typeof e3 !== y)
|
|
229
|
+
throw new Error("Listener" + E$1);
|
|
230
|
+
var n3 = true;
|
|
231
|
+
return s2(), u2.push(e3), function() {
|
|
232
|
+
if (n3) {
|
|
233
|
+
n3 = false, s2();
|
|
234
|
+
var t3 = u2.indexOf(e3);
|
|
235
|
+
u2.splice(t3, 1);
|
|
323
236
|
}
|
|
324
|
-
|
|
325
|
-
});
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
function _defineProperty$2(obj, key, value) {
|
|
329
|
-
if (key in obj) {
|
|
330
|
-
Object.defineProperty(obj, key, {
|
|
331
|
-
value,
|
|
332
|
-
enumerable: true,
|
|
333
|
-
configurable: true,
|
|
334
|
-
writable: true
|
|
335
|
-
});
|
|
336
|
-
} else {
|
|
337
|
-
obj[key] = value;
|
|
338
|
-
}
|
|
339
|
-
return obj;
|
|
340
|
-
}
|
|
341
|
-
function ownKeys$1(object, enumerableOnly) {
|
|
342
|
-
var keys = Object.keys(object);
|
|
343
|
-
if (Object.getOwnPropertySymbols) {
|
|
344
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
345
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
346
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
347
|
-
})), keys.push.apply(keys, symbols);
|
|
348
|
-
}
|
|
349
|
-
return keys;
|
|
350
|
-
}
|
|
351
|
-
function _objectSpread2$1(target) {
|
|
352
|
-
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
353
|
-
var source = arguments[i2] != null ? arguments[i2] : {};
|
|
354
|
-
i2 % 2 ? ownKeys$1(Object(source), true).forEach(function(key) {
|
|
355
|
-
_defineProperty$2(target, key, source[key]);
|
|
356
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function(key) {
|
|
357
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
358
|
-
});
|
|
237
|
+
};
|
|
359
238
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
(
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
var undefined$1;
|
|
368
|
-
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
369
|
-
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
370
|
-
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
371
|
-
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
372
|
-
function define(obj, key, value) {
|
|
373
|
-
Object.defineProperty(obj, key, {
|
|
374
|
-
value,
|
|
375
|
-
enumerable: true,
|
|
376
|
-
configurable: true,
|
|
377
|
-
writable: true
|
|
378
|
-
});
|
|
379
|
-
return obj[key];
|
|
380
|
-
}
|
|
239
|
+
function p(e3) {
|
|
240
|
+
if (!on(e3))
|
|
241
|
+
throw new Error("Act != obj");
|
|
242
|
+
if (typeof e3.type === b$1)
|
|
243
|
+
throw new Error("ActType " + b$1);
|
|
244
|
+
if (c2)
|
|
245
|
+
throw new Error("Dispatch in reducer");
|
|
381
246
|
try {
|
|
382
|
-
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
type: "throw",
|
|
405
|
-
arg: err
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
var GenStateSuspendedStart = "suspendedStart";
|
|
410
|
-
var GenStateSuspendedYield = "suspendedYield";
|
|
411
|
-
var GenStateExecuting = "executing";
|
|
412
|
-
var GenStateCompleted = "completed";
|
|
413
|
-
var ContinueSentinel = {};
|
|
414
|
-
function Generator() {
|
|
415
|
-
}
|
|
416
|
-
function GeneratorFunction() {
|
|
417
|
-
}
|
|
418
|
-
function GeneratorFunctionPrototype() {
|
|
419
|
-
}
|
|
420
|
-
var IteratorPrototype = {};
|
|
421
|
-
define(IteratorPrototype, iteratorSymbol, function() {
|
|
247
|
+
c2 = true, a2 = i2(a2, e3);
|
|
248
|
+
} finally {
|
|
249
|
+
c2 = false;
|
|
250
|
+
}
|
|
251
|
+
for (var n3 = o2 = u2, t3 = 0; t3 < n3.length; t3++)
|
|
252
|
+
(0, n3[t3])();
|
|
253
|
+
return e3;
|
|
254
|
+
}
|
|
255
|
+
return p({ type: "@@redux/INIT" }), (r2 = { dispatch: p, subscribe: d2, getState: f2, replaceReducer: function(e3) {
|
|
256
|
+
if (typeof e3 !== y)
|
|
257
|
+
throw new Error("next reducer" + E$1);
|
|
258
|
+
i2 = e3, p({ type: "@@redux/INIT" });
|
|
259
|
+
} })[w] = function() {
|
|
260
|
+
var e3, n3 = d2;
|
|
261
|
+
return (e3 = { subscribe: function(e4) {
|
|
262
|
+
if (typeof e4 != "object")
|
|
263
|
+
throw new TypeError("Observer != obj");
|
|
264
|
+
function t3() {
|
|
265
|
+
e4.next && e4.next(f2());
|
|
266
|
+
}
|
|
267
|
+
return t3(), { unsubscribe: n3(t3) };
|
|
268
|
+
} })[w] = function() {
|
|
422
269
|
return this;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
return this._invoke(method, arg);
|
|
438
|
-
});
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
exports.isGeneratorFunction = function(genFun) {
|
|
442
|
-
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
443
|
-
return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
444
|
-
};
|
|
445
|
-
exports.mark = function(genFun) {
|
|
446
|
-
if (Object.setPrototypeOf) {
|
|
447
|
-
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
448
|
-
} else {
|
|
449
|
-
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
450
|
-
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
451
|
-
}
|
|
452
|
-
genFun.prototype = Object.create(Gp);
|
|
453
|
-
return genFun;
|
|
454
|
-
};
|
|
455
|
-
exports.awrap = function(arg) {
|
|
456
|
-
return {
|
|
457
|
-
__await: arg
|
|
458
|
-
};
|
|
270
|
+
}, e3;
|
|
271
|
+
}, r2;
|
|
272
|
+
}
|
|
273
|
+
function S(e2, n2) {
|
|
274
|
+
var t2 = n2 && n2.type;
|
|
275
|
+
return "action " + (t2 && t2.toString() || "?") + "reducer " + e2 + " returns " + b$1;
|
|
276
|
+
}
|
|
277
|
+
function N$1() {
|
|
278
|
+
var e2 = [].slice.call(arguments);
|
|
279
|
+
return e2.length === 0 ? function(e3) {
|
|
280
|
+
return e3;
|
|
281
|
+
} : e2.length === 1 ? e2[0] : e2.reduce(function(e3, n2) {
|
|
282
|
+
return function() {
|
|
283
|
+
return e3(n2.apply(void 0, [].slice.call(arguments)));
|
|
459
284
|
};
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
invoke("throw", err, resolve, reject);
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
return PromiseImpl.resolve(value).then(function(unwrapped) {
|
|
476
|
-
result.value = unwrapped;
|
|
477
|
-
resolve(result);
|
|
478
|
-
}, function(error) {
|
|
479
|
-
return invoke("throw", error, resolve, reject);
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
var previousPromise;
|
|
484
|
-
function enqueue(method, arg) {
|
|
485
|
-
function callInvokeWithMethodAndArg() {
|
|
486
|
-
return new PromiseImpl(function(resolve, reject) {
|
|
487
|
-
invoke(method, arg, resolve, reject);
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
491
|
-
}
|
|
492
|
-
this._invoke = enqueue;
|
|
493
|
-
}
|
|
494
|
-
defineIteratorMethods(AsyncIterator.prototype);
|
|
495
|
-
define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
|
|
496
|
-
return this;
|
|
497
|
-
});
|
|
498
|
-
exports.AsyncIterator = AsyncIterator;
|
|
499
|
-
exports.async = function(innerFn, outerFn, self2, tryLocsList, PromiseImpl) {
|
|
500
|
-
if (PromiseImpl === void 0)
|
|
501
|
-
PromiseImpl = Promise;
|
|
502
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self2, tryLocsList), PromiseImpl);
|
|
503
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
|
|
504
|
-
return result.done ? result.value : iter.next();
|
|
505
|
-
});
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
function O$1() {
|
|
288
|
+
var e2 = arguments;
|
|
289
|
+
return function(n2) {
|
|
290
|
+
return function(t2, r2, i2) {
|
|
291
|
+
var a2, o2 = n2(t2, r2, i2), u2 = o2.dispatch, c2 = { getState: o2.getState, dispatch: function(e3) {
|
|
292
|
+
return u2(e3);
|
|
293
|
+
} };
|
|
294
|
+
return a2 = [].slice.call(e2).map(function(e3) {
|
|
295
|
+
return e3(c2);
|
|
296
|
+
}), v({}, o2, { dispatch: u2 = N$1.apply(void 0, a2)(o2.dispatch) });
|
|
506
297
|
};
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
var
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
}
|
|
538
|
-
context2.dispatchException(context2.arg);
|
|
539
|
-
} else if (context2.method === "return") {
|
|
540
|
-
context2.abrupt("return", context2.arg);
|
|
541
|
-
}
|
|
542
|
-
state = GenStateExecuting;
|
|
543
|
-
var record = tryCatch(innerFn, self2, context2);
|
|
544
|
-
if (record.type === "normal") {
|
|
545
|
-
state = context2.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
546
|
-
if (record.arg === ContinueSentinel) {
|
|
547
|
-
continue;
|
|
548
|
-
}
|
|
549
|
-
return {
|
|
550
|
-
value: record.arg,
|
|
551
|
-
done: context2.done
|
|
552
|
-
};
|
|
553
|
-
} else if (record.type === "throw") {
|
|
554
|
-
state = GenStateCompleted;
|
|
555
|
-
context2.method = "throw";
|
|
556
|
-
context2.arg = record.arg;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
function maybeInvokeDelegate(delegate, context2) {
|
|
562
|
-
var method = delegate.iterator[context2.method];
|
|
563
|
-
if (method === undefined$1) {
|
|
564
|
-
context2.delegate = null;
|
|
565
|
-
if (context2.method === "throw") {
|
|
566
|
-
if (delegate.iterator["return"]) {
|
|
567
|
-
context2.method = "return";
|
|
568
|
-
context2.arg = undefined$1;
|
|
569
|
-
maybeInvokeDelegate(delegate, context2);
|
|
570
|
-
if (context2.method === "throw") {
|
|
571
|
-
return ContinueSentinel;
|
|
572
|
-
}
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
var A$1 = j$1 + "anon_id", _ = j$1 + "user_id", x$1 = j$1 + "user_traits", j = "userId", T = "anonymousId", z = ["bootstrap", "params", "campaign", "initializeStart", "initialize", "initializeEnd", "ready", "resetStart", "reset", "resetEnd", "pageStart", "page", "pageEnd", "pageAborted", "trackStart", "track", "trackEnd", "trackAborted", "identifyStart", "identify", "identifyEnd", "identifyAborted", "userIdChanged", "registerPlugins", "enablePlugin", "disablePlugin", "online", "offline", "setItemStart", "setItem", "setItemEnd", "setItemAborted", "removeItemStart", "removeItem", "removeItemEnd", "removeItemAborted"], M = ["name", "EVENTS", "config", "loaded"], q = z.reduce(function(e2, n2) {
|
|
301
|
+
return e2[n2] = n2, e2;
|
|
302
|
+
}, { registerPluginType: function(e2) {
|
|
303
|
+
return "registerPlugin:" + e2;
|
|
304
|
+
}, pluginReadyType: function(e2) {
|
|
305
|
+
return "ready:" + e2;
|
|
306
|
+
} }), U = /^utm_/, V = /^an_prop_/, L$1 = /^an_trait_/;
|
|
307
|
+
function C$1(e2) {
|
|
308
|
+
var n2 = e2.storage.setItem;
|
|
309
|
+
return function(t2) {
|
|
310
|
+
return function(r2) {
|
|
311
|
+
return function(i2) {
|
|
312
|
+
if (i2.type === q.bootstrap) {
|
|
313
|
+
var a2 = i2.params, o2 = i2.user, u2 = i2.persistedUser, c2 = i2.initialUser, s2 = u2.userId === o2.userId;
|
|
314
|
+
u2.anonymousId !== o2.anonymousId && n2(A$1, o2.anonymousId), s2 || n2(_, o2.userId), c2.traits && n2(x$1, v({}, s2 && u2.traits ? u2.traits : {}, c2.traits));
|
|
315
|
+
var l2 = Object.keys(i2.params);
|
|
316
|
+
if (l2.length) {
|
|
317
|
+
var f2 = a2.an_uid, d2 = a2.an_event, p = l2.reduce(function(e3, n3) {
|
|
318
|
+
if (n3.match(U) || n3.match(/^(d|g)clid/)) {
|
|
319
|
+
var t3 = n3.replace(U, "");
|
|
320
|
+
e3.campaign[t3 === "campaign" ? "name" : t3] = a2[n3];
|
|
321
|
+
}
|
|
322
|
+
return n3.match(V) && (e3.props[n3.replace(V, "")] = a2[n3]), n3.match(L$1) && (e3.traits[n3.replace(L$1, "")] = a2[n3]), e3;
|
|
323
|
+
}, { campaign: {}, props: {}, traits: {} });
|
|
324
|
+
t2.dispatch(v({ type: q.params, raw: a2 }, p, f2 ? { userId: f2 } : {})), f2 && setTimeout(function() {
|
|
325
|
+
return e2.identify(f2, p.traits);
|
|
326
|
+
}, 0), d2 && setTimeout(function() {
|
|
327
|
+
return e2.track(d2, p.props);
|
|
328
|
+
}, 0), Object.keys(p.campaign).length && t2.dispatch({ type: q.campaign, campaign: p.campaign });
|
|
573
329
|
}
|
|
574
|
-
context2.method = "throw";
|
|
575
|
-
context2.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
576
|
-
}
|
|
577
|
-
return ContinueSentinel;
|
|
578
|
-
}
|
|
579
|
-
var record = tryCatch(method, delegate.iterator, context2.arg);
|
|
580
|
-
if (record.type === "throw") {
|
|
581
|
-
context2.method = "throw";
|
|
582
|
-
context2.arg = record.arg;
|
|
583
|
-
context2.delegate = null;
|
|
584
|
-
return ContinueSentinel;
|
|
585
|
-
}
|
|
586
|
-
var info = record.arg;
|
|
587
|
-
if (!info) {
|
|
588
|
-
context2.method = "throw";
|
|
589
|
-
context2.arg = new TypeError("iterator result is not an object");
|
|
590
|
-
context2.delegate = null;
|
|
591
|
-
return ContinueSentinel;
|
|
592
|
-
}
|
|
593
|
-
if (info.done) {
|
|
594
|
-
context2[delegate.resultName] = info.value;
|
|
595
|
-
context2.next = delegate.nextLoc;
|
|
596
|
-
if (context2.method !== "return") {
|
|
597
|
-
context2.method = "next";
|
|
598
|
-
context2.arg = undefined$1;
|
|
599
330
|
}
|
|
600
|
-
|
|
601
|
-
return info;
|
|
602
|
-
}
|
|
603
|
-
context2.delegate = null;
|
|
604
|
-
return ContinueSentinel;
|
|
605
|
-
}
|
|
606
|
-
defineIteratorMethods(Gp);
|
|
607
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
608
|
-
define(Gp, iteratorSymbol, function() {
|
|
609
|
-
return this;
|
|
610
|
-
});
|
|
611
|
-
define(Gp, "toString", function() {
|
|
612
|
-
return "[object Generator]";
|
|
613
|
-
});
|
|
614
|
-
function pushTryEntry(locs) {
|
|
615
|
-
var entry = {
|
|
616
|
-
tryLoc: locs[0]
|
|
331
|
+
return r2(i2);
|
|
617
332
|
};
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
this.reset(true);
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function R(e2) {
|
|
337
|
+
return function(n2, t2) {
|
|
338
|
+
if (n2 === void 0 && (n2 = {}), t2 === void 0 && (t2 = {}), t2.type === q.setItemEnd) {
|
|
339
|
+
if (t2.key === A$1)
|
|
340
|
+
return v({}, n2, { anonymousId: t2.value });
|
|
341
|
+
if (t2.key === _)
|
|
342
|
+
return v({}, n2, { userId: t2.value });
|
|
343
|
+
}
|
|
344
|
+
switch (t2.type) {
|
|
345
|
+
case q.identify:
|
|
346
|
+
return Object.assign({}, n2, { userId: t2.userId, traits: v({}, n2.traits, t2.traits) });
|
|
347
|
+
case q.reset:
|
|
348
|
+
return [_, A$1, x$1].forEach(function(n3) {
|
|
349
|
+
e2.removeItem(n3);
|
|
350
|
+
}), Object.assign({}, n2, { userId: null, anonymousId: null, traits: {} });
|
|
351
|
+
default:
|
|
352
|
+
return n2;
|
|
639
353
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
function $(e2) {
|
|
357
|
+
return { userId: e2.getItem(_), anonymousId: e2.getItem(A$1), traits: e2.getItem(x$1) };
|
|
358
|
+
}
|
|
359
|
+
var D = function(e2) {
|
|
360
|
+
return j$1 + "TEMP" + j$1 + e2;
|
|
361
|
+
};
|
|
362
|
+
function B(n2) {
|
|
363
|
+
var t2 = n2.storage, r2 = t2.setItem, i2 = t2.removeItem, a2 = t2.getItem;
|
|
364
|
+
return function(n3) {
|
|
365
|
+
return function(t3) {
|
|
366
|
+
return function(u2) {
|
|
367
|
+
var c2 = u2.userId, s2 = u2.traits, l2 = u2.options;
|
|
368
|
+
if (u2.type === q.reset && ([_, x$1, A$1].forEach(function(e2) {
|
|
369
|
+
i2(e2);
|
|
370
|
+
}), [j, T, "traits"].forEach(function(e2) {
|
|
371
|
+
i$2(D(e2));
|
|
372
|
+
})), u2.type === q.identify) {
|
|
373
|
+
a2(A$1) || r2(A$1, y$1());
|
|
374
|
+
var f2 = a2(_), d2 = a2(x$1) || {};
|
|
375
|
+
f2 && f2 !== c2 && n3.dispatch({ type: q.userIdChanged, old: { userId: f2, traits: d2 }, new: { userId: c2, traits: s2 }, options: l2 }), c2 && r2(_, c2), s2 && r2(x$1, v({}, d2, s2));
|
|
654
376
|
}
|
|
655
|
-
|
|
656
|
-
return next;
|
|
377
|
+
return t3(u2);
|
|
657
378
|
};
|
|
658
379
|
};
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
var X = {};
|
|
383
|
+
function J$1(e2, n2) {
|
|
384
|
+
X[e2] && W$1(X[e2]) && (X[e2](n2), delete X[e2]);
|
|
385
|
+
}
|
|
386
|
+
function W(e2, n2, t2) {
|
|
387
|
+
return new Promise(function(r2, i2) {
|
|
388
|
+
return n2() ? r2(e2) : t2 < 1 ? i2(v({}, e2, { queue: true })) : new Promise(function(e3) {
|
|
389
|
+
return setTimeout(e3, 10);
|
|
390
|
+
}).then(function(a2) {
|
|
391
|
+
return W(e2, n2, t2 - 10).then(r2, i2);
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
function H(e2, n2, t2) {
|
|
396
|
+
var r2 = n2(), i2 = e2.getState(), a2 = i2.plugins, o2 = i2.queue, u2 = i2.user;
|
|
397
|
+
if (!i2.context.offline && o2 && o2.actions && o2.actions.length) {
|
|
398
|
+
var c2 = o2.actions.reduce(function(e3, n3, t3) {
|
|
399
|
+
return a2[n3.plugin].loaded ? (e3.process.push(n3), e3.processIndex.push(t3)) : (e3.requeue.push(n3), e3.requeueIndex.push(t3)), e3;
|
|
400
|
+
}, { processIndex: [], process: [], requeue: [], requeueIndex: [] });
|
|
401
|
+
if (c2.processIndex && c2.processIndex.length) {
|
|
402
|
+
c2.processIndex.forEach(function(n3) {
|
|
403
|
+
var i3 = o2.actions[n3], c3 = i3.plugin, s3 = i3.payload.type, l2 = r2[c3][s3];
|
|
404
|
+
if (l2 && W$1(l2)) {
|
|
405
|
+
var f2 = function(e3, n4) {
|
|
406
|
+
return e3 === void 0 && (e3 = {}), n4 === void 0 && (n4 = {}), [j, T].reduce(function(t3, r3) {
|
|
407
|
+
return e3.hasOwnProperty(r3) && n4[r3] && n4[r3] !== e3[r3] && (t3[r3] = n4[r3]), t3;
|
|
408
|
+
}, e3);
|
|
409
|
+
}(i3.payload, u2);
|
|
410
|
+
l2({ payload: f2, config: a2[c3].config, instance: t2 });
|
|
411
|
+
var p = s3 + ":" + c3;
|
|
412
|
+
e2.dispatch(v({}, f2, { type: p, _: { called: p, from: "queueDrain" } }));
|
|
682
413
|
}
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
};
|
|
414
|
+
});
|
|
415
|
+
var s2 = o2.actions.filter(function(e3, n3) {
|
|
416
|
+
return !~c2.processIndex.indexOf(n3);
|
|
417
|
+
});
|
|
418
|
+
o2.actions = s2;
|
|
687
419
|
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
var F$1 = function(e2) {
|
|
423
|
+
var n2 = e2.data, t2 = e2.action, r2 = e2.instance, i2 = e2.state, a2 = e2.allPlugins, o2 = e2.allMatches, u2 = e2.store, c2 = e2.EVENTS;
|
|
424
|
+
try {
|
|
425
|
+
var s2 = i2.plugins, f2 = i2.context, p = t2.type, m2 = p.match(G$1), g2 = n2.exact.map(function(e3) {
|
|
426
|
+
return e3.pluginName;
|
|
427
|
+
});
|
|
428
|
+
m2 && (g2 = o2.during.map(function(e3) {
|
|
429
|
+
return e3.pluginName;
|
|
430
|
+
}));
|
|
431
|
+
var h2 = function(e3, n3) {
|
|
432
|
+
return function(t3, r3, i3) {
|
|
433
|
+
var a3 = r3.config, o3 = r3.name, u3 = o3 + "." + t3.type;
|
|
434
|
+
i3 && (u3 = i3.event);
|
|
435
|
+
var c3 = t3.type.match(G$1) ? function(e4, n4, t4, r4, i4) {
|
|
436
|
+
return function(a4, o4) {
|
|
437
|
+
var u4 = r4 ? r4.name : e4, c4 = o4 && ie(o4) ? o4 : t4;
|
|
438
|
+
if (r4 && (!(c4 = o4 && ie(o4) ? o4 : [e4]).includes(e4) || c4.length !== 1))
|
|
439
|
+
throw new Error("Method " + n4 + " can only abort " + e4 + " plugin. " + JSON.stringify(c4) + " input valid");
|
|
440
|
+
return v({}, i4, { abort: { reason: a4, plugins: c4, caller: n4, _: u4 } });
|
|
441
|
+
};
|
|
442
|
+
}(o3, u3, n3, i3, t3) : function(e4, n4) {
|
|
443
|
+
return function() {
|
|
444
|
+
throw new Error(e4.type + " action not cancellable. Remove abort in " + n4);
|
|
445
|
+
};
|
|
446
|
+
}(t3, u3);
|
|
447
|
+
return { payload: ue(t3), instance: e3, config: a3 || {}, abort: c3 };
|
|
693
448
|
};
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
this.method = "next";
|
|
704
|
-
this.arg = undefined$1;
|
|
705
|
-
this.tryEntries.forEach(resetTryEntry);
|
|
706
|
-
if (!skipTempReset) {
|
|
707
|
-
for (var name in this) {
|
|
708
|
-
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
|
709
|
-
this[name] = undefined$1;
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
},
|
|
714
|
-
stop: function() {
|
|
715
|
-
this.done = true;
|
|
716
|
-
var rootEntry = this.tryEntries[0];
|
|
717
|
-
var rootRecord = rootEntry.completion;
|
|
718
|
-
if (rootRecord.type === "throw") {
|
|
719
|
-
throw rootRecord.arg;
|
|
449
|
+
}(r2, g2), y2 = n2.exact.reduce(function(e3, n3) {
|
|
450
|
+
var t3 = n3.pluginName, r3 = n3.methodName, i3 = false;
|
|
451
|
+
return r3.match(/^initialize/) || r3.match(/^reset/) || (i3 = !s2[t3].loaded), f2.offline && r3.match(/^(page|track|identify)/) && (i3 = true), e3["" + t3] = i3, e3;
|
|
452
|
+
}, {});
|
|
453
|
+
return Promise.resolve(n2.exact.reduce(function(e3, i3, o3) {
|
|
454
|
+
var u3 = i3.pluginName;
|
|
455
|
+
return Promise.resolve(e3).then(function(e4) {
|
|
456
|
+
function i4() {
|
|
457
|
+
return Promise.resolve(e4);
|
|
720
458
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
459
|
+
var o4 = function() {
|
|
460
|
+
if (n2.namespaced && n2.namespaced[u3])
|
|
461
|
+
return Promise.resolve(n2.namespaced[u3].reduce(function(e5, n3, t3) {
|
|
462
|
+
return Promise.resolve(e5).then(function(e6) {
|
|
463
|
+
return n3.method && W$1(n3.method) ? (function(e7, n4) {
|
|
464
|
+
var t5 = oe(e7);
|
|
465
|
+
if (t5 && t5.name === n4) {
|
|
466
|
+
var r3 = oe(t5.method);
|
|
467
|
+
throw new Error([n4 + " plugin is calling method " + e7, "Plugins cant call self", "Use " + t5.method + " " + (r3 ? "or " + r3.method : "") + " in " + n4 + " plugin insteadof " + e7].join("\n"));
|
|
468
|
+
}
|
|
469
|
+
}(n3.methodName, n3.pluginName), Promise.resolve(n3.method({ payload: e6, instance: r2, abort: (t4 = e6, i5 = u3, o5 = n3.pluginName, function(e7, n4) {
|
|
470
|
+
return v({}, t4, { abort: { reason: e7, plugins: n4 || [i5], caller: p, from: o5 || i5 } });
|
|
471
|
+
}), config: Z(n3.pluginName, s2, a2), plugins: s2 })).then(function(n4) {
|
|
472
|
+
var t5 = on(n4) ? n4 : {};
|
|
473
|
+
return Promise.resolve(v({}, e6, t5));
|
|
474
|
+
})) : e6;
|
|
475
|
+
var t4, i5, o5;
|
|
476
|
+
});
|
|
477
|
+
}, Promise.resolve(t2))).then(function(n3) {
|
|
478
|
+
e4[u3] = n3;
|
|
479
|
+
});
|
|
480
|
+
e4[u3] = t2;
|
|
481
|
+
}();
|
|
482
|
+
return o4 && o4.then ? o4.then(i4) : i4();
|
|
483
|
+
});
|
|
484
|
+
}, Promise.resolve({}))).then(function(e3) {
|
|
485
|
+
return Promise.resolve(n2.exact.reduce(function(t3, i3, o3) {
|
|
486
|
+
try {
|
|
487
|
+
var c3 = n2.exact.length === o3 + 1, f3 = i3.pluginName, d2 = a2[f3];
|
|
488
|
+
return Promise.resolve(t3).then(function(n3) {
|
|
489
|
+
var t4 = e3[f3] ? e3[f3] : {};
|
|
490
|
+
if (m2 && (t4 = n3), te(t4, f3))
|
|
491
|
+
return Y({ data: t4, method: p, instance: r2, pluginName: f3, store: u2 }), Promise.resolve(n3);
|
|
492
|
+
if (te(n3, f3))
|
|
493
|
+
return c3 && Y({ data: n3, method: p, instance: r2, store: u2 }), Promise.resolve(n3);
|
|
494
|
+
if (y2.hasOwnProperty(f3) && y2[f3] === true)
|
|
495
|
+
return u2.dispatch({ type: "queue", plugin: f3, payload: t4, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(n3);
|
|
496
|
+
var i4 = h2(e3[f3], a2[f3]);
|
|
497
|
+
return Promise.resolve(d2[p]({ abort: i4.abort, payload: t4, instance: r2, config: Z(f3, s2, a2), plugins: s2 })).then(function(i5) {
|
|
498
|
+
var a3 = on(i5) ? i5 : {}, o4 = v({}, n3, a3), c4 = e3[f3];
|
|
499
|
+
if (te(c4, f3))
|
|
500
|
+
Y({ data: c4, method: p, instance: r2, pluginName: f3, store: u2 });
|
|
501
|
+
else {
|
|
502
|
+
var s3 = p + ":" + f3;
|
|
503
|
+
(s3.match(/:/g) || []).length < 2 && !p.match(K) && !p.match(Q) && r2.dispatch(v({}, m2 ? o4 : t4, { type: s3, _: { called: s3, from: "submethod" } }));
|
|
504
|
+
}
|
|
505
|
+
return Promise.resolve(o4);
|
|
506
|
+
});
|
|
507
|
+
});
|
|
508
|
+
} catch (e4) {
|
|
509
|
+
return Promise.reject(e4);
|
|
726
510
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
context2.method = "next";
|
|
734
|
-
context2.arg = undefined$1;
|
|
735
|
-
}
|
|
736
|
-
return !!caught;
|
|
511
|
+
}, Promise.resolve(t2))).then(function(e4) {
|
|
512
|
+
if (!(p.match(G$1) || p.match(/^registerPlugin/) || p.match(Q) || p.match(K) || p.match(/^params/) || p.match(/^userIdChanged/))) {
|
|
513
|
+
if (c2.plugins.includes(p), e4._ && e4._.originalAction === p)
|
|
514
|
+
return e4;
|
|
515
|
+
var t3 = v({}, e4, { _: { originalAction: e4.type, called: e4.type, from: "engineEnd" } });
|
|
516
|
+
re(e4, n2.exact.length) && !p.match(/End$/) && (t3 = v({}, t3, { type: e4.type + "Aborted" })), u2.dispatch(t3);
|
|
737
517
|
}
|
|
738
|
-
|
|
739
|
-
var entry = this.tryEntries[i2];
|
|
740
|
-
var record = entry.completion;
|
|
741
|
-
if (entry.tryLoc === "root") {
|
|
742
|
-
return handle("end");
|
|
743
|
-
}
|
|
744
|
-
if (entry.tryLoc <= this.prev) {
|
|
745
|
-
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
746
|
-
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
747
|
-
if (hasCatch && hasFinally) {
|
|
748
|
-
if (this.prev < entry.catchLoc) {
|
|
749
|
-
return handle(entry.catchLoc, true);
|
|
750
|
-
} else if (this.prev < entry.finallyLoc) {
|
|
751
|
-
return handle(entry.finallyLoc);
|
|
752
|
-
}
|
|
753
|
-
} else if (hasCatch) {
|
|
754
|
-
if (this.prev < entry.catchLoc) {
|
|
755
|
-
return handle(entry.catchLoc, true);
|
|
756
|
-
}
|
|
757
|
-
} else if (hasFinally) {
|
|
758
|
-
if (this.prev < entry.finallyLoc) {
|
|
759
|
-
return handle(entry.finallyLoc);
|
|
760
|
-
}
|
|
761
|
-
} else {
|
|
762
|
-
throw new Error("try statement without catch or finally");
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
},
|
|
767
|
-
abrupt: function(type, arg) {
|
|
768
|
-
for (var i2 = this.tryEntries.length - 1; i2 >= 0; --i2) {
|
|
769
|
-
var entry = this.tryEntries[i2];
|
|
770
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
771
|
-
var finallyEntry = entry;
|
|
772
|
-
break;
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
776
|
-
finallyEntry = null;
|
|
777
|
-
}
|
|
778
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
779
|
-
record.type = type;
|
|
780
|
-
record.arg = arg;
|
|
781
|
-
if (finallyEntry) {
|
|
782
|
-
this.method = "next";
|
|
783
|
-
this.next = finallyEntry.finallyLoc;
|
|
784
|
-
return ContinueSentinel;
|
|
785
|
-
}
|
|
786
|
-
return this.complete(record);
|
|
787
|
-
},
|
|
788
|
-
complete: function(record, afterLoc) {
|
|
789
|
-
if (record.type === "throw") {
|
|
790
|
-
throw record.arg;
|
|
791
|
-
}
|
|
792
|
-
if (record.type === "break" || record.type === "continue") {
|
|
793
|
-
this.next = record.arg;
|
|
794
|
-
} else if (record.type === "return") {
|
|
795
|
-
this.rval = this.arg = record.arg;
|
|
796
|
-
this.method = "return";
|
|
797
|
-
this.next = "end";
|
|
798
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
799
|
-
this.next = afterLoc;
|
|
800
|
-
}
|
|
801
|
-
return ContinueSentinel;
|
|
802
|
-
},
|
|
803
|
-
finish: function(finallyLoc) {
|
|
804
|
-
for (var i2 = this.tryEntries.length - 1; i2 >= 0; --i2) {
|
|
805
|
-
var entry = this.tryEntries[i2];
|
|
806
|
-
if (entry.finallyLoc === finallyLoc) {
|
|
807
|
-
this.complete(entry.completion, entry.afterLoc);
|
|
808
|
-
resetTryEntry(entry);
|
|
809
|
-
return ContinueSentinel;
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
},
|
|
813
|
-
"catch": function(tryLoc) {
|
|
814
|
-
for (var i2 = this.tryEntries.length - 1; i2 >= 0; --i2) {
|
|
815
|
-
var entry = this.tryEntries[i2];
|
|
816
|
-
if (entry.tryLoc === tryLoc) {
|
|
817
|
-
var record = entry.completion;
|
|
818
|
-
if (record.type === "throw") {
|
|
819
|
-
var thrown = record.arg;
|
|
820
|
-
resetTryEntry(entry);
|
|
821
|
-
}
|
|
822
|
-
return thrown;
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
throw new Error("illegal catch attempt");
|
|
826
|
-
},
|
|
827
|
-
delegateYield: function(iterable, resultName, nextLoc) {
|
|
828
|
-
this.delegate = {
|
|
829
|
-
iterator: values(iterable),
|
|
830
|
-
resultName,
|
|
831
|
-
nextLoc
|
|
832
|
-
};
|
|
833
|
-
if (this.method === "next") {
|
|
834
|
-
this.arg = undefined$1;
|
|
835
|
-
}
|
|
836
|
-
return ContinueSentinel;
|
|
837
|
-
}
|
|
838
|
-
};
|
|
839
|
-
return exports;
|
|
840
|
-
}(module.exports);
|
|
841
|
-
try {
|
|
842
|
-
regeneratorRuntime = runtime2;
|
|
843
|
-
} catch (accidentalStrictMode) {
|
|
844
|
-
if (typeof globalThis === "object") {
|
|
845
|
-
globalThis.regeneratorRuntime = runtime2;
|
|
846
|
-
} else {
|
|
847
|
-
Function("r", "regeneratorRuntime = r")(runtime2);
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
})(runtime);
|
|
851
|
-
var regenerator = runtime.exports;
|
|
852
|
-
var FUNC = "function";
|
|
853
|
-
var UNDEF = "undefined";
|
|
854
|
-
var REDUCER = "reducer";
|
|
855
|
-
var base = "@@redux/";
|
|
856
|
-
var ACTION_INIT = base + "INIT";
|
|
857
|
-
var ACTION_TEST = base + Math.random().toString(36);
|
|
858
|
-
var $$observable = /* @__PURE__ */ function() {
|
|
859
|
-
return (typeof Symbol === "undefined" ? "undefined" : _typeof(Symbol)) === FUNC && Symbol.observable || "@@observable";
|
|
860
|
-
}();
|
|
861
|
-
var msg = " != " + FUNC;
|
|
862
|
-
function createStore(reducer, preloadedState, enhancer) {
|
|
863
|
-
if (_typeof(preloadedState) === FUNC && _typeof(enhancer) === UNDEF) {
|
|
864
|
-
enhancer = preloadedState;
|
|
865
|
-
preloadedState = void 0;
|
|
866
|
-
}
|
|
867
|
-
if (_typeof(enhancer) !== UNDEF) {
|
|
868
|
-
if (_typeof(enhancer) !== FUNC) {
|
|
869
|
-
throw new Error("enhancer" + msg);
|
|
870
|
-
}
|
|
871
|
-
return enhancer(createStore)(reducer, preloadedState);
|
|
872
|
-
}
|
|
873
|
-
if (_typeof(reducer) !== FUNC) {
|
|
874
|
-
throw new Error(REDUCER + msg);
|
|
875
|
-
}
|
|
876
|
-
var currentReducer = reducer;
|
|
877
|
-
var currentState = preloadedState;
|
|
878
|
-
var currentListeners = [];
|
|
879
|
-
var nextListeners = currentListeners;
|
|
880
|
-
var isDispatching = false;
|
|
881
|
-
function ensureCanMutateNextListeners() {
|
|
882
|
-
if (nextListeners === currentListeners) {
|
|
883
|
-
nextListeners = currentListeners.slice();
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
function getState() {
|
|
887
|
-
return currentState;
|
|
888
|
-
}
|
|
889
|
-
function subscribe(listener) {
|
|
890
|
-
if (_typeof(listener) !== FUNC) {
|
|
891
|
-
throw new Error("Listener" + msg);
|
|
892
|
-
}
|
|
893
|
-
var isSubscribed = true;
|
|
894
|
-
ensureCanMutateNextListeners();
|
|
895
|
-
nextListeners.push(listener);
|
|
896
|
-
return function unsubscribe() {
|
|
897
|
-
if (!isSubscribed) {
|
|
898
|
-
return;
|
|
899
|
-
}
|
|
900
|
-
isSubscribed = false;
|
|
901
|
-
ensureCanMutateNextListeners();
|
|
902
|
-
var index2 = nextListeners.indexOf(listener);
|
|
903
|
-
nextListeners.splice(index2, 1);
|
|
904
|
-
};
|
|
905
|
-
}
|
|
906
|
-
function dispatch(action) {
|
|
907
|
-
if (!M$3(action)) {
|
|
908
|
-
throw new Error("Act != obj");
|
|
909
|
-
}
|
|
910
|
-
if (_typeof(action.type) === UNDEF) {
|
|
911
|
-
throw new Error("ActType " + UNDEF);
|
|
912
|
-
}
|
|
913
|
-
if (isDispatching) {
|
|
914
|
-
throw new Error("Dispatch in " + REDUCER);
|
|
915
|
-
}
|
|
916
|
-
try {
|
|
917
|
-
isDispatching = true;
|
|
918
|
-
currentState = currentReducer(currentState, action);
|
|
919
|
-
} finally {
|
|
920
|
-
isDispatching = false;
|
|
921
|
-
}
|
|
922
|
-
var listeners = currentListeners = nextListeners;
|
|
923
|
-
for (var i2 = 0; i2 < listeners.length; i2++) {
|
|
924
|
-
var listener = listeners[i2];
|
|
925
|
-
listener();
|
|
926
|
-
}
|
|
927
|
-
return action;
|
|
928
|
-
}
|
|
929
|
-
function replaceReducer(nextReducer) {
|
|
930
|
-
if (_typeof(nextReducer) !== FUNC) {
|
|
931
|
-
throw new Error("next " + REDUCER + msg);
|
|
932
|
-
}
|
|
933
|
-
currentReducer = nextReducer;
|
|
934
|
-
dispatch({
|
|
935
|
-
type: ACTION_INIT
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
function observable() {
|
|
939
|
-
var outerSubscribe = subscribe;
|
|
940
|
-
return _defineProperty$2({
|
|
941
|
-
subscribe: function subscribe2(observer) {
|
|
942
|
-
if (_typeof(observer) !== "object") {
|
|
943
|
-
throw new TypeError("Observer != obj");
|
|
944
|
-
}
|
|
945
|
-
function observeState() {
|
|
946
|
-
if (observer.next) {
|
|
947
|
-
observer.next(getState());
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
observeState();
|
|
951
|
-
var unsubscribe = outerSubscribe(observeState);
|
|
952
|
-
return {
|
|
953
|
-
unsubscribe
|
|
954
|
-
};
|
|
955
|
-
}
|
|
956
|
-
}, $$observable, function() {
|
|
957
|
-
return this;
|
|
958
|
-
});
|
|
959
|
-
}
|
|
960
|
-
dispatch({
|
|
961
|
-
type: ACTION_INIT
|
|
962
|
-
});
|
|
963
|
-
return _defineProperty$2({
|
|
964
|
-
dispatch,
|
|
965
|
-
subscribe,
|
|
966
|
-
getState,
|
|
967
|
-
replaceReducer
|
|
968
|
-
}, $$observable, observable);
|
|
969
|
-
}
|
|
970
|
-
function getUndefinedStateErrorMessage(key, action) {
|
|
971
|
-
var actionType = action && action.type;
|
|
972
|
-
var actionName = actionType && actionType.toString() || "?";
|
|
973
|
-
return "action " + actionName + REDUCER + " " + key + " returns " + UNDEF;
|
|
974
|
-
}
|
|
975
|
-
function assertReducerShape(reducers) {
|
|
976
|
-
Object.keys(reducers).forEach(function(key) {
|
|
977
|
-
var reducer = reducers[key];
|
|
978
|
-
var initialState2 = reducer(void 0, {
|
|
979
|
-
type: ACTION_INIT
|
|
980
|
-
});
|
|
981
|
-
if (_typeof(initialState2) === UNDEF || _typeof(reducer(void 0, {
|
|
982
|
-
type: ACTION_TEST
|
|
983
|
-
})) === UNDEF) {
|
|
984
|
-
throw new Error(REDUCER + " " + key + " " + UNDEF);
|
|
985
|
-
}
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
|
-
function combineReducers(reducers) {
|
|
989
|
-
var reducerKeys = Object.keys(reducers);
|
|
990
|
-
var finalReducers = {};
|
|
991
|
-
for (var i2 = 0; i2 < reducerKeys.length; i2++) {
|
|
992
|
-
var key = reducerKeys[i2];
|
|
993
|
-
if (_typeof(reducers[key]) === FUNC) {
|
|
994
|
-
finalReducers[key] = reducers[key];
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
var finalReducerKeys = Object.keys(finalReducers);
|
|
998
|
-
var shapeAssertionError;
|
|
999
|
-
try {
|
|
1000
|
-
assertReducerShape(finalReducers);
|
|
1001
|
-
} catch (e2) {
|
|
1002
|
-
shapeAssertionError = e2;
|
|
1003
|
-
}
|
|
1004
|
-
return function combination() {
|
|
1005
|
-
var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1006
|
-
var action = arguments.length > 1 ? arguments[1] : void 0;
|
|
1007
|
-
if (shapeAssertionError) {
|
|
1008
|
-
throw shapeAssertionError;
|
|
1009
|
-
}
|
|
1010
|
-
var hasChanged = false;
|
|
1011
|
-
var nextState = {};
|
|
1012
|
-
for (var _i = 0; _i < finalReducerKeys.length; _i++) {
|
|
1013
|
-
var _key = finalReducerKeys[_i];
|
|
1014
|
-
var reducer = finalReducers[_key];
|
|
1015
|
-
var previousStateForKey = state[_key];
|
|
1016
|
-
var nextStateForKey = reducer(previousStateForKey, action);
|
|
1017
|
-
if (_typeof(nextStateForKey) === UNDEF) {
|
|
1018
|
-
var errorMessage = getUndefinedStateErrorMessage(_key, action);
|
|
1019
|
-
throw new Error(errorMessage);
|
|
1020
|
-
}
|
|
1021
|
-
nextState[_key] = nextStateForKey;
|
|
1022
|
-
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
1023
|
-
}
|
|
1024
|
-
return hasChanged ? nextState : state;
|
|
1025
|
-
};
|
|
1026
|
-
}
|
|
1027
|
-
function compose() {
|
|
1028
|
-
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1029
|
-
funcs[_key] = arguments[_key];
|
|
1030
|
-
}
|
|
1031
|
-
if (funcs.length === 0) {
|
|
1032
|
-
return function(arg) {
|
|
1033
|
-
return arg;
|
|
1034
|
-
};
|
|
1035
|
-
}
|
|
1036
|
-
if (funcs.length === 1) {
|
|
1037
|
-
return funcs[0];
|
|
1038
|
-
}
|
|
1039
|
-
return funcs.reduce(function(a2, b2) {
|
|
1040
|
-
return function() {
|
|
1041
|
-
return a2(b2.apply(void 0, arguments));
|
|
1042
|
-
};
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
function applyMiddleware() {
|
|
1046
|
-
for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1047
|
-
middlewares[_key] = arguments[_key];
|
|
1048
|
-
}
|
|
1049
|
-
return function(createStore2) {
|
|
1050
|
-
return function(reducer, preloadedState, enhancer) {
|
|
1051
|
-
var store = createStore2(reducer, preloadedState, enhancer);
|
|
1052
|
-
var _dispatch = store.dispatch;
|
|
1053
|
-
var chain = [];
|
|
1054
|
-
var middlewareAPI = {
|
|
1055
|
-
getState: store.getState,
|
|
1056
|
-
dispatch: function dispatch(action) {
|
|
1057
|
-
return _dispatch(action);
|
|
1058
|
-
}
|
|
1059
|
-
};
|
|
1060
|
-
chain = middlewares.map(function(middleware) {
|
|
1061
|
-
return middleware(middlewareAPI);
|
|
1062
|
-
});
|
|
1063
|
-
_dispatch = compose.apply(void 0, _toConsumableArray(chain))(store.dispatch);
|
|
1064
|
-
return _objectSpread2$1(_objectSpread2$1({}, store), {}, {
|
|
1065
|
-
dispatch: _dispatch
|
|
1066
|
-
});
|
|
1067
|
-
};
|
|
1068
|
-
};
|
|
1069
|
-
}
|
|
1070
|
-
var ANON_ID = p + "anon_id";
|
|
1071
|
-
var USER_ID = p + "user_id";
|
|
1072
|
-
var USER_TRAITS = p + "user_traits";
|
|
1073
|
-
var LIB_NAME = "analytics";
|
|
1074
|
-
var ID = "userId";
|
|
1075
|
-
var ANONID = "anonymousId";
|
|
1076
|
-
var ERROR_URL = "https://lytics.dev/errors/";
|
|
1077
|
-
var coreEvents = [
|
|
1078
|
-
"bootstrap",
|
|
1079
|
-
"params",
|
|
1080
|
-
"campaign",
|
|
1081
|
-
"initializeStart",
|
|
1082
|
-
"initialize",
|
|
1083
|
-
"initializeEnd",
|
|
1084
|
-
"ready",
|
|
1085
|
-
"resetStart",
|
|
1086
|
-
"reset",
|
|
1087
|
-
"resetEnd",
|
|
1088
|
-
"pageStart",
|
|
1089
|
-
"page",
|
|
1090
|
-
"pageEnd",
|
|
1091
|
-
"pageAborted",
|
|
1092
|
-
"trackStart",
|
|
1093
|
-
"track",
|
|
1094
|
-
"trackEnd",
|
|
1095
|
-
"trackAborted",
|
|
1096
|
-
"identifyStart",
|
|
1097
|
-
"identify",
|
|
1098
|
-
"identifyEnd",
|
|
1099
|
-
"identifyAborted",
|
|
1100
|
-
"userIdChanged",
|
|
1101
|
-
"registerPlugins",
|
|
1102
|
-
"enablePlugin",
|
|
1103
|
-
"disablePlugin",
|
|
1104
|
-
"online",
|
|
1105
|
-
"offline",
|
|
1106
|
-
"setItemStart",
|
|
1107
|
-
"setItem",
|
|
1108
|
-
"setItemEnd",
|
|
1109
|
-
"setItemAborted",
|
|
1110
|
-
"removeItemStart",
|
|
1111
|
-
"removeItem",
|
|
1112
|
-
"removeItemEnd",
|
|
1113
|
-
"removeItemAborted"
|
|
1114
|
-
];
|
|
1115
|
-
var nonEvents = ["name", "EVENTS", "config", "loaded"];
|
|
1116
|
-
var pluginEvents = {
|
|
1117
|
-
registerPluginType: function registerPluginType(name) {
|
|
1118
|
-
return "registerPlugin:".concat(name);
|
|
1119
|
-
},
|
|
1120
|
-
pluginReadyType: function pluginReadyType(name) {
|
|
1121
|
-
return "ready:".concat(name);
|
|
1122
|
-
}
|
|
1123
|
-
};
|
|
1124
|
-
var EVENTS = coreEvents.reduce(function(acc, curr) {
|
|
1125
|
-
acc[curr] = curr;
|
|
1126
|
-
return acc;
|
|
1127
|
-
}, pluginEvents);
|
|
1128
|
-
var EVENTS$1 = EVENTS;
|
|
1129
|
-
function isReservedAction(type) {
|
|
1130
|
-
return coreEvents.includes(type);
|
|
1131
|
-
}
|
|
1132
|
-
var utmRegex = /^utm_/;
|
|
1133
|
-
var propRegex = /^an_prop_/;
|
|
1134
|
-
var traitRegex = /^an_trait_/;
|
|
1135
|
-
function initializeMiddleware(instance) {
|
|
1136
|
-
var setItem = instance.storage.setItem;
|
|
1137
|
-
return function(store) {
|
|
1138
|
-
return function(next) {
|
|
1139
|
-
return function(action) {
|
|
1140
|
-
if (action.type === EVENTS$1.bootstrap) {
|
|
1141
|
-
var params = action.params, user = action.user, persistedUser = action.persistedUser, initialUser = action.initialUser;
|
|
1142
|
-
var isKnownId = persistedUser.userId === user.userId;
|
|
1143
|
-
if (persistedUser.anonymousId !== user.anonymousId) {
|
|
1144
|
-
setItem(ANON_ID, user.anonymousId);
|
|
1145
|
-
}
|
|
1146
|
-
if (!isKnownId) {
|
|
1147
|
-
setItem(USER_ID, user.userId);
|
|
1148
|
-
}
|
|
1149
|
-
if (initialUser.traits) {
|
|
1150
|
-
setItem(USER_TRAITS, _objectSpread2$1(_objectSpread2$1({}, isKnownId && persistedUser.traits ? persistedUser.traits : {}), initialUser.traits));
|
|
1151
|
-
}
|
|
1152
|
-
var paramsArray = Object.keys(action.params);
|
|
1153
|
-
if (paramsArray.length) {
|
|
1154
|
-
var an_uid = params.an_uid, an_event = params.an_event;
|
|
1155
|
-
var groupedParams = paramsArray.reduce(function(acc, key) {
|
|
1156
|
-
if (key.match(utmRegex) || key.match(/^(d|g)clid/)) {
|
|
1157
|
-
var cleanName = key.replace(utmRegex, "");
|
|
1158
|
-
var keyName = cleanName === "campaign" ? "name" : cleanName;
|
|
1159
|
-
acc.campaign[keyName] = params[key];
|
|
1160
|
-
}
|
|
1161
|
-
if (key.match(propRegex)) {
|
|
1162
|
-
acc.props[key.replace(propRegex, "")] = params[key];
|
|
1163
|
-
}
|
|
1164
|
-
if (key.match(traitRegex)) {
|
|
1165
|
-
acc.traits[key.replace(traitRegex, "")] = params[key];
|
|
1166
|
-
}
|
|
1167
|
-
return acc;
|
|
1168
|
-
}, {
|
|
1169
|
-
campaign: {},
|
|
1170
|
-
props: {},
|
|
1171
|
-
traits: {}
|
|
1172
|
-
});
|
|
1173
|
-
store.dispatch(_objectSpread2$1(_objectSpread2$1({
|
|
1174
|
-
type: EVENTS$1.params,
|
|
1175
|
-
raw: params
|
|
1176
|
-
}, groupedParams), an_uid ? {
|
|
1177
|
-
userId: an_uid
|
|
1178
|
-
} : {}));
|
|
1179
|
-
if (an_uid) {
|
|
1180
|
-
setTimeout(function() {
|
|
1181
|
-
return instance.identify(an_uid, groupedParams.traits);
|
|
1182
|
-
}, 0);
|
|
1183
|
-
}
|
|
1184
|
-
if (an_event) {
|
|
1185
|
-
setTimeout(function() {
|
|
1186
|
-
return instance.track(an_event, groupedParams.props);
|
|
1187
|
-
}, 0);
|
|
1188
|
-
}
|
|
1189
|
-
if (Object.keys(groupedParams.campaign).length) {
|
|
1190
|
-
store.dispatch({
|
|
1191
|
-
type: EVENTS$1.campaign,
|
|
1192
|
-
campaign: groupedParams.campaign
|
|
1193
|
-
});
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
return next(action);
|
|
1198
|
-
};
|
|
1199
|
-
};
|
|
1200
|
-
};
|
|
1201
|
-
}
|
|
1202
|
-
function userReducer(storage2) {
|
|
1203
|
-
return function user() {
|
|
1204
|
-
var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1205
|
-
var action = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1206
|
-
if (action.type === EVENTS$1.setItemEnd) {
|
|
1207
|
-
if (action.key === ANON_ID) {
|
|
1208
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), {
|
|
1209
|
-
anonymousId: action.value
|
|
1210
|
-
});
|
|
1211
|
-
}
|
|
1212
|
-
if (action.key === USER_ID) {
|
|
1213
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), {
|
|
1214
|
-
userId: action.value
|
|
1215
|
-
});
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
switch (action.type) {
|
|
1219
|
-
case EVENTS$1.identify:
|
|
1220
|
-
return Object.assign({}, state, {
|
|
1221
|
-
userId: action.userId,
|
|
1222
|
-
traits: _objectSpread2$1(_objectSpread2$1({}, state.traits), action.traits)
|
|
1223
|
-
});
|
|
1224
|
-
case EVENTS$1.reset:
|
|
1225
|
-
[USER_ID, ANON_ID, USER_TRAITS].forEach(function(key) {
|
|
1226
|
-
storage2.removeItem(key);
|
|
1227
|
-
});
|
|
1228
|
-
return Object.assign({}, state, {
|
|
1229
|
-
userId: null,
|
|
1230
|
-
anonymousId: null,
|
|
1231
|
-
traits: {}
|
|
1232
|
-
});
|
|
1233
|
-
default:
|
|
1234
|
-
return state;
|
|
1235
|
-
}
|
|
1236
|
-
};
|
|
1237
|
-
}
|
|
1238
|
-
function getPersistedUserData(storage2) {
|
|
1239
|
-
return {
|
|
1240
|
-
userId: storage2.getItem(USER_ID),
|
|
1241
|
-
anonymousId: storage2.getItem(ANON_ID),
|
|
1242
|
-
traits: storage2.getItem(USER_TRAITS)
|
|
1243
|
-
};
|
|
1244
|
-
}
|
|
1245
|
-
var tempKey = function tempKey2(key) {
|
|
1246
|
-
return p + "TEMP" + p + key;
|
|
1247
|
-
};
|
|
1248
|
-
function getUserPropFunc(storage2) {
|
|
1249
|
-
return function getUserProp(key, instance, payload) {
|
|
1250
|
-
var currentId = instance.getState("user")[key];
|
|
1251
|
-
if (currentId) {
|
|
1252
|
-
return currentId;
|
|
1253
|
-
}
|
|
1254
|
-
if (payload && M$3(payload) && payload[key]) {
|
|
1255
|
-
return payload[key];
|
|
1256
|
-
}
|
|
1257
|
-
var persistedInfo = getPersistedUserData(storage2)[key];
|
|
1258
|
-
if (persistedInfo) {
|
|
1259
|
-
return persistedInfo;
|
|
1260
|
-
}
|
|
1261
|
-
return a$4(tempKey(key)) || null;
|
|
1262
|
-
};
|
|
1263
|
-
}
|
|
1264
|
-
function identifyMiddleware(instance) {
|
|
1265
|
-
var _instance$storage = instance.storage, setItem = _instance$storage.setItem, removeItem = _instance$storage.removeItem, getItem = _instance$storage.getItem;
|
|
1266
|
-
return function(store) {
|
|
1267
|
-
return function(next) {
|
|
1268
|
-
return function(action) {
|
|
1269
|
-
var userId = action.userId, traits = action.traits, options = action.options;
|
|
1270
|
-
if (action.type === EVENTS$1.reset) {
|
|
1271
|
-
[USER_ID, USER_TRAITS, ANON_ID].forEach(function(key) {
|
|
1272
|
-
removeItem(key);
|
|
1273
|
-
});
|
|
1274
|
-
[ID, ANONID, "traits"].forEach(function(key) {
|
|
1275
|
-
i$4(tempKey(key));
|
|
1276
|
-
});
|
|
1277
|
-
}
|
|
1278
|
-
if (action.type === EVENTS$1.identify) {
|
|
1279
|
-
if (!getItem(ANON_ID)) {
|
|
1280
|
-
setItem(ANON_ID, y$1());
|
|
1281
|
-
}
|
|
1282
|
-
var currentId = getItem(USER_ID);
|
|
1283
|
-
var currentTraits = getItem(USER_TRAITS) || {};
|
|
1284
|
-
if (currentId && currentId !== userId) {
|
|
1285
|
-
store.dispatch({
|
|
1286
|
-
type: EVENTS$1.userIdChanged,
|
|
1287
|
-
old: {
|
|
1288
|
-
userId: currentId,
|
|
1289
|
-
traits: currentTraits
|
|
1290
|
-
},
|
|
1291
|
-
"new": {
|
|
1292
|
-
userId,
|
|
1293
|
-
traits
|
|
1294
|
-
},
|
|
1295
|
-
options
|
|
1296
|
-
});
|
|
1297
|
-
}
|
|
1298
|
-
if (userId) {
|
|
1299
|
-
setItem(USER_ID, userId);
|
|
1300
|
-
}
|
|
1301
|
-
if (traits) {
|
|
1302
|
-
setItem(USER_TRAITS, _objectSpread2$1(_objectSpread2$1({}, currentTraits), traits));
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
return next(action);
|
|
1306
|
-
};
|
|
1307
|
-
};
|
|
1308
|
-
};
|
|
1309
|
-
}
|
|
1310
|
-
var stack = {};
|
|
1311
|
-
function runCallback(id, payload) {
|
|
1312
|
-
if (stack[id] && _(stack[id])) {
|
|
1313
|
-
stack[id](payload);
|
|
1314
|
-
delete stack[id];
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
function waitForReady(data, predicate, timeout) {
|
|
1318
|
-
return new Promise(function(resolve, reject) {
|
|
1319
|
-
if (predicate()) {
|
|
1320
|
-
return resolve(data);
|
|
1321
|
-
}
|
|
1322
|
-
if (timeout < 1) {
|
|
1323
|
-
return reject(_objectSpread2$1(_objectSpread2$1({}, data), {}, {
|
|
1324
|
-
queue: true
|
|
1325
|
-
}));
|
|
1326
|
-
}
|
|
1327
|
-
return pause(10).then(function(_2) {
|
|
1328
|
-
return waitForReady(data, predicate, timeout - 10).then(resolve, reject);
|
|
1329
|
-
});
|
|
1330
|
-
});
|
|
1331
|
-
}
|
|
1332
|
-
function pause(ms) {
|
|
1333
|
-
return new Promise(function(resolve) {
|
|
1334
|
-
return setTimeout(resolve, ms);
|
|
1335
|
-
});
|
|
1336
|
-
}
|
|
1337
|
-
function processQueue(store, getPlugins, instance) {
|
|
1338
|
-
var pluginMethods = getPlugins();
|
|
1339
|
-
var _store$getState = store.getState(), plugins = _store$getState.plugins, context2 = _store$getState.context, queue = _store$getState.queue, user = _store$getState.user;
|
|
1340
|
-
var isOnline = !context2.offline;
|
|
1341
|
-
if (isOnline && queue && queue.actions && queue.actions.length) {
|
|
1342
|
-
var pipeline = queue.actions.reduce(function(acc, item, index2) {
|
|
1343
|
-
var isLoaded = plugins[item.plugin].loaded;
|
|
1344
|
-
if (isLoaded) {
|
|
1345
|
-
acc.process.push(item);
|
|
1346
|
-
acc.processIndex.push(index2);
|
|
1347
|
-
} else {
|
|
1348
|
-
acc.requeue.push(item);
|
|
1349
|
-
acc.requeueIndex.push(index2);
|
|
1350
|
-
}
|
|
1351
|
-
return acc;
|
|
1352
|
-
}, {
|
|
1353
|
-
processIndex: [],
|
|
1354
|
-
process: [],
|
|
1355
|
-
requeue: [],
|
|
1356
|
-
requeueIndex: []
|
|
1357
|
-
});
|
|
1358
|
-
if (pipeline.processIndex && pipeline.processIndex.length) {
|
|
1359
|
-
pipeline.processIndex.forEach(function(i2) {
|
|
1360
|
-
var processAction = queue.actions[i2];
|
|
1361
|
-
var currentPlugin = processAction.plugin;
|
|
1362
|
-
var currentMethod = processAction.payload.type;
|
|
1363
|
-
var method = pluginMethods[currentPlugin][currentMethod];
|
|
1364
|
-
if (method && _(method)) {
|
|
1365
|
-
var enrichedPayload = enrich(processAction.payload, user);
|
|
1366
|
-
method({
|
|
1367
|
-
payload: enrichedPayload,
|
|
1368
|
-
config: plugins[currentPlugin].config,
|
|
1369
|
-
instance
|
|
1370
|
-
});
|
|
1371
|
-
var pluginEvent = "".concat(currentMethod, ":").concat(currentPlugin);
|
|
1372
|
-
store.dispatch(_objectSpread2$1(_objectSpread2$1({}, enrichedPayload), {}, {
|
|
1373
|
-
type: pluginEvent,
|
|
1374
|
-
_: {
|
|
1375
|
-
called: pluginEvent,
|
|
1376
|
-
from: "queueDrain"
|
|
1377
|
-
}
|
|
1378
|
-
}));
|
|
1379
|
-
}
|
|
1380
|
-
});
|
|
1381
|
-
var reQueueActions = queue.actions.filter(function(value, index2) {
|
|
1382
|
-
return !~pipeline.processIndex.indexOf(index2);
|
|
1383
|
-
});
|
|
1384
|
-
queue.actions = reQueueActions;
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
function heartBeat(store, getPlugins, instance) {
|
|
1389
|
-
return setInterval(function() {
|
|
1390
|
-
return processQueue(store, getPlugins, instance);
|
|
1391
|
-
}, 3e3);
|
|
1392
|
-
}
|
|
1393
|
-
function enrich() {
|
|
1394
|
-
var payload = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1395
|
-
var user = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1396
|
-
return [ID, ANONID].reduce(function(acc, key) {
|
|
1397
|
-
if (payload.hasOwnProperty(key) && user[key] && user[key] !== payload[key]) {
|
|
1398
|
-
acc[key] = user[key];
|
|
1399
|
-
}
|
|
1400
|
-
return acc;
|
|
1401
|
-
}, payload);
|
|
1402
|
-
}
|
|
1403
|
-
function _arrayWithHoles(arr) {
|
|
1404
|
-
if (Array.isArray(arr))
|
|
1405
|
-
return arr;
|
|
1406
|
-
}
|
|
1407
|
-
function _iterableToArrayLimit(arr, i2) {
|
|
1408
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1409
|
-
if (_i == null)
|
|
1410
|
-
return;
|
|
1411
|
-
var _arr = [];
|
|
1412
|
-
var _n2 = true;
|
|
1413
|
-
var _d = false;
|
|
1414
|
-
var _s, _e;
|
|
1415
|
-
try {
|
|
1416
|
-
for (_i = _i.call(arr); !(_n2 = (_s = _i.next()).done); _n2 = true) {
|
|
1417
|
-
_arr.push(_s.value);
|
|
1418
|
-
if (i2 && _arr.length === i2)
|
|
1419
|
-
break;
|
|
1420
|
-
}
|
|
1421
|
-
} catch (err) {
|
|
1422
|
-
_d = true;
|
|
1423
|
-
_e = err;
|
|
1424
|
-
} finally {
|
|
1425
|
-
try {
|
|
1426
|
-
if (!_n2 && _i["return"] != null)
|
|
1427
|
-
_i["return"]();
|
|
1428
|
-
} finally {
|
|
1429
|
-
if (_d)
|
|
1430
|
-
throw _e;
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
return _arr;
|
|
1434
|
-
}
|
|
1435
|
-
function _nonIterableRest() {
|
|
1436
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1437
|
-
}
|
|
1438
|
-
function _slicedToArray(arr, i2) {
|
|
1439
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i2) || _unsupportedIterableToArray(arr, i2) || _nonIterableRest();
|
|
1440
|
-
}
|
|
1441
|
-
function fitlerDisabledPlugins(allPlugins) {
|
|
1442
|
-
var settings = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1443
|
-
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1444
|
-
return Object.keys(allPlugins).filter(function(name) {
|
|
1445
|
-
var fromCallOptions = options.plugins || {};
|
|
1446
|
-
if (x$1(fromCallOptions[name])) {
|
|
1447
|
-
return fromCallOptions[name];
|
|
1448
|
-
}
|
|
1449
|
-
if (fromCallOptions.all === false) {
|
|
1450
|
-
return false;
|
|
1451
|
-
}
|
|
1452
|
-
if (settings[name] && settings[name].enabled === false) {
|
|
1453
|
-
return false;
|
|
1454
|
-
}
|
|
1455
|
-
return true;
|
|
1456
|
-
}).map(function(name) {
|
|
1457
|
-
return allPlugins[name];
|
|
1458
|
-
});
|
|
1459
|
-
}
|
|
1460
|
-
var endsWithStartRegex = /Start$/;
|
|
1461
|
-
var bootstrapRegex = /^bootstrap/;
|
|
1462
|
-
var readyRegex = /^ready/;
|
|
1463
|
-
function runPlugins(_x, _x2, _x3, _x4, _x5) {
|
|
1464
|
-
return _ref.apply(this, arguments);
|
|
1465
|
-
}
|
|
1466
|
-
function _ref() {
|
|
1467
|
-
_ref = _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee(action, getPlugins, instance, store, eventsInfo) {
|
|
1468
|
-
var pluginObject, originalType, updatedType, state, activePlugins, allActivePluginKeys, allMatches, actionBefore, actionDuring, afterName, actionAfter;
|
|
1469
|
-
return regenerator.wrap(function _callee$(_context) {
|
|
1470
|
-
while (1) {
|
|
1471
|
-
switch (_context.prev = _context.next) {
|
|
1472
|
-
case 0:
|
|
1473
|
-
pluginObject = _(getPlugins) ? getPlugins() : getPlugins;
|
|
1474
|
-
originalType = action.type;
|
|
1475
|
-
updatedType = originalType.replace(endsWithStartRegex, "");
|
|
1476
|
-
if (!(action._ && action._.called)) {
|
|
1477
|
-
_context.next = 5;
|
|
1478
|
-
break;
|
|
1479
|
-
}
|
|
1480
|
-
return _context.abrupt("return", action);
|
|
1481
|
-
case 5:
|
|
1482
|
-
state = instance.getState();
|
|
1483
|
-
activePlugins = fitlerDisabledPlugins(pluginObject, state.plugins, action.options);
|
|
1484
|
-
if (originalType === EVENTS$1.initializeStart && action.fromEnable) {
|
|
1485
|
-
activePlugins = Object.keys(state.plugins).filter(function(name) {
|
|
1486
|
-
var info = state.plugins[name];
|
|
1487
|
-
return action.plugins.includes(name) && !info.initialized;
|
|
1488
|
-
}).map(function(name) {
|
|
1489
|
-
return pluginObject[name];
|
|
1490
|
-
});
|
|
1491
|
-
}
|
|
1492
|
-
allActivePluginKeys = activePlugins.map(function(p2) {
|
|
1493
|
-
return p2.name;
|
|
1494
|
-
});
|
|
1495
|
-
allMatches = getAllMatchingCalls(originalType, activePlugins);
|
|
1496
|
-
_context.next = 12;
|
|
1497
|
-
return processEvent({
|
|
1498
|
-
action,
|
|
1499
|
-
data: {
|
|
1500
|
-
exact: allMatches.before,
|
|
1501
|
-
namespaced: allMatches.beforeNS
|
|
1502
|
-
},
|
|
1503
|
-
state,
|
|
1504
|
-
allPlugins: pluginObject,
|
|
1505
|
-
allMatches,
|
|
1506
|
-
instance,
|
|
1507
|
-
store,
|
|
1508
|
-
EVENTS: eventsInfo
|
|
1509
|
-
});
|
|
1510
|
-
case 12:
|
|
1511
|
-
actionBefore = _context.sent;
|
|
1512
|
-
if (!shouldAbortAll(actionBefore, allActivePluginKeys.length)) {
|
|
1513
|
-
_context.next = 15;
|
|
1514
|
-
break;
|
|
1515
|
-
}
|
|
1516
|
-
return _context.abrupt("return", actionBefore);
|
|
1517
|
-
case 15:
|
|
1518
|
-
if (!(originalType === updatedType)) {
|
|
1519
|
-
_context.next = 19;
|
|
1520
|
-
break;
|
|
1521
|
-
}
|
|
1522
|
-
actionDuring = actionBefore;
|
|
1523
|
-
_context.next = 22;
|
|
1524
|
-
break;
|
|
1525
|
-
case 19:
|
|
1526
|
-
_context.next = 21;
|
|
1527
|
-
return processEvent({
|
|
1528
|
-
action: _objectSpread2$1(_objectSpread2$1({}, actionBefore), {}, {
|
|
1529
|
-
type: updatedType
|
|
1530
|
-
}),
|
|
1531
|
-
data: {
|
|
1532
|
-
exact: allMatches.during,
|
|
1533
|
-
namespaced: allMatches.duringNS
|
|
1534
|
-
},
|
|
1535
|
-
state,
|
|
1536
|
-
allPlugins: pluginObject,
|
|
1537
|
-
allMatches,
|
|
1538
|
-
instance,
|
|
1539
|
-
store,
|
|
1540
|
-
EVENTS: eventsInfo
|
|
1541
|
-
});
|
|
1542
|
-
case 21:
|
|
1543
|
-
actionDuring = _context.sent;
|
|
1544
|
-
case 22:
|
|
1545
|
-
if (!originalType.match(endsWithStartRegex)) {
|
|
1546
|
-
_context.next = 28;
|
|
1547
|
-
break;
|
|
1548
|
-
}
|
|
1549
|
-
afterName = "".concat(updatedType, "End");
|
|
1550
|
-
_context.next = 26;
|
|
1551
|
-
return processEvent({
|
|
1552
|
-
action: _objectSpread2$1(_objectSpread2$1({}, actionDuring), {}, {
|
|
1553
|
-
type: afterName
|
|
1554
|
-
}),
|
|
1555
|
-
data: {
|
|
1556
|
-
exact: allMatches.after,
|
|
1557
|
-
namespaced: allMatches.afterNS
|
|
1558
|
-
},
|
|
1559
|
-
state,
|
|
1560
|
-
allPlugins: pluginObject,
|
|
1561
|
-
allMatches,
|
|
1562
|
-
instance,
|
|
1563
|
-
store,
|
|
1564
|
-
EVENTS: eventsInfo
|
|
1565
|
-
});
|
|
1566
|
-
case 26:
|
|
1567
|
-
actionAfter = _context.sent;
|
|
1568
|
-
if (actionAfter.meta && actionAfter.meta.hasCallback) {
|
|
1569
|
-
runCallback(actionAfter.meta.rid, {
|
|
1570
|
-
payload: actionAfter
|
|
1571
|
-
});
|
|
1572
|
-
}
|
|
1573
|
-
case 28:
|
|
1574
|
-
return _context.abrupt("return", actionBefore);
|
|
1575
|
-
case 29:
|
|
1576
|
-
case "end":
|
|
1577
|
-
return _context.stop();
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
}, _callee);
|
|
1581
|
-
}));
|
|
1582
|
-
return _ref.apply(this, arguments);
|
|
1583
|
-
}
|
|
1584
|
-
function processEvent(_x6) {
|
|
1585
|
-
return _processEvent.apply(this, arguments);
|
|
1586
|
-
}
|
|
1587
|
-
function _processEvent() {
|
|
1588
|
-
_processEvent = _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee5(_ref2) {
|
|
1589
|
-
var data, action, instance, state, allPlugins, allMatches, store, EVENTS2, plugins, context2, method, isStartEvent, abortable, makeArgs, queueData, payloads, resolvedAction, endAction;
|
|
1590
|
-
return regenerator.wrap(function _callee5$(_context5) {
|
|
1591
|
-
while (1) {
|
|
1592
|
-
switch (_context5.prev = _context5.next) {
|
|
1593
|
-
case 0:
|
|
1594
|
-
data = _ref2.data, action = _ref2.action, instance = _ref2.instance, state = _ref2.state, allPlugins = _ref2.allPlugins, allMatches = _ref2.allMatches, store = _ref2.store, EVENTS2 = _ref2.EVENTS;
|
|
1595
|
-
plugins = state.plugins, context2 = state.context;
|
|
1596
|
-
method = action.type;
|
|
1597
|
-
isStartEvent = method.match(endsWithStartRegex);
|
|
1598
|
-
abortable = data.exact.map(function(x2) {
|
|
1599
|
-
return x2.pluginName;
|
|
1600
|
-
});
|
|
1601
|
-
if (isStartEvent) {
|
|
1602
|
-
abortable = allMatches.during.map(function(x2) {
|
|
1603
|
-
return x2.pluginName;
|
|
1604
|
-
});
|
|
1605
|
-
}
|
|
1606
|
-
makeArgs = argumentFactory(instance, abortable);
|
|
1607
|
-
queueData = data.exact.reduce(function(acc, thing) {
|
|
1608
|
-
var pluginName = thing.pluginName, methodName = thing.methodName;
|
|
1609
|
-
var addToQueue = false;
|
|
1610
|
-
if (!methodName.match(/^initialize/) && !methodName.match(/^reset/)) {
|
|
1611
|
-
addToQueue = !plugins[pluginName].loaded;
|
|
1612
|
-
}
|
|
1613
|
-
if (context2.offline && methodName.match(/^(page|track|identify)/)) {
|
|
1614
|
-
addToQueue = true;
|
|
1615
|
-
}
|
|
1616
|
-
acc["".concat(pluginName)] = addToQueue;
|
|
1617
|
-
return acc;
|
|
1618
|
-
}, {});
|
|
1619
|
-
_context5.next = 10;
|
|
1620
|
-
return data.exact.reduce(/* @__PURE__ */ function() {
|
|
1621
|
-
var _ref6 = _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee3(scoped, curr, i2) {
|
|
1622
|
-
var pluginName, curScope, scopedPayload;
|
|
1623
|
-
return regenerator.wrap(function _callee3$(_context3) {
|
|
1624
|
-
while (1) {
|
|
1625
|
-
switch (_context3.prev = _context3.next) {
|
|
1626
|
-
case 0:
|
|
1627
|
-
pluginName = curr.pluginName;
|
|
1628
|
-
_context3.next = 3;
|
|
1629
|
-
return scoped;
|
|
1630
|
-
case 3:
|
|
1631
|
-
curScope = _context3.sent;
|
|
1632
|
-
if (!(data.namespaced && data.namespaced[pluginName])) {
|
|
1633
|
-
_context3.next = 11;
|
|
1634
|
-
break;
|
|
1635
|
-
}
|
|
1636
|
-
_context3.next = 7;
|
|
1637
|
-
return data.namespaced[pluginName].reduce(/* @__PURE__ */ function() {
|
|
1638
|
-
var _ref7 = _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee2(acc, p2, count) {
|
|
1639
|
-
var curScopeData, genAbort, val, returnValue;
|
|
1640
|
-
return regenerator.wrap(function _callee2$(_context2) {
|
|
1641
|
-
while (1) {
|
|
1642
|
-
switch (_context2.prev = _context2.next) {
|
|
1643
|
-
case 0:
|
|
1644
|
-
genAbort = function _genAbort(currentAct, pname, otherPlug) {
|
|
1645
|
-
return function(reason, plugins2) {
|
|
1646
|
-
var callsite = otherPlug || pname;
|
|
1647
|
-
return _objectSpread2$1(_objectSpread2$1({}, currentAct), {}, {
|
|
1648
|
-
abort: {
|
|
1649
|
-
reason,
|
|
1650
|
-
plugins: plugins2 || [pname],
|
|
1651
|
-
caller: method,
|
|
1652
|
-
from: callsite
|
|
1653
|
-
}
|
|
1654
|
-
});
|
|
1655
|
-
};
|
|
1656
|
-
};
|
|
1657
|
-
_context2.next = 3;
|
|
1658
|
-
return acc;
|
|
1659
|
-
case 3:
|
|
1660
|
-
curScopeData = _context2.sent;
|
|
1661
|
-
if (!(!p2.method || !_(p2.method))) {
|
|
1662
|
-
_context2.next = 6;
|
|
1663
|
-
break;
|
|
1664
|
-
}
|
|
1665
|
-
return _context2.abrupt("return", curScopeData);
|
|
1666
|
-
case 6:
|
|
1667
|
-
validateMethod(p2.methodName, p2.pluginName);
|
|
1668
|
-
_context2.next = 9;
|
|
1669
|
-
return p2.method({
|
|
1670
|
-
payload: curScopeData,
|
|
1671
|
-
instance,
|
|
1672
|
-
abort: genAbort(curScopeData, pluginName, p2.pluginName),
|
|
1673
|
-
config: getConfig(p2.pluginName, plugins, allPlugins),
|
|
1674
|
-
plugins
|
|
1675
|
-
});
|
|
1676
|
-
case 9:
|
|
1677
|
-
val = _context2.sent;
|
|
1678
|
-
returnValue = M$3(val) ? val : {};
|
|
1679
|
-
return _context2.abrupt("return", Promise.resolve(_objectSpread2$1(_objectSpread2$1({}, curScopeData), returnValue)));
|
|
1680
|
-
case 12:
|
|
1681
|
-
case "end":
|
|
1682
|
-
return _context2.stop();
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
}, _callee2);
|
|
1686
|
-
}));
|
|
1687
|
-
return function(_x10, _x11, _x12) {
|
|
1688
|
-
return _ref7.apply(this, arguments);
|
|
1689
|
-
};
|
|
1690
|
-
}(), Promise.resolve(action));
|
|
1691
|
-
case 7:
|
|
1692
|
-
scopedPayload = _context3.sent;
|
|
1693
|
-
curScope[pluginName] = scopedPayload;
|
|
1694
|
-
_context3.next = 12;
|
|
1695
|
-
break;
|
|
1696
|
-
case 11:
|
|
1697
|
-
curScope[pluginName] = action;
|
|
1698
|
-
case 12:
|
|
1699
|
-
return _context3.abrupt("return", Promise.resolve(curScope));
|
|
1700
|
-
case 13:
|
|
1701
|
-
case "end":
|
|
1702
|
-
return _context3.stop();
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
|
-
}, _callee3);
|
|
1706
|
-
}));
|
|
1707
|
-
return function(_x7, _x8, _x9) {
|
|
1708
|
-
return _ref6.apply(this, arguments);
|
|
1709
|
-
};
|
|
1710
|
-
}(), Promise.resolve({}));
|
|
1711
|
-
case 10:
|
|
1712
|
-
payloads = _context5.sent;
|
|
1713
|
-
_context5.next = 13;
|
|
1714
|
-
return data.exact.reduce(/* @__PURE__ */ function() {
|
|
1715
|
-
var _ref8 = _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee4(promise, curr, i2) {
|
|
1716
|
-
var lastLoop, pluginName, currentPlugin, currentActionValue, payloadValue, funcArgs, val, returnValue, merged, scopedPayload, nameSpaceEvent, actionDepth, updatedPayload;
|
|
1717
|
-
return regenerator.wrap(function _callee4$(_context4) {
|
|
1718
|
-
while (1) {
|
|
1719
|
-
switch (_context4.prev = _context4.next) {
|
|
1720
|
-
case 0:
|
|
1721
|
-
lastLoop = data.exact.length === i2 + 1;
|
|
1722
|
-
pluginName = curr.pluginName;
|
|
1723
|
-
currentPlugin = allPlugins[pluginName];
|
|
1724
|
-
_context4.next = 5;
|
|
1725
|
-
return promise;
|
|
1726
|
-
case 5:
|
|
1727
|
-
currentActionValue = _context4.sent;
|
|
1728
|
-
payloadValue = payloads[pluginName] ? payloads[pluginName] : {};
|
|
1729
|
-
if (isStartEvent) {
|
|
1730
|
-
payloadValue = currentActionValue;
|
|
1731
|
-
}
|
|
1732
|
-
if (!shouldAbort(payloadValue, pluginName)) {
|
|
1733
|
-
_context4.next = 11;
|
|
1734
|
-
break;
|
|
1735
|
-
}
|
|
1736
|
-
abortDispatch({
|
|
1737
|
-
data: payloadValue,
|
|
1738
|
-
method,
|
|
1739
|
-
instance,
|
|
1740
|
-
pluginName,
|
|
1741
|
-
store
|
|
1742
|
-
});
|
|
1743
|
-
return _context4.abrupt("return", Promise.resolve(currentActionValue));
|
|
1744
|
-
case 11:
|
|
1745
|
-
if (!shouldAbort(currentActionValue, pluginName)) {
|
|
1746
|
-
_context4.next = 14;
|
|
1747
|
-
break;
|
|
1748
|
-
}
|
|
1749
|
-
if (lastLoop) {
|
|
1750
|
-
abortDispatch({
|
|
1751
|
-
data: currentActionValue,
|
|
1752
|
-
method,
|
|
1753
|
-
instance,
|
|
1754
|
-
store
|
|
1755
|
-
});
|
|
1756
|
-
}
|
|
1757
|
-
return _context4.abrupt("return", Promise.resolve(currentActionValue));
|
|
1758
|
-
case 14:
|
|
1759
|
-
if (!(queueData.hasOwnProperty(pluginName) && queueData[pluginName] === true)) {
|
|
1760
|
-
_context4.next = 17;
|
|
1761
|
-
break;
|
|
1762
|
-
}
|
|
1763
|
-
store.dispatch({
|
|
1764
|
-
type: "queue",
|
|
1765
|
-
plugin: pluginName,
|
|
1766
|
-
payload: payloadValue,
|
|
1767
|
-
_: {
|
|
1768
|
-
called: "queue",
|
|
1769
|
-
from: "queueMechanism"
|
|
1770
|
-
}
|
|
1771
|
-
});
|
|
1772
|
-
return _context4.abrupt("return", Promise.resolve(currentActionValue));
|
|
1773
|
-
case 17:
|
|
1774
|
-
funcArgs = makeArgs(payloads[pluginName], allPlugins[pluginName]);
|
|
1775
|
-
_context4.next = 20;
|
|
1776
|
-
return currentPlugin[method]({
|
|
1777
|
-
abort: funcArgs.abort,
|
|
1778
|
-
payload: payloadValue,
|
|
1779
|
-
instance,
|
|
1780
|
-
config: getConfig(pluginName, plugins, allPlugins),
|
|
1781
|
-
plugins
|
|
1782
|
-
});
|
|
1783
|
-
case 20:
|
|
1784
|
-
val = _context4.sent;
|
|
1785
|
-
returnValue = M$3(val) ? val : {};
|
|
1786
|
-
merged = _objectSpread2$1(_objectSpread2$1({}, currentActionValue), returnValue);
|
|
1787
|
-
scopedPayload = payloads[pluginName];
|
|
1788
|
-
if (shouldAbort(scopedPayload, pluginName)) {
|
|
1789
|
-
abortDispatch({
|
|
1790
|
-
data: scopedPayload,
|
|
1791
|
-
method,
|
|
1792
|
-
instance,
|
|
1793
|
-
pluginName,
|
|
1794
|
-
store
|
|
1795
|
-
});
|
|
1796
|
-
} else {
|
|
1797
|
-
nameSpaceEvent = "".concat(method, ":").concat(pluginName);
|
|
1798
|
-
actionDepth = (nameSpaceEvent.match(/:/g) || []).length;
|
|
1799
|
-
if (actionDepth < 2 && !method.match(bootstrapRegex) && !method.match(readyRegex)) {
|
|
1800
|
-
updatedPayload = isStartEvent ? merged : payloadValue;
|
|
1801
|
-
instance.dispatch(_objectSpread2$1(_objectSpread2$1({}, updatedPayload), {}, {
|
|
1802
|
-
type: nameSpaceEvent,
|
|
1803
|
-
_: {
|
|
1804
|
-
called: nameSpaceEvent,
|
|
1805
|
-
from: "submethod"
|
|
1806
|
-
}
|
|
1807
|
-
}));
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
return _context4.abrupt("return", Promise.resolve(merged));
|
|
1811
|
-
case 26:
|
|
1812
|
-
case "end":
|
|
1813
|
-
return _context4.stop();
|
|
1814
|
-
}
|
|
1815
|
-
}
|
|
1816
|
-
}, _callee4);
|
|
1817
|
-
}));
|
|
1818
|
-
return function(_x13, _x14, _x15) {
|
|
1819
|
-
return _ref8.apply(this, arguments);
|
|
1820
|
-
};
|
|
1821
|
-
}(), Promise.resolve(action));
|
|
1822
|
-
case 13:
|
|
1823
|
-
resolvedAction = _context5.sent;
|
|
1824
|
-
if (!(!method.match(endsWithStartRegex) && !method.match(/^registerPlugin/) && !method.match(readyRegex) && !method.match(bootstrapRegex) && !method.match(/^params/) && !method.match(/^userIdChanged/))) {
|
|
1825
|
-
_context5.next = 21;
|
|
1826
|
-
break;
|
|
1827
|
-
}
|
|
1828
|
-
if (EVENTS2.plugins.includes(method))
|
|
1829
|
-
;
|
|
1830
|
-
if (!(resolvedAction._ && resolvedAction._.originalAction === method)) {
|
|
1831
|
-
_context5.next = 18;
|
|
1832
|
-
break;
|
|
1833
|
-
}
|
|
1834
|
-
return _context5.abrupt("return", resolvedAction);
|
|
1835
|
-
case 18:
|
|
1836
|
-
endAction = _objectSpread2$1(_objectSpread2$1({}, resolvedAction), {
|
|
1837
|
-
_: {
|
|
1838
|
-
originalAction: resolvedAction.type,
|
|
1839
|
-
called: resolvedAction.type,
|
|
1840
|
-
from: "engineEnd"
|
|
1841
|
-
}
|
|
1842
|
-
});
|
|
1843
|
-
if (shouldAbortAll(resolvedAction, data.exact.length) && !method.match(/End$/)) {
|
|
1844
|
-
endAction = _objectSpread2$1(_objectSpread2$1({}, endAction), {
|
|
1845
|
-
type: resolvedAction.type + "Aborted"
|
|
1846
|
-
});
|
|
1847
|
-
}
|
|
1848
|
-
store.dispatch(endAction);
|
|
1849
|
-
case 21:
|
|
1850
|
-
return _context5.abrupt("return", resolvedAction);
|
|
1851
|
-
case 22:
|
|
1852
|
-
case "end":
|
|
1853
|
-
return _context5.stop();
|
|
1854
|
-
}
|
|
1855
|
-
}
|
|
1856
|
-
}, _callee5);
|
|
1857
|
-
}));
|
|
1858
|
-
return _processEvent.apply(this, arguments);
|
|
1859
|
-
}
|
|
1860
|
-
function abortDispatch(_ref3) {
|
|
1861
|
-
var data = _ref3.data, method = _ref3.method;
|
|
1862
|
-
_ref3.instance;
|
|
1863
|
-
var pluginName = _ref3.pluginName, store = _ref3.store;
|
|
1864
|
-
var postFix = pluginName ? ":" + pluginName : "";
|
|
1865
|
-
var abortEvent = method + "Aborted" + postFix;
|
|
1866
|
-
store.dispatch(_objectSpread2$1(_objectSpread2$1({}, data), {}, {
|
|
1867
|
-
type: abortEvent,
|
|
1868
|
-
_: {
|
|
1869
|
-
called: abortEvent,
|
|
1870
|
-
from: "abort"
|
|
1871
|
-
}
|
|
1872
|
-
}));
|
|
1873
|
-
}
|
|
1874
|
-
function getConfig(name, pluginState, allPlugins) {
|
|
1875
|
-
var pluginData = pluginState[name] || allPlugins[name];
|
|
1876
|
-
if (pluginData && pluginData.config) {
|
|
1877
|
-
return pluginData.config;
|
|
1878
|
-
}
|
|
1879
|
-
return {};
|
|
1880
|
-
}
|
|
1881
|
-
function getPluginFunctions(methodName, plugins) {
|
|
1882
|
-
return plugins.reduce(function(arr, plugin) {
|
|
1883
|
-
return !plugin[methodName] ? arr : arr.concat({
|
|
1884
|
-
methodName,
|
|
1885
|
-
pluginName: plugin.name,
|
|
1886
|
-
method: plugin[methodName]
|
|
1887
|
-
});
|
|
1888
|
-
}, []);
|
|
1889
|
-
}
|
|
1890
|
-
function formatMethod(type) {
|
|
1891
|
-
return type.replace(endsWithStartRegex, "");
|
|
1892
|
-
}
|
|
1893
|
-
function getEventNames(eventType, namespace) {
|
|
1894
|
-
var method = formatMethod(eventType);
|
|
1895
|
-
var postFix = namespace ? ":".concat(namespace) : "";
|
|
1896
|
-
var type = "".concat(eventType).concat(postFix);
|
|
1897
|
-
var methodName = "".concat(method).concat(postFix);
|
|
1898
|
-
var end = "".concat(method, "End").concat(postFix);
|
|
1899
|
-
return [type, methodName, end];
|
|
1900
|
-
}
|
|
1901
|
-
function getAllMatchingCalls(eventType, activePlugins, allPlugins) {
|
|
1902
|
-
var eventNames = getEventNames(eventType);
|
|
1903
|
-
var core = eventNames.map(function(word) {
|
|
1904
|
-
return getPluginFunctions(word, activePlugins);
|
|
1905
|
-
});
|
|
1906
|
-
return activePlugins.reduce(function(acc, plugin) {
|
|
1907
|
-
var name = plugin.name;
|
|
1908
|
-
var nameSpacedEvents = getEventNames(eventType, name);
|
|
1909
|
-
var _nameSpacedEvents$map = nameSpacedEvents.map(function(word) {
|
|
1910
|
-
return getPluginFunctions(word, activePlugins);
|
|
1911
|
-
}), _nameSpacedEvents$map2 = _slicedToArray(_nameSpacedEvents$map, 3), beforeFuncs = _nameSpacedEvents$map2[0], duringFuncs = _nameSpacedEvents$map2[1], afterFuncs = _nameSpacedEvents$map2[2];
|
|
1912
|
-
if (beforeFuncs.length) {
|
|
1913
|
-
acc.beforeNS[name] = beforeFuncs;
|
|
1914
|
-
}
|
|
1915
|
-
if (duringFuncs.length) {
|
|
1916
|
-
acc.duringNS[name] = duringFuncs;
|
|
1917
|
-
}
|
|
1918
|
-
if (afterFuncs.length) {
|
|
1919
|
-
acc.afterNS[name] = afterFuncs;
|
|
1920
|
-
}
|
|
1921
|
-
return acc;
|
|
1922
|
-
}, {
|
|
1923
|
-
before: core[0],
|
|
1924
|
-
beforeNS: {},
|
|
1925
|
-
during: core[1],
|
|
1926
|
-
duringNS: {},
|
|
1927
|
-
after: core[2],
|
|
1928
|
-
afterNS: {}
|
|
1929
|
-
});
|
|
1930
|
-
}
|
|
1931
|
-
function shouldAbort(_ref4, pluginName) {
|
|
1932
|
-
var abort = _ref4.abort;
|
|
1933
|
-
if (!abort)
|
|
1934
|
-
return false;
|
|
1935
|
-
if (abort === true)
|
|
1936
|
-
return true;
|
|
1937
|
-
return includes(abort, pluginName) || abort && includes(abort.plugins, pluginName);
|
|
1938
|
-
}
|
|
1939
|
-
function shouldAbortAll(_ref5, pluginsCount) {
|
|
1940
|
-
var abort = _ref5.abort;
|
|
1941
|
-
if (!abort)
|
|
1942
|
-
return false;
|
|
1943
|
-
if (abort === true || L$1(abort))
|
|
1944
|
-
return true;
|
|
1945
|
-
var plugins = abort.plugins;
|
|
1946
|
-
return isArray(abort) && abort.length === pluginsCount || isArray(plugins) && plugins.length === pluginsCount;
|
|
1947
|
-
}
|
|
1948
|
-
function isArray(arr) {
|
|
1949
|
-
return Array.isArray(arr);
|
|
1950
|
-
}
|
|
1951
|
-
function includes(arr, name) {
|
|
1952
|
-
if (!arr || !isArray(arr))
|
|
1953
|
-
return false;
|
|
1954
|
-
return arr.includes(name);
|
|
1955
|
-
}
|
|
1956
|
-
function argumentFactory(instance, abortablePlugins) {
|
|
1957
|
-
return function(action, plugin, otherPlugin) {
|
|
1958
|
-
var config2 = plugin.config, name = plugin.name;
|
|
1959
|
-
var method = "".concat(name, ".").concat(action.type);
|
|
1960
|
-
if (otherPlugin) {
|
|
1961
|
-
method = otherPlugin.event;
|
|
1962
|
-
}
|
|
1963
|
-
var abortF = action.type.match(endsWithStartRegex) ? abortFunction(name, method, abortablePlugins, otherPlugin, action) : notAbortableError(action, method);
|
|
1964
|
-
return {
|
|
1965
|
-
payload: formatPayload(action),
|
|
1966
|
-
instance,
|
|
1967
|
-
config: config2 || {},
|
|
1968
|
-
abort: abortF
|
|
1969
|
-
};
|
|
1970
|
-
};
|
|
1971
|
-
}
|
|
1972
|
-
function abortFunction(pluginName, method, abortablePlugins, otherPlugin, action) {
|
|
1973
|
-
return function(reason, plugins) {
|
|
1974
|
-
var caller = otherPlugin ? otherPlugin.name : pluginName;
|
|
1975
|
-
var pluginsToAbort = plugins && isArray(plugins) ? plugins : abortablePlugins;
|
|
1976
|
-
if (otherPlugin) {
|
|
1977
|
-
pluginsToAbort = plugins && isArray(plugins) ? plugins : [pluginName];
|
|
1978
|
-
if (!pluginsToAbort.includes(pluginName) || pluginsToAbort.length !== 1) {
|
|
1979
|
-
throw new Error("Method ".concat(method, " can only abort ").concat(pluginName, " plugin. ").concat(JSON.stringify(pluginsToAbort), " input valid"));
|
|
1980
|
-
}
|
|
1981
|
-
}
|
|
1982
|
-
return _objectSpread2$1(_objectSpread2$1({}, action), {}, {
|
|
1983
|
-
abort: {
|
|
1984
|
-
reason,
|
|
1985
|
-
plugins: pluginsToAbort,
|
|
1986
|
-
caller: method,
|
|
1987
|
-
_: caller
|
|
1988
|
-
}
|
|
1989
|
-
});
|
|
1990
|
-
};
|
|
1991
|
-
}
|
|
1992
|
-
function notAbortableError(action, method) {
|
|
1993
|
-
return function() {
|
|
1994
|
-
throw new Error(action.type + " action not cancellable. Remove abort in " + method);
|
|
1995
|
-
};
|
|
1996
|
-
}
|
|
1997
|
-
function validateMethod(actionName, pluginName) {
|
|
1998
|
-
var text = getNameSpacedAction(actionName);
|
|
1999
|
-
var methodCallMatchesPluginNamespace = text && text.name === pluginName;
|
|
2000
|
-
if (methodCallMatchesPluginNamespace) {
|
|
2001
|
-
var sub = getNameSpacedAction(text.method);
|
|
2002
|
-
var subText = sub ? "or " + sub.method : "";
|
|
2003
|
-
throw new Error([pluginName + " plugin is calling method " + actionName, "Plugins cant call self", "Use ".concat(text.method, " ").concat(subText, " in ").concat(pluginName, " plugin insteadof ").concat(actionName)].join("\n"));
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
2006
|
-
function getNameSpacedAction(event) {
|
|
2007
|
-
var split = event.match(/(.*):(.*)/);
|
|
2008
|
-
if (!split) {
|
|
2009
|
-
return false;
|
|
2010
|
-
}
|
|
2011
|
-
return {
|
|
2012
|
-
method: split[1],
|
|
2013
|
-
name: split[2]
|
|
2014
|
-
};
|
|
2015
|
-
}
|
|
2016
|
-
function formatPayload(action) {
|
|
2017
|
-
return Object.keys(action).reduce(function(acc, key) {
|
|
2018
|
-
if (key === "type") {
|
|
2019
|
-
return acc;
|
|
2020
|
-
}
|
|
2021
|
-
if (M$3(action[key])) {
|
|
2022
|
-
acc[key] = Object.assign({}, action[key]);
|
|
2023
|
-
} else {
|
|
2024
|
-
acc[key] = action[key];
|
|
2025
|
-
}
|
|
2026
|
-
return acc;
|
|
2027
|
-
}, {});
|
|
2028
|
-
}
|
|
2029
|
-
function pluginMiddleware(instance, getPlugins, systemEvents) {
|
|
2030
|
-
var isReady = {};
|
|
2031
|
-
return function(store) {
|
|
2032
|
-
return function(next) {
|
|
2033
|
-
return /* @__PURE__ */ function() {
|
|
2034
|
-
var _ref2 = _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee(action) {
|
|
2035
|
-
var type, abort, plugins, updatedAction, allPlugins, pluginsArray, allRegisteredPlugins, completed, failed, disabled, waitForPluginsToLoad, updated;
|
|
2036
|
-
return regenerator.wrap(function _callee$(_context) {
|
|
2037
|
-
while (1) {
|
|
2038
|
-
switch (_context.prev = _context.next) {
|
|
2039
|
-
case 0:
|
|
2040
|
-
type = action.type, abort = action.abort, plugins = action.plugins;
|
|
2041
|
-
updatedAction = action;
|
|
2042
|
-
if (!abort) {
|
|
2043
|
-
_context.next = 4;
|
|
2044
|
-
break;
|
|
2045
|
-
}
|
|
2046
|
-
return _context.abrupt("return", next(action));
|
|
2047
|
-
case 4:
|
|
2048
|
-
if (type === EVENTS$1.enablePlugin) {
|
|
2049
|
-
store.dispatch({
|
|
2050
|
-
type: EVENTS$1.initializeStart,
|
|
2051
|
-
plugins,
|
|
2052
|
-
disabled: [],
|
|
2053
|
-
fromEnable: true,
|
|
2054
|
-
meta: action.meta
|
|
2055
|
-
});
|
|
2056
|
-
}
|
|
2057
|
-
if (type === EVENTS$1.disablePlugin) {
|
|
2058
|
-
setTimeout(function() {
|
|
2059
|
-
return runCallback(action.meta.rid, {
|
|
2060
|
-
payload: action
|
|
2061
|
-
});
|
|
2062
|
-
}, 0);
|
|
2063
|
-
}
|
|
2064
|
-
if (type === EVENTS$1.initializeEnd) {
|
|
2065
|
-
allPlugins = getPlugins();
|
|
2066
|
-
pluginsArray = Object.keys(allPlugins);
|
|
2067
|
-
allRegisteredPlugins = pluginsArray.filter(function(name) {
|
|
2068
|
-
return plugins.includes(name);
|
|
2069
|
-
}).map(function(name) {
|
|
2070
|
-
return allPlugins[name];
|
|
2071
|
-
});
|
|
2072
|
-
completed = [];
|
|
2073
|
-
failed = [];
|
|
2074
|
-
disabled = action.disabled;
|
|
2075
|
-
waitForPluginsToLoad = allRegisteredPlugins.map(function(plugin) {
|
|
2076
|
-
var loaded = plugin.loaded, name = plugin.name;
|
|
2077
|
-
return waitForReady(plugin, loaded, 1e4).then(function(d2) {
|
|
2078
|
-
if (!isReady[name]) {
|
|
2079
|
-
store.dispatch({
|
|
2080
|
-
type: EVENTS$1.pluginReadyType(name),
|
|
2081
|
-
name,
|
|
2082
|
-
events: Object.keys(plugin).filter(function(name2) {
|
|
2083
|
-
return !nonEvents.includes(name2);
|
|
2084
|
-
})
|
|
2085
|
-
});
|
|
2086
|
-
isReady[name] = true;
|
|
2087
|
-
}
|
|
2088
|
-
completed = completed.concat(name);
|
|
2089
|
-
return plugin;
|
|
2090
|
-
})["catch"](function(e2) {
|
|
2091
|
-
if (e2 instanceof Error) {
|
|
2092
|
-
throw new Error(e2);
|
|
2093
|
-
}
|
|
2094
|
-
failed = failed.concat(e2.name);
|
|
2095
|
-
return e2;
|
|
2096
|
-
});
|
|
2097
|
-
});
|
|
2098
|
-
Promise.all(waitForPluginsToLoad).then(function(calls) {
|
|
2099
|
-
var payload = {
|
|
2100
|
-
plugins: completed,
|
|
2101
|
-
failed,
|
|
2102
|
-
disabled
|
|
2103
|
-
};
|
|
2104
|
-
setTimeout(function() {
|
|
2105
|
-
if (pluginsArray.length === waitForPluginsToLoad.length + disabled.length) {
|
|
2106
|
-
store.dispatch(_objectSpread2$1(_objectSpread2$1({}, {
|
|
2107
|
-
type: EVENTS$1.ready
|
|
2108
|
-
}), payload));
|
|
2109
|
-
}
|
|
2110
|
-
}, 0);
|
|
2111
|
-
});
|
|
2112
|
-
}
|
|
2113
|
-
if (!(type !== EVENTS$1.bootstrap)) {
|
|
2114
|
-
_context.next = 13;
|
|
2115
|
-
break;
|
|
2116
|
-
}
|
|
2117
|
-
if (/^ready:([^:]*)$/.test(type)) {
|
|
2118
|
-
setTimeout(function() {
|
|
2119
|
-
return processQueue(store, getPlugins, instance);
|
|
2120
|
-
}, 0);
|
|
2121
|
-
}
|
|
2122
|
-
_context.next = 11;
|
|
2123
|
-
return runPlugins(action, getPlugins, instance, store, systemEvents);
|
|
2124
|
-
case 11:
|
|
2125
|
-
updated = _context.sent;
|
|
2126
|
-
return _context.abrupt("return", next(updated));
|
|
2127
|
-
case 13:
|
|
2128
|
-
return _context.abrupt("return", next(updatedAction));
|
|
2129
|
-
case 14:
|
|
2130
|
-
case "end":
|
|
2131
|
-
return _context.stop();
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
}, _callee);
|
|
2135
|
-
}));
|
|
2136
|
-
return function(_x) {
|
|
2137
|
-
return _ref2.apply(this, arguments);
|
|
2138
|
-
};
|
|
2139
|
-
}();
|
|
2140
|
-
};
|
|
2141
|
-
};
|
|
2142
|
-
}
|
|
2143
|
-
function storageMiddleware(storage2) {
|
|
2144
|
-
return function(store) {
|
|
2145
|
-
return function(next) {
|
|
2146
|
-
return function(action) {
|
|
2147
|
-
var type = action.type, key = action.key, value = action.value, options = action.options;
|
|
2148
|
-
if (type === EVENTS$1.setItem || type === EVENTS$1.removeItem) {
|
|
2149
|
-
if (action.abort) {
|
|
2150
|
-
return next(action);
|
|
2151
|
-
}
|
|
2152
|
-
if (type === EVENTS$1.setItem) {
|
|
2153
|
-
storage2.setItem(key, value, options);
|
|
2154
|
-
} else {
|
|
2155
|
-
storage2.removeItem(key, options);
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
return next(action);
|
|
2159
|
-
};
|
|
2160
|
-
};
|
|
2161
|
-
};
|
|
2162
|
-
}
|
|
2163
|
-
function _defineProperties(target, props) {
|
|
2164
|
-
for (var i2 = 0; i2 < props.length; i2++) {
|
|
2165
|
-
var descriptor = props[i2];
|
|
2166
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
2167
|
-
descriptor.configurable = true;
|
|
2168
|
-
if ("value" in descriptor)
|
|
2169
|
-
descriptor.writable = true;
|
|
2170
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
2171
|
-
}
|
|
2172
|
-
}
|
|
2173
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
2174
|
-
if (protoProps)
|
|
2175
|
-
_defineProperties(Constructor.prototype, protoProps);
|
|
2176
|
-
if (staticProps)
|
|
2177
|
-
_defineProperties(Constructor, staticProps);
|
|
2178
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
2179
|
-
writable: false
|
|
2180
|
-
});
|
|
2181
|
-
return Constructor;
|
|
2182
|
-
}
|
|
2183
|
-
function _classCallCheck(instance, Constructor) {
|
|
2184
|
-
if (!(instance instanceof Constructor)) {
|
|
2185
|
-
throw new TypeError("Cannot call a class as a function");
|
|
2186
|
-
}
|
|
2187
|
-
}
|
|
2188
|
-
var DynamicMiddleware = /* @__PURE__ */ _createClass(function DynamicMiddleware2() {
|
|
2189
|
-
var _this = this;
|
|
2190
|
-
_classCallCheck(this, DynamicMiddleware2);
|
|
2191
|
-
_defineProperty$2(this, "before", []);
|
|
2192
|
-
_defineProperty$2(this, "after", []);
|
|
2193
|
-
_defineProperty$2(this, "addMiddleware", function(middlewares, position) {
|
|
2194
|
-
_this[position] = _this[position].concat(middlewares);
|
|
2195
|
-
});
|
|
2196
|
-
_defineProperty$2(this, "removeMiddleware", function(middleware, position) {
|
|
2197
|
-
var index2 = _this[position].findIndex(function(d2) {
|
|
2198
|
-
return d2 === middleware;
|
|
2199
|
-
});
|
|
2200
|
-
if (index2 === -1)
|
|
2201
|
-
return;
|
|
2202
|
-
_this[position] = [].concat(_toConsumableArray(_this[position].slice(0, index2)), _toConsumableArray(_this[position].slice(index2 + 1)));
|
|
2203
|
-
});
|
|
2204
|
-
_defineProperty$2(this, "dynamicMiddlewares", function(position) {
|
|
2205
|
-
return function(store) {
|
|
2206
|
-
return function(next) {
|
|
2207
|
-
return function(action) {
|
|
2208
|
-
var middlewareAPI = {
|
|
2209
|
-
getState: store.getState,
|
|
2210
|
-
dispatch: function dispatch(act) {
|
|
2211
|
-
return store.dispatch(act);
|
|
2212
|
-
}
|
|
2213
|
-
};
|
|
2214
|
-
var chain = _this[position].map(function(middleware) {
|
|
2215
|
-
return middleware(middlewareAPI);
|
|
2216
|
-
});
|
|
2217
|
-
return compose.apply(void 0, _toConsumableArray(chain))(next)(action);
|
|
2218
|
-
};
|
|
2219
|
-
};
|
|
2220
|
-
};
|
|
2221
|
-
});
|
|
2222
|
-
});
|
|
2223
|
-
function createReducer(getPlugins) {
|
|
2224
|
-
return function plugins() {
|
|
2225
|
-
var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2226
|
-
var action = arguments.length > 1 ? arguments[1] : void 0;
|
|
2227
|
-
var newState = {};
|
|
2228
|
-
if (action.type === "initialize:aborted") {
|
|
2229
|
-
return state;
|
|
2230
|
-
}
|
|
2231
|
-
if (/^registerPlugin:([^:]*)$/.test(action.type)) {
|
|
2232
|
-
var name = getNameFromEventType(action.type, "registerPlugin");
|
|
2233
|
-
var plugin = getPlugins()[name];
|
|
2234
|
-
if (!plugin || !name) {
|
|
2235
|
-
return state;
|
|
2236
|
-
}
|
|
2237
|
-
var isEnabled = action.enabled;
|
|
2238
|
-
newState[name] = {
|
|
2239
|
-
enabled: isEnabled,
|
|
2240
|
-
initialized: isEnabled ? Boolean(!plugin.initialize) : false,
|
|
2241
|
-
loaded: isEnabled ? Boolean(plugin.loaded()) : false,
|
|
2242
|
-
config: plugin.config || {}
|
|
2243
|
-
};
|
|
2244
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), newState);
|
|
2245
|
-
}
|
|
2246
|
-
if (/^initialize:([^:]*)$/.test(action.type)) {
|
|
2247
|
-
var _name = getNameFromEventType(action.type, EVENTS$1.initialize);
|
|
2248
|
-
var _plugin = getPlugins()[_name];
|
|
2249
|
-
if (!_plugin || !_name) {
|
|
2250
|
-
return state;
|
|
2251
|
-
}
|
|
2252
|
-
newState[_name] = _objectSpread2$1(_objectSpread2$1({}, state[_name]), {
|
|
2253
|
-
initialized: true,
|
|
2254
|
-
loaded: Boolean(_plugin.loaded())
|
|
2255
|
-
});
|
|
2256
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), newState);
|
|
2257
|
-
}
|
|
2258
|
-
if (/^ready:([^:]*)$/.test(action.type)) {
|
|
2259
|
-
newState[action.name] = _objectSpread2$1(_objectSpread2$1({}, state[action.name]), {
|
|
2260
|
-
loaded: true
|
|
2261
|
-
});
|
|
2262
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), newState);
|
|
2263
|
-
}
|
|
2264
|
-
switch (action.type) {
|
|
2265
|
-
case EVENTS$1.disablePlugin:
|
|
2266
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), togglePluginStatus(action.plugins, false, state));
|
|
2267
|
-
case EVENTS$1.enablePlugin:
|
|
2268
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), togglePluginStatus(action.plugins, true, state));
|
|
2269
|
-
default:
|
|
2270
|
-
return state;
|
|
2271
|
-
}
|
|
2272
|
-
};
|
|
2273
|
-
}
|
|
2274
|
-
function getNameFromEventType(type, baseName) {
|
|
2275
|
-
return type.substring(baseName.length + 1, type.length);
|
|
2276
|
-
}
|
|
2277
|
-
function togglePluginStatus(plugins, status, currentState) {
|
|
2278
|
-
return plugins.reduce(function(acc, pluginKey) {
|
|
2279
|
-
acc[pluginKey] = _objectSpread2$1(_objectSpread2$1({}, currentState[pluginKey]), {
|
|
2280
|
-
enabled: status
|
|
2281
|
-
});
|
|
2282
|
-
return acc;
|
|
2283
|
-
}, currentState);
|
|
2284
|
-
}
|
|
2285
|
-
function serialize(obj) {
|
|
2286
|
-
try {
|
|
2287
|
-
return JSON.parse(JSON.stringify(obj));
|
|
2288
|
-
} catch (err) {
|
|
2289
|
-
}
|
|
2290
|
-
return obj;
|
|
2291
|
-
}
|
|
2292
|
-
var initialState$3 = {
|
|
2293
|
-
last: {},
|
|
2294
|
-
history: []
|
|
2295
|
-
};
|
|
2296
|
-
function trackReducer() {
|
|
2297
|
-
var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : initialState$3;
|
|
2298
|
-
var action = arguments.length > 1 ? arguments[1] : void 0;
|
|
2299
|
-
var type = action.type, event = action.event, properties = action.properties, options = action.options, meta = action.meta;
|
|
2300
|
-
switch (type) {
|
|
2301
|
-
case EVENTS$1.track:
|
|
2302
|
-
var trackEvent = serialize(_objectSpread2$1(_objectSpread2$1({
|
|
2303
|
-
event,
|
|
2304
|
-
properties
|
|
2305
|
-
}, Object.keys(options).length && {
|
|
2306
|
-
options
|
|
2307
|
-
}), {}, {
|
|
2308
|
-
meta
|
|
2309
|
-
}));
|
|
2310
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), {
|
|
2311
|
-
last: trackEvent,
|
|
2312
|
-
history: state.history.concat(trackEvent)
|
|
2313
|
-
});
|
|
2314
|
-
default:
|
|
2315
|
-
return state;
|
|
2316
|
-
}
|
|
2317
|
-
}
|
|
2318
|
-
var initialState$2 = {
|
|
2319
|
-
actions: []
|
|
2320
|
-
};
|
|
2321
|
-
function queueReducer() {
|
|
2322
|
-
var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : initialState$2;
|
|
2323
|
-
var action = arguments.length > 1 ? arguments[1] : void 0;
|
|
2324
|
-
var type = action.type, payload = action.payload;
|
|
2325
|
-
switch (type) {
|
|
2326
|
-
case "queue":
|
|
2327
|
-
var actionChain;
|
|
2328
|
-
if (payload && payload.type && payload.type === EVENTS$1.identify) {
|
|
2329
|
-
actionChain = [action].concat(state.actions);
|
|
2330
|
-
} else {
|
|
2331
|
-
actionChain = state.actions.concat(action);
|
|
2332
|
-
}
|
|
2333
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), {}, {
|
|
2334
|
-
actions: actionChain
|
|
2335
|
-
});
|
|
2336
|
-
case "dequeue":
|
|
2337
|
-
return [];
|
|
2338
|
-
default:
|
|
2339
|
-
return state;
|
|
2340
|
-
}
|
|
2341
|
-
}
|
|
2342
|
-
var hashRegex = /#.*$/;
|
|
2343
|
-
function canonicalUrl() {
|
|
2344
|
-
if (!z)
|
|
2345
|
-
return;
|
|
2346
|
-
var tags = document.getElementsByTagName("link");
|
|
2347
|
-
for (var i2 = 0, tag; tag = tags[i2]; i2++) {
|
|
2348
|
-
if (tag.getAttribute("rel") === "canonical") {
|
|
2349
|
-
return tag.getAttribute("href");
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
function urlPath(url) {
|
|
2354
|
-
var regex = /(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g;
|
|
2355
|
-
var matches = regex.exec(url);
|
|
2356
|
-
var pathMatch = matches && matches[3] ? matches[3].split("?")[0].replace(hashRegex, "") : "";
|
|
2357
|
-
return "/" + pathMatch;
|
|
2358
|
-
}
|
|
2359
|
-
function currentUrl(search) {
|
|
2360
|
-
var canonical = canonicalUrl();
|
|
2361
|
-
if (!canonical)
|
|
2362
|
-
return window.location.href.replace(hashRegex, "");
|
|
2363
|
-
return canonical.match(/\?/) ? canonical : canonical + search;
|
|
2364
|
-
}
|
|
2365
|
-
var getPageData = function getPageData2() {
|
|
2366
|
-
var pageData = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2367
|
-
if (!z)
|
|
2368
|
-
return pageData;
|
|
2369
|
-
var _document = document, title = _document.title, referrer2 = _document.referrer;
|
|
2370
|
-
var _window = window, location = _window.location, innerWidth = _window.innerWidth, innerHeight = _window.innerHeight;
|
|
2371
|
-
var hash = location.hash, search = location.search;
|
|
2372
|
-
var url = currentUrl(search);
|
|
2373
|
-
var page2 = {
|
|
2374
|
-
title,
|
|
2375
|
-
url,
|
|
2376
|
-
path: urlPath(url),
|
|
2377
|
-
hash,
|
|
2378
|
-
search,
|
|
2379
|
-
width: innerWidth,
|
|
2380
|
-
height: innerHeight
|
|
2381
|
-
};
|
|
2382
|
-
if (referrer2 && referrer2 !== "") {
|
|
2383
|
-
page2.referrer = referrer2;
|
|
2384
|
-
}
|
|
2385
|
-
return _objectSpread2$1(_objectSpread2$1({}, page2), pageData);
|
|
2386
|
-
};
|
|
2387
|
-
var initialState$1 = {
|
|
2388
|
-
last: {},
|
|
2389
|
-
history: []
|
|
2390
|
-
};
|
|
2391
|
-
function page() {
|
|
2392
|
-
var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : initialState$1;
|
|
2393
|
-
var action = arguments.length > 1 ? arguments[1] : void 0;
|
|
2394
|
-
var properties = action.properties, options = action.options, meta = action.meta;
|
|
2395
|
-
switch (action.type) {
|
|
2396
|
-
case EVENTS$1.page:
|
|
2397
|
-
var viewData = serialize(_objectSpread2$1({
|
|
2398
|
-
properties,
|
|
2399
|
-
meta
|
|
2400
|
-
}, Object.keys(options).length && {
|
|
2401
|
-
options
|
|
2402
|
-
}));
|
|
2403
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), {
|
|
2404
|
-
last: viewData,
|
|
2405
|
-
history: state.history.concat(viewData)
|
|
2406
|
-
});
|
|
2407
|
-
default:
|
|
2408
|
-
return state;
|
|
2409
|
-
}
|
|
2410
|
-
}
|
|
2411
|
-
function getBrowserOS() {
|
|
2412
|
-
if (!z)
|
|
2413
|
-
return false;
|
|
2414
|
-
var os = navigator.appVersion;
|
|
2415
|
-
if (~os.indexOf("Win"))
|
|
2416
|
-
return "Windows";
|
|
2417
|
-
if (~os.indexOf("Mac"))
|
|
2418
|
-
return "MacOS";
|
|
2419
|
-
if (~os.indexOf("X11"))
|
|
2420
|
-
return "UNIX";
|
|
2421
|
-
if (~os.indexOf("Linux"))
|
|
2422
|
-
return "Linux";
|
|
2423
|
-
return "Unknown OS";
|
|
2424
|
-
}
|
|
2425
|
-
var osName;
|
|
2426
|
-
var referrer;
|
|
2427
|
-
var locale;
|
|
2428
|
-
var timeZone;
|
|
2429
|
-
{
|
|
2430
|
-
osName = getBrowserOS();
|
|
2431
|
-
referrer = z ? document.referrer : null;
|
|
2432
|
-
locale = o$8();
|
|
2433
|
-
timeZone = a$5();
|
|
2434
|
-
}
|
|
2435
|
-
var initialState = {
|
|
2436
|
-
initialized: false,
|
|
2437
|
-
sessionId: y$1(),
|
|
2438
|
-
app: null,
|
|
2439
|
-
version: null,
|
|
2440
|
-
debug: false,
|
|
2441
|
-
offline: z ? !navigator.onLine : false,
|
|
2442
|
-
os: {
|
|
2443
|
-
name: osName
|
|
2444
|
-
},
|
|
2445
|
-
userAgent: z ? navigator.userAgent : "node",
|
|
2446
|
-
library: {
|
|
2447
|
-
name: LIB_NAME,
|
|
2448
|
-
version: "0.10.22"
|
|
2449
|
-
},
|
|
2450
|
-
timezone: timeZone,
|
|
2451
|
-
locale,
|
|
2452
|
-
campaign: {},
|
|
2453
|
-
referrer
|
|
2454
|
-
};
|
|
2455
|
-
function context() {
|
|
2456
|
-
var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : initialState;
|
|
2457
|
-
var action = arguments.length > 1 ? arguments[1] : void 0;
|
|
2458
|
-
var initialized = state.initialized;
|
|
2459
|
-
var type = action.type, campaign = action.campaign;
|
|
2460
|
-
switch (type) {
|
|
2461
|
-
case EVENTS$1.campaign:
|
|
2462
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), {
|
|
2463
|
-
campaign
|
|
2464
|
-
});
|
|
2465
|
-
case EVENTS$1.offline:
|
|
2466
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), {
|
|
2467
|
-
offline: true
|
|
2468
|
-
});
|
|
2469
|
-
case EVENTS$1.online:
|
|
2470
|
-
return _objectSpread2$1(_objectSpread2$1({}, state), {
|
|
2471
|
-
offline: false
|
|
2472
|
-
});
|
|
2473
|
-
default:
|
|
2474
|
-
if (!initialized) {
|
|
2475
|
-
return _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, initialState), state), {
|
|
2476
|
-
initialized: true
|
|
2477
|
-
});
|
|
2478
|
-
}
|
|
2479
|
-
return state;
|
|
2480
|
-
}
|
|
2481
|
-
}
|
|
2482
|
-
var excludeItems = ["plugins", "reducers", "storage"];
|
|
2483
|
-
function makeContext(config2) {
|
|
2484
|
-
return Object.keys(config2).reduce(function(acc, current) {
|
|
2485
|
-
if (excludeItems.includes(current)) {
|
|
2486
|
-
return acc;
|
|
2487
|
-
}
|
|
2488
|
-
acc[current] = config2[current];
|
|
2489
|
-
return acc;
|
|
2490
|
-
}, {});
|
|
2491
|
-
}
|
|
2492
|
-
function listen(events, func, toAdd) {
|
|
2493
|
-
if (!z)
|
|
2494
|
-
return;
|
|
2495
|
-
var fn = window[(toAdd ? "add" : "remove") + "EventListener"];
|
|
2496
|
-
events.split(" ").forEach(function(ev) {
|
|
2497
|
-
fn(ev, func);
|
|
2498
|
-
});
|
|
2499
|
-
}
|
|
2500
|
-
function check() {
|
|
2501
|
-
return Promise.resolve(!navigator.onLine);
|
|
2502
|
-
}
|
|
2503
|
-
function watch(cb) {
|
|
2504
|
-
var fn = function fn2(_2) {
|
|
2505
|
-
return check().then(cb);
|
|
2506
|
-
};
|
|
2507
|
-
var listener = listen.bind(null, "online offline", fn);
|
|
2508
|
-
listener(true);
|
|
2509
|
-
return function(_2) {
|
|
2510
|
-
return listener(false);
|
|
2511
|
-
};
|
|
2512
|
-
}
|
|
2513
|
-
function Debug() {
|
|
2514
|
-
f$4(LIB_NAME, []);
|
|
2515
|
-
return function(createStore2) {
|
|
2516
|
-
return function(reducer, preloadedState, enhancer) {
|
|
2517
|
-
var store = createStore2(reducer, preloadedState, enhancer);
|
|
2518
|
-
var origDispatch = store.dispatch;
|
|
2519
|
-
var dispatch = function dispatch2(action) {
|
|
2520
|
-
var a2 = action.action || action;
|
|
2521
|
-
n$4[o$6][LIB_NAME].push(a2);
|
|
2522
|
-
return origDispatch(action);
|
|
2523
|
-
};
|
|
2524
|
-
return Object.assign(store, {
|
|
2525
|
-
dispatch
|
|
2526
|
-
});
|
|
2527
|
-
};
|
|
2528
|
-
};
|
|
2529
|
-
}
|
|
2530
|
-
function composeWithDebug(config2) {
|
|
2531
|
-
return function() {
|
|
2532
|
-
return compose(compose.apply(null, arguments), Debug());
|
|
2533
|
-
};
|
|
2534
|
-
}
|
|
2535
|
-
function ensureArray(singleOrArray) {
|
|
2536
|
-
if (!singleOrArray)
|
|
2537
|
-
return [];
|
|
2538
|
-
if (G(singleOrArray))
|
|
2539
|
-
return singleOrArray;
|
|
2540
|
-
return [singleOrArray];
|
|
2541
|
-
}
|
|
2542
|
-
function getCallbackFromArgs(argArray) {
|
|
2543
|
-
var args = argArray || Array.prototype.slice.call(arguments);
|
|
2544
|
-
var cb;
|
|
2545
|
-
for (var i2 = 0; i2 < args.length; i2++) {
|
|
2546
|
-
if (_(args[i2])) {
|
|
2547
|
-
cb = args[i2];
|
|
2548
|
-
break;
|
|
2549
|
-
}
|
|
2550
|
-
}
|
|
2551
|
-
return cb;
|
|
2552
|
-
}
|
|
2553
|
-
function timeStamp() {
|
|
2554
|
-
return new Date().getTime();
|
|
2555
|
-
}
|
|
2556
|
-
function deferredPromiseResolver(resolver, callback) {
|
|
2557
|
-
return function(data) {
|
|
2558
|
-
if (callback)
|
|
2559
|
-
callback(data);
|
|
2560
|
-
resolver(data);
|
|
2561
|
-
};
|
|
2562
|
-
}
|
|
2563
|
-
function generateMeta() {
|
|
2564
|
-
var meta = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2565
|
-
var resolve = arguments.length > 1 ? arguments[1] : void 0;
|
|
2566
|
-
var possibleCallbacks = arguments.length > 2 ? arguments[2] : void 0;
|
|
2567
|
-
var rid = y$1();
|
|
2568
|
-
if (resolve) {
|
|
2569
|
-
stack[rid] = deferredPromiseResolver(resolve, getCallbackFromArgs(possibleCallbacks));
|
|
2570
|
-
}
|
|
2571
|
-
return _objectSpread2$1(_objectSpread2$1({}, meta), {}, {
|
|
2572
|
-
rid,
|
|
2573
|
-
ts: timeStamp()
|
|
2574
|
-
}, !resolve ? {} : {
|
|
2575
|
-
hasCallback: true
|
|
2576
|
-
});
|
|
2577
|
-
}
|
|
2578
|
-
function analytics() {
|
|
2579
|
-
var config2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2580
|
-
var customReducers = config2.reducers || {};
|
|
2581
|
-
var initialUser = config2.initialUser || {};
|
|
2582
|
-
var parsedOptions = (config2.plugins || []).reduce(function(acc, plugin) {
|
|
2583
|
-
if (_(plugin)) {
|
|
2584
|
-
acc.middlewares = acc.middlewares.concat(plugin);
|
|
2585
|
-
return acc;
|
|
2586
|
-
}
|
|
2587
|
-
if (plugin.NAMESPACE)
|
|
2588
|
-
plugin.name = plugin.NAMESPACE;
|
|
2589
|
-
if (!plugin.name) {
|
|
2590
|
-
throw new Error(ERROR_URL + "1");
|
|
2591
|
-
}
|
|
2592
|
-
var definedEvents = plugin.EVENTS ? Object.keys(plugin.EVENTS).map(function(k2) {
|
|
2593
|
-
return plugin.EVENTS[k2];
|
|
2594
|
-
}) : [];
|
|
2595
|
-
var enabledFromMerge = !(plugin.enabled === false);
|
|
2596
|
-
var enabledFromPluginConfig = !(plugin.config && plugin.config.enabled === false);
|
|
2597
|
-
acc.pluginEnabled[plugin.name] = enabledFromMerge && enabledFromPluginConfig;
|
|
2598
|
-
delete plugin.enabled;
|
|
2599
|
-
if (plugin.methods) {
|
|
2600
|
-
acc.methods[plugin.name] = Object.keys(plugin.methods).reduce(function(a2, c2) {
|
|
2601
|
-
a2[c2] = appendArguments(plugin.methods[c2]);
|
|
2602
|
-
return a2;
|
|
2603
|
-
}, {});
|
|
2604
|
-
delete plugin.methods;
|
|
2605
|
-
}
|
|
2606
|
-
var methodsToEvents = Object.keys(plugin);
|
|
2607
|
-
var allEvents = methodsToEvents.concat(definedEvents);
|
|
2608
|
-
var allEventsUnique = new Set(acc.events.concat(allEvents));
|
|
2609
|
-
acc.events = Array.from(allEventsUnique);
|
|
2610
|
-
acc.pluginsArray = acc.pluginsArray.concat(plugin);
|
|
2611
|
-
if (acc.plugins[plugin.name]) {
|
|
2612
|
-
throw new Error(plugin.name + "AlreadyLoaded");
|
|
2613
|
-
}
|
|
2614
|
-
acc.plugins[plugin.name] = plugin;
|
|
2615
|
-
if (!acc.plugins[plugin.name].loaded) {
|
|
2616
|
-
acc.plugins[plugin.name].loaded = function() {
|
|
2617
|
-
return true;
|
|
2618
|
-
};
|
|
2619
|
-
}
|
|
2620
|
-
return acc;
|
|
2621
|
-
}, {
|
|
2622
|
-
plugins: {},
|
|
2623
|
-
pluginEnabled: {},
|
|
2624
|
-
methods: {},
|
|
2625
|
-
pluginsArray: [],
|
|
2626
|
-
middlewares: [],
|
|
2627
|
-
events: []
|
|
2628
|
-
});
|
|
2629
|
-
var storage2 = config2.storage ? config2.storage : {
|
|
2630
|
-
getItem: a$4,
|
|
2631
|
-
setItem: f$4,
|
|
2632
|
-
removeItem: i$4
|
|
2633
|
-
};
|
|
2634
|
-
var getUserProp = getUserPropFunc(storage2);
|
|
2635
|
-
var customPlugins = parsedOptions.plugins;
|
|
2636
|
-
var allPluginEvents = parsedOptions.events.filter(function(name) {
|
|
2637
|
-
return !nonEvents.includes(name);
|
|
2638
|
-
}).sort();
|
|
2639
|
-
var uniqueEvents = new Set(allPluginEvents.concat(coreEvents).filter(function(name) {
|
|
2640
|
-
return !nonEvents.includes(name);
|
|
2641
|
-
}));
|
|
2642
|
-
var allSystemEvents = Array.from(uniqueEvents).sort();
|
|
2643
|
-
var getPlugins = function getPlugins2() {
|
|
2644
|
-
return customPlugins;
|
|
2645
|
-
};
|
|
2646
|
-
var _DynamicMiddleware = new DynamicMiddleware(), addMiddleware = _DynamicMiddleware.addMiddleware, removeMiddleware = _DynamicMiddleware.removeMiddleware, dynamicMiddlewares = _DynamicMiddleware.dynamicMiddlewares;
|
|
2647
|
-
var nonAbortable = function nonAbortable2() {
|
|
2648
|
-
throw new Error("Abort disabled inListener");
|
|
2649
|
-
};
|
|
2650
|
-
var params = s();
|
|
2651
|
-
var persistedUser = getPersistedUserData(storage2);
|
|
2652
|
-
var visitorInfo = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, persistedUser), initialUser), !params.an_uid ? {} : {
|
|
2653
|
-
userId: params.an_uid
|
|
2654
|
-
}), !params.an_aid ? {} : {
|
|
2655
|
-
anonymousId: params.an_aid
|
|
2656
|
-
});
|
|
2657
|
-
if (!visitorInfo.anonymousId) {
|
|
2658
|
-
visitorInfo.anonymousId = y$1();
|
|
2659
|
-
}
|
|
2660
|
-
var plugins = _objectSpread2$1({
|
|
2661
|
-
enable: function enable(plugins2, callback) {
|
|
2662
|
-
return new Promise(function(resolve) {
|
|
2663
|
-
store.dispatch({
|
|
2664
|
-
type: EVENTS$1.enablePlugin,
|
|
2665
|
-
plugins: ensureArray(plugins2),
|
|
2666
|
-
_: {
|
|
2667
|
-
originalAction: EVENTS$1.enablePlugin
|
|
2668
|
-
}
|
|
2669
|
-
}, resolve, [callback]);
|
|
2670
|
-
});
|
|
2671
|
-
},
|
|
2672
|
-
disable: function disable(plugins2, callback) {
|
|
2673
|
-
return new Promise(function(resolve) {
|
|
2674
|
-
store.dispatch({
|
|
2675
|
-
type: EVENTS$1.disablePlugin,
|
|
2676
|
-
plugins: ensureArray(plugins2),
|
|
2677
|
-
_: {
|
|
2678
|
-
originalAction: EVENTS$1.disablePlugin
|
|
2679
|
-
}
|
|
2680
|
-
}, resolve, [callback]);
|
|
2681
|
-
});
|
|
2682
|
-
}
|
|
2683
|
-
}, parsedOptions.methods);
|
|
2684
|
-
var instance = {
|
|
2685
|
-
identify: function() {
|
|
2686
|
-
var _identify = _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee(userId, traits, options, callback) {
|
|
2687
|
-
var id, data, opts, user, resolvedId;
|
|
2688
|
-
return regenerator.wrap(function _callee$(_context) {
|
|
2689
|
-
while (1) {
|
|
2690
|
-
switch (_context.prev = _context.next) {
|
|
2691
|
-
case 0:
|
|
2692
|
-
id = L$1(userId) ? userId : null;
|
|
2693
|
-
data = M$3(userId) ? userId : traits;
|
|
2694
|
-
opts = options || {};
|
|
2695
|
-
user = instance.user();
|
|
2696
|
-
f$4(tempKey(ID), id);
|
|
2697
|
-
resolvedId = id || data.userId || getUserProp(ID, instance, data);
|
|
2698
|
-
return _context.abrupt("return", new Promise(function(resolve) {
|
|
2699
|
-
store.dispatch(_objectSpread2$1({
|
|
2700
|
-
type: EVENTS$1.identifyStart,
|
|
2701
|
-
userId: resolvedId,
|
|
2702
|
-
traits: data || {},
|
|
2703
|
-
options: opts,
|
|
2704
|
-
anonymousId: user.anonymousId
|
|
2705
|
-
}, user.id && user.id !== id && {
|
|
2706
|
-
previousId: user.id
|
|
2707
|
-
}), resolve, [traits, options, callback]);
|
|
2708
|
-
}));
|
|
2709
|
-
case 7:
|
|
2710
|
-
case "end":
|
|
2711
|
-
return _context.stop();
|
|
2712
|
-
}
|
|
2713
|
-
}
|
|
2714
|
-
}, _callee);
|
|
2715
|
-
}));
|
|
2716
|
-
function identify(_x, _x2, _x3, _x4) {
|
|
2717
|
-
return _identify.apply(this, arguments);
|
|
2718
|
-
}
|
|
2719
|
-
return identify;
|
|
2720
|
-
}(),
|
|
2721
|
-
track: function() {
|
|
2722
|
-
var _track = _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee2(eventName, payload, options, callback) {
|
|
2723
|
-
var name, data, opts;
|
|
2724
|
-
return regenerator.wrap(function _callee2$(_context2) {
|
|
2725
|
-
while (1) {
|
|
2726
|
-
switch (_context2.prev = _context2.next) {
|
|
2727
|
-
case 0:
|
|
2728
|
-
name = M$3(eventName) ? eventName.event : eventName;
|
|
2729
|
-
if (!(!name || !L$1(name))) {
|
|
2730
|
-
_context2.next = 3;
|
|
2731
|
-
break;
|
|
2732
|
-
}
|
|
2733
|
-
throw new Error("EventMissing");
|
|
2734
|
-
case 3:
|
|
2735
|
-
data = M$3(eventName) ? eventName : payload || {};
|
|
2736
|
-
opts = M$3(options) ? options : {};
|
|
2737
|
-
return _context2.abrupt("return", new Promise(function(resolve) {
|
|
2738
|
-
store.dispatch({
|
|
2739
|
-
type: EVENTS$1.trackStart,
|
|
2740
|
-
event: name,
|
|
2741
|
-
properties: data,
|
|
2742
|
-
options: opts,
|
|
2743
|
-
userId: getUserProp(ID, instance, payload),
|
|
2744
|
-
anonymousId: getUserProp(ANONID, instance, payload)
|
|
2745
|
-
}, resolve, [payload, options, callback]);
|
|
2746
|
-
}));
|
|
2747
|
-
case 6:
|
|
2748
|
-
case "end":
|
|
2749
|
-
return _context2.stop();
|
|
2750
|
-
}
|
|
2751
|
-
}
|
|
2752
|
-
}, _callee2);
|
|
2753
|
-
}));
|
|
2754
|
-
function track(_x5, _x6, _x7, _x8) {
|
|
2755
|
-
return _track.apply(this, arguments);
|
|
2756
|
-
}
|
|
2757
|
-
return track;
|
|
2758
|
-
}(),
|
|
2759
|
-
page: function() {
|
|
2760
|
-
var _page = _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee3(data, options, callback) {
|
|
2761
|
-
var d2, opts;
|
|
2762
|
-
return regenerator.wrap(function _callee3$(_context3) {
|
|
2763
|
-
while (1) {
|
|
2764
|
-
switch (_context3.prev = _context3.next) {
|
|
2765
|
-
case 0:
|
|
2766
|
-
d2 = M$3(data) ? data : {};
|
|
2767
|
-
opts = M$3(options) ? options : {};
|
|
2768
|
-
return _context3.abrupt("return", new Promise(function(resolve) {
|
|
2769
|
-
store.dispatch({
|
|
2770
|
-
type: EVENTS$1.pageStart,
|
|
2771
|
-
properties: getPageData(d2),
|
|
2772
|
-
options: opts,
|
|
2773
|
-
userId: getUserProp(ID, instance, d2),
|
|
2774
|
-
anonymousId: getUserProp(ANONID, instance, d2)
|
|
2775
|
-
}, resolve, [data, options, callback]);
|
|
2776
|
-
}));
|
|
2777
|
-
case 3:
|
|
2778
|
-
case "end":
|
|
2779
|
-
return _context3.stop();
|
|
2780
|
-
}
|
|
2781
|
-
}
|
|
2782
|
-
}, _callee3);
|
|
2783
|
-
}));
|
|
2784
|
-
function page2(_x9, _x10, _x11) {
|
|
2785
|
-
return _page.apply(this, arguments);
|
|
2786
|
-
}
|
|
2787
|
-
return page2;
|
|
2788
|
-
}(),
|
|
2789
|
-
user: function user(key) {
|
|
2790
|
-
if (key === ID || key === "id") {
|
|
2791
|
-
return getUserProp(ID, instance);
|
|
2792
|
-
}
|
|
2793
|
-
if (key === ANONID || key === "anonId") {
|
|
2794
|
-
return getUserProp(ANONID, instance);
|
|
2795
|
-
}
|
|
2796
|
-
var user2 = instance.getState("user");
|
|
2797
|
-
if (!key)
|
|
2798
|
-
return user2;
|
|
2799
|
-
return dotProp(user2, key);
|
|
2800
|
-
},
|
|
2801
|
-
reset: function reset(callback) {
|
|
2802
|
-
return new Promise(function(resolve) {
|
|
2803
|
-
store.dispatch({
|
|
2804
|
-
type: EVENTS$1.resetStart
|
|
2805
|
-
}, resolve, callback);
|
|
2806
|
-
});
|
|
2807
|
-
},
|
|
2808
|
-
ready: function ready(callback) {
|
|
2809
|
-
return instance.on(EVENTS$1.ready, callback);
|
|
2810
|
-
},
|
|
2811
|
-
on: function on(name, callback) {
|
|
2812
|
-
if (!name || !_(callback)) {
|
|
2813
|
-
return false;
|
|
2814
|
-
}
|
|
2815
|
-
if (name === EVENTS$1.bootstrap) {
|
|
2816
|
-
throw new Error(".on disabled for " + name);
|
|
2817
|
-
}
|
|
2818
|
-
var startRegex = /Start$|Start:/;
|
|
2819
|
-
if (name === "*") {
|
|
2820
|
-
var beforeHandler = function beforeHandler2(store2) {
|
|
2821
|
-
return function(next) {
|
|
2822
|
-
return function(action) {
|
|
2823
|
-
if (action.type.match(startRegex)) {
|
|
2824
|
-
callback({
|
|
2825
|
-
payload: action,
|
|
2826
|
-
instance,
|
|
2827
|
-
plugins: customPlugins
|
|
2828
|
-
});
|
|
2829
|
-
}
|
|
2830
|
-
return next(action);
|
|
2831
|
-
};
|
|
2832
|
-
};
|
|
2833
|
-
};
|
|
2834
|
-
var afterHandler = function afterHandler2(store2) {
|
|
2835
|
-
return function(next) {
|
|
2836
|
-
return function(action) {
|
|
2837
|
-
if (!action.type.match(startRegex)) {
|
|
2838
|
-
callback({
|
|
2839
|
-
payload: action,
|
|
2840
|
-
instance,
|
|
2841
|
-
plugins: customPlugins
|
|
2842
|
-
});
|
|
2843
|
-
}
|
|
2844
|
-
return next(action);
|
|
2845
|
-
};
|
|
2846
|
-
};
|
|
2847
|
-
};
|
|
2848
|
-
addMiddleware(beforeHandler, before);
|
|
2849
|
-
addMiddleware(afterHandler, after);
|
|
2850
|
-
return function() {
|
|
2851
|
-
removeMiddleware(beforeHandler, before);
|
|
2852
|
-
removeMiddleware(afterHandler, after);
|
|
2853
|
-
};
|
|
2854
|
-
}
|
|
2855
|
-
var position = name.match(startRegex) ? before : after;
|
|
2856
|
-
var handler = function handler2(store2) {
|
|
2857
|
-
return function(next) {
|
|
2858
|
-
return function(action) {
|
|
2859
|
-
if (action.type === name) {
|
|
2860
|
-
callback({
|
|
2861
|
-
payload: action,
|
|
2862
|
-
instance,
|
|
2863
|
-
plugins: customPlugins,
|
|
2864
|
-
abort: nonAbortable
|
|
2865
|
-
});
|
|
2866
|
-
}
|
|
2867
|
-
return next(action);
|
|
2868
|
-
};
|
|
2869
|
-
};
|
|
2870
|
-
};
|
|
2871
|
-
addMiddleware(handler, position);
|
|
2872
|
-
return function() {
|
|
2873
|
-
return removeMiddleware(handler, position);
|
|
2874
|
-
};
|
|
2875
|
-
},
|
|
2876
|
-
once: function once(name, callback) {
|
|
2877
|
-
if (!name || !_(callback)) {
|
|
2878
|
-
return false;
|
|
2879
|
-
}
|
|
2880
|
-
if (name === EVENTS$1.bootstrap) {
|
|
2881
|
-
throw new Error(".once disabled for " + name);
|
|
2882
|
-
}
|
|
2883
|
-
var detachListener = instance.on(name, function(_ref2) {
|
|
2884
|
-
var payload = _ref2.payload;
|
|
2885
|
-
callback({
|
|
2886
|
-
payload,
|
|
2887
|
-
instance,
|
|
2888
|
-
plugins: customPlugins,
|
|
2889
|
-
abort: nonAbortable
|
|
2890
|
-
});
|
|
2891
|
-
detachListener();
|
|
2892
|
-
});
|
|
2893
|
-
return detachListener;
|
|
2894
|
-
},
|
|
2895
|
-
getState: function getState(key) {
|
|
2896
|
-
var state = store.getState();
|
|
2897
|
-
if (key)
|
|
2898
|
-
return dotProp(state, key);
|
|
2899
|
-
return Object.assign({}, state);
|
|
2900
|
-
},
|
|
2901
|
-
dispatch: function dispatch(action) {
|
|
2902
|
-
var actionData = L$1(action) ? {
|
|
2903
|
-
type: action
|
|
2904
|
-
} : action;
|
|
2905
|
-
if (isReservedAction(actionData.type)) {
|
|
2906
|
-
throw new Error("reserved action " + actionData.type);
|
|
2907
|
-
}
|
|
2908
|
-
var _private = action._ || {};
|
|
2909
|
-
var dispatchData = _objectSpread2$1(_objectSpread2$1({}, actionData), {}, {
|
|
2910
|
-
_: _objectSpread2$1({
|
|
2911
|
-
originalAction: actionData.type
|
|
2912
|
-
}, _private)
|
|
2913
|
-
});
|
|
2914
|
-
store.dispatch(dispatchData);
|
|
2915
|
-
},
|
|
2916
|
-
enablePlugin: plugins.enable,
|
|
2917
|
-
disablePlugin: plugins.disable,
|
|
2918
|
-
plugins,
|
|
2919
|
-
storage: {
|
|
2920
|
-
getItem: storage2.getItem,
|
|
2921
|
-
setItem: function setItem(key, value, options) {
|
|
2922
|
-
store.dispatch({
|
|
2923
|
-
type: EVENTS$1.setItemStart,
|
|
2924
|
-
key,
|
|
2925
|
-
value,
|
|
2926
|
-
options
|
|
2927
|
-
});
|
|
2928
|
-
},
|
|
2929
|
-
removeItem: function removeItem(key, options) {
|
|
2930
|
-
store.dispatch({
|
|
2931
|
-
type: EVENTS$1.removeItemStart,
|
|
2932
|
-
key,
|
|
2933
|
-
options
|
|
2934
|
-
});
|
|
2935
|
-
}
|
|
2936
|
-
},
|
|
2937
|
-
setAnonymousId: function setAnonymousId(anonymousId, options) {
|
|
2938
|
-
instance.storage.setItem(ANON_ID, anonymousId, options);
|
|
2939
|
-
},
|
|
2940
|
-
events: {
|
|
2941
|
-
all: allSystemEvents,
|
|
2942
|
-
core: coreEvents,
|
|
2943
|
-
plugins: allPluginEvents
|
|
2944
|
-
}
|
|
2945
|
-
};
|
|
2946
|
-
var enrichMiddleware = function enrichMiddleware2(storeAPI) {
|
|
2947
|
-
return function(next) {
|
|
2948
|
-
return function(action) {
|
|
2949
|
-
if (!action.meta) {
|
|
2950
|
-
action.meta = generateMeta();
|
|
2951
|
-
}
|
|
2952
|
-
return next(action);
|
|
2953
|
-
};
|
|
2954
|
-
};
|
|
2955
|
-
};
|
|
2956
|
-
var middlewares = parsedOptions.middlewares.concat([
|
|
2957
|
-
enrichMiddleware,
|
|
2958
|
-
dynamicMiddlewares(before),
|
|
2959
|
-
pluginMiddleware(instance, getPlugins, {
|
|
2960
|
-
all: allSystemEvents,
|
|
2961
|
-
plugins: allPluginEvents
|
|
2962
|
-
}),
|
|
2963
|
-
storageMiddleware(storage2),
|
|
2964
|
-
initializeMiddleware(instance),
|
|
2965
|
-
identifyMiddleware(instance),
|
|
2966
|
-
dynamicMiddlewares(after)
|
|
2967
|
-
]);
|
|
2968
|
-
var coreReducers = {
|
|
2969
|
-
context,
|
|
2970
|
-
user: userReducer(storage2),
|
|
2971
|
-
page,
|
|
2972
|
-
track: trackReducer,
|
|
2973
|
-
plugins: createReducer(getPlugins),
|
|
2974
|
-
queue: queueReducer
|
|
2975
|
-
};
|
|
2976
|
-
var composeEnhancers = compose;
|
|
2977
|
-
var composeWithGlobalDebug = compose;
|
|
2978
|
-
if (z && config2.debug) {
|
|
2979
|
-
var devTools = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
|
2980
|
-
if (devTools) {
|
|
2981
|
-
composeEnhancers = devTools({
|
|
2982
|
-
trace: true,
|
|
2983
|
-
traceLimit: 25
|
|
2984
|
-
});
|
|
2985
|
-
}
|
|
2986
|
-
composeWithGlobalDebug = function composeWithGlobalDebug2() {
|
|
2987
|
-
if (arguments.length === 0)
|
|
2988
|
-
return Debug();
|
|
2989
|
-
if (M$3(_typeof(arguments[0])))
|
|
2990
|
-
return composeWithDebug();
|
|
2991
|
-
return composeWithDebug().apply(null, arguments);
|
|
2992
|
-
};
|
|
2993
|
-
}
|
|
2994
|
-
var initialConfig = makeContext(config2);
|
|
2995
|
-
var intialPluginState = parsedOptions.pluginsArray.reduce(function(acc, plugin) {
|
|
2996
|
-
var name = plugin.name, config3 = plugin.config, loaded = plugin.loaded;
|
|
2997
|
-
var isEnabled = parsedOptions.pluginEnabled[name];
|
|
2998
|
-
acc[name] = {
|
|
2999
|
-
enabled: isEnabled,
|
|
3000
|
-
initialized: isEnabled ? Boolean(!plugin.initialize) : false,
|
|
3001
|
-
loaded: Boolean(loaded()),
|
|
3002
|
-
config: config3 || {}
|
|
3003
|
-
};
|
|
3004
|
-
return acc;
|
|
3005
|
-
}, {});
|
|
3006
|
-
var initialState2 = {
|
|
3007
|
-
context: initialConfig,
|
|
3008
|
-
user: visitorInfo,
|
|
3009
|
-
plugins: intialPluginState
|
|
3010
|
-
};
|
|
3011
|
-
var store = createStore(combineReducers(_objectSpread2$1(_objectSpread2$1({}, coreReducers), customReducers)), initialState2, composeWithGlobalDebug(composeEnhancers(applyMiddleware.apply(void 0, _toConsumableArray(middlewares)))));
|
|
3012
|
-
function enhanceDispatch(fn) {
|
|
3013
|
-
return function(event, resolver, callbacks) {
|
|
3014
|
-
var meta = generateMeta(event.meta, resolver, ensureArray(callbacks));
|
|
3015
|
-
var newEvent = _objectSpread2$1(_objectSpread2$1({}, event), {
|
|
3016
|
-
meta
|
|
3017
|
-
});
|
|
3018
|
-
return fn.apply(null, [newEvent]);
|
|
3019
|
-
};
|
|
3020
|
-
}
|
|
3021
|
-
store.dispatch = enhanceDispatch(store.dispatch);
|
|
3022
|
-
var pluginKeys = Object.keys(customPlugins);
|
|
3023
|
-
store.dispatch({
|
|
3024
|
-
type: EVENTS$1.bootstrap,
|
|
3025
|
-
plugins: pluginKeys,
|
|
3026
|
-
config: initialConfig,
|
|
3027
|
-
params,
|
|
3028
|
-
user: visitorInfo,
|
|
3029
|
-
initialUser,
|
|
3030
|
-
persistedUser
|
|
3031
|
-
});
|
|
3032
|
-
var enabledPlugins = pluginKeys.filter(function(name) {
|
|
3033
|
-
return parsedOptions.pluginEnabled[name];
|
|
3034
|
-
});
|
|
3035
|
-
var disabledPlugins = pluginKeys.filter(function(name) {
|
|
3036
|
-
return !parsedOptions.pluginEnabled[name];
|
|
3037
|
-
});
|
|
3038
|
-
store.dispatch({
|
|
3039
|
-
type: EVENTS$1.registerPlugins,
|
|
3040
|
-
plugins: pluginKeys,
|
|
3041
|
-
enabled: parsedOptions.pluginEnabled
|
|
3042
|
-
});
|
|
3043
|
-
parsedOptions.pluginsArray.map(function(plugin, i2) {
|
|
3044
|
-
var bootstrap = plugin.bootstrap, config3 = plugin.config, name = plugin.name;
|
|
3045
|
-
if (bootstrap && _(bootstrap)) {
|
|
3046
|
-
bootstrap({
|
|
3047
|
-
instance,
|
|
3048
|
-
config: config3,
|
|
3049
|
-
payload: plugin
|
|
3050
|
-
});
|
|
3051
|
-
}
|
|
3052
|
-
store.dispatch({
|
|
3053
|
-
type: EVENTS$1.registerPluginType(name),
|
|
3054
|
-
name,
|
|
3055
|
-
enabled: parsedOptions.pluginEnabled[name],
|
|
3056
|
-
plugin
|
|
3057
|
-
});
|
|
3058
|
-
if (parsedOptions.pluginsArray.length === i2 + 1) {
|
|
3059
|
-
store.dispatch({
|
|
3060
|
-
type: EVENTS$1.initializeStart,
|
|
3061
|
-
plugins: enabledPlugins,
|
|
3062
|
-
disabled: disabledPlugins
|
|
3063
|
-
});
|
|
3064
|
-
}
|
|
3065
|
-
});
|
|
3066
|
-
{
|
|
3067
|
-
watch(function(offline) {
|
|
3068
|
-
store.dispatch({
|
|
3069
|
-
type: offline ? EVENTS$1.offline : EVENTS$1.online
|
|
518
|
+
return e4;
|
|
3070
519
|
});
|
|
3071
520
|
});
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
function appendArguments(fn) {
|
|
3075
|
-
return function() {
|
|
3076
|
-
var args = Array.prototype.slice.call(arguments);
|
|
3077
|
-
var newArgs = new Array(fn.length);
|
|
3078
|
-
for (var i2 = 0; i2 < args.length; i2++) {
|
|
3079
|
-
newArgs[i2] = args[i2];
|
|
3080
|
-
}
|
|
3081
|
-
newArgs[newArgs.length] = instance;
|
|
3082
|
-
return fn.apply({
|
|
3083
|
-
instance
|
|
3084
|
-
}, newArgs);
|
|
3085
|
-
};
|
|
521
|
+
} catch (e3) {
|
|
522
|
+
return Promise.reject(e3);
|
|
3086
523
|
}
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
var
|
|
3090
|
-
|
|
3091
|
-
var o$5 = "object", j$2 = "__", F$2 = typeof process != "undefined" ? process : {};
|
|
3092
|
-
F$2.env && F$2.env.NODE_ENV || "";
|
|
3093
|
-
var $$2 = typeof window != "undefined";
|
|
3094
|
-
F$2.versions != null && F$2.versions.node != null;
|
|
3095
|
-
typeof Deno != "undefined" && Deno.core !== void 0;
|
|
3096
|
-
$$2 && window.name === "nodejs" || typeof navigator != "undefined" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
3097
|
-
function M$2(n2, t2) {
|
|
3098
|
-
return t2.charAt(0)[n2]() + t2.slice(1);
|
|
3099
|
-
}
|
|
3100
|
-
var U$2 = M$2.bind(null, "toUpperCase"), H$2 = M$2.bind(null, "toLowerCase");
|
|
3101
|
-
function J$2(n2) {
|
|
3102
|
-
return Y$2(n2) ? U$2("null") : typeof n2 == "object" ? yn$2(n2) : Object.prototype.toString.call(n2).slice(8, -1);
|
|
3103
|
-
}
|
|
3104
|
-
function R$2(n2, t2) {
|
|
3105
|
-
t2 === void 0 && (t2 = true);
|
|
3106
|
-
var e2 = J$2(n2);
|
|
3107
|
-
return t2 ? H$2(e2) : e2;
|
|
3108
|
-
}
|
|
3109
|
-
function V$2(n2, t2) {
|
|
3110
|
-
return typeof t2 === n2;
|
|
3111
|
-
}
|
|
3112
|
-
var W$2 = V$2.bind(null, "function"), q$2 = V$2.bind(null, "string");
|
|
3113
|
-
V$2.bind(null, "undefined");
|
|
3114
|
-
V$2.bind(null, "boolean");
|
|
3115
|
-
V$2.bind(null, "symbol");
|
|
3116
|
-
function Y$2(n2) {
|
|
3117
|
-
return n2 === null;
|
|
3118
|
-
}
|
|
3119
|
-
function nn$2(n2) {
|
|
3120
|
-
return R$2(n2) === "number" && !isNaN(n2);
|
|
3121
|
-
}
|
|
3122
|
-
function yn$2(n2) {
|
|
3123
|
-
return W$2(n2.constructor) ? n2.constructor.name : null;
|
|
3124
|
-
}
|
|
3125
|
-
function hn$2(n2) {
|
|
3126
|
-
return n2 instanceof Error || q$2(n2.message) && n2.constructor && nn$2(n2.constructor.stackTraceLimit);
|
|
3127
|
-
}
|
|
3128
|
-
function On$2(n2, t2) {
|
|
3129
|
-
if (typeof t2 != "object" || Y$2(t2))
|
|
3130
|
-
return false;
|
|
3131
|
-
if (t2 instanceof n2)
|
|
3132
|
-
return true;
|
|
3133
|
-
var e2 = R$2(new n2(""));
|
|
3134
|
-
if (hn$2(t2))
|
|
3135
|
-
for (; t2; ) {
|
|
3136
|
-
if (R$2(t2) === e2)
|
|
3137
|
-
return true;
|
|
3138
|
-
t2 = Object.getPrototypeOf(t2);
|
|
3139
|
-
}
|
|
3140
|
-
return false;
|
|
3141
|
-
}
|
|
3142
|
-
On$2.bind(null, TypeError);
|
|
3143
|
-
On$2.bind(null, SyntaxError);
|
|
3144
|
-
function $n$2(n2, t2) {
|
|
3145
|
-
var e2 = n2 instanceof Element || n2 instanceof HTMLDocument;
|
|
3146
|
-
return e2 && t2 ? Tn$2(n2, t2) : e2;
|
|
3147
|
-
}
|
|
3148
|
-
function Tn$2(n2, t2) {
|
|
3149
|
-
return t2 === void 0 && (t2 = ""), n2 && n2.nodeName === t2.toUpperCase();
|
|
3150
|
-
}
|
|
3151
|
-
function _n$2(n2) {
|
|
3152
|
-
var t2 = [].slice.call(arguments, 1);
|
|
3153
|
-
return function() {
|
|
3154
|
-
return n2.apply(void 0, [].slice.call(arguments).concat(t2));
|
|
3155
|
-
};
|
|
3156
|
-
}
|
|
3157
|
-
_n$2($n$2, "form");
|
|
3158
|
-
_n$2($n$2, "button");
|
|
3159
|
-
_n$2($n$2, "input");
|
|
3160
|
-
_n$2($n$2, "select");
|
|
3161
|
-
var l = "global", o$4 = j$2 + "global" + j$2, n$2 = typeof self === o$5 && self.self === self && self || typeof global === o$5 && global.global === global && global || void 0;
|
|
3162
|
-
function a$3(t2) {
|
|
3163
|
-
return n$2[o$4][t2];
|
|
3164
|
-
}
|
|
3165
|
-
function f$2(t2, e2) {
|
|
3166
|
-
return n$2[o$4][t2] = e2;
|
|
3167
|
-
}
|
|
3168
|
-
function i$3(t2) {
|
|
3169
|
-
delete n$2[o$4][t2];
|
|
3170
|
-
}
|
|
3171
|
-
n$2[o$4] || (n$2[o$4] = {});
|
|
3172
|
-
var o$3 = "object", j$1 = "__", F$1 = typeof process != "undefined" ? process : {};
|
|
3173
|
-
F$1.env && F$1.env.NODE_ENV || "";
|
|
3174
|
-
var $$1 = typeof window != "undefined";
|
|
3175
|
-
F$1.versions != null && F$1.versions.node != null;
|
|
3176
|
-
typeof Deno != "undefined" && Deno.core !== void 0;
|
|
3177
|
-
$$1 && window.name === "nodejs" || typeof navigator != "undefined" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
3178
|
-
function M$1(n2, t2) {
|
|
3179
|
-
return t2.charAt(0)[n2]() + t2.slice(1);
|
|
3180
|
-
}
|
|
3181
|
-
var U$1 = M$1.bind(null, "toUpperCase"), H$1 = M$1.bind(null, "toLowerCase");
|
|
3182
|
-
function J$1(n2) {
|
|
3183
|
-
return Y$1(n2) ? U$1("null") : typeof n2 == "object" ? yn$1(n2) : Object.prototype.toString.call(n2).slice(8, -1);
|
|
3184
|
-
}
|
|
3185
|
-
function R$1(n2, t2) {
|
|
3186
|
-
t2 === void 0 && (t2 = true);
|
|
3187
|
-
var e2 = J$1(n2);
|
|
3188
|
-
return t2 ? H$1(e2) : e2;
|
|
3189
|
-
}
|
|
3190
|
-
function V$1(n2, t2) {
|
|
3191
|
-
return typeof t2 === n2;
|
|
3192
|
-
}
|
|
3193
|
-
var W$1 = V$1.bind(null, "function"), q$1 = V$1.bind(null, "string");
|
|
3194
|
-
V$1.bind(null, "undefined");
|
|
3195
|
-
V$1.bind(null, "boolean");
|
|
3196
|
-
V$1.bind(null, "symbol");
|
|
3197
|
-
function Y$1(n2) {
|
|
3198
|
-
return n2 === null;
|
|
524
|
+
}, G$1 = /Start$/, K = /^bootstrap/, Q = /^ready/;
|
|
525
|
+
function Y(e2) {
|
|
526
|
+
var n2 = e2.pluginName, t2 = e2.method + "Aborted" + (n2 ? ":" + n2 : "");
|
|
527
|
+
e2.store.dispatch(v({}, e2.data, { type: t2, _: { called: t2, from: "abort" } }));
|
|
3199
528
|
}
|
|
3200
|
-
function
|
|
3201
|
-
|
|
529
|
+
function Z(e2, n2, t2) {
|
|
530
|
+
var r2 = n2[e2] || t2[e2];
|
|
531
|
+
return r2 && r2.config ? r2.config : {};
|
|
3202
532
|
}
|
|
3203
|
-
function
|
|
3204
|
-
return
|
|
533
|
+
function ee(e2, n2) {
|
|
534
|
+
return n2.reduce(function(n3, t2) {
|
|
535
|
+
return t2[e2] ? n3.concat({ methodName: e2, pluginName: t2.name, method: t2[e2] }) : n3;
|
|
536
|
+
}, []);
|
|
3205
537
|
}
|
|
3206
|
-
function
|
|
3207
|
-
|
|
538
|
+
function ne(e2, n2) {
|
|
539
|
+
var t2 = e2.replace(G$1, ""), r2 = n2 ? ":" + n2 : "";
|
|
540
|
+
return ["" + e2 + r2, "" + t2 + r2, t2 + "End" + r2];
|
|
3208
541
|
}
|
|
3209
|
-
function
|
|
3210
|
-
|
|
542
|
+
function te(e2, n2) {
|
|
543
|
+
var t2 = e2.abort;
|
|
544
|
+
return !!t2 && (t2 === true || ae(t2, n2) || t2 && ae(t2.plugins, n2));
|
|
545
|
+
}
|
|
546
|
+
function re(e2, n2) {
|
|
547
|
+
var t2 = e2.abort;
|
|
548
|
+
if (!t2)
|
|
3211
549
|
return false;
|
|
3212
|
-
if (t2
|
|
550
|
+
if (t2 === true || q$1(t2))
|
|
3213
551
|
return true;
|
|
3214
|
-
var
|
|
3215
|
-
|
|
3216
|
-
for (; t2; ) {
|
|
3217
|
-
if (R$1(t2) === e2)
|
|
3218
|
-
return true;
|
|
3219
|
-
t2 = Object.getPrototypeOf(t2);
|
|
3220
|
-
}
|
|
3221
|
-
return false;
|
|
552
|
+
var r2 = t2.plugins;
|
|
553
|
+
return ie(t2) && t2.length === n2 || ie(r2) && r2.length === n2;
|
|
3222
554
|
}
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
function $n$1(n2, t2) {
|
|
3226
|
-
var e2 = n2 instanceof Element || n2 instanceof HTMLDocument;
|
|
3227
|
-
return e2 && t2 ? Tn$1(n2, t2) : e2;
|
|
555
|
+
function ie(e2) {
|
|
556
|
+
return Array.isArray(e2);
|
|
3228
557
|
}
|
|
3229
|
-
function
|
|
3230
|
-
return
|
|
558
|
+
function ae(e2, n2) {
|
|
559
|
+
return !(!e2 || !ie(e2)) && e2.includes(n2);
|
|
3231
560
|
}
|
|
3232
|
-
function
|
|
3233
|
-
var
|
|
3234
|
-
return
|
|
3235
|
-
|
|
561
|
+
function oe(e2) {
|
|
562
|
+
var n2 = e2.match(/(.*):(.*)/);
|
|
563
|
+
return !!n2 && { method: n2[1], name: n2[2] };
|
|
564
|
+
}
|
|
565
|
+
function ue(e2) {
|
|
566
|
+
return Object.keys(e2).reduce(function(n2, t2) {
|
|
567
|
+
return t2 === "type" || (n2[t2] = on(e2[t2]) ? Object.assign({}, e2[t2]) : e2[t2]), n2;
|
|
568
|
+
}, {});
|
|
569
|
+
}
|
|
570
|
+
function ce(e2, n2, t2) {
|
|
571
|
+
var r2 = {};
|
|
572
|
+
return function(i2) {
|
|
573
|
+
return function(a2) {
|
|
574
|
+
return function(o2) {
|
|
575
|
+
try {
|
|
576
|
+
var u2, c2 = function(e3) {
|
|
577
|
+
return u2 ? e3 : a2(f2);
|
|
578
|
+
}, s2 = o2.type, l2 = o2.plugins, f2 = o2;
|
|
579
|
+
if (o2.abort)
|
|
580
|
+
return Promise.resolve(a2(o2));
|
|
581
|
+
if (s2 === q.enablePlugin && i2.dispatch({ type: q.initializeStart, plugins: l2, disabled: [], fromEnable: true, meta: o2.meta }), s2 === q.disablePlugin && setTimeout(function() {
|
|
582
|
+
return J$1(o2.meta.rid, { payload: o2 });
|
|
583
|
+
}, 0), s2 === q.initializeEnd) {
|
|
584
|
+
var m2 = n2(), g2 = Object.keys(m2), h2 = g2.filter(function(e3) {
|
|
585
|
+
return l2.includes(e3);
|
|
586
|
+
}).map(function(e3) {
|
|
587
|
+
return m2[e3];
|
|
588
|
+
}), y2 = [], b2 = [], I2 = o2.disabled, w2 = h2.map(function(e3) {
|
|
589
|
+
var n3 = e3.name;
|
|
590
|
+
return W(e3, e3.loaded, 1e4).then(function(t3) {
|
|
591
|
+
return r2[n3] || (i2.dispatch({ type: q.pluginReadyType(n3), name: n3, events: Object.keys(e3).filter(function(e4) {
|
|
592
|
+
return !M.includes(e4);
|
|
593
|
+
}) }), r2[n3] = true), y2 = y2.concat(n3), e3;
|
|
594
|
+
}).catch(function(e4) {
|
|
595
|
+
if (e4 instanceof Error)
|
|
596
|
+
throw new Error(e4);
|
|
597
|
+
return b2 = b2.concat(e4.name), e4;
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
Promise.all(w2).then(function(e3) {
|
|
601
|
+
var n3 = { plugins: y2, failed: b2, disabled: I2 };
|
|
602
|
+
setTimeout(function() {
|
|
603
|
+
g2.length === w2.length + I2.length && i2.dispatch(v({}, { type: q.ready }, n3));
|
|
604
|
+
}, 0);
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
var E2 = function() {
|
|
608
|
+
if (s2 !== q.bootstrap)
|
|
609
|
+
return /^ready:([^:]*)$/.test(s2) && setTimeout(function() {
|
|
610
|
+
return H(i2, n2, e2);
|
|
611
|
+
}, 0), Promise.resolve(function(e3, n3, t3, r3, i3) {
|
|
612
|
+
try {
|
|
613
|
+
var a3 = W$1(n3) ? n3() : n3, o3 = e3.type, u3 = o3.replace(G$1, "");
|
|
614
|
+
if (e3._ && e3._.called)
|
|
615
|
+
return Promise.resolve(e3);
|
|
616
|
+
var c3 = t3.getState(), s3 = (m3 = a3, (g3 = c3.plugins) === void 0 && (g3 = {}), (h3 = e3.options) === void 0 && (h3 = {}), Object.keys(m3).filter(function(e4) {
|
|
617
|
+
var n4 = h3.plugins || {};
|
|
618
|
+
return Q$1(n4[e4]) ? n4[e4] : n4.all !== false && (!g3[e4] || g3[e4].enabled !== false);
|
|
619
|
+
}).map(function(e4) {
|
|
620
|
+
return m3[e4];
|
|
621
|
+
}));
|
|
622
|
+
o3 === q.initializeStart && e3.fromEnable && (s3 = Object.keys(c3.plugins).filter(function(n4) {
|
|
623
|
+
var t4 = c3.plugins[n4];
|
|
624
|
+
return e3.plugins.includes(n4) && !t4.initialized;
|
|
625
|
+
}).map(function(e4) {
|
|
626
|
+
return a3[e4];
|
|
627
|
+
}));
|
|
628
|
+
var l3 = s3.map(function(e4) {
|
|
629
|
+
return e4.name;
|
|
630
|
+
}), f3 = function(e4, n4, t4) {
|
|
631
|
+
var r4 = ne(e4).map(function(e5) {
|
|
632
|
+
return ee(e5, n4);
|
|
633
|
+
});
|
|
634
|
+
return n4.reduce(function(t5, r5) {
|
|
635
|
+
var i4 = r5.name, a4 = ne(e4, i4).map(function(e5) {
|
|
636
|
+
return ee(e5, n4);
|
|
637
|
+
}), o4 = a4[0], u4 = a4[1], c4 = a4[2];
|
|
638
|
+
return o4.length && (t5.beforeNS[i4] = o4), u4.length && (t5.duringNS[i4] = u4), c4.length && (t5.afterNS[i4] = c4), t5;
|
|
639
|
+
}, { before: r4[0], beforeNS: {}, during: r4[1], duringNS: {}, after: r4[2], afterNS: {} });
|
|
640
|
+
}(o3, s3);
|
|
641
|
+
return Promise.resolve(F$1({ action: e3, data: { exact: f3.before, namespaced: f3.beforeNS }, state: c3, allPlugins: a3, allMatches: f3, instance: t3, store: r3, EVENTS: i3 })).then(function(e4) {
|
|
642
|
+
function n4() {
|
|
643
|
+
var n5 = function() {
|
|
644
|
+
if (o3.match(G$1))
|
|
645
|
+
return Promise.resolve(F$1({ action: v({}, s4, { type: u3 + "End" }), data: { exact: f3.after, namespaced: f3.afterNS }, state: c3, allPlugins: a3, allMatches: f3, instance: t3, store: r3, EVENTS: i3 })).then(function(e5) {
|
|
646
|
+
e5.meta && e5.meta.hasCallback && J$1(e5.meta.rid, { payload: e5 });
|
|
647
|
+
});
|
|
648
|
+
}();
|
|
649
|
+
return n5 && n5.then ? n5.then(function() {
|
|
650
|
+
return e4;
|
|
651
|
+
}) : e4;
|
|
652
|
+
}
|
|
653
|
+
if (re(e4, l3.length))
|
|
654
|
+
return e4;
|
|
655
|
+
var s4, d2 = function() {
|
|
656
|
+
if (o3 !== u3)
|
|
657
|
+
return Promise.resolve(F$1({ action: v({}, e4, { type: u3 }), data: { exact: f3.during, namespaced: f3.duringNS }, state: c3, allPlugins: a3, allMatches: f3, instance: t3, store: r3, EVENTS: i3 })).then(function(e5) {
|
|
658
|
+
s4 = e5;
|
|
659
|
+
});
|
|
660
|
+
s4 = e4;
|
|
661
|
+
}();
|
|
662
|
+
return d2 && d2.then ? d2.then(n4) : n4();
|
|
663
|
+
});
|
|
664
|
+
} catch (e4) {
|
|
665
|
+
return Promise.reject(e4);
|
|
666
|
+
}
|
|
667
|
+
var m3, g3, h3;
|
|
668
|
+
}(o2, n2, e2, i2, t2)).then(function(e3) {
|
|
669
|
+
var n3 = a2(e3);
|
|
670
|
+
return u2 = 1, n3;
|
|
671
|
+
});
|
|
672
|
+
}();
|
|
673
|
+
return Promise.resolve(E2 && E2.then ? E2.then(c2) : c2(E2));
|
|
674
|
+
} catch (e3) {
|
|
675
|
+
return Promise.reject(e3);
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
};
|
|
3236
679
|
};
|
|
3237
680
|
}
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
var
|
|
3243
|
-
|
|
3244
|
-
|
|
681
|
+
function se(e2) {
|
|
682
|
+
return function(n2) {
|
|
683
|
+
return function(n3) {
|
|
684
|
+
return function(t2) {
|
|
685
|
+
var r2 = t2.type, i2 = t2.key, a2 = t2.value, o2 = t2.options;
|
|
686
|
+
if (r2 === q.setItem || r2 === q.removeItem) {
|
|
687
|
+
if (t2.abort)
|
|
688
|
+
return n3(t2);
|
|
689
|
+
r2 === q.setItem ? e2.setItem(i2, a2, o2) : e2.removeItem(i2, o2);
|
|
690
|
+
}
|
|
691
|
+
return n3(t2);
|
|
692
|
+
};
|
|
693
|
+
};
|
|
694
|
+
};
|
|
3245
695
|
}
|
|
3246
|
-
function
|
|
3247
|
-
|
|
696
|
+
var le = function() {
|
|
697
|
+
var e2 = this;
|
|
698
|
+
this.before = [], this.after = [], this.addMiddleware = function(n2, t2) {
|
|
699
|
+
e2[t2] = e2[t2].concat(n2);
|
|
700
|
+
}, this.removeMiddleware = function(n2, t2) {
|
|
701
|
+
var r2 = e2[t2].findIndex(function(e3) {
|
|
702
|
+
return e3 === n2;
|
|
703
|
+
});
|
|
704
|
+
r2 !== -1 && (e2[t2] = [].concat(e2[t2].slice(0, r2), e2[t2].slice(r2 + 1)));
|
|
705
|
+
}, this.dynamicMiddlewares = function(n2) {
|
|
706
|
+
return function(t2) {
|
|
707
|
+
return function(r2) {
|
|
708
|
+
return function(i2) {
|
|
709
|
+
var a2 = { getState: t2.getState, dispatch: function(e3) {
|
|
710
|
+
return t2.dispatch(e3);
|
|
711
|
+
} }, o2 = e2[n2].map(function(e3) {
|
|
712
|
+
return e3(a2);
|
|
713
|
+
});
|
|
714
|
+
return N$1.apply(void 0, o2)(r2)(i2);
|
|
715
|
+
};
|
|
716
|
+
};
|
|
717
|
+
};
|
|
718
|
+
};
|
|
719
|
+
};
|
|
720
|
+
function fe(e2) {
|
|
721
|
+
return function(n2, t2) {
|
|
722
|
+
n2 === void 0 && (n2 = {});
|
|
723
|
+
var r2 = {};
|
|
724
|
+
if (t2.type === "initialize:aborted")
|
|
725
|
+
return n2;
|
|
726
|
+
if (/^registerPlugin:([^:]*)$/.test(t2.type)) {
|
|
727
|
+
var i2 = de(t2.type, "registerPlugin"), a2 = e2()[i2];
|
|
728
|
+
if (!a2 || !i2)
|
|
729
|
+
return n2;
|
|
730
|
+
var o2 = t2.enabled;
|
|
731
|
+
return r2[i2] = { enabled: o2, initialized: !!o2 && Boolean(!a2.initialize), loaded: !!o2 && Boolean(a2.loaded()), config: a2.config || {} }, v({}, n2, r2);
|
|
732
|
+
}
|
|
733
|
+
if (/^initialize:([^:]*)$/.test(t2.type)) {
|
|
734
|
+
var u2 = de(t2.type, q.initialize), c2 = e2()[u2];
|
|
735
|
+
return c2 && u2 ? (r2[u2] = v({}, n2[u2], { initialized: true, loaded: Boolean(c2.loaded()) }), v({}, n2, r2)) : n2;
|
|
736
|
+
}
|
|
737
|
+
if (/^ready:([^:]*)$/.test(t2.type))
|
|
738
|
+
return r2[t2.name] = v({}, n2[t2.name], { loaded: true }), v({}, n2, r2);
|
|
739
|
+
switch (t2.type) {
|
|
740
|
+
case q.disablePlugin:
|
|
741
|
+
return v({}, n2, pe(t2.plugins, false, n2));
|
|
742
|
+
case q.enablePlugin:
|
|
743
|
+
return v({}, n2, pe(t2.plugins, true, n2));
|
|
744
|
+
default:
|
|
745
|
+
return n2;
|
|
746
|
+
}
|
|
747
|
+
};
|
|
3248
748
|
}
|
|
3249
|
-
function
|
|
3250
|
-
|
|
749
|
+
function de(e2, n2) {
|
|
750
|
+
return e2.substring(n2.length + 1, e2.length);
|
|
3251
751
|
}
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
752
|
+
function pe(e2, n2, t2) {
|
|
753
|
+
return e2.reduce(function(e3, r2) {
|
|
754
|
+
return e3[r2] = v({}, t2[r2], { enabled: n2 }), e3;
|
|
755
|
+
}, t2);
|
|
3256
756
|
}
|
|
3257
|
-
function
|
|
3258
|
-
if (i$1 !== void 0)
|
|
3259
|
-
return i$1;
|
|
3260
|
-
var e2 = "cookiecookie";
|
|
757
|
+
function me(e2) {
|
|
3261
758
|
try {
|
|
3262
|
-
|
|
759
|
+
return JSON.parse(JSON.stringify(e2));
|
|
3263
760
|
} catch (e3) {
|
|
3264
|
-
i$1 = false;
|
|
3265
761
|
}
|
|
3266
|
-
return
|
|
762
|
+
return e2;
|
|
3267
763
|
}
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
764
|
+
var ge = { last: {}, history: [] };
|
|
765
|
+
function he(e2, n2) {
|
|
766
|
+
e2 === void 0 && (e2 = ge);
|
|
767
|
+
var t2 = n2.options, r2 = n2.meta;
|
|
768
|
+
if (n2.type === q.track) {
|
|
769
|
+
var i2 = me(v({ event: n2.event, properties: n2.properties }, Object.keys(t2).length && { options: t2 }, { meta: r2 }));
|
|
770
|
+
return v({}, e2, { last: i2, history: e2.history.concat(i2) });
|
|
3272
771
|
}
|
|
772
|
+
return e2;
|
|
3273
773
|
}
|
|
3274
|
-
var
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
}
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
}
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
return
|
|
3307
|
-
}
|
|
3308
|
-
function
|
|
3309
|
-
|
|
774
|
+
var ve = { actions: [] };
|
|
775
|
+
function ye(e2, n2) {
|
|
776
|
+
e2 === void 0 && (e2 = ve);
|
|
777
|
+
var t2 = n2.payload;
|
|
778
|
+
switch (n2.type) {
|
|
779
|
+
case "queue":
|
|
780
|
+
var r2;
|
|
781
|
+
return r2 = t2 && t2.type && t2.type === q.identify ? [n2].concat(e2.actions) : e2.actions.concat(n2), v({}, e2, { actions: r2 });
|
|
782
|
+
case "dequeue":
|
|
783
|
+
return [];
|
|
784
|
+
default:
|
|
785
|
+
return e2;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
var be = /#.*$/;
|
|
789
|
+
function Ie(e2) {
|
|
790
|
+
var n2 = /(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e2);
|
|
791
|
+
return "/" + (n2 && n2[3] ? n2[3].split("?")[0].replace(be, "") : "");
|
|
792
|
+
}
|
|
793
|
+
var we, Ee, Pe, Se, Ne = function(e2) {
|
|
794
|
+
if (e2 === void 0 && (e2 = {}), !$$1)
|
|
795
|
+
return e2;
|
|
796
|
+
var n2 = document, t2 = n2.title, r2 = n2.referrer, i2 = window, a2 = i2.location, o2 = i2.innerWidth, u2 = i2.innerHeight, c2 = a2.hash, s2 = a2.search, l2 = function(e3) {
|
|
797
|
+
var n3 = function() {
|
|
798
|
+
if ($$1) {
|
|
799
|
+
for (var e4, n4 = document.getElementsByTagName("link"), t3 = 0; e4 = n4[t3]; t3++)
|
|
800
|
+
if (e4.getAttribute("rel") === "canonical")
|
|
801
|
+
return e4.getAttribute("href");
|
|
802
|
+
}
|
|
803
|
+
}();
|
|
804
|
+
return n3 ? n3.match(/\?/) ? n3 : n3 + e3 : window.location.href.replace(be, "");
|
|
805
|
+
}(s2), f2 = { title: t2, url: l2, path: Ie(l2), hash: c2, search: s2, width: o2, height: u2 };
|
|
806
|
+
return r2 && r2 !== "" && (f2.referrer = r2), v({}, f2, e2);
|
|
807
|
+
}, Oe = { last: {}, history: [] };
|
|
808
|
+
function Ae(e2, n2) {
|
|
809
|
+
e2 === void 0 && (e2 = Oe);
|
|
810
|
+
var t2 = n2.options;
|
|
811
|
+
if (n2.type === q.page) {
|
|
812
|
+
var r2 = me(v({ properties: n2.properties, meta: n2.meta }, Object.keys(t2).length && { options: t2 }));
|
|
813
|
+
return v({}, e2, { last: r2, history: e2.history.concat(r2) });
|
|
814
|
+
}
|
|
815
|
+
return e2;
|
|
3310
816
|
}
|
|
3311
|
-
function
|
|
3312
|
-
if (
|
|
817
|
+
we = function() {
|
|
818
|
+
if (!$$1)
|
|
3313
819
|
return false;
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
820
|
+
var e2 = navigator.appVersion;
|
|
821
|
+
return ~e2.indexOf("Win") ? "Windows" : ~e2.indexOf("Mac") ? "MacOS" : ~e2.indexOf("X11") ? "UNIX" : ~e2.indexOf("Linux") ? "Linux" : "Unknown OS";
|
|
822
|
+
}(), Ee = $$1 ? document.referrer : null, Pe = o$1(), Se = a$3();
|
|
823
|
+
var _e = { initialized: false, sessionId: y$1(), app: null, version: null, debug: false, offline: !!$$1 && !navigator.onLine, os: { name: we }, userAgent: $$1 ? navigator.userAgent : "node", library: { name: "analytics", version: "0.11.0" }, timezone: Se, locale: Pe, campaign: {}, referrer: Ee };
|
|
824
|
+
function xe(e2, n2) {
|
|
825
|
+
e2 === void 0 && (e2 = _e);
|
|
826
|
+
var t2 = e2.initialized, r2 = n2.campaign;
|
|
827
|
+
switch (n2.type) {
|
|
828
|
+
case q.campaign:
|
|
829
|
+
return v({}, e2, { campaign: r2 });
|
|
830
|
+
case q.offline:
|
|
831
|
+
return v({}, e2, { offline: true });
|
|
832
|
+
case q.online:
|
|
833
|
+
return v({}, e2, { offline: false });
|
|
834
|
+
default:
|
|
835
|
+
return t2 ? e2 : v({}, _e, e2, { initialized: true });
|
|
836
|
+
}
|
|
3330
837
|
}
|
|
3331
|
-
|
|
3332
|
-
|
|
838
|
+
var ke = ["plugins", "reducers", "storage"];
|
|
839
|
+
function je(e2, n2, t2) {
|
|
840
|
+
if ($$1) {
|
|
841
|
+
var r2 = window[(t2 ? "add" : "remove") + "EventListener"];
|
|
842
|
+
e2.split(" ").forEach(function(e3) {
|
|
843
|
+
r2(e3, n2);
|
|
844
|
+
});
|
|
845
|
+
}
|
|
3333
846
|
}
|
|
3334
|
-
function
|
|
3335
|
-
var
|
|
3336
|
-
|
|
3337
|
-
|
|
847
|
+
function Te(e2) {
|
|
848
|
+
var n2 = je.bind(null, "online offline", function(n3) {
|
|
849
|
+
return Promise.resolve(!navigator.onLine).then(e2);
|
|
850
|
+
});
|
|
851
|
+
return n2(true), function(e3) {
|
|
852
|
+
return n2(false);
|
|
3338
853
|
};
|
|
3339
854
|
}
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
855
|
+
function ze() {
|
|
856
|
+
return f("analytics", []), function(e2) {
|
|
857
|
+
return function(n$12, t2, r2) {
|
|
858
|
+
var i2 = e2(n$12, t2, r2), a2 = i2.dispatch;
|
|
859
|
+
return Object.assign(i2, { dispatch: function(e3) {
|
|
860
|
+
return n[o].analytics.push(e3.action || e3), a2(e3);
|
|
861
|
+
} });
|
|
862
|
+
};
|
|
863
|
+
};
|
|
3347
864
|
}
|
|
3348
|
-
function
|
|
3349
|
-
return
|
|
865
|
+
function Me(e2) {
|
|
866
|
+
return function() {
|
|
867
|
+
return N$1(N$1.apply(null, arguments), ze());
|
|
868
|
+
};
|
|
3350
869
|
}
|
|
3351
|
-
function
|
|
3352
|
-
|
|
870
|
+
function qe(e2) {
|
|
871
|
+
return e2 ? rn(e2) ? e2 : [e2] : [];
|
|
3353
872
|
}
|
|
3354
|
-
function
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
873
|
+
function Ue(n2, t2, r2) {
|
|
874
|
+
n2 === void 0 && (n2 = {});
|
|
875
|
+
var i2, a2, o2 = y$1();
|
|
876
|
+
return t2 && (X[o2] = (i2 = t2, a2 = function(e2) {
|
|
877
|
+
for (var n3, t3 = e2 || Array.prototype.slice.call(arguments), r3 = 0; r3 < t3.length; r3++)
|
|
878
|
+
if (W$1(t3[r3])) {
|
|
879
|
+
n3 = t3[r3];
|
|
880
|
+
break;
|
|
881
|
+
}
|
|
882
|
+
return n3;
|
|
883
|
+
}(r2), function(e2) {
|
|
884
|
+
a2 && a2(e2), i2(e2);
|
|
885
|
+
})), v({}, n2, { rid: o2, ts: new Date().getTime() }, t2 ? { hasCallback: true } : {});
|
|
886
|
+
}
|
|
887
|
+
function Ve(n2) {
|
|
888
|
+
n2 === void 0 && (n2 = {});
|
|
889
|
+
var t2 = n2.reducers || {}, c2 = n2.initialUser || {}, s$1 = (n2.plugins || []).reduce(function(e2, n3) {
|
|
890
|
+
if (W$1(n3))
|
|
891
|
+
return e2.middlewares = e2.middlewares.concat(n3), e2;
|
|
892
|
+
if (n3.NAMESPACE && (n3.name = n3.NAMESPACE), !n3.name)
|
|
893
|
+
throw new Error("https://lytics.dev/errors/1");
|
|
894
|
+
var t3 = n3.EVENTS ? Object.keys(n3.EVENTS).map(function(e3) {
|
|
895
|
+
return n3.EVENTS[e3];
|
|
896
|
+
}) : [];
|
|
897
|
+
e2.pluginEnabled[n3.name] = !(n3.enabled === false || n3.config && n3.config.enabled === false), delete n3.enabled, n3.methods && (e2.methods[n3.name] = Object.keys(n3.methods).reduce(function(e3, t4) {
|
|
898
|
+
var r3;
|
|
899
|
+
return e3[t4] = (r3 = n3.methods[t4], function() {
|
|
900
|
+
for (var e4 = Array.prototype.slice.call(arguments), n4 = new Array(r3.length), t5 = 0; t5 < e4.length; t5++)
|
|
901
|
+
n4[t5] = e4[t5];
|
|
902
|
+
return n4[n4.length] = K2, r3.apply({ instance: K2 }, n4);
|
|
903
|
+
}), e3;
|
|
904
|
+
}, {}), delete n3.methods);
|
|
905
|
+
var r2 = Object.keys(n3).concat(t3), i2 = new Set(e2.events.concat(r2));
|
|
906
|
+
if (e2.events = Array.from(i2), e2.pluginsArray = e2.pluginsArray.concat(n3), e2.plugins[n3.name])
|
|
907
|
+
throw new Error(n3.name + "AlreadyLoaded");
|
|
908
|
+
return e2.plugins[n3.name] = n3, e2.plugins[n3.name].loaded || (e2.plugins[n3.name].loaded = function() {
|
|
909
|
+
return true;
|
|
910
|
+
}), e2;
|
|
911
|
+
}, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), f$1 = n2.storage ? n2.storage : { getItem: a$2, setItem: f, removeItem: i$2 }, p = function(e2) {
|
|
912
|
+
return function(n3, t3, r2) {
|
|
913
|
+
return t3.getState("user")[n3] || (r2 && on(r2) && r2[n3] ? r2[n3] : $(e2)[n3] || a$2(D(n3)) || null);
|
|
914
|
+
};
|
|
915
|
+
}(f$1), h2 = s$1.plugins, w2 = s$1.events.filter(function(e2) {
|
|
916
|
+
return !M.includes(e2);
|
|
917
|
+
}).sort(), E2 = new Set(w2.concat(z).filter(function(e2) {
|
|
918
|
+
return !M.includes(e2);
|
|
919
|
+
})), _2 = Array.from(E2).sort(), x2 = function() {
|
|
920
|
+
return h2;
|
|
921
|
+
}, k2 = new le(), U2 = k2.addMiddleware, V2 = k2.removeMiddleware, L2 = k2.dynamicMiddlewares, X2 = function() {
|
|
922
|
+
throw new Error("Abort disabled inListener");
|
|
923
|
+
}, J2 = s(), W2 = $(f$1), F2 = v({}, W2, c2, J2.an_uid ? { userId: J2.an_uid } : {}, J2.an_aid ? { anonymousId: J2.an_aid } : {});
|
|
924
|
+
F2.anonymousId || (F2.anonymousId = y$1());
|
|
925
|
+
var G2 = v({ enable: function(e2, n3) {
|
|
926
|
+
return new Promise(function(t3) {
|
|
927
|
+
oe2.dispatch({ type: q.enablePlugin, plugins: qe(e2), _: { originalAction: q.enablePlugin } }, t3, [n3]);
|
|
928
|
+
});
|
|
929
|
+
}, disable: function(e2, n3) {
|
|
930
|
+
return new Promise(function(t3) {
|
|
931
|
+
oe2.dispatch({ type: q.disablePlugin, plugins: qe(e2), _: { originalAction: q.disablePlugin } }, t3, [n3]);
|
|
932
|
+
});
|
|
933
|
+
} }, s$1.methods), K2 = { identify: function(e2, n3, t3, r2) {
|
|
934
|
+
try {
|
|
935
|
+
var i2 = q$1(e2) ? e2 : null, a2 = on(e2) ? e2 : n3, o2 = t3 || {}, c3 = K2.user();
|
|
936
|
+
f(D(j), i2);
|
|
937
|
+
var s2 = i2 || a2.userId || p(j, K2, a2);
|
|
938
|
+
return Promise.resolve(new Promise(function(e3) {
|
|
939
|
+
oe2.dispatch(v({ type: q.identifyStart, userId: s2, traits: a2 || {}, options: o2, anonymousId: c3.anonymousId }, c3.id && c3.id !== i2 && { previousId: c3.id }), e3, [n3, t3, r2]);
|
|
940
|
+
}));
|
|
941
|
+
} catch (e3) {
|
|
942
|
+
return Promise.reject(e3);
|
|
3360
943
|
}
|
|
3361
|
-
}
|
|
944
|
+
}, track: function(e2, n3, t3, r2) {
|
|
945
|
+
try {
|
|
946
|
+
var i2 = on(e2) ? e2.event : e2;
|
|
947
|
+
if (!i2 || !q$1(i2))
|
|
948
|
+
throw new Error("EventMissing");
|
|
949
|
+
var a2 = on(e2) ? e2 : n3 || {}, o2 = on(t3) ? t3 : {};
|
|
950
|
+
return Promise.resolve(new Promise(function(e3) {
|
|
951
|
+
oe2.dispatch({ type: q.trackStart, event: i2, properties: a2, options: o2, userId: p(j, K2, n3), anonymousId: p(T, K2, n3) }, e3, [n3, t3, r2]);
|
|
952
|
+
}));
|
|
953
|
+
} catch (e3) {
|
|
954
|
+
return Promise.reject(e3);
|
|
955
|
+
}
|
|
956
|
+
}, page: function(e2, n3, t3) {
|
|
957
|
+
try {
|
|
958
|
+
var r2 = on(e2) ? e2 : {}, i2 = on(n3) ? n3 : {};
|
|
959
|
+
return Promise.resolve(new Promise(function(a2) {
|
|
960
|
+
oe2.dispatch({ type: q.pageStart, properties: Ne(r2), options: i2, userId: p(j, K2, r2), anonymousId: p(T, K2, r2) }, a2, [e2, n3, t3]);
|
|
961
|
+
}));
|
|
962
|
+
} catch (e3) {
|
|
963
|
+
return Promise.reject(e3);
|
|
964
|
+
}
|
|
965
|
+
}, user: function(e2) {
|
|
966
|
+
if (e2 === j || e2 === "id")
|
|
967
|
+
return p(j, K2);
|
|
968
|
+
if (e2 === T || e2 === "anonId")
|
|
969
|
+
return p(T, K2);
|
|
970
|
+
var n3 = K2.getState("user");
|
|
971
|
+
return e2 ? i$3(n3, e2) : n3;
|
|
972
|
+
}, reset: function(e2) {
|
|
973
|
+
return new Promise(function(n3) {
|
|
974
|
+
oe2.dispatch({ type: q.resetStart }, n3, e2);
|
|
975
|
+
});
|
|
976
|
+
}, ready: function(e2) {
|
|
977
|
+
return K2.on(q.ready, e2);
|
|
978
|
+
}, on: function(e2, n3) {
|
|
979
|
+
if (!e2 || !W$1(n3))
|
|
980
|
+
return false;
|
|
981
|
+
if (e2 === q.bootstrap)
|
|
982
|
+
throw new Error(".on disabled for " + e2);
|
|
983
|
+
var t3 = /Start$|Start:/;
|
|
984
|
+
if (e2 === "*") {
|
|
985
|
+
var r2 = function(e3) {
|
|
986
|
+
return function(e4) {
|
|
987
|
+
return function(r3) {
|
|
988
|
+
return r3.type.match(t3) && n3({ payload: r3, instance: K2, plugins: h2 }), e4(r3);
|
|
989
|
+
};
|
|
990
|
+
};
|
|
991
|
+
}, i2 = function(e3) {
|
|
992
|
+
return function(e4) {
|
|
993
|
+
return function(r3) {
|
|
994
|
+
return r3.type.match(t3) || n3({ payload: r3, instance: K2, plugins: h2 }), e4(r3);
|
|
995
|
+
};
|
|
996
|
+
};
|
|
997
|
+
};
|
|
998
|
+
return U2(r2, Le), U2(i2, Ce), function() {
|
|
999
|
+
V2(r2, Le), V2(i2, Ce);
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
var a2 = e2.match(t3) ? Le : Ce, o2 = function(t4) {
|
|
1003
|
+
return function(t5) {
|
|
1004
|
+
return function(r3) {
|
|
1005
|
+
return r3.type === e2 && n3({ payload: r3, instance: K2, plugins: h2, abort: X2 }), t5(r3);
|
|
1006
|
+
};
|
|
1007
|
+
};
|
|
1008
|
+
};
|
|
1009
|
+
return U2(o2, a2), function() {
|
|
1010
|
+
return V2(o2, a2);
|
|
1011
|
+
};
|
|
1012
|
+
}, once: function(e2, n3) {
|
|
1013
|
+
if (!e2 || !W$1(n3))
|
|
1014
|
+
return false;
|
|
1015
|
+
if (e2 === q.bootstrap)
|
|
1016
|
+
throw new Error(".once disabled for " + e2);
|
|
1017
|
+
var t3 = K2.on(e2, function(e3) {
|
|
1018
|
+
n3({ payload: e3.payload, instance: K2, plugins: h2, abort: X2 }), t3();
|
|
1019
|
+
});
|
|
1020
|
+
return t3;
|
|
1021
|
+
}, getState: function(e2) {
|
|
1022
|
+
var n3 = oe2.getState();
|
|
1023
|
+
return e2 ? i$3(n3, e2) : Object.assign({}, n3);
|
|
1024
|
+
}, dispatch: function(e2) {
|
|
1025
|
+
var n3 = q$1(e2) ? { type: e2 } : e2;
|
|
1026
|
+
if (z.includes(n3.type))
|
|
1027
|
+
throw new Error("reserved action " + n3.type);
|
|
1028
|
+
var t3 = v({}, n3, { _: v({ originalAction: n3.type }, e2._ || {}) });
|
|
1029
|
+
oe2.dispatch(t3);
|
|
1030
|
+
}, enablePlugin: G2.enable, disablePlugin: G2.disable, plugins: G2, storage: { getItem: f$1.getItem, setItem: function(e2, n3, t3) {
|
|
1031
|
+
oe2.dispatch({ type: q.setItemStart, key: e2, value: n3, options: t3 });
|
|
1032
|
+
}, removeItem: function(e2, n3) {
|
|
1033
|
+
oe2.dispatch({ type: q.removeItemStart, key: e2, options: n3 });
|
|
1034
|
+
} }, setAnonymousId: function(e2, n3) {
|
|
1035
|
+
K2.storage.setItem(A$1, e2, n3);
|
|
1036
|
+
}, events: { core: z, plugins: w2 } }, Q2 = s$1.middlewares.concat([function(e2) {
|
|
1037
|
+
return function(e3) {
|
|
1038
|
+
return function(n3) {
|
|
1039
|
+
return n3.meta || (n3.meta = Ue()), e3(n3);
|
|
1040
|
+
};
|
|
1041
|
+
};
|
|
1042
|
+
}, L2(Le), ce(K2, x2, { all: _2, plugins: w2 }), se(f$1), C$1(K2), B(K2), L2(Ce)]), Y2 = { context: xe, user: R(f$1), page: Ae, track: he, plugins: fe(x2), queue: ye }, Z2 = N$1, ee2 = N$1;
|
|
1043
|
+
if ($$1 && n2.debug) {
|
|
1044
|
+
var ne2 = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
|
1045
|
+
ne2 && (Z2 = ne2({ trace: true, traceLimit: 25 })), ee2 = function() {
|
|
1046
|
+
return arguments.length === 0 ? ze() : on(typeof arguments[0]) ? Me() : Me().apply(null, arguments);
|
|
1047
|
+
};
|
|
3362
1048
|
}
|
|
3363
|
-
|
|
1049
|
+
var te2, re2 = function(e2) {
|
|
1050
|
+
return Object.keys(e2).reduce(function(n3, t3) {
|
|
1051
|
+
return ke.includes(t3) || (n3[t3] = e2[t3]), n3;
|
|
1052
|
+
}, {});
|
|
1053
|
+
}(n2), ie2 = s$1.pluginsArray.reduce(function(e2, n3) {
|
|
1054
|
+
var t3 = n3.name, r2 = n3.config, i2 = n3.loaded, a2 = s$1.pluginEnabled[t3];
|
|
1055
|
+
return e2[t3] = { enabled: a2, initialized: !!a2 && Boolean(!n3.initialize), loaded: Boolean(i2()), config: r2 || {} }, e2;
|
|
1056
|
+
}, {}), ae2 = { context: re2, user: F2, plugins: ie2 }, oe2 = P(function(e2) {
|
|
1057
|
+
for (var n3 = Object.keys(e2), t3 = {}, r2 = 0; r2 < n3.length; r2++) {
|
|
1058
|
+
var i2 = n3[r2];
|
|
1059
|
+
typeof e2[i2] === y && (t3[i2] = e2[i2]);
|
|
1060
|
+
}
|
|
1061
|
+
var a2, o2 = Object.keys(t3);
|
|
1062
|
+
try {
|
|
1063
|
+
!function(e3) {
|
|
1064
|
+
Object.keys(e3).forEach(function(n4) {
|
|
1065
|
+
var t4 = e3[n4];
|
|
1066
|
+
if (typeof t4(void 0, { type: "@@redux/INIT" }) === b$1 || typeof t4(void 0, { type: I$1 }) === b$1)
|
|
1067
|
+
throw new Error("reducer " + n4 + " " + b$1);
|
|
1068
|
+
});
|
|
1069
|
+
}(t3);
|
|
1070
|
+
} catch (e3) {
|
|
1071
|
+
a2 = e3;
|
|
1072
|
+
}
|
|
1073
|
+
return function(e3, n4) {
|
|
1074
|
+
if (e3 === void 0 && (e3 = {}), a2)
|
|
1075
|
+
throw a2;
|
|
1076
|
+
for (var r3 = false, i3 = {}, u2 = 0; u2 < o2.length; u2++) {
|
|
1077
|
+
var c3 = o2[u2], s2 = e3[c3], l2 = (0, t3[c3])(s2, n4);
|
|
1078
|
+
if (typeof l2 === b$1) {
|
|
1079
|
+
var f2 = S(c3, n4);
|
|
1080
|
+
throw new Error(f2);
|
|
1081
|
+
}
|
|
1082
|
+
i3[c3] = l2, r3 = r3 || l2 !== s2;
|
|
1083
|
+
}
|
|
1084
|
+
return r3 ? i3 : e3;
|
|
1085
|
+
};
|
|
1086
|
+
}(v({}, Y2, t2)), ae2, ee2(Z2(O$1.apply(void 0, Q2))));
|
|
1087
|
+
oe2.dispatch = (te2 = oe2.dispatch, function(e2, n3, t3) {
|
|
1088
|
+
var r2 = v({}, e2, { meta: Ue(e2.meta, n3, qe(t3)) });
|
|
1089
|
+
return te2.apply(null, [r2]);
|
|
1090
|
+
});
|
|
1091
|
+
var ue2 = Object.keys(h2);
|
|
1092
|
+
oe2.dispatch({ type: q.bootstrap, plugins: ue2, config: re2, params: J2, user: F2, initialUser: c2, persistedUser: W2 });
|
|
1093
|
+
var de2 = ue2.filter(function(e2) {
|
|
1094
|
+
return s$1.pluginEnabled[e2];
|
|
1095
|
+
}), pe2 = ue2.filter(function(e2) {
|
|
1096
|
+
return !s$1.pluginEnabled[e2];
|
|
1097
|
+
});
|
|
1098
|
+
return oe2.dispatch({ type: q.registerPlugins, plugins: ue2, enabled: s$1.pluginEnabled }), s$1.pluginsArray.map(function(e2, n3) {
|
|
1099
|
+
var t3 = e2.bootstrap, r2 = e2.config, i2 = e2.name;
|
|
1100
|
+
t3 && W$1(t3) && t3({ instance: K2, config: r2, payload: e2 }), oe2.dispatch({ type: q.registerPluginType(i2), name: i2, enabled: s$1.pluginEnabled[i2], plugin: e2 }), s$1.pluginsArray.length === n3 + 1 && oe2.dispatch({ type: q.initializeStart, plugins: de2, disabled: pe2 });
|
|
1101
|
+
}), Te(function(e2) {
|
|
1102
|
+
oe2.dispatch({ type: e2 ? q.offline : q.online });
|
|
1103
|
+
}), function(e2, n3, t3) {
|
|
1104
|
+
setInterval(function() {
|
|
1105
|
+
return H(e2, n3, t3);
|
|
1106
|
+
}, 3e3);
|
|
1107
|
+
}(oe2, x2, K2), K2;
|
|
1108
|
+
}
|
|
1109
|
+
var Le = "before", Ce = "after";
|
|
1110
|
+
var t = "cookie", i$1 = a$1(), r$1 = d$1, c = d$1;
|
|
1111
|
+
function u(o2) {
|
|
1112
|
+
return i$1 ? d$1(o2, "", -1) : i$2(o2);
|
|
3364
1113
|
}
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
return c[t2];
|
|
1114
|
+
function a$1() {
|
|
1115
|
+
if (i$1 !== void 0)
|
|
1116
|
+
return i$1;
|
|
1117
|
+
var e2 = "cookiecookie";
|
|
3370
1118
|
try {
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
return c[t2] = false;
|
|
1119
|
+
d$1(e2, e2), i$1 = document.cookie.indexOf(e2) !== -1, u(e2);
|
|
1120
|
+
} catch (e3) {
|
|
1121
|
+
i$1 = false;
|
|
3375
1122
|
}
|
|
3376
|
-
return
|
|
1123
|
+
return i$1;
|
|
3377
1124
|
}
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
1125
|
+
function d$1(e2, t2, r2, c2, u2, a2) {
|
|
1126
|
+
if (typeof window != "undefined") {
|
|
1127
|
+
var d2 = arguments.length > 1;
|
|
1128
|
+
return i$1 === false && (d2 ? f(e2, t2) : a$2(e2)), d2 ? document.cookie = e2 + "=" + encodeURIComponent(t2) + (r2 ? "; expires=" + new Date(+new Date() + 1e3 * r2).toUTCString() + (c2 ? "; path=" + c2 : "") + (u2 ? "; domain=" + u2 : "") + (a2 ? "; secure" : "") : "") : decodeURIComponent((("; " + document.cookie).split("; " + e2 + "=")[1] || "").split(";")[0]);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
var r = "localStorage", g = b$2.bind(null, "localStorage");
|
|
1132
|
+
u$1("localStorage", "getItem", a$2);
|
|
1133
|
+
u$1("localStorage", "setItem", f);
|
|
1134
|
+
u$1("localStorage", "removeItem", i$2);
|
|
1135
|
+
var a = "sessionStorage", i = b$2.bind(null, "sessionStorage");
|
|
1136
|
+
u$1("sessionStorage", "getItem", a$2);
|
|
1137
|
+
u$1("sessionStorage", "setItem", f);
|
|
1138
|
+
u$1("sessionStorage", "removeItem", i$2);
|
|
1139
|
+
function I(t2) {
|
|
3383
1140
|
var o2 = t2;
|
|
3384
1141
|
try {
|
|
3385
1142
|
if ((o2 = JSON.parse(t2)) === "true")
|
|
3386
1143
|
return true;
|
|
3387
1144
|
if (o2 === "false")
|
|
3388
1145
|
return false;
|
|
3389
|
-
if (
|
|
1146
|
+
if (on(o2))
|
|
3390
1147
|
return o2;
|
|
3391
1148
|
parseFloat(o2) === o2 && (o2 = parseFloat(o2));
|
|
3392
1149
|
} catch (t3) {
|
|
@@ -3394,52 +1151,57 @@ function y(t2) {
|
|
|
3394
1151
|
if (o2 !== null && o2 !== "")
|
|
3395
1152
|
return o2;
|
|
3396
1153
|
}
|
|
3397
|
-
var
|
|
3398
|
-
function
|
|
1154
|
+
var k = g(), O = i(), x = a$1();
|
|
1155
|
+
function C(o2, e2) {
|
|
3399
1156
|
if (o2) {
|
|
3400
|
-
var
|
|
3401
|
-
if (a2 &&
|
|
3402
|
-
return
|
|
3403
|
-
var n2 =
|
|
1157
|
+
var r2 = A(e2), a2 = !N(r2), i2 = d(r2) ? I(localStorage.getItem(o2)) : void 0;
|
|
1158
|
+
if (a2 && !I$2(i2))
|
|
1159
|
+
return i2;
|
|
1160
|
+
var n2 = h(r2) ? I(r$1(o2)) : void 0;
|
|
3404
1161
|
if (a2 && n2)
|
|
3405
1162
|
return n2;
|
|
3406
|
-
var
|
|
3407
|
-
|
|
1163
|
+
var l2 = E(r2) ? I(sessionStorage.getItem(o2)) : void 0;
|
|
1164
|
+
if (a2 && l2)
|
|
1165
|
+
return l2;
|
|
1166
|
+
var u2 = a$2(o2);
|
|
1167
|
+
return a2 ? u2 : { localStorage: i2, sessionStorage: l2, cookie: n2, global: u2 };
|
|
3408
1168
|
}
|
|
3409
1169
|
}
|
|
3410
|
-
function
|
|
3411
|
-
if (
|
|
3412
|
-
var
|
|
3413
|
-
return
|
|
1170
|
+
function L(r$2, a$12, l$1) {
|
|
1171
|
+
if (r$2 && !I$2(a$12)) {
|
|
1172
|
+
var u2 = {}, g2 = A(l$1), m2 = JSON.stringify(a$12), S2 = !N(g2);
|
|
1173
|
+
return d(g2) && (u2[r] = F(r, a$12, I(localStorage.getItem(r$2))), localStorage.setItem(r$2, m2), S2) ? u2[r] : h(g2) && (u2[t] = F(t, a$12, I(r$1(r$2))), c(r$2, m2), S2) ? u2[t] : E(g2) && (u2[a] = F(a, a$12, I(sessionStorage.getItem(r$2))), sessionStorage.setItem(r$2, m2), S2) ? u2[a] : (u2[l] = F(l, a$12, a$2(r$2)), f(r$2, a$12), S2 ? u2[l] : u2);
|
|
3414
1174
|
}
|
|
3415
1175
|
}
|
|
3416
|
-
function
|
|
1176
|
+
function b(t$1, e2) {
|
|
3417
1177
|
if (t$1) {
|
|
3418
|
-
var
|
|
3419
|
-
return
|
|
1178
|
+
var a$12 = A(e2), s2 = C(t$1, m$1), n2 = {};
|
|
1179
|
+
return !I$2(s2.localStorage) && d(a$12) && (localStorage.removeItem(t$1), n2[r] = s2.localStorage), !I$2(s2.cookie) && h(a$12) && (u(t$1), n2[t] = s2.cookie), !I$2(s2.sessionStorage) && E(a$12) && (sessionStorage.removeItem(t$1), n2[a] = s2.sessionStorage), !I$2(s2.global) && G(a$12, l) && (i$2(t$1), n2[l] = s2.global), n2;
|
|
3420
1180
|
}
|
|
3421
1181
|
}
|
|
3422
|
-
function
|
|
3423
|
-
return t2 ?
|
|
1182
|
+
function A(t2) {
|
|
1183
|
+
return t2 ? q$1(t2) ? t2 : t2.storage : g$1;
|
|
1184
|
+
}
|
|
1185
|
+
function d(t2) {
|
|
1186
|
+
return k && G(t2, r);
|
|
3424
1187
|
}
|
|
3425
|
-
function
|
|
3426
|
-
return
|
|
1188
|
+
function h(t$1) {
|
|
1189
|
+
return x && G(t$1, t);
|
|
3427
1190
|
}
|
|
3428
|
-
function
|
|
3429
|
-
return
|
|
1191
|
+
function E(t2) {
|
|
1192
|
+
return O && G(t2, a);
|
|
3430
1193
|
}
|
|
3431
|
-
function
|
|
3432
|
-
return t2 ===
|
|
1194
|
+
function N(t2) {
|
|
1195
|
+
return t2 === m$1 || t2 === "all";
|
|
3433
1196
|
}
|
|
3434
|
-
function
|
|
3435
|
-
return t2 ===
|
|
1197
|
+
function G(t2, o2) {
|
|
1198
|
+
return t2 === g$1 || t2 === o2 || N(t2);
|
|
3436
1199
|
}
|
|
3437
|
-
function
|
|
3438
|
-
return { location: t2, current: o2, previous:
|
|
1200
|
+
function F(t2, o2, e2) {
|
|
1201
|
+
return { location: t2, current: o2, previous: e2 };
|
|
3439
1202
|
}
|
|
3440
|
-
var
|
|
3441
|
-
|
|
3442
|
-
function _defineProperty$1(obj, key, value) {
|
|
1203
|
+
var J = { setItem: L, getItem: C, removeItem: b };
|
|
1204
|
+
function _defineProperty(obj, key, value) {
|
|
3443
1205
|
if (key in obj) {
|
|
3444
1206
|
Object.defineProperty(obj, key, {
|
|
3445
1207
|
value,
|
|
@@ -3452,169 +1214,78 @@ function _defineProperty$1(obj, key, value) {
|
|
|
3452
1214
|
}
|
|
3453
1215
|
return obj;
|
|
3454
1216
|
}
|
|
3455
|
-
var defineProperty = _defineProperty$1;
|
|
3456
1217
|
function ownKeys(object, enumerableOnly) {
|
|
3457
1218
|
var keys = Object.keys(object);
|
|
3458
1219
|
if (Object.getOwnPropertySymbols) {
|
|
3459
1220
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
});
|
|
3464
|
-
keys.push.apply(keys, symbols);
|
|
1221
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
1222
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1223
|
+
})), keys.push.apply(keys, symbols);
|
|
3465
1224
|
}
|
|
3466
1225
|
return keys;
|
|
3467
1226
|
}
|
|
3468
1227
|
function _objectSpread2(target) {
|
|
3469
1228
|
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
3470
1229
|
var source = arguments[i2] != null ? arguments[i2] : {};
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
}
|
|
3476
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
3477
|
-
} else {
|
|
3478
|
-
ownKeys(source).forEach(function(key) {
|
|
3479
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
3480
|
-
});
|
|
3481
|
-
}
|
|
1230
|
+
i2 % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
1231
|
+
_defineProperty(target, key, source[key]);
|
|
1232
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
1233
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1234
|
+
});
|
|
3482
1235
|
}
|
|
3483
1236
|
return target;
|
|
3484
1237
|
}
|
|
3485
|
-
var objectSpread2 = _objectSpread2;
|
|
3486
1238
|
function analyticsLib() {
|
|
3487
1239
|
var opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
3488
1240
|
var defaultSettings = {
|
|
3489
|
-
storage
|
|
1241
|
+
storage: J
|
|
3490
1242
|
};
|
|
3491
|
-
return
|
|
3492
|
-
}
|
|
3493
|
-
function _defineProperty(obj, key, value) {
|
|
3494
|
-
if (key in obj) {
|
|
3495
|
-
Object.defineProperty(obj, key, {
|
|
3496
|
-
value,
|
|
3497
|
-
enumerable: true,
|
|
3498
|
-
configurable: true,
|
|
3499
|
-
writable: true
|
|
3500
|
-
});
|
|
3501
|
-
} else {
|
|
3502
|
-
obj[key] = value;
|
|
3503
|
-
}
|
|
3504
|
-
return obj;
|
|
3505
|
-
}
|
|
3506
|
-
function _objectSpread(target) {
|
|
3507
|
-
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
3508
|
-
var source = arguments[i2] != null ? arguments[i2] : {};
|
|
3509
|
-
var ownKeys2 = Object.keys(source);
|
|
3510
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
3511
|
-
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
3512
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
3513
|
-
}));
|
|
3514
|
-
}
|
|
3515
|
-
ownKeys2.forEach(function(key) {
|
|
3516
|
-
_defineProperty(target, key, source[key]);
|
|
3517
|
-
});
|
|
3518
|
-
}
|
|
3519
|
-
return target;
|
|
1243
|
+
return Ve(_objectSpread2(_objectSpread2({}, defaultSettings), opts));
|
|
3520
1244
|
}
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
1245
|
+
function facebookScriptInit(f2, b2, e2, v2, n2, t2, s2) {
|
|
1246
|
+
if (f2.fbq)
|
|
1247
|
+
return;
|
|
1248
|
+
n2 = f2.fbq = function() {
|
|
1249
|
+
n2.callMethod ? n2.callMethod.apply(n2, arguments) : n2.queue.push(arguments);
|
|
1250
|
+
};
|
|
1251
|
+
if (!f2._fbq)
|
|
1252
|
+
f2._fbq = n2;
|
|
1253
|
+
n2.push = n2;
|
|
1254
|
+
n2.loaded = true;
|
|
1255
|
+
n2.version = "2.0";
|
|
1256
|
+
n2.queue = [];
|
|
1257
|
+
t2 = b2.createElement(e2);
|
|
1258
|
+
t2.async = true;
|
|
1259
|
+
t2.src = v2;
|
|
1260
|
+
s2 = b2.getElementsByTagName(e2)[0];
|
|
1261
|
+
s2.parentNode.insertBefore(t2, s2);
|
|
1262
|
+
}
|
|
1263
|
+
function facebookInit({ trackingId }) {
|
|
1264
|
+
facebookScriptInit(window, document, "script", "https://connect.facebook.net/en_US/fbevents.js");
|
|
1265
|
+
window.fbq("init", trackingId);
|
|
1266
|
+
}
|
|
1267
|
+
function facebook(pluginConfig = {}) {
|
|
3533
1268
|
return {
|
|
3534
|
-
name: "
|
|
3535
|
-
config:
|
|
3536
|
-
initialize: function
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
throw new Error("No google tag manager containerId defined");
|
|
3541
|
-
}
|
|
3542
|
-
if (preview && !auth) {
|
|
3543
|
-
throw new Error("When enabling preview mode, both preview and auth parameters must be defined");
|
|
3544
|
-
}
|
|
3545
|
-
var scriptSrc = customScriptSrc || "https://www.googletagmanager.com/gtm.js";
|
|
3546
|
-
if (!scriptLoaded(containerId)) {
|
|
3547
|
-
(function(w, d2, s2, l2, i2) {
|
|
3548
|
-
w[l2] = w[l2] || [];
|
|
3549
|
-
w[l2].push({
|
|
3550
|
-
"gtm.start": new Date().getTime(),
|
|
3551
|
-
event: "gtm.js"
|
|
3552
|
-
});
|
|
3553
|
-
var f2 = d2.getElementsByTagName(s2)[0], j2 = d2.createElement(s2), dl = l2 != "dataLayer" ? "&l=" + l2 : "", p2 = preview ? ">m_preview=" + preview + ">m_auth=" + auth + ">m_cookies_win=x" : "";
|
|
3554
|
-
if (execution) {
|
|
3555
|
-
j2[execution] = true;
|
|
3556
|
-
}
|
|
3557
|
-
j2.src = "".concat(scriptSrc, "?id=") + i2 + dl + p2;
|
|
3558
|
-
f2.parentNode.insertBefore(j2, f2);
|
|
3559
|
-
})(window, document, "script", dataLayerName, containerId);
|
|
3560
|
-
initializedDataLayerName = dataLayerName;
|
|
3561
|
-
config2.dataLayer = window[dataLayerName];
|
|
3562
|
-
}
|
|
1269
|
+
name: "facebook",
|
|
1270
|
+
config: pluginConfig,
|
|
1271
|
+
initialize: function({ config, instance }) {
|
|
1272
|
+
if (!config.trackingId)
|
|
1273
|
+
throw new Error("No Facebook trackingId defined");
|
|
1274
|
+
facebookInit({ trackingId: config.trackingId });
|
|
3563
1275
|
},
|
|
3564
|
-
page: function
|
|
3565
|
-
|
|
3566
|
-
_ref2.options;
|
|
3567
|
-
_ref2.instance;
|
|
3568
|
-
var config2 = _ref2.config;
|
|
3569
|
-
if (typeof config2.dataLayer !== "undefined") {
|
|
3570
|
-
config2.dataLayer.push(payload.properties);
|
|
3571
|
-
}
|
|
1276
|
+
page: function({ payload, config, instance }) {
|
|
1277
|
+
window.fbq("track", "PageView");
|
|
3572
1278
|
},
|
|
3573
|
-
track: function
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
if (typeof config2.dataLayer !== "undefined") {
|
|
3578
|
-
var anonymousId = payload.anonymousId, userId = payload.userId, properties = payload.properties;
|
|
3579
|
-
var formattedPayload = properties;
|
|
3580
|
-
if (userId) {
|
|
3581
|
-
formattedPayload.userId = userId;
|
|
3582
|
-
}
|
|
3583
|
-
if (anonymousId) {
|
|
3584
|
-
formattedPayload.anonymousId = anonymousId;
|
|
3585
|
-
}
|
|
3586
|
-
if (!properties.category) {
|
|
3587
|
-
formattedPayload.category = "All";
|
|
3588
|
-
}
|
|
3589
|
-
if (config2.debug) {
|
|
3590
|
-
console.log("gtag push", _objectSpread({
|
|
3591
|
-
event: payload.event
|
|
3592
|
-
}, formattedPayload));
|
|
3593
|
-
}
|
|
3594
|
-
config2.dataLayer.push(_objectSpread({
|
|
3595
|
-
event: payload.event
|
|
3596
|
-
}, formattedPayload));
|
|
3597
|
-
}
|
|
1279
|
+
track: function({ payload, config, instance }) {
|
|
1280
|
+
window.fbq("track", payload.event, payload.properties);
|
|
1281
|
+
},
|
|
1282
|
+
identify: function({ payload, config }) {
|
|
3598
1283
|
},
|
|
3599
|
-
loaded: function
|
|
3600
|
-
|
|
3601
|
-
return scriptLoaded(pluginConfig.containerId) && hasDataLayer;
|
|
1284
|
+
loaded: function() {
|
|
1285
|
+
return !!window.fbq;
|
|
3602
1286
|
}
|
|
3603
1287
|
};
|
|
3604
1288
|
}
|
|
3605
|
-
var regexCache = {};
|
|
3606
|
-
function scriptLoaded(containerId) {
|
|
3607
|
-
var regex = regexCache[containerId];
|
|
3608
|
-
if (!regex) {
|
|
3609
|
-
regex = new RegExp("googletagmanager\\.com\\/gtm\\.js.*[?&]id=" + containerId);
|
|
3610
|
-
regexCache[containerId] = regex;
|
|
3611
|
-
}
|
|
3612
|
-
var scripts = document.querySelectorAll("script[src]");
|
|
3613
|
-
return !!Object.keys(scripts).filter(function(key) {
|
|
3614
|
-
return (scripts[key].src || "").match(regex);
|
|
3615
|
-
}).length;
|
|
3616
|
-
}
|
|
3617
|
-
var index = googleTagManager$1;
|
|
3618
1289
|
function gtag() {
|
|
3619
1290
|
window.dataLayer.push(arguments);
|
|
3620
1291
|
}
|
|
@@ -3641,28 +1312,28 @@ function googleAnalytics4(pluginConfig = {}) {
|
|
|
3641
1312
|
return {
|
|
3642
1313
|
name: "google-analytics-4",
|
|
3643
1314
|
config: pluginConfig,
|
|
3644
|
-
initialize: function({ config
|
|
3645
|
-
if (!
|
|
1315
|
+
initialize: function({ config, instance }) {
|
|
1316
|
+
if (!config.trackingId)
|
|
3646
1317
|
throw new Error("No GA trackingId defined");
|
|
3647
1318
|
var configParams = {};
|
|
3648
1319
|
var setParams = {};
|
|
3649
|
-
if (
|
|
1320
|
+
if (config.customDimensions) {
|
|
3650
1321
|
var customMap = {};
|
|
3651
|
-
for (var i2 = 0; i2 <
|
|
3652
|
-
var customDim =
|
|
3653
|
-
configParams[customDim.name] = customDim.callback(instance,
|
|
1322
|
+
for (var i2 = 0; i2 < config.customDimensions.length; i2++) {
|
|
1323
|
+
var customDim = config.customDimensions[i2];
|
|
1324
|
+
configParams[customDim.name] = customDim.callback(instance, config);
|
|
3654
1325
|
customMap["dimension" + (i2 + 1)] = customDim.name;
|
|
3655
1326
|
}
|
|
3656
1327
|
setParams["custom_map"] = customMap;
|
|
3657
1328
|
}
|
|
3658
|
-
gtagInit({ trackingId:
|
|
1329
|
+
gtagInit({ trackingId: config.trackingId, configParams, setParams });
|
|
3659
1330
|
},
|
|
3660
|
-
page: function({ payload, config
|
|
1331
|
+
page: function({ payload, config, instance }) {
|
|
3661
1332
|
},
|
|
3662
|
-
track: function({ payload, config
|
|
1333
|
+
track: function({ payload, config, instance }) {
|
|
3663
1334
|
gtag("event", payload.event, payload.properties);
|
|
3664
1335
|
},
|
|
3665
|
-
identify: function({ payload, config
|
|
1336
|
+
identify: function({ payload, config }) {
|
|
3666
1337
|
},
|
|
3667
1338
|
loaded: function() {
|
|
3668
1339
|
return !!window.gtag;
|
|
@@ -3678,26 +1349,30 @@ function dbg() {
|
|
|
3678
1349
|
return;
|
|
3679
1350
|
console.debug(...arguments);
|
|
3680
1351
|
}
|
|
3681
|
-
function warning(
|
|
3682
|
-
console.warn(
|
|
1352
|
+
function warning(msg) {
|
|
1353
|
+
console.warn(msg);
|
|
3683
1354
|
if (window.Rollbar) {
|
|
3684
|
-
window.Rollbar.warning(
|
|
1355
|
+
window.Rollbar.warning(msg);
|
|
3685
1356
|
}
|
|
3686
1357
|
}
|
|
3687
1358
|
function isFunc(value) {
|
|
3688
1359
|
return value && (Object.prototype.toString.call(value) === "[object Function]" || typeof value === "function" || value instanceof Function);
|
|
3689
1360
|
}
|
|
3690
1361
|
function isBot() {
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
1362
|
+
try {
|
|
1363
|
+
var ua = navigator.userAgent || "";
|
|
1364
|
+
var bots = new RegExp([
|
|
1365
|
+
/bot/,
|
|
1366
|
+
/spider/,
|
|
1367
|
+
/crawl/,
|
|
1368
|
+
/mediapartners/,
|
|
1369
|
+
/Google-Read-Aloud/,
|
|
1370
|
+
/semrush/
|
|
1371
|
+
].map((r2) => r2.source).join("|"), "i");
|
|
1372
|
+
return bots.test(ua);
|
|
1373
|
+
} catch (e2) {
|
|
1374
|
+
return false;
|
|
1375
|
+
}
|
|
3701
1376
|
}
|
|
3702
1377
|
function afterDOMContentLoaded(func) {
|
|
3703
1378
|
if (document.readyState === "complete" || document.readyState === "loaded" || document.readyState === "interactive") {
|
|
@@ -3987,11 +1662,11 @@ function clearPoolIntervals() {
|
|
|
3987
1662
|
}
|
|
3988
1663
|
}
|
|
3989
1664
|
function getPoolNumber(_0) {
|
|
3990
|
-
return __async(this, arguments, function* ({ poolId, apiUrl, number = null, context
|
|
1665
|
+
return __async(this, arguments, function* ({ poolId, apiUrl, number = null, context = null }) {
|
|
3991
1666
|
var payload = {
|
|
3992
1667
|
pool_id: poolId,
|
|
3993
1668
|
number,
|
|
3994
|
-
context
|
|
1669
|
+
context,
|
|
3995
1670
|
properties: {
|
|
3996
1671
|
zar: getStorage()
|
|
3997
1672
|
}
|
|
@@ -4018,15 +1693,15 @@ function renewTrackingPool() {
|
|
|
4018
1693
|
apiUrl = getDefaultApiUrl(),
|
|
4019
1694
|
contextCallback = null
|
|
4020
1695
|
} = {}) {
|
|
4021
|
-
var
|
|
1696
|
+
var context = {};
|
|
4022
1697
|
if (contextCallback) {
|
|
4023
|
-
|
|
1698
|
+
context = contextCallback() || {};
|
|
4024
1699
|
}
|
|
4025
1700
|
try {
|
|
4026
|
-
var resp = yield getPoolNumber({ poolId, apiUrl, number, context
|
|
1701
|
+
var resp = yield getPoolNumber({ poolId, apiUrl, number, context });
|
|
4027
1702
|
} catch (e2) {
|
|
4028
|
-
var
|
|
4029
|
-
warning(
|
|
1703
|
+
var msg = "error getting number: " + JSON.stringify(e2);
|
|
1704
|
+
warning(msg);
|
|
4030
1705
|
getNumberFailureCount++;
|
|
4031
1706
|
if (getNumberFailureCount >= MAX_GET_NUMBER_FAILURES) {
|
|
4032
1707
|
warning("max failures, stopping pool");
|
|
@@ -4035,7 +1710,7 @@ function renewTrackingPool() {
|
|
|
4035
1710
|
revertOverlayNumbers({ elems: overlayElements });
|
|
4036
1711
|
}
|
|
4037
1712
|
}
|
|
4038
|
-
return { status: NUMBER_POOL_ERROR, msg
|
|
1713
|
+
return { status: NUMBER_POOL_ERROR, msg };
|
|
4039
1714
|
}
|
|
4040
1715
|
if (resp.status === NUMBER_POOL_SUCCESS && resp.number) {
|
|
4041
1716
|
if (overlayElements) {
|
|
@@ -4060,36 +1735,36 @@ function getPoolId(poolId) {
|
|
|
4060
1735
|
}
|
|
4061
1736
|
function initTrackingPool() {
|
|
4062
1737
|
return __async(this, arguments, function* ({ poolData, poolConfig, apiUrl } = {}) {
|
|
4063
|
-
var
|
|
1738
|
+
var msg;
|
|
4064
1739
|
if (!poolConfig || !poolConfig.poolId || !poolConfig.overlayQuerySelector || !apiUrl) {
|
|
4065
|
-
|
|
4066
|
-
warning(
|
|
1740
|
+
msg = "missing pool config: " + JSON.stringify(poolConfig);
|
|
1741
|
+
warning(msg);
|
|
4067
1742
|
if (poolConfig.initCallback) {
|
|
4068
|
-
poolConfig.initCallback({ status: NUMBER_POOL_ERROR, msg
|
|
1743
|
+
poolConfig.initCallback({ status: NUMBER_POOL_ERROR, msg });
|
|
4069
1744
|
}
|
|
4070
1745
|
return poolIntervals;
|
|
4071
1746
|
}
|
|
4072
|
-
var
|
|
1747
|
+
var context = {};
|
|
4073
1748
|
if (poolConfig.contextCallback) {
|
|
4074
|
-
|
|
1749
|
+
context = poolConfig.contextCallback() || {};
|
|
4075
1750
|
}
|
|
4076
1751
|
var poolId = getPoolId(poolConfig.poolId);
|
|
4077
1752
|
if (!poolId) {
|
|
4078
|
-
|
|
4079
|
-
warning(
|
|
1753
|
+
msg = "no pool ID";
|
|
1754
|
+
warning(msg);
|
|
4080
1755
|
if (poolConfig.initCallback) {
|
|
4081
|
-
poolConfig.initCallback({ status: NUMBER_POOL_ERROR, msg
|
|
1756
|
+
poolConfig.initCallback({ status: NUMBER_POOL_ERROR, msg });
|
|
4082
1757
|
}
|
|
4083
1758
|
return poolIntervals;
|
|
4084
1759
|
}
|
|
4085
1760
|
if (!poolData) {
|
|
4086
1761
|
try {
|
|
4087
|
-
poolData = yield getPoolNumber({ poolId, apiUrl, number: null, context
|
|
1762
|
+
poolData = yield getPoolNumber({ poolId, apiUrl, number: null, context });
|
|
4088
1763
|
} catch (e2) {
|
|
4089
|
-
|
|
4090
|
-
warning(
|
|
1764
|
+
msg = "error getting number on init: " + JSON.stringify(e2);
|
|
1765
|
+
warning(msg);
|
|
4091
1766
|
if (poolConfig.initCallback) {
|
|
4092
|
-
poolConfig.initCallback({ status: NUMBER_POOL_ERROR, msg
|
|
1767
|
+
poolConfig.initCallback({ status: NUMBER_POOL_ERROR, msg });
|
|
4093
1768
|
}
|
|
4094
1769
|
return poolIntervals;
|
|
4095
1770
|
}
|
|
@@ -4098,10 +1773,10 @@ function initTrackingPool() {
|
|
|
4098
1773
|
afterDOMContentLoaded(function() {
|
|
4099
1774
|
var overlayElements = document.querySelectorAll(poolConfig.overlayQuerySelector);
|
|
4100
1775
|
if (!overlayElements) {
|
|
4101
|
-
var
|
|
4102
|
-
warning(
|
|
1776
|
+
var msg2 = "No elems found for:" + poolConfig.overlayQuerySelector;
|
|
1777
|
+
warning(msg2);
|
|
4103
1778
|
if (poolConfig.initCallback) {
|
|
4104
|
-
poolConfig.initCallback({ status: NUMBER_POOL_ERROR, msg:
|
|
1779
|
+
poolConfig.initCallback({ status: NUMBER_POOL_ERROR, msg: msg2 });
|
|
4105
1780
|
}
|
|
4106
1781
|
return;
|
|
4107
1782
|
}
|
|
@@ -4116,8 +1791,8 @@ function initTrackingPool() {
|
|
|
4116
1791
|
contextCallback: poolConfig.contextCallback
|
|
4117
1792
|
});
|
|
4118
1793
|
} catch (e2) {
|
|
4119
|
-
var
|
|
4120
|
-
warning(
|
|
1794
|
+
var msg3 = "error on interval: " + JSON.stringify(e2);
|
|
1795
|
+
warning(msg3);
|
|
4121
1796
|
}
|
|
4122
1797
|
}, poolConfig.renewalInterval || NUMBER_POOL_RENEWAL_TIME_MS);
|
|
4123
1798
|
poolIntervals[poolData.pool_id] = interval;
|
|
@@ -4134,12 +1809,12 @@ function zar({ apiUrl, poolConfig }) {
|
|
|
4134
1809
|
return {
|
|
4135
1810
|
name: "zar",
|
|
4136
1811
|
config: { apiUrl, poolConfig },
|
|
4137
|
-
initialize: function({ config
|
|
1812
|
+
initialize: function({ config }) {
|
|
4138
1813
|
},
|
|
4139
1814
|
loaded: function() {
|
|
4140
1815
|
return true;
|
|
4141
1816
|
},
|
|
4142
|
-
pageStart: function({ payload, config
|
|
1817
|
+
pageStart: function({ payload, config, instance }) {
|
|
4143
1818
|
payload.properties.zar = getStorage();
|
|
4144
1819
|
payload.properties.referrer = document.referrer;
|
|
4145
1820
|
payload.properties.is_bot = isBot();
|
|
@@ -4152,33 +1827,52 @@ function zar({ apiUrl, poolConfig }) {
|
|
|
4152
1827
|
if ("search" in payload.properties) {
|
|
4153
1828
|
delete payload.properties["search"];
|
|
4154
1829
|
}
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
1830
|
+
try {
|
|
1831
|
+
var pcfg = config.poolConfig;
|
|
1832
|
+
if (pcfg && pcfg.poolId) {
|
|
1833
|
+
payload.properties.pool_id = getPoolId(pcfg.poolId);
|
|
1834
|
+
if (pcfg.contextCallback) {
|
|
1835
|
+
payload.properties.pool_context = pcfg.contextCallback() || {};
|
|
1836
|
+
}
|
|
4160
1837
|
}
|
|
1838
|
+
} catch (e2) {
|
|
1839
|
+
warning("error getting pool id: " + JSON.stringify(e2));
|
|
4161
1840
|
}
|
|
4162
1841
|
return payload;
|
|
4163
1842
|
},
|
|
4164
1843
|
page: function(_0) {
|
|
4165
|
-
return __async(this, arguments, function* ({ payload, options, instance, config
|
|
4166
|
-
dbg("page", payload, options,
|
|
4167
|
-
var
|
|
4168
|
-
|
|
4169
|
-
|
|
1844
|
+
return __async(this, arguments, function* ({ payload, options, instance, config }) {
|
|
1845
|
+
dbg("page", payload, options, config);
|
|
1846
|
+
var tries = 0;
|
|
1847
|
+
var maxTries = 3;
|
|
1848
|
+
var res;
|
|
1849
|
+
while (tries < maxTries) {
|
|
1850
|
+
try {
|
|
1851
|
+
res = yield httpPost({ url: `${config.apiUrl}/page`, data: payload });
|
|
1852
|
+
break;
|
|
1853
|
+
} catch (e2) {
|
|
1854
|
+
tries++;
|
|
1855
|
+
if (tries >= maxTries) {
|
|
1856
|
+
warning("error posting page: " + JSON.stringify(e2));
|
|
1857
|
+
throw e2;
|
|
1858
|
+
}
|
|
1859
|
+
yield new Promise((r2) => setTimeout(r2, 1e3));
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
if (res && res.pool_data) {
|
|
1863
|
+
initTrackingPool({ poolData: res.pool_data, poolConfig: config.poolConfig, apiUrl: config.apiUrl });
|
|
4170
1864
|
}
|
|
4171
1865
|
});
|
|
4172
1866
|
},
|
|
4173
|
-
trackStart: function({ payload, config
|
|
1867
|
+
trackStart: function({ payload, config, instance }) {
|
|
4174
1868
|
payload.properties.zar = getStorage();
|
|
4175
1869
|
payload.properties.url = window.location.href;
|
|
4176
1870
|
payload.properties.referrer = document.referrer;
|
|
4177
1871
|
return payload;
|
|
4178
1872
|
},
|
|
4179
|
-
track: function({ payload, options, instance, config
|
|
1873
|
+
track: function({ payload, options, instance, config }) {
|
|
4180
1874
|
dbg("track", payload);
|
|
4181
|
-
httpPost({ url: `${
|
|
1875
|
+
httpPost({ url: `${config.apiUrl}/track`, data: payload, beacon: true });
|
|
4182
1876
|
},
|
|
4183
1877
|
methods: {
|
|
4184
1878
|
apiUrl() {
|
|
@@ -4242,7 +1936,7 @@ function zar({ apiUrl, poolConfig }) {
|
|
|
4242
1936
|
}
|
|
4243
1937
|
};
|
|
4244
1938
|
}
|
|
4245
|
-
function init({ app,
|
|
1939
|
+
function init({ app, ga4Config = null, facebookConfig = null, apiUrl = null, poolConfig = null }) {
|
|
4246
1940
|
if (!apiUrl) {
|
|
4247
1941
|
apiUrl = getDefaultApiUrl();
|
|
4248
1942
|
}
|
|
@@ -4250,8 +1944,8 @@ function init({ app, gtmConfig = null, ga4Config = null, apiUrl = null, poolConf
|
|
|
4250
1944
|
if (ga4Config) {
|
|
4251
1945
|
plugins.push(googleAnalytics4(ga4Config));
|
|
4252
1946
|
}
|
|
4253
|
-
if (
|
|
4254
|
-
plugins.push(
|
|
1947
|
+
if (facebookConfig) {
|
|
1948
|
+
plugins.push(facebook(facebookConfig));
|
|
4255
1949
|
}
|
|
4256
1950
|
return analyticsLib({ app, plugins });
|
|
4257
1951
|
}
|