@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
@@ -3,37 +3,37 @@ import ti from "../models/push-token.js";
3
3
  import { logger as r, EncodingUtils as ei } from "../../shared-lib/index.js";
4
4
  import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
5
5
  import { User } from "../User/index.js";
6
- import { WindowUtils as eo } from "../util/window-utils.js";
7
6
  import yt from "./utils/push-utils.js";
8
7
  import { getErrorMessage as si } from "../util/error-utils.js";
9
8
  export default class ea {
10
- constructor(i, t, e, s, r, n, o, u, a, c) {
9
+ constructor(i, t, e, s, r, n, o, u, a, h, c) {
11
10
  (this.sn = i),
12
11
  (this.rn = t),
13
12
  (this.on = e),
14
13
  (this.un = r),
15
14
  (this.an = n),
16
- (this.yt = o),
17
- (this.cn = u),
18
- (this.hn = a),
15
+ (this.hn = o),
16
+ (this.qt = u),
17
+ (this.cn = a),
18
+ (this.fn = h),
19
19
  (this.u = c),
20
20
  (this.sn = i),
21
21
  (this.rn = t),
22
22
  (this.on = e),
23
- (this.fn = s + "/safari/" + t),
23
+ (this.ln = s + "/safari/" + t),
24
24
  (this.un = r || "/service-worker.js"),
25
- (this.an = n),
26
- (this.yt = o),
27
- (this.cn = u || !1),
28
- (this.hn = a || !1),
25
+ (this.hn = o),
26
+ (this.qt = u),
27
+ (this.cn = a || !1),
28
+ (this.fn = h || !1),
29
29
  (this.u = c),
30
- (this.ln = yt.dn()),
31
- (this.pn = yt.bn());
30
+ (this.dn = yt.pn()),
31
+ (this.bn = yt.yn());
32
32
  }
33
33
  mn() {
34
- return this.hn;
34
+ return this.fn;
35
35
  }
36
- yn(i, t, e, s, n) {
36
+ gn(i, t, e, s, n) {
37
37
  i.unsubscribe()
38
38
  .then((i) => {
39
39
  i
@@ -46,7 +46,7 @@ export default class ea {
46
46
  "function" == typeof n && n(!1);
47
47
  });
48
48
  }
49
- gn(i, t, e) {
49
+ wn(i, t, e) {
50
50
  var s;
51
51
  const n = ((i) => {
52
52
  if ("string" == typeof i) return i;
@@ -55,9 +55,9 @@ export default class ea {
55
55
  let t = i.endpoint;
56
56
  const e = i;
57
57
  return (
58
- e.wn &&
59
- -1 === i.endpoint.indexOf(e.wn) &&
60
- (t = i.endpoint + "/" + e.wn),
58
+ e.kn &&
59
+ -1 === i.endpoint.indexOf(e.kn) &&
60
+ (t = i.endpoint + "/" + e.kn),
61
61
  t
62
62
  );
63
63
  })(i);
@@ -73,7 +73,7 @@ export default class ea {
73
73
  } catch (i) {
74
74
  r.error(si(i));
75
75
  }
76
- const c = ((i) => {
76
+ const h = ((i) => {
77
77
  let t;
78
78
  return i.options &&
79
79
  (t = i.options.applicationServerKey) &&
@@ -84,25 +84,25 @@ export default class ea {
84
84
  .replace(/\//g, "_")
85
85
  : null;
86
86
  })(a);
87
- null === (s = this.sn) || void 0 === s || s.kn(n, t, o, u, c),
87
+ null === (s = this.sn) || void 0 === s || s.Pn(n, t, o, u, h),
88
88
  n && "function" == typeof e && e(n, o, u);
89
89
  }
90
- Pn() {
90
+ Dn() {
91
91
  var i;
92
- null === (i = this.sn) || void 0 === i || i.Dn(!0);
92
+ null === (i = this.sn) || void 0 === i || i.Sn(!0);
93
93
  }
94
- Sn(i, t) {
94
+ An(i, t) {
95
95
  var e;
96
- null === (e = this.sn) || void 0 === e || e.Dn(!1),
96
+ null === (e = this.sn) || void 0 === e || e.Sn(!1),
97
97
  r.info(i),
98
98
  "function" == typeof t && t(!1);
99
99
  }
100
- An(i, t, e, s) {
100
+ jn(i, t, e, s) {
101
101
  var n;
102
102
  if ("default" === t.permission)
103
103
  try {
104
104
  window.safari.pushNotification.requestPermission(
105
- this.fn,
105
+ this.ln,
106
106
  i,
107
107
  {
108
108
  api_key: this.rn,
@@ -116,21 +116,21 @@ export default class ea {
116
116
  this.sn.setPushNotificationSubscriptionType(
117
117
  User.NotificationSubscriptionTypes.OPTED_IN,
118
118
  ),
119
- this.An(i, t, e, s);
119
+ this.jn(i, t, e, s);
120
120
  },
121
121
  );
122
122
  } catch (i) {
123
- this.Sn("Could not request permission for push: " + i, s);
123
+ this.An("Could not request permission for push: " + i, s);
124
124
  }
125
125
  else
126
126
  "denied" === t.permission
127
- ? this.Sn(
127
+ ? this.An(
128
128
  "The user has blocked notifications from this site, or Safari push is not configured in the Braze dashboard.",
129
129
  s,
130
130
  )
131
131
  : "granted" === t.permission &&
132
132
  (r.info("Device successfully subscribed to push."),
133
- this.gn(t.deviceToken, new Date(), e));
133
+ this.wn(t.deviceToken, new Date(), e));
134
134
  }
135
135
  requestPermission(i, t, e) {
136
136
  const s = (s) => {
@@ -166,7 +166,7 @@ export default class ea {
166
166
  .subscribe(n)
167
167
  .then((i) => {
168
168
  r.info("Device successfully subscribed to push."),
169
- this.gn(i, new Date(), e);
169
+ this.wn(i, new Date(), e);
170
170
  })
171
171
  .catch((i) => {
172
172
  yt.isPushBlocked()
@@ -176,60 +176,48 @@ export default class ea {
176
176
  "function" == typeof s && s(!0));
177
177
  });
178
178
  }
179
- jn() {
180
- return this.cn
181
- ? navigator.serviceWorker.getRegistration(this.un)
182
- : navigator.serviceWorker.register(this.un).then(() =>
183
- navigator.serviceWorker.ready.then(
184
- (i) => (
185
- i &&
186
- "function" == typeof i.update &&
187
- i.update().catch((i) => {
188
- r.info("ServiceWorker update failed: " + i);
189
- }),
190
- i
191
- ),
192
- ),
193
- );
179
+ xn() {
180
+ if (this.cn) return navigator.serviceWorker.getRegistration(this.un);
181
+ const i = this.an ? { scope: this.an } : void 0;
182
+ return navigator.serviceWorker.register(this.un, i).then(() =>
183
+ navigator.serviceWorker.ready.then(
184
+ (i) => (
185
+ i &&
186
+ "function" == typeof i.update &&
187
+ i.update().catch((i) => {
188
+ r.info("ServiceWorker update failed: " + i);
189
+ }),
190
+ i
191
+ ),
192
+ ),
193
+ );
194
194
  }
195
- xn(i) {
195
+ Nn(i) {
196
196
  this.cn ||
197
197
  (i.unregister(), r.info("Service worker successfully unregistered."));
198
198
  }
199
199
  subscribe(i, t) {
200
200
  if (!yt.isPushSupported())
201
- return r.info(ea.Nn), void ("function" == typeof t && t(!1));
202
- if (this.ln) {
201
+ return r.info(ea.Un), void ("function" == typeof t && t(!1));
202
+ if (this.dn) {
203
203
  if (!this.cn && null != window.location) {
204
204
  let i = this.un;
205
205
  -1 === i.indexOf(window.location.host) &&
206
206
  (i = window.location.host + i),
207
207
  -1 === i.indexOf(window.location.protocol) &&
208
208
  (i = window.location.protocol + "//" + i);
209
- const e = i.substr(0, i.lastIndexOf("/") + 1);
210
- if (0 !== eo.Un().indexOf(e))
211
- return (
212
- r.error(
213
- "Cannot subscribe to push from a path higher than the service worker location (tried to subscribe from " +
214
- window.location.pathname +
215
- " but service worker is at " +
216
- i +
217
- ")",
218
- ),
219
- void ("function" == typeof t && t(!0))
220
- );
221
209
  }
222
210
  if (yt.isPushBlocked())
223
- return void this.Sn(
211
+ return void this.An(
224
212
  "Notifications from this site are blocked. This may be a temporary embargo or a permanent denial.",
225
213
  t,
226
214
  );
227
- if (this.yt && !this.yt.Wn() && 0 === this.yt.ii())
215
+ if (this.qt && !this.qt.Wn() && 0 === this.qt.hi())
228
216
  return (
229
217
  r.info(
230
218
  "Waiting for VAPID key from server config before subscribing to push.",
231
219
  ),
232
- void this.yt._n(() => {
220
+ void this.qt._n(() => {
233
221
  this.subscribe(i, t);
234
222
  })
235
223
  );
@@ -252,7 +240,7 @@ export default class ea {
252
240
  this.sn.setPushNotificationSubscriptionType(
253
241
  User.NotificationSubscriptionTypes.OPTED_IN,
254
242
  ),
255
- this.jn()
243
+ this.xn()
256
244
  .then((e) => {
257
245
  if (null == e)
258
246
  return (
@@ -268,14 +256,14 @@ export default class ea {
268
256
  let u = null;
269
257
  if (
270
258
  (null !=
271
- (null === (n = this.yt) || void 0 === n
259
+ (null === (n = this.qt) || void 0 === n
272
260
  ? void 0
273
- : n.Wn()) && (u = ei.Tn(this.yt.Wn())),
261
+ : n.Wn()) && (u = ei.Tn(this.qt.Wn())),
274
262
  s)
275
263
  ) {
276
264
  let n,
277
265
  a = null,
278
- c = null;
266
+ h = null;
279
267
  if ((this.u && (n = this.u.j(o.C.In)), n && !j(n))) {
280
268
  let i;
281
269
  try {
@@ -287,8 +275,8 @@ export default class ea {
287
275
  isNaN(i.getTime()) ||
288
276
  0 === i.getTime() ||
289
277
  ((a = i),
290
- (c = new Date(a)),
291
- c.setMonth(a.getMonth() + 6));
278
+ (h = new Date(a)),
279
+ h.setMonth(a.getMonth() + 6));
292
280
  }
293
281
  null != u &&
294
282
  s.options &&
@@ -303,30 +291,30 @@ export default class ea {
303
291
  : r.info(
304
292
  "Attempting to upgrade a gcm_sender_id-based push registration to VAPID - depending on the browser this may or may not result in the same gcm_sender_id-based subscription.",
305
293
  ),
306
- this.yn(s, e, u, i, t))
294
+ this.gn(s, e, u, i, t))
307
295
  : s.expirationTime &&
308
296
  new Date(s.expirationTime).valueOf() <=
309
297
  new Date().valueOf()
310
298
  ? (r.info(
311
299
  "Push subscription is expired, creating new subscription.",
312
300
  ),
313
- this.yn(s, e, u, i, t))
301
+ this.gn(s, e, u, i, t))
314
302
  : n && j(n)
315
- ? this.yn(s, e, u, i, t)
316
- : null == c
303
+ ? this.gn(s, e, u, i, t)
304
+ : null == h
317
305
  ? (r.info(
318
306
  "No push subscription creation date found, creating new subscription.",
319
307
  ),
320
- this.yn(s, e, u, i, t))
321
- : c.valueOf() <= new Date().valueOf()
308
+ this.gn(s, e, u, i, t))
309
+ : h.valueOf() <= new Date().valueOf()
322
310
  ? (r.info(
323
311
  "Push subscription older than 6 months, creating new subscription.",
324
312
  ),
325
- this.yn(s, e, u, i, t))
313
+ this.gn(s, e, u, i, t))
326
314
  : (r.info(
327
315
  "Device already subscribed to push, sending existing subscription to backend.",
328
316
  ),
329
- this.gn(s, a, i));
317
+ this.wn(s, a, i));
330
318
  } else this.vn(e, u, i, t);
331
319
  })
332
320
  .catch((i) => {
@@ -338,29 +326,29 @@ export default class ea {
338
326
  });
339
327
  };
340
328
  this.requestPermission(u, s, e);
341
- } else if (this.pn) {
342
- if (null == this.an || "" === this.an)
329
+ } else if (this.bn) {
330
+ if (null == this.hn || "" === this.hn)
343
331
  return (
344
332
  r.error(
345
333
  "You must supply the safariWebsitePushId initialization option in order to use registerPush on Safari",
346
334
  ),
347
335
  void ("function" == typeof t && t(!0))
348
336
  );
349
- const e = window.safari.pushNotification.permission(this.an);
350
- this.An(this.an, e, i, t);
337
+ const e = window.safari.pushNotification.permission(this.hn);
338
+ this.jn(this.hn, e, i, t);
351
339
  }
352
340
  }
353
341
  unsubscribe(i, t) {
354
342
  if (!yt.isPushSupported())
355
- return r.info(ea.Nn), void ("function" == typeof t && t());
356
- this.ln
343
+ return r.info(ea.Un), void ("function" == typeof t && t());
344
+ this.dn
357
345
  ? navigator.serviceWorker.getRegistration(this.un).then((e) => {
358
346
  e
359
347
  ? e.pushManager
360
348
  .getSubscription()
361
349
  .then((s) => {
362
350
  s
363
- ? (this.Pn(),
351
+ ? (this.Dn(),
364
352
  s
365
353
  .unsubscribe()
366
354
  .then((s) => {
@@ -373,7 +361,7 @@ export default class ea {
373
361
  "Failed to unsubscribe device from push.",
374
362
  ),
375
363
  "function" == typeof t && t()),
376
- this.xn(e);
364
+ this.Nn(e);
377
365
  })
378
366
  .catch((i) => {
379
367
  r.error("Push unsubscription error: " + i),
@@ -389,10 +377,10 @@ export default class ea {
389
377
  : (r.info("Device already unsubscribed from push."),
390
378
  "function" == typeof i && i());
391
379
  })
392
- : this.pn &&
393
- (this.Pn(),
380
+ : this.bn &&
381
+ (this.Dn(),
394
382
  r.info("Device unsubscribed from push."),
395
383
  "function" == typeof i && i());
396
384
  }
397
385
  }
398
- ea.Nn = "Push notifications are not supported in this browser.";
386
+ ea.Un = "Push notifications are not supported in this browser.";
@@ -1,15 +1,15 @@
1
1
  const yt = {
2
- dn: () =>
2
+ pn: () =>
3
3
  "serviceWorker" in navigator &&
4
4
  "undefined" != typeof ServiceWorkerRegistration &&
5
5
  "showNotification" in ServiceWorkerRegistration.prototype &&
6
6
  "PushManager" in window,
7
- bn: () =>
7
+ yn: () =>
8
8
  "safari" in window &&
9
9
  "pushNotification" in window.safari &&
10
10
  "function" == typeof window.safari.pushNotification.permission &&
11
11
  "function" == typeof window.safari.pushNotification.requestPermission,
12
- isPushSupported: () => yt.dn() || yt.bn(),
12
+ isPushSupported: () => yt.pn() || yt.yn(),
13
13
  isPushBlocked: () => {
14
14
  const i =
15
15
  yt.isPushSupported() &&
@@ -28,7 +28,7 @@ const yt = {
28
28
  null != window.Notification &&
29
29
  null != window.Notification.permission &&
30
30
  "granted" === window.Notification.permission,
31
- Qi: () =>
31
+ Wi: () =>
32
32
  !yt.isPushBlocked() &&
33
33
  yt.isPushSupported() &&
34
34
  !yt.isPushPermissionGranted(),
@@ -6,7 +6,7 @@ import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
6
6
  import { User } from "../User/index.js";
7
7
  export default class kt {
8
8
  constructor(t, s) {
9
- (this.yt = t), (this.u = s), (this.yt = t), (this.u = s);
9
+ (this.qt = t), (this.u = s), (this.qt = t), (this.u = s);
10
10
  }
11
11
  getUserId() {
12
12
  const t = this.u.tu(o.iu.su);
@@ -24,7 +24,7 @@ export default class kt {
24
24
  this.u.uu(o.iu.su, new _t(t)), s && this.u.ru(t);
25
25
  }
26
26
  setCustomUserAttribute(t, s) {
27
- if (this.yt.hu(t))
27
+ if (this.qt.hu(t))
28
28
  return (
29
29
  r.info('Custom Attribute "' + t + '" is blocklisted, ignoring.'), !1
30
30
  );
@@ -47,17 +47,17 @@ export default class kt {
47
47
  u
48
48
  );
49
49
  }
50
- kn(t, s, i, e, u) {
50
+ Pn(t, s, i, e, u) {
51
51
  this.nu("push_token", t, !1, !0),
52
52
  this.nu("custom_push_public_key", i, !1, !0),
53
53
  this.nu("custom_push_user_auth", e, !1, !0),
54
54
  this.nu("custom_push_vapid_public_key", u, !1, !0);
55
- const h = A.Yt.Qt,
55
+ const h = A.ts.Zt,
56
56
  n = new A(h, r),
57
57
  l = new ti(t, s, i, e, u);
58
- this.u.k(o.C.In, l.Y()), n.setItem(h.ss.cu, h.ie, !0);
58
+ this.u.I(o.C.In, l.Y()), n.setItem(h.hs.cu, h.ie, !0);
59
59
  }
60
- Dn(t) {
60
+ Sn(t) {
61
61
  if (
62
62
  (this.nu("push_token", null, !1, !0),
63
63
  this.nu("custom_push_public_key", null, !1, !0),
@@ -65,9 +65,9 @@ export default class kt {
65
65
  this.nu("custom_push_vapid_public_key", null, !1, !0),
66
66
  t)
67
67
  ) {
68
- const t = A.Yt.Qt,
68
+ const t = A.ts.Zt,
69
69
  s = new A(t, r);
70
- this.u.k(o.C.In, !1), s.setItem(t.ss.cu, t.ie, !1);
70
+ this.u.I(o.C.In, !1), s.setItem(t.hs.cu, t.ie, !1);
71
71
  }
72
72
  }
73
73
  }
package/src/User/user.js CHANGED
@@ -18,10 +18,10 @@ import { SET_CUSTOM_USER_ATTRIBUTE_STRING as $t } from "../common/constants.js";
18
18
  import { toValidBackendTimeString as Bt } from "../util/date-utils.js";
19
19
  export default class User {
20
20
  constructor(t, e) {
21
- (this.wt = t), (this.zi = e), (this.wt = t), (this.zi = e);
21
+ (this.yt = t), (this.Ui = e), (this.yt = t), (this.Ui = e);
22
22
  }
23
23
  getUserId(t) {
24
- const e = this.wt.getUserId();
24
+ const e = this.yt.getUserId();
25
25
  if ("function" != typeof t) return e;
26
26
  r.warn(
27
27
  "The callback for getUserId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getUser().getUserId()`)",
@@ -33,22 +33,22 @@ export default class User {
33
33
  ? (r.error("addAlias requires a non-empty alias"), !1)
34
34
  : !P(e, "add alias", "the label", !1) || e.length <= 0
35
35
  ? (r.error("addAlias requires a non-empty label"), !1)
36
- : this.zi.Cn(t, e).L;
36
+ : this.Ui.Cn(t, e).L;
37
37
  }
38
38
  setFirstName(t) {
39
39
  return (
40
40
  !!P(t, "set first name", "the firstName", !0) &&
41
- this.wt.nu("first_name", t)
41
+ this.yt.nu("first_name", t)
42
42
  );
43
43
  }
44
44
  setLastName(t) {
45
45
  return (
46
- !!P(t, "set last name", "the lastName", !0) && this.wt.nu("last_name", t)
46
+ !!P(t, "set last name", "the lastName", !0) && this.yt.nu("last_name", t)
47
47
  );
48
48
  }
49
49
  setEmail(t) {
50
50
  return null === t || St(t)
51
- ? this.wt.nu("email", t)
51
+ ? this.yt.nu("email", t)
52
52
  : (r.error(
53
53
  `Cannot set email address - "${t}" did not pass RFC-5322 validation.`,
54
54
  ),
@@ -65,12 +65,12 @@ export default class User {
65
65
  `Gender "${t}" is not a valid gender.`,
66
66
  "User.Genders",
67
67
  )
68
- ) && this.wt.nu("gender", t)
68
+ ) && this.yt.nu("gender", t)
69
69
  );
70
70
  }
71
71
  setDateOfBirth(t, e, s) {
72
72
  return null === t && null === e && null === s
73
- ? this.wt.nu("dob", null)
73
+ ? this.yt.nu("dob", null)
74
74
  : ((t = null != t ? parseInt(t.toString()) : null),
75
75
  (e = null != e ? parseInt(e.toString()) : null),
76
76
  (s = null != s ? parseInt(s.toString()) : null),
@@ -88,19 +88,19 @@ export default class User {
88
88
  "Cannot set date of birth - parameters should comprise a valid date e.g. setDateOfBirth(1776, 7, 4);",
89
89
  ),
90
90
  !1)
91
- : this.wt.nu("dob", `${t}-${e}-${s}`));
91
+ : this.yt.nu("dob", `${t}-${e}-${s}`));
92
92
  }
93
93
  setCountry(t) {
94
- return !!P(t, "set country", "the country", !0) && this.wt.nu("country", t);
94
+ return !!P(t, "set country", "the country", !0) && this.yt.nu("country", t);
95
95
  }
96
96
  setHomeCity(t) {
97
97
  return (
98
- !!P(t, "set home city", "the homeCity", !0) && this.wt.nu("home_city", t)
98
+ !!P(t, "set home city", "the homeCity", !0) && this.yt.nu("home_city", t)
99
99
  );
100
100
  }
101
101
  setLanguage(t) {
102
102
  return (
103
- !!P(t, "set language", "the language", !0) && this.wt.nu("language", t)
103
+ !!P(t, "set language", "the language", !0) && this.yt.nu("language", t)
104
104
  );
105
105
  }
106
106
  setEmailNotificationSubscriptionType(t) {
@@ -110,7 +110,7 @@ export default class User {
110
110
  t,
111
111
  `Email notification setting "${t}" is not a valid subscription type.`,
112
112
  "User.NotificationSubscriptionTypes",
113
- ) && this.wt.nu("email_subscribe", t)
113
+ ) && this.yt.nu("email_subscribe", t)
114
114
  );
115
115
  }
116
116
  setPushNotificationSubscriptionType(t) {
@@ -120,14 +120,14 @@ export default class User {
120
120
  t,
121
121
  `Push notification setting "${t}" is not a valid subscription type.`,
122
122
  "User.NotificationSubscriptionTypes",
123
- ) && this.wt.nu("push_subscribe", t)
123
+ ) && this.yt.nu("push_subscribe", t)
124
124
  );
125
125
  }
126
126
  setPhoneNumber(t) {
127
127
  return (
128
128
  !!P(t, "set phone number", "the phoneNumber", !0) &&
129
129
  (null === t || t.match(User.En)
130
- ? this.wt.nu("phone", t)
130
+ ? this.yt.nu("phone", t)
131
131
  : (r.error(`Cannot set phone number - "${t}" did not pass validation.`),
132
132
  !1))
133
133
  );
@@ -162,7 +162,7 @@ export default class User {
162
162
  "Cannot set last-known location - accuracy and altitudeAccuracy may not be negative.",
163
163
  ),
164
164
  !1)
165
- : this.zi.setLastKnownLocation(this.wt.getUserId(), t, e, n, s, i).L);
165
+ : this.Ui.setLastKnownLocation(this.yt.getUserId(), t, e, n, s, i).L);
166
166
  }
167
167
  setCustomUserAttribute(t, e, r) {
168
168
  if (!Ut(t)) return !1;
@@ -179,11 +179,11 @@ export default class User {
179
179
  if (j(e)) {
180
180
  const [r, n] = At(t, e);
181
181
  if (!r && !n && 0 !== e.length) return !1;
182
- if (r || 0 === e.length) return this.zi.Fn(i.$n, t, e).L;
182
+ if (r || 0 === e.length) return this.Ui.Fn(i.$n, t, e).L;
183
183
  for (const t of e) if (!s(t)) return !1;
184
184
  } else if (Ct(e)) {
185
185
  if (!s(e)) return !1;
186
- if (r) return this.zi.Fn(i.Bn, t, e).L;
186
+ if (r) return this.Ui.Fn(i.Bn, t, e).L;
187
187
  } else {
188
188
  if (!(void 0 !== e && Ft(e))) return !1;
189
189
  if (
@@ -197,7 +197,7 @@ export default class User {
197
197
  )
198
198
  return !1;
199
199
  }
200
- return this.wt.setCustomUserAttribute(t, e);
200
+ return this.yt.setCustomUserAttribute(t, e);
201
201
  }
202
202
  addToCustomAttributeArray(t, e) {
203
203
  return (
@@ -206,7 +206,7 @@ export default class User {
206
206
  null != e &&
207
207
  !rt(e, "add to custom user attribute array", "the given value")
208
208
  ) &&
209
- this.zi.Fn(i.Ln, t, e).L
209
+ this.Ui.Fn(i.Ln, t, e).L
210
210
  );
211
211
  }
212
212
  removeFromCustomAttributeArray(t, e) {
@@ -216,7 +216,7 @@ export default class User {
216
216
  null != e &&
217
217
  !rt(e, "remove from custom user attribute array", "the given value")
218
218
  ) &&
219
- this.zi.Fn(i.Rn, t, e).L
219
+ this.Ui.Fn(i.Rn, t, e).L
220
220
  );
221
221
  }
222
222
  incrementCustomUserAttribute(t, e) {
@@ -228,7 +228,7 @@ export default class User {
228
228
  `Cannot increment custom user attribute because the given incrementValue "${e}" is not an integer.`,
229
229
  ),
230
230
  !1)
231
- : this.zi.Fn(i.On, t, s).L;
231
+ : this.Ui.Fn(i.On, t, s).L;
232
232
  }
233
233
  setCustomLocationAttribute(t, e, s) {
234
234
  return (
@@ -244,7 +244,7 @@ export default class User {
244
244
  "Received invalid values for latitude and/or longitude. Latitude and longitude are bounded by ±90 and ±180 respectively, or must both be null for removal.",
245
245
  ),
246
246
  !1)
247
- : this.zi.Gn(t, e, s).L)
247
+ : this.Ui.Gn(t, e, s).L)
248
248
  );
249
249
  }
250
250
  addToSubscriptionGroup(t) {
@@ -258,7 +258,7 @@ export default class User {
258
258
  "addToSubscriptionGroup requires a non-empty subscription group ID",
259
259
  ),
260
260
  !1)
261
- : this.zi.Hn(t, User.Kn.SUBSCRIBED).L;
261
+ : this.Ui.Hn(t, User.Kn.SUBSCRIBED).L;
262
262
  }
263
263
  removeFromSubscriptionGroup(t) {
264
264
  return !P(
@@ -271,13 +271,13 @@ export default class User {
271
271
  "removeFromSubscriptionGroup requires a non-empty subscription group ID",
272
272
  ),
273
273
  !1)
274
- : this.zi.Hn(t, User.Kn.UNSUBSCRIBED).L;
274
+ : this.Ui.Hn(t, User.Kn.UNSUBSCRIBED).L;
275
275
  }
276
- kn(t, e, r, s, n) {
277
- this.wt.kn(t, e, r, s, n), this.zi.Mn();
276
+ Pn(t, e, r, s, n) {
277
+ this.yt.Pn(t, e, r, s, n), this.Ui.Mn();
278
278
  }
279
- Dn(t) {
280
- this.wt.Dn(t);
279
+ Sn(t) {
280
+ this.yt.Sn(t);
281
281
  }
282
282
  }
283
283
  (User.Genders = {
@@ -1,6 +1,6 @@
1
1
  export default class y {
2
2
  constructor() {}
3
- Ns(a) {}
3
+ Ss(a) {}
4
4
  changeUser(a = !1) {}
5
5
  clearData(a = !1) {}
6
6
  }