@braze/web-sdk 5.5.0 → 5.6.1

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 +54 -52
  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 +99 -99
  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 +261 -263
  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 +27 -27
  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 +234 -235
  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 +31 -30
  170. package/src/util/client-hints-parser.js +10 -10
  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 +18 -18
  182. package/src/util/validation-utils.js +89 -85
  183. package/src/util/window-utils.js +3 -3
@@ -1,7 +1,7 @@
1
- import x from "../common/base-feed.js";
1
+ import rr from "../common/base-feed.js";
2
2
  import { logCardClick, logCardImpressions } from "../Card/index.js";
3
3
  import { requestContentCardsRefresh } from "./request-content-cards-refresh.js";
4
- export default class ContentCards extends x {
4
+ export default class ContentCards extends rr {
5
5
  constructor(r, e) {
6
6
  super(r, e);
7
7
  }
@@ -14,11 +14,11 @@ export default class ContentCards extends x {
14
14
  logCardClick(r) {
15
15
  return logCardClick(r, !0);
16
16
  }
17
- sr() {
17
+ dr() {
18
18
  requestContentCardsRefresh();
19
19
  }
20
- dr() {
20
+ ur() {
21
21
  return !0;
22
22
  }
23
23
  }
24
- ContentCards.ur = 6e4;
24
+ ContentCards.ar = 6e4;
@@ -1,5 +1,5 @@
1
- import g from "./content-cards-provider-factory.js";
2
- import e from "../managers/braze-instance.js";
1
+ import W from "./content-cards-provider-factory.js";
2
+ import r from "../managers/braze-instance.js";
3
3
  export function getCachedContentCards() {
4
- if (e.X()) return g.rr().As(!1);
4
+ if (r.rr()) return W.m().ki(!1);
5
5
  }
@@ -1,5 +1,5 @@
1
- import e from "../managers/braze-instance.js";
2
- import g from "./content-cards-provider-factory.js";
3
- export function requestContentCardsRefresh(r, t) {
4
- if (e.X()) return g.rr().qs(r, t);
1
+ import r from "../managers/braze-instance.js";
2
+ import W from "./content-cards-provider-factory.js";
3
+ export function requestContentCardsRefresh(e, t) {
4
+ if (r.rr()) return W.m().zi(e, t);
5
5
  }
@@ -1,17 +1,17 @@
1
- import e from "../managers/braze-instance.js";
2
- import g from "./content-cards-provider-factory.js";
3
- export function subscribeToContentCardsUpdates(r) {
4
- if (!e.X()) return;
5
- const t = g.rr(),
6
- n = t.si(r);
7
- if (!t.ws()) {
8
- const r = e.cr();
9
- if (r) {
10
- const n = r.mr(() => {
11
- t.qs();
1
+ import r from "../managers/braze-instance.js";
2
+ import W from "./content-cards-provider-factory.js";
3
+ export function subscribeToContentCardsUpdates(t) {
4
+ if (!r.rr()) return;
5
+ const n = W.m(),
6
+ o = n.Fs(t);
7
+ if (!n.Ts()) {
8
+ const t = r.nn();
9
+ if (t) {
10
+ const r = t.rn(() => {
11
+ n.zi();
12
12
  });
13
- n && t.Cs(n);
13
+ r && n.Rs(r);
14
14
  }
15
15
  }
16
- return n;
16
+ return o;
17
17
  }
@@ -1,8 +1,8 @@
1
- import e from "../../managers/braze-instance.js";
2
- import { destroyFeedHtml as z } from "../../common/feed-display.js";
3
- export function hideContentCards(n) {
4
- if (!e.X()) return;
5
- const o = document.querySelectorAll(".ab-feed");
6
- for (let e = 0; e < o.length; e++)
7
- (null == n || (null != n && o[e].parentNode === n)) && z(o[e]);
1
+ import r from "../../managers/braze-instance.js";
2
+ import { destroyFeedHtml as ee } from "../../common/feed-display.js";
3
+ export function hideContentCards(e) {
4
+ if (!r.rr()) return;
5
+ const n = document.querySelectorAll(".ab-feed");
6
+ for (let o = 0; o < n.length; o++)
7
+ (null == e || (null != e && n[o].parentNode === e)) && ee(n[o]);
8
8
  }
@@ -1,44 +1,44 @@
1
- import e, { OPTIONS as L } from "../../managers/braze-instance.js";
1
+ import r, { OPTIONS as z } from "../../managers/braze-instance.js";
2
2
  import { ContentCards, subscribeToContentCardsUpdates } from "../index.js";
3
- import g from "../content-cards-provider-factory.js";
3
+ import W from "../content-cards-provider-factory.js";
4
4
  import {
5
- destroyFeedHtml as z,
6
- detectFeedImpressions as q,
7
- feedToHtml as I,
8
- LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as M,
9
- refreshFeed as $,
10
- registerFeedSubscriptionId as B,
11
- updateFeedCards as F,
5
+ destroyFeedHtml as ee,
6
+ detectFeedImpressions as nn,
7
+ feedToHtml as tn,
8
+ LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as en,
9
+ refreshFeed as on,
10
+ registerFeedSubscriptionId as rn,
11
+ updateFeedCards as an,
12
12
  } from "../../common/feed-display.js";
13
- import { setCardHeight as G } from "../../Card/display/card-display.js";
14
- import { setupFeedUI as H } from "../../ui/js/index.js";
15
- import { logger as r } from "../../../shared-lib/index.js";
13
+ import { setCardHeight as sn } from "../../Card/display/card-display.js";
14
+ import { setupFeedUI as fn } from "../../ui/js/index.js";
15
+ import { logger as N } from "../../../shared-lib/index.js";
16
16
  export function showContentCards(n, t) {
17
- if (!e.X()) return;
18
- H();
19
- let o = !1;
20
- null == n && ((n = document.body), (o = !0));
21
- const i = e.nn(L.tn) || e.nn(L.en) || !1,
22
- a = g.rr().As(!1);
23
- "function" == typeof t && F(a, t(a.cards.slice()), a.lastUpdated, null, i);
24
- const s = I(a, i, o),
25
- f = g.rr(),
26
- l = f.ps();
27
- (null == a.lastUpdated ||
28
- new Date().valueOf() - a.lastUpdated.valueOf() > ContentCards.ur) &&
29
- (null == l || new Date().valueOf() - l > ContentCards.ur) &&
30
- (r.info(
31
- `Cached content cards were older than max TTL of ${ContentCards.ur} ms, requesting an update from the server.`,
17
+ if (!r.rr()) return;
18
+ fn();
19
+ let e = !1;
20
+ null == n && ((n = document.body), (e = !0));
21
+ const o = r.sr(z.tn) || r.sr(z.en) || !1,
22
+ i = W.m().ki(!1);
23
+ "function" == typeof t && an(i, t(i.cards.slice()), i.lastUpdated, null, o);
24
+ const a = tn(i, o, e),
25
+ s = W.m(),
26
+ f = s.pi();
27
+ (null == i.lastUpdated ||
28
+ new Date().valueOf() - i.lastUpdated.valueOf() > ContentCards.ar) &&
29
+ (null == f || new Date().valueOf() - f > ContentCards.ar) &&
30
+ (N.info(
31
+ `Cached content cards were older than max TTL of ${ContentCards.ar} ms, requesting an update from the server.`,
32
32
  ),
33
- $(a, s),
34
- f.vs(new Date().valueOf()));
35
- const c = new Date().valueOf(),
36
- u = subscribeToContentCardsUpdates(function (n) {
37
- const e = s.querySelectorAll(".ab-refresh-button")[0];
33
+ on(i, a),
34
+ s.vi(new Date().valueOf()));
35
+ const l = new Date().valueOf(),
36
+ c = subscribeToContentCardsUpdates(function (n) {
37
+ const e = a.querySelectorAll(".ab-refresh-button")[0];
38
38
  if (null != e) {
39
39
  let n = 500,
40
- t = (n -= new Date().valueOf() - c);
41
- const o = s.getAttribute(M);
40
+ t = (n -= new Date().valueOf() - l);
41
+ const o = a.getAttribute(en);
42
42
  o && ((t = parseInt(o)), isNaN(t) || (n -= new Date().valueOf() - t)),
43
43
  setTimeout(
44
44
  function () {
@@ -47,31 +47,31 @@ export function showContentCards(n, t) {
47
47
  Math.max(n, 0),
48
48
  );
49
49
  }
50
- let o = n.cards;
51
- "function" == typeof t && (o = t(o.slice())),
52
- F(a, o, n.lastUpdated, s, i);
50
+ let r = n.cards;
51
+ "function" == typeof t && (r = t(r.slice())),
52
+ an(i, r, n.lastUpdated, a, o);
53
53
  });
54
- B(u, s);
55
- const d = function (n) {
54
+ rn(c, a);
55
+ const u = function (n) {
56
56
  const t = n.querySelectorAll(".ab-feed");
57
- let e = null;
58
- for (let o = 0; o < t.length; o++) t[o].parentNode === n && (e = t[o]);
59
- null != e
60
- ? (z(e), null != e.parentNode && e.parentNode.replaceChild(s, e))
61
- : n.appendChild(s),
57
+ let o = null;
58
+ for (let e = 0; e < t.length; e++) t[e].parentNode === n && (o = t[e]);
59
+ null != o
60
+ ? (ee(o), null != o.parentNode && o.parentNode.replaceChild(a, o))
61
+ : n.appendChild(a),
62
62
  setTimeout(function () {
63
- s.className = s.className.replace("ab-hide", "ab-show");
63
+ a.className = a.className.replace("ab-hide", "ab-show");
64
64
  }, 0),
65
- o && s.focus(),
66
- q(a, s),
67
- G(a.cards, n);
65
+ e && a.focus(),
66
+ nn(i, a),
67
+ sn(i.cards, n);
68
68
  };
69
- var m;
69
+ var d;
70
70
  null != n
71
- ? d(n)
71
+ ? u(n)
72
72
  : (window.onload =
73
- ((m = window.onload),
73
+ ((d = window.onload),
74
74
  function () {
75
- "function" == typeof m && m(new Event("oldLoad")), d(document.body);
75
+ "function" == typeof d && d(new Event("oldLoad")), u(document.body);
76
76
  }));
77
77
  }
@@ -1,8 +1,8 @@
1
- import e from "../../managers/braze-instance.js";
1
+ import r from "../../managers/braze-instance.js";
2
2
  import { hideContentCards, showContentCards } from "../index.js";
3
- export function toggleContentCards(n, o) {
4
- e.X() &&
3
+ export function toggleContentCards(e, n) {
4
+ r.rr() &&
5
5
  (document.querySelectorAll(".ab-feed").length > 0
6
6
  ? hideContentCards()
7
- : showContentCards(n, o));
7
+ : showContentCards(e, n));
8
8
  }
@@ -1,21 +1,21 @@
1
- import K from "../managers/braze-instance.js";
1
+ import aa from "../managers/braze-instance.js";
2
2
  import BrazeSdkMetadata from "./braze-sdk-metadata.js";
3
3
  import {
4
- isArray as j,
5
- validateValueIsFromEnum as J,
4
+ isArray as w,
5
+ validateValueIsFromEnum as ta,
6
6
  } from "../util/code-utils.js";
7
- import { logger as r } from "../../shared-lib/index.js";
7
+ import { logger as N } from "../../shared-lib/index.js";
8
8
  export function addSdkMetadata(a) {
9
- if (!K.X()) return;
10
- const t = K.nr();
9
+ if (!aa.rr()) return;
10
+ const t = aa.g();
11
11
  if (t) {
12
- if (!j(a))
12
+ if (!w(a))
13
13
  return (
14
- r.error("Cannot set SDK metadata because metadata is not an array."), !1
14
+ N.error("Cannot set SDK metadata because metadata is not an array."), !1
15
15
  );
16
16
  for (const t of a)
17
17
  if (
18
- !J(
18
+ !ta(
19
19
  BrazeSdkMetadata,
20
20
  t,
21
21
  "sdkMetadata contained an invalid value.",
@@ -1,17 +1,17 @@
1
- import e from "../managers/braze-instance.js";
2
- import { getByteLength as O } from "../util/string-utils.js";
3
- import { logger as r } from "../../shared-lib/index.js";
1
+ import r from "../managers/braze-instance.js";
2
+ import { getByteLength as er } from "../util/string-utils.js";
3
+ import { logger as N } from "../../shared-lib/index.js";
4
4
  import { User } from "../User/index.js";
5
- import { validateStandardString as P } from "../util/validation-utils.js";
6
- export function changeUser(i, t) {
7
- if (!e.X()) return;
8
- if (null == i || 0 === i.length || i != i)
9
- return void r.error("changeUser requires a non-empty userId.");
10
- if (O(i) > User.lr)
11
- return void r.error(
12
- `Rejected user id "${i}" because it is longer than ${User.lr} bytes.`,
5
+ import { validateStandardString as ir } from "../util/validation-utils.js";
6
+ export function changeUser(e, i) {
7
+ if (!r.rr()) return;
8
+ if (null == e || 0 === e.length || e != e)
9
+ return void N.error("changeUser requires a non-empty userId.");
10
+ if (er(e) > User.mr)
11
+ return void N.error(
12
+ `Rejected user id "${e}" because it is longer than ${User.mr} bytes.`,
13
13
  );
14
- if (null != t && !P(t, "set signature for new user", "signature")) return;
15
- const n = e.cr();
16
- n && n.changeUser(i.toString(), e.gr(), t);
14
+ if (null != i && !ir(i, "set signature for new user", "signature")) return;
15
+ const t = r.nn();
16
+ t && t.changeUser(e.toString(), r.lr(), i);
17
17
  }
@@ -1,5 +1,5 @@
1
- import e from "../managers/braze-instance.js";
2
- import { logger as r } from "../../shared-lib/index.js";
1
+ import r from "../managers/braze-instance.js";
2
+ import { logger as N } from "../../shared-lib/index.js";
3
3
  export function destroy() {
4
- r.info("Destroying Braze instance"), e.destroy(!0);
4
+ N.info("Destroying Braze instance"), r.destroy(!0);
5
5
  }
@@ -1,15 +1,15 @@
1
- import e from "../managers/braze-instance.js";
2
- import { logger as r, IndexedDBAdapter as A } from "../../shared-lib/index.js";
3
- import Q, { STORAGE_KEYS as o } from "../managers/storage-manager.js";
1
+ import r from "../managers/braze-instance.js";
2
+ import { logger as N, IndexedDBAdapter as it } from "../../shared-lib/index.js";
3
+ import ne, { STORAGE_KEYS as t } from "../managers/storage-manager.js";
4
4
  export function disableSDK() {
5
- const n = e.cr();
6
- n && n.requestImmediateDataFlush();
7
- const s = new Q.ee(null, !0),
8
- a = "This-cookie-will-expire-in-" + s.ne();
9
- s.store(o.se, a);
10
- const i = A.ts.Zt;
11
- new A(i, r).setItem(i.hs.ae, i.ie, !0),
12
- r.info("disableSDK was called"),
13
- e.destroy(!1),
14
- e.oe(!0);
5
+ const e = r.nn();
6
+ e && e.requestImmediateDataFlush();
7
+ const n = new ne.ne(null, !0),
8
+ s = "This-cookie-will-expire-in-" + n.se();
9
+ n.store(t.ae, s);
10
+ const a = it.Gs._s;
11
+ new it(a, N).setItem(a.Os.ie, a.oe, !0),
12
+ N.info("disableSDK was called"),
13
+ r.destroy(!1),
14
+ r.re(!0);
15
15
  }
@@ -1,11 +1,11 @@
1
- import e from "../managers/braze-instance.js";
2
- import { logger as r, IndexedDBAdapter as A } from "../../shared-lib/index.js";
3
- import Q, { STORAGE_KEYS as o } from "../managers/storage-manager.js";
1
+ import r from "../managers/braze-instance.js";
2
+ import { logger as N, IndexedDBAdapter as it } from "../../shared-lib/index.js";
3
+ import ne, { STORAGE_KEYS as t } from "../managers/storage-manager.js";
4
4
  export function enableSDK() {
5
- new Q.ee(null, !0).remove(o.se);
6
- const a = A.ts.Zt;
7
- new A(a, r).re(a.hs.ae, a.ie),
8
- r.info("enableSDK was called"),
9
- e.destroy(!1),
10
- e.oe(!1);
5
+ new ne.ne(null, !0).remove(t.ae);
6
+ const e = it.Gs._s;
7
+ new it(e, N).me(e.Os.ie, e.oe),
8
+ N.info("enableSDK was called"),
9
+ r.destroy(!1),
10
+ r.re(!1);
11
11
  }
@@ -1,13 +1,13 @@
1
- import e from "../managers/braze-instance.js";
2
- import { logger as r } from "../../shared-lib/index.js";
3
- export function getDeviceId(t) {
4
- if (!e.X()) return;
5
- const i = e.te();
6
- if (!i) return;
7
- const n = i.ce().id;
8
- if ("function" != typeof t) return n;
9
- r.warn(
1
+ import r from "../managers/braze-instance.js";
2
+ import { logger as N } from "../../shared-lib/index.js";
3
+ export function getDeviceId(e) {
4
+ if (!r.rr()) return;
5
+ const t = r.te();
6
+ if (!t) return;
7
+ const i = t.ce().id;
8
+ if ("function" != typeof e) return i;
9
+ N.warn(
10
10
  "The callback for getDeviceId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getDeviceId()`)",
11
11
  ),
12
- t(n);
12
+ e(i);
13
13
  }
@@ -1,4 +1,4 @@
1
- import e from "../managers/braze-instance.js";
1
+ import r from "../managers/braze-instance.js";
2
2
  export function getUser() {
3
- if (e.X()) return e.pr();
3
+ if (r.rr()) return r.cr();
4
4
  }
@@ -1,86 +1,86 @@
1
- import { logger as r } from "../../shared-lib/index.js";
2
- import { BRAZE_MUST_BE_INITIALIZED_ERROR as _ } from "../common/constants.js";
3
- import e from "../managers/braze-instance.js";
1
+ import { logger as N } from "../../shared-lib/index.js";
2
+ import { BRAZE_MUST_BE_INITIALIZED_ERROR as p } from "../common/constants.js";
3
+ import r from "../managers/braze-instance.js";
4
4
  import {
5
- BRAZE_ACTIONS as V,
6
- getDecodedBrazeAction as W,
5
+ BRAZE_ACTIONS as oo,
6
+ getDecodedBrazeAction as eo,
7
7
  } from "../util/braze-actions.js";
8
- import X from "../util/browser-detector.js";
9
- import { OperatingSystems as Y } from "../util/device-constants.js";
8
+ import ro from "../util/browser-detector.js";
9
+ import { OperatingSystems as so } from "../util/device-constants.js";
10
10
  import {
11
- BRAZE_ACTION_URI_REGEX as Z,
12
- isValidBrazeActionJson as oo,
11
+ BRAZE_ACTION_URI_REGEX as to,
12
+ isValidBrazeActionJson as io,
13
13
  } from "../util/validation-utils.js";
14
- import { WindowUtils as eo } from "../util/window-utils.js";
15
- import { getUser as ro } from "./get-user.js";
16
- export function _handleBrazeAction(o, s, t) {
17
- if (e.X())
18
- if (Z.test(o)) {
19
- const s = W(o);
20
- if (!s) return;
21
- const t = (o) => {
22
- if (!oo(o))
23
- return void r.error(
14
+ import { WindowUtils as no } from "../util/window-utils.js";
15
+ import { getUser as ao } from "./get-user.js";
16
+ export function _handleBrazeAction(o, e, s) {
17
+ if (r.rr())
18
+ if (to.test(o)) {
19
+ const e = eo(o);
20
+ if (!e) return;
21
+ const s = (o) => {
22
+ if (!io(o))
23
+ return void N.error(
24
24
  `Decoded Braze Action json is invalid: ${JSON.stringify(
25
25
  o,
26
26
  null,
27
27
  2,
28
28
  )}`,
29
29
  );
30
- const s = V.properties.type,
31
- i = V.properties.oo,
32
- n = V.properties.eo,
33
- a = o[s];
34
- if (a === V.types.ro) {
35
- const e = o[i];
36
- for (const o of e) t(o);
30
+ const e = oo.properties.type,
31
+ t = oo.properties.eo,
32
+ i = oo.properties.so,
33
+ n = o[e];
34
+ if (n === oo.types.io) {
35
+ const e = o[t];
36
+ for (const o of e) s(o);
37
37
  } else {
38
- const s = o[n];
39
- let t, i;
40
- switch (a) {
41
- case V.types.logCustomEvent:
38
+ const e = o[i];
39
+ let s, t;
40
+ switch (n) {
41
+ case oo.types.logCustomEvent:
42
42
  import("./log-custom-event.js").then(
43
43
  ({ logCustomEvent: logCustomEvent }) => {
44
- e.so()
45
- ? ((i = Array.prototype.slice.call(s)),
46
- logCustomEvent(...i))
47
- : r.error(_);
44
+ r.nt()
45
+ ? ((t = Array.prototype.slice.call(e)),
46
+ logCustomEvent(...t))
47
+ : N.error(p);
48
48
  },
49
49
  );
50
50
  break;
51
- case V.types.requestPushPermission:
51
+ case oo.types.requestPushPermission:
52
52
  import("../Push/request-push-permission.js").then(
53
53
  ({ requestPushPermission: requestPushPermission }) => {
54
- e.so()
55
- ? "Safari" === X.browser && X.OS === Y.io
54
+ r.nt()
55
+ ? "Safari" === ro.browser && ro.OS === so.ao
56
56
  ? window.navigator.standalone && requestPushPermission()
57
57
  : requestPushPermission()
58
- : r.error(_);
58
+ : N.error(p);
59
59
  },
60
60
  );
61
61
  break;
62
- case V.types.setEmailNotificationSubscriptionType:
63
- case V.types.setPushNotificationSubscriptionType:
64
- case V.types.setCustomUserAttribute:
65
- case V.types.addToSubscriptionGroup:
66
- case V.types.removeFromSubscriptionGroup:
67
- case V.types.addToCustomAttributeArray:
68
- case V.types.removeFromCustomAttributeArray:
69
- if (((t = ro()), t)) {
70
- t[a](...Array.prototype.slice.call(s));
62
+ case oo.types.setEmailNotificationSubscriptionType:
63
+ case oo.types.setPushNotificationSubscriptionType:
64
+ case oo.types.setCustomUserAttribute:
65
+ case oo.types.addToSubscriptionGroup:
66
+ case oo.types.removeFromSubscriptionGroup:
67
+ case oo.types.addToCustomAttributeArray:
68
+ case oo.types.removeFromCustomAttributeArray:
69
+ if (((s = ao()), s)) {
70
+ s[n](...Array.prototype.slice.call(e));
71
71
  }
72
72
  break;
73
- case V.types.no:
74
- case V.types.ao:
75
- (i = Array.prototype.slice.call(s)), eo.openUri(...i);
73
+ case oo.types.co:
74
+ case oo.types.mo:
75
+ (t = Array.prototype.slice.call(e)), no.openUri(...t);
76
76
  break;
77
77
  default:
78
- r.info(`Ignoring unknown Braze Action: ${a}`);
78
+ N.info(`Ignoring unknown Braze Action: ${n}`);
79
79
  }
80
80
  }
81
81
  };
82
- t(s);
83
- } else eo.openUri(o, s, t);
82
+ s(e);
83
+ } else no.openUri(o, e, s);
84
84
  }
85
85
  export function handleBrazeAction(o, e) {
86
86
  _handleBrazeAction(o, e);
@@ -1,4 +1,4 @@
1
- import e from "../managers/braze-instance.js";
1
+ import r from "../managers/braze-instance.js";
2
2
  export function initialize(i, n) {
3
- return e.initialize(i, n);
3
+ return r.initialize(i, n);
4
4
  }
@@ -1,4 +1,4 @@
1
- import Q, { STORAGE_KEYS as o } from "../managers/storage-manager.js";
1
+ import ne, { STORAGE_KEYS as t } from "../managers/storage-manager.js";
2
2
  export function isDisabled() {
3
- return !!new Q.ee(null, !0).br(o.se);
3
+ return !!new ne.ne(null, !0).gr(t.ae);
4
4
  }
@@ -1,4 +1,4 @@
1
- import e from "../managers/braze-instance.js";
1
+ import r from "../managers/braze-instance.js";
2
2
  export function isInitialized() {
3
- return e.so();
3
+ return r.nt();
4
4
  }
@@ -1,38 +1,38 @@
1
- import e from "../managers/braze-instance.js";
2
- import t from "../common/event-logger.js";
3
- import { logger as r, EventTypes as i } from "../../shared-lib/index.js";
4
- import tt from "../triggers/models/trigger-events.js";
5
- import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js";
1
+ import r from "../managers/braze-instance.js";
2
+ import c from "../common/event-logger.js";
3
+ import { logger as N, EventTypes as d } from "../../shared-lib/index.js";
4
+ import et from "../triggers/models/trigger-events.js";
5
+ import { TriggersProviderFactory as ot } from "../triggers/triggers-provider-factory.js";
6
6
  import {
7
- validateCustomProperties as ot,
8
- validateCustomString as rt,
7
+ validateCustomProperties as rt,
8
+ validateCustomString as nt,
9
9
  } from "../util/validation-utils.js";
10
- import { LOG_CUSTOM_EVENT_STRING as nt } from "../common/constants.js";
11
- export function logCustomEvent(o, n) {
12
- if (!e.X()) return !1;
13
- if (null == o || o.length <= 0)
10
+ import { LOG_CUSTOM_EVENT_STRING as mt } from "../common/constants.js";
11
+ export function logCustomEvent(t, e) {
12
+ if (!r.rr()) return !1;
13
+ if (null == t || t.length <= 0)
14
14
  return (
15
- r.error(
16
- `logCustomEvent requires a non-empty eventName, got "${o}". Ignoring event.`,
15
+ N.error(
16
+ `logCustomEvent requires a non-empty eventName, got "${t}". Ignoring event.`,
17
17
  ),
18
18
  !1
19
19
  );
20
- if (!rt(o, "log custom event", "the event name")) return !1;
21
- const [s, m] = ot(
22
- n,
23
- nt,
20
+ if (!nt(t, "log custom event", "the event name")) return !1;
21
+ const [o, n] = rt(
22
+ e,
23
+ mt,
24
24
  "eventProperties",
25
- `log custom event "${o}"`,
25
+ `log custom event "${t}"`,
26
26
  "event",
27
27
  );
28
- if (!s) return !1;
29
- const g = e.ir();
30
- if (g && g.me(o))
31
- return r.info(`Custom Event "${o}" is blocklisted, ignoring.`), !1;
32
- const f = t.q(i.CustomEvent, { n: o, p: m });
33
- if (f.L) {
34
- r.info(`Logged custom event "${o}".`);
35
- for (const t of f.ge) et.rr().fe(tt.ue, [o, n], t);
28
+ if (!o) return !1;
29
+ const i = r.v();
30
+ if (i && i.ge(t))
31
+ return N.info(`Custom Event "${t}" is blocklisted, ignoring.`), !1;
32
+ const s = c.ds(d.CustomEvent, { n: t, p: n });
33
+ if (s.ss) {
34
+ N.info(`Logged custom event "${t}".`);
35
+ for (const o of s.fe) ot.m().ue(et.ve, [t, e], o);
36
36
  }
37
- return f.L;
37
+ return s.ss;
38
38
  }