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