@braze/web-sdk 5.3.2 → 5.5.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 (96) hide show
  1. package/index.d.ts +20 -4
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +12 -12
  4. package/shared-lib/indexed-db-adapter.js +14 -14
  5. package/shared-lib/logger.js +2 -2
  6. package/shared-lib/supported-options.js +10 -9
  7. package/src/Card/card-manager.js +46 -42
  8. package/src/Card/display/card-display.js +59 -58
  9. package/src/Card/models/card.js +61 -55
  10. package/src/Card/models/classic-card.js +1 -1
  11. package/src/Card/models/control-card.js +1 -1
  12. package/src/Card/models/image-only.js +1 -1
  13. package/src/Card/util/card-factory.js +20 -20
  14. package/src/ContentCards/content-cards-provider.js +140 -140
  15. package/src/ContentCards/get-cached-content-cards.js +1 -1
  16. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  17. package/src/ContentCards/subscribe-to-content-cards-updates.js +4 -4
  18. package/src/ContentCards/ui/show-content-cards.js +3 -3
  19. package/src/Core/disable-sdk.js +2 -2
  20. package/src/Core/enable-sdk.js +2 -2
  21. package/src/Core/index.js +1 -0
  22. package/src/Core/is-initialized.js +4 -0
  23. package/src/Core/log-custom-event.js +14 -14
  24. package/src/Core/log-purchase.js +8 -8
  25. package/src/Core/open-session.js +4 -4
  26. package/src/Core/wipe-data.js +2 -2
  27. package/src/FeatureFlags/feature-flag-factory.js +5 -5
  28. package/src/FeatureFlags/feature-flag.js +1 -1
  29. package/src/FeatureFlags/feature-flags-provider.js +74 -74
  30. package/src/FeatureFlags/get-all-feature-flags.js +2 -2
  31. package/src/FeatureFlags/get-feature-flag.js +2 -2
  32. package/src/FeatureFlags/log-feature-flag-impression.js +12 -12
  33. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
  34. package/src/Feed/feed-provider.js +29 -29
  35. package/src/Feed/get-cached-feed.js +1 -1
  36. package/src/Feed/request-feed-refresh.js +1 -1
  37. package/src/Feed/subscribe-to-feed-updates.js +1 -1
  38. package/src/Feed/ui/show-feed.js +1 -1
  39. package/src/InAppMessage/display/in-app-message-to-html.js +64 -62
  40. package/src/InAppMessage/in-app-message-manager.js +63 -63
  41. package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
  42. package/src/InAppMessage/log-in-app-message-click.js +2 -2
  43. package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
  44. package/src/InAppMessage/log-in-app-message-impression.js +1 -1
  45. package/src/InAppMessage/models/full-screen-message.js +10 -10
  46. package/src/InAppMessage/models/html-message.js +13 -13
  47. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  48. package/src/InAppMessage/models/in-app-message.js +59 -59
  49. package/src/InAppMessage/models/modal-message.js +9 -9
  50. package/src/InAppMessage/models/slide-up-message.js +11 -11
  51. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  52. package/src/InAppMessage/ui/show-in-app-message.js +42 -40
  53. package/src/Push/push-manager-factory.js +5 -4
  54. package/src/Push/push-manager.js +77 -89
  55. package/src/Push/utils/push-utils.js +4 -4
  56. package/src/User/user-manager.js +8 -8
  57. package/src/User/user.js +29 -29
  58. package/src/common/base-provider.js +1 -1
  59. package/src/common/event-logger.js +11 -11
  60. package/src/common/feed-display.js +18 -17
  61. package/src/l10n/l10n-manager-factory.js +7 -7
  62. package/src/l10n/l10n-manager.js +15 -5
  63. package/src/managers/auth-manager.js +9 -9
  64. package/src/managers/braze-instance.js +89 -87
  65. package/src/managers/device-manager.js +17 -17
  66. package/src/managers/network-manager.js +130 -130
  67. package/src/managers/server-config-manager.js +24 -24
  68. package/src/managers/session-manager.js +12 -12
  69. package/src/managers/storage-manager-factory.js +1 -1
  70. package/src/managers/storage-manager.js +31 -31
  71. package/src/managers/subscription-manager.js +2 -2
  72. package/src/models/backend-errors.js +5 -5
  73. package/src/models/braze-event.js +4 -4
  74. package/src/models/device.js +2 -2
  75. package/src/models/request-result.js +1 -1
  76. package/src/models/server-config.js +5 -5
  77. package/src/request-controller.js +130 -130
  78. package/src/triggers/models/filter.js +9 -9
  79. package/src/triggers/models/in-app-message-click-data.js +8 -8
  80. package/src/triggers/models/push-click-data.js +3 -3
  81. package/src/triggers/models/trigger-condition.js +27 -27
  82. package/src/triggers/models/trigger-events.js +1 -1
  83. package/src/triggers/models/trigger.js +7 -7
  84. package/src/triggers/triggers-provider.js +29 -29
  85. package/src/ui/js/attach-css.js +1 -1
  86. package/src/ui/js/feed-css.js +1 -1
  87. package/src/ui/js/iam-css.js +1 -1
  88. package/src/util/base-device-parser.js +7 -7
  89. package/src/util/braze-actions.js +4 -4
  90. package/src/util/browser-detector.js +21 -21
  91. package/src/util/client-hints-parser.js +3 -3
  92. package/src/util/component-utils.js +13 -12
  93. package/src/util/net.js +4 -4
  94. package/src/util/request-header-utils.js +17 -17
  95. package/src/util/user-agent-parser.js +3 -3
  96. package/src/util/window-utils.js +1 -1
@@ -1,98 +1,98 @@
1
1
  import Xt from "../models/backend-errors.js";
2
- import ue from "../models/braze-event.js";
2
+ import ve from "../models/braze-event.js";
3
3
  import {
4
4
  convertMsToSeconds as h,
5
5
  convertSecondsToMs as Kt,
6
6
  } from "../util/date-utils.js";
7
- import s from "../common/event-logger.js";
7
+ import t from "../common/event-logger.js";
8
8
  import { isArray as j, isEqual as ii } from "../util/code-utils.js";
9
9
  import { logger as r, EventTypes as i } from "../../shared-lib/index.js";
10
10
  import { STORAGE_KEYS as o } from "./storage-manager.js";
11
11
  import D from "../util/request-header-utils.js";
12
12
  import { LAST_REQUEST_TO_ENDPOINT_MS_AGO_DEFAULT as Ht } from "../common/constants.js";
13
13
  import { getAlias as Yt } from "./utils.js";
14
- export default class Rt {
14
+ export default class Pt {
15
15
  constructor(t, e, i, s, r, n, o, h, a, u, l, c) {
16
16
  (this.on = t),
17
17
  (this.u = e),
18
- (this.zo = i),
19
- (this.wt = s),
20
- (this.ri = r),
21
- (this.yt = n),
18
+ (this.Ko = i),
19
+ (this.yt = s),
20
+ (this.oi = r),
21
+ (this.qt = n),
22
22
  (this.rn = o),
23
23
  (this.Go = h),
24
- (this.Wo = a),
24
+ (this.Bo = a),
25
25
  (this.Vo = u),
26
26
  (this.appVersion = l),
27
27
  (this.Xh = c),
28
- (this.$h = (t) => (null == t ? "" : `${t} `)),
28
+ (this.Hh = (t) => (null == t ? "" : `${t} `)),
29
29
  (this.on = t),
30
30
  (this.u = e),
31
- (this.zo = i),
32
- (this.wt = s),
33
- (this.ri = r),
34
- (this.yt = n),
31
+ (this.Ko = i),
32
+ (this.yt = s),
33
+ (this.oi = r),
34
+ (this.qt = n),
35
35
  (this.rn = o),
36
36
  (this.Go = h),
37
- (this.Wo = a),
37
+ (this.Bo = a),
38
38
  (this.Vo = u),
39
39
  (this.appVersion = l),
40
40
  (this.Xh = c),
41
- (this.Hh = ["npm"]);
41
+ (this.Yh = ["npm"]);
42
42
  }
43
- Js(t, e = !1, i = !1) {
43
+ $s(t, e = !1, i = !1) {
44
44
  const s = this.on.ce(!i),
45
- r = s.Zi(),
46
- n = this.u.j(o.C.Ca);
45
+ r = s.Mr(),
46
+ n = this.u.j(o.C.Fa);
47
47
  ii(n, r) || (t.device = r),
48
48
  (t.api_key = this.rn),
49
49
  (t.time = h(new Date().valueOf(), !0));
50
- const a = this.u.j(o.C.Yh) || [],
51
- u = this.u.j(o.C.Jh) || "";
50
+ const a = this.u.j(o.C.Jh) || [],
51
+ u = this.u.j(o.C.Qh) || "";
52
52
  if (
53
- (this.Hh.length > 0 &&
54
- (!ii(a, this.Hh) || u !== this.ri.Si()) &&
55
- (t.sdk_metadata = this.Hh),
56
- (t.sdk_version = this.Wo),
53
+ (this.Yh.length > 0 &&
54
+ (!ii(a, this.Yh) || u !== this.oi.xi()) &&
55
+ (t.sdk_metadata = this.Yh),
56
+ (t.sdk_version = this.Bo),
57
57
  this.Vo && (t.sdk_flavor = this.Vo),
58
58
  (t.app_version = this.appVersion),
59
59
  (t.app_version_code = this.Xh),
60
60
  (t.device_id = s.id),
61
61
  e)
62
62
  ) {
63
- const e = this.wt.getUserId();
63
+ const e = this.yt.getUserId();
64
64
  null != e && (t.user_id = e);
65
65
  }
66
- if (!t.user_id && !this.zo.Fh()) {
66
+ if (!t.user_id && !this.Ko.Fh()) {
67
67
  const e = Yt(this.u);
68
68
  e && (t.alias = e);
69
69
  }
70
70
  return t;
71
71
  }
72
- Ks(t, e, n) {
73
- const o = e.auth_error,
74
- h = e.error;
72
+ Qs(e, s, n) {
73
+ const o = s.auth_error,
74
+ h = s.error;
75
75
  if (!o && !h) return !0;
76
76
  if (o) {
77
- let e;
78
- this.zo.Bh();
77
+ let t;
78
+ this.Ko.Bh();
79
79
  const i = { errorCode: o.error_code };
80
80
  for (const t of n)
81
81
  j(t) && "X-Braze-Auth-Signature" === t[0] && (i.signature = t[1]);
82
- t.respond_with && t.respond_with.user_id
83
- ? (i.userId = t.respond_with.user_id)
84
- : t.user_id && (i.userId = t.user_id);
82
+ e.respond_with && e.respond_with.user_id
83
+ ? (i.userId = e.respond_with.user_id)
84
+ : e.user_id && (i.userId = e.user_id);
85
85
  const s = o.reason;
86
86
  return (
87
87
  s
88
- ? ((i.reason = s), (e = `due to ${s}`))
89
- : (e = `with error code ${o.error_code}.`),
90
- this.zo.Fh() ||
91
- (e +=
88
+ ? ((i.reason = s), (t = `due to ${s}`))
89
+ : (t = `with error code ${o.error_code}.`),
90
+ this.Ko.Fh() ||
91
+ (t +=
92
92
  ' Please use the "enableSdkAuthentication" initialization option to enable authentication.'),
93
- r.error(`SDK Authentication failed ${e}`),
94
- this.Qh(t.events || [], t.attributes || []),
95
- this.zo.qh(i),
93
+ r.error(`SDK Authentication failed ${t}`),
94
+ this.Zh(e.events || [], e.attributes || []),
95
+ this.Ko.qh(i),
96
96
  !1
97
97
  );
98
98
  }
@@ -100,42 +100,42 @@ export default class Rt {
100
100
  let n,
101
101
  o = h;
102
102
  switch (o) {
103
- case Xt.Zh:
103
+ case Xt.Ra:
104
104
  return (
105
105
  (n = "Received successful response with empty body."),
106
- s.q(i.qs, { e: n }),
106
+ t.q(i.Ls, { e: n }),
107
107
  r.info(n),
108
108
  !1
109
109
  );
110
- case Xt.Ra:
110
+ case Xt.Ba:
111
111
  return (
112
112
  (n = "Received successful response with invalid JSON"),
113
- s.q(i.qs, { e: n + ": " + e.response }),
113
+ t.q(i.Ls, { e: n + ": " + s.response }),
114
114
  r.info(n),
115
115
  !1
116
116
  );
117
- case Xt.qa:
118
- o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Go}`;
117
+ case Xt.Na:
118
+ o = `The API key "${e.api_key}" is invalid for the baseUrl ${this.Go}`;
119
119
  break;
120
- case Xt.Aa:
120
+ case Xt.Xa:
121
121
  o =
122
122
  "Sorry, we are not currently accepting your requests. If you think this is in error, please contact us.";
123
123
  break;
124
- case Xt.Ba:
124
+ case Xt.$a:
125
125
  o = "No device identifier. Please contact support@braze.com";
126
126
  }
127
127
  r.error("Backend error: " + o);
128
128
  }
129
129
  return !1;
130
130
  }
131
- Na(t, e, i, s) {
131
+ La(t, e, i, s) {
132
132
  return !!((t && 0 !== t.length) || (e && 0 !== e.length) || i || s);
133
133
  }
134
- Xa(t, e, i, s, r = !1) {
134
+ Ea(t, e, i, s, r = !1) {
135
135
  const n = [],
136
136
  o = (t) => t || "",
137
- h = o(this.wt.getUserId());
138
- let a = this.Yi(t, e);
137
+ h = o(this.yt.getUserId());
138
+ let a = this.Ir(t, e);
139
139
  const u = [],
140
140
  l = [];
141
141
  let c,
@@ -143,7 +143,7 @@ export default class Rt {
143
143
  if (i.length > 0) {
144
144
  const t = [];
145
145
  for (const e of i) {
146
- if (((c = e.Zi()), this.zo.Fh())) {
146
+ if (((c = e.Mr()), this.Ko.Fh())) {
147
147
  if (h && !c.user_id) {
148
148
  d || (d = {}), d.events || (d.events = []), d.events.push(c);
149
149
  continue;
@@ -160,60 +160,60 @@ export default class Rt {
160
160
  if (s.length > 0) {
161
161
  const t = [];
162
162
  for (const e of s)
163
- e && (this.zo.Fh() && o(e.user_id) !== h ? u.push(e) : t.push(e));
163
+ e && (this.Ko.Fh() && o(e.user_id) !== h ? u.push(e) : t.push(e));
164
164
  t.length > 0 && (a.attributes = t);
165
165
  }
166
- if ((this.Qh(l, u), (a = this.Js(a, !0, r)), d)) {
167
- d = this.Js(d, !1, r);
168
- const t = { requestData: d, headers: this.$s(d, D.Ps.$a) };
166
+ if ((this.Zh(l, u), (a = this.$s(a, !0, r)), d)) {
167
+ d = this.$s(d, !1, r);
168
+ const t = { requestData: d, headers: this.Ps(d, D._s.Ka) };
169
169
  n.push(t);
170
170
  }
171
- if (a && !this.Na(a.events, a.attributes, t, e)) return d ? n : null;
172
- const f = { requestData: a, headers: this.$s(a, D.Ps.$a) };
171
+ if (a && !this.La(a.events, a.attributes, t, e)) return d ? n : null;
172
+ const f = { requestData: a, headers: this.Ps(a, D._s.Ka) };
173
173
  return n.push(f), n;
174
174
  }
175
- Qh(t, e) {
175
+ Zh(t, e) {
176
176
  if (t) {
177
177
  const e = [];
178
178
  for (const i of t) {
179
- const t = ue.fromJson(i);
179
+ const t = ve.fromJson(i);
180
180
  (t.time = Kt(t.time)), e.push(t);
181
181
  }
182
- this.u.xo(e);
182
+ this.u.zo(e);
183
183
  }
184
- if (e) for (const t of e) this.u.La(t);
184
+ if (e) for (const t of e) this.u.Pa(t);
185
185
  }
186
- Vs(t, e) {
186
+ Ys(t, e) {
187
187
  let i = "HTTP error ";
188
188
  null != t && (i += t + " "), (i += e), r.error(i);
189
189
  }
190
- qr(t) {
191
- return s.q(i.Ea, { n: t });
190
+ qr(e) {
191
+ return t.q(i.Ua, { n: e });
192
192
  }
193
- Yi(t, e, i) {
193
+ Ir(t, e, i) {
194
194
  const s = {};
195
195
  t && (s.feed = !0), e && (s.triggers = !0);
196
- const r = null != i ? i : this.wt.getUserId();
197
- if ((r && (s.user_id = r), !s.user_id && !this.zo.Fh())) {
196
+ const r = null != i ? i : this.yt.getUserId();
197
+ if ((r && (s.user_id = r), !s.user_id && !this.Ko.Fh())) {
198
198
  const t = Yt(this.u);
199
199
  t && (s.alias = t);
200
200
  }
201
- return (s.config = { config_time: this.yt.ii() }), { respond_with: s };
201
+ return (s.config = { config_time: this.qt.hi() }), { respond_with: s };
202
202
  }
203
- Ka(t) {
203
+ Ha(t) {
204
204
  const e = new Date().valueOf();
205
205
  let i = Ht.toString();
206
- const s = D.Pa(this.u, t);
206
+ const s = D.Wa(this.u, t);
207
207
  if (-1 !== s) {
208
208
  i = (e - s).toString();
209
209
  }
210
210
  return i;
211
211
  }
212
- $s(t, e, i = !1) {
212
+ Ps(t, e, i = !1) {
213
213
  const s = [["X-Braze-Api-Key", this.rn]],
214
- r = this.Ka(e);
214
+ r = this.Ha(e);
215
215
  s.push(["X-Braze-Last-Req-Ms-Ago", r]);
216
- const n = D.Ua(this.u, e).toString();
216
+ const n = D.Ya(this.u, e).toString();
217
217
  s.push(["X-Braze-Req-Attempt", n]);
218
218
  let h = !1;
219
219
  if (
@@ -223,95 +223,95 @@ export default class Rt {
223
223
  null != t.respond_with &&
224
224
  t.respond_with.feed &&
225
225
  (s.push(["X-Braze-FeedRequest", "true"]), (h = !0)),
226
- e === D.Ps.Bs)
226
+ e === D._s.Xs)
227
227
  ) {
228
228
  s.push(["X-Braze-ContentCardsRequest", "true"]);
229
- let t = this.u.j(o.C.As);
230
- (t && i) || ((t = 0), this.u.k(o.C.As, t)),
229
+ let t = this.u.j(o.C.xs);
230
+ (t && i) || ((t = 0), this.u.I(o.C.xs, t)),
231
231
  s.push(["BRAZE-SYNC-RETRY-COUNT", t.toString()]),
232
232
  (h = !0);
233
233
  }
234
234
  if (
235
- (e === D.Ps.bi &&
235
+ (e === D._s.Ri &&
236
236
  (s.push(["X-Braze-FeatureFlagsRequest", "true"]), (h = !0)),
237
237
  h && s.push(["X-Braze-DataRequest", "true"]),
238
- this.zo.Fh())
238
+ this.Ko.Fh())
239
239
  ) {
240
- const t = this.zo.kh();
240
+ const t = this.Ko.kh();
241
241
  null != t && s.push(["X-Braze-Auth-Signature", t]);
242
242
  }
243
243
  return s;
244
244
  }
245
- Ga(t, e, i, s) {
245
+ Ja(t, e, i, s) {
246
246
  window.setTimeout(() => {
247
- r.info(`Retrying rate limited ${this.$h(s)}SDK request.`),
248
- this.Xs(e, i, s);
247
+ r.info(`Retrying rate limited ${this.Hh(s)}SDK request.`),
248
+ this.Gs(e, i, s);
249
249
  }, t);
250
250
  }
251
- Xs(t, e, i, s) {
252
- if (!this.Ha(i))
251
+ Gs(t, e, i, s) {
252
+ if (!this.Qa(i))
253
253
  return (
254
- r.info(`${this.$h(i)}SDK request being rate limited.`),
254
+ r.info(`${this.Hh(i)}SDK request being rate limited.`),
255
255
  void ("function" == typeof s && s())
256
256
  );
257
- const n = this.Wa();
258
- if (!n.Ya)
257
+ const n = this.Va();
258
+ if (!n.Za)
259
259
  return (
260
260
  r.info(
261
- `${this.$h(
261
+ `${this.Hh(
262
262
  i,
263
263
  )}SDK request being rate limited. Request will be retried in ${Math.trunc(
264
- n.Ja / 1e3,
264
+ n.au / 1e3,
265
265
  )} seconds.`,
266
266
  ),
267
- void this.Ga(n.Ja, t, e, i)
267
+ void this.Ja(n.au, t, e, i)
268
268
  );
269
- this.u.k(o.C.Qa, new Date().valueOf());
269
+ this.u.I(o.C.du, new Date().valueOf());
270
270
  const h = t.device;
271
271
  h && h.os_version instanceof Promise
272
272
  ? h.os_version.then((i) => {
273
- (t.device.os_version = i), e(n.Va);
273
+ (t.device.os_version = i), e(n.fu);
274
274
  })
275
- : e(n.Va);
275
+ : e(n.fu);
276
276
  }
277
- Za(t) {
277
+ vu(t) {
278
278
  var e;
279
- null === (e = this.u) || void 0 === e || e.k(o.C.au, t);
279
+ null === (e = this.u) || void 0 === e || e.I(o.C.Ru, t);
280
280
  }
281
- du(t, e) {
282
- let i = this.fu();
283
- null == i && (i = {}), (i[t] = e), this.u.k(o.C.vu, i);
281
+ gu(t, e) {
282
+ let i = this.pu();
283
+ null == i && (i = {}), (i[t] = e), this.u.I(o.C.bu, i);
284
284
  }
285
- Ru() {
285
+ qu() {
286
286
  var t;
287
- return null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.au);
287
+ return null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.Ru);
288
288
  }
289
- fu() {
289
+ pu() {
290
290
  var t;
291
- return null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.vu);
291
+ return null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.bu);
292
292
  }
293
- gu(t, e, i, s, r = "") {
293
+ Au(t, e, i, s, r = "") {
294
294
  let n;
295
295
  if (r) {
296
- const t = this.fu();
296
+ const t = this.pu();
297
297
  n = null == t || isNaN(t[r]) ? e : t[r];
298
- } else (n = this.Ru()), (null == n || isNaN(n)) && (n = e);
298
+ } else (n = this.qu()), (null == n || isNaN(n)) && (n = e);
299
299
  const o = (t - s) / 1e3;
300
300
  return (n = Math.min(n + o / i, e)), n;
301
301
  }
302
- pu(t, e) {
302
+ Du(t, e) {
303
303
  return Math.max(0, (1 - t) * e * 1e3);
304
304
  }
305
- bu(t, e = "") {
305
+ Tu(t, e = "") {
306
306
  var i, s, r, n, h;
307
- const a = { Ya: !0, Va: -1, Ja: 0 };
307
+ const a = { Za: !0, fu: -1, au: 0 };
308
308
  if ((null == t && (t = !0), !t && !e)) return a;
309
309
  let u,
310
310
  l,
311
311
  c = null;
312
- if (t) c = null === (i = this.u) || void 0 === i ? void 0 : i.j(o.C.Qa);
312
+ if (t) c = null === (i = this.u) || void 0 === i ? void 0 : i.j(o.C.du);
313
313
  else {
314
- const t = D.qu(this.u);
314
+ const t = D.ku(this.u);
315
315
  if (null == t || null == t[e]) return a;
316
316
  c = t[e];
317
317
  }
@@ -319,39 +319,39 @@ export default class Rt {
319
319
  if (
320
320
  (t
321
321
  ? ((u =
322
- (null === (s = this.yt) || void 0 === s ? void 0 : s.Au()) || -1),
322
+ (null === (s = this.qt) || void 0 === s ? void 0 : s.Cu()) || -1),
323
323
  (l =
324
- (null === (r = this.yt) || void 0 === r ? void 0 : r.Du()) || -1))
324
+ (null === (r = this.qt) || void 0 === r ? void 0 : r.Su()) || -1))
325
325
  : ((u =
326
- (null === (n = this.yt) || void 0 === n ? void 0 : n.Tu(e)) || -1),
326
+ (null === (n = this.qt) || void 0 === n ? void 0 : n.Bu(e)) || -1),
327
327
  (l =
328
- (null === (h = this.yt) || void 0 === h ? void 0 : h.ku(e)) || -1)),
328
+ (null === (h = this.qt) || void 0 === h ? void 0 : h.wu(e)) || -1)),
329
329
  -1 === u || -1 === l)
330
330
  )
331
331
  return a;
332
332
  const d = new Date().valueOf();
333
- let f = this.gu(d, u, l, c, e);
333
+ let f = this.Au(d, u, l, c, e);
334
334
  return f < 1
335
- ? ((a.Ya = !1), (a.Ja = this.pu(f, l)), a)
335
+ ? ((a.Za = !1), (a.au = this.Du(f, l)), a)
336
336
  : ((f = Math.trunc(f) - 1),
337
- (a.Va = f),
338
- t ? this.Za(f) : this.du(e, f),
337
+ (a.fu = f),
338
+ t ? this.vu(f) : this.gu(e, f),
339
339
  a);
340
340
  }
341
- Wa() {
342
- return this.bu(!0);
341
+ Va() {
342
+ return this.Tu(!0);
343
343
  }
344
- Ha(t) {
345
- const e = this.bu(!1, t);
346
- return !(e && !e.Ya);
344
+ Qa(t) {
345
+ const e = this.Tu(!1, t);
346
+ return !(e && !e.Za);
347
347
  }
348
- Os() {
349
- this.zo.Os();
348
+ Vs() {
349
+ this.Ko.Vs();
350
350
  }
351
- Hs() {
351
+ Os() {
352
352
  return this.Go;
353
353
  }
354
354
  addSdkMetadata(t) {
355
- for (const e of t) -1 === this.Hh.indexOf(e) && this.Hh.push(e);
355
+ for (const e of t) -1 === this.Yh.indexOf(e) && this.Yh.push(e);
356
356
  }
357
357
  }
@@ -1,7 +1,7 @@
1
1
  import { STORAGE_KEYS as o } from "./storage-manager.js";
2
2
  import T from "./subscription-manager.js";
3
3
  import Jt from "../models/server-config.js";
4
- import s from "../common/event-logger.js";
4
+ import t from "../common/event-logger.js";
5
5
  import { EventTypes as i } from "../../shared-lib/index.js";
6
6
  export default class Dt {
7
7
  constructor(t) {
@@ -20,7 +20,7 @@ export default class Dt {
20
20
  }
21
21
  return this.rl;
22
22
  }
23
- ii() {
23
+ hi() {
24
24
  return this.ll().hl;
25
25
  }
26
26
  al(t) {
@@ -42,26 +42,26 @@ export default class Dt {
42
42
  let s = !1;
43
43
  null != i.cl && this.Wn() !== i.cl && (s = !0);
44
44
  let r = !1;
45
- null != i.ml.enabled && this.si() !== i.ml.enabled && (r = !0);
45
+ null != i.ml.enabled && this.ei() !== i.ml.enabled && (r = !0);
46
46
  let n = !1;
47
- null != i.hi.enabled && this.ci() !== i.hi.enabled && (n = !0),
47
+ null != i.ai.enabled && this.mi() !== i.ai.enabled && (n = !0),
48
48
  (this.rl = i),
49
- this.u.k(o.C.ul, i.Y()),
50
- s && this.tl.Dt(),
51
- r && this.el.Dt(),
52
- n && this.il.Dt();
49
+ this.u.I(o.C.ul, i.Y()),
50
+ s && this.tl.Rt(),
51
+ r && this.el.Rt(),
52
+ n && this.il.Rt();
53
53
  }
54
54
  }
55
55
  }
56
56
  _n(t) {
57
- const e = this.tl.It(t);
57
+ const e = this.tl.Nt(t);
58
58
  return this.sl && this.tl.removeSubscription(this.sl), (this.sl = e), e;
59
59
  }
60
- Is(t) {
61
- return this.el.It(t);
60
+ Ms(t) {
61
+ return this.el.Nt(t);
62
62
  }
63
- ji(t) {
64
- return this.il.It(t);
63
+ bi(t) {
64
+ return this.il.Nt(t);
65
65
  }
66
66
  me(t) {
67
67
  return -1 !== this.ll().gl.indexOf(t);
@@ -78,19 +78,19 @@ export default class Dt {
78
78
  Wn() {
79
79
  return this.ll().cl;
80
80
  }
81
- si() {
81
+ ei() {
82
82
  return this.ll().ml.enabled || !1;
83
83
  }
84
84
  Cl() {
85
85
  const t = this.ll().ol;
86
86
  return !(!t || null == t.enabled) && t.enabled;
87
87
  }
88
- Au() {
88
+ Cu() {
89
89
  if (!this.Cl()) return -1;
90
90
  const t = this.ll().ol;
91
91
  return null == t.capacity || t.capacity < 10 ? -1 : t.capacity;
92
92
  }
93
- Du() {
93
+ Su() {
94
94
  if (!this.Cl()) return -1;
95
95
  const t = this.ll().ol;
96
96
  return null == t.refill_rate || t.refill_rate <= 0 ? -1 : t.refill_rate;
@@ -99,22 +99,22 @@ export default class Dt {
99
99
  const e = this.ll().ol.endpoint_overrides;
100
100
  return null == e ? null : e[t];
101
101
  }
102
- Tu(t) {
102
+ Bu(t) {
103
103
  const e = this.vl(t);
104
104
  return null == e || isNaN(e.capacity) || e.capacity <= 0 ? -1 : e.capacity;
105
105
  }
106
- ku(t) {
106
+ wu(t) {
107
107
  const e = this.vl(t);
108
108
  return null == e || isNaN(e.refill_rate) || e.refill_rate <= 0
109
109
  ? -1
110
110
  : e.refill_rate;
111
111
  }
112
- ci() {
113
- return this.ll().hi.enabled && null == this.Ri()
114
- ? (s.q(i.qs, { e: "Missing feature flag refresh_rate_limit." }), !1)
115
- : this.ll().hi.enabled || !1;
112
+ mi() {
113
+ return this.ll().ai.enabled && null == this.Di()
114
+ ? (t.q(i.Ls, { e: "Missing feature flag refresh_rate_limit." }), !1)
115
+ : this.ll().ai.enabled || !1;
116
116
  }
117
- Ri() {
118
- return this.ll().hi.refresh_rate_limit;
117
+ Di() {
118
+ return this.ll().ai.refresh_rate_limit;
119
119
  }
120
120
  }
@@ -1,5 +1,5 @@
1
1
  import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
2
- import ue from "../models/braze-event.js";
2
+ import ve from "../models/braze-event.js";
3
3
  import _t from "../models/identifier.js";
4
4
  import { convertMsToSeconds as h } from "../util/date-utils.js";
5
5
  import {
@@ -10,12 +10,12 @@ import {
10
10
  export default class Mt {
11
11
  constructor(s, t, i, e) {
12
12
  (this.u = s),
13
- (this.wt = t),
14
- (this.yt = i),
13
+ (this.yt = t),
14
+ (this.qt = i),
15
15
  (this.wl = e),
16
16
  (this.u = s),
17
- (this.wt = t),
18
- (this.yt = i),
17
+ (this.yt = t),
18
+ (this.qt = i),
19
19
  (this.Sl = 1e3),
20
20
  (null == e || isNaN(e)) && (e = 1800),
21
21
  e < this.Sl / 1e3 &&
@@ -30,28 +30,28 @@ export default class Mt {
30
30
  (this.wl = e);
31
31
  }
32
32
  jl(s, t) {
33
- return new ue(this.wt.getUserId(), i.xl, s, t.eu, { d: h(s - t.Dl) });
33
+ return new ve(this.yt.getUserId(), i.xl, s, t.eu, { d: h(s - t.Dl) });
34
34
  }
35
- Si() {
35
+ xi() {
36
36
  const s = this.u.tu(o.iu.El);
37
37
  return null == s ? null : s.eu;
38
38
  }
39
39
  Gl() {
40
40
  const s = new Date().valueOf(),
41
- t = this.yt.dl(),
41
+ t = this.qt.dl(),
42
42
  i = this.u.j(o.C.Nl);
43
43
  if (null != i && null == t) return !1;
44
44
  let e = !1;
45
45
  return (
46
46
  null == i ? (e = !0) : null != t && (e = s - i > 1e3 * t),
47
- e && this.u.k(o.C.Nl, s),
47
+ e && this.u.I(o.C.Nl, s),
48
48
  e
49
49
  );
50
50
  }
51
51
  zl(s, t) {
52
52
  return null == t || null == t.Hl || (!(s - t.Dl < this.Sl) && t.Hl < s);
53
53
  }
54
- wo() {
54
+ xo() {
55
55
  const s = new Date().valueOf(),
56
56
  t = s + 1e3 * this.wl,
57
57
  e = this.u.tu(o.iu.El);
@@ -65,9 +65,9 @@ export default class Mt {
65
65
  }
66
66
  (n += ". Will expire " + t.valueOf()), r.info(n);
67
67
  const l = new _t(p.W(), t);
68
- this.u.kl(new ue(this.wt.getUserId(), i.ql, s, l.eu)),
68
+ this.u.kl(new ve(this.yt.getUserId(), i.ql, s, l.eu)),
69
69
  this.u.uu(o.iu.El, l);
70
- return null == this.u.j(o.C.Nl) && this.u.k(o.C.Nl, s), l.eu;
70
+ return null == this.u.j(o.C.Nl) && this.u.I(o.C.Nl, s), l.eu;
71
71
  }
72
72
  if (null != e) return (e.Wl = s), (e.Hl = t), this.u.uu(o.iu.El, e), e.eu;
73
73
  }
@@ -1,7 +1,7 @@
1
1
  import Q, { STORAGE_KEYS as o } from "./storage-manager.js";
2
2
  import { logger as r } from "../../shared-lib/index.js";
3
3
  const Wt = {
4
- Qo: function (e, t = !1) {
4
+ Wh: function (e, t = !1) {
5
5
  let a = !1;
6
6
  try {
7
7
  if (localStorage && localStorage.getItem)