@braze/web-sdk 6.0.0 → 6.2.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 (147) hide show
  1. package/index.d.ts +103 -33
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +1 -1
  4. package/shared-lib/event-types.js +22 -22
  5. package/shared-lib/guid.js +3 -3
  6. package/shared-lib/indexed-db-adapter.js +19 -19
  7. package/shared-lib/logger.js +18 -18
  8. package/shared-lib/supported-options.js +15 -15
  9. package/src/Banner/banner-factory.js +2 -1
  10. package/src/Banner/banner-provider-factory.js +7 -7
  11. package/src/Banner/banner-provider.js +92 -98
  12. package/src/Banner/banner.js +21 -18
  13. package/src/Banner/display/banner-to-html.js +9 -9
  14. package/src/Banner/display/destroy-banner-html.js +2 -2
  15. package/src/Banner/display/detect-banner-impressions.js +2 -2
  16. package/src/Banner/get-all-banners.js +5 -5
  17. package/src/Banner/get-banner.js +7 -7
  18. package/src/Banner/log-banner-click.js +7 -7
  19. package/src/Banner/log-banner-impressions.js +9 -9
  20. package/src/Banner/request-banners-refresh.js +16 -20
  21. package/src/Banner/subscribe-to-banners-updates.js +7 -7
  22. package/src/Banner/ui/insert-banner.js +6 -6
  23. package/src/Card/card-manager-factory.js +7 -7
  24. package/src/Card/card-manager.js +35 -35
  25. package/src/Card/display/card-display.js +11 -11
  26. package/src/Card/log-card-dismissal.js +4 -4
  27. package/src/Card/log-content-card-click.js +4 -4
  28. package/src/Card/log-content-card-impressions.js +6 -6
  29. package/src/Card/models/captioned-image.js +21 -21
  30. package/src/Card/models/card.js +68 -68
  31. package/src/Card/models/classic-card.js +21 -21
  32. package/src/Card/models/control-card.js +11 -11
  33. package/src/Card/models/image-only.js +18 -18
  34. package/src/Card/util/card-factory.js +35 -35
  35. package/src/ContentCards/content-cards-provider-factory.js +13 -13
  36. package/src/ContentCards/content-cards-provider.js +136 -136
  37. package/src/ContentCards/get-cached-content-cards.js +2 -2
  38. package/src/ContentCards/request-content-cards-refresh.js +2 -2
  39. package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
  40. package/src/ContentCards/ui/show-content-cards.js +7 -7
  41. package/src/Core/add-sdk-metadata.js +3 -3
  42. package/src/Core/change-user.js +7 -7
  43. package/src/Core/destroy.js +2 -2
  44. package/src/Core/disable-sdk.js +8 -8
  45. package/src/Core/enable-sdk.js +6 -6
  46. package/src/Core/get-device-id.js +4 -4
  47. package/src/Core/handle-braze-action.js +5 -5
  48. package/src/Core/is-disabled.js +1 -1
  49. package/src/Core/log-custom-event.js +10 -10
  50. package/src/Core/log-purchase.js +13 -13
  51. package/src/Core/open-session.js +10 -10
  52. package/src/Core/set-logger.js +2 -2
  53. package/src/Core/set-sdk-authentication-signature.js +2 -2
  54. package/src/Core/toggle-logging.js +2 -2
  55. package/src/Core/wipe-data.js +7 -7
  56. package/src/FeatureFlags/feature-flag-factory.js +10 -10
  57. package/src/FeatureFlags/feature-flag.js +20 -71
  58. package/src/FeatureFlags/feature-flags-provider-factory.js +12 -12
  59. package/src/FeatureFlags/feature-flags-provider.js +87 -87
  60. package/src/FeatureFlags/get-all-feature-flags.js +4 -4
  61. package/src/FeatureFlags/get-feature-flag.js +4 -4
  62. package/src/FeatureFlags/log-feature-flag-impression.js +9 -9
  63. package/src/FeatureFlags/refresh-feature-flags.js +2 -2
  64. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
  65. package/src/InAppMessage/defer-in-app-message.js +4 -4
  66. package/src/InAppMessage/display/html-message-to-html.js +10 -10
  67. package/src/InAppMessage/display/in-app-message-to-html.js +28 -28
  68. package/src/InAppMessage/display/modal-utils.js +7 -7
  69. package/src/InAppMessage/in-app-message-factory.js +15 -15
  70. package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
  71. package/src/InAppMessage/in-app-message-manager.js +100 -100
  72. package/src/InAppMessage/log-in-app-message-button-click.js +9 -9
  73. package/src/InAppMessage/log-in-app-message-click.js +6 -6
  74. package/src/InAppMessage/log-in-app-message-html-click.js +9 -9
  75. package/src/InAppMessage/log-in-app-message-impression.js +4 -4
  76. package/src/InAppMessage/models/control-message.js +4 -4
  77. package/src/InAppMessage/models/full-screen-message.js +35 -35
  78. package/src/InAppMessage/models/html-message.js +21 -21
  79. package/src/InAppMessage/models/in-app-message-button.js +5 -5
  80. package/src/InAppMessage/models/in-app-message.js +75 -75
  81. package/src/InAppMessage/models/modal-message.js +34 -34
  82. package/src/InAppMessage/models/slide-up-message.js +31 -31
  83. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  84. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  85. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  86. package/src/InAppMessage/ui/show-in-app-message.js +19 -19
  87. package/src/Push/push-manager-factory.js +9 -9
  88. package/src/Push/push-manager.js +118 -118
  89. package/src/Push/utils/push-utils.js +9 -9
  90. package/src/User/user-manager.js +20 -20
  91. package/src/User/user.js +44 -45
  92. package/src/common/base-provider.js +1 -1
  93. package/src/common/content-cards-display.js +18 -18
  94. package/src/common/event-logger.js +10 -10
  95. package/src/common/properties-base.js +56 -0
  96. package/src/l10n/l10n-manager-factory.js +7 -7
  97. package/src/l10n/l10n-manager.js +4 -4
  98. package/src/managers/auth-manager.js +32 -32
  99. package/src/managers/braze-instance.js +143 -143
  100. package/src/managers/device-manager.js +22 -22
  101. package/src/managers/network-manager.js +172 -168
  102. package/src/managers/server-config-manager.js +73 -73
  103. package/src/managers/session-manager.js +40 -40
  104. package/src/managers/storage-manager-factory.js +6 -6
  105. package/src/managers/storage-manager.js +97 -97
  106. package/src/managers/subscription-manager.js +12 -12
  107. package/src/managers/utils.js +1 -1
  108. package/src/models/backend-errors.js +5 -5
  109. package/src/models/braze-event.js +5 -5
  110. package/src/models/device.js +2 -2
  111. package/src/models/identifier.js +12 -12
  112. package/src/models/push-token.js +13 -13
  113. package/src/models/request-result.js +4 -4
  114. package/src/models/server-config.js +31 -31
  115. package/src/request-controller.js +159 -159
  116. package/src/triggers/models/custom-event-data.js +1 -1
  117. package/src/triggers/models/custom-event-property-data.js +2 -2
  118. package/src/triggers/models/filter-set.js +6 -6
  119. package/src/triggers/models/filter.js +26 -26
  120. package/src/triggers/models/in-app-message-click-data.js +1 -1
  121. package/src/triggers/models/purchase-data.js +1 -1
  122. package/src/triggers/models/purchase-property-data.js +2 -2
  123. package/src/triggers/models/push-click-data.js +1 -1
  124. package/src/triggers/models/trigger-condition.js +37 -37
  125. package/src/triggers/models/trigger-events.js +3 -3
  126. package/src/triggers/models/trigger.js +16 -16
  127. package/src/triggers/triggers-provider-factory.js +12 -12
  128. package/src/triggers/triggers-provider.js +61 -61
  129. package/src/ui/js/attach-css.js +1 -1
  130. package/src/ui/js/load-font-awesome.js +1 -1
  131. package/src/util/base-device-parser.js +1 -1
  132. package/src/util/braze-actions.js +6 -6
  133. package/src/util/browser-detector.js +22 -13
  134. package/src/util/client-hints-parser.js +6 -6
  135. package/src/util/code-utils.js +2 -2
  136. package/src/util/component-utils.js +1 -1
  137. package/src/util/deprecation-utils.js +2 -2
  138. package/src/util/device-constants.js +4 -4
  139. package/src/util/dom-utils.js +9 -9
  140. package/src/util/html-display-utils.js +7 -7
  141. package/src/util/key-codes.js +1 -1
  142. package/src/util/net.js +12 -12
  143. package/src/util/request-header-utils.js +22 -22
  144. package/src/util/string-utils.js +2 -2
  145. package/src/util/user-agent-parser.js +16 -16
  146. package/src/util/validation-utils.js +12 -12
  147. package/src/util/window-utils.js +2 -2
@@ -1,51 +1,51 @@
1
1
  import { STORAGE_KEYS as s } from "./storage-manager.js";
2
2
  import u from "./subscription-manager.js";
3
- import { logger as N, IndexedDBAdapter as et } from "../../shared-lib/index.js";
3
+ import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
4
4
  export default class Bt {
5
5
  constructor(t, i, s) {
6
- (this.C = t),
7
- (this.gh = i),
8
- (this.ph = s),
9
- (this.C = t),
10
- (this.gh = i || !1),
11
- (this.ph = s),
12
- (this.Fh = new u()),
13
- (this.kh = 0),
14
- (this.fh = 1);
6
+ (this.j = t),
7
+ (this.Zn = i),
8
+ (this.gh = s),
9
+ (this.j = t),
10
+ (this.Zn = i || !1),
11
+ (this.gh = s),
12
+ (this.ph = new u()),
13
+ (this.Fh = 0),
14
+ (this.kh = 1);
15
+ }
16
+ fh() {
17
+ return this.Zn;
15
18
  }
16
19
  wh() {
17
- return this.gh;
18
- }
19
- jh() {
20
- return this.C.ft(s.gt.xh);
20
+ return this.j.lt(s.ct.jh);
21
21
  }
22
22
  setSdkAuthenticationSignature(t) {
23
- const i = this.jh();
24
- this.C.Bt(s.gt.xh, t);
25
- const e = et.Ds.Us;
26
- new et(e, N).setItem(e.Ls.qh, this.fh, t), i !== t && this.it();
23
+ const i = this.wh();
24
+ this.j.ft(s.ct.jh, t);
25
+ const e = et.Us.Rs;
26
+ new et(e, E).setItem(e.Fs.xh, this.kh, t), i !== t && this.Z();
27
27
  }
28
- yh() {
29
- this.C.Ut(s.gt.xh);
30
- const t = et.Ds.Us;
31
- new et(t, N).ge(t.Ls.qh, this.fh);
28
+ qh() {
29
+ this.j.Nt(s.ct.jh);
30
+ const t = et.Us.Rs;
31
+ new et(t, E).be(t.Fs.xh, this.kh);
32
32
  }
33
33
  subscribeToSdkAuthenticationFailures(t) {
34
- return this.ph.Dt(t);
34
+ return this.gh.wt(t);
35
+ }
36
+ yh(t) {
37
+ this.gh.L(t);
35
38
  }
36
- Bh(t) {
37
- this.ph.X(t);
39
+ Bh() {
40
+ this.ph.removeAllSubscriptions();
38
41
  }
39
42
  Gh() {
40
- this.Fh.removeAllSubscriptions();
43
+ this.Fh += 1;
41
44
  }
42
45
  Hh() {
43
- this.kh += 1;
44
- }
45
- Jh() {
46
- return this.kh;
46
+ return this.Fh;
47
47
  }
48
- it() {
49
- this.kh = 0;
48
+ Z() {
49
+ this.Fh = 0;
50
50
  }
51
51
  }
@@ -22,118 +22,118 @@ import { User } from "../User/index.js";
22
22
  import { parseQueryStringKeyValues as ll } from "../util/url-utils.js";
23
23
  import { WindowUtils as no } from "../util/window-utils.js";
24
24
  import { BRAZE_MUST_BE_INITIALIZED_ERROR as w } from "../common/constants.js";
25
- import { SupportedOptions as $t, logger as N } from "../../shared-lib/index.js";
25
+ import { SupportedOptions as $t, logger as E } from "../../shared-lib/index.js";
26
26
  import _t from "../models/identifier.js";
27
27
  const z = {
28
28
  _o: "allowCrawlerActivity",
29
- Yo: "baseUrl",
30
- Xo: "noCookies",
31
- Zo: "devicePropertyAllowlist",
29
+ Ro: "baseUrl",
30
+ Wo: "noCookies",
31
+ Vo: "devicePropertyAllowlist",
32
32
  Aa: "disablePushTokenMaintenance",
33
- Wh: "enableLogging",
34
- Vh: "enableSdkAuthentication",
33
+ Yo: "enableLogging",
34
+ Xo: "enableSdkAuthentication",
35
35
  qa: "manageServiceWorkerExternally",
36
- Kh: "minimumIntervalBetweenTriggerActionsInSeconds",
37
- $h: "sessionTimeoutInSeconds",
38
- Yh: "appVersion",
39
- Xh: "appVersionNumber",
36
+ Zo: "minimumIntervalBetweenTriggerActionsInSeconds",
37
+ Wh: "sessionTimeoutInSeconds",
38
+ Vh: "appVersion",
39
+ Kh: "appVersionNumber",
40
40
  Ma: "serviceWorkerLocation",
41
41
  ka: "safariWebsitePushId",
42
- Zn: "localization",
42
+ Xn: "localization",
43
43
  er: "contentSecurityNonce",
44
44
  re: "allowUserSuppliedJavascript",
45
- Ko: "inAppMessageZIndex",
46
- Qo: "openInAppMessagesInNewTab",
45
+ Jo: "inAppMessageZIndex",
46
+ Do: "openInAppMessagesInNewTab",
47
47
  tn: "openCardsInNewTab",
48
48
  Lh: "requireExplicitInAppMessageDismissal",
49
- Zh: "doNotLoadFontAwesome",
50
- Qh: "deviceId",
49
+ $h: "doNotLoadFontAwesome",
50
+ Jh: "deviceId",
51
51
  _a: "serviceWorkerScope",
52
- Ea: "sdkFlavor",
52
+ Yh: "sdkFlavor",
53
53
  };
54
54
  class Jt {
55
55
  constructor() {
56
- (this.on = ""),
57
- (this.Ia = ""),
58
- (this.Sa = void 0),
59
- (this.Na = null),
60
- (this.un = null),
61
- (this.S = null),
62
- (this.Cn = null),
56
+ (this.sn = ""),
57
+ (this.Xh = ""),
58
+ (this.Zh = void 0),
59
+ (this.Qh = null),
60
+ (this.on = null),
63
61
  (this.B = null),
64
- (this.T = null),
62
+ (this.Cn = null),
63
+ (this.h = null),
65
64
  (this.C = null),
65
+ (this.j = null),
66
66
  (this.Cs = null),
67
- (this.Oa = ""),
67
+ (this.Ea = ""),
68
68
  (this.isInitialized = !1),
69
- (this.Ta = !1),
70
- (this.Ra = new u()),
71
- (this.Ca = new u()),
69
+ (this.Ia = !1),
70
+ (this.Sa = new u()),
71
+ (this.Na = new u()),
72
72
  (this.options = {}),
73
- (this.Pa = []),
74
- (this.La = []),
75
- (this.Mi = []),
76
- (this.Ia = "6.0.0");
73
+ (this.Oa = []),
74
+ (this.Ta = []),
75
+ (this.yi = []),
76
+ (this.Xh = "6.2.0");
77
77
  }
78
- Da(t) {
79
- this.Ra.Dt(t);
78
+ Ra(t) {
79
+ this.Sa.wt(t);
80
80
  }
81
81
  mh(t) {
82
- this.Ca.Dt(t);
82
+ this.Na.wt(t);
83
83
  }
84
84
  initialize(t, i) {
85
85
  if (this.ao())
86
- return N.info("Braze has already been initialized with an API key."), !0;
86
+ return E.info("Braze has already been initialized with an API key."), !0;
87
87
  this.options = i || {};
88
- let e = this.ee(z.Wh);
89
- const r = ll(no.Ua());
88
+ let e = this.ee(z.Yo);
89
+ const r = ll(no.Ca());
90
90
  if (
91
91
  (r && "true" === r.brazeLogging && (e = !0),
92
- N.init(e),
93
- N.info(
92
+ E.init(e),
93
+ E.info(
94
94
  `Initialization Options: ${JSON.stringify(this.options, null, 2)}`,
95
95
  ),
96
96
  null == t || "" === t || "string" != typeof t)
97
97
  )
98
- return N.error("Braze requires a valid API key to be initialized."), !1;
99
- this.on = t;
100
- let n = this.ee(z.Yo);
98
+ return E.error("Braze requires a valid API key to be initialized."), !1;
99
+ this.sn = t;
100
+ let n = this.ee(z.Ro);
101
101
  if (null == n || "" === n || "string" != typeof n)
102
- return N.error("Braze requires a valid baseUrl to be initialized."), !1;
102
+ return E.error("Braze requires a valid baseUrl to be initialized."), !1;
103
103
  !1 === /^https?:/.test(n) && (n = `https://${n}`);
104
104
  const o = n;
105
105
  if (
106
106
  ((n = document.createElement("a")),
107
107
  (n.href = o),
108
108
  "/" === n.pathname && (n = `${n}api/v3`),
109
- (this.Oa = n.toString()),
110
- ro.Wa && !this.ee(z._o))
109
+ (this.Ea = n.toString()),
110
+ ro.Pa && !this.ee(z._o))
111
111
  )
112
112
  return (
113
- N.info("Ignoring activity from crawler bot " + navigator.userAgent),
114
- (this.Ta = !0),
113
+ E.info("Ignoring activity from crawler bot " + navigator.userAgent),
114
+ (this.Ia = !0),
115
115
  !1
116
116
  );
117
- const h = this.ee(z.Xo) || !1;
117
+ const h = this.ee(z.Wo) || !1;
118
118
  if (
119
- ((this.C = Gt.Ba(t, h)), h && this.C.Va(t), new ee.se(null, !0).pr(s.me))
119
+ ((this.j = Gt.La(t, h)), h && this.j.Da(t), new ee.ne(null, !0).br(s.ie))
120
120
  )
121
121
  return (
122
- N.info("Ignoring all activity due to previous opt out"),
123
- (this.Ta = !0),
122
+ E.info("Ignoring all activity due to previous opt out"),
123
+ (this.Ia = !0),
124
124
  !1
125
125
  );
126
126
  for (const t of C(this.options))
127
127
  -1 === Pt($t).indexOf(t) &&
128
- N.warn(`Ignoring unknown initialization option '${t}'.`);
128
+ E.warn(`Ignoring unknown initialization option '${t}'.`);
129
129
  const a = ["mparticle", "wordpress", "tealium"];
130
- if (null != this.ee(z.Ea)) {
131
- const t = this.ee(z.Ea);
130
+ if (null != this.ee(z.Yh)) {
131
+ const t = this.ee(z.Yh);
132
132
  -1 !== a.indexOf(t)
133
- ? (this.Sa = t)
134
- : N.error("Invalid sdk flavor passed: " + t);
133
+ ? (this.Zh = t)
134
+ : E.error("Invalid sdk flavor passed: " + t);
135
135
  }
136
- let l = this.ee($t.Zo);
136
+ let l = this.ee($t.Vo);
137
137
  if (null != l)
138
138
  if (D(l)) {
139
139
  const t = [];
@@ -146,63 +146,63 @@ class Jt {
146
146
  ) && t.push(l[i]);
147
147
  l = t;
148
148
  } else
149
- N.error(
149
+ E.error(
150
150
  "devicePropertyAllowlist must be an array. Defaulting to all properties.",
151
151
  ),
152
152
  (l = null);
153
- const c = this.ee(z.Qh);
153
+ const c = this.ee(z.Jh);
154
154
  if (c) {
155
155
  const t = new _t(c);
156
- this.C.uu(s.iu.Qh, t);
156
+ this.j.uu(s.iu.Jh, t);
157
157
  }
158
- (this.un = new Ot(this.C, l)),
159
- (this.B = new Vt(this.C)),
160
- (this.Cs = new bt(this.B, this.C)),
161
- (this.T = new Kt(this.C, this.Cs, this.B, this.ee(z.$h)));
158
+ (this.on = new Ot(this.j, l)),
159
+ (this.h = new Vt(this.j)),
160
+ (this.Cs = new bt(this.h, this.j)),
161
+ (this.C = new Kt(this.j, this.Cs, this.h, this.ee(z.Wh)));
162
162
  const f = new u();
163
163
  return (
164
- (this.Na = new Bt(this.C, this.ee(z.Vh), f)),
165
- this.F(f),
166
- (this.S = new Mt(
167
- this.un,
168
- this.C,
169
- this.Na,
170
- this.Cs,
171
- this.T,
172
- this.B,
164
+ (this.Qh = new Bt(this.j, this.ee(z.Xo), f)),
165
+ this.q(f),
166
+ (this.B = new Mt(
173
167
  this.on,
174
- this.Oa,
175
- this.Ia,
176
- this.Sa || "",
177
- this.ee(z.Yh),
178
- this.ee(z.Xh),
168
+ this.j,
169
+ this.Qh,
170
+ this.Cs,
171
+ this.C,
172
+ this.h,
173
+ this.sn,
174
+ this.Ea,
175
+ this.Xh,
176
+ this.Zh || "",
177
+ this.ee(z.Vh),
178
+ this.ee(z.Kh),
179
179
  )),
180
180
  (this.Cn = new Wt(
181
+ this.sn,
182
+ this.Ea,
183
+ this.C,
181
184
  this.on,
182
- this.Oa,
183
- this.T,
184
- this.un,
185
185
  this.Cs,
186
- this.B,
187
- this.C,
186
+ this.h,
187
+ this.j,
188
188
  (t) => {
189
- if (this.ao()) for (const i of this.lr()) i.U(t);
189
+ if (this.ao()) for (const i of this.lr()) i.N(t);
190
190
  },
191
- this.Na,
192
- this.S,
191
+ this.Qh,
192
+ this.B,
193
193
  )),
194
194
  this.Cn.initialize(),
195
- h || this.C.Fa(),
196
- N.info(
195
+ h || this.j.Ua(),
196
+ E.info(
197
197
  `Initialized for the Braze backend at "${this.ee(
198
- z.Yo,
199
- )}" with API key "${this.on}".`,
198
+ z.Ro,
199
+ )}" with API key "${this.sn}".`,
200
200
  ),
201
- rt.p(),
202
- this.B.Ke(() => {
201
+ rt.t(),
202
+ this.h.Ue(() => {
203
203
  var t;
204
204
  this.isInitialized &&
205
- (null === (t = this.B) || void 0 === t ? void 0 : t.ke()) &&
205
+ (null === (t = this.h) || void 0 === t ? void 0 : t.Re()) &&
206
206
  import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
207
207
  if (!this.isInitialized) return;
208
208
  (0, t.default)();
@@ -211,79 +211,79 @@ class Jt {
211
211
  this.Cn.rn(() => {
212
212
  var t;
213
213
  this.isInitialized &&
214
- (null === (t = this.B) || void 0 === t ? void 0 : t.ke()) &&
214
+ (null === (t = this.h) || void 0 === t ? void 0 : t.Re()) &&
215
215
  import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
216
216
  if (!this.isInitialized) return;
217
217
  (0, t.default)(void 0, void 0, !0);
218
218
  });
219
219
  }),
220
- this.Ra.X(this.options),
220
+ this.Sa.L(this.options),
221
221
  (this.isInitialized = !0),
222
222
  window.dispatchEvent(new CustomEvent("braze.initialized")),
223
223
  !0
224
224
  );
225
225
  }
226
226
  destroy(t) {
227
- if ((N.destroy(), this.ao())) {
228
- this.Ca.X(), this.Ca.removeAllSubscriptions();
229
- for (const t of this.Pa) t.destroy();
230
- this.Pa = [];
231
- for (const t of this.La) t.clearData(!1);
232
- this.S && this.S.fo(),
233
- (this.La = []),
227
+ if ((E.destroy(), this.ao())) {
228
+ this.Na.L(), this.Na.removeAllSubscriptions();
229
+ for (const t of this.Oa) t.destroy();
230
+ this.Oa = [];
231
+ for (const t of this.Ta) t.clearData(!1);
232
+ this.B && this.B.fo(),
233
+ (this.Ta = []),
234
234
  this.removeAllSubscriptions(),
235
- (this.Mi = []),
235
+ (this.yi = []),
236
236
  null != this.Cn && this.Cn.destroy(),
237
237
  (this.Cn = null),
238
- (this.Na = null),
239
- (this.un = null),
240
- (this.S = null),
238
+ (this.Qh = null),
239
+ (this.on = null),
241
240
  (this.B = null),
242
- (this.T = null),
241
+ (this.h = null),
242
+ (this.C = null),
243
243
  (this.Cs = null),
244
244
  (this.options = {}),
245
- (this.Sa = void 0),
245
+ (this.Zh = void 0),
246
246
  (this.isInitialized = !1),
247
- (this.Ta = !1),
248
- t && (this.C = null);
247
+ (this.Ia = !1),
248
+ t && (this.j = null);
249
249
  }
250
250
  }
251
251
  rr() {
252
- return !this.Ka() && (!!this.ao() || (console.warn(w), !1));
252
+ return !this.Wa() && (!!this.ao() || (console.warn(w), !1));
253
253
  }
254
254
  ba() {
255
- return this.on;
255
+ return this.sn;
256
256
  }
257
257
  Sr() {
258
- return this.Na;
258
+ return this.Qh;
259
259
  }
260
- Z() {
261
- return this.Oa;
260
+ V() {
261
+ return this.Ea;
262
262
  }
263
- ue() {
264
- return this.un;
263
+ de() {
264
+ return this.on;
265
265
  }
266
- g() {
267
- return this.S;
266
+ m() {
267
+ return this.B;
268
268
  }
269
269
  ee(t) {
270
270
  return this.options[t];
271
271
  }
272
272
  lr() {
273
- return this.La;
273
+ return this.Ta;
274
274
  }
275
275
  nn() {
276
276
  return this.Cn;
277
277
  }
278
- v() {
279
- return this.B;
280
- }
281
- P() {
282
- return this.T;
278
+ l() {
279
+ return this.h;
283
280
  }
284
- j() {
281
+ u() {
285
282
  return this.C;
286
283
  }
284
+ p() {
285
+ return this.j;
286
+ }
287
287
  gr() {
288
288
  if (this.Cs && this.Cn) return new User(this.Cs, this.Cn);
289
289
  }
@@ -293,37 +293,37 @@ class Jt {
293
293
  tr() {
294
294
  return !0 === this.ee(z.re);
295
295
  }
296
- h(t) {
296
+ g(t) {
297
297
  let i = !1;
298
- for (const s of this.Pa) s === t && (i = !0);
299
- i || this.Pa.push(t);
298
+ for (const s of this.Oa) s === t && (i = !0);
299
+ i || this.Oa.push(t);
300
300
  }
301
- _(i) {
301
+ v(i) {
302
302
  let s = !1;
303
- for (const t of this.La) t.constructor === i.constructor && (s = !0);
304
- i instanceof t && !s && this.La.push(i);
303
+ for (const t of this.Ta) t.constructor === i.constructor && (s = !0);
304
+ i instanceof t && !s && this.Ta.push(i);
305
305
  }
306
- F(t) {
307
- t instanceof u && this.Mi.push(t);
306
+ q(t) {
307
+ t instanceof u && this.yi.push(t);
308
308
  }
309
309
  removeAllSubscriptions() {
310
- if (this.rr()) for (const t of this.Mi) t.removeAllSubscriptions();
310
+ if (this.rr()) for (const t of this.yi) t.removeAllSubscriptions();
311
311
  }
312
312
  removeSubscription(t) {
313
- if (this.rr()) for (const i of this.Mi) i.removeSubscription(t);
313
+ if (this.rr()) for (const i of this.yi) i.removeSubscription(t);
314
314
  }
315
- fe(t) {
316
- this.Ta = t;
315
+ ce(t) {
316
+ this.Ia = t;
317
317
  }
318
318
  ao() {
319
319
  return this.isInitialized;
320
320
  }
321
- Ka() {
322
- return this.Ta;
323
- }
324
- Ws() {
321
+ Wa() {
325
322
  return this.Ia;
326
323
  }
324
+ Vs() {
325
+ return this.Xh;
326
+ }
327
327
  }
328
328
  const r = new Jt();
329
329
  export { r as default, Jt as BrazeSdkInstance, z as OPTIONS };
@@ -2,41 +2,41 @@ import ro from "../util/browser-detector.js";
2
2
  import Qt 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 N, Guid as O } from "../../shared-lib/index.js";
5
+ import { logger as E, Guid as P } from "../../shared-lib/index.js";
6
6
  import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
7
7
  import { values as Pt } 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
- (this.C = t),
12
- (this.Ga = e),
13
- (this.C = t),
11
+ (this.j = t),
12
+ (this.Fa = e),
13
+ (this.j = t),
14
14
  null == e && (e = Pt(DeviceProperties)),
15
- (this.Ga = e);
15
+ (this.Fa = e);
16
16
  }
17
- ve(t = !0) {
18
- let e = this.C.tu(s.iu.Qh);
19
- null == e && ((e = new _t(O.ce())), t && this.C.uu(s.iu.Qh, e));
17
+ fe(t = !0) {
18
+ let e = this.j.tu(s.iu.Jh);
19
+ null == e && ((e = new _t(P.oe())), t && this.j.uu(s.iu.Jh, e));
20
20
  const r = new Qt(e.eu);
21
- for (let t = 0; t < this.Ga.length; t++) {
22
- switch (this.Ga[t]) {
21
+ for (let t = 0; t < this.Fa.length; t++) {
22
+ switch (this.Fa[t]) {
23
23
  case DeviceProperties.BROWSER:
24
24
  r.browser = ro.browser;
25
25
  break;
26
26
  case DeviceProperties.BROWSER_VERSION:
27
- r.Ja = ro.version;
27
+ r.Ga = ro.version;
28
28
  break;
29
29
  case DeviceProperties.OS:
30
- r.os = this.Ha();
30
+ r.os = this.Ja();
31
31
  break;
32
32
  case DeviceProperties.RESOLUTION:
33
- r.Qa = screen.width + "x" + screen.height;
33
+ r.Ba = screen.width + "x" + screen.height;
34
34
  break;
35
35
  case DeviceProperties.LANGUAGE:
36
36
  r.language = ro.language;
37
37
  break;
38
38
  case DeviceProperties.TIME_ZONE:
39
- r.timeZone = this.Xa(new Date());
39
+ r.timeZone = this.Ha(new Date());
40
40
  break;
41
41
  case DeviceProperties.USER_AGENT:
42
42
  r.userAgent = ro.userAgent;
@@ -44,12 +44,12 @@ export default class Ot {
44
44
  }
45
45
  return r;
46
46
  }
47
- Ha() {
48
- if (ro.Ya()) return ro.Ya();
49
- const t = this.C.ft(s.gt.Za);
50
- return t && t.os_version ? t.os_version : ro.Ha();
47
+ Ja() {
48
+ if (ro.Ka()) return ro.Ka();
49
+ const t = this.j.lt(s.ct.Qa);
50
+ return t && t.os_version ? t.os_version : ro.Ja();
51
51
  }
52
- Xa(t) {
52
+ Ha(t) {
53
53
  let e = !1;
54
54
  if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
55
55
  try {
@@ -58,7 +58,7 @@ export default class Ot {
58
58
  if (null != t && "" !== t) return t;
59
59
  }
60
60
  } catch (t) {
61
- N.info(
61
+ E.info(
62
62
  "Intl.DateTimeFormat threw an error, cannot detect user's time zone:" +
63
63
  si(t),
64
64
  ),
@@ -66,9 +66,9 @@ export default class Ot {
66
66
  }
67
67
  if (e) return "";
68
68
  const r = t.getTimezoneOffset();
69
- return this.$a(r);
69
+ return this.Va(r);
70
70
  }
71
- $a(t) {
71
+ Va(t) {
72
72
  const e = Math.trunc(t / 60),
73
73
  r = Math.trunc(t % 60);
74
74
  let s = "GMT";