@braze/web-sdk 6.7.1 → 6.9.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 (138) hide show
  1. package/index.d.ts +165 -38
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +2 -2
  4. package/shared-lib/event-types.js +16 -16
  5. package/shared-lib/indexed-db-adapter.js +65 -65
  6. package/shared-lib/logger.js +18 -18
  7. package/shared-lib/supported-options.js +1 -1
  8. package/src/Banner/banner-provider.js +67 -59
  9. package/src/Banner/banner.js +40 -19
  10. package/src/Banner/dismiss-banner.js +4 -0
  11. package/src/Banner/display/banner-to-html.js +10 -10
  12. package/src/Banner/display/destroy-banner-html.js +2 -2
  13. package/src/Banner/get-all-banners.js +6 -6
  14. package/src/Banner/get-banner.js +6 -6
  15. package/src/Banner/index.js +1 -0
  16. package/src/Banner/log-banner-click.js +7 -7
  17. package/src/Banner/log-banner-dismissal.js +7 -7
  18. package/src/Banner/log-banner-impressions.js +27 -18
  19. package/src/Banner/request-banners-refresh.js +8 -8
  20. package/src/Banner/subscribe-to-banners-updates.js +5 -5
  21. package/src/Banner/ui/insert-banner.js +8 -8
  22. package/src/Card/card-manager.js +31 -31
  23. package/src/Card/log-card-dismissal.js +2 -2
  24. package/src/Card/log-content-card-click.js +2 -2
  25. package/src/Card/log-content-card-impressions.js +4 -4
  26. package/src/Card/models/captioned-image.js +15 -15
  27. package/src/Card/models/card.js +89 -89
  28. package/src/Card/models/classic-card.js +16 -16
  29. package/src/Card/models/control-card.js +7 -7
  30. package/src/Card/models/image-only.js +13 -13
  31. package/src/Card/util/card-factory.js +32 -32
  32. package/src/ContentCards/content-cards-provider-factory.js +13 -11
  33. package/src/ContentCards/content-cards-provider.js +105 -105
  34. package/src/ContentCards/get-cached-content-cards.js +2 -2
  35. package/src/ContentCards/request-content-cards-refresh.js +2 -2
  36. package/src/ContentCards/subscribe-to-content-cards-updates.js +10 -10
  37. package/src/ContentCards/ui/show-content-cards.js +7 -7
  38. package/src/Core/add-sdk-metadata.js +2 -2
  39. package/src/Core/change-user.js +5 -5
  40. package/src/Core/destroy.js +2 -2
  41. package/src/Core/disable-sdk.js +4 -4
  42. package/src/Core/enable-sdk.js +4 -4
  43. package/src/Core/get-device-id.js +2 -2
  44. package/src/Core/handle-braze-action.js +5 -5
  45. package/src/Core/index.js +1 -0
  46. package/src/Core/log-custom-event.js +5 -5
  47. package/src/Core/log-ecommerce-event.js +29 -0
  48. package/src/Core/log-purchase.js +23 -198
  49. package/src/Core/open-session.js +10 -10
  50. package/src/Core/set-logger.js +2 -2
  51. package/src/Core/set-sdk-authentication-signature.js +1 -1
  52. package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
  53. package/src/Core/toggle-logging.js +2 -2
  54. package/src/Core/wipe-data.js +6 -6
  55. package/src/DUST/dust-connection-core.js +1 -0
  56. package/src/DUST/dust-provider-factory.js +10 -10
  57. package/src/DUST/dust-provider.js +258 -226
  58. package/src/DUST/dust-shared-worker-code.js +1 -1
  59. package/src/DUST/dust-shared-worker-impl.js +97 -103
  60. package/src/DUST/dust-worker-bridge.js +55 -40
  61. package/src/DUST/subscribe-to-dust.js +7 -7
  62. package/src/FeatureFlags/feature-flag-factory.js +8 -8
  63. package/src/FeatureFlags/feature-flag.js +3 -3
  64. package/src/FeatureFlags/feature-flags-provider.js +21 -21
  65. package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
  66. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
  67. package/src/InAppMessage/constants.js +3 -3
  68. package/src/InAppMessage/defer-in-app-message.js +3 -3
  69. package/src/InAppMessage/display/html-message-to-html.js +4 -4
  70. package/src/InAppMessage/display/in-app-message-to-html.js +32 -32
  71. package/src/InAppMessage/display/modal-utils.js +2 -2
  72. package/src/InAppMessage/in-app-message-factory.js +36 -36
  73. package/src/InAppMessage/in-app-message-manager.js +35 -35
  74. package/src/InAppMessage/log-in-app-message-button-click.js +3 -3
  75. package/src/InAppMessage/log-in-app-message-click.js +3 -3
  76. package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
  77. package/src/InAppMessage/log-in-app-message-impression.js +3 -3
  78. package/src/InAppMessage/models/control-message.js +4 -4
  79. package/src/InAppMessage/models/full-screen-message.js +9 -9
  80. package/src/InAppMessage/models/html-message.js +2 -2
  81. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  82. package/src/InAppMessage/models/in-app-message.js +34 -34
  83. package/src/InAppMessage/models/modal-message.js +7 -7
  84. package/src/InAppMessage/models/slide-up-message.js +8 -8
  85. package/src/InAppMessage/ui/show-in-app-message.js +20 -20
  86. package/src/Push/push-manager.js +44 -44
  87. package/src/User/user-manager.js +19 -19
  88. package/src/User/user.js +17 -17
  89. package/src/common/base-provider.js +1 -1
  90. package/src/common/constants.js +1 -0
  91. package/src/common/content-cards-display.js +6 -6
  92. package/src/common/event-logger.js +3 -3
  93. package/src/common/properties-base.js +3 -3
  94. package/src/l10n/l10n-manager.js +2 -2
  95. package/src/managers/auth-manager.js +11 -11
  96. package/src/managers/braze-instance.js +59 -59
  97. package/src/managers/device-manager.js +9 -9
  98. package/src/managers/network-manager.js +65 -63
  99. package/src/managers/server-config-manager.js +110 -93
  100. package/src/managers/session-manager.js +20 -20
  101. package/src/managers/storage-manager-factory.js +9 -9
  102. package/src/managers/storage-manager.js +137 -137
  103. package/src/managers/subscription-manager.js +2 -2
  104. package/src/managers/utils.js +1 -1
  105. package/src/models/braze-event.js +2 -2
  106. package/src/models/identifier.js +5 -5
  107. package/src/models/push-token.js +8 -8
  108. package/src/models/request-result.js +1 -1
  109. package/src/models/server-config.js +46 -28
  110. package/src/request-controller.js +124 -124
  111. package/src/triggers/models/custom-event-data.js +4 -4
  112. package/src/triggers/models/custom-event-property-data.js +5 -5
  113. package/src/triggers/models/filter-set.js +2 -2
  114. package/src/triggers/models/filter.js +1 -1
  115. package/src/triggers/models/in-app-message-click-data.js +5 -5
  116. package/src/triggers/models/purchase-data.js +1 -1
  117. package/src/triggers/models/purchase-property-data.js +2 -2
  118. package/src/triggers/models/push-click-data.js +5 -5
  119. package/src/triggers/models/trigger-condition.js +45 -45
  120. package/src/triggers/models/trigger-events.js +3 -3
  121. package/src/triggers/models/trigger.js +30 -30
  122. package/src/triggers/triggers-provider.js +63 -63
  123. package/src/types.js +5 -1
  124. package/src/ui/js/attach-css.js +1 -1
  125. package/src/util/braze-actions.js +6 -6
  126. package/src/util/browser-detector.js +13 -13
  127. package/src/util/client-hints-parser.js +5 -5
  128. package/src/util/code-utils.js +2 -2
  129. package/src/util/deprecation-utils.js +2 -2
  130. package/src/util/dom-utils.js +8 -8
  131. package/src/util/ecommerce-event-validation.js +343 -0
  132. package/src/util/html-display-utils.js +11 -11
  133. package/src/util/iso-4217-currency-codes.js +176 -0
  134. package/src/util/net.js +4 -4
  135. package/src/util/request-header-utils.js +10 -10
  136. package/src/util/string-utils.js +2 -2
  137. package/src/util/user-agent-parser.js +15 -15
  138. package/src/util/validation-utils.js +14 -14
package/src/User/user.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  isObject as Ct,
5
5
  validateValueIsFromEnum as ta,
6
6
  } from "../util/code-utils.js";
7
- import { logger as E, EventTypes as p } from "../../shared-lib/index.js";
7
+ import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
8
8
  import {
9
9
  isValidEmail as At,
10
10
  validateCustomAttributeArrayType as Dt,
@@ -23,16 +23,16 @@ export default class User {
23
23
  getUserId(t) {
24
24
  const e = this.Ss.getUserId();
25
25
  if ("function" != typeof t) return e;
26
- E.warn(
26
+ b.warn(
27
27
  "The callback for getUserId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getUser().getUserId()`)",
28
28
  ),
29
29
  t(e);
30
30
  }
31
31
  addAlias(t, e) {
32
32
  return !tr(t, "add alias", "the alias", !1) || t.length <= 0
33
- ? (E.error("addAlias requires a non-empty alias"), !1)
33
+ ? (b.error("addAlias requires a non-empty alias"), !1)
34
34
  : !tr(e, "add alias", "the label", !1) || e.length <= 0
35
- ? (E.error("addAlias requires a non-empty label"), !1)
35
+ ? (b.error("addAlias requires a non-empty label"), !1)
36
36
  : this.Ru.Gu(t, e).lt;
37
37
  }
38
38
  setFirstName(t) {
@@ -49,7 +49,7 @@ export default class User {
49
49
  setEmail(t) {
50
50
  return null === t || At(t)
51
51
  ? this.Ss.zu("email", t)
52
- : (E.error(
52
+ : (b.error(
53
53
  `Cannot set email address - "${t}" did not pass RFC-5322 validation.`,
54
54
  ),
55
55
  !1);
@@ -84,7 +84,7 @@ export default class User {
84
84
  e < 1 ||
85
85
  r > 31 ||
86
86
  r < 1
87
- ? (E.error(
87
+ ? (b.error(
88
88
  "Cannot set date of birth - parameters should comprise a valid date e.g. setDateOfBirth(1776, 7, 4);",
89
89
  ),
90
90
  !1)
@@ -130,13 +130,13 @@ export default class User {
130
130
  !!tr(t, "set phone number", "the phoneNumber", !0) &&
131
131
  (null === t || t.match(User.Hu)
132
132
  ? this.Ss.zu("phone", t)
133
- : (E.error(`Cannot set phone number - "${t}" did not pass validation.`),
133
+ : (b.error(`Cannot set phone number - "${t}" did not pass validation.`),
134
134
  !1))
135
135
  );
136
136
  }
137
137
  setLastKnownLocation(t, e, r, s, n) {
138
138
  return null == t || null == e
139
- ? (E.error(
139
+ ? (b.error(
140
140
  "Cannot set last-known location - latitude and longitude are required.",
141
141
  ),
142
142
  !1)
@@ -150,17 +150,17 @@ export default class User {
150
150
  (null != r && isNaN(r)) ||
151
151
  (null != s && isNaN(s)) ||
152
152
  (null != n && isNaN(n))
153
- ? (E.error(
153
+ ? (b.error(
154
154
  "Cannot set last-known location - all supplied parameters must be numeric.",
155
155
  ),
156
156
  !1)
157
157
  : t > 90 || t < -90 || e > 180 || e < -180
158
- ? (E.error(
158
+ ? (b.error(
159
159
  "Cannot set last-known location - latitude and longitude are bounded by ±90 and ±180 respectively.",
160
160
  ),
161
161
  !1)
162
162
  : (null != r && r < 0) || (null != n && n < 0)
163
- ? (E.error(
163
+ ? (b.error(
164
164
  "Cannot set last-known location - accuracy and altitudeAccuracy may not be negative.",
165
165
  ),
166
166
  !1)
@@ -227,7 +227,7 @@ export default class User {
227
227
  null == e && (e = 1);
228
228
  const r = parseInt(e.toString());
229
229
  return isNaN(r) || r !== parseFloat(e.toString())
230
- ? (E.error(
230
+ ? (b.error(
231
231
  `Cannot increment custom user attribute because the given incrementValue "${e}" is not an integer.`,
232
232
  ),
233
233
  !1)
@@ -243,7 +243,7 @@ export default class User {
243
243
  (null != e && null == r) ||
244
244
  (null != e && (isNaN(e) || e > 90 || e < -90)) ||
245
245
  (null != r && (isNaN(r) || r > 180 || r < -180)))
246
- ? (E.error(
246
+ ? (b.error(
247
247
  "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.",
248
248
  ),
249
249
  !1)
@@ -257,7 +257,7 @@ export default class User {
257
257
  "subscription group ID",
258
258
  !1,
259
259
  ) || t.length <= 0
260
- ? (E.error(
260
+ ? (b.error(
261
261
  "addToSubscriptionGroup requires a non-empty subscription group ID",
262
262
  ),
263
263
  !1)
@@ -270,7 +270,7 @@ export default class User {
270
270
  "subscription group ID",
271
271
  !1,
272
272
  ) || t.length <= 0
273
- ? (E.error(
273
+ ? (b.error(
274
274
  "removeFromSubscriptionGroup requires a non-empty subscription group ID",
275
275
  ),
276
276
  !1)
@@ -280,12 +280,12 @@ export default class User {
280
280
  return tr(t, "set LINE user ID", "the ID", !0) &&
281
281
  0 !== (null == t ? void 0 : t.length)
282
282
  ? t && t.length > User.Ca
283
- ? (E.error(
283
+ ? (b.error(
284
284
  `Rejected LINE user ID ${t} because it is longer than ${User.Ca} characters.`,
285
285
  ),
286
286
  !1)
287
287
  : this.Ss.zu("native_line_id", t)
288
- : (E.error("setLineId requires a non-empty ID"), !1);
288
+ : (b.error("setLineId requires a non-empty ID"), !1);
289
289
  }
290
290
  gu(t, e, r, s, n) {
291
291
  this.Ss.gu(t, e, r, s, n), this.Ru.Ea();
@@ -1,6 +1,6 @@
1
1
  export default class t {
2
2
  constructor() {}
3
- I(a) {}
3
+ q(a) {}
4
4
  changeUser(a = !1) {}
5
5
  clearData(a = !1) {}
6
6
  }
@@ -12,5 +12,6 @@ export const REQUEST_BACKOFF_MAX_SLEEP_MS_DEFAULT = 3e5;
12
12
  export const CoreStrings = {
13
13
  ee: "Braze must be initialized before calling methods.",
14
14
  je: "logCustomEvent",
15
+ QE: "logEcommerceEvent",
15
16
  Ku: "setCustomUserAttribute",
16
17
  };
@@ -9,7 +9,7 @@ import { isArray as g } from "../util/code-utils.js";
9
9
  import { KeyCodes as Ce } from "../util/key-codes.js";
10
10
  import Je from "../l10n/l10n-manager-factory.js";
11
11
  import { removeSubscription } from "../Core/remove-subscription.js";
12
- import { logger as E, Guid as V } from "../../shared-lib/index.js";
12
+ import { logger as b, Guid as V } from "../../shared-lib/index.js";
13
13
  import { BRAZE_ACTION_URI_REGEX as to } from "../util/validation-utils.js";
14
14
  import {
15
15
  INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as bt,
@@ -23,7 +23,7 @@ import {
23
23
  impressOnTop as B,
24
24
  topHadImpression as Bt,
25
25
  } from "./detect-impression.js";
26
- import { BannerStrings as j } from "../Banner/constants.js";
26
+ import { BannerStrings as x } from "../Banner/constants.js";
27
27
  import ContentCards from "../ContentCards/content-cards.js";
28
28
  export const LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE =
29
29
  "data-last-requested-refresh";
@@ -35,7 +35,7 @@ export function destroyContentCardsHtml(t) {
35
35
  setTimeout(() => {
36
36
  t && t.parentNode && t.parentNode.removeChild(t);
37
37
  }, ContentCards.gr));
38
- const e = t.getAttribute(j.ea);
38
+ const e = t.getAttribute(x.ea);
39
39
  null != e && removeSubscription(e);
40
40
  const n = t.getAttribute("data-listener-id");
41
41
  null != n &&
@@ -64,7 +64,7 @@ export function generateContentCardsUI(t, e) {
64
64
  const i = a instanceof ControlCard;
65
65
  !i || t.hr()
66
66
  ? (o.appendChild(qt(a, r, e, n.wa())), (s = s || !i))
67
- : E.error(
67
+ : b.error(
68
68
  "Received a control card for a legacy news feed. Control cards are only supported with content cards.",
69
69
  );
70
70
  }
@@ -188,7 +188,7 @@ export function updateContentCards(t, e, n, o, s) {
188
188
  if (t.url && to.test(t.url)) {
189
189
  const e = eo(t.url);
190
190
  if (vt(e)) {
191
- E.error(yt(bt.Un, "Content Card"));
191
+ b.error(yt(bt.Un, "Content Card"));
192
192
  continue;
193
193
  }
194
194
  }
@@ -207,5 +207,5 @@ export function updateContentCards(t, e, n, o, s) {
207
207
  }
208
208
  }
209
209
  export function registerContentCardsSubscriptionId(t, e) {
210
- t && e.setAttribute(j.ea, t);
210
+ t && e.setAttribute(x.ea, t);
211
211
  }
@@ -1,15 +1,15 @@
1
- import { logger as E } from "../../shared-lib/index.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
2
  import r from "../managers/braze-instance.js";
3
3
  import Ie from "../models/braze-event.js";
4
4
  import L from "../models/request-result.js";
5
5
  const v = {
6
- wt: (e, o, t) => {
6
+ Dt: (e, o, t) => {
7
7
  var n, s;
8
8
  const i = new L(),
9
9
  l = r.u();
10
10
  if (!l)
11
11
  return (
12
- E.info(
12
+ b.info(
13
13
  `Not logging event with type "${e}" because the current session ID could not be found.`,
14
14
  ),
15
15
  i
@@ -1,4 +1,4 @@
1
- import { logger as E } from "../../shared-lib/index.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
2
  export class PropertiesBase {
3
3
  constructor(t) {
4
4
  (this.properties = t), (this.properties = t || {});
@@ -26,10 +26,10 @@ export class PropertiesBase {
26
26
  return this.tp(t, this.up, "datetime");
27
27
  }
28
28
  ep(t) {
29
- E.info(`Property is not of type ${t}.`);
29
+ b.info(`Property is not of type ${t}.`);
30
30
  }
31
31
  rp(t) {
32
- E.info(`${t} not found in properties.`);
32
+ b.info(`${t} not found in properties.`);
33
33
  }
34
34
  op(t) {
35
35
  return "string" === t.type && "string" == typeof t.value;
@@ -1,4 +1,4 @@
1
- import { logger as E } from "../../shared-lib/index.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
2
  import zt from "../common/translations.js";
3
3
  export default class gr {
4
4
  constructor(t, e = !1) {
@@ -15,7 +15,7 @@ export default class gr {
15
15
  "Braze does not yet have a localization for language " +
16
16
  t +
17
17
  ", defaulting to English. Please contact us if you are willing and able to help us translate our SDK into this language.";
18
- e ? E.error(a) : E.info(a), (t = "en");
18
+ e ? b.error(a) : b.info(a), (t = "en");
19
19
  }
20
20
  this.language = t;
21
21
  }
@@ -1,12 +1,12 @@
1
1
  import { STORAGE_KEYS as s } from "./storage-manager.js";
2
2
  import f from "./subscription-manager.js";
3
- import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
3
+ import { logger as b, IndexedDBAdapter as et } from "../../shared-lib/index.js";
4
4
  export default class Gt {
5
5
  constructor(t, i, s) {
6
- (this.C = t),
6
+ (this.j = t),
7
7
  (this.gh = i),
8
8
  (this.bh = s),
9
- (this.C = t),
9
+ (this.j = t),
10
10
  (this.gh = i || !1),
11
11
  (this.bh = s),
12
12
  (this.Sh = new f()),
@@ -17,21 +17,21 @@ export default class Gt {
17
17
  return this.gh;
18
18
  }
19
19
  kh() {
20
- return this.C.Rt(s.Tt.fh);
20
+ return this.j.St(s.It.fh);
21
21
  }
22
22
  setSdkAuthenticationSignature(t) {
23
23
  const i = this.kh();
24
- this.C.It(s.Tt.fh, t);
25
- const e = et.Ps.$s;
26
- new et(e, E).setItem(e.Os.wh, this.ph, t), i !== t && this.ct();
24
+ this.j.Pt(s.It.fh, t);
25
+ const e = et._s.Xs;
26
+ new et(e, b).setItem(e.Ws.wh, this.ph, t), i !== t && this.ct();
27
27
  }
28
28
  jh() {
29
- this.C.Qt(s.Tt.fh);
30
- const t = et.Ps.$s;
31
- new et(t, E).ge(t.Os.wh, this.ph);
29
+ this.j.Vt(s.It.fh);
30
+ const t = et._s.Xs;
31
+ new et(t, b).ge(t.Ws.wh, this.ph);
32
32
  }
33
33
  subscribeToSdkAuthenticationFailures(t) {
34
- return this.bh.Kt(t);
34
+ return this.bh.Ut(t);
35
35
  }
36
36
  Ch(t) {
37
37
  this.bh.A(t);
@@ -5,7 +5,7 @@ import Pt from "./device-manager.js";
5
5
  import DeviceProperties from "../Core/device-properties.js";
6
6
  import {
7
7
  isArray as g,
8
- keys as D,
8
+ keys as C,
9
9
  validateValueIsFromEnum as ta,
10
10
  values as Wt,
11
11
  } from "../util/code-utils.js";
@@ -17,14 +17,14 @@ import ne, { STORAGE_KEYS as s } from "./storage-manager.js";
17
17
  import Zt from "./storage-manager-factory.js";
18
18
  import f from "./subscription-manager.js";
19
19
  import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
20
- import sr from "../DUST/dust-provider-factory.js";
20
+ import dr from "../DUST/dust-provider-factory.js";
21
21
  import { subscribeToDust as Qt } from "../DUST/subscribe-to-dust.js";
22
22
  import Ut from "../User/user-manager.js";
23
23
  import { User } from "../User/index.js";
24
24
  import { parseQueryStringKeyValues as lt } from "../util/url-utils.js";
25
25
  import { WindowUtils as no } from "../util/window-utils.js";
26
26
  import { CoreStrings as R } from "../common/constants.js";
27
- import { SupportedOptions as hi, logger as E } from "../../shared-lib/index.js";
27
+ import { SupportedOptions as li, logger as b } from "../../shared-lib/index.js";
28
28
  import _t from "../models/identifier.js";
29
29
  const U = {
30
30
  _h: "allowCrawlerActivity",
@@ -52,10 +52,10 @@ const U = {
52
52
  Uh: "doNotLoadFontAwesome",
53
53
  Wh: "deviceId",
54
54
  ya: "serviceWorkerScope",
55
- Qe: "dustHost",
55
+ Ye: "dustHost",
56
56
  Bh: "sdkFlavor",
57
57
  };
58
- class li {
58
+ class ci {
59
59
  constructor() {
60
60
  (this.tu = ""),
61
61
  (this.Vh = ""),
@@ -65,8 +65,8 @@ class li {
65
65
  (this.B = null),
66
66
  (this.Ru = null),
67
67
  (this.h = null),
68
- (this.j = null),
69
68
  (this.C = null),
69
+ (this.j = null),
70
70
  (this.Ss = null),
71
71
  (this.Yh = ""),
72
72
  (this.isInitialized = !1),
@@ -77,34 +77,34 @@ class li {
77
77
  (this.Jh = []),
78
78
  (this.Xh = []),
79
79
  (this.In = []),
80
- (this.Vh = "6.7.1");
80
+ (this.Vh = "6.9.0");
81
81
  }
82
82
  Zh(t) {
83
- this.qh.Kt(t);
83
+ this.qh.Ut(t);
84
84
  }
85
85
  uh(t) {
86
- this.Hh.Kt(t);
86
+ this.Hh.Ut(t);
87
87
  }
88
88
  initialize(t, i) {
89
89
  var e, r, o;
90
90
  if (this.ao())
91
- return E.info("Braze has already been initialized with an API key."), !0;
91
+ return b.info("Braze has already been initialized with an API key."), !0;
92
92
  this.options = i || {};
93
93
  let n = this.er(U.Rh);
94
94
  const h = lt(no.Qh());
95
95
  if (
96
96
  (h && "true" === h.brazeLogging && (n = !0),
97
- E.init(n),
98
- E.info(
97
+ b.init(n),
98
+ b.info(
99
99
  `Initialization Options: ${JSON.stringify(this.options, null, 2)}`,
100
100
  ),
101
101
  null == t || "" === t || "string" != typeof t)
102
102
  )
103
- return E.error("Braze requires a valid API key to be initialized."), !1;
103
+ return b.error("Braze requires a valid API key to be initialized."), !1;
104
104
  this.tu = t;
105
105
  let l = this.er(U.Nh);
106
106
  if (null == l || "" === l || "string" != typeof l)
107
- return E.error("Braze requires a valid baseUrl to be initialized."), !1;
107
+ return b.error("Braze requires a valid baseUrl to be initialized."), !1;
108
108
  !1 === /^https?:/.test(l) && (l = `https://${l}`);
109
109
  const a = l;
110
110
  if (
@@ -115,7 +115,7 @@ class li {
115
115
  ro.il && !this.er(U._h))
116
116
  )
117
117
  return (
118
- E.info("Ignoring activity from crawler bot " + navigator.userAgent),
118
+ b.info("Ignoring activity from crawler bot " + navigator.userAgent),
119
119
  (this.$h = !0),
120
120
  !1
121
121
  );
@@ -123,26 +123,26 @@ class li {
123
123
  c = this.er(U.se),
124
124
  m = Zt.sl();
125
125
  if (
126
- ((this.C = Zt.rl(t, u, c)),
127
- u && this.C.hl(t),
126
+ ((this.j = Zt.rl(t, u, c)),
127
+ u && this.j.hl(t),
128
128
  new ne.le(null, !0).wr(s.ce))
129
129
  )
130
130
  return (
131
- E.info("Ignoring all activity due to previous opt out"),
131
+ b.info("Ignoring all activity due to previous opt out"),
132
132
  (this.$h = !0),
133
133
  !1
134
134
  );
135
- for (const t of D(this.options))
136
- -1 === Wt(hi).indexOf(t) &&
137
- E.warn(`Ignoring unknown initialization option '${t}'.`);
135
+ for (const t of C(this.options))
136
+ -1 === Wt(li).indexOf(t) &&
137
+ b.warn(`Ignoring unknown initialization option '${t}'.`);
138
138
  const p = ["mparticle", "wordpress", "tealium"];
139
139
  if (null != this.er(U.Bh)) {
140
140
  const t = this.er(U.Bh);
141
141
  -1 !== p.indexOf(t)
142
142
  ? (this.Kh = t)
143
- : E.error("Invalid sdk flavor passed: " + t);
143
+ : b.error("Invalid sdk flavor passed: " + t);
144
144
  }
145
- let d = this.er(hi.Th);
145
+ let d = this.er(li.Th);
146
146
  if (null != d)
147
147
  if (g(d)) {
148
148
  const t = [];
@@ -155,28 +155,28 @@ class li {
155
155
  ) && t.push(d[i]);
156
156
  d = t;
157
157
  } else
158
- E.error(
158
+ b.error(
159
159
  "devicePropertyAllowlist must be an array. Defaulting to all properties.",
160
160
  ),
161
161
  (d = null);
162
- const I = this.er(U.Wh);
163
- if (I) {
164
- const t = new _t(I);
165
- this.C.Iu(s.Ou.Wh, t);
162
+ const E = this.er(U.Wh);
163
+ if (E) {
164
+ const t = new _t(E);
165
+ this.j.Iu(s.Ou.Wh, t);
166
166
  }
167
- (this.eu = new Pt(this.C, d)),
168
- (this.h = new Yt(this.C)),
169
- (this.Ss = new Ut(this.h, this.C)),
170
- (this.j = new Xt(this.C, this.Ss, this.h, this.er(U.Lh)));
171
- const _ = new f();
172
- (this.Gh = new Gt(this.C, this.er(U.Ph), _)),
173
- this.S(_),
167
+ (this.eu = new Pt(this.j, d)),
168
+ (this.h = new Yt(this.j)),
169
+ (this.Ss = new Ut(this.h, this.j)),
170
+ (this.C = new Xt(this.j, this.Ss, this.h, this.er(U.Lh)));
171
+ const I = new f();
172
+ (this.Gh = new Gt(this.j, this.er(U.Ph), I)),
173
+ this.S(I),
174
174
  (this.B = new Vt(
175
175
  this.eu,
176
- this.C,
176
+ this.j,
177
177
  this.Gh,
178
178
  this.Ss,
179
- this.j,
179
+ this.C,
180
180
  this.h,
181
181
  this.tu,
182
182
  this.Yh,
@@ -188,20 +188,20 @@ class li {
188
188
  (this.Ru = new Kt(
189
189
  this.tu,
190
190
  this.Yh,
191
- this.j,
191
+ this.C,
192
192
  this.eu,
193
193
  this.Ss,
194
194
  this.h,
195
- this.C,
195
+ this.j,
196
196
  (t) => {
197
- if (this.ao()) for (const i of this.vr()) i.I(t);
197
+ if (this.ao()) for (const i of this.vr()) i.q(t);
198
198
  },
199
199
  this.Gh,
200
200
  this.B,
201
201
  )),
202
202
  this.Ru.initialize(),
203
- u || this.C.ll(),
204
- E.info(
203
+ u || this.j.ll(),
204
+ b.info(
205
205
  `Initialized for the Braze backend at "${this.er(
206
206
  U.Nh,
207
207
  )}" with API key "${this.tu}".`,
@@ -229,21 +229,21 @@ class li {
229
229
  this.qh.A(this.options),
230
230
  (this.isInitialized = !0),
231
231
  window.dispatchEvent(new CustomEvent("braze.initialized"));
232
- const S = null === (e = this.j) || void 0 === e ? void 0 : e.al();
232
+ const _ = null === (e = this.C) || void 0 === e ? void 0 : e.al();
233
233
  return (
234
234
  m ||
235
- null == S ||
236
- (null === (r = this.j) || void 0 === r
235
+ null == _ ||
236
+ (null === (r = this.C) || void 0 === r
237
237
  ? void 0
238
- : r.ul(new Date().valueOf(), S)) ||
238
+ : r.ul(new Date().valueOf(), _)) ||
239
239
  null === (o = this.Ru) ||
240
240
  void 0 === o ||
241
- o.Sr(),
241
+ o.Ar(),
242
242
  !0
243
243
  );
244
244
  }
245
245
  destroy(t) {
246
- if ((E.destroy(), this.ao())) {
246
+ if ((b.destroy(), this.ao())) {
247
247
  this.Hh.A(), this.Hh.removeAllSubscriptions();
248
248
  for (const t of this.Jh) t.destroy();
249
249
  this.Jh = [];
@@ -258,13 +258,13 @@ class li {
258
258
  (this.eu = null),
259
259
  (this.B = null),
260
260
  (this.h = null),
261
- (this.j = null),
261
+ (this.C = null),
262
262
  (this.Ss = null),
263
263
  (this.options = {}),
264
264
  (this.Kh = void 0),
265
265
  (this.isInitialized = !1),
266
266
  (this.$h = !1),
267
- t && (this.C = null);
267
+ t && (this.j = null);
268
268
  }
269
269
  }
270
270
  rr() {
@@ -273,7 +273,7 @@ class li {
273
273
  za() {
274
274
  return this.tu;
275
275
  }
276
- Br() {
276
+ Er() {
277
277
  return this.Gh;
278
278
  }
279
279
  ht() {
@@ -298,10 +298,10 @@ class li {
298
298
  return this.h;
299
299
  }
300
300
  u() {
301
- return this.j;
301
+ return this.C;
302
302
  }
303
303
  p() {
304
- return this.C;
304
+ return this.j;
305
305
  }
306
306
  zr() {
307
307
  if (this.Ss && this.Ru) return new User(this.Ss, this.Ru);
@@ -309,7 +309,7 @@ class li {
309
309
  ir() {
310
310
  return this.Ss;
311
311
  }
312
- ar() {
312
+ dr() {
313
313
  return !0 === this.er(U.nr);
314
314
  }
315
315
  g(t) {
@@ -340,13 +340,13 @@ class li {
340
340
  cl() {
341
341
  return this.$h;
342
342
  }
343
- dr(t, i) {
343
+ ar(t, i) {
344
344
  if (!this.rr()) return null;
345
- return sr.o().Ze(t, i);
345
+ return dr.o().on(t, i);
346
346
  }
347
- zi() {
347
+ qi() {
348
348
  return this.Vh;
349
349
  }
350
350
  }
351
- const r = new li();
352
- export { r as default, li as BrazeSdkInstance, U as OPTIONS };
351
+ const r = new ci();
352
+ export { r as default, ci as BrazeSdkInstance, U as OPTIONS };
@@ -2,21 +2,21 @@ import ro from "../util/browser-detector.js";
2
2
  import Se from "../models/device.js";
3
3
  import DeviceProperties from "../Core/device-properties.js";
4
4
  import _t from "../models/identifier.js";
5
- import { logger as E, Guid as V } from "../../shared-lib/index.js";
5
+ import { logger as b, Guid as V } from "../../shared-lib/index.js";
6
6
  import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
7
7
  import { values as Wt } from "../util/code-utils.js";
8
- import { getErrorMessage as ai } from "../util/error-utils.js";
8
+ import { getErrorMessage as hi } from "../util/error-utils.js";
9
9
  export default class Pt {
10
10
  constructor(t, e) {
11
- (this.C = t),
11
+ (this.j = t),
12
12
  (this.Da = e),
13
- (this.C = t),
13
+ (this.j = t),
14
14
  null == e && (e = Wt(DeviceProperties)),
15
15
  (this.Da = e);
16
16
  }
17
17
  ve(t = !0) {
18
- let e = this.C.$u(s.Ou.Wh);
19
- null == e && ((e = new _t(V.de())), t && this.C.Iu(s.Ou.Wh, e));
18
+ let e = this.j.$u(s.Ou.Wh);
19
+ null == e && ((e = new _t(V.de())), t && this.j.Iu(s.Ou.Wh, e));
20
20
  const r = new Se(e.Tu);
21
21
  for (let t = 0; t < this.Da.length; t++) {
22
22
  switch (this.Da[t]) {
@@ -46,7 +46,7 @@ export default class Pt {
46
46
  }
47
47
  Fa() {
48
48
  if (ro.Aa()) return ro.Aa();
49
- const t = this.C.Rt(s.Tt.Ba);
49
+ const t = this.j.St(s.It.Ba);
50
50
  return t && t.os_version ? t.os_version : ro.Fa();
51
51
  }
52
52
  Ja(t) {
@@ -58,9 +58,9 @@ export default class Pt {
58
58
  if (null != t && "" !== t) return t;
59
59
  }
60
60
  } catch (t) {
61
- E.info(
61
+ b.info(
62
62
  "Intl.DateTimeFormat threw an error, cannot detect user's time zone:" +
63
- ai(t),
63
+ hi(t),
64
64
  ),
65
65
  (e = !0);
66
66
  }