@braze/web-sdk 4.7.1 → 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 +204 -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 +165 -155
  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 +42 -42
  140. package/src/triggers/triggers-provider-factory.js +8 -8
  141. package/src/triggers/triggers-provider.js +171 -168
  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,311 +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.1");
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 a = 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 = a),
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 h = this.nn(Bt.Zn) || !1;
104
- if (((this.h = Dt.Bo(t, h)), new G.ne(null, !0).lr(o.ae)))
104
+ const a = this.nn(L._o) || !1;
105
+ if (
106
+ ((this.Jn = Bt.qo(t, a)), a && this.Jn.xo(t), new O.ee(null, !0).wr(i.re))
107
+ )
105
108
  return (
106
- r.D.info("Ignoring all activity due to previous opt out"),
107
- (this.vo = !0),
109
+ r.j.info("Ignoring all activity due to previous opt out"),
110
+ (this.Mo = !0),
108
111
  !1
109
112
  );
110
- for (const t of or(this.Po))
111
- -1 === Lt(r.Wo).indexOf(t) &&
112
- 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}'.`);
113
116
  const l = ["mparticle", "wordpress", "tealium"];
114
- if (null != this.nn(T.To)) {
115
- const t = this.nn(T.To);
117
+ if (null != this.nn(L.Po)) {
118
+ const t = this.nn(L.Po);
116
119
  -1 !== l.indexOf(t)
117
- ? (this.Fo = t)
118
- : r.D.error("Invalid sdk flavor passed: " + t);
120
+ ? (this.Yo = t)
121
+ : r.j.error("Invalid sdk flavor passed: " + t);
119
122
  }
120
- let f = this.nn(r.Wo.ho);
121
- if (null != f)
122
- if (p(f)) {
123
+ let u = this.nn(r.Jo.Io);
124
+ if (null != u)
125
+ if (p(u)) {
123
126
  const t = [];
124
- for (let i = 0; i < f.length; i++)
125
- F(
127
+ for (let i = 0; i < u.length; i++)
128
+ H(
126
129
  DeviceProperties,
127
- f[i],
130
+ u[i],
128
131
  "devicePropertyAllowlist contained an invalid value.",
129
132
  "DeviceProperties"
130
- ) && t.push(f[i]);
131
- f = t;
133
+ ) && t.push(u[i]);
134
+ u = t;
132
135
  } else
133
- r.D.error(
136
+ r.j.error(
134
137
  "devicePropertyAllowlist must be an array. Defaulting to all properties."
135
138
  ),
136
- (f = null);
137
- (this.Ur = new Ot(this.h, f)),
138
- (this.gt = new Mt(this.h)),
139
- (this.v = new bt(this.gt, this.h)),
140
- (this.j = new jt(this.h, this.v, this.gt, this.nn(T.Io)));
141
- 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();
142
145
  return (
143
- (this.Vo = new kt(this.h, this.nn(T.Eo), m)),
144
- this.jt(m),
145
- (this.vt = new Pt(
146
- this.Ur,
147
- this.h,
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,
148
157
  this.Vo,
149
- this.v,
150
- this.j,
151
- this.gt,
152
- this._r,
153
- this.Uo,
154
- this.jo,
155
- this.Fo,
156
- this.nn(T.Ao)
158
+ this.Yo,
159
+ this.nn(L.To)
157
160
  )),
158
- (this.Ci = new Rt(
159
- this._r,
160
- this.Uo,
161
- this.j,
162
- this.Ur,
163
- this.v,
164
- this.gt,
165
- 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,
166
169
  t => {
167
- 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);
168
171
  },
169
- this.Vo,
170
- this.vt
172
+ this.gh,
173
+ this.wh
171
174
  )),
172
- this.Ci.initialize(),
173
- r.D.info(
175
+ this.Ch.initialize(),
176
+ r.j.info(
174
177
  `Initialized for the Braze backend at "${this.nn(
175
- T.Xn
176
- )}" with API key "${this._r}".`
178
+ L.Eo
179
+ )}" with API key "${this.Ko}".`
177
180
  ),
178
- null != this.nn(T.So) &&
179
- D(
181
+ null != this.nn(L.Oo) &&
182
+ z(
180
183
  "enableHtmlInAppMessages",
181
184
  "initialization option",
182
185
  "allowUserSuppliedJavascript"
183
186
  ),
184
- W.init(),
185
- this.gt.Fi(() => {
186
- this.Oo &&
187
- this.gt.ci() &&
187
+ et.init(),
188
+ this.Zo.Ni(() => {
189
+ this.Ro &&
190
+ this.Zo.bi() &&
188
191
  import("../FeatureFlags/refresh-feature-flags.js").then(t => {
189
- if (!this.Oo) return;
192
+ if (!this.Ro) return;
190
193
  (0, t.default)();
191
194
  });
192
195
  }),
193
- this.Ci.cr(() => {
194
- this.Oo &&
195
- this.gt.ci() &&
196
+ this.Ch.pr(() => {
197
+ this.Ro &&
198
+ this.Zo.bi() &&
196
199
  import("../FeatureFlags/refresh-feature-flags.js").then(t => {
197
- if (!this.Oo) return;
200
+ if (!this.Ro) return;
198
201
  (0, t.default)(null, null, !0);
199
202
  });
200
203
  }),
201
- this.Co.St(this.Po),
202
- (this.Oo = !0),
204
+ this.jo.Et(this.Uo),
205
+ (this.Ro = !0),
203
206
  !0
204
207
  );
205
208
  }
206
209
  destroy(t) {
207
- if ((r.D.destroy(), this.Do())) {
208
- this.Lo.St(), this.Lo.removeAllSubscriptions();
209
- for (const t of this.Ro) t.destroy();
210
- this.Ro = [];
211
- for (const t of this.Mo) t.clearData(!1);
212
- (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 = []),
213
216
  this.removeAllSubscriptions(),
214
- (this.Se = []),
215
- this.Ci.destroy(),
216
- (this.Ci = null),
217
- (this.Vo = null),
218
- (this.Ur = null),
219
- (this.vt = null),
220
- (this.gt = null),
221
- (this.j = null),
222
- (this.v = null),
223
- (this.Po = {}),
224
- (this.Fo = void 0),
225
- (this.Oo = !1),
226
- (this.vo = !1),
227
- 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);
228
231
  }
229
232
  }
230
233
  rr() {
231
- if (this.Go()) return !1;
232
- if (!this.Do())
233
- throw new Error("Braze must be initialized before calling methods.");
234
+ if (this.Ph()) return !1;
235
+ if (!this.ue()) throw new Error(P);
234
236
  return !0;
235
237
  }
236
238
  ea() {
237
- return this._r;
239
+ return this.Ko;
238
240
  }
239
- ii() {
240
- return this.Vo;
241
+ Sr() {
242
+ return this.gh;
241
243
  }
242
- Ks() {
243
- return this.Uo;
244
+ Zs() {
245
+ return this.Ho;
244
246
  }
245
- ce() {
246
- return this.Ur;
247
+ ie() {
248
+ return this.Xo;
247
249
  }
248
- nr() {
249
- return this.vt;
250
+ ar() {
251
+ return this.wh;
250
252
  }
251
253
  nn(t) {
252
- return this.Po[t];
254
+ return this.Uo[t];
253
255
  }
254
- re() {
255
- return this.Mo;
256
+ gr() {
257
+ return this.Wo;
256
258
  }
257
- mr() {
258
- return this.Ci;
259
+ cr() {
260
+ return this.Ch;
259
261
  }
260
- ir() {
261
- return this.gt;
262
+ tr() {
263
+ return this.Zo;
262
264
  }
263
- g() {
264
- return this.j;
265
+ aa() {
266
+ return this.fh;
265
267
  }
266
268
  l() {
267
- return this.h;
269
+ return this.Jn;
268
270
  }
269
- gr() {
270
- 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);
271
273
  }
272
- p() {
273
- return this.v;
274
+ ir() {
275
+ return this.Qo;
274
276
  }
275
- tr() {
276
- 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);
277
279
  }
278
- u(t) {
280
+ g(t) {
279
281
  let i = !1;
280
- for (const s of this.Ro) s === t && (i = !0);
281
- i || this.Ro.push(t);
282
+ for (const s of this.Bo) s === t && (i = !0);
283
+ i || this.Bo.push(t);
282
284
  }
283
- ar(t) {
285
+ dr(t) {
284
286
  let i = !1;
285
- for (const s of this.Mo) s.constructor === t.constructor && (i = !0);
286
- 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);
287
289
  }
288
290
  jt(t) {
289
- t instanceof u && this.Se.push(t);
291
+ t instanceof E && this.zo.push(t);
290
292
  }
291
293
  removeAllSubscriptions() {
292
- if (this.rr()) for (const t of this.Se) t.removeAllSubscriptions();
294
+ if (this.rr()) for (const t of this.zo) t.removeAllSubscriptions();
293
295
  }
294
296
  removeSubscription(t) {
295
- 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);
296
298
  }
297
- le(t) {
298
- this.vo = t;
299
+ ae(t) {
300
+ this.Mo = t;
299
301
  }
300
- Do() {
301
- return this.Oo;
302
+ ue() {
303
+ return this.Ro;
302
304
  }
303
- Go() {
304
- return this.vo;
305
+ Ph() {
306
+ return this.Mo;
305
307
  }
306
- Ds() {
307
- return this.jo;
308
+ Us() {
309
+ return this.Vo;
308
310
  }
309
311
  }
310
- const e = new Bt();
311
- 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.Ko()) return ot.Ko();
45
- const e = this.h.I(o.q.Qo);
46
- return e && e.os_version ? e.os_version : ot.Xo();
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.Yo(t);
64
+ return this.ha(t);
65
65
  }
66
- Yo(e) {
66
+ ha(e) {
67
67
  const t = parseInt(e / 60),
68
68
  r = parseInt(e % 60);
69
69
  let s = "GMT";