@braze/web-sdk 4.10.0 → 5.0.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 (107) hide show
  1. package/index.d.ts +19 -106
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +1 -1
  4. package/shared-lib/indexed-db-adapter.js +12 -12
  5. package/shared-lib/logger.js +2 -2
  6. package/shared-lib/supported-options.js +7 -8
  7. package/src/Card/models/captioned-image.js +19 -19
  8. package/src/Card/models/card.js +95 -94
  9. package/src/Card/models/classic-card.js +19 -19
  10. package/src/Card/models/control-card.js +9 -9
  11. package/src/Card/models/image-only.js +21 -22
  12. package/src/Card/models/index.js +0 -1
  13. package/src/Card/util/card-factory.js +39 -39
  14. package/src/ContentCards/content-cards-provider.js +114 -114
  15. package/src/ContentCards/get-cached-content-cards.js +1 -1
  16. package/src/ContentCards/index.js +0 -1
  17. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  18. package/src/ContentCards/subscribe-to-content-cards-updates.js +3 -3
  19. package/src/ContentCards/ui/hide-content-cards.js +2 -2
  20. package/src/ContentCards/ui/show-content-cards.js +14 -14
  21. package/src/Core/add-sdk-metadata.js +2 -2
  22. package/src/Core/change-user.js +2 -2
  23. package/src/Core/disable-sdk.js +4 -4
  24. package/src/Core/enable-sdk.js +4 -4
  25. package/src/Core/handle-braze-action.js +14 -14
  26. package/src/Core/is-disabled.js +2 -2
  27. package/src/Core/open-session.js +5 -5
  28. package/src/Core/set-sdk-authentication-signature.js +2 -2
  29. package/src/Core/wipe-data.js +4 -4
  30. package/src/FeatureFlags/feature-flag-factory.js +10 -10
  31. package/src/FeatureFlags/feature-flag.js +7 -7
  32. package/src/FeatureFlags/feature-flags-provider.js +50 -50
  33. package/src/FeatureFlags/get-all-feature-flags.js +1 -1
  34. package/src/FeatureFlags/get-feature-flag.js +3 -5
  35. package/src/Feed/feed-provider-factory.js +8 -8
  36. package/src/Feed/feed-provider.js +15 -15
  37. package/src/Feed/get-cached-feed.js +2 -2
  38. package/src/Feed/request-feed-refresh.js +2 -2
  39. package/src/Feed/subscribe-to-feed-updates.js +2 -2
  40. package/src/Feed/ui/hide-feed.js +2 -2
  41. package/src/Feed/ui/show-feed.js +13 -13
  42. package/src/InAppMessage/display/html-message-to-html.js +11 -12
  43. package/src/InAppMessage/display/in-app-message-to-html.js +15 -15
  44. package/src/InAppMessage/display/modal-utils.js +8 -8
  45. package/src/InAppMessage/in-app-message-factory.js +4 -4
  46. package/src/InAppMessage/in-app-message-manager.js +38 -38
  47. package/src/InAppMessage/models/full-screen-message.js +31 -31
  48. package/src/InAppMessage/models/html-message.js +16 -16
  49. package/src/InAppMessage/models/in-app-message-button.js +5 -5
  50. package/src/InAppMessage/models/in-app-message.js +46 -46
  51. package/src/InAppMessage/models/modal-message.js +30 -30
  52. package/src/InAppMessage/models/slide-up-message.js +26 -26
  53. package/src/InAppMessage/ui/show-in-app-message.js +9 -9
  54. package/src/Push/is-push-blocked.js +2 -2
  55. package/src/Push/is-push-permission-granted.js +2 -2
  56. package/src/Push/is-push-supported.js +2 -2
  57. package/src/Push/push-manager.js +31 -31
  58. package/src/Push/utils/push-utils.js +9 -9
  59. package/src/User/user-manager.js +8 -8
  60. package/src/User/user.js +29 -29
  61. package/src/common/base-feed.js +15 -14
  62. package/src/common/base-provider.js +1 -1
  63. package/src/common/event-logger.js +2 -2
  64. package/src/common/feed-display.js +32 -32
  65. package/src/l10n/l10n-manager-factory.js +9 -9
  66. package/src/managers/auth-manager.js +6 -6
  67. package/src/managers/braze-instance.js +96 -106
  68. package/src/managers/device-manager.js +17 -17
  69. package/src/managers/network-manager.js +27 -27
  70. package/src/managers/server-config-manager.js +13 -13
  71. package/src/managers/session-manager.js +8 -8
  72. package/src/managers/storage-manager-factory.js +7 -7
  73. package/src/managers/storage-manager.js +104 -104
  74. package/src/managers/subscription-manager.js +2 -2
  75. package/src/models/braze-event.js +5 -5
  76. package/src/models/device.js +1 -1
  77. package/src/models/identifier.js +1 -1
  78. package/src/models/push-token.js +1 -1
  79. package/src/models/server-config.js +6 -6
  80. package/src/request-controller.js +52 -52
  81. package/src/triggers/models/custom-event-data.js +1 -1
  82. package/src/triggers/models/custom-event-property-data.js +6 -6
  83. package/src/triggers/models/filter-set.js +8 -8
  84. package/src/triggers/models/filter.js +25 -25
  85. package/src/triggers/models/in-app-message-click-data.js +1 -1
  86. package/src/triggers/models/purchase-data.js +1 -1
  87. package/src/triggers/models/purchase-property-data.js +4 -4
  88. package/src/triggers/models/push-click-data.js +3 -3
  89. package/src/triggers/models/trigger-condition.js +14 -14
  90. package/src/triggers/models/trigger-events.js +1 -1
  91. package/src/triggers/models/trigger.js +11 -11
  92. package/src/triggers/triggers-provider.js +38 -38
  93. package/src/ui/js/attach-css.js +1 -1
  94. package/src/ui/js/feed-css.js +5 -5
  95. package/src/ui/js/iam-css.js +4 -4
  96. package/src/ui/js/load-font-awesome.js +1 -1
  97. package/src/util/base-device-parser.js +1 -1
  98. package/src/util/braze-actions.js +4 -4
  99. package/src/util/browser-detector.js +14 -14
  100. package/src/util/client-hints-parser.js +2 -2
  101. package/src/util/component-utils.js +2 -2
  102. package/src/util/device-constants.js +4 -5
  103. package/src/util/dom-utils.js +5 -5
  104. package/src/util/request-header-utils.js +4 -4
  105. package/src/util/user-agent-parser.js +10 -15
  106. package/src/Card/models/banner.js +0 -31
  107. package/src/ContentCards/log-content-cards-displayed.js +0 -5
@@ -1,85 +1,83 @@
1
1
  import kt from "./auth-manager.js";
2
2
  import y from "../common/base-provider.js";
3
- import V from "../util/browser-detector.js";
3
+ import Q from "../util/browser-detector.js";
4
4
  import Ot from "./device-manager.js";
5
5
  import DeviceProperties from "../Core/device-properties.js";
6
6
  import {
7
7
  isArray as p,
8
8
  keys as oo,
9
- validateValueIsFromEnum as H,
9
+ validateValueIsFromEnum as G,
10
10
  values as Pt,
11
11
  } from "../util/code-utils.js";
12
- import { logDeprecationWarning as z } from "../util/deprecation-utils.js";
13
12
  import Rt from "./network-manager.js";
14
13
  import Lt from "../request-controller.js";
15
- import Mt from "./server-config-manager.js";
14
+ import jt from "./server-config-manager.js";
16
15
  import Dt from "./session-manager.js";
17
16
  import r from "../../shared-lib/braze-shared-lib.js";
18
- import O, { STORAGE_KEYS as i } from "./storage-manager.js";
19
- import Bt from "./storage-manager-factory.js";
17
+ import J, { STORAGE_KEYS as i } from "./storage-manager.js";
18
+ import Mt from "./storage-manager-factory.js";
20
19
  import E from "./subscription-manager.js";
21
20
  import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js";
22
21
  import bt from "../User/user-manager.js";
23
22
  import { User } from "../User/index.js";
24
- import { parseQueryStringKeyValues as ct } from "../util/url-utils.js";
25
- import { WindowUtils as Z } from "../util/window-utils.js";
23
+ import { parseQueryStringKeyValues as ut } from "../util/url-utils.js";
24
+ import { WindowUtils as Y } from "../util/window-utils.js";
26
25
  import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../common/constants.js";
27
26
  const L = {
28
27
  ho: "allowCrawlerActivity",
29
- Eo: "baseUrl",
30
- _o: "noCookies",
28
+ _o: "baseUrl",
29
+ Eo: "noCookies",
31
30
  Io: "devicePropertyAllowlist",
32
31
  Aa: "disablePushTokenMaintenance",
33
32
  Ao: "enableLogging",
34
33
  So: "enableSdkAuthentication",
35
34
  qa: "manageServiceWorkerExternally",
36
35
  No: "minimumIntervalBetweenTriggerActionsInSeconds",
37
- wo: "sessionTimeoutInSeconds",
38
- Oo: "appVersion",
36
+ Oo: "sessionTimeoutInSeconds",
37
+ wo: "appVersion",
39
38
  Po: "appVersionNumber",
40
39
  _a: "serviceWorkerLocation",
41
40
  ka: "safariWebsitePushId",
42
41
  Ba: "localization",
43
42
  po: "contentSecurityNonce",
44
- Ro: "enableHtmlInAppMessages",
45
- Co: "allowUserSuppliedJavascript",
43
+ Ro: "allowUserSuppliedJavascript",
46
44
  lo: "inAppMessageZIndex",
47
45
  fo: "openInAppMessagesInNewTab",
48
46
  tn: "openCardsInNewTab",
49
47
  en: "openNewsFeedCardsInNewTab",
50
48
  mh: "requireExplicitInAppMessageDismissal",
51
- Lo: "doNotLoadFontAwesome",
52
- Mo: "sdkFlavor",
49
+ Co: "doNotLoadFontAwesome",
50
+ Lo: "sdkFlavor",
53
51
  };
54
- class Wt {
52
+ class Bt {
55
53
  constructor() {
56
54
  (this.cn = ""),
57
55
  (this.jo = ""),
58
56
  (this.Do = void 0),
59
- (this.Uo = null),
57
+ (this.Mo = null),
60
58
  (this.fn = null),
61
- (this.gt = null),
59
+ (this.$t = null),
62
60
  (this.ki = null),
63
- (this.wt = null),
61
+ (this.yt = null),
64
62
  (this._e = null),
65
63
  (this.u = null),
66
- (this.ft = null),
67
- (this.Bo = ""),
64
+ (this.wt = null),
65
+ (this.Uo = ""),
66
+ (this.Bo = !1),
68
67
  (this.Wo = !1),
69
- (this.zo = !1),
68
+ (this.zo = new E()),
70
69
  (this.Vo = new E()),
71
- (this.Go = new E()),
72
70
  (this.options = {}),
71
+ (this.Go = []),
73
72
  (this.Ko = []),
74
- (this.Ho = []),
75
73
  (this.Ve = []),
76
- (this.jo = "4.10.0");
74
+ (this.jo = "5.0.0");
77
75
  }
78
76
  $o(t) {
79
- this.Vo.lt(t);
77
+ this.zo.It(t);
80
78
  }
81
79
  Rh(t) {
82
- this.Go.lt(t);
80
+ this.Vo.It(t);
83
81
  }
84
82
  initialize(t, s) {
85
83
  if (this.fe())
@@ -88,7 +86,7 @@ class Wt {
88
86
  );
89
87
  this.options = s || {};
90
88
  let e = this.nn(L.Ao);
91
- const n = ct(Z.Cn());
89
+ const n = ut(Y.Cn());
92
90
  if (
93
91
  (n && "true" === n.brazeLogging && (e = !0),
94
92
  r.j.init(e),
@@ -99,7 +97,7 @@ class Wt {
99
97
  )
100
98
  return r.j.error("Braze requires a valid API key to be initialized."), !1;
101
99
  this.cn = t;
102
- let o = this.nn(L.Eo);
100
+ let o = this.nn(L._o);
103
101
  if (null == o || "" === o || "string" != typeof o)
104
102
  return r.j.error("Braze requires a valid baseUrl to be initialized."), !1;
105
103
  !1 === /^https?:/.test(o) && (o = `https://${o}`);
@@ -108,29 +106,29 @@ class Wt {
108
106
  ((o = document.createElement("a")),
109
107
  (o.href = h),
110
108
  "/" === o.pathname && (o = `${o}api/v3`),
111
- (this.Bo = o.toString()),
112
- V.qo && !this.nn(L.ho))
109
+ (this.Uo = o.toString()),
110
+ Q.qo && !this.nn(L.ho))
113
111
  )
114
112
  return (
115
113
  r.j.info("Ignoring activity from crawler bot " + navigator.userAgent),
116
- (this.zo = !0),
114
+ (this.Wo = !0),
117
115
  !1
118
116
  );
119
- const a = this.nn(L._o) || !1;
117
+ const a = this.nn(L.Eo) || !1;
120
118
  if (
121
- ((this.u = Bt.xo(t, a)), a && this.u.Jo(t), new O.ee(null, !0).jr(i.re))
119
+ ((this.u = Mt.xo(t, a)), a && this.u.Jo(t), new J.ee(null, !0).jr(i.re))
122
120
  )
123
121
  return (
124
122
  r.j.info("Ignoring all activity due to previous opt out"),
125
- (this.zo = !0),
123
+ (this.Wo = !0),
126
124
  !1
127
125
  );
128
126
  for (const t of oo(this.options))
129
127
  -1 === Pt(r.Yo).indexOf(t) &&
130
128
  r.j.warn(`Ignoring unknown initialization option '${t}'.`);
131
129
  const l = ["mparticle", "wordpress", "tealium"];
132
- if (null != this.nn(L.Mo)) {
133
- const t = this.nn(L.Mo);
130
+ if (null != this.nn(L.Lo)) {
131
+ const t = this.nn(L.Lo);
134
132
  -1 !== l.indexOf(t)
135
133
  ? (this.Do = t)
136
134
  : r.j.error("Invalid sdk flavor passed: " + t);
@@ -140,7 +138,7 @@ class Wt {
140
138
  if (p(u)) {
141
139
  const t = [];
142
140
  for (let i = 0; i < u.length; i++)
143
- H(
141
+ G(
144
142
  DeviceProperties,
145
143
  u[i],
146
144
  "devicePropertyAllowlist contained an invalid value.",
@@ -153,132 +151,124 @@ class Wt {
153
151
  ),
154
152
  (u = null);
155
153
  (this.fn = new Ot(this.u, u)),
156
- (this.wt = new Mt(this.u)),
157
- (this.ft = new bt(this.wt, this.u)),
158
- (this._e = new Dt(this.u, this.ft, this.wt, this.nn(L.wo)));
154
+ (this.yt = new jt(this.u)),
155
+ (this.wt = new bt(this.yt, this.u)),
156
+ (this._e = new Dt(this.u, this.wt, this.yt, this.nn(L.Oo)));
159
157
  const f = new E();
160
158
  return (
161
- (this.Uo = new kt(this.u, this.nn(L.So), f)),
162
- this.jt(f),
163
- (this.gt = new Rt(
159
+ (this.Mo = new kt(this.u, this.nn(L.So), f)),
160
+ this.Ht(f),
161
+ (this.$t = new Rt(
164
162
  this.fn,
165
163
  this.u,
166
- this.Uo,
167
- this.ft,
168
- this._e,
164
+ this.Mo,
169
165
  this.wt,
166
+ this._e,
167
+ this.yt,
170
168
  this.cn,
171
- this.Bo,
169
+ this.Uo,
172
170
  this.jo,
173
171
  this.Do || "",
174
- this.nn(L.Oo),
172
+ this.nn(L.wo),
175
173
  this.nn(L.Po),
176
174
  )),
177
175
  (this.ki = new Lt(
178
176
  this.cn,
179
- this.Bo,
177
+ this.Uo,
180
178
  this._e,
181
179
  this.fn,
182
- this.ft,
183
180
  this.wt,
181
+ this.yt,
184
182
  this.u,
185
183
  (t) => {
186
- if (this.fe()) for (const i of this.gr()) i.Ts(t);
184
+ if (this.fe()) for (const i of this.gr()) i.Ss(t);
187
185
  },
188
- this.Uo,
189
- this.gt,
186
+ this.Mo,
187
+ this.$t,
190
188
  )),
191
189
  this.ki.initialize(),
192
190
  r.j.info(
193
191
  `Initialized for the Braze backend at "${this.nn(
194
- L.Eo,
192
+ L._o,
195
193
  )}" with API key "${this.cn}".`,
196
194
  ),
197
- null != this.nn(L.Ro) &&
198
- z(
199
- "enableHtmlInAppMessages",
200
- "initialization option",
201
- "allowUserSuppliedJavascript",
202
- ),
203
195
  et.o(),
204
- this.wt.Ci(() => {
205
- this.Wo &&
206
- this.wt &&
207
- this.wt.vi() &&
196
+ this.yt.Ci(() => {
197
+ this.Bo &&
198
+ this.yt &&
199
+ this.yt.yi() &&
208
200
  import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
209
- if (!this.Wo) return;
201
+ if (!this.Bo) return;
210
202
  (0, t.default)();
211
203
  });
212
204
  }),
213
205
  this.ki.pr(() => {
214
- this.Wo &&
215
- this.wt &&
216
- this.wt.vi() &&
206
+ this.Bo &&
207
+ this.yt &&
208
+ this.yt.yi() &&
217
209
  import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
218
- if (!this.Wo) return;
210
+ if (!this.Bo) return;
219
211
  (0, t.default)(void 0, void 0, !0);
220
212
  });
221
213
  }),
222
- this.Vo.Et(this.options),
223
- (this.Wo = !0),
214
+ this.zo.Dt(this.options),
215
+ (this.Bo = !0),
224
216
  !0
225
217
  );
226
218
  }
227
219
  destroy(t) {
228
220
  if ((r.j.destroy(), this.fe())) {
229
- this.Go.Et(), this.Go.removeAllSubscriptions();
230
- for (const t of this.Ko) t.destroy();
231
- this.Ko = [];
232
- for (const t of this.Ho) t.clearData(!1);
233
- (this.Ho = []),
221
+ this.Vo.Dt(), this.Vo.removeAllSubscriptions();
222
+ for (const t of this.Go) t.destroy();
223
+ this.Go = [];
224
+ for (const t of this.Ko) t.clearData(!1);
225
+ (this.Ko = []),
234
226
  this.removeAllSubscriptions(),
235
227
  (this.Ve = []),
236
228
  null != this.ki && this.ki.destroy(),
237
229
  (this.ki = null),
238
- (this.Uo = null),
230
+ (this.Mo = null),
239
231
  (this.fn = null),
240
- (this.gt = null),
241
- (this.wt = null),
232
+ (this.$t = null),
233
+ (this.yt = null),
242
234
  (this._e = null),
243
- (this.ft = null),
235
+ (this.wt = null),
244
236
  (this.options = {}),
245
237
  (this.Do = void 0),
238
+ (this.Bo = !1),
246
239
  (this.Wo = !1),
247
- (this.zo = !1),
248
240
  t && (this.u = null);
249
241
  }
250
242
  }
251
243
  rr() {
252
- if (this.Xo()) return !1;
253
- if (!this.fe()) throw new Error(P);
254
- return !0;
244
+ return !this.Ho() && (!!this.fe() || (console.warn(P), !1));
255
245
  }
256
246
  Ma() {
257
247
  return this.cn;
258
248
  }
259
249
  Sr() {
260
- return this.Uo;
250
+ return this.Mo;
261
251
  }
262
252
  Ys() {
263
- return this.Bo;
253
+ return this.Uo;
264
254
  }
265
255
  te() {
266
256
  return this.fn;
267
257
  }
268
258
  ar() {
269
- return this.gt;
259
+ return this.$t;
270
260
  }
271
261
  nn(t) {
272
262
  return this.options[t];
273
263
  }
274
264
  gr() {
275
- return this.Ho;
265
+ return this.Ko;
276
266
  }
277
267
  cr() {
278
268
  return this.ki;
279
269
  }
280
270
  tr() {
281
- return this.wt;
271
+ return this.yt;
282
272
  }
283
273
  aa() {
284
274
  return this._e;
@@ -287,25 +277,25 @@ class Wt {
287
277
  return this.u;
288
278
  }
289
279
  br() {
290
- if (this.ft && this.ki) return new User(this.ft, this.ki);
280
+ if (this.wt && this.ki) return new User(this.wt, this.ki);
291
281
  }
292
282
  ir() {
293
- return this.ft;
283
+ return this.wt;
294
284
  }
295
285
  nr() {
296
- return !0 === this.nn(L.Co) || !0 === this.nn(L.Ro);
286
+ return !0 === this.nn(L.Ro);
297
287
  }
298
288
  g(t) {
299
289
  let i = !1;
300
- for (const s of this.Ko) s === t && (i = !0);
301
- i || this.Ko.push(t);
290
+ for (const s of this.Go) s === t && (i = !0);
291
+ i || this.Go.push(t);
302
292
  }
303
293
  dr(t) {
304
294
  let i = !1;
305
- for (const s of this.Ho) s.constructor === t.constructor && (i = !0);
306
- t instanceof y && !i && this.Ho.push(t);
295
+ for (const s of this.Ko) s.constructor === t.constructor && (i = !0);
296
+ t instanceof y && !i && this.Ko.push(t);
307
297
  }
308
- jt(t) {
298
+ Ht(t) {
309
299
  t instanceof E && this.Ve.push(t);
310
300
  }
311
301
  removeAllSubscriptions() {
@@ -315,17 +305,17 @@ class Wt {
315
305
  if (this.rr()) for (const i of this.Ve) i.removeSubscription(t);
316
306
  }
317
307
  ne(t) {
318
- this.zo = t;
308
+ this.Wo = t;
319
309
  }
320
310
  fe() {
321
- return this.Wo;
311
+ return this.Bo;
322
312
  }
323
- Xo() {
324
- return this.zo;
313
+ Ho() {
314
+ return this.Wo;
325
315
  }
326
- ks() {
316
+ As() {
327
317
  return this.jo;
328
318
  }
329
319
  }
330
- const e = new Wt();
331
- export { e as default, Wt as BrazeSdkInstance, L as OPTIONS };
320
+ const e = new Bt();
321
+ export { e as default, Bt as BrazeSdkInstance, L as OPTIONS };
@@ -1,4 +1,4 @@
1
- import V from "../util/browser-detector.js";
1
+ import Q from "../util/browser-detector.js";
2
2
  import xt from "../models/device.js";
3
3
  import DeviceProperties from "../Core/device-properties.js";
4
4
  import _t from "../models/identifier.js";
@@ -15,41 +15,41 @@ export default class Ot {
15
15
  (this.Qo = e);
16
16
  }
17
17
  ce(t = !0) {
18
- let e = this.u.tu(i.eu.Zo);
19
- null == e && ((e = new _t(r.Z.Y())), t && this.u.uu(i.eu.Zo, e));
18
+ let e = this.u.tu(i.eu.Xo);
19
+ null == e && ((e = new _t(r.Z.Y())), t && this.u.uu(i.eu.Xo, e));
20
20
  const s = new xt(e.iu);
21
21
  for (let t = 0; t < this.Qo.length; t++) {
22
22
  switch (this.Qo[t]) {
23
23
  case DeviceProperties.BROWSER:
24
- s.browser = V.browser;
24
+ s.browser = Q.browser;
25
25
  break;
26
26
  case DeviceProperties.BROWSER_VERSION:
27
- s.Ia = V.version;
27
+ s.Zo = Q.version;
28
28
  break;
29
29
  case DeviceProperties.OS:
30
- s.os = this.Ta();
30
+ s.os = this.Ia();
31
31
  break;
32
32
  case DeviceProperties.RESOLUTION:
33
- s.Da = screen.width + "x" + screen.height;
33
+ s.Ta = screen.width + "x" + screen.height;
34
34
  break;
35
35
  case DeviceProperties.LANGUAGE:
36
- s.language = V.language;
36
+ s.language = Q.language;
37
37
  break;
38
38
  case DeviceProperties.TIME_ZONE:
39
- s.timeZone = this.Oa(new Date());
39
+ s.timeZone = this.Da(new Date());
40
40
  break;
41
41
  case DeviceProperties.USER_AGENT:
42
- s.userAgent = V.userAgent;
42
+ s.userAgent = Q.userAgent;
43
43
  }
44
44
  }
45
45
  return s;
46
46
  }
47
- Ta() {
48
- if (V.Ca()) return V.Ca();
49
- const t = this.u.v(i.k.Fa);
50
- return t && t.os_version ? t.os_version : V.Ta();
47
+ Ia() {
48
+ if (Q.Oa()) return Q.Oa();
49
+ const t = this.u.v(i.k.Ca);
50
+ return t && t.os_version ? t.os_version : Q.Ia();
51
51
  }
52
- Oa(t) {
52
+ Da(t) {
53
53
  let e = !1;
54
54
  if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
55
55
  try {
@@ -66,9 +66,9 @@ export default class Ot {
66
66
  }
67
67
  if (e) return "";
68
68
  const s = t.getTimezoneOffset();
69
- return this.Ga(s);
69
+ return this.Fa(s);
70
70
  }
71
- Ga(t) {
71
+ Fa(t) {
72
72
  const e = Math.trunc(t / 60),
73
73
  r = Math.trunc(t % 60);
74
74
  let s = "GMT";
@@ -1,5 +1,5 @@
1
1
  import qt from "../models/backend-errors.js";
2
- import be from "../models/braze-event.js";
2
+ import ue from "../models/braze-event.js";
3
3
  import {
4
4
  convertMsToSeconds as h,
5
5
  convertSecondsToMs as Xt,
@@ -14,24 +14,24 @@ export default class Rt {
14
14
  constructor(t, e, s, i, r, o, n, h, a, u, c, l) {
15
15
  (this.fn = t),
16
16
  (this.u = e),
17
- (this.Uo = s),
18
- (this.ft = i),
17
+ (this.Mo = s),
18
+ (this.wt = i),
19
19
  (this._e = r),
20
- (this.wt = o),
20
+ (this.yt = o),
21
21
  (this.cn = n),
22
- (this.Bo = h),
22
+ (this.Uo = h),
23
23
  (this.jo = a),
24
24
  (this.Do = u),
25
25
  (this.appVersion = c),
26
26
  (this.Xh = l),
27
27
  (this.fn = t),
28
28
  (this.u = e),
29
- (this.Uo = s),
30
- (this.ft = i),
29
+ (this.Mo = s),
30
+ (this.wt = i),
31
31
  (this._e = r),
32
- (this.wt = o),
32
+ (this.yt = o),
33
33
  (this.cn = n),
34
- (this.Bo = h),
34
+ (this.Uo = h),
35
35
  (this.jo = a),
36
36
  (this.Do = u),
37
37
  (this.appVersion = c),
@@ -41,7 +41,7 @@ export default class Rt {
41
41
  Bs(t, e = !1, s = !1) {
42
42
  const r = this.fn.ce(!s),
43
43
  o = r.Kr(),
44
- n = this.u.v(i.k.Fa);
44
+ n = this.u.v(i.k.Ca);
45
45
  ii(n, o) || (t.device = o),
46
46
  (t.api_key = this.cn),
47
47
  (t.time = h(new Date().valueOf(), !0));
@@ -58,7 +58,7 @@ export default class Rt {
58
58
  (t.device_id = r.id),
59
59
  e)
60
60
  ) {
61
- const e = this.ft.getUserId();
61
+ const e = this.wt.getUserId();
62
62
  null != e && (t.user_id = e);
63
63
  }
64
64
  return t;
@@ -69,7 +69,7 @@ export default class Rt {
69
69
  if (!o && !n) return !0;
70
70
  if (o) {
71
71
  let e;
72
- this.Uo.Hh();
72
+ this.Mo.Hh();
73
73
  const s = { errorCode: o.error_code };
74
74
  for (const t of i)
75
75
  p(t) && "X-Braze-Auth-Signature" === t[0] && (s.signature = t[1]);
@@ -81,12 +81,12 @@ export default class Rt {
81
81
  n
82
82
  ? ((s.reason = n), (e = `due to ${n}`))
83
83
  : (e = `with error code ${o.error_code}.`),
84
- this.Uo.wh() ||
84
+ this.Mo.wh() ||
85
85
  (e +=
86
86
  ' Please use the "enableSdkAuthentication" initialization option to enable authentication.'),
87
87
  r.j.error(`SDK Authentication failed ${e}`),
88
88
  this.Qh(t.events || [], t.attributes || []),
89
- this.Uo.Bh(s),
89
+ this.Mo.Bh(s),
90
90
  !1
91
91
  );
92
92
  }
@@ -109,7 +109,7 @@ export default class Rt {
109
109
  !1
110
110
  );
111
111
  case qt.Ra:
112
- o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Bo}`;
112
+ o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Uo}`;
113
113
  break;
114
114
  case qt.Xa:
115
115
  o =
@@ -128,7 +128,7 @@ export default class Rt {
128
128
  $a(t, e, s, i, r = !1) {
129
129
  const o = [],
130
130
  n = (t) => t || "",
131
- h = n(this.ft.getUserId());
131
+ h = n(this.wt.getUserId());
132
132
  let a = this.Jr(t, e);
133
133
  const u = [],
134
134
  c = [];
@@ -137,7 +137,7 @@ export default class Rt {
137
137
  if (s.length > 0) {
138
138
  const t = [];
139
139
  for (const e of s) {
140
- if (((l = e.Kr()), this.Uo.wh())) {
140
+ if (((l = e.Kr()), this.Mo.wh())) {
141
141
  if (h && !l.user_id) {
142
142
  f || (f = {}), f.events || (f.events = []), f.events.push(l);
143
143
  continue;
@@ -154,7 +154,7 @@ export default class Rt {
154
154
  if (i.length > 0) {
155
155
  const t = [];
156
156
  for (const e of i)
157
- e && (this.Uo.wh() && n(e.user_id) !== h ? u.push(e) : t.push(e));
157
+ e && (this.Mo.wh() && n(e.user_id) !== h ? u.push(e) : t.push(e));
158
158
  t.length > 0 && (a.attributes = t);
159
159
  }
160
160
  if ((this.Qh(c, u), (a = this.Bs(a, !0, r)), f)) {
@@ -170,7 +170,7 @@ export default class Rt {
170
170
  if (t) {
171
171
  const e = [];
172
172
  for (const s of t) {
173
- const t = be.fromJson(s);
173
+ const t = ue.fromJson(s);
174
174
  (t.time = Xt(t.time)), e.push(t);
175
175
  }
176
176
  this.u.bo(e);
@@ -187,10 +187,10 @@ export default class Rt {
187
187
  Jr(t, e, s) {
188
188
  const i = {};
189
189
  t && (i.feed = !0), e && (i.triggers = !0);
190
- const r = null != s ? s : this.ft.getUserId();
190
+ const r = null != s ? s : this.wt.getUserId();
191
191
  return (
192
192
  r && (i.user_id = r),
193
- (i.config = { config_time: this.wt.li() }),
193
+ (i.config = { config_time: this.yt.li() }),
194
194
  { respond_with: i }
195
195
  );
196
196
  }
@@ -220,8 +220,8 @@ export default class Rt {
220
220
  e === T.Os.Ks)
221
221
  ) {
222
222
  r.push(["X-Braze-ContentCardsRequest", "true"]);
223
- let t = this.u.v(i.k.Ls);
224
- (t && s) || ((t = 0), this.u.D(i.k.Ls, t)),
223
+ let t = this.u.v(i.k.zs);
224
+ (t && s) || ((t = 0), this.u.D(i.k.zs, t)),
225
225
  r.push(["BRAZE-SYNC-RETRY-COUNT", t.toString()]),
226
226
  (h = !0);
227
227
  }
@@ -229,9 +229,9 @@ export default class Rt {
229
229
  (e === T.Os.Si &&
230
230
  (r.push(["X-Braze-FeatureFlagsRequest", "true"]), (h = !0)),
231
231
  h && r.push(["X-Braze-DataRequest", "true"]),
232
- this.Uo.wh())
232
+ this.Mo.wh())
233
233
  ) {
234
- const t = this.Uo.jh();
234
+ const t = this.Mo.jh();
235
235
  null != t && r.push(["X-Braze-Auth-Signature", t]);
236
236
  }
237
237
  return r;
@@ -245,10 +245,10 @@ export default class Rt {
245
245
  : e();
246
246
  }
247
247
  ti() {
248
- this.Uo.ti();
248
+ this.Mo.ti();
249
249
  }
250
250
  Ys() {
251
- return this.Bo;
251
+ return this.Uo;
252
252
  }
253
253
  addSdkMetadata(t) {
254
254
  for (const e of t) -1 === this.$h.indexOf(e) && this.$h.push(e);