@braze/web-sdk 4.7.0 → 4.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +7 -7
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +1 -1
- package/shared-lib/event-types.js +7 -7
- package/shared-lib/indexed-db-adapter.js +1 -1
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +2 -2
- package/src/Card/models/card.js +1 -1
- package/src/managers/braze-instance.js +21 -19
- package/src/managers/device-manager.js +5 -5
- package/src/managers/network-manager.js +32 -32
- package/src/managers/session-manager.js +1 -1
- package/src/managers/storage-manager.js +73 -66
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +1 -1
- package/src/models/server-config.js +2 -2
- package/src/request-controller.js +70 -70
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +5 -5
- package/src/triggers/models/filter-set.js +2 -2
- package/src/triggers/models/filter.js +56 -56
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +5 -5
- package/src/triggers/models/push-click-data.js +4 -4
- package/src/triggers/models/trigger-condition.js +2 -2
- package/src/triggers/models/trigger.js +20 -20
- package/src/triggers/triggers-provider.js +37 -37
- package/src/ui/js/attach-css.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- package/src/util/browser-detector.js +4 -4
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/net.js +1 -1
- package/src/util/user-agent-parser.js +1 -1
|
@@ -18,18 +18,18 @@ export const STORAGE_KEYS = {
|
|
|
18
18
|
q: {
|
|
19
19
|
Sa: "ab.test",
|
|
20
20
|
Ta: "ab.storage.events",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
Ia: "ab.storage.attributes",
|
|
22
|
+
Ka: "ab.storage.attributes.anonymous_user",
|
|
23
|
+
Xo: "ab.storage.device",
|
|
24
|
+
oa: "ab.storage.sdk_metadata",
|
|
25
|
+
ua: "ab.storage.session_id_for_cached_metadata",
|
|
26
26
|
vn: "ab.storage.pushToken",
|
|
27
27
|
Di: "ab.storage.newsFeed",
|
|
28
28
|
xi: "ab.storage.lastNewsFeedRefresh",
|
|
29
29
|
P: "ab.storage.cardImpressions",
|
|
30
30
|
hl: "ab.storage.serverConfig",
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
Ya: "ab.storage.triggers",
|
|
32
|
+
Da: "ab.storage.triggers.ts",
|
|
33
33
|
Gh: "ab.storage.messagingSessionStart",
|
|
34
34
|
Yt: "ab.storage.cc",
|
|
35
35
|
vs: "ab.storage.ccLastFullSync",
|
|
@@ -37,9 +37,9 @@ export const STORAGE_KEYS = {
|
|
|
37
37
|
$: "ab.storage.ccClicks",
|
|
38
38
|
O: "ab.storage.ccImpressions",
|
|
39
39
|
K: "ab.storage.ccDismissals",
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
Ga: "ab.storage.lastDisplayedTriggerTimesById",
|
|
41
|
+
Na: "ab.storage.lastDisplayedTriggerTime",
|
|
42
|
+
va: "ab.storage.triggerFireInstancesById",
|
|
43
43
|
Ln: "ab.storage.signature",
|
|
44
44
|
As: "ab.storage.brazeSyncRetryCount",
|
|
45
45
|
_s: "ab.storage.sdkVersion",
|
|
@@ -50,21 +50,21 @@ export const STORAGE_KEYS = {
|
|
|
50
50
|
};
|
|
51
51
|
export default class G {
|
|
52
52
|
constructor(t, e) {
|
|
53
|
-
(this.
|
|
53
|
+
(this.Ca = t), (this.Ma = e);
|
|
54
54
|
}
|
|
55
55
|
uu(t, e) {
|
|
56
56
|
let s = e;
|
|
57
|
-
null != e && e instanceof _t && (s = e.ss()), this.
|
|
57
|
+
null != e && e instanceof _t && (s = e.ss()), this.Ca.store(t, s);
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
ya(t) {
|
|
60
60
|
const e = this.tu(t);
|
|
61
61
|
null != e && ((e.Wh = new Date().valueOf()), this.uu(t, e));
|
|
62
62
|
}
|
|
63
63
|
tu(t) {
|
|
64
|
-
return _t.Pn(this.
|
|
64
|
+
return _t.Pn(this.Ca.lr(t));
|
|
65
65
|
}
|
|
66
66
|
Jh(t) {
|
|
67
|
-
this.
|
|
67
|
+
this.Ca.remove(t);
|
|
68
68
|
}
|
|
69
69
|
bo(t) {
|
|
70
70
|
if (null == t || 0 === t.length) return !1;
|
|
@@ -77,7 +77,7 @@ export default class G {
|
|
|
77
77
|
qh(t) {
|
|
78
78
|
return null != t && this.bo([t]);
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
Ua() {
|
|
81
81
|
let t = this.Ma.lr(STORAGE_KEYS.q.Ta);
|
|
82
82
|
this.Ma.remove(STORAGE_KEYS.q.Ta), null == t && (t = []);
|
|
83
83
|
const e = [];
|
|
@@ -85,7 +85,7 @@ export default class G {
|
|
|
85
85
|
o = null;
|
|
86
86
|
if (p(t))
|
|
87
87
|
for (let s = 0; s < t.length; s++)
|
|
88
|
-
ue.
|
|
88
|
+
ue.Fa(t[s]) ? e.push(ue.Pn(t[s])) : (o = s);
|
|
89
89
|
else s = !0;
|
|
90
90
|
if (s || null != o) {
|
|
91
91
|
let n = "Stored events could not be deserialized as Events";
|
|
@@ -132,34 +132,39 @@ export default class G {
|
|
|
132
132
|
) && (this.Ma.remove(t), !0)
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
|
+
Wo(t) {
|
|
136
|
+
const e = or(STORAGE_KEYS.eu),
|
|
137
|
+
s = new G.ne(t);
|
|
138
|
+
for (const t of e) s.remove(STORAGE_KEYS.eu[t]);
|
|
139
|
+
}
|
|
135
140
|
clearData() {
|
|
136
141
|
const t = or(STORAGE_KEYS.eu),
|
|
137
142
|
e = or(STORAGE_KEYS.q);
|
|
138
143
|
for (let e = 0; e < t.length; e++) {
|
|
139
144
|
const s = t[e];
|
|
140
|
-
this.
|
|
145
|
+
this.Ca.remove(STORAGE_KEYS.eu[s]);
|
|
141
146
|
}
|
|
142
147
|
for (let t = 0; t < e.length; t++) {
|
|
143
148
|
const s = e[t];
|
|
144
149
|
this.Ma.remove(STORAGE_KEYS.q[s]);
|
|
145
150
|
}
|
|
146
151
|
}
|
|
147
|
-
|
|
148
|
-
return t || STORAGE_KEYS.q.
|
|
152
|
+
La(t) {
|
|
153
|
+
return t || STORAGE_KEYS.q.Ka;
|
|
149
154
|
}
|
|
150
|
-
|
|
151
|
-
let e = this.Ma.lr(STORAGE_KEYS.q.
|
|
155
|
+
qa(t) {
|
|
156
|
+
let e = this.Ma.lr(STORAGE_KEYS.q.Ia);
|
|
152
157
|
null == e && (e = {});
|
|
153
|
-
const s = this.
|
|
158
|
+
const s = this.La(t[User.Dn]);
|
|
154
159
|
for (let r in t)
|
|
155
160
|
r === User.Dn ||
|
|
156
161
|
(null != e[s] && null != e[s][r]) ||
|
|
157
162
|
this.mu(t[User.Dn], r, t[r]);
|
|
158
163
|
}
|
|
159
164
|
mu(t, e, s) {
|
|
160
|
-
let r = this.Ma.lr(STORAGE_KEYS.q.
|
|
165
|
+
let r = this.Ma.lr(STORAGE_KEYS.q.Ia);
|
|
161
166
|
null == r && (r = {});
|
|
162
|
-
const o = this.
|
|
167
|
+
const o = this.La(t);
|
|
163
168
|
let n = r[o];
|
|
164
169
|
if (
|
|
165
170
|
(null == n && ((n = {}), null != t && (n[User.Dn] = t)), e === User.lu)
|
|
@@ -167,43 +172,43 @@ export default class G {
|
|
|
167
172
|
null == n[e] && (n[e] = {});
|
|
168
173
|
for (let t in s) n[e][t] = s[t];
|
|
169
174
|
} else n[e] = s;
|
|
170
|
-
return (r[o] = n), this.Ma.store(STORAGE_KEYS.q.
|
|
175
|
+
return (r[o] = n), this.Ma.store(STORAGE_KEYS.q.Ia, r);
|
|
171
176
|
}
|
|
172
|
-
|
|
173
|
-
const t = this.Ma.lr(STORAGE_KEYS.q.
|
|
174
|
-
this.Ma.remove(STORAGE_KEYS.q.
|
|
177
|
+
Ba() {
|
|
178
|
+
const t = this.Ma.lr(STORAGE_KEYS.q.Ia);
|
|
179
|
+
this.Ma.remove(STORAGE_KEYS.q.Ia);
|
|
175
180
|
const e = [];
|
|
176
181
|
for (let s in t) null != t[s] && e.push(t[s]);
|
|
177
182
|
return e;
|
|
178
183
|
}
|
|
179
184
|
ou(t) {
|
|
180
|
-
const e = this.Ma.lr(STORAGE_KEYS.q.
|
|
185
|
+
const e = this.Ma.lr(STORAGE_KEYS.q.Ia);
|
|
181
186
|
if (null != e) {
|
|
182
|
-
const s = this.
|
|
187
|
+
const s = this.La(null),
|
|
183
188
|
r = e[s];
|
|
184
189
|
null != r &&
|
|
185
190
|
((e[s] = void 0),
|
|
186
|
-
this.Ma.store(STORAGE_KEYS.q.
|
|
191
|
+
this.Ma.store(STORAGE_KEYS.q.Ia, e),
|
|
187
192
|
(r[User.Dn] = t),
|
|
188
|
-
this.
|
|
193
|
+
this.qa(r));
|
|
189
194
|
}
|
|
190
195
|
const s = this.tu(STORAGE_KEYS.eu.xh);
|
|
191
196
|
let r = null;
|
|
192
197
|
null != s && (r = s.iu);
|
|
193
|
-
const o = this.
|
|
198
|
+
const o = this.Ua();
|
|
194
199
|
if (null != o)
|
|
195
200
|
for (let e = 0; e < o.length; e++) {
|
|
196
201
|
const s = o[e];
|
|
197
202
|
null == s.userId && s.sessionId == r && (s.userId = t), this.qh(s);
|
|
198
203
|
}
|
|
199
204
|
}
|
|
200
|
-
|
|
201
|
-
return this.Ma.
|
|
205
|
+
Pa() {
|
|
206
|
+
return this.Ma.ka;
|
|
202
207
|
}
|
|
203
208
|
}
|
|
204
209
|
G._a = class {
|
|
205
210
|
constructor(t) {
|
|
206
|
-
(this._r = t), (this.
|
|
211
|
+
(this._r = t), (this.ka = ot.xa() ? 3 : 10);
|
|
207
212
|
}
|
|
208
213
|
Ja(t) {
|
|
209
214
|
return t + "." + this._r;
|
|
@@ -234,12 +239,12 @@ G._a = class {
|
|
|
234
239
|
};
|
|
235
240
|
G.ne = class {
|
|
236
241
|
constructor(t, e) {
|
|
237
|
-
(this._r = t), (this.
|
|
242
|
+
(this._r = t), (this.Va = this.za()), (this.Qa = 576e3), (this.Ha = !!e);
|
|
238
243
|
}
|
|
239
244
|
Ja(t) {
|
|
240
245
|
return null != this._r ? t + "." + this._r : t;
|
|
241
246
|
}
|
|
242
|
-
|
|
247
|
+
za() {
|
|
243
248
|
let t = 0,
|
|
244
249
|
e = document.location.hostname;
|
|
245
250
|
const s = e.split("."),
|
|
@@ -256,9 +261,9 @@ G.ne = class {
|
|
|
256
261
|
}
|
|
257
262
|
ie() {
|
|
258
263
|
const t = new Date();
|
|
259
|
-
return t.setTime(t.getTime() + 60 * this.
|
|
264
|
+
return t.setTime(t.getTime() + 60 * this.Qa * 1e3), t.getFullYear();
|
|
260
265
|
}
|
|
261
|
-
|
|
266
|
+
Wa() {
|
|
262
267
|
const t = Lt(STORAGE_KEYS.eu),
|
|
263
268
|
e = document.cookie.split(";");
|
|
264
269
|
for (let s = 0; s < e.length; s++) {
|
|
@@ -272,18 +277,18 @@ G.ne = class {
|
|
|
272
277
|
}
|
|
273
278
|
if (o) {
|
|
274
279
|
const t = r.split("=")[0];
|
|
275
|
-
-1 === t.indexOf("." + this._r) && this.
|
|
280
|
+
-1 === t.indexOf("." + this._r) && this.Xa(t);
|
|
276
281
|
}
|
|
277
282
|
}
|
|
278
283
|
}
|
|
279
284
|
store(t, e) {
|
|
280
|
-
this.
|
|
285
|
+
this.Wa();
|
|
281
286
|
const s = new Date();
|
|
282
|
-
s.setTime(s.getTime() + 60 * this.
|
|
287
|
+
s.setTime(s.getTime() + 60 * this.Qa * 1e3);
|
|
283
288
|
const o = "expires=" + s.toUTCString(),
|
|
284
|
-
n = "domain=" + this.
|
|
289
|
+
n = "domain=" + this.Va;
|
|
285
290
|
let i;
|
|
286
|
-
i = this.
|
|
291
|
+
i = this.Ha ? e : encodeURIComponent(JSON.stringify(e));
|
|
287
292
|
const a = this.Ja(t) + "=" + i + ";" + o + ";" + n + ";path=/";
|
|
288
293
|
return a.length >= 4093
|
|
289
294
|
? (r.D.info(
|
|
@@ -304,7 +309,7 @@ G.ne = class {
|
|
|
304
309
|
if (0 === i.indexOf(s))
|
|
305
310
|
try {
|
|
306
311
|
let t;
|
|
307
|
-
(t = this.
|
|
312
|
+
(t = this.Ha
|
|
308
313
|
? i.substring(s.length, i.length)
|
|
309
314
|
: JSON.parse(decodeURIComponent(i.substring(s.length, i.length)))),
|
|
310
315
|
e.push(t);
|
|
@@ -319,33 +324,33 @@ G.ne = class {
|
|
|
319
324
|
return e.length > 0 ? e[e.length - 1] : null;
|
|
320
325
|
}
|
|
321
326
|
remove(t) {
|
|
322
|
-
this.
|
|
327
|
+
this.Xa(this.Ja(t));
|
|
323
328
|
}
|
|
324
|
-
|
|
329
|
+
Xa(t) {
|
|
325
330
|
const e = t + "=;expires=" + new Date(0).toGMTString();
|
|
326
331
|
(document.cookie = e), (document.cookie = e + ";path=/");
|
|
327
|
-
const s = e + ";domain=" + this.
|
|
332
|
+
const s = e + ";domain=" + this.Va;
|
|
328
333
|
(document.cookie = s), (document.cookie = s + ";path=/");
|
|
329
334
|
}
|
|
330
335
|
};
|
|
331
336
|
G.Oa = class {
|
|
332
337
|
constructor() {
|
|
333
|
-
(this.
|
|
338
|
+
(this.Za = {}), (this.$a = 5242880), (this.ka = 3);
|
|
334
339
|
}
|
|
335
340
|
store(t, e) {
|
|
336
341
|
const s = { value: e },
|
|
337
|
-
o = this
|
|
338
|
-
return o > this
|
|
342
|
+
o = this.El(e);
|
|
343
|
+
return o > this.$a
|
|
339
344
|
? (r.D.info(
|
|
340
345
|
"Storage failure: object is ≈" +
|
|
341
346
|
o +
|
|
342
347
|
" bytes which is greater than the max of " +
|
|
343
|
-
this
|
|
348
|
+
this.$a
|
|
344
349
|
),
|
|
345
350
|
!1)
|
|
346
|
-
: ((this.
|
|
351
|
+
: ((this.Za[t] = s), !0);
|
|
347
352
|
}
|
|
348
|
-
|
|
353
|
+
El(t) {
|
|
349
354
|
const e = [],
|
|
350
355
|
s = [t];
|
|
351
356
|
let r = 0;
|
|
@@ -362,33 +367,35 @@ G.Oa = class {
|
|
|
362
367
|
return r;
|
|
363
368
|
}
|
|
364
369
|
lr(t) {
|
|
365
|
-
const e = this.
|
|
370
|
+
const e = this.Za[t];
|
|
366
371
|
return null == e ? null : e.value;
|
|
367
372
|
}
|
|
368
373
|
remove(t) {
|
|
369
|
-
this.
|
|
374
|
+
this.Za[t] = null;
|
|
370
375
|
}
|
|
371
376
|
};
|
|
372
377
|
G.wa = class {
|
|
373
378
|
constructor(t, e, s) {
|
|
374
|
-
(this.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
this.
|
|
379
|
+
(this._r = t),
|
|
380
|
+
(this.Sl = []),
|
|
381
|
+
e && this.Sl.push(new G.ne(t)),
|
|
382
|
+
s && this.Sl.push(new G._a(t)),
|
|
383
|
+
this.Sl.push(new G.Oa(t));
|
|
378
384
|
}
|
|
379
385
|
store(t, e) {
|
|
380
386
|
let s = !0;
|
|
381
|
-
for (let r = 0; r < this.
|
|
387
|
+
for (let r = 0; r < this.Sl.length; r++) s = this.Sl[r].store(t, e) && s;
|
|
382
388
|
return s;
|
|
383
389
|
}
|
|
384
390
|
lr(t) {
|
|
385
|
-
for (let e = 0; e < this.
|
|
386
|
-
const s = this.
|
|
391
|
+
for (let e = 0; e < this.Sl.length; e++) {
|
|
392
|
+
const s = this.Sl[e].lr(t);
|
|
387
393
|
if (null != s) return s;
|
|
388
394
|
}
|
|
389
395
|
return null;
|
|
390
396
|
}
|
|
391
397
|
remove(t) {
|
|
392
|
-
|
|
398
|
+
new G.ne(this._r).remove(t);
|
|
399
|
+
for (let e = 0; e < this.Sl.length; e++) this.Sl[e].remove(t);
|
|
393
400
|
}
|
|
394
401
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
ma: "invalid_api_key",
|
|
3
|
+
pa: "blacklisted",
|
|
4
|
+
Ra: "no_device_identifier",
|
|
5
|
+
fa: "invalid_json_response",
|
|
6
|
+
la: "empty_response",
|
|
7
7
|
__: "sdk_auth_error"
|
|
8
8
|
};
|
|
@@ -12,7 +12,7 @@ export default class Kt {
|
|
|
12
12
|
}
|
|
13
13
|
ss() {
|
|
14
14
|
return {
|
|
15
|
-
s: "4.7.
|
|
15
|
+
s: "4.7.2",
|
|
16
16
|
l: this.ol,
|
|
17
17
|
e: this.fl,
|
|
18
18
|
a: this.bl,
|
|
@@ -26,7 +26,7 @@ export default class Kt {
|
|
|
26
26
|
static Pn(t) {
|
|
27
27
|
let s = t.l;
|
|
28
28
|
return (
|
|
29
|
-
"4.7.
|
|
29
|
+
"4.7.2" !== t.s && (s = 0), new Kt(s, t.e, t.a, t.p, t.m, t.v, t.c, t.f)
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -12,23 +12,23 @@ export default class Rt {
|
|
|
12
12
|
(this._r = t),
|
|
13
13
|
(this.Uo = s),
|
|
14
14
|
(this.kl = 0),
|
|
15
|
-
(this.yl = h.
|
|
16
|
-
(this.
|
|
15
|
+
(this.yl = h.Pa()),
|
|
16
|
+
(this.jl = null),
|
|
17
17
|
(this.j = i),
|
|
18
18
|
(this.Ur = e),
|
|
19
19
|
(this.v = n),
|
|
20
20
|
(this.gt = l),
|
|
21
21
|
(this.h = h),
|
|
22
|
-
(this.
|
|
22
|
+
(this.Go = r),
|
|
23
23
|
(this.vt = a),
|
|
24
|
-
(this
|
|
25
|
-
(this
|
|
26
|
-
(this.
|
|
24
|
+
(this.$l = o),
|
|
25
|
+
(this.Al = new u()),
|
|
26
|
+
(this.Cl = 50);
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
return !t && !s && this.
|
|
28
|
+
Tl(t, s) {
|
|
29
|
+
return !t && !s && this.Go.Wn() >= this.Cl;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
_l(t) {
|
|
32
32
|
let s = this.j.Ch();
|
|
33
33
|
if (t.length > 0) {
|
|
34
34
|
const i = this.v.getUserId();
|
|
@@ -39,10 +39,10 @@ export default class Rt {
|
|
|
39
39
|
}
|
|
40
40
|
return s;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
null == i && (i = !0), i && this.
|
|
44
|
-
const u = this.h.
|
|
45
|
-
a = this.h.
|
|
42
|
+
ql(t, s, i, e, n, l, h) {
|
|
43
|
+
null == i && (i = !0), i && this.Fl();
|
|
44
|
+
const u = this.h.Ua(),
|
|
45
|
+
a = this.h.Ba();
|
|
46
46
|
let c = !1;
|
|
47
47
|
const d = (t, s) => {
|
|
48
48
|
let h = !1;
|
|
@@ -55,15 +55,15 @@ export default class Rt {
|
|
|
55
55
|
t.respond_with.triggers &&
|
|
56
56
|
(this.kl = Math.max(this.kl - 1, 0)),
|
|
57
57
|
this.vt.Os(t, i, s)
|
|
58
|
-
? (this.
|
|
58
|
+
? (this.Go.Qs(),
|
|
59
59
|
this.gt.al(i),
|
|
60
60
|
(null != t.respond_with &&
|
|
61
61
|
t.respond_with.user_id != this.v.getUserId()) ||
|
|
62
|
-
(null != t.device && this.h.B(o.q.
|
|
62
|
+
(null != t.device && this.h.B(o.q.Xo, t.device),
|
|
63
63
|
null != t.sdk_metadata &&
|
|
64
|
-
(this.h.B(o.q.
|
|
65
|
-
this.h.B(o.q.
|
|
66
|
-
this
|
|
64
|
+
(this.h.B(o.q.oa, t.sdk_metadata),
|
|
65
|
+
this.h.B(o.q.ua, this.j.ha())),
|
|
66
|
+
this.$l(i),
|
|
67
67
|
"function" == typeof e && e()))
|
|
68
68
|
: i.auth_error && (h = !0);
|
|
69
69
|
},
|
|
@@ -71,84 +71,84 @@ export default class Rt {
|
|
|
71
71
|
null != t.respond_with &&
|
|
72
72
|
t.respond_with.triggers &&
|
|
73
73
|
(this.kl = Math.max(this.kl - 1, 0)),
|
|
74
|
-
this.vt.
|
|
74
|
+
this.vt.ca(t.events, t.attributes),
|
|
75
75
|
"function" == typeof n && n();
|
|
76
76
|
},
|
|
77
77
|
wi: t => {
|
|
78
78
|
if (("function" == typeof l && l(t), i && !c)) {
|
|
79
|
-
if (t && !h) this.
|
|
79
|
+
if (t && !h) this.Dl();
|
|
80
80
|
else {
|
|
81
|
-
let t = this.
|
|
81
|
+
let t = this.jl;
|
|
82
82
|
(null == t || t < 1e3 * this.yl) && (t = 1e3 * this.yl),
|
|
83
|
-
this.
|
|
83
|
+
this.Dl(Math.min(3e5, tt(1e3 * this.yl, 3 * t)));
|
|
84
84
|
}
|
|
85
85
|
c = !0;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
},
|
|
90
|
-
f = this.
|
|
90
|
+
f = this._l(u),
|
|
91
91
|
m = s || f;
|
|
92
|
-
if (this.
|
|
92
|
+
if (this.Tl(h, f))
|
|
93
93
|
return void r.D.info(
|
|
94
94
|
"Declining to flush data due to 50 consecutive authentication failures"
|
|
95
95
|
);
|
|
96
|
-
if (i && !this.vt.
|
|
97
|
-
return this.
|
|
98
|
-
const g = this.vt.
|
|
96
|
+
if (i && !this.vt.ba(u, a, t, m))
|
|
97
|
+
return this.Dl(), void ("function" == typeof l && l(!0));
|
|
98
|
+
const g = this.vt.ga(t, m, u, a);
|
|
99
99
|
m && this.kl++;
|
|
100
100
|
let p = !1;
|
|
101
101
|
if (g)
|
|
102
102
|
for (const t of g)
|
|
103
103
|
this.vt.Gs(t.requestData, () => d(t.requestData, t.headers)), (p = !0);
|
|
104
|
-
this.
|
|
105
|
-
? this.
|
|
106
|
-
: f && (r.D.info("Invoking new session subscriptions"), this
|
|
104
|
+
this.Go.Jn() && i && !p
|
|
105
|
+
? this.Dl()
|
|
106
|
+
: f && (r.D.info("Invoking new session subscriptions"), this.Al.St());
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
Ll() {
|
|
109
109
|
return this.kl > 0;
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
this.
|
|
111
|
+
Dl(t) {
|
|
112
|
+
this.Pl ||
|
|
113
113
|
(null == t && (t = 1e3 * this.yl),
|
|
114
|
-
this.
|
|
115
|
-
(this.
|
|
114
|
+
this.Fl(),
|
|
115
|
+
(this.Rl = setTimeout(() => {
|
|
116
116
|
if (document.hidden) {
|
|
117
117
|
const t = "visibilitychange",
|
|
118
118
|
s = () => {
|
|
119
119
|
document.hidden ||
|
|
120
|
-
(document.removeEventListener(t, s, !1), this.
|
|
120
|
+
(document.removeEventListener(t, s, !1), this.ql());
|
|
121
121
|
};
|
|
122
122
|
document.addEventListener(t, s, !1);
|
|
123
|
-
} else this.
|
|
123
|
+
} else this.ql();
|
|
124
124
|
}, t)),
|
|
125
|
-
(this.
|
|
125
|
+
(this.jl = t));
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
null != this.
|
|
127
|
+
Fl() {
|
|
128
|
+
null != this.Rl && (clearTimeout(this.Rl), (this.Rl = null));
|
|
129
129
|
}
|
|
130
130
|
initialize() {
|
|
131
|
-
(this.
|
|
131
|
+
(this.Pl = !1), this.Dl();
|
|
132
132
|
}
|
|
133
133
|
destroy() {
|
|
134
|
-
this
|
|
135
|
-
this.
|
|
136
|
-
this.
|
|
137
|
-
(this.
|
|
138
|
-
this.
|
|
139
|
-
(this.
|
|
134
|
+
this.Al.removeAllSubscriptions(),
|
|
135
|
+
this.Go.Rn(),
|
|
136
|
+
this.Fl(),
|
|
137
|
+
(this.Pl = !0),
|
|
138
|
+
this.ql(null, null, !1),
|
|
139
|
+
(this.Rl = null);
|
|
140
140
|
}
|
|
141
141
|
cr(t) {
|
|
142
|
-
return this
|
|
142
|
+
return this.Al.ut(t);
|
|
143
143
|
}
|
|
144
144
|
openSession() {
|
|
145
|
-
const t = this.j.
|
|
146
|
-
t && (this.h.
|
|
147
|
-
this.
|
|
145
|
+
const t = this.j.ha() !== this.j.mo();
|
|
146
|
+
t && (this.h.ya(o.eu.Jo), this.h.ya(o.eu.su)),
|
|
147
|
+
this.ql(null, !1, null, null, null),
|
|
148
148
|
this.Bn(),
|
|
149
149
|
t &&
|
|
150
150
|
import("./Push/push-manager-factory.js").then(t => {
|
|
151
|
-
if (this.
|
|
151
|
+
if (this.Pl) return;
|
|
152
152
|
const s = t.default.aa();
|
|
153
153
|
if (
|
|
154
154
|
null != s &&
|
|
@@ -177,26 +177,26 @@ export default class Rt {
|
|
|
177
177
|
const e = this.v.getUserId();
|
|
178
178
|
if (e !== t) {
|
|
179
179
|
this.j.Bh(),
|
|
180
|
-
null != e && this.
|
|
180
|
+
null != e && this.ql(null, !1, null, null, null),
|
|
181
181
|
this.v.ru(t),
|
|
182
|
-
i ? this.
|
|
182
|
+
i ? this.Go.setSdkAuthenticationSignature(i) : this.Go.On();
|
|
183
183
|
for (let t = 0; t < s.length; t++) s[t].changeUser(null == e);
|
|
184
184
|
null != e && this.h.Xs(o.q.P),
|
|
185
|
-
this.h.Xs(o.q.
|
|
185
|
+
this.h.Xs(o.q.Xo),
|
|
186
186
|
this.openSession(),
|
|
187
187
|
r.D.info('Changed user to "' + t + '".');
|
|
188
188
|
} else {
|
|
189
189
|
let s = "Doing nothing.";
|
|
190
190
|
i &&
|
|
191
|
-
this.
|
|
192
|
-
(this.
|
|
191
|
+
this.Go.Kn() !== i &&
|
|
192
|
+
(this.Go.setSdkAuthenticationSignature(i),
|
|
193
193
|
(s = "Updated SDK authentication signature")),
|
|
194
194
|
r.D.info(`Current user is already ${t}. ${s}`);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
requestImmediateDataFlush(t) {
|
|
198
|
-
this.
|
|
199
|
-
this.
|
|
198
|
+
this.Fl(), this.j.mo();
|
|
199
|
+
this.ql(
|
|
200
200
|
null,
|
|
201
201
|
null,
|
|
202
202
|
null,
|
|
@@ -211,15 +211,15 @@ export default class Rt {
|
|
|
211
211
|
);
|
|
212
212
|
}
|
|
213
213
|
requestFeedRefresh() {
|
|
214
|
-
this.j.mo(), this.
|
|
214
|
+
this.j.mo(), this.ql(!0);
|
|
215
215
|
}
|
|
216
216
|
zr(t, s) {
|
|
217
217
|
this.j.mo(),
|
|
218
218
|
r.D.info("Requesting explicit trigger refresh."),
|
|
219
|
-
this.
|
|
219
|
+
this.ql(null, !0, null, t, s);
|
|
220
220
|
}
|
|
221
221
|
Nn(t, i) {
|
|
222
|
-
const e = r.A.
|
|
222
|
+
const e = r.A.Ml,
|
|
223
223
|
n = { a: t, l: i },
|
|
224
224
|
l = s.G(e, n);
|
|
225
225
|
return l && r.D.info(`Logged alias ${t} with label ${i}`), l;
|
|
@@ -242,7 +242,7 @@ export default class Rt {
|
|
|
242
242
|
null != n && (o.altitude = n),
|
|
243
243
|
null != l && (o.ll_accuracy = l),
|
|
244
244
|
null != h && (o.alt_accuracy = h);
|
|
245
|
-
const u = s.G(r.A.
|
|
245
|
+
const u = s.G(r.A.Nl, o, t);
|
|
246
246
|
return (
|
|
247
247
|
u &&
|
|
248
248
|
r.D.info(
|
|
@@ -253,20 +253,20 @@ export default class Rt {
|
|
|
253
253
|
}
|
|
254
254
|
kr(t, s) {
|
|
255
255
|
const i = this.j.mo();
|
|
256
|
-
return new ue(this.v.getUserId(), r.A.
|
|
256
|
+
return new ue(this.v.getUserId(), r.A.Ol, t, i, { cid: s });
|
|
257
257
|
}
|
|
258
258
|
Bn() {
|
|
259
259
|
const t = r.xt.Ft;
|
|
260
|
-
new r.qt(t, r.D).setItem(t.$t.
|
|
260
|
+
new r.qt(t, r.D).setItem(t.$t.Il, 1, {
|
|
261
261
|
baseUrl: this.Uo,
|
|
262
262
|
data: { api_key: this._r, device_id: this.Ur.te().id },
|
|
263
263
|
userId: this.v.getUserId(),
|
|
264
|
-
sdkAuthEnabled: this.
|
|
264
|
+
sdkAuthEnabled: this.Go.Jn()
|
|
265
265
|
});
|
|
266
266
|
}
|
|
267
267
|
wr(t) {
|
|
268
268
|
for (const s of t)
|
|
269
|
-
if (s.api_key === this._r) this.vt.
|
|
269
|
+
if (s.api_key === this._r) this.vt.ca(s.events, s.attributes);
|
|
270
270
|
else {
|
|
271
271
|
const t = r.xt.Ft;
|
|
272
272
|
new r.qt(t, r.D).setItem(t.$t.$r, r.it.nt(), s);
|
|
@@ -280,13 +280,13 @@ export default class Rt {
|
|
|
280
280
|
let l, h;
|
|
281
281
|
return (
|
|
282
282
|
null === e && null === n
|
|
283
|
-
? ((l = r.A.
|
|
284
|
-
: ((l = r.A.
|
|
283
|
+
? ((l = r.A.Ul), (h = { key: i }))
|
|
284
|
+
: ((l = r.A.xl), (h = { key: i, latitude: e, longitude: n })),
|
|
285
285
|
s.G(l, h)
|
|
286
286
|
);
|
|
287
287
|
}
|
|
288
288
|
$n(t, i) {
|
|
289
289
|
const e = { group_id: t, status: i };
|
|
290
|
-
return s.G(r.A.
|
|
290
|
+
return s.G(r.A.Jl, e);
|
|
291
291
|
}
|
|
292
292
|
}
|