@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.
Files changed (59) hide show
  1. package/index.d.ts +8 -3
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +11 -11
  4. package/shared-lib/indexed-db-adapter.js +4 -4
  5. package/shared-lib/logger.js +2 -2
  6. package/shared-lib/supported-options.js +14 -13
  7. package/src/Core/disable-sdk.js +8 -7
  8. package/src/Core/enable-sdk.js +3 -3
  9. package/src/Core/is-disabled.js +1 -1
  10. package/src/DUST/dust-provider.js +100 -100
  11. package/src/DUST/dust-shared-worker-impl.js +12 -12
  12. package/src/DUST/dust-worker-bridge.js +11 -11
  13. package/src/DUST/subscribe-to-dust.js +5 -5
  14. package/src/InAppMessage/defer-in-app-message.js +1 -1
  15. package/src/InAppMessage/in-app-message-manager.js +68 -68
  16. package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
  17. package/src/InAppMessage/log-in-app-message-click.js +1 -1
  18. package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
  19. package/src/InAppMessage/log-in-app-message-impression.js +1 -1
  20. package/src/InAppMessage/models/full-screen-message.js +7 -7
  21. package/src/InAppMessage/models/html-message.js +8 -8
  22. package/src/InAppMessage/models/in-app-message-button.js +2 -2
  23. package/src/InAppMessage/models/in-app-message.js +42 -42
  24. package/src/InAppMessage/models/modal-message.js +8 -8
  25. package/src/InAppMessage/models/slide-up-message.js +6 -6
  26. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  27. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  28. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  29. package/src/Push/push-manager-factory.js +2 -2
  30. package/src/Push/utils/push-utils.js +6 -6
  31. package/src/User/user-manager.js +2 -2
  32. package/src/User/user.js +9 -9
  33. package/src/common/content-cards-display.js +1 -1
  34. package/src/l10n/l10n-manager-factory.js +1 -1
  35. package/src/managers/braze-instance.js +99 -95
  36. package/src/managers/device-manager.js +2 -2
  37. package/src/managers/network-manager.js +116 -116
  38. package/src/managers/server-config-manager.js +33 -33
  39. package/src/managers/session-manager.js +1 -1
  40. package/src/managers/storage-manager-factory.js +8 -8
  41. package/src/managers/storage-manager.js +45 -48
  42. package/src/managers/subscription-manager.js +8 -8
  43. package/src/models/backend-errors.js +5 -5
  44. package/src/models/braze-event.js +1 -1
  45. package/src/models/device.js +1 -1
  46. package/src/models/push-token.js +6 -6
  47. package/src/models/server-config.js +29 -29
  48. package/src/request-controller.js +91 -91
  49. package/src/triggers/models/trigger-condition.js +25 -25
  50. package/src/triggers/models/trigger.js +7 -7
  51. package/src/triggers/triggers-provider-factory.js +1 -1
  52. package/src/triggers/triggers-provider.js +12 -12
  53. package/src/ui/js/attach-css.js +1 -1
  54. package/src/ui/js/load-font-awesome.js +1 -1
  55. package/src/util/braze-actions.js +2 -2
  56. package/src/util/browser-detector.js +1 -1
  57. package/src/util/net.js +2 -2
  58. package/src/util/request-header-utils.js +12 -12
  59. 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
- tl: "ab.storage.deviceId",
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
- Dl: "ab.storage.sdk_metadata",
26
- Tl: "ab.storage.session_id_for_cached_metadata",
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
- uc: "ab.storage.globalRateLimitCurrentTokenCount",
37
- fc: "ab.storage.dynamicRateLimitCurrentTokenCount",
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
- Wn: "ab.storage.deferredIam",
54
- Jl: "ab.storage.lastSdkReq",
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
- Ue: "ab.storage.dust.mite",
60
- Ne: "ab.storage.dust.host",
61
- Te: "ab.storage.dust.auth",
62
- ze: "ab.storage.dust.expiration",
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
- pe: "ab.optOut",
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
- Sl(t) {
70
+ Al(t) {
71
71
  const e = C(STORAGE_KEYS.Ou),
72
- s = new ee.le(t);
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
- Al() {
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.wl, new Date().valueOf(), null, { e: o }));
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
- Xl(t) {
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.Va]),
197
+ const s = this.OE(t[User.Wa]),
198
198
  r = e[s];
199
199
  for (const o in t)
200
- o !== User.Va &&
200
+ o !== User.Wa &&
201
201
  (null == e[s] || (r && null == r[o])) &&
202
- this.Eu(t[User.Va], o, t[o]);
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.Va] = t)), e === User.Bu)
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.Va] = t),
233
- this.Xl(r));
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.Wc = class {
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.Xc = class {
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.le = class {
324
- constructor(t, e) {
325
- (this.tu = t),
326
- (this.DE = e),
327
- (this.tu = t),
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
- me() {
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.UE(t);
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.UE(this.mE(t));
412
+ this.vE(this.mE(t));
416
413
  }
417
- UE(t) {
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.Jc = class {
425
- constructor(t, e, s) {
421
+ (ee.Wc = class {
422
+ constructor(t, e, s, r) {
426
423
  (this.tu = t),
427
- (this.vE = []),
428
- e && this.vE.push(new ee.le(t)),
429
- s && this.vE.push(new ee.Wc(t)),
430
- this.vE.push(new ee.Xc());
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.vE.length; r++) s = this.vE[r].store(t, e) && s;
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.vE.length; e++) {
439
- const s = this.vE[e].jr(t);
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.le(this.tu).remove(t);
446
- for (let e = 0; e < this.vE.length; e++) this.vE[e].remove(t);
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.jn = {};
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.jn[i] = t), i;
9
+ return (this.vn[i] = t), i;
10
10
  }
11
11
  removeSubscription(t) {
12
- delete this.jn[t];
12
+ delete this.vn[t];
13
13
  }
14
14
  removeAllSubscriptions() {
15
- this.jn = {};
15
+ this.vn = {};
16
16
  }
17
- De() {
18
- return Object.keys(this.jn).length;
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.jn) {
23
- const r = this.jn[s];
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
- Bl: "invalid_api_key",
3
- zl: "blacklisted",
4
- jl: "no_device_identifier",
5
- Cl: "invalid_json_response",
6
- yl: "empty_response",
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
  };
@@ -18,7 +18,7 @@ export default class De {
18
18
  (this.sessionId = r),
19
19
  (this.data = e);
20
20
  }
21
- Hn() {
21
+ Jn() {
22
22
  var t;
23
23
  const s = {
24
24
  name: this.type,
@@ -2,7 +2,7 @@ export default class Jt {
2
2
  constructor(s) {
3
3
  (this.id = s), (this.id = s);
4
4
  }
5
- Hn() {
5
+ Jn() {
6
6
  const s = {};
7
7
  return (
8
8
  null != this.browser && (s.browser = this.browser),
@@ -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.Yc = l),
8
- (this.xc = h),
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.Yc = l || null),
13
- (this.xc = h || null);
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.Yc,
21
- v: this.xc,
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.kc = t),
21
- (this.Ic = i),
22
- (this.Kc = s),
23
- (this.Pc = h),
24
- (this.Oc = e),
25
- (this.xc = l),
26
- (this.Gc = r),
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.Nc = a),
28
+ (this.xc = a),
29
29
  (this.banners = o),
30
30
  (this.dust = u),
31
- (this.Hc = c),
32
- (this.kc = t),
33
- (this.Ic = i),
34
- (this.Kc = s),
35
- (this.Pc = h),
36
- (this.Oc = e),
37
- (this.xc = l),
38
- (this.Gc = r),
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.Nc = a),
40
+ (this.xc = a),
41
41
  (this.banners = o),
42
42
  (this.dust = u),
43
- (this.Hc = c);
43
+ (this.Jc = c);
44
44
  }
45
45
  gt() {
46
46
  return {
47
- s: "6.5.0",
48
- l: this.kc,
49
- e: this.Ic,
50
- a: this.Kc,
51
- p: this.Pc,
52
- m: this.Oc,
53
- v: this.xc,
54
- c: this.Gc,
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.Nc,
56
+ grl: this.xc,
57
57
  b: this.banners,
58
58
  d: this.dust,
59
- rb: this.Hc,
59
+ rb: this.Jc,
60
60
  };
61
61
  }
62
62
  static _u(t) {
63
63
  let i = t.l;
64
64
  return (
65
- "6.5.0" !== t.s && (i = 0),
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
  }