@braze/web-sdk 5.9.1 → 6.0.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/index.d.ts +109 -253
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +1 -1
  4. package/shared-lib/event-types.js +24 -26
  5. package/shared-lib/guid.js +2 -2
  6. package/shared-lib/indexed-db-adapter.js +19 -19
  7. package/shared-lib/logger.js +2 -2
  8. package/shared-lib/supported-options.js +21 -22
  9. package/src/Banner/display/banner-to-html.js +13 -25
  10. package/src/Banner/display/destroy-banner-html.js +2 -2
  11. package/src/Banner/display/detect-banner-impressions.js +11 -11
  12. package/src/Banner/index.js +0 -1
  13. package/src/Banner/request-banners-refresh.js +8 -8
  14. package/src/Banner/subscribe-to-banners-updates.js +2 -2
  15. package/src/Banner/ui/insert-banner.js +7 -7
  16. package/src/Card/card-manager.js +35 -37
  17. package/src/Card/display/card-display.js +76 -74
  18. package/src/Card/index.js +0 -2
  19. package/src/Card/log-card-dismissal.js +2 -2
  20. package/src/Card/log-content-card-click.js +9 -2
  21. package/src/Card/log-content-card-impressions.js +11 -2
  22. package/src/Card/models/captioned-image.js +20 -20
  23. package/src/Card/models/card.js +110 -104
  24. package/src/Card/models/classic-card.js +20 -20
  25. package/src/Card/models/control-card.js +14 -14
  26. package/src/Card/models/image-only.js +19 -20
  27. package/src/Card/util/card-factory.js +57 -78
  28. package/src/ContentCards/content-cards-provider-factory.js +10 -10
  29. package/src/ContentCards/content-cards-provider.js +109 -109
  30. package/src/ContentCards/content-cards.js +21 -13
  31. package/src/ContentCards/get-cached-content-cards.js +2 -2
  32. package/src/ContentCards/request-content-cards-refresh.js +2 -2
  33. package/src/ContentCards/subscribe-to-content-cards-updates.js +5 -5
  34. package/src/ContentCards/ui/hide-content-cards.js +5 -5
  35. package/src/ContentCards/ui/show-content-cards.js +34 -34
  36. package/src/Core/add-sdk-metadata.js +2 -2
  37. package/src/Core/change-user.js +7 -7
  38. package/src/Core/disable-sdk.js +6 -6
  39. package/src/Core/enable-sdk.js +5 -5
  40. package/src/Core/get-user.js +1 -1
  41. package/src/Core/handle-braze-action.js +7 -7
  42. package/src/Core/is-disabled.js +2 -2
  43. package/src/Core/is-initialized.js +1 -1
  44. package/src/Core/log-custom-event.js +9 -9
  45. package/src/Core/log-purchase.js +7 -7
  46. package/src/Core/open-session.js +12 -12
  47. package/src/Core/request-immediate-data-flush.js +1 -1
  48. package/src/Core/set-sdk-authentication-signature.js +2 -2
  49. package/src/Core/wipe-data.js +7 -7
  50. package/src/FeatureFlags/feature-flag-factory.js +7 -7
  51. package/src/FeatureFlags/feature-flag.js +6 -6
  52. package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
  53. package/src/FeatureFlags/feature-flags-provider.js +1 -1
  54. package/src/FeatureFlags/get-all-feature-flags.js +2 -2
  55. package/src/FeatureFlags/get-feature-flag.js +2 -2
  56. package/src/FeatureFlags/log-feature-flag-impression.js +4 -4
  57. package/src/FeatureFlags/refresh-feature-flags.js +2 -2
  58. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
  59. package/src/InAppMessage/defer-in-app-message.js +1 -1
  60. package/src/InAppMessage/display/html-message-to-html.js +37 -37
  61. package/src/InAppMessage/display/in-app-message-to-html.js +139 -133
  62. package/src/InAppMessage/display/modal-utils.js +39 -41
  63. package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
  64. package/src/InAppMessage/in-app-message-factory.js +22 -14
  65. package/src/InAppMessage/in-app-message-manager.js +90 -88
  66. package/src/InAppMessage/log-in-app-message-button-click.js +5 -5
  67. package/src/InAppMessage/log-in-app-message-click.js +5 -5
  68. package/src/InAppMessage/log-in-app-message-html-click.js +5 -5
  69. package/src/InAppMessage/log-in-app-message-impression.js +1 -1
  70. package/src/InAppMessage/models/control-message.js +2 -2
  71. package/src/InAppMessage/models/full-screen-message.js +40 -34
  72. package/src/InAppMessage/models/html-message.js +23 -21
  73. package/src/InAppMessage/models/in-app-message-button.js +2 -2
  74. package/src/InAppMessage/models/in-app-message.js +137 -133
  75. package/src/InAppMessage/models/modal-message.js +39 -33
  76. package/src/InAppMessage/models/slide-up-message.js +36 -30
  77. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  78. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  79. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  80. package/src/InAppMessage/ui/show-in-app-message.js +56 -62
  81. package/src/Push/is-push-blocked.js +2 -2
  82. package/src/Push/is-push-permission-granted.js +2 -2
  83. package/src/Push/is-push-supported.js +2 -2
  84. package/src/Push/push-manager-factory.js +8 -8
  85. package/src/Push/push-manager.js +90 -90
  86. package/src/Push/request-push-permission.js +1 -1
  87. package/src/Push/utils/push-utils.js +25 -15
  88. package/src/User/user-manager.js +14 -14
  89. package/src/User/user.js +55 -55
  90. package/src/common/content-cards-display.js +211 -0
  91. package/src/common/event-logger.js +6 -6
  92. package/src/index.js +0 -1
  93. package/src/l10n/l10n-manager-factory.js +9 -9
  94. package/src/l10n/l10n-manager.js +6 -6
  95. package/src/managers/auth-manager.js +27 -27
  96. package/src/managers/braze-instance.js +136 -137
  97. package/src/managers/device-manager.js +22 -22
  98. package/src/managers/network-manager.js +180 -183
  99. package/src/managers/server-config-manager.js +63 -63
  100. package/src/managers/session-manager.js +34 -34
  101. package/src/managers/storage-manager-factory.js +11 -11
  102. package/src/managers/storage-manager.js +139 -141
  103. package/src/managers/subscription-manager.js +3 -3
  104. package/src/managers/utils.js +1 -1
  105. package/src/models/backend-errors.js +5 -5
  106. package/src/models/braze-event.js +15 -15
  107. package/src/models/device.js +3 -3
  108. package/src/models/identifier.js +13 -13
  109. package/src/models/push-token.js +12 -12
  110. package/src/models/request-result.js +2 -2
  111. package/src/models/server-config.js +29 -29
  112. package/src/request-controller.js +175 -174
  113. package/src/triggers/models/custom-event-data.js +6 -6
  114. package/src/triggers/models/custom-event-property-data.js +7 -7
  115. package/src/triggers/models/filter-set.js +8 -8
  116. package/src/triggers/models/filter.js +45 -45
  117. package/src/triggers/models/in-app-message-click-data.js +3 -3
  118. package/src/triggers/models/purchase-data.js +1 -1
  119. package/src/triggers/models/purchase-property-data.js +4 -4
  120. package/src/triggers/models/push-click-data.js +1 -1
  121. package/src/triggers/models/trigger-condition.js +47 -47
  122. package/src/triggers/models/trigger-events.js +3 -3
  123. package/src/triggers/models/trigger.js +15 -15
  124. package/src/triggers/triggers-provider-factory.js +4 -4
  125. package/src/triggers/triggers-provider.js +44 -44
  126. package/src/ui/js/attach-css.js +3 -3
  127. package/src/ui/js/banner-css.js +1 -1
  128. package/src/ui/js/iam-css.js +1 -1
  129. package/src/ui/js/load-font-awesome.js +2 -2
  130. package/src/util/base-device-parser.js +4 -4
  131. package/src/util/braze-actions.js +8 -14
  132. package/src/util/browser-detector.js +12 -12
  133. package/src/util/client-hints-parser.js +3 -3
  134. package/src/util/component-utils.js +14 -14
  135. package/src/util/device-constants.js +1 -1
  136. package/src/util/dom-utils.js +6 -6
  137. package/src/util/html-display-utils.js +37 -37
  138. package/src/util/key-codes.js +1 -1
  139. package/src/util/net.js +1 -1
  140. package/src/util/request-header-utils.js +17 -17
  141. package/src/util/user-agent-parser.js +4 -4
  142. package/src/util/validation-utils.js +20 -20
  143. package/src/util/window-utils.js +1 -1
  144. package/src/Card/log-card-click.js +0 -11
  145. package/src/Card/log-card-impressions.js +0 -13
  146. package/src/Feed/feed-provider-factory.js +0 -18
  147. package/src/Feed/feed-provider.js +0 -90
  148. package/src/Feed/feed.js +0 -20
  149. package/src/Feed/get-cached-feed.js +0 -5
  150. package/src/Feed/index.js +0 -8
  151. package/src/Feed/log-feed-displayed.js +0 -7
  152. package/src/Feed/request-feed-refresh.js +0 -5
  153. package/src/Feed/subscribe-to-feed-updates.js +0 -5
  154. package/src/Feed/types.js +0 -1
  155. package/src/Feed/ui/hide-feed.js +0 -7
  156. package/src/Feed/ui/show-feed.js +0 -96
  157. package/src/Feed/ui/toggle-feed.js +0 -8
  158. package/src/common/base-feed.js +0 -29
  159. package/src/common/feed-display.js +0 -211
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braze/web-sdk",
3
- "version": "5.9.1",
3
+ "version": "6.0.0",
4
4
  "description": "Braze SDK for web sites and other JS platforms.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  const ei = {
2
- qn: function (t) {
2
+ In: function (t) {
3
3
  const r = (t + "=".repeat((4 - (t.length % 4)) % 4))
4
4
  .replace(/\-/g, "+")
5
5
  .replace(/_/g, "/"),
@@ -1,36 +1,34 @@
1
1
  const d = {
2
2
  CustomEvent: "ce",
3
3
  Pr: "p",
4
- wc: "pc",
5
- Ac: "ca",
6
- Su: "i",
7
- qu: "ie",
8
- ts: "cci",
9
- rs: "ccic",
4
+ mc: "pc",
5
+ Cc: "ca",
6
+ Al: "i",
7
+ ul: "ie",
8
+ Zt: "cci",
9
+ ts: "ccic",
10
10
  Mt: "ccc",
11
- Wt: "ccd",
12
- Fl: "ss",
13
- Dl: "se",
14
- Ki: "si",
15
- Li: "sc",
16
- Qi: "sbc",
17
- Mc: "sfe",
18
- Do: "iec",
19
- bc: "lr",
20
- vc: "uae",
21
- ss: "ci",
22
- Ot: "cc",
23
- Sc: "lcaa",
24
- yc: "lcar",
25
- Hn: "inc",
26
- On: "add",
27
- Gn: "rem",
11
+ Vt: "ccd",
12
+ Iu: "ss",
13
+ Du: "se",
14
+ $i: "si",
15
+ Fi: "sc",
16
+ Oi: "sbc",
17
+ yc: "sfe",
18
+ Go: "iec",
19
+ dc: "lr",
20
+ cc: "uae",
21
+ vc: "lcaa",
22
+ gc: "lcar",
23
+ Gn: "inc",
24
+ Rn: "add",
25
+ On: "rem",
28
26
  $n: "set",
29
27
  Bn: "ncam",
30
- jc: "sgu",
28
+ bc: "sgu",
31
29
  yr: "ffi",
32
30
  ro: "bi",
33
31
  ct: "bc",
34
32
  },
35
- dr = { Fr: "feed_displayed", Dc: "content_cards_displayed" };
36
- export { d as EventTypes, dr as InternalEventTypes };
33
+ Ee = { Mc: "content_cards_displayed" };
34
+ export { d as EventTypes, Ee as InternalEventTypes };
@@ -1,4 +1,4 @@
1
- const K = {
1
+ const O = {
2
2
  ce: function () {
3
3
  const t = (t = !1) => {
4
4
  const n = (Math.random().toString(16) + "000000000").substr(2, 8);
@@ -7,4 +7,4 @@ const K = {
7
7
  return t() + t(!0) + t(!0) + t();
8
8
  },
9
9
  };
10
- export default K;
10
+ export default O;
@@ -1,4 +1,4 @@
1
- export default class st {
1
+ export default class et {
2
2
  constructor(t, e) {
3
3
  (this.database = t),
4
4
  (this.vd = e),
@@ -64,11 +64,11 @@ export default class st {
64
64
  "...",
65
65
  );
66
66
  const n = null === (e = t.target) || void 0 === e ? void 0 : e.result;
67
- for (const t in i.database.Ms) {
67
+ for (const t in i.database.Ls) {
68
68
  const e = t;
69
- i.database.Ms.hasOwnProperty(t) &&
70
- !n.objectStoreNames.contains(i.database.Ms[e]) &&
71
- n.createObjectStore(i.database.Ms[e]);
69
+ i.database.Ls.hasOwnProperty(t) &&
70
+ !n.objectStoreNames.contains(i.database.Ls[e]) &&
71
+ n.createObjectStore(i.database.Ls[e]);
72
72
  }
73
73
  }),
74
74
  (o.onsuccess = (n) => {
@@ -180,7 +180,7 @@ export default class st {
180
180
  });
181
181
  });
182
182
  }
183
- cr(t, e, n) {
183
+ jr(t, e, n) {
184
184
  if (!this.isSupported()) return "function" == typeof n && n(), !1;
185
185
  const o = this;
186
186
  return this.Bd((i) => {
@@ -249,7 +249,7 @@ export default class st {
249
249
  };
250
250
  });
251
251
  }
252
- Ns(t, e) {
252
+ As(t, e) {
253
253
  if (!this.isSupported()) return !1;
254
254
  const n = this;
255
255
  return this.Bd((o) => {
@@ -304,11 +304,11 @@ export default class st {
304
304
  clearData() {
305
305
  if (!this.isSupported()) return !1;
306
306
  const t = [];
307
- for (const e in this.database.Ms) {
307
+ for (const e in this.database.Ls) {
308
308
  const n = e;
309
- this.database.Ms.hasOwnProperty(e) &&
310
- this.database.Ms[n] !== this.database.Ms.pe &&
311
- t.push(this.database.Ms[n]);
309
+ this.database.Ls.hasOwnProperty(e) &&
310
+ this.database.Ls[n] !== this.database.Ls.pe &&
311
+ t.push(this.database.Ls[n]);
312
312
  }
313
313
  const e = this;
314
314
  return this.Bd(function (n) {
@@ -333,19 +333,19 @@ export default class st {
333
333
  });
334
334
  }
335
335
  }
336
- st.Ls = {
337
- Fs: {
336
+ et.Ds = {
337
+ Us: {
338
338
  Sd: "AppboyServiceWorkerAsyncStorage",
339
339
  VERSION: 6,
340
- Ms: {
341
- Nu: "data",
342
- jr: "pushClicks",
340
+ Ls: {
341
+ gl: "data",
342
+ hr: "pushClicks",
343
343
  cu: "pushSubscribed",
344
344
  Cd: "fallbackDevice",
345
- Js: "cardUpdates",
345
+ Fs: "cardUpdates",
346
346
  pe: "optOut",
347
- kr: "pendingData",
348
- yh: "sdkAuthenticationSignature",
347
+ $r: "pendingData",
348
+ qh: "sdkAuthenticationSignature",
349
349
  },
350
350
  be: 1,
351
351
  },
@@ -24,13 +24,13 @@ const N = {
24
24
  },
25
25
  warn: function (n) {
26
26
  if (N.zg) {
27
- const o = "Braze SDK Warning: " + n + " (v5.9.1)";
27
+ const o = "Braze SDK Warning: " + n + " (v6.0.0)";
28
28
  null != N.vd ? N.vd(o) : console.warn(o);
29
29
  }
30
30
  },
31
31
  error: function (n) {
32
32
  if (N.zg) {
33
- const o = "Braze SDK Error: " + n + " (v5.9.1)";
33
+ const o = "Braze SDK Error: " + n + " (v6.0.0)";
34
34
  null != N.vd ? N.vd(o) : console.error(o);
35
35
  }
36
36
  },
@@ -1,28 +1,27 @@
1
1
  export default {
2
- Yo: "allowCrawlerActivity",
3
- Zo: "baseUrl",
4
- Wh: "noCookies",
5
- Vh: "devicePropertyAllowlist",
6
- Da: "disablePushTokenMaintenance",
7
- $h: "enableLogging",
8
- Yh: "enableSdkAuthentication",
9
- Ca: "manageServiceWorkerExternally",
10
- Xh: "minimumIntervalBetweenTriggerActionsInSeconds",
11
- Zh: "sessionTimeoutInSeconds",
12
- Qh: "appVersion",
13
- Ea: "appVersionNumber",
14
- _a: "serviceWorkerLocation",
15
- Ba: "safariWebsitePushId",
2
+ _o: "allowCrawlerActivity",
3
+ Yo: "baseUrl",
4
+ Xo: "noCookies",
5
+ Zo: "devicePropertyAllowlist",
6
+ Aa: "disablePushTokenMaintenance",
7
+ Wh: "enableLogging",
8
+ Vh: "enableSdkAuthentication",
9
+ qa: "manageServiceWorkerExternally",
10
+ Kh: "minimumIntervalBetweenTriggerActionsInSeconds",
11
+ $h: "sessionTimeoutInSeconds",
12
+ Yh: "appVersion",
13
+ Xh: "appVersionNumber",
14
+ Ma: "serviceWorkerLocation",
15
+ ka: "safariWebsitePushId",
16
16
  Zn: "localization",
17
17
  er: "contentSecurityNonce",
18
18
  re: "allowUserSuppliedJavascript",
19
- Go: "inAppMessageZIndex",
20
- Ko: "openInAppMessagesInNewTab",
21
- en: "openNewsFeedCardsInNewTab",
22
- mh: "requireExplicitInAppMessageDismissal",
23
- Ia: "doNotLoadFontAwesome",
24
- Na: "deviceId",
25
- Aa: "serviceWorkerScope",
26
- Oa: "sdkFlavor",
19
+ Ko: "inAppMessageZIndex",
20
+ Qo: "openInAppMessagesInNewTab",
21
+ Lh: "requireExplicitInAppMessageDismissal",
22
+ Zh: "doNotLoadFontAwesome",
23
+ Qh: "deviceId",
24
+ _a: "serviceWorkerScope",
25
+ Ea: "sdkFlavor",
27
26
  tn: "openCardsInNewTab",
28
27
  };
@@ -2,10 +2,8 @@ import {
2
2
  attachHtmlToIframeWithNonce as m,
3
3
  buildBrazeBridge as b,
4
4
  } from "../../util/html-display-utils.js";
5
- import r from "../../managers/braze-instance.js";
6
5
  import N from "../../../shared-lib/logger.js";
7
- import { BRAZE_MUST_BE_INITIALIZED_ERROR as p } from "../../common/constants.js";
8
- import { logBannerClick } from "../log-banner-click.js";
6
+ import { logBannerClick as E } from "../log-banner-click.js";
9
7
  export const BANNER_PLACEMENT_ID = "data-ab-banner-placement-id";
10
8
  export const BANNER_HTML_CLASS = "ab-html-banner";
11
9
  export const CONTROL_BANNER_HTML_CLASS = "ab-html-control-banner";
@@ -32,29 +30,19 @@ export function bannerToHtml(n, t) {
32
30
  const t = e.contentWindow,
33
31
  o = t.document.getElementsByTagName("title");
34
32
  o && o.length > 0 && e.setAttribute("title", o[0].textContent || "");
35
- const a = Object.assign(
36
- Object.assign(
37
- {},
38
- b(e, () => {
39
- import("../../Feed/ui/show-feed.js").then((n) => {
40
- r.nn() ? n.showFeed() : N.error(p);
41
- });
42
- }),
43
- ),
44
- {
45
- logClick: function () {
46
- logBannerClick(n, ...arguments);
47
- },
48
- closeMessage: function () {},
49
- setBannerHeight: (n) => {
50
- isNaN(n) || !isFinite(n) || n < 0
51
- ? N.warn(`Invalid banner height: ${n}`)
52
- : (e.style.height = `${n}px`);
53
- },
33
+ const r = Object.assign(Object.assign({}, b(e)), {
34
+ logClick: function () {
35
+ E(n, ...arguments);
54
36
  },
55
- );
56
- (t.brazeBridge = a),
57
- (t.appboyBridge = a),
37
+ closeMessage: function () {},
38
+ setBannerHeight: (n) => {
39
+ isNaN(n) || !isFinite(n) || n < 0
40
+ ? N.warn(`Invalid banner height: ${n}`)
41
+ : (e.style.height = `${n}px`);
42
+ },
43
+ });
44
+ (t.brazeBridge = r),
45
+ (t.appboyBridge = r),
58
46
  t.dispatchEvent(new CustomEvent("ab.BridgeReady"));
59
47
  }),
60
48
  e
@@ -1,7 +1,7 @@
1
1
  import { removeSubscription } from "../../Core/remove-subscription.js";
2
- import { SUBSCRIPTION_ID_DATA_ATTRIBUTE as f } from "../../common/constants.js";
2
+ import { SUBSCRIPTION_ID_DATA_ATTRIBUTE as p } from "../../common/constants.js";
3
3
  export function destroyBannerHtml(o) {
4
- const n = o.getAttribute(f);
4
+ const n = o.getAttribute(p);
5
5
  null != n && removeSubscription(n),
6
6
  o && o.parentNode && o.parentNode.removeChild(o);
7
7
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
- impressOnBottom as j,
3
- impressOnTop as $,
4
- detectImpression as g,
2
+ impressOnBottom as f,
3
+ impressOnTop as j,
4
+ detectImpression as $,
5
5
  } from "../../common/detect-impression.js";
6
- import { topIsInView as x, bottomIsInView as B } from "../../util/dom-utils.js";
7
- import { logBannerImpressions } from "../log-banner-impressions.js";
6
+ import { topIsInView as g, bottomIsInView as x } from "../../util/dom-utils.js";
7
+ import { logBannerImpressions as B } from "../log-banner-impressions.js";
8
8
  import {
9
9
  BANNER_HTML_CLASS as I,
10
10
  BANNER_PLACEMENT_ID as k,
@@ -17,12 +17,12 @@ export function detectBannerImpressions() {
17
17
  const s = o[n],
18
18
  i = s.getAttribute(k);
19
19
  if (!i) continue;
20
- const m = g.oo(s),
21
- r = g.no(s);
20
+ const m = $.oo(s),
21
+ r = $.no(s);
22
22
  if (m && r) continue;
23
- const e = x(s),
24
- c = B(s);
25
- e && !m && $(s), c && !r && j(s), g.oo(s) && g.no(s) && t.push(i);
23
+ const e = g(s),
24
+ c = x(s);
25
+ e && !m && j(s), c && !r && f(s), $.oo(s) && $.no(s) && t.push(i);
26
26
  }
27
- t.length > 0 && logBannerImpressions(t);
27
+ t.length > 0 && B(t);
28
28
  }
@@ -4,4 +4,3 @@ export { insertBanner } from "./ui/insert-banner.js";
4
4
  export { requestBannersRefresh } from "./request-banners-refresh.js";
5
5
  export { getAllBanners } from "./get-all-banners.js";
6
6
  export { subscribeToBannersUpdates } from "./subscribe-to-banners-updates.js";
7
- export { logBannerImpressions } from "./log-banner-impressions.js";
@@ -1,19 +1,19 @@
1
1
  import { logger as N } from "../../shared-lib/index.js";
2
2
  import {
3
3
  BANNERS_DISABLED_MESSAGE as v,
4
- BRAZE_MUST_BE_INITIALIZED_ERROR as p,
4
+ BRAZE_MUST_BE_INITIALIZED_ERROR as w,
5
5
  } from "../common/constants.js";
6
- import r, { OPTIONS as w } from "../managers/braze-instance.js";
7
- import { isArray as z } from "../util/code-utils.js";
8
- import { isValidBannerPlacementId as D } from "../util/validation-utils.js";
6
+ import r, { OPTIONS as z } from "../managers/braze-instance.js";
7
+ import { isArray as D } from "../util/code-utils.js";
8
+ import { isValidBannerPlacementId as R } from "../util/validation-utils.js";
9
9
  import i from "./banner-provider-factory.js";
10
10
  export function requestBannersRefresh(e, n, t) {
11
- if (!r.rr()) return void N.warn(p);
11
+ if (!r.rr()) return void N.warn(w);
12
12
  const s = r.v();
13
13
  if (!s) return;
14
- if (!z(e) || 0 === e.length)
14
+ if (!D(e) || 0 === e.length)
15
15
  return void N.warn("placementIds should be a non-empty array.");
16
- if (!r.ee(w.re))
16
+ if (!r.ee(z.re))
17
17
  return void N.error(
18
18
  "Banners are disabled. Use the 'allowUserSuppliedJavascript' option for braze.initialize to enable these messages.",
19
19
  );
@@ -35,7 +35,7 @@ export function requestBannersRefresh(e, n, t) {
35
35
  0 !==
36
36
  (e = e.filter(
37
37
  (e) =>
38
- !!D(e) ||
38
+ !!R(e) ||
39
39
  (N.warn(
40
40
  `Placement ID should be a valid utf8 string with no whitespaces, filtering out: ${e}`,
41
41
  ),
@@ -12,9 +12,9 @@ export function subscribeToBannersUpdates(n) {
12
12
  const s = t.qt(n);
13
13
  if (!t.Ct()) {
14
14
  const n =
15
- null === (o = r.rn()) || void 0 === o
15
+ null === (o = r.nn()) || void 0 === o
16
16
  ? void 0
17
- : o.on(() => {
17
+ : o.rn(() => {
18
18
  const n = t.ht();
19
19
  n && n.length > 0 && t.$(n);
20
20
  });
@@ -1,26 +1,26 @@
1
1
  import N from "../../../shared-lib/logger.js";
2
- import { SUBSCRIPTION_ID_DATA_ATTRIBUTE as f } from "../../common/constants.js";
3
- import r, { OPTIONS as w } from "../../managers/braze-instance.js";
2
+ import { SUBSCRIPTION_ID_DATA_ATTRIBUTE as p } from "../../common/constants.js";
3
+ import r, { OPTIONS as z } from "../../managers/braze-instance.js";
4
4
  import { setupBannerUI as U } from "../../ui/js/banner-css.js";
5
5
  import { addPassiveEventListener as J } from "../../util/dom-utils.js";
6
6
  import { bannerToHtml as S } from "../display/banner-to-html.js";
7
7
  import { destroyBannerHtml as A } from "../display/destroy-banner-html.js";
8
- import { detectBannerImpressions as E } from "../display/detect-banner-impressions.js";
8
+ import { detectBannerImpressions as F } from "../display/detect-banner-impressions.js";
9
9
  import { subscribeToBannersUpdates } from "../subscribe-to-banners-updates.js";
10
10
  export function insertBanner(o, e) {
11
11
  if (!r.rr()) return;
12
12
  if (!o) return void N.error("Not inserting banner: banner was not provided.");
13
13
  if (!e)
14
14
  return void N.error("Not inserting banner: parentNode was not provided.");
15
- if (!r.ee(w.re))
15
+ if (!r.ee(z.re))
16
16
  return void N.error(
17
17
  "Banners are disabled. Use the 'allowUserSuppliedJavascript' option for braze.initialize to enable these messages.",
18
18
  );
19
19
  U();
20
- const n = S(o, r.ee(w.er)),
20
+ const n = S(o, r.ee(z.er)),
21
21
  s = subscribeToBannersUpdates((s) => {
22
22
  const i = s[o.placementId];
23
- i ? e.replaceChildren(S(i, r.ee(w.er))) : A(n);
23
+ i ? e.replaceChildren(S(i, r.ee(z.er))) : A(n);
24
24
  });
25
- s && n.setAttribute(f, s), e.replaceChildren(n), J(window, "scroll", E), E();
25
+ s && n.setAttribute(p, s), e.replaceChildren(n), J(window, "scroll", F), F();
26
26
  }
@@ -1,31 +1,31 @@
1
1
  import { ControlCard } from "./models/index.js";
2
2
  import c from "../common/event-logger.js";
3
- import F from "../models/request-result.js";
3
+ import G from "../models/request-result.js";
4
4
  import { logger as N, EventTypes as d } from "../../shared-lib/index.js";
5
5
  import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
6
6
  export default class M {
7
7
  constructor(t) {
8
8
  (this.C = t), (this.C = t);
9
9
  }
10
- logClick(t, n) {
11
- const r = new F();
10
+ logClick(t) {
11
+ const n = new G();
12
12
  if ((t.$t(), null == t.url || "" === t.url))
13
13
  return (
14
14
  N.info(`Card ${t.id} has no url. Not logging click to Braze servers.`),
15
- r
15
+ n
16
16
  );
17
- if (n && t.id && this.C) {
17
+ if (t.id && this.C) {
18
18
  const n = this.C.ft(s.gt.Kt) || {};
19
19
  (n[t.id] = !0), this.C.Bt(s.gt.Kt, n);
20
20
  }
21
- const i = this.Lt([t]);
22
- if (null == i) return r;
23
- const o = n ? d.Mt : d.Ot;
24
- return c.ut(o, i);
21
+ const r = this.Lt([t]);
22
+ if (null == r) return n;
23
+ const i = d.Mt;
24
+ return c.ut(i, r);
25
25
  }
26
- Pt(t) {
27
- const n = new F();
28
- if (!t.Qt())
26
+ Ot(t) {
27
+ const n = new G();
28
+ if (!t.Pt())
29
29
  return (
30
30
  N.info(
31
31
  `Card ${t.id} refused this dismissal. Ignoring analytics event.`,
@@ -33,41 +33,39 @@ export default class M {
33
33
  n
34
34
  );
35
35
  if (t.id && this.C) {
36
- const n = this.C.ft(s.gt.Vt) || {};
37
- (n[t.id] = !0), this.C.Bt(s.gt.Vt, n);
36
+ const n = this.C.ft(s.gt.Qt) || {};
37
+ (n[t.id] = !0), this.C.Bt(s.gt.Qt, n);
38
38
  }
39
39
  const r = this.Lt([t]);
40
- return null == r ? n : c.ut(d.Wt, r);
40
+ return null == r ? n : c.ut(d.Vt, r);
41
41
  }
42
- Xt(t, n) {
43
- const r = new F(!0),
44
- i = [],
45
- o = [];
46
- let e = {};
47
- this.C && (e = n ? this.C.ft(s.gt.Yt) || {} : this.C.ft(s.gt.Zt) || {});
42
+ Wt(t) {
43
+ const n = new G(!0),
44
+ r = [],
45
+ i = [];
46
+ let o = {};
47
+ this.C && (o = this.C.ft(s.gt.Xt) || {});
48
48
  for (const s of t) {
49
- s._t()
50
- ? (s instanceof ControlCard ? o.push(s) : i.push(s),
51
- s.id && (e[s.id] = !0))
49
+ s.Yt()
50
+ ? (s instanceof ControlCard ? i.push(s) : r.push(s),
51
+ s.id && (o[s.id] = !0))
52
52
  : N.info(
53
53
  `Card ${s.id} logged an impression too recently. Ignoring analytics event.`,
54
54
  );
55
55
  }
56
- const l = this.Lt(i),
57
- a = this.Lt(o);
58
- if (null == l && null == a) return (r.tt = !1), r;
59
- if (
60
- (this.C && (n ? this.C.Bt(s.gt.Yt, e) : this.C.Bt(s.gt.Zt, e)), null != l)
61
- ) {
62
- const t = n ? d.ts : d.ss,
63
- s = c.ut(t, l);
64
- r.ns(s);
56
+ const e = this.Lt(r),
57
+ l = this.Lt(i);
58
+ if (null == e && null == l) return (n.tt = !1), n;
59
+ if ((this.C && this.C.Bt(s.gt.Xt, o), null != e)) {
60
+ const t = d.Zt,
61
+ s = c.ut(t, e);
62
+ n._t(s);
65
63
  }
66
- if (null != a && n) {
67
- const t = c.ut(d.rs, a);
68
- r.ns(t);
64
+ if (null != l) {
65
+ const t = c.ut(d.ts, l);
66
+ n._t(t);
69
67
  }
70
- return r;
68
+ return n;
71
69
  }
72
70
  Lt(t) {
73
71
  let s,