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