@braze/web-sdk 6.5.0 → 6.6.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/index.d.ts +8 -3
- package/package.json +1 -1
- package/shared-lib/event-types.js +11 -11
- package/shared-lib/indexed-db-adapter.js +4 -4
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +14 -13
- package/src/Core/disable-sdk.js +8 -7
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/is-disabled.js +1 -1
- package/src/DUST/dust-provider.js +100 -100
- package/src/DUST/dust-shared-worker-impl.js +12 -12
- package/src/DUST/dust-worker-bridge.js +11 -11
- package/src/DUST/subscribe-to-dust.js +5 -5
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +68 -68
- package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +7 -7
- package/src/InAppMessage/models/html-message.js +8 -8
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +42 -42
- package/src/InAppMessage/models/modal-message.js +8 -8
- package/src/InAppMessage/models/slide-up-message.js +6 -6
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/Push/push-manager-factory.js +2 -2
- package/src/Push/utils/push-utils.js +6 -6
- package/src/User/user-manager.js +2 -2
- package/src/User/user.js +9 -9
- package/src/common/content-cards-display.js +1 -1
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/managers/braze-instance.js +99 -95
- package/src/managers/device-manager.js +2 -2
- package/src/managers/network-manager.js +116 -116
- package/src/managers/server-config-manager.js +33 -33
- package/src/managers/session-manager.js +1 -1
- package/src/managers/storage-manager-factory.js +8 -8
- package/src/managers/storage-manager.js +45 -48
- package/src/managers/subscription-manager.js +8 -8
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +1 -1
- package/src/models/device.js +1 -1
- package/src/models/push-token.js +6 -6
- package/src/models/server-config.js +29 -29
- package/src/request-controller.js +91 -91
- package/src/triggers/models/trigger-condition.js +25 -25
- package/src/triggers/models/trigger.js +7 -7
- package/src/triggers/triggers-provider-factory.js +1 -1
- package/src/triggers/triggers-provider.js +12 -12
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/braze-actions.js +2 -2
- package/src/util/browser-detector.js +1 -1
- package/src/util/net.js +2 -2
- package/src/util/request-header-utils.js +12 -12
- package/src/util/window-utils.js +1 -1
|
@@ -13,7 +13,7 @@ import { getErrorMessage as ai } from "../util/error-utils.js";
|
|
|
13
13
|
export const STORAGE_KEYS = {
|
|
14
14
|
Ou: {
|
|
15
15
|
Cu: "ab.storage.userId",
|
|
16
|
-
|
|
16
|
+
il: "ab.storage.deviceId",
|
|
17
17
|
um: "ab.storage.sessionId",
|
|
18
18
|
},
|
|
19
19
|
ft: {
|
|
@@ -22,8 +22,8 @@ export const STORAGE_KEYS = {
|
|
|
22
22
|
eE: "ab.storage.attributes",
|
|
23
23
|
sE: "ab.storage.attributes.anonymous_user",
|
|
24
24
|
ac: "ab.storage.device",
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
Tl: "ab.storage.sdk_metadata",
|
|
26
|
+
kl: "ab.storage.session_id_for_cached_metadata",
|
|
27
27
|
Uu: "ab.storage.pushToken",
|
|
28
28
|
rE: "ab.storage.cardImpressions",
|
|
29
29
|
jc: "ab.storage.serverConfig",
|
|
@@ -33,8 +33,8 @@ export const STORAGE_KEYS = {
|
|
|
33
33
|
Ps: "ab.storage.cc",
|
|
34
34
|
Gs: "ab.storage.ccLastFullSync",
|
|
35
35
|
Hs: "ab.storage.ccLastCardUpdated",
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
lc: "ab.storage.globalRateLimitCurrentTokenCount",
|
|
37
|
+
mc: "ab.storage.dynamicRateLimitCurrentTokenCount",
|
|
38
38
|
Jt: "ab.storage.ccClicks",
|
|
39
39
|
Vt: "ab.storage.ccImpressions",
|
|
40
40
|
Pt: "ab.storage.ccDismissals",
|
|
@@ -50,26 +50,26 @@ export const STORAGE_KEYS = {
|
|
|
50
50
|
Co: "ab.storage.ff.sessionId",
|
|
51
51
|
lE: "ab.storage.lastReqToEndpoint",
|
|
52
52
|
_E: "ab.storage.requestAttempts",
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
Yn: "ab.storage.deferredIam",
|
|
54
|
+
Ql: "ab.storage.lastSdkReq",
|
|
55
55
|
uE: "ab.storage.alias",
|
|
56
56
|
vt: "ab.storage.banners",
|
|
57
57
|
Dt: "ab.storage.banners.impressions",
|
|
58
58
|
Bt: "ab.storage.banners.sessionId",
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
Ne: "ab.storage.dust.mite",
|
|
60
|
+
Te: "ab.storage.dust.host",
|
|
61
|
+
ze: "ab.storage.dust.auth",
|
|
62
|
+
Ae: "ab.storage.dust.expiration",
|
|
63
63
|
},
|
|
64
|
-
|
|
64
|
+
be: "ab.optOut",
|
|
65
65
|
};
|
|
66
66
|
export default class ee {
|
|
67
67
|
constructor(t, e) {
|
|
68
68
|
(this.TE = t), (this.cE = e), (this.TE = t), (this.cE = e);
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
Al(t) {
|
|
71
71
|
const e = C(STORAGE_KEYS.Ou),
|
|
72
|
-
s = new ee.
|
|
72
|
+
s = new ee.me(t);
|
|
73
73
|
for (const t of e) s.remove(STORAGE_KEYS.Ou[t]);
|
|
74
74
|
}
|
|
75
75
|
Iu(t, e) {
|
|
@@ -102,7 +102,7 @@ export default class ee {
|
|
|
102
102
|
xm(t) {
|
|
103
103
|
this.TE.remove(t);
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
Nl() {
|
|
106
106
|
const t = C(STORAGE_KEYS.Ou);
|
|
107
107
|
let e;
|
|
108
108
|
for (const s of t)
|
|
@@ -142,7 +142,7 @@ export default class ee {
|
|
|
142
142
|
typeof t +
|
|
143
143
|
": " +
|
|
144
144
|
JSON.stringify(t)),
|
|
145
|
-
e.push(new De(null, f.
|
|
145
|
+
e.push(new De(null, f.Cl, new Date().valueOf(), null, { e: o }));
|
|
146
146
|
}
|
|
147
147
|
return e;
|
|
148
148
|
}
|
|
@@ -191,15 +191,15 @@ export default class ee {
|
|
|
191
191
|
OE(t) {
|
|
192
192
|
return t || STORAGE_KEYS.ft.sE;
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
Ll(t) {
|
|
195
195
|
let e = this.cE.jr(STORAGE_KEYS.ft.eE);
|
|
196
196
|
null == e && (e = {});
|
|
197
|
-
const s = this.OE(t[User.
|
|
197
|
+
const s = this.OE(t[User.Wa]),
|
|
198
198
|
r = e[s];
|
|
199
199
|
for (const o in t)
|
|
200
|
-
o !== User.
|
|
200
|
+
o !== User.Wa &&
|
|
201
201
|
(null == e[s] || (r && null == r[o])) &&
|
|
202
|
-
this.Eu(t[User.
|
|
202
|
+
this.Eu(t[User.Wa], o, t[o]);
|
|
203
203
|
}
|
|
204
204
|
Eu(t, e, s) {
|
|
205
205
|
let r = this.cE.jr(STORAGE_KEYS.ft.eE);
|
|
@@ -207,7 +207,7 @@ export default class ee {
|
|
|
207
207
|
const o = this.OE(t);
|
|
208
208
|
let n = r[o];
|
|
209
209
|
if (
|
|
210
|
-
(null == n && ((n = {}), null != t && (n[User.
|
|
210
|
+
(null == n && ((n = {}), null != t && (n[User.Wa] = t)), e === User.Bu)
|
|
211
211
|
) {
|
|
212
212
|
null == n[e] && (n[e] = {});
|
|
213
213
|
for (const t in s) n[e][t] = s[t];
|
|
@@ -229,8 +229,8 @@ export default class ee {
|
|
|
229
229
|
null != r &&
|
|
230
230
|
((e[s] = void 0),
|
|
231
231
|
this.cE.store(STORAGE_KEYS.ft.eE, e),
|
|
232
|
-
(r[User.
|
|
233
|
-
this.
|
|
232
|
+
(r[User.Wa] = t),
|
|
233
|
+
this.Ll(r));
|
|
234
234
|
}
|
|
235
235
|
const s = this.$u(STORAGE_KEYS.Ou.um);
|
|
236
236
|
let r = null;
|
|
@@ -246,7 +246,7 @@ export default class ee {
|
|
|
246
246
|
return this.cE.bE;
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
(ee.
|
|
249
|
+
(ee.Xc = class {
|
|
250
250
|
constructor(t) {
|
|
251
251
|
(this.tu = t), (this.tu = t), (this.bE = ro.fE() ? 3 : 10);
|
|
252
252
|
}
|
|
@@ -278,7 +278,7 @@ export default class ee {
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
}),
|
|
281
|
-
(ee.
|
|
281
|
+
(ee.Yc = class {
|
|
282
282
|
constructor() {
|
|
283
283
|
(this.KE = {}), (this.YE = 5242880), (this.bE = 3);
|
|
284
284
|
}
|
|
@@ -320,14 +320,11 @@ export default class ee {
|
|
|
320
320
|
this.KE[t] = null;
|
|
321
321
|
}
|
|
322
322
|
}),
|
|
323
|
-
(ee.
|
|
324
|
-
constructor(t, e) {
|
|
325
|
-
(this.tu = t),
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
(this.GE = this.CE()),
|
|
329
|
-
(this.ME = 576e3),
|
|
330
|
-
(this.DE = !!e);
|
|
323
|
+
(ee.me = class {
|
|
324
|
+
constructor(t, e, s) {
|
|
325
|
+
(this.tu = t), (this.DE = e), (this.tu = t), (this.GE = this.CE());
|
|
326
|
+
const r = "number" == typeof s && s > 0 ? s : 400;
|
|
327
|
+
(this.ME = 24 * r * 60), (this.DE = !!e);
|
|
331
328
|
}
|
|
332
329
|
mE(t) {
|
|
333
330
|
return null != this.tu ? t + "." + this.tu : t;
|
|
@@ -347,7 +344,7 @@ export default class ee {
|
|
|
347
344
|
e
|
|
348
345
|
);
|
|
349
346
|
}
|
|
350
|
-
|
|
347
|
+
pe() {
|
|
351
348
|
const t = new Date();
|
|
352
349
|
return t.setTime(t.getTime() + 60 * this.ME * 1e3), t.getFullYear();
|
|
353
350
|
}
|
|
@@ -365,7 +362,7 @@ export default class ee {
|
|
|
365
362
|
}
|
|
366
363
|
if (o) {
|
|
367
364
|
const t = r.split("=")[0];
|
|
368
|
-
-1 === t.indexOf("." + this.tu) && this.
|
|
365
|
+
-1 === t.indexOf("." + this.tu) && this.vE(t);
|
|
369
366
|
}
|
|
370
367
|
}
|
|
371
368
|
}
|
|
@@ -412,37 +409,37 @@ export default class ee {
|
|
|
412
409
|
return e.length > 0 ? e[e.length - 1] : null;
|
|
413
410
|
}
|
|
414
411
|
remove(t) {
|
|
415
|
-
this.
|
|
412
|
+
this.vE(this.mE(t));
|
|
416
413
|
}
|
|
417
|
-
|
|
414
|
+
vE(t) {
|
|
418
415
|
const e = t + "=;expires=" + new Date(0).toUTCString();
|
|
419
416
|
(document.cookie = e), (document.cookie = e + ";path=/");
|
|
420
417
|
const s = e + ";domain=" + this.GE;
|
|
421
418
|
(document.cookie = s), (document.cookie = s + ";path=/");
|
|
422
419
|
}
|
|
423
420
|
}),
|
|
424
|
-
(ee.
|
|
425
|
-
constructor(t, e, s) {
|
|
421
|
+
(ee.Wc = class {
|
|
422
|
+
constructor(t, e, s, r) {
|
|
426
423
|
(this.tu = t),
|
|
427
|
-
(this.
|
|
428
|
-
e && this.
|
|
429
|
-
s && this.
|
|
430
|
-
this.
|
|
424
|
+
(this.UE = []),
|
|
425
|
+
e && this.UE.push(new ee.me(t, void 0, r)),
|
|
426
|
+
s && this.UE.push(new ee.Xc(t)),
|
|
427
|
+
this.UE.push(new ee.Yc());
|
|
431
428
|
}
|
|
432
429
|
store(t, e) {
|
|
433
430
|
let s = !0;
|
|
434
|
-
for (let r = 0; r < this.
|
|
431
|
+
for (let r = 0; r < this.UE.length; r++) s = this.UE[r].store(t, e) && s;
|
|
435
432
|
return s;
|
|
436
433
|
}
|
|
437
434
|
jr(t) {
|
|
438
|
-
for (let e = 0; e < this.
|
|
439
|
-
const s = this.
|
|
435
|
+
for (let e = 0; e < this.UE.length; e++) {
|
|
436
|
+
const s = this.UE[e].jr(t);
|
|
440
437
|
if (null != s) return s;
|
|
441
438
|
}
|
|
442
439
|
return null;
|
|
443
440
|
}
|
|
444
441
|
remove(t) {
|
|
445
|
-
new ee.
|
|
446
|
-
for (let e = 0; e < this.
|
|
442
|
+
new ee.me(this.tu).remove(t);
|
|
443
|
+
for (let e = 0; e < this.UE.length; e++) this.UE[e].remove(t);
|
|
447
444
|
}
|
|
448
445
|
});
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { Guid as P } from "../../shared-lib/index.js";
|
|
2
2
|
export default class m {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.
|
|
4
|
+
this.vn = {};
|
|
5
5
|
}
|
|
6
6
|
Rt(t) {
|
|
7
7
|
if ("function" != typeof t) return null;
|
|
8
8
|
const i = P.se();
|
|
9
|
-
return (this.
|
|
9
|
+
return (this.vn[i] = t), i;
|
|
10
10
|
}
|
|
11
11
|
removeSubscription(t) {
|
|
12
|
-
delete this.
|
|
12
|
+
delete this.vn[t];
|
|
13
13
|
}
|
|
14
14
|
removeAllSubscriptions() {
|
|
15
|
-
this.
|
|
15
|
+
this.vn = {};
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
return Object.keys(this.
|
|
17
|
+
We() {
|
|
18
|
+
return Object.keys(this.vn).length;
|
|
19
19
|
}
|
|
20
20
|
L(t) {
|
|
21
21
|
const i = [];
|
|
22
|
-
for (const s in this.
|
|
23
|
-
const r = this.
|
|
22
|
+
for (const s in this.vn) {
|
|
23
|
+
const r = this.vn[s];
|
|
24
24
|
i.push(r(t));
|
|
25
25
|
}
|
|
26
26
|
return i;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
zl: "invalid_api_key",
|
|
3
|
+
jl: "blacklisted",
|
|
4
|
+
Ml: "no_device_identifier",
|
|
5
|
+
Bl: "invalid_json_response",
|
|
6
|
+
wl: "empty_response",
|
|
7
7
|
__: "sdk_auth_error",
|
|
8
8
|
};
|
package/src/models/device.js
CHANGED
package/src/models/push-token.js
CHANGED
|
@@ -4,21 +4,21 @@ export default class oi {
|
|
|
4
4
|
(this.endpoint = t),
|
|
5
5
|
(this.Wu = i),
|
|
6
6
|
(this.publicKey = s),
|
|
7
|
-
(this.
|
|
8
|
-
(this.
|
|
7
|
+
(this.Zc = l),
|
|
8
|
+
(this.Gc = h),
|
|
9
9
|
(this.endpoint = t || null),
|
|
10
10
|
(this.Wu = i || null),
|
|
11
11
|
(this.publicKey = s || null),
|
|
12
|
-
(this.
|
|
13
|
-
(this.
|
|
12
|
+
(this.Zc = l || null),
|
|
13
|
+
(this.Gc = h || null);
|
|
14
14
|
}
|
|
15
15
|
gt() {
|
|
16
16
|
return {
|
|
17
17
|
e: this.endpoint,
|
|
18
18
|
c: this.Wu,
|
|
19
19
|
p: this.publicKey,
|
|
20
|
-
u: this.
|
|
21
|
-
v: this.
|
|
20
|
+
u: this.Zc,
|
|
21
|
+
v: this.Gc,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
static _u(t) {
|
|
@@ -17,52 +17,52 @@ export default class li {
|
|
|
17
17
|
u = null,
|
|
18
18
|
c = null,
|
|
19
19
|
) {
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
22
|
-
(this.
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
25
|
-
(this.
|
|
26
|
-
(this.
|
|
20
|
+
(this.Sc = t),
|
|
21
|
+
(this.Kc = i),
|
|
22
|
+
(this.Pc = s),
|
|
23
|
+
(this._c = h),
|
|
24
|
+
(this.Vc = e),
|
|
25
|
+
(this.Gc = l),
|
|
26
|
+
(this.Ic = r),
|
|
27
27
|
(this.Xr = n),
|
|
28
|
-
(this.
|
|
28
|
+
(this.xc = a),
|
|
29
29
|
(this.banners = o),
|
|
30
30
|
(this.dust = u),
|
|
31
|
-
(this.
|
|
32
|
-
(this.
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
35
|
-
(this.
|
|
36
|
-
(this.
|
|
37
|
-
(this.
|
|
38
|
-
(this.
|
|
31
|
+
(this.Jc = c),
|
|
32
|
+
(this.Sc = t),
|
|
33
|
+
(this.Kc = i),
|
|
34
|
+
(this.Pc = s),
|
|
35
|
+
(this._c = h),
|
|
36
|
+
(this.Vc = e),
|
|
37
|
+
(this.Gc = l),
|
|
38
|
+
(this.Ic = r),
|
|
39
39
|
(this.Xr = n),
|
|
40
|
-
(this.
|
|
40
|
+
(this.xc = a),
|
|
41
41
|
(this.banners = o),
|
|
42
42
|
(this.dust = u),
|
|
43
|
-
(this.
|
|
43
|
+
(this.Jc = c);
|
|
44
44
|
}
|
|
45
45
|
gt() {
|
|
46
46
|
return {
|
|
47
|
-
s: "6.
|
|
48
|
-
l: this.
|
|
49
|
-
e: this.
|
|
50
|
-
a: this.
|
|
51
|
-
p: this.
|
|
52
|
-
m: this.
|
|
53
|
-
v: this.
|
|
54
|
-
c: this.
|
|
47
|
+
s: "6.6.0",
|
|
48
|
+
l: this.Sc,
|
|
49
|
+
e: this.Kc,
|
|
50
|
+
a: this.Pc,
|
|
51
|
+
p: this._c,
|
|
52
|
+
m: this.Vc,
|
|
53
|
+
v: this.Gc,
|
|
54
|
+
c: this.Ic,
|
|
55
55
|
f: this.Xr,
|
|
56
|
-
grl: this.
|
|
56
|
+
grl: this.xc,
|
|
57
57
|
b: this.banners,
|
|
58
58
|
d: this.dust,
|
|
59
|
-
rb: this.
|
|
59
|
+
rb: this.Jc,
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
static _u(t) {
|
|
63
63
|
let i = t.l;
|
|
64
64
|
return (
|
|
65
|
-
"6.
|
|
65
|
+
"6.6.0" !== t.s && (i = 0),
|
|
66
66
|
new li(i, t.e, t.a, t.p, t.m, t.v, t.c, t.f, t.grl, t.b, t.d, t.rb)
|
|
67
67
|
);
|
|
68
68
|
}
|