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