@braze/web-sdk 6.10.2 → 6.11.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 (71) hide show
  1. package/index.d.ts +28 -4
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +3 -3
  4. package/shared-lib/event-types.js +10 -10
  5. package/shared-lib/indexed-db-adapter.js +51 -51
  6. package/shared-lib/logger.js +7 -7
  7. package/shared-lib/supported-options.js +9 -9
  8. package/src/Core/logout.js +2 -2
  9. package/src/InAppMessage/constants.js +39 -47
  10. package/src/InAppMessage/display/html-message-to-html.js +1 -1
  11. package/src/InAppMessage/display/in-app-message-to-html.js +38 -36
  12. package/src/InAppMessage/in-app-message-factory.js +4 -4
  13. package/src/InAppMessage/in-app-message-manager.js +89 -68
  14. package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
  15. package/src/InAppMessage/log-in-app-message-click.js +1 -1
  16. package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
  17. package/src/InAppMessage/log-in-app-message-impression.js +1 -1
  18. package/src/InAppMessage/models/full-screen-message.js +22 -22
  19. package/src/InAppMessage/models/html-message.js +13 -13
  20. package/src/InAppMessage/models/in-app-message-button.js +2 -2
  21. package/src/InAppMessage/models/in-app-message.js +68 -66
  22. package/src/InAppMessage/models/modal-message.js +20 -20
  23. package/src/InAppMessage/models/slide-up-message.js +25 -25
  24. package/src/InAppMessage/models/templated-in-app-message.js +6 -6
  25. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  26. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  27. package/src/InAppMessage/ui/show-in-app-message.js +27 -25
  28. package/src/Push/index.js +1 -0
  29. package/src/Push/push-manager-factory.js +4 -4
  30. package/src/Push/push-manager.js +222 -179
  31. package/src/Push/register-push.js +9 -0
  32. package/src/Push/unregister-push-token-on-server.js +4 -4
  33. package/src/Push/utils/push-utils.js +8 -8
  34. package/src/User/user-manager.js +19 -19
  35. package/src/User/user.js +35 -35
  36. package/src/common/constants.js +1 -1
  37. package/src/common/content-cards-display.js +5 -5
  38. package/src/l10n/l10n-manager-factory.js +1 -1
  39. package/src/l10n/l10n-manager.js +1 -1
  40. package/src/managers/braze-instance.js +42 -38
  41. package/src/managers/device-manager.js +20 -20
  42. package/src/managers/network-manager.js +122 -122
  43. package/src/managers/server-config-manager.js +76 -76
  44. package/src/managers/session-manager.js +8 -8
  45. package/src/managers/storage-manager.js +127 -127
  46. package/src/managers/utils.js +1 -1
  47. package/src/models/backend-errors.js +5 -5
  48. package/src/models/braze-event.js +2 -2
  49. package/src/models/device.js +3 -3
  50. package/src/models/identifier.js +6 -6
  51. package/src/models/push-token.js +6 -6
  52. package/src/models/server-config.js +24 -24
  53. package/src/request-controller.js +85 -85
  54. package/src/triggers/models/trigger-condition.js +27 -27
  55. package/src/triggers/models/trigger.js +2 -2
  56. package/src/triggers/triggers-provider-factory.js +1 -1
  57. package/src/triggers/triggers-provider.js +37 -29
  58. package/src/types.js +2 -2
  59. package/src/ui/js/attach-css.js +1 -1
  60. package/src/util/base-device-parser.js +1 -1
  61. package/src/util/braze-actions.js +4 -4
  62. package/src/util/browser-detector.js +5 -5
  63. package/src/util/client-hints-parser.js +1 -1
  64. package/src/util/dom-utils.js +2 -2
  65. package/src/util/ecommerce-event-validation.js +1 -1
  66. package/src/util/key-codes.js +1 -1
  67. package/src/util/net.js +3 -3
  68. package/src/util/request-header-utils.js +15 -15
  69. package/src/util/user-agent-parser.js +4 -4
  70. package/src/util/validation-utils.js +5 -5
  71. package/src/util/window-utils.js +2 -2
@@ -13,31 +13,31 @@ export default class Yt {
13
13
  constructor(t) {
14
14
  (this.j = t),
15
15
  (this.j = t),
16
- (this._l = new f()),
17
16
  (this.Vl = new f()),
18
- (this.Jl = new f()),
19
17
  (this.Ql = new f()),
20
- (this.Wl = new f()),
21
- (this.Yl = new f()),
22
- (this.Zl = null),
23
- (this.ed = null);
24
- }
25
- sd() {
26
- if (null == this.ed) {
27
- const t = this.j.St(s.It.nd);
28
- this.ed = null != t ? di._u(t) : new di();
18
+ (this.Zl = new f()),
19
+ (this.ed = new f()),
20
+ (this.sd = new f()),
21
+ (this.nd = new f()),
22
+ (this.ld = null),
23
+ (this.ud = null);
24
+ }
25
+ ad() {
26
+ if (null == this.ud) {
27
+ const t = this.j.St(s.It.hd);
28
+ this.ud = null != t ? di._u(t) : new di();
29
29
  }
30
- return this.ed;
30
+ return this.ud;
31
31
  }
32
32
  Qt() {
33
- return this.sd().ld;
33
+ return this.ad().dd;
34
34
  }
35
- ud(t) {
35
+ vd(t) {
36
36
  var i, e, n, l, r, o;
37
37
  if (null != t && null != t.config) {
38
38
  const u = t.config;
39
- if (u.time > this.sd().ld) {
40
- const t = (t) => (null == t ? this.sd().ad : t),
39
+ if (u.time > this.ad().dd) {
40
+ const t = (t) => (null == t ? this.ad().md : t),
41
41
  a = new di(
42
42
  u.time,
43
43
  u.events_blacklist,
@@ -55,9 +55,9 @@ export default class Yt {
55
55
  u.conversational_chat,
56
56
  );
57
57
  let h = !1;
58
- null != a.hd && this.ju() !== a.hd && (h = !0);
58
+ null != a.gd && this.Wu() !== a.gd && (h = !0);
59
59
  let d = !1;
60
- null != a.dd.enabled && this.Pi() !== a.dd.enabled && (d = !0);
60
+ null != a.bd.enabled && this.Pi() !== a.bd.enabled && (d = !0);
61
61
  let c = !1;
62
62
  null != a.Xr.enabled && this.lo() !== a.Xr.enabled && (c = !0);
63
63
  let v = !1;
@@ -72,105 +72,105 @@ export default class Yt {
72
72
  (null === (l = a.dust) || void 0 === l ? void 0 : l.enabled) &&
73
73
  (m = !0);
74
74
  let g = !1;
75
- null != (null === (r = a.vd) || void 0 === r ? void 0 : r.enabled) &&
76
- this.md() !==
77
- (null === (o = a.vd) || void 0 === o ? void 0 : o.enabled) &&
75
+ null != (null === (r = a.fd) || void 0 === r ? void 0 : r.enabled) &&
76
+ this.pd() !==
77
+ (null === (o = a.fd) || void 0 === o ? void 0 : o.enabled) &&
78
78
  (g = !0),
79
- (this.ed = a),
80
- this.j.Pt(s.It.nd, a.qt()),
81
- h && this._l.A(),
82
- d && this.Vl.A(),
83
- c && this.Jl.A(),
84
- v && this.Ql.A(),
85
- m && this.Wl.A(),
86
- g && this.Yl.A();
79
+ (this.ud = a),
80
+ this.j.Pt(s.It.hd, a.qt()),
81
+ h && this.Vl.A(),
82
+ d && this.Ql.A(),
83
+ c && this.Zl.A(),
84
+ v && this.ed.A(),
85
+ m && this.sd.A(),
86
+ g && this.nd.A();
87
87
  }
88
88
  }
89
89
  }
90
- xu(t) {
91
- const i = this._l.Ut(t);
92
- return this.Zl && this._l.removeSubscription(this.Zl), (this.Zl = i), i;
90
+ ju(t) {
91
+ const i = this.Vl.Ut(t);
92
+ return this.ld && this.Vl.removeSubscription(this.ld), (this.ld = i), i;
93
93
  }
94
94
  $i(t) {
95
- return this.Vl.Ut(t);
95
+ return this.Ql.Ut(t);
96
96
  }
97
97
  bo(t) {
98
- return this.Jl.Ut(t);
98
+ return this.Zl.Ut(t);
99
99
  }
100
100
  V(t) {
101
- return this.Ql.Ut(t);
101
+ return this.ed.Ut(t);
102
102
  }
103
103
  Tr(t) {
104
- return this.Wl.Ut(t);
104
+ return this.sd.Ut(t);
105
105
  }
106
- gd(t) {
107
- return this.Yl.Ut(t);
106
+ Rd(t) {
107
+ return this.nd.Ut(t);
108
108
  }
109
109
  $e(t) {
110
- return -1 !== this.sd().bd.indexOf(t);
110
+ return -1 !== this.ad().Cd.indexOf(t);
111
111
  }
112
- qu(t) {
113
- return -1 !== this.sd().fd.indexOf(t);
112
+ zu(t) {
113
+ return -1 !== this.ad().Ed.indexOf(t);
114
114
  }
115
115
  $r(t) {
116
- return -1 !== this.sd().pd.indexOf(t);
116
+ return -1 !== this.ad().wd.indexOf(t);
117
117
  }
118
- Rd() {
119
- return this.sd().Cd;
118
+ Bd() {
119
+ return this.ad().Td;
120
120
  }
121
- ju() {
122
- return this.sd().hd;
121
+ Wu() {
122
+ return this.ad().gd;
123
123
  }
124
124
  Pi() {
125
- return this.sd().dd.enabled || !1;
125
+ return this.ad().bd.enabled || !1;
126
126
  }
127
- Ed() {
128
- const t = this.sd().ad;
127
+ yd() {
128
+ const t = this.ad().md;
129
129
  return !(!t || null == t.enabled) && t.enabled;
130
130
  }
131
- xl() {
132
- if (!this.Ed()) return -1;
133
- const t = this.sd().ad;
131
+ _l() {
132
+ if (!this.yd()) return -1;
133
+ const t = this.ad().md;
134
134
  return null == t.capacity || t.capacity < 10 ? -1 : t.capacity;
135
135
  }
136
- Hl() {
137
- if (!this.Ed()) return -1;
138
- const t = this.sd().ad;
136
+ Wl() {
137
+ if (!this.yd()) return -1;
138
+ const t = this.ad().md;
139
139
  return null == t.refill_rate || t.refill_rate <= 0 ? -1 : t.refill_rate;
140
140
  }
141
- wd(t) {
142
- const i = this.sd().ad.endpoint_overrides;
141
+ Md(t) {
142
+ const i = this.ad().md.endpoint_overrides;
143
143
  return null == i ? null : i[t];
144
144
  }
145
- Ol(t) {
146
- const i = this.wd(t);
145
+ Yl(t) {
146
+ const i = this.Md(t);
147
147
  return null == i || isNaN(i.capacity) || i.capacity <= 0 ? -1 : i.capacity;
148
148
  }
149
- Gl(t) {
150
- const i = this.wd(t);
149
+ Jl(t) {
150
+ const i = this.Md(t);
151
151
  return null == i || isNaN(i.refill_rate) || i.refill_rate <= 0
152
152
  ? -1
153
153
  : i.refill_rate;
154
154
  }
155
155
  lo() {
156
- return this.sd().Xr.enabled && null == this.Ro()
157
- ? (v.Dt(p.Qa, { e: "Missing feature flag refresh_rate_limit." }), !1)
158
- : this.sd().Xr.enabled || !1;
156
+ return this.ad().Xr.enabled && null == this.Ro()
157
+ ? (v.Dt(p.fl, { e: "Missing feature flag refresh_rate_limit." }), !1)
158
+ : this.ad().Xr.enabled || !1;
159
159
  }
160
160
  Ro() {
161
- return this.sd().Xr.refresh_rate_limit;
161
+ return this.ad().Xr.refresh_rate_limit;
162
162
  }
163
163
  Ot() {
164
164
  var t;
165
165
  return (
166
- (null === (t = this.sd().banners) || void 0 === t ? void 0 : t.enabled) ||
166
+ (null === (t = this.ad().banners) || void 0 === t ? void 0 : t.enabled) ||
167
167
  null
168
168
  );
169
169
  }
170
170
  re() {
171
171
  var t;
172
172
  return (
173
- (null === (t = this.sd().banners) || void 0 === t
173
+ (null === (t = this.ad().banners) || void 0 === t
174
174
  ? void 0
175
175
  : t.max_placements) || 0
176
176
  );
@@ -178,7 +178,7 @@ export default class Yt {
178
178
  Gt() {
179
179
  var t;
180
180
  const i =
181
- null === (t = this.sd().banners) || void 0 === t
181
+ null === (t = this.ad().banners) || void 0 === t
182
182
  ? void 0
183
183
  : t.dismissals_cache_size;
184
184
  return null != i && "number" == typeof i && i > 0 ? i : u;
@@ -186,19 +186,19 @@ export default class Yt {
186
186
  fn() {
187
187
  var t;
188
188
  return (
189
- (null === (t = this.sd().dust) || void 0 === t ? void 0 : t.enabled) || !1
189
+ (null === (t = this.ad().dust) || void 0 === t ? void 0 : t.enabled) || !1
190
190
  );
191
191
  }
192
- md() {
192
+ pd() {
193
193
  var t;
194
194
  return (
195
- (null === (t = this.sd().vd) || void 0 === t ? void 0 : t.enabled) || !1
195
+ (null === (t = this.ad().fd) || void 0 === t ? void 0 : t.enabled) || !1
196
196
  );
197
197
  }
198
198
  vt() {
199
199
  var t;
200
200
  const i =
201
- null === (t = this.sd().Bd) || void 0 === t
201
+ null === (t = this.ad().Sd) || void 0 === t
202
202
  ? void 0
203
203
  : t.min_sleep_duration_ms;
204
204
  return null != i ? i : d;
@@ -206,18 +206,18 @@ export default class Yt {
206
206
  gt() {
207
207
  var t;
208
208
  const i =
209
- null === (t = this.sd().Bd) || void 0 === t ? void 0 : t.scale_factor;
209
+ null === (t = this.ad().Sd) || void 0 === t ? void 0 : t.scale_factor;
210
210
  return null != i ? i : m;
211
211
  }
212
212
  bt() {
213
213
  var t;
214
214
  const i =
215
- null === (t = this.sd().Bd) || void 0 === t
215
+ null === (t = this.ad().Sd) || void 0 === t
216
216
  ? void 0
217
217
  : t.max_sleep_duration_ms;
218
218
  return null != i ? i : c;
219
219
  }
220
- Td() {
221
- return this.sd().yd;
220
+ Fd() {
221
+ return this.ad().Ld;
222
222
  }
223
223
  }
@@ -17,7 +17,7 @@ export default class Xt {
17
17
  (this.j = s),
18
18
  (this.Ss = t),
19
19
  (this.h = i);
20
- const n = this.h.Td();
20
+ const n = this.h.Fd();
21
21
  (this.im = n ? 1e3 * n : ts),
22
22
  (null == e || isNaN(e)) && (e = 1800),
23
23
  e < this.im / 1e3 &&
@@ -31,18 +31,18 @@ export default class Xt {
31
31
  (this.tm = Math.max(e, this.im / 1e3));
32
32
  }
33
33
  nm(s, t) {
34
- return new Ie(this.Ss.getUserId(), p.hm, s, t.Tu, { d: X(s - t.lm) });
34
+ return new Ie(this.Ss.getUserId(), p.hm, s, t.Iu, { d: X(s - t.lm) });
35
35
  }
36
36
  al() {
37
37
  return this.j.$u(s.Ou.um);
38
38
  }
39
39
  $t() {
40
40
  const t = this.j.$u(s.Ou.um);
41
- return null == t ? null : t.Tu;
41
+ return null == t ? null : t.Iu;
42
42
  }
43
43
  am() {
44
44
  const t = new Date().valueOf(),
45
- i = this.h.Rd();
45
+ i = this.h.Bd();
46
46
  if (null == i) return !1;
47
47
  const e = this.j.St(s.It.dm),
48
48
  n = null == e || t - e > 1e3 * i;
@@ -65,11 +65,11 @@ export default class Xt {
65
65
  }
66
66
  (n += ". Will expire " + i.valueOf()), b.info(n);
67
67
  const r = new _t(V.de(), i);
68
- this.j.gm(new Ie(this.Ss.getUserId(), p.wm, t, r.Tu)),
69
- this.j.Iu(s.Ou.um, r);
70
- return null == this.j.St(s.It.dm) && this.j.Pt(s.It.dm, t), r.Tu;
68
+ this.j.gm(new Ie(this.Ss.getUserId(), p.wm, t, r.Iu)),
69
+ this.j.Ju(s.Ou.um, r);
70
+ return null == this.j.St(s.It.dm) && this.j.Pt(s.It.dm, t), r.Iu;
71
71
  }
72
- if (null != e) return (e.pm = t), (e.fm = i), this.j.Iu(s.Ou.um, e), e.Tu;
72
+ if (null != e) return (e.pm = t), (e.fm = i), this.j.Ju(s.Ou.um, e), e.Iu;
73
73
  }
74
74
  Sm() {
75
75
  const t = this.j.$u(s.Ou.um);