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