@braze/web-sdk 4.8.0 → 4.8.1

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 (72) hide show
  1. package/index.d.ts +6 -3
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +1 -1
  4. package/shared-lib/encoding-utils.js +1 -1
  5. package/shared-lib/event-types.js +11 -11
  6. package/shared-lib/indexed-db-adapter.js +67 -67
  7. package/shared-lib/logger.js +7 -7
  8. package/src/Card/card-manager.js +1 -1
  9. package/src/ContentCards/ui/show-content-cards.js +1 -1
  10. package/src/Core/disable-sdk.js +5 -4
  11. package/src/Core/enable-sdk.js +1 -1
  12. package/src/Core/is-disabled.js +1 -1
  13. package/src/FeatureFlags/feature-flags-provider.js +12 -12
  14. package/src/Feed/ui/show-feed.js +1 -1
  15. package/src/InAppMessage/in-app-message-manager.js +40 -34
  16. package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
  17. package/src/InAppMessage/log-in-app-message-click.js +2 -2
  18. package/src/InAppMessage/log-in-app-message-html-click.js +1 -1
  19. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  20. package/src/InAppMessage/models/in-app-message.js +13 -13
  21. package/src/InAppMessage/models/slide-up-message.js +2 -2
  22. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  23. package/src/InAppMessage/ui/show-in-app-message.js +2 -2
  24. package/src/Push/push-manager.js +82 -81
  25. package/src/Push/utils/push-utils.js +4 -4
  26. package/src/User/user-manager.js +4 -4
  27. package/src/User/user.js +5 -5
  28. package/src/common/feed-display.js +82 -72
  29. package/src/l10n/l10n-manager-factory.js +7 -7
  30. package/src/managers/auth-manager.js +18 -15
  31. package/src/managers/braze-instance.js +125 -109
  32. package/src/managers/device-manager.js +40 -35
  33. package/src/managers/network-manager.js +90 -81
  34. package/src/managers/server-config-manager.js +36 -34
  35. package/src/managers/session-manager.js +44 -37
  36. package/src/managers/storage-manager-factory.js +23 -16
  37. package/src/managers/storage-manager.js +251 -239
  38. package/src/managers/subscription-manager.js +10 -7
  39. package/src/managers/types.js +1 -0
  40. package/src/models/backend-errors.js +5 -5
  41. package/src/models/braze-event.js +10 -4
  42. package/src/models/device.js +10 -18
  43. package/src/models/identifier.js +10 -11
  44. package/src/models/push-token.js +14 -9
  45. package/src/models/request-result.js +2 -2
  46. package/src/models/server-config.js +32 -16
  47. package/src/models/types.js +1 -0
  48. package/src/request-controller.js +109 -109
  49. package/src/triggers/models/custom-event-data.js +6 -6
  50. package/src/triggers/models/custom-event-property-data.js +9 -9
  51. package/src/triggers/models/filter-set.js +9 -9
  52. package/src/triggers/models/filter.js +60 -60
  53. package/src/triggers/models/in-app-message-click-data.js +9 -9
  54. package/src/triggers/models/purchase-data.js +3 -3
  55. package/src/triggers/models/purchase-property-data.js +7 -7
  56. package/src/triggers/models/push-click-data.js +6 -6
  57. package/src/triggers/models/trigger-condition.js +46 -46
  58. package/src/triggers/models/trigger-events.js +1 -1
  59. package/src/triggers/models/trigger.js +27 -27
  60. package/src/triggers/triggers-provider.js +126 -126
  61. package/src/ui/js/attach-css.js +1 -1
  62. package/src/util/base-device-parser.js +2 -2
  63. package/src/util/braze-actions.js +4 -4
  64. package/src/util/browser-detector.js +18 -18
  65. package/src/util/client-hints-parser.js +6 -6
  66. package/src/util/device-constants.js +6 -6
  67. package/src/util/dom-utils.js +5 -5
  68. package/src/util/error-utils.js +2 -0
  69. package/src/util/net.js +1 -1
  70. package/src/util/request-header-utils.js +9 -9
  71. package/src/util/user-agent-parser.js +21 -21
  72. package/src/util/window-utils.js +1 -1
@@ -1,4 +1,3 @@
1
- import V from "../util/browser-detector.js";
2
1
  import ue from "../models/braze-event.js";
3
2
  import _t from "../models/identifier.js";
4
3
  import {
@@ -9,28 +8,30 @@ import {
9
8
  } from "../util/code-utils.js";
10
9
  import r from "../../shared-lib/braze-shared-lib.js";
11
10
  import { User } from "../User/index.js";
11
+ import V from "../util/browser-detector.js";
12
+ import { getErrorMessage as ei } from "../util/error-utils.js";
12
13
  export const STORAGE_KEYS = {
13
14
  eu: {
14
15
  su: "ab.storage.userId",
15
- oa: "ab.storage.deviceId",
16
- Wh: "ab.storage.sessionId"
16
+ Xo: "ab.storage.deviceId",
17
+ Dl: "ab.storage.sessionId"
17
18
  },
18
19
  k: {
19
- _a: "ab.test",
20
+ Ea: "ab.test",
20
21
  Ia: "ab.storage.events",
21
22
  Ka: "ab.storage.attributes",
22
23
  Ya: "ab.storage.attributes.anonymous_user",
23
- ma: "ab.storage.device",
24
- ga: "ab.storage.sdk_metadata",
25
- qa: "ab.storage.session_id_for_cached_metadata",
26
- xn: "ab.storage.pushToken",
24
+ la: "ab.storage.device",
25
+ ua: "ab.storage.sdk_metadata",
26
+ ma: "ab.storage.session_id_for_cached_metadata",
27
+ Nn: "ab.storage.pushToken",
27
28
  ki: "ab.storage.newsFeed",
28
29
  Ai: "ab.storage.lastNewsFeedRefresh",
29
30
  L: "ab.storage.cardImpressions",
30
- ll: "ab.storage.serverConfig",
31
+ hl: "ab.storage.serverConfig",
31
32
  Na: "ab.storage.triggers",
32
- Ga: "ab.storage.triggers.ts",
33
- qh: "ab.storage.messagingSessionStart",
33
+ Ca: "ab.storage.triggers.ts",
34
+ zl: "ab.storage.messagingSessionStart",
34
35
  Zt: "ab.storage.cc",
35
36
  vs: "ab.storage.ccLastFullSync",
36
37
  ys: "ab.storage.ccLastCardUpdated",
@@ -39,56 +40,62 @@ export const STORAGE_KEYS = {
39
40
  C: "ab.storage.ccClicks",
40
41
  K: "ab.storage.ccImpressions",
41
42
  G: "ab.storage.ccDismissals",
42
- Ua: "ab.storage.lastDisplayedTriggerTimesById",
43
- La: "ab.storage.lastDisplayedTriggerTime",
44
- Fa: "ab.storage.triggerFireInstancesById",
45
- bu: "ab.storage.signature",
43
+ Ga: "ab.storage.lastDisplayedTriggerTimesById",
44
+ Ma: "ab.storage.lastDisplayedTriggerTime",
45
+ ya: "ab.storage.triggerFireInstancesById",
46
+ Fh: "ab.storage.signature",
46
47
  Fs: "ab.storage.brazeSyncRetryCount",
47
48
  Ss: "ab.storage.sdkVersion",
48
49
  Di: "ab.storage.ff",
49
50
  $i: "ab.storage.ffLastRefreshAt",
50
- Pa: "ab.storage.lastReqToEndpoint"
51
+ Ua: "ab.storage.lastReqToEndpoint"
51
52
  },
52
- re: "ab.optOut"
53
+ ne: "ab.optOut"
53
54
  };
54
55
  export default class O {
55
56
  constructor(t, e) {
56
- (this.Ja = t), (this.Va = e);
57
+ (this.La = t), (this.Fa = e), (this.La = t), (this.Fa = e);
58
+ }
59
+ qo(t) {
60
+ const e = oo(STORAGE_KEYS.eu),
61
+ s = new O.ee(t);
62
+ for (const t of e) s.remove(STORAGE_KEYS.eu[t]);
57
63
  }
58
64
  uu(t, e) {
59
- let s = e;
60
- null != e && e instanceof _t && (s = e.ss()), this.Ja.store(t, s);
65
+ let s = null;
66
+ null != e && e instanceof _t && (s = e.ss()), this.La.store(t, s);
61
67
  }
62
- Ha(t) {
68
+ Pa(t) {
63
69
  const e = this.tu(t);
64
- null != e && ((e.Jh = new Date().valueOf()), this.uu(t, e));
70
+ null != e && ((e.Nl = new Date().valueOf()), this.uu(t, e));
65
71
  }
66
72
  tu(t) {
67
- return _t.Tn(this.Ja.wr(t));
73
+ return _t.zn(this.La.wr(t));
68
74
  }
69
- Yh(t) {
70
- this.Ja.remove(t);
75
+ ql(t) {
76
+ this.La.remove(t);
71
77
  }
72
78
  co(t) {
79
+ let e;
73
80
  if (null == t || 0 === t.length) return !1;
74
- p(t) || (t = [t]);
75
- let e = this.Va.wr(STORAGE_KEYS.k.Ia);
76
- (null != e && p(e)) || (e = []);
77
- for (let s = 0; s < t.length; s++) e.push(t[s].ss());
78
- return this.Va.store(STORAGE_KEYS.k.Ia, e);
81
+ e = p(t) ? t : [t];
82
+ let s = this.Fa.wr(STORAGE_KEYS.k.Ia);
83
+ (null != s && p(s)) || (s = []);
84
+ for (let t = 0; t < e.length; t++) s.push(e[t].ss());
85
+ return this.Fa.store(STORAGE_KEYS.k.Ia, s);
79
86
  }
80
- Qh(t) {
87
+ Hl(t) {
81
88
  return null != t && this.co([t]);
82
89
  }
83
- Wa() {
84
- let t = this.Va.wr(STORAGE_KEYS.k.Ia);
85
- this.Va.remove(STORAGE_KEYS.k.Ia), null == t && (t = []);
90
+ Ja() {
91
+ let t = this.Fa.wr(STORAGE_KEYS.k.Ia);
92
+ this.Fa.remove(STORAGE_KEYS.k.Ia), null == t && (t = []);
86
93
  const e = [];
87
94
  let s = !1,
88
95
  o = null;
89
96
  if (p(t))
90
97
  for (let s = 0; s < t.length; s++)
91
- ue.Za(t[s]) ? e.push(ue.Tn(t[s])) : (o = s);
98
+ ue.Qa(t[s]) ? e.push(ue.zn(t[s])) : (o = s);
92
99
  else s = !0;
93
100
  if (s || null != o) {
94
101
  let n = "Stored events could not be deserialized as Events";
@@ -112,7 +119,7 @@ export default class O {
112
119
  t,
113
120
  "StorageManager cannot store object.",
114
121
  "STORAGE_KEYS.OBJECTS"
115
- ) && this.Va.store(t, e)
122
+ ) && this.Fa.store(t, e)
116
123
  );
117
124
  }
118
125
  v(t) {
@@ -122,7 +129,7 @@ export default class O {
122
129
  t,
123
130
  "StorageManager cannot retrieve object.",
124
131
  "STORAGE_KEYS.OBJECTS"
125
- ) && this.Va.wr(t)
132
+ ) && this.Fa.wr(t)
126
133
  );
127
134
  }
128
135
  ri(t) {
@@ -132,273 +139,278 @@ export default class O {
132
139
  t,
133
140
  "StorageManager cannot remove object.",
134
141
  "STORAGE_KEYS.OBJECTS"
135
- ) && (this.Va.remove(t), !0)
142
+ ) && (this.Fa.remove(t), !0)
136
143
  );
137
144
  }
138
- xo(t) {
139
- const e = oo(STORAGE_KEYS.eu),
140
- s = new O.ee(t);
141
- for (const t of e) s.remove(STORAGE_KEYS.eu[t]);
142
- }
143
145
  clearData() {
144
146
  const t = oo(STORAGE_KEYS.eu),
145
147
  e = oo(STORAGE_KEYS.k);
146
148
  for (let e = 0; e < t.length; e++) {
147
149
  const s = t[e];
148
- this.Ja.remove(STORAGE_KEYS.eu[s]);
150
+ this.La.remove(STORAGE_KEYS.eu[s]);
149
151
  }
150
152
  for (let t = 0; t < e.length; t++) {
151
153
  const s = e[t];
152
- this.Va.remove(STORAGE_KEYS.k[s]);
154
+ this.Fa.remove(STORAGE_KEYS.k[s]);
153
155
  }
154
156
  }
155
- $a(t) {
157
+ Va(t) {
156
158
  return t || STORAGE_KEYS.k.Ya;
157
159
  }
158
- wa(t) {
159
- let e = this.Va.wr(STORAGE_KEYS.k.Ka);
160
+ va(t) {
161
+ let e = this.Fa.wr(STORAGE_KEYS.k.Ka);
160
162
  null == e && (e = {});
161
- const s = this.$a(t[User.Hn]);
162
- for (let r in t)
163
- r === User.Hn ||
164
- (null != e[s] && null != e[s][r]) ||
165
- this.mu(t[User.Hn], r, t[r]);
163
+ const s = this.Va(t[User.Kn]),
164
+ r = e[s];
165
+ for (const o in t)
166
+ o !== User.Kn &&
167
+ (null == e[s] || (r && null == r[o])) &&
168
+ this.mu(t[User.Kn], o, t[o]);
166
169
  }
167
170
  mu(t, e, s) {
168
- let r = this.Va.wr(STORAGE_KEYS.k.Ka);
171
+ let r = this.Fa.wr(STORAGE_KEYS.k.Ka);
169
172
  null == r && (r = {});
170
- const o = this.$a(t);
173
+ const o = this.Va(t);
171
174
  let n = r[o];
172
175
  if (
173
- (null == n && ((n = {}), null != t && (n[User.Hn] = t)), e === User.lu)
176
+ (null == n && ((n = {}), null != t && (n[User.Kn] = t)), e === User.lu)
174
177
  ) {
175
178
  null == n[e] && (n[e] = {});
176
- for (let t in s) n[e][t] = s[t];
177
- } else n[e] = s;
178
- return (r[o] = n), this.Va.store(STORAGE_KEYS.k.Ka, r);
179
+ for (const t in s) n[e][t] = s[t];
180
+ } else null != s && (n[e] = s);
181
+ return (r[o] = n), this.Fa.store(STORAGE_KEYS.k.Ka, r);
179
182
  }
180
- tE() {
181
- const t = this.Va.wr(STORAGE_KEYS.k.Ka);
182
- this.Va.remove(STORAGE_KEYS.k.Ka);
183
+ Ha() {
184
+ const t = this.Fa.wr(STORAGE_KEYS.k.Ka);
185
+ this.Fa.remove(STORAGE_KEYS.k.Ka);
183
186
  const e = [];
184
- for (let s in t) null != t[s] && e.push(t[s]);
187
+ for (const s in t) null != t[s] && e.push(t[s]);
185
188
  return e;
186
189
  }
187
190
  ou(t) {
188
- const e = this.Va.wr(STORAGE_KEYS.k.Ka);
191
+ const e = this.Fa.wr(STORAGE_KEYS.k.Ka);
189
192
  if (null != e) {
190
- const s = this.$a(null),
193
+ const s = this.Va(null),
191
194
  r = e[s];
192
195
  null != r &&
193
196
  ((e[s] = void 0),
194
- this.Va.store(STORAGE_KEYS.k.Ka, e),
195
- (r[User.Hn] = t),
196
- this.wa(r));
197
+ this.Fa.store(STORAGE_KEYS.k.Ka, e),
198
+ (r[User.Kn] = t),
199
+ this.va(r));
197
200
  }
198
- const s = this.tu(STORAGE_KEYS.eu.Wh);
201
+ const s = this.tu(STORAGE_KEYS.eu.Dl);
199
202
  let r = null;
200
203
  null != s && (r = s.iu);
201
- const o = this.Wa();
204
+ const o = this.Ja();
202
205
  if (null != o)
203
206
  for (let e = 0; e < o.length; e++) {
204
207
  const s = o[e];
205
- null == s.userId && s.sessionId == r && (s.userId = t), this.Qh(s);
208
+ null == s.userId && s.sessionId == r && (s.userId = t), this.Hl(s);
206
209
  }
207
210
  }
208
- eE() {
209
- return this.Va.sE;
211
+ Wa() {
212
+ return this.Fa.Za;
210
213
  }
211
214
  }
212
- O.Ma = class {
215
+ (O.Oa = class {
213
216
  constructor(t) {
214
- (this.Ko = t), (this.sE = V.rE() ? 3 : 10);
217
+ (this.Xr = t), (this.Xr = t), (this.Za = V.$a() ? 3 : 10);
215
218
  }
216
- oE(t) {
217
- return t + "." + this.Ko;
219
+ _l(t) {
220
+ return t + "." + this.Xr;
218
221
  }
219
222
  store(t, e) {
220
223
  const s = { v: e };
221
224
  try {
222
- return localStorage.setItem(this.oE(t), JSON.stringify(s)), !0;
225
+ return localStorage.setItem(this._l(t), JSON.stringify(s)), !0;
223
226
  } catch (t) {
224
- return r.j.info("Storage failure: " + t.message), !1;
227
+ return r.j.info("Storage failure: " + ei(t)), !1;
225
228
  }
226
229
  }
227
230
  wr(t) {
228
231
  try {
229
- const e = JSON.parse(localStorage.getItem(this.oE(t)));
230
- return null == e ? null : e.v;
232
+ let e = null;
233
+ const s = localStorage.getItem(this._l(t));
234
+ return null != s && (e = JSON.parse(s)), null == e ? null : e.v;
231
235
  } catch (t) {
232
- return r.j.info("Storage retrieval failure: " + t.message), null;
236
+ return r.j.info("Storage retrieval failure: " + ei(t)), null;
233
237
  }
234
238
  }
235
239
  remove(t) {
236
240
  try {
237
- localStorage.removeItem(this.oE(t));
241
+ localStorage.removeItem(this._l(t));
238
242
  } catch (t) {
239
- return r.j.info("Storage removal failure: " + t.message), !1;
243
+ return r.j.info("Storage removal failure: " + ei(t)), !1;
240
244
  }
241
245
  }
242
- };
243
- O.ee = class {
244
- constructor(t, e) {
245
- (this.Ko = t), (this.nE = this.aE()), (this.iE = 576e3), (this.EE = !!e);
246
- }
247
- oE(t) {
248
- return null != this.Ko ? t + "." + this.Ko : t;
249
- }
250
- aE() {
251
- let t = 0,
252
- e = document.location.hostname;
253
- const s = e.split("."),
254
- r = "ab._gd";
255
- for (; t < s.length - 1 && -1 === document.cookie.indexOf(r + "=" + r); )
256
- t++,
257
- (e = "." + s.slice(-1 - t).join(".")),
258
- (document.cookie = r + "=" + r + ";domain=" + e + ";");
259
- return (
260
- (document.cookie =
261
- r + "=;expires=" + new Date(0).toGMTString() + ";domain=" + e + ";"),
262
- e
263
- );
264
- }
265
- ne() {
266
- const t = new Date();
267
- return t.setTime(t.getTime() + 60 * this.iE * 1e3), t.getFullYear();
268
- }
269
- lE() {
270
- const t = Lt(STORAGE_KEYS.eu),
271
- e = document.cookie.split(";");
272
- for (let s = 0; s < e.length; s++) {
273
- let r = e[s];
274
- for (; " " === r.charAt(0); ) r = r.substring(1);
275
- let o = !1;
276
- for (let e = 0; e < t.length; e++)
277
- if (0 === r.indexOf(t[e])) {
278
- o = !0;
279
- break;
246
+ }),
247
+ (O.xa = class {
248
+ constructor() {
249
+ (this.Tl = {}), (this.Al = 5242880), (this.Za = 3);
250
+ }
251
+ store(t, e) {
252
+ const s = { value: e },
253
+ o = this.Rl(e);
254
+ return o > this.Al
255
+ ? (r.j.info(
256
+ "Storage failure: object is ≈" +
257
+ o +
258
+ " bytes which is greater than the max of " +
259
+ this.Al
260
+ ),
261
+ !1)
262
+ : ((this.Tl[t] = s), !0);
263
+ }
264
+ Rl(t) {
265
+ const e = [],
266
+ s = [t];
267
+ let r = 0;
268
+ for (; s.length; ) {
269
+ const t = s.pop();
270
+ if ("boolean" == typeof t) r += 4;
271
+ else if ("string" == typeof t) r += 2 * t.length;
272
+ else if ("number" == typeof t) r += 8;
273
+ else if ("object" == typeof t && -1 === e.indexOf(t)) {
274
+ let r, o;
275
+ e.push(t);
276
+ for (const e in t) (o = t), (r = e), s.push(o[r]);
280
277
  }
281
- if (o) {
282
- const t = r.split("=")[0];
283
- -1 === t.indexOf("." + this.Ko) && this.SE(t);
284
278
  }
279
+ return r;
285
280
  }
286
- }
287
- store(t, e) {
288
- this.lE();
289
- const s = new Date();
290
- s.setTime(s.getTime() + 60 * this.iE * 1e3);
291
- const o = "expires=" + s.toUTCString(),
292
- n = "domain=" + this.nE;
293
- let a;
294
- a = this.EE ? e : encodeURIComponent(JSON.stringify(e));
295
- const i = this.oE(t) + "=" + a + ";" + o + ";" + n + ";path=/";
296
- return i.length >= 4093
297
- ? (r.j.info(
298
- "Storage failure: string is " +
299
- i.length +
300
- " chars which is too large to store as a cookie."
301
- ),
302
- !1)
303
- : ((document.cookie = i), !0);
304
- }
305
- wr(t) {
306
- const e = [],
307
- s = this.oE(t) + "=",
308
- o = document.cookie.split(";");
309
- for (let n = 0; n < o.length; n++) {
310
- let a = o[n];
311
- for (; " " === a.charAt(0); ) a = a.substring(1);
312
- if (0 === a.indexOf(s))
313
- try {
314
- let t;
315
- (t = this.EE
316
- ? a.substring(s.length, a.length)
317
- : JSON.parse(decodeURIComponent(a.substring(s.length, a.length)))),
318
- e.push(t);
319
- } catch (e) {
320
- return (
321
- r.j.info("Storage retrieval failure: " + e.message),
322
- this.remove(t),
323
- null
324
- );
281
+ wr(t) {
282
+ const e = this.Tl[t];
283
+ return null == e ? null : e.value;
284
+ }
285
+ remove(t) {
286
+ this.Tl[t] = null;
287
+ }
288
+ }),
289
+ (O.ee = class {
290
+ constructor(t, e) {
291
+ (this.Xr = t),
292
+ (this.Ol = e),
293
+ (this.Xr = t),
294
+ (this.Il = this.Kl()),
295
+ (this.Yl = 576e3),
296
+ (this.Ol = !!e);
297
+ }
298
+ _l(t) {
299
+ return null != this.Xr ? t + "." + this.Xr : t;
300
+ }
301
+ Kl() {
302
+ let t = 0,
303
+ e = document.location.hostname;
304
+ const s = e.split("."),
305
+ r = "ab._gd";
306
+ for (; t < s.length - 1 && -1 === document.cookie.indexOf(r + "=" + r); )
307
+ t++,
308
+ (e = "." + s.slice(-1 - t).join(".")),
309
+ (document.cookie = r + "=" + r + ";domain=" + e + ";");
310
+ return (
311
+ (document.cookie =
312
+ r + "=;expires=" + new Date(0).toUTCString() + ";domain=" + e + ";"),
313
+ e
314
+ );
315
+ }
316
+ re() {
317
+ const t = new Date();
318
+ return t.setTime(t.getTime() + 60 * this.Yl * 1e3), t.getFullYear();
319
+ }
320
+ Ml() {
321
+ const t = Lt(STORAGE_KEYS.eu),
322
+ e = document.cookie.split(";");
323
+ for (let s = 0; s < e.length; s++) {
324
+ let r = e[s];
325
+ for (; " " === r.charAt(0); ) r = r.substring(1);
326
+ let o = !1;
327
+ for (let e = 0; e < t.length; e++)
328
+ if (0 === r.indexOf(t[e])) {
329
+ o = !0;
330
+ break;
331
+ }
332
+ if (o) {
333
+ const t = r.split("=")[0];
334
+ -1 === t.indexOf("." + this.Xr) && this.yl(t);
325
335
  }
336
+ }
326
337
  }
327
- return e.length > 0 ? e[e.length - 1] : null;
328
- }
329
- remove(t) {
330
- this.SE(this.oE(t));
331
- }
332
- SE(t) {
333
- const e = t + "=;expires=" + new Date(0).toGMTString();
334
- (document.cookie = e), (document.cookie = e + ";path=/");
335
- const s = e + ";domain=" + this.nE;
336
- (document.cookie = s), (document.cookie = s + ";path=/");
337
- }
338
- };
339
- O.Qa = class {
340
- constructor() {
341
- (this._E = {}), (this.uE = 5242880), (this.sE = 3);
342
- }
343
- store(t, e) {
344
- const s = { value: e },
345
- o = this.cE(e);
346
- return o > this.uE
347
- ? (r.j.info(
348
- "Storage failure: object is ≈" +
349
- o +
350
- " bytes which is greater than the max of " +
351
- this.uE
352
- ),
353
- !1)
354
- : ((this._E[t] = s), !0);
355
- }
356
- cE(t) {
357
- const e = [],
358
- s = [t];
359
- let r = 0;
360
- for (; s.length; ) {
361
- const t = s.pop();
362
- if ("boolean" == typeof t) r += 4;
363
- else if ("string" == typeof t) r += 2 * t.length;
364
- else if ("number" == typeof t) r += 8;
365
- else if ("object" == typeof t && -1 === e.indexOf(t)) {
366
- e.push(t);
367
- for (let e in t) s.push(t[e]);
338
+ store(t, e) {
339
+ this.Ml();
340
+ const s = new Date();
341
+ s.setTime(s.getTime() + 60 * this.Yl * 1e3);
342
+ const o = "expires=" + s.toUTCString(),
343
+ n = "domain=" + this.Il;
344
+ let i;
345
+ i = this.Ol ? e : encodeURIComponent(JSON.stringify(e));
346
+ const a = this._l(t) + "=" + i + ";" + o + ";" + n + ";path=/";
347
+ return a.length >= 4093
348
+ ? (r.j.info(
349
+ "Storage failure: string is " +
350
+ a.length +
351
+ " chars which is too large to store as a cookie."
352
+ ),
353
+ !1)
354
+ : ((document.cookie = a), !0);
355
+ }
356
+ wr(t) {
357
+ const e = [],
358
+ s = this._l(t) + "=",
359
+ o = document.cookie.split(";");
360
+ for (let n = 0; n < o.length; n++) {
361
+ let i = o[n];
362
+ for (; " " === i.charAt(0); ) i = i.substring(1);
363
+ if (0 === i.indexOf(s))
364
+ try {
365
+ let t;
366
+ (t = this.Ol
367
+ ? i.substring(s.length, i.length)
368
+ : JSON.parse(
369
+ decodeURIComponent(i.substring(s.length, i.length))
370
+ )),
371
+ e.push(t);
372
+ } catch (e) {
373
+ return (
374
+ r.j.info("Storage retrieval failure: " + ei(e)),
375
+ this.remove(t),
376
+ null
377
+ );
378
+ }
368
379
  }
380
+ return e.length > 0 ? e[e.length - 1] : null;
369
381
  }
370
- return r;
371
- }
372
- wr(t) {
373
- const e = this._E[t];
374
- return null == e ? null : e.value;
375
- }
376
- remove(t) {
377
- this._E[t] = null;
378
- }
379
- };
380
- O.xa = class {
381
- constructor(t, e, s) {
382
- (this.Ko = t),
383
- (this.TE = []),
384
- e && this.TE.push(new O.ee(t)),
385
- s && this.TE.push(new O.Ma(t)),
386
- this.TE.push(new O.Qa(t));
387
- }
388
- store(t, e) {
389
- let s = !0;
390
- for (let r = 0; r < this.TE.length; r++) s = this.TE[r].store(t, e) && s;
391
- return s;
392
- }
393
- wr(t) {
394
- for (let e = 0; e < this.TE.length; e++) {
395
- const s = this.TE[e].wr(t);
396
- if (null != s) return s;
382
+ remove(t) {
383
+ this.yl(this._l(t));
397
384
  }
398
- return null;
399
- }
400
- remove(t) {
401
- new O.ee(this.Ko).remove(t);
402
- for (let e = 0; e < this.TE.length; e++) this.TE[e].remove(t);
403
- }
404
- };
385
+ yl(t) {
386
+ const e = t + "=;expires=" + new Date(0).toUTCString();
387
+ (document.cookie = e), (document.cookie = e + ";path=/");
388
+ const s = e + ";domain=" + this.Il;
389
+ (document.cookie = s), (document.cookie = s + ";path=/");
390
+ }
391
+ }),
392
+ (O._a = class {
393
+ constructor(t, e, s) {
394
+ (this.Xr = t),
395
+ (this.Ul = []),
396
+ e && this.Ul.push(new O.ee(t)),
397
+ s && this.Ul.push(new O.Oa(t)),
398
+ this.Ul.push(new O.xa());
399
+ }
400
+ store(t, e) {
401
+ let s = !0;
402
+ for (let r = 0; r < this.Ul.length; r++) s = this.Ul[r].store(t, e) && s;
403
+ return s;
404
+ }
405
+ wr(t) {
406
+ for (let e = 0; e < this.Ul.length; e++) {
407
+ const s = this.Ul[e].wr(t);
408
+ if (null != s) return s;
409
+ }
410
+ return null;
411
+ }
412
+ remove(t) {
413
+ new O.ee(this.Xr).remove(t);
414
+ for (let e = 0; e < this.Ul.length; e++) this.Ul[e].remove(t);
415
+ }
416
+ });
@@ -1,25 +1,28 @@
1
1
  import r from "../../shared-lib/braze-shared-lib.js";
2
2
  export default class E {
3
3
  constructor() {
4
- this.zo = {};
4
+ this.Se = {};
5
5
  }
6
6
  lt(t) {
7
7
  if ("function" != typeof t) return null;
8
8
  const i = r.Z.Y();
9
- return (this.zo[i] = t), i;
9
+ return (this.Se[i] = t), i;
10
10
  }
11
11
  removeSubscription(t) {
12
- delete this.zo[t];
12
+ delete this.Se[t];
13
13
  }
14
14
  removeAllSubscriptions() {
15
- this.zo = {};
15
+ this.Se = {};
16
16
  }
17
- fu() {
18
- return Object.keys(this.zo).length;
17
+ tc() {
18
+ return Object.keys(this.Se).length;
19
19
  }
20
20
  Et(t) {
21
21
  const i = [];
22
- for (let r in this.zo) i.push(this.zo[r](t));
22
+ for (const r in this.Se) {
23
+ const s = this.Se[r];
24
+ i.push(s(t));
25
+ }
23
26
  return i;
24
27
  }
25
28
  }
@@ -0,0 +1 @@
1
+ export {};