@braze/web-sdk 5.3.2 → 5.4.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 (48) hide show
  1. package/index.d.ts +20 -4
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +7 -7
  4. package/shared-lib/indexed-db-adapter.js +1 -1
  5. package/shared-lib/logger.js +2 -2
  6. package/shared-lib/supported-options.js +9 -8
  7. package/src/Card/display/card-display.js +59 -58
  8. package/src/Core/index.js +1 -0
  9. package/src/Core/is-initialized.js +4 -0
  10. package/src/InAppMessage/display/in-app-message-to-html.js +64 -62
  11. package/src/InAppMessage/ui/show-in-app-message.js +42 -40
  12. package/src/Push/push-manager-factory.js +2 -1
  13. package/src/Push/push-manager.js +73 -85
  14. package/src/Push/utils/push-utils.js +3 -3
  15. package/src/User/user-manager.js +2 -2
  16. package/src/User/user.js +4 -4
  17. package/src/common/event-logger.js +4 -4
  18. package/src/common/feed-display.js +17 -16
  19. package/src/l10n/l10n-manager-factory.js +7 -7
  20. package/src/l10n/l10n-manager.js +15 -5
  21. package/src/managers/braze-instance.js +53 -51
  22. package/src/managers/device-manager.js +17 -17
  23. package/src/managers/network-manager.js +89 -89
  24. package/src/managers/server-config-manager.js +4 -4
  25. package/src/managers/session-manager.js +4 -4
  26. package/src/managers/storage-manager-factory.js +1 -1
  27. package/src/managers/storage-manager.js +17 -17
  28. package/src/models/backend-errors.js +5 -5
  29. package/src/models/braze-event.js +3 -3
  30. package/src/models/device.js +1 -1
  31. package/src/models/server-config.js +2 -2
  32. package/src/request-controller.js +74 -74
  33. package/src/triggers/models/filter.js +3 -3
  34. package/src/triggers/models/in-app-message-click-data.js +8 -8
  35. package/src/triggers/models/push-click-data.js +3 -3
  36. package/src/triggers/models/trigger-condition.js +1 -1
  37. package/src/triggers/triggers-provider.js +3 -3
  38. package/src/ui/js/attach-css.js +1 -1
  39. package/src/ui/js/feed-css.js +1 -1
  40. package/src/ui/js/iam-css.js +1 -1
  41. package/src/util/base-device-parser.js +7 -7
  42. package/src/util/browser-detector.js +21 -21
  43. package/src/util/client-hints-parser.js +3 -3
  44. package/src/util/component-utils.js +13 -12
  45. package/src/util/net.js +1 -1
  46. package/src/util/request-header-utils.js +7 -7
  47. package/src/util/user-agent-parser.js +3 -3
  48. package/src/util/window-utils.js +1 -1
@@ -1,5 +1,5 @@
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,
@@ -11,49 +11,49 @@ 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),
18
+ (this.Ko = i),
19
19
  (this.wt = s),
20
20
  (this.ri = r),
21
21
  (this.yt = 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),
31
+ (this.Ko = i),
32
32
  (this.wt = s),
33
33
  (this.ri = r),
34
34
  (this.yt = 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
43
  Js(t, e = !1, i = !1) {
44
44
  const s = this.on.ce(!i),
45
45
  r = s.Zi(),
46
- n = this.u.j(o.C.Ca);
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.ri.Si()) &&
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),
@@ -63,7 +63,7 @@ export default class Rt {
63
63
  const e = this.wt.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
  }
@@ -75,7 +75,7 @@ export default class Rt {
75
75
  if (!o && !h) return !0;
76
76
  if (o) {
77
77
  let e;
78
- this.zo.Bh();
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]);
@@ -87,12 +87,12 @@ export default class Rt {
87
87
  s
88
88
  ? ((i.reason = s), (e = `due to ${s}`))
89
89
  : (e = `with error code ${o.error_code}.`),
90
- this.zo.Fh() ||
90
+ this.Ko.Fh() ||
91
91
  (e +=
92
92
  ' Please use the "enableSdkAuthentication" initialization option to enable authentication.'),
93
93
  r.error(`SDK Authentication failed ${e}`),
94
- this.Qh(t.events || [], t.attributes || []),
95
- this.zo.qh(i),
94
+ this.Zh(t.events || [], t.attributes || []),
95
+ this.Ko.qh(i),
96
96
  !1
97
97
  );
98
98
  }
@@ -100,38 +100,38 @@ 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
106
  s.q(i.qs, { e: n }),
107
107
  r.info(n),
108
108
  !1
109
109
  );
110
- case Xt.Ra:
110
+ case Xt.qa:
111
111
  return (
112
112
  (n = "Received successful response with invalid JSON"),
113
113
  s.q(i.qs, { e: n + ": " + e.response }),
114
114
  r.info(n),
115
115
  !1
116
116
  );
117
- case Xt.qa:
117
+ case Xt.Aa:
118
118
  o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Go}`;
119
119
  break;
120
- case Xt.Aa:
120
+ case Xt.Ba:
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.Na:
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
+ Xa(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
+ $a(t, e, i, s, r = !1) {
135
135
  const n = [],
136
136
  o = (t) => t || "",
137
137
  h = o(this.wt.getUserId());
@@ -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.Zi()), 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,50 +160,50 @@ 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)) {
166
+ if ((this.Zh(l, u), (a = this.Js(a, !0, r)), d)) {
167
167
  d = this.Js(d, !1, r);
168
- const t = { requestData: d, headers: this.$s(d, D.Ps.$a) };
168
+ const t = { requestData: d, headers: this.$s(d, D.Ps.La) };
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.Xa(a.events, a.attributes, t, e)) return d ? n : null;
172
+ const f = { requestData: a, headers: this.$s(a, D.Ps.La) };
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.Ea(t);
185
185
  }
186
186
  Vs(t, e) {
187
187
  let i = "HTTP error ";
188
188
  null != t && (i += t + " "), (i += e), r.error(i);
189
189
  }
190
190
  qr(t) {
191
- return s.q(i.Ea, { n: t });
191
+ return s.q(i.Ka, { n: t });
192
192
  }
193
193
  Yi(t, e, i) {
194
194
  const s = {};
195
195
  t && (s.feed = !0), e && (s.triggers = !0);
196
196
  const r = null != i ? i : this.wt.getUserId();
197
- if ((r && (s.user_id = r), !s.user_id && !this.zo.Fh())) {
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
201
  return (s.config = { config_time: this.yt.ii() }), { respond_with: s };
202
202
  }
203
- Ka(t) {
203
+ Pa(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.Ua(this.u, t);
207
207
  if (-1 !== s) {
208
208
  i = (e - s).toString();
209
209
  }
@@ -211,9 +211,9 @@ export default class Rt {
211
211
  }
212
212
  $s(t, e, i = !1) {
213
213
  const s = [["X-Braze-Api-Key", this.rn]],
214
- r = this.Ka(e);
214
+ r = this.Pa(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.Ha(this.u, e).toString();
217
217
  s.push(["X-Braze-Req-Attempt", n]);
218
218
  let h = !1;
219
219
  if (
@@ -235,83 +235,83 @@ export default class Rt {
235
235
  (e === D.Ps.bi &&
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
+ Wa(t, e, i, s) {
246
246
  window.setTimeout(() => {
247
- r.info(`Retrying rate limited ${this.$h(s)}SDK request.`),
247
+ r.info(`Retrying rate limited ${this.Hh(s)}SDK request.`),
248
248
  this.Xs(e, i, s);
249
249
  }, t);
250
250
  }
251
251
  Xs(t, e, i, s) {
252
- if (!this.Ha(i))
252
+ if (!this.Ya(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.Ja();
258
+ if (!n.Qa)
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.Va / 1e3,
265
265
  )} seconds.`,
266
266
  ),
267
- void this.Ga(n.Ja, t, e, i)
267
+ void this.Wa(n.Va, t, e, i)
268
268
  );
269
- this.u.k(o.C.Qa, new Date().valueOf());
269
+ this.u.k(o.C.Za, 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.au);
274
274
  })
275
- : e(n.Va);
275
+ : e(n.au);
276
276
  }
277
- Za(t) {
277
+ du(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.k(o.C.fu, 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
+ vu(t, e) {
282
+ let i = this.Ru();
283
+ null == i && (i = {}), (i[t] = e), this.u.k(o.C.gu, i);
284
284
  }
285
- Ru() {
285
+ pu() {
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.fu);
288
288
  }
289
- fu() {
289
+ Ru() {
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.gu);
292
292
  }
293
- gu(t, e, i, s, r = "") {
293
+ bu(t, e, i, s, r = "") {
294
294
  let n;
295
295
  if (r) {
296
- const t = this.fu();
296
+ const t = this.Ru();
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.pu()), (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
+ qu(t, e) {
303
303
  return Math.max(0, (1 - t) * e * 1e3);
304
304
  }
305
- bu(t, e = "") {
305
+ Au(t, e = "") {
306
306
  var i, s, r, n, h;
307
- const a = { Ya: !0, Va: -1, Ja: 0 };
307
+ const a = { Qa: !0, au: -1, Va: 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.Za);
313
313
  else {
314
- const t = D.qu(this.u);
314
+ const t = D.Du(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.yt) || void 0 === s ? void 0 : s.Tu()) || -1),
323
323
  (l =
324
- (null === (r = this.yt) || void 0 === r ? void 0 : r.Du()) || -1))
324
+ (null === (r = this.yt) || void 0 === r ? void 0 : r.ku()) || -1))
325
325
  : ((u =
326
- (null === (n = this.yt) || void 0 === n ? void 0 : n.Tu(e)) || -1),
326
+ (null === (n = this.yt) || void 0 === n ? void 0 : n.Cu(e)) || -1),
327
327
  (l =
328
- (null === (h = this.yt) || void 0 === h ? void 0 : h.ku(e)) || -1)),
328
+ (null === (h = this.yt) || void 0 === h ? void 0 : h.Su(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.bu(d, u, l, c, e);
334
334
  return f < 1
335
- ? ((a.Ya = !1), (a.Ja = this.pu(f, l)), a)
335
+ ? ((a.Qa = !1), (a.Va = this.qu(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.au = f),
338
+ t ? this.du(f) : this.vu(e, f),
339
339
  a);
340
340
  }
341
- Wa() {
342
- return this.bu(!0);
341
+ Ja() {
342
+ return this.Au(!0);
343
343
  }
344
- Ha(t) {
345
- const e = this.bu(!1, t);
346
- return !(e && !e.Ya);
344
+ Ya(t) {
345
+ const e = this.Au(!1, t);
346
+ return !(e && !e.Qa);
347
347
  }
348
348
  Os() {
349
- this.zo.Os();
349
+ this.Ko.Os();
350
350
  }
351
351
  Hs() {
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
  }
@@ -85,12 +85,12 @@ export default class Dt {
85
85
  const t = this.ll().ol;
86
86
  return !(!t || null == t.enabled) && t.enabled;
87
87
  }
88
- Au() {
88
+ Tu() {
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
+ ku() {
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,11 +99,11 @@ 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
+ Cu(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
+ Su(t) {
107
107
  const e = this.vl(t);
108
108
  return null == e || isNaN(e.refill_rate) || e.refill_rate <= 0
109
109
  ? -1
@@ -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 {
@@ -30,7 +30,7 @@ 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.wt.getUserId(), i.xl, s, t.eu, { d: h(s - t.Dl) });
34
34
  }
35
35
  Si() {
36
36
  const s = this.u.tu(o.iu.El);
@@ -51,7 +51,7 @@ export default class Mt {
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,7 +65,7 @@ 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.wt.getUserId(), i.ql, s, l.eu)),
69
69
  this.u.uu(o.iu.El, l);
70
70
  return null == this.u.j(o.C.Nl) && this.u.k(o.C.Nl, s), l.eu;
71
71
  }
@@ -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)
@@ -1,10 +1,10 @@
1
- import ue from "../models/braze-event.js";
1
+ import ve from "../models/braze-event.js";
2
2
  import _t from "../models/identifier.js";
3
3
  import {
4
4
  isArray as j,
5
5
  keys as to,
6
6
  validateValueIsFromEnum as J,
7
- values as Pt,
7
+ values as Rt,
8
8
  } from "../util/code-utils.js";
9
9
  import { logger as r, EventTypes as i } from "../../shared-lib/index.js";
10
10
  import { User } from "../User/index.js";
@@ -21,9 +21,9 @@ export const STORAGE_KEYS = {
21
21
  tE: "ab.storage.events",
22
22
  eE: "ab.storage.attributes",
23
23
  sE: "ab.storage.attributes.anonymous_user",
24
- Ca: "ab.storage.device",
25
- Yh: "ab.storage.sdk_metadata",
26
- Jh: "ab.storage.session_id_for_cached_metadata",
24
+ Fa: "ab.storage.device",
25
+ Jh: "ab.storage.sdk_metadata",
26
+ Qh: "ab.storage.session_id_for_cached_metadata",
27
27
  In: "ab.storage.pushToken",
28
28
  Ui: "ab.storage.newsFeed",
29
29
  ki: "ab.storage.lastNewsFeedRefresh",
@@ -36,8 +36,8 @@ export const STORAGE_KEYS = {
36
36
  gs: "ab.storage.ccLastFullSync",
37
37
  ys: "ab.storage.ccLastCardUpdated",
38
38
  nE: "ab.storage.ccRateLimitCurrentTokenCount",
39
- au: "ab.storage.globalRateLimitCurrentTokenCount",
40
- vu: "ab.storage.dynamicRateLimitCurrentTokenCount",
39
+ fu: "ab.storage.globalRateLimitCurrentTokenCount",
40
+ gu: "ab.storage.dynamicRateLimitCurrentTokenCount",
41
41
  v: "ab.storage.ccClicks",
42
42
  H: "ab.storage.ccImpressions",
43
43
  A: "ab.storage.ccDismissals",
@@ -54,7 +54,7 @@ export const STORAGE_KEYS = {
54
54
  lE: "ab.storage.lastReqToEndpoint",
55
55
  SE: "ab.storage.requestAttempts",
56
56
  Nr: "ab.storage.deferredIam",
57
- Qa: "ab.storage.lastSdkReq",
57
+ Za: "ab.storage.lastSdkReq",
58
58
  _E: "ab.storage.alias",
59
59
  },
60
60
  se: "ab.optOut",
@@ -63,7 +63,7 @@ export default class Q {
63
63
  constructor(t, e) {
64
64
  (this.uE = t), (this.TE = e), (this.uE = t), (this.TE = e);
65
65
  }
66
- Wh(t) {
66
+ Vh(t) {
67
67
  const e = to(STORAGE_KEYS.iu),
68
68
  s = new Q.ee(t);
69
69
  for (const t of e) s.remove(STORAGE_KEYS.iu[t]);
@@ -98,14 +98,14 @@ export default class Q {
98
98
  Al(t) {
99
99
  this.uE.remove(t);
100
100
  }
101
- Vh() {
101
+ Kh() {
102
102
  const t = to(STORAGE_KEYS.iu);
103
103
  let e;
104
104
  for (const s of t)
105
105
  (e = this.tu(STORAGE_KEYS.iu[s])),
106
106
  null != e && this.uu(STORAGE_KEYS.iu[s], e);
107
107
  }
108
- xo(t) {
108
+ zo(t) {
109
109
  let e;
110
110
  if (null == t || 0 === t.length) return !1;
111
111
  e = j(t) ? t : [t];
@@ -115,7 +115,7 @@ export default class Q {
115
115
  return this.TE.store(STORAGE_KEYS.C.tE, s);
116
116
  }
117
117
  kl(t) {
118
- return null != t && this.xo([t]);
118
+ return null != t && this.zo([t]);
119
119
  }
120
120
  AE() {
121
121
  let t = this.TE.br(STORAGE_KEYS.C.tE);
@@ -125,7 +125,7 @@ export default class Q {
125
125
  r = null;
126
126
  if (j(t))
127
127
  for (let s = 0; s < t.length; s++)
128
- ue.RE(t[s]) ? e.push(ue.qn(t[s])) : (r = s);
128
+ ve.RE(t[s]) ? e.push(ve.qn(t[s])) : (r = s);
129
129
  else s = !0;
130
130
  if (s || null != r) {
131
131
  let o = "Stored events could not be deserialized as Events";
@@ -138,7 +138,7 @@ export default class Q {
138
138
  typeof t +
139
139
  ": " +
140
140
  JSON.stringify(t)),
141
- e.push(new ue(null, i.qs, new Date().valueOf(), null, { e: o }));
141
+ e.push(new ve(null, i.qs, new Date().valueOf(), null, { e: o }));
142
142
  }
143
143
  return e;
144
144
  }
@@ -187,7 +187,7 @@ export default class Q {
187
187
  gE(t) {
188
188
  return t || STORAGE_KEYS.C.sE;
189
189
  }
190
- La(t) {
190
+ Ea(t) {
191
191
  let e = this.TE.br(STORAGE_KEYS.C.eE);
192
192
  null == e && (e = {});
193
193
  const s = this.gE(t[User.Yn]),
@@ -226,7 +226,7 @@ export default class Q {
226
226
  ((e[s] = void 0),
227
227
  this.TE.store(STORAGE_KEYS.C.eE, e),
228
228
  (r[User.Yn] = t),
229
- this.La(r));
229
+ this.Ea(r));
230
230
  }
231
231
  const s = this.tu(STORAGE_KEYS.iu.El);
232
232
  let r = null;
@@ -348,7 +348,7 @@ export default class Q {
348
348
  return t.setTime(t.getTime() + 60 * this.DE * 1e3), t.getFullYear();
349
349
  }
350
350
  ME() {
351
- const t = Pt(STORAGE_KEYS.iu),
351
+ const t = Rt(STORAGE_KEYS.iu),
352
352
  e = document.cookie.split(";");
353
353
  for (let s = 0; s < e.length; s++) {
354
354
  let r = e[s];
@@ -1,8 +1,8 @@
1
1
  export default {
2
- qa: "invalid_api_key",
3
- Aa: "blacklisted",
4
- Ba: "no_device_identifier",
5
- Ra: "invalid_json_response",
6
- Zh: "empty_response",
2
+ Aa: "invalid_api_key",
3
+ Ba: "blacklisted",
4
+ Na: "no_device_identifier",
5
+ qa: "invalid_json_response",
6
+ Ra: "empty_response",
7
7
  __: "sdk_auth_error",
8
8
  };
@@ -5,7 +5,7 @@ import {
5
5
  convertMsToSeconds as h,
6
6
  timestampOrNow as Qt,
7
7
  } from "../util/date-utils.js";
8
- export default class ue {
8
+ export default class ve {
9
9
  constructor(t, s, i, r, e) {
10
10
  (this.userId = t),
11
11
  (this.type = s),
@@ -44,12 +44,12 @@ export default class ue {
44
44
  };
45
45
  }
46
46
  static fromJson(t) {
47
- return new ue(t.user_id, t.name, t.time, t.session_id, t.data);
47
+ return new ve(t.user_id, t.name, t.time, t.session_id, t.data);
48
48
  }
49
49
  static RE(t) {
50
50
  return null != t && Ct(t) && null != t.t && "" !== t.t;
51
51
  }
52
52
  static qn(t) {
53
- return new ue(t.u, t.t, t.ts, t.s, t.d);
53
+ return new ve(t.u, t.t, t.ts, t.s, t.d);
54
54
  }
55
55
  }
@@ -6,7 +6,7 @@ export default class Gt {
6
6
  const s = {};
7
7
  return (
8
8
  null != this.browser && (s.browser = this.browser),
9
- null != this.Ia && (s.browser_version = this.Ia),
9
+ null != this.Ta && (s.browser_version = this.Ta),
10
10
  null != this.os && (s.os_version = this.os),
11
11
  null != this.resolution && (s.resolution = this.resolution),
12
12
  null != this.language && (s.locale = this.language),
@@ -35,7 +35,7 @@ export default class Jt {
35
35
  }
36
36
  Y() {
37
37
  return {
38
- s: "5.3.2",
38
+ s: "5.4.0",
39
39
  l: this.hl,
40
40
  e: this.gl,
41
41
  a: this.fl,
@@ -50,7 +50,7 @@ export default class Jt {
50
50
  static qn(t) {
51
51
  let i = t.l;
52
52
  return (
53
- "5.3.2" !== t.s && (i = 0),
53
+ "5.4.0" !== t.s && (i = 0),
54
54
  new Jt(i, t.e, t.a, t.p, t.m, t.v, t.c, t.f, t.grl)
55
55
  );
56
56
  }