@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
@@ -1,11 +1,11 @@
1
1
  import { logger as r } from "../../shared-lib/index.js";
2
2
  import e from "../managers/braze-instance.js";
3
- import ue from "../models/braze-event.js";
4
- import t from "../models/request-result.js";
5
- const s = {
6
- q: (o, n, s) => {
3
+ import ve from "../models/braze-event.js";
4
+ import s from "../models/request-result.js";
5
+ const t = {
6
+ q: (o, t, n) => {
7
7
  var i, l;
8
- const d = new t(),
8
+ const d = new s(),
9
9
  m = e.zr();
10
10
  if (!m)
11
11
  return (
@@ -14,21 +14,21 @@ const s = {
14
14
  ),
15
15
  d
16
16
  );
17
- const u = m.wo();
17
+ const u = m.xo();
18
18
  return (
19
19
  d.ge.push(
20
- new ue(
21
- s || (null === (i = e.er()) || void 0 === i ? void 0 : i.getUserId()),
20
+ new ve(
21
+ n || (null === (i = e.er()) || void 0 === i ? void 0 : i.getUserId()),
22
22
  o,
23
23
  new Date().valueOf(),
24
24
  u,
25
- n,
25
+ t,
26
26
  ),
27
27
  ),
28
28
  (d.L =
29
- (null === (l = e.l()) || void 0 === l ? void 0 : l.xo(d.ge)) || !1),
29
+ (null === (l = e.l()) || void 0 === l ? void 0 : l.zo(d.ge)) || !1),
30
30
  d
31
31
  );
32
32
  },
33
33
  };
34
- export default s;
34
+ export default t;
@@ -12,7 +12,7 @@ import { Card, ControlCard } from "../Card/index.js";
12
12
  import { cardToHtml as _e } from "../Card/display/card-display.js";
13
13
  import { isArray as j } from "../util/code-utils.js";
14
14
  import { KeyCodes as mt } from "../util/key-codes.js";
15
- import je from "../l10n/l10n-manager-factory.js";
15
+ import ue from "../l10n/l10n-manager-factory.js";
16
16
  import { removeSubscription } from "../Core/remove-subscription.js";
17
17
  import { logger as r, Guid as p } from "../../shared-lib/index.js";
18
18
  import { BRAZE_ACTION_URI_REGEX as Z } from "../util/validation-utils.js";
@@ -41,11 +41,12 @@ export function destroyFeedHtml(e) {
41
41
  delete scrollListeners[o]);
42
42
  }
43
43
  export function generateFeedBody(e, t) {
44
- const o = document.createElement("div");
44
+ const o = ue.m(),
45
+ s = document.createElement("div");
45
46
  if (
46
- ((o.className = "ab-feed-body"),
47
- o.setAttribute("aria-label", "Feed"),
48
- o.setAttribute("role", "feed"),
47
+ ((s.className = "ab-feed-body"),
48
+ s.setAttribute("aria-label", "Feed"),
49
+ s.setAttribute("role", "feed"),
49
50
  null == e.lastUpdated)
50
51
  ) {
51
52
  const e = document.createElement("div");
@@ -53,27 +54,27 @@ export function generateFeedBody(e, t) {
53
54
  const t = document.createElement("i");
54
55
  (t.className = "fa fa-spinner fa-spin fa-4x ab-initial-spinner"),
55
56
  e.appendChild(t),
56
- o.appendChild(e);
57
+ s.appendChild(e);
57
58
  } else {
58
- let s = !1;
59
+ let n = !1;
59
60
  const logCardClick = (t) => e.logCardClick(t);
60
- for (const n of e.cards) {
61
- const i = n instanceof ControlCard;
62
- !i || e.dr()
63
- ? (o.appendChild(_e(n, logCardClick, t)), (s = s || !i))
61
+ for (const i of e.cards) {
62
+ const a = i instanceof ControlCard;
63
+ !a || e.dr()
64
+ ? (s.appendChild(_e(i, logCardClick, t, o.wo())), (n = n || !a))
64
65
  : r.error(
65
66
  "Received a control card for a legacy news feed. Control cards are only supported with content cards.",
66
67
  );
67
68
  }
68
- if (!s) {
69
+ if (!n) {
69
70
  const e = document.createElement("div");
70
71
  (e.className = "ab-no-cards-message"),
71
- (e.innerHTML = je.m().get("NO_CARDS_MESSAGE") || ""),
72
+ (e.innerHTML = o.get("NO_CARDS_MESSAGE") || ""),
72
73
  e.setAttribute("role", "article"),
73
- o.appendChild(e);
74
+ s.appendChild(e);
74
75
  }
75
76
  }
76
- return o;
77
+ return s;
77
78
  }
78
79
  export function detectFeedImpressions(e, t) {
79
80
  if (null != e && null != t) {
@@ -123,7 +124,7 @@ export function refreshFeed(e, t) {
123
124
  const o = t.querySelectorAll(".ab-initial-spinner")[0];
124
125
  if (null != o) {
125
126
  const e = document.createElement("span");
126
- (e.innerHTML = je.m().get("FEED_TIMEOUT_MESSAGE") || ""),
127
+ (e.innerHTML = ue.m().get("FEED_TIMEOUT_MESSAGE") || ""),
127
128
  null != o.parentNode &&
128
129
  (o.parentNode.appendChild(e), o.parentNode.removeChild(o));
129
130
  }
@@ -187,7 +188,7 @@ export function updateFeedCards(e, t, o, s, n) {
187
188
  if (e.url && Z.test(e.url)) {
188
189
  const t = W(e.url);
189
190
  if (jt(t)) {
190
- r.error(vt(bt.Li, "Content Card"));
191
+ r.error(vt(bt.Vi, "Content Card"));
191
192
  continue;
192
193
  }
193
194
  }
@@ -1,22 +1,22 @@
1
1
  import e, { OPTIONS as L } from "../managers/braze-instance.js";
2
2
  import X from "../util/browser-detector.js";
3
3
  import nr from "./l10n-manager.js";
4
- const je = {
4
+ const ue = {
5
5
  t: !1,
6
6
  i: null,
7
7
  m: () => {
8
- if ((je.o(), !je.i)) {
8
+ if ((ue.o(), !ue.i)) {
9
9
  let r = X.language,
10
10
  t = !1;
11
- e.nn(L.zn) && ((r = e.nn(L.zn)), (t = !0)), (je.i = new nr(r, t));
11
+ e.nn(L.zn) && ((r = e.nn(L.zn)), (t = !0)), (ue.i = new nr(r, t));
12
12
  }
13
- return je.i;
13
+ return ue.i;
14
14
  },
15
15
  o: () => {
16
- je.t || (e.g(je), (je.t = !0));
16
+ ue.t || (e.g(ue), (ue.t = !0));
17
17
  },
18
18
  destroy: () => {
19
- (je.i = null), (je.t = !1);
19
+ (ue.i = null), (ue.t = !1);
20
20
  },
21
21
  };
22
- export default je;
22
+ export default ue;
@@ -1,25 +1,35 @@
1
1
  import { logger as r } from "../../shared-lib/index.js";
2
2
  import xt from "../common/translations.js";
3
3
  export default class nr {
4
- constructor(t, l = !1) {
4
+ constructor(t, e = !1) {
5
5
  if (
6
6
  ((this.language = t),
7
7
  null != t && (t = t.toLowerCase()),
8
8
  null != t && null == xt[t])
9
9
  ) {
10
- const l = t.indexOf("-");
11
- l > 0 && (t = t.substring(0, l));
10
+ const e = t.indexOf("-");
11
+ e > 0 && (t = t.substring(0, e));
12
12
  }
13
13
  if (null == xt[t]) {
14
- const n =
14
+ const a =
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
- l ? r.error(n) : r.info(n), (t = "en");
18
+ e ? r.error(a) : r.info(a), (t = "en");
19
19
  }
20
20
  this.language = t;
21
21
  }
22
22
  get(t) {
23
23
  return xt[this.language][t];
24
24
  }
25
+ wo() {
26
+ switch (this.language) {
27
+ case "ar":
28
+ case "he":
29
+ case "fa":
30
+ return "rtl";
31
+ default:
32
+ return "ltr";
33
+ }
34
+ }
25
35
  }
@@ -21,20 +21,20 @@ export default class qt {
21
21
  }
22
22
  setSdkAuthenticationSignature(t) {
23
23
  const i = this.kh();
24
- this.u.k(o.C.wh, t);
25
- const s = A.Yt.Qt;
26
- new A(s, r).setItem(s.ss.jh, this.gh, t), i !== t && this.Os();
24
+ this.u.I(o.C.wh, t);
25
+ const s = A.ts.Zt;
26
+ new A(s, r).setItem(s.hs.jh, this.gh, t), i !== t && this.Vs();
27
27
  }
28
28
  xh() {
29
- this.u.ti(o.C.wh);
30
- const t = A.Yt.Qt;
31
- new A(t, r).re(t.ss.jh, this.gh);
29
+ this.u.ii(o.C.wh);
30
+ const t = A.ts.Zt;
31
+ new A(t, r).re(t.hs.jh, this.gh);
32
32
  }
33
33
  subscribeToSdkAuthenticationFailures(t) {
34
- return this.Qn.It(t);
34
+ return this.Qn.Nt(t);
35
35
  }
36
36
  qh(t) {
37
- this.Qn.Dt(t);
37
+ this.Qn.Rt(t);
38
38
  }
39
39
  yh() {
40
40
  this.Xn.removeAllSubscriptions();
@@ -45,7 +45,7 @@ export default class qt {
45
45
  Gh() {
46
46
  return this.Zn;
47
47
  }
48
- Os() {
48
+ Vs() {
49
49
  this.Zn = 0;
50
50
  }
51
51
  }
@@ -7,9 +7,9 @@ import {
7
7
  isArray as j,
8
8
  keys as to,
9
9
  validateValueIsFromEnum as J,
10
- values as Pt,
10
+ values as Rt,
11
11
  } from "../util/code-utils.js";
12
- import Rt from "./network-manager.js";
12
+ import Pt from "./network-manager.js";
13
13
  import Lt from "../request-controller.js";
14
14
  import Dt from "./server-config-manager.js";
15
15
  import Mt from "./session-manager.js";
@@ -22,23 +22,23 @@ import { User } from "../User/index.js";
22
22
  import { parseQueryStringKeyValues as ut } from "../util/url-utils.js";
23
23
  import { WindowUtils as eo } from "../util/window-utils.js";
24
24
  import { BRAZE_MUST_BE_INITIALIZED_ERROR as _ } from "../common/constants.js";
25
- import { SupportedOptions as Vt, logger as r } from "../../shared-lib/index.js";
25
+ import { SupportedOptions as zt, logger as r } from "../../shared-lib/index.js";
26
26
  import _t from "../models/identifier.js";
27
27
  const L = {
28
28
  Eo: "allowCrawlerActivity",
29
29
  _o: "baseUrl",
30
30
  Io: "noCookies",
31
- Ao: "devicePropertyAllowlist",
32
- _a: "disablePushTokenMaintenance",
33
- So: "enableLogging",
31
+ So: "devicePropertyAllowlist",
32
+ Aa: "disablePushTokenMaintenance",
33
+ Ao: "enableLogging",
34
34
  No: "enableSdkAuthentication",
35
- Ma: "manageServiceWorkerExternally",
35
+ qa: "manageServiceWorkerExternally",
36
36
  Oo: "minimumIntervalBetweenTriggerActionsInSeconds",
37
- Po: "sessionTimeoutInSeconds",
38
- Ro: "appVersion",
37
+ Ro: "sessionTimeoutInSeconds",
38
+ Po: "appVersion",
39
39
  Lo: "appVersionNumber",
40
- wa: "serviceWorkerLocation",
41
- ya: "safariWebsitePushId",
40
+ Ma: "serviceWorkerLocation",
41
+ ka: "safariWebsitePushId",
42
42
  zn: "localization",
43
43
  bo: "contentSecurityNonce",
44
44
  Do: "allowUserSuppliedJavascript",
@@ -49,23 +49,24 @@ const L = {
49
49
  Lh: "requireExplicitInAppMessageDismissal",
50
50
  Mo: "doNotLoadFontAwesome",
51
51
  Uo: "deviceId",
52
- Bo: "sdkFlavor",
52
+ _a: "serviceWorkerScope",
53
+ Wo: "sdkFlavor",
53
54
  };
54
- class zt {
55
+ class Vt {
55
56
  constructor() {
56
57
  (this.rn = ""),
57
- (this.Wo = ""),
58
+ (this.Bo = ""),
58
59
  (this.Vo = void 0),
59
- (this.zo = null),
60
+ (this.Ko = null),
60
61
  (this.on = null),
62
+ (this.$t = null),
63
+ (this.Ui = null),
61
64
  (this.qt = null),
62
- (this.zi = null),
63
- (this.yt = null),
64
- (this.ri = null),
65
+ (this.oi = null),
65
66
  (this.u = null),
66
- (this.wt = null),
67
+ (this.yt = null),
67
68
  (this.Go = ""),
68
- (this.Ko = !1),
69
+ (this.isInitialized = !1),
69
70
  (this.$o = !1),
70
71
  (this.qo = new T()),
71
72
  (this.Jo = new T()),
@@ -73,20 +74,20 @@ class zt {
73
74
  (this.Yo = []),
74
75
  (this.Ho = []),
75
76
  (this._e = []),
76
- (this.Wo = "5.3.2");
77
+ (this.Bo = "5.5.0");
77
78
  }
78
79
  Xo(t) {
79
- this.qo.It(t);
80
+ this.qo.Nt(t);
80
81
  }
81
82
  Sh(t) {
82
- this.Jo.It(t);
83
+ this.Jo.Nt(t);
83
84
  }
84
85
  initialize(t, i) {
85
86
  if (this.so())
86
87
  return r.info("Braze has already been initialized with an API key."), !0;
87
88
  this.options = i || {};
88
- let s = this.nn(L.So);
89
- const e = ut(eo.Un());
89
+ let s = this.nn(L.Ao);
90
+ const e = ut(eo.Zo());
90
91
  if (
91
92
  (e && "true" === e.brazeLogging && (s = !0),
92
93
  r.init(s),
@@ -107,7 +108,7 @@ class zt {
107
108
  (n.href = h),
108
109
  "/" === n.pathname && (n = `${n}api/v3`),
109
110
  (this.Go = n.toString()),
110
- X.Zo && !this.nn(L.Eo))
111
+ X.Qo && !this.nn(L.Eo))
111
112
  )
112
113
  return (
113
114
  r.info("Ignoring activity from crawler bot " + navigator.userAgent),
@@ -116,7 +117,7 @@ class zt {
116
117
  );
117
118
  const a = this.nn(L.Io) || !1;
118
119
  if (
119
- ((this.u = Wt.Qo(t, a)), a && this.u.Wh(t), new Q.ee(null, !0).br(o.se))
120
+ ((this.u = Wt.Wh(t, a)), a && this.u.Vh(t), new Q.ee(null, !0).br(o.se))
120
121
  )
121
122
  return (
122
123
  r.info("Ignoring all activity due to previous opt out"),
@@ -124,16 +125,16 @@ class zt {
124
125
  !1
125
126
  );
126
127
  for (const t of to(this.options))
127
- -1 === Pt(Vt).indexOf(t) &&
128
+ -1 === Rt(zt).indexOf(t) &&
128
129
  r.warn(`Ignoring unknown initialization option '${t}'.`);
129
130
  const l = ["mparticle", "wordpress", "tealium"];
130
- if (null != this.nn(L.Bo)) {
131
- const t = this.nn(L.Bo);
131
+ if (null != this.nn(L.Wo)) {
132
+ const t = this.nn(L.Wo);
132
133
  -1 !== l.indexOf(t)
133
134
  ? (this.Vo = t)
134
135
  : r.error("Invalid sdk flavor passed: " + t);
135
136
  }
136
- let u = this.nn(Vt.Ao);
137
+ let u = this.nn(zt.So);
137
138
  if (null != u)
138
139
  if (j(u)) {
139
140
  const t = [];
@@ -150,119 +151,120 @@ class zt {
150
151
  "devicePropertyAllowlist must be an array. Defaulting to all properties.",
151
152
  ),
152
153
  (u = null);
153
- const f = this.nn(L.Uo);
154
- if (f) {
155
- const t = new _t(f);
154
+ const c = this.nn(L.Uo);
155
+ if (c) {
156
+ const t = new _t(c);
156
157
  this.u.uu(o.iu.Uo, t);
157
158
  }
158
159
  (this.on = new Ot(this.u, u)),
159
- (this.yt = new Dt(this.u)),
160
- (this.wt = new kt(this.yt, this.u)),
161
- (this.ri = new Mt(this.u, this.wt, this.yt, this.nn(L.Po)));
162
- const c = new T();
160
+ (this.qt = new Dt(this.u)),
161
+ (this.yt = new kt(this.qt, this.u)),
162
+ (this.oi = new Mt(this.u, this.yt, this.qt, this.nn(L.Ro)));
163
+ const f = new T();
163
164
  return (
164
- (this.zo = new qt(this.u, this.nn(L.No), c)),
165
- this.$t(c),
166
- (this.qt = new Rt(
165
+ (this.Ko = new qt(this.u, this.nn(L.No), f)),
166
+ this.Ht(f),
167
+ (this.$t = new Pt(
167
168
  this.on,
168
169
  this.u,
169
- this.zo,
170
- this.wt,
171
- this.ri,
170
+ this.Ko,
172
171
  this.yt,
172
+ this.oi,
173
+ this.qt,
173
174
  this.rn,
174
175
  this.Go,
175
- this.Wo,
176
+ this.Bo,
176
177
  this.Vo || "",
177
- this.nn(L.Ro),
178
+ this.nn(L.Po),
178
179
  this.nn(L.Lo),
179
180
  )),
180
- (this.zi = new Lt(
181
+ (this.Ui = new Lt(
181
182
  this.rn,
182
183
  this.Go,
183
- this.ri,
184
+ this.oi,
184
185
  this.on,
185
- this.wt,
186
186
  this.yt,
187
+ this.qt,
187
188
  this.u,
188
189
  (t) => {
189
- if (this.so()) for (const i of this.gr()) i.Ns(t);
190
+ if (this.so()) for (const i of this.gr()) i.Ss(t);
190
191
  },
191
- this.zo,
192
- this.qt,
192
+ this.Ko,
193
+ this.$t,
193
194
  )),
194
- this.zi.initialize(),
195
- a || this.u.Vh(),
195
+ this.Ui.initialize(),
196
+ a || this.u.Kh(),
196
197
  r.info(
197
198
  `Initialized for the Braze backend at "${this.nn(
198
199
  L._o,
199
200
  )}" with API key "${this.rn}".`,
200
201
  ),
201
202
  et.o(),
202
- this.yt.ji(() => {
203
+ this.qt.bi(() => {
203
204
  var t;
204
- this.Ko &&
205
- (null === (t = this.yt) || void 0 === t ? void 0 : t.ci()) &&
205
+ this.isInitialized &&
206
+ (null === (t = this.qt) || void 0 === t ? void 0 : t.mi()) &&
206
207
  import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
207
- if (!this.Ko) return;
208
+ if (!this.isInitialized) return;
208
209
  (0, t.default)();
209
210
  });
210
211
  }),
211
- this.zi.mr(() => {
212
+ this.Ui.mr(() => {
212
213
  var t;
213
- this.Ko &&
214
- (null === (t = this.yt) || void 0 === t ? void 0 : t.ci()) &&
214
+ this.isInitialized &&
215
+ (null === (t = this.qt) || void 0 === t ? void 0 : t.mi()) &&
215
216
  import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
216
- if (!this.Ko) return;
217
+ if (!this.isInitialized) return;
217
218
  (0, t.default)(void 0, void 0, !0);
218
219
  });
219
220
  }),
220
- this.qo.Dt(this.options),
221
- (this.Ko = !0),
221
+ this.qo.Rt(this.options),
222
+ (this.isInitialized = !0),
223
+ window.dispatchEvent(new CustomEvent("braze.initialized")),
222
224
  !0
223
225
  );
224
226
  }
225
227
  destroy(t) {
226
228
  if ((r.destroy(), this.so())) {
227
- this.Jo.Dt(), this.Jo.removeAllSubscriptions();
229
+ this.Jo.Rt(), this.Jo.removeAllSubscriptions();
228
230
  for (const t of this.Yo) t.destroy();
229
231
  this.Yo = [];
230
232
  for (const t of this.Ho) t.clearData(!1);
231
233
  (this.Ho = []),
232
234
  this.removeAllSubscriptions(),
233
235
  (this._e = []),
234
- null != this.zi && this.zi.destroy(),
235
- (this.zi = null),
236
- (this.zo = null),
236
+ null != this.Ui && this.Ui.destroy(),
237
+ (this.Ui = null),
238
+ (this.Ko = null),
237
239
  (this.on = null),
240
+ (this.$t = null),
238
241
  (this.qt = null),
242
+ (this.oi = null),
239
243
  (this.yt = null),
240
- (this.ri = null),
241
- (this.wt = null),
242
244
  (this.options = {}),
243
245
  (this.Vo = void 0),
244
- (this.Ko = !1),
246
+ (this.isInitialized = !1),
245
247
  (this.$o = !1),
246
248
  t && (this.u = null);
247
249
  }
248
250
  }
249
251
  X() {
250
- return !this.Kh() && (!!this.so() || (console.warn(_), !1));
252
+ return !this.$h() && (!!this.so() || (console.warn(_), !1));
251
253
  }
252
254
  ba() {
253
255
  return this.rn;
254
256
  }
255
257
  Sr() {
256
- return this.zo;
258
+ return this.Ko;
257
259
  }
258
- Hs() {
260
+ Os() {
259
261
  return this.Go;
260
262
  }
261
263
  te() {
262
264
  return this.on;
263
265
  }
264
266
  nr() {
265
- return this.qt;
267
+ return this.$t;
266
268
  }
267
269
  nn(t) {
268
270
  return this.options[t];
@@ -271,22 +273,22 @@ class zt {
271
273
  return this.Ho;
272
274
  }
273
275
  cr() {
274
- return this.zi;
276
+ return this.Ui;
275
277
  }
276
278
  ir() {
277
- return this.yt;
279
+ return this.qt;
278
280
  }
279
281
  zr() {
280
- return this.ri;
282
+ return this.oi;
281
283
  }
282
284
  l() {
283
285
  return this.u;
284
286
  }
285
287
  pr() {
286
- if (this.wt && this.zi) return new User(this.wt, this.zi);
288
+ if (this.yt && this.Ui) return new User(this.yt, this.Ui);
287
289
  }
288
290
  er() {
289
- return this.wt;
291
+ return this.yt;
290
292
  }
291
293
  tr() {
292
294
  return !0 === this.nn(L.Do);
@@ -301,7 +303,7 @@ class zt {
301
303
  for (const s of this.Ho) s.constructor === t.constructor && (i = !0);
302
304
  t instanceof y && !i && this.Ho.push(t);
303
305
  }
304
- $t(t) {
306
+ Ht(t) {
305
307
  t instanceof T && this._e.push(t);
306
308
  }
307
309
  removeAllSubscriptions() {
@@ -314,14 +316,14 @@ class zt {
314
316
  this.$o = t;
315
317
  }
316
318
  so() {
317
- return this.Ko;
319
+ return this.isInitialized;
318
320
  }
319
- Kh() {
321
+ $h() {
320
322
  return this.$o;
321
323
  }
322
- Ds() {
323
- return this.Wo;
324
+ ks() {
325
+ return this.Bo;
324
326
  }
325
327
  }
326
- const e = new zt();
327
- export { e as default, zt as BrazeSdkInstance, L as OPTIONS };
328
+ const e = new Vt();
329
+ export { e as default, Vt as BrazeSdkInstance, L as OPTIONS };
@@ -4,39 +4,39 @@ import DeviceProperties from "../Core/device-properties.js";
4
4
  import _t from "../models/identifier.js";
5
5
  import { logger as r, Guid as p } from "../../shared-lib/index.js";
6
6
  import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
7
- import { values as Pt } from "../util/code-utils.js";
7
+ import { values as Rt } from "../util/code-utils.js";
8
8
  import { getErrorMessage as si } from "../util/error-utils.js";
9
9
  export default class Ot {
10
10
  constructor(t, e) {
11
11
  (this.u = t),
12
- (this.ka = e),
12
+ (this.Ia = e),
13
13
  (this.u = t),
14
- null == e && (e = Pt(DeviceProperties)),
15
- (this.ka = e);
14
+ null == e && (e = Rt(DeviceProperties)),
15
+ (this.Ia = e);
16
16
  }
17
17
  ce(t = !0) {
18
18
  let e = this.u.tu(o.iu.Uo);
19
19
  null == e && ((e = new _t(p.W())), t && this.u.uu(o.iu.Uo, e));
20
20
  const r = new Gt(e.eu);
21
- for (let t = 0; t < this.ka.length; t++) {
22
- switch (this.ka[t]) {
21
+ for (let t = 0; t < this.Ia.length; t++) {
22
+ switch (this.Ia[t]) {
23
23
  case DeviceProperties.BROWSER:
24
24
  r.browser = X.browser;
25
25
  break;
26
26
  case DeviceProperties.BROWSER_VERSION:
27
- r.Ia = X.version;
27
+ r.Ta = X.version;
28
28
  break;
29
29
  case DeviceProperties.OS:
30
- r.os = this.Ta();
30
+ r.os = this.Da();
31
31
  break;
32
32
  case DeviceProperties.RESOLUTION:
33
- r.Da = screen.width + "x" + screen.height;
33
+ r.Sa = screen.width + "x" + screen.height;
34
34
  break;
35
35
  case DeviceProperties.LANGUAGE:
36
36
  r.language = X.language;
37
37
  break;
38
38
  case DeviceProperties.TIME_ZONE:
39
- r.timeZone = this.Sa(new Date());
39
+ r.timeZone = this.Oa(new Date());
40
40
  break;
41
41
  case DeviceProperties.USER_AGENT:
42
42
  r.userAgent = X.userAgent;
@@ -44,12 +44,12 @@ export default class Ot {
44
44
  }
45
45
  return r;
46
46
  }
47
- Ta() {
48
- if (X.Oa()) return X.Oa();
49
- const t = this.u.j(o.C.Ca);
50
- return t && t.os_version ? t.os_version : X.Ta();
47
+ Da() {
48
+ if (X.Ca()) return X.Ca();
49
+ const t = this.u.j(o.C.Fa);
50
+ return t && t.os_version ? t.os_version : X.Da();
51
51
  }
52
- Sa(t) {
52
+ Oa(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.Fa(s);
69
+ return this.Ga(s);
70
70
  }
71
- Fa(t) {
71
+ Ga(t) {
72
72
  const e = Math.trunc(t / 60),
73
73
  r = Math.trunc(t % 60);
74
74
  let s = "GMT";