@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
@@ -1,27 +1,27 @@
1
1
  import { addPassiveEventListener as J, buildSvg as oe } from "./dom-utils.js";
2
- import { KeyCodes as bt } from "./key-codes.js";
3
- export function createCloseButton(t, o, e, n = "ltr") {
4
- const r = document.createElement("button");
5
- r.setAttribute("aria-label", t),
6
- r.setAttribute("tabindex", "0"),
7
- r.setAttribute("role", "button"),
8
- (r.dir = n),
9
- J(r, "touchstart"),
10
- (r.className = "ab-close-button");
2
+ import { KeyCodes as ie } from "./key-codes.js";
3
+ export function createCloseButton(t, o, e, r = "ltr") {
4
+ const n = document.createElement("button");
5
+ n.setAttribute("aria-label", t),
6
+ n.setAttribute("role", "button"),
7
+ (n.dir = r),
8
+ J(n, "touchstart"),
9
+ (n.className = "ab-close-button");
11
10
  const l = oe(
12
11
  "0 0 15 15",
13
12
  "M15 1.5L13.5 0l-6 6-6-6L0 1.5l6 6-6 6L1.5 15l6-6 6 6 1.5-1.5-6-6 6-6z",
14
13
  o,
15
14
  );
16
15
  return (
17
- r.appendChild(l),
18
- r.addEventListener("keydown", (t) => {
19
- (t.keyCode !== bt.Wo && t.keyCode !== bt.Xo) ||
16
+ n.appendChild(l),
17
+ l.setAttribute("aria-hidden", "true"),
18
+ n.addEventListener("keydown", (t) => {
19
+ (t.keyCode !== ie.$o && t.keyCode !== ie.Co) ||
20
20
  (e(), t.stopPropagation());
21
21
  }),
22
- (r.onclick = (t) => {
22
+ (n.onclick = (t) => {
23
23
  e(), t.stopPropagation();
24
24
  }),
25
- r
25
+ n
26
26
  );
27
27
  }
@@ -7,7 +7,7 @@ export const Browsers = {
7
7
  };
8
8
  export const OperatingSystems = {
9
9
  xg: "Android",
10
- ao: "iOS",
10
+ co: "iOS",
11
11
  Pg: "Mac",
12
12
  Og: "Windows",
13
13
  };
@@ -18,8 +18,8 @@ export function _isInView(t, n = !1, e = !1, s = !1) {
18
18
  !s)
19
19
  );
20
20
  }
21
- export const DOMUtils = { Ic: null, Ho: _isInView };
22
- export const DIRECTIONS = { qo: "up", yo: "down", ie: "left", de: "right" };
21
+ export const DOMUtils = { Ic: null, Oo: _isInView };
22
+ export const DIRECTIONS = { Do: "up", Eo: "down", ie: "left", de: "right" };
23
23
  export function supportsPassive() {
24
24
  if (null == DOMUtils.Ic) {
25
25
  DOMUtils.Ic = !1;
@@ -41,10 +41,10 @@ export function addPassiveEventListener(t, n, e = () => {}) {
41
41
  t.addEventListener(n, e, !!supportsPassive() && { passive: !0 });
42
42
  }
43
43
  export function topIsInView(t) {
44
- return DOMUtils.Ho(t, !0, !1, !1);
44
+ return DOMUtils.Oo(t, !0, !1, !1);
45
45
  }
46
46
  export function bottomIsInView(t) {
47
- return DOMUtils.Ho(t, !1, !0, !1);
47
+ return DOMUtils.Oo(t, !1, !0, !1);
48
48
  }
49
49
  export function clickElement(t) {
50
50
  if (t.onclick) {
@@ -69,9 +69,9 @@ export function detectSwipe(t, n, e) {
69
69
  (i = null))
70
70
  : Math.abs(u) >= 25 &&
71
71
  (((u > 0 &&
72
- n === DIRECTIONS.qo &&
72
+ n === DIRECTIONS.Do &&
73
73
  t.scrollTop === t.scrollHeight - t.offsetHeight) ||
74
- (u < 0 && n === DIRECTIONS.yo && 0 === t.scrollTop)) &&
74
+ (u < 0 && n === DIRECTIONS.Eo && 0 === t.scrollTop)) &&
75
75
  e(o),
76
76
  (s = null),
77
77
  (i = null));
@@ -1,28 +1,28 @@
1
1
  import { logger as N } from "../../shared-lib/index.js";
2
2
  import { getUser as ao } from "../Core/get-user.js";
3
- import { BRAZE_MUST_BE_INITIALIZED_ERROR as p } from "../common/constants.js";
3
+ import { BRAZE_MUST_BE_INITIALIZED_ERROR as w } from "../common/constants.js";
4
4
  import r from "../managers/braze-instance.js";
5
5
  import { keys as C } from "../util/code-utils.js";
6
- export const buildBrazeBridge = (t, e, o) => {
7
- const n = { display: {}, web: {} },
6
+ export const buildBrazeBridge = (t, e) => {
7
+ const o = { display: {}, web: {} },
8
8
  requestPushPermission = function () {
9
9
  return function () {
10
10
  const t = arguments;
11
11
  import("../Push/request-push-permission.js").then((e) => {
12
- r.nn()
12
+ r.ao()
13
13
  ? e.requestPushPermission(...Array.prototype.slice.call(t))
14
- : N.error(p);
14
+ : N.error(w);
15
15
  });
16
16
  };
17
17
  },
18
- s = {
18
+ n = {
19
19
  requestImmediateDataFlush: function () {
20
20
  const t = arguments;
21
21
  import("../Core/request-immediate-data-flush.js").then(
22
22
  ({ requestImmediateDataFlush: requestImmediateDataFlush }) => {
23
- r.nn()
23
+ r.ao()
24
24
  ? requestImmediateDataFlush(...Array.prototype.slice.call(t))
25
- : N.error(p);
25
+ : N.error(w);
26
26
  },
27
27
  );
28
28
  },
@@ -30,7 +30,7 @@ export const buildBrazeBridge = (t, e, o) => {
30
30
  const t = arguments;
31
31
  import("../Core/log-custom-event.js").then(
32
32
  ({ logCustomEvent: logCustomEvent }) => {
33
- if (!r.nn()) return void N.error(p);
33
+ if (!r.ao()) return void N.error(w);
34
34
  logCustomEvent(...Array.prototype.slice.call(t));
35
35
  },
36
36
  );
@@ -39,7 +39,7 @@ export const buildBrazeBridge = (t, e, o) => {
39
39
  const t = arguments;
40
40
  import("../Core/log-purchase.js").then(
41
41
  ({ logPurchase: logPurchase }) => {
42
- if (!r.nn()) return void N.error(p);
42
+ if (!r.ao()) return void N.error(w);
43
43
  logPurchase(...Array.prototype.slice.call(t));
44
44
  },
45
45
  );
@@ -48,9 +48,9 @@ export const buildBrazeBridge = (t, e, o) => {
48
48
  const t = arguments;
49
49
  import("../Push/unregister-push.js").then(
50
50
  ({ unregisterPush: unregisterPush }) => {
51
- r.nn()
51
+ r.ao()
52
52
  ? unregisterPush(...Array.prototype.slice.call(t))
53
- : N.error(p);
53
+ : N.error(w);
54
54
  },
55
55
  );
56
56
  },
@@ -58,18 +58,18 @@ export const buildBrazeBridge = (t, e, o) => {
58
58
  changeUser: function () {
59
59
  const t = arguments;
60
60
  import("../Core/change-user.js").then(({ changeUser: changeUser }) => {
61
- if (!r.nn()) return void N.error(p);
61
+ if (!r.ao()) return void N.error(w);
62
62
  changeUser(...Array.prototype.slice.call(t));
63
63
  });
64
64
  },
65
65
  },
66
- i = function (t) {
66
+ s = function (t) {
67
67
  return function () {
68
- s[t](...Array.prototype.slice.call(arguments));
68
+ n[t](...Array.prototype.slice.call(arguments));
69
69
  };
70
70
  };
71
- for (const t of C(s)) n[t] = i(t);
72
- const u = [
71
+ for (const t of C(n)) o[t] = s(t);
72
+ const i = [
73
73
  "setFirstName",
74
74
  "setLastName",
75
75
  "setEmail",
@@ -91,39 +91,39 @@ export const buildBrazeBridge = (t, e, o) => {
91
91
  "removeFromSubscriptionGroup",
92
92
  "setLineId",
93
93
  ],
94
- c = function (t) {
94
+ u = function (t) {
95
95
  return function () {
96
96
  const e = ao();
97
97
  e && e[t](...Array.prototype.slice.call(arguments));
98
98
  };
99
99
  },
100
- a = {};
101
- for (let t = 0; t < u.length; t++) a[u[t]] = c(u[t]);
102
- n.getUser = function () {
103
- return a;
100
+ c = {};
101
+ for (let t = 0; t < i.length; t++) c[i[t]] = u(i[t]);
102
+ o.getUser = function () {
103
+ return c;
104
104
  };
105
- const m = { showFeed: e },
106
- f = function (e) {
105
+ const a = {},
106
+ m = function (r) {
107
107
  return function () {
108
- const r = arguments;
109
- "function" != typeof o
110
- ? m[e](...Array.prototype.slice.call(r))
111
- : o(t, function () {
112
- m[e](...Array.prototype.slice.call(r));
108
+ const o = arguments;
109
+ "function" != typeof e
110
+ ? a[r](...Array.prototype.slice.call(o))
111
+ : e(t, function () {
112
+ a[r](...Array.prototype.slice.call(o));
113
113
  });
114
114
  };
115
115
  },
116
- l = n.display;
117
- for (const t of C(m)) l[t] = f(t);
118
- const y = { registerAppboyPushMessages: requestPushPermission() },
119
- d = function (t) {
116
+ f = o.display;
117
+ for (const t of C(a)) f[t] = m(t);
118
+ const l = { registerAppboyPushMessages: requestPushPermission() },
119
+ p = function (t) {
120
120
  return function () {
121
- y[t](...Array.prototype.slice.call(arguments));
121
+ l[t](...Array.prototype.slice.call(arguments));
122
122
  };
123
123
  },
124
- h = n.web;
125
- for (const t of C(y)) h[t] = d(t);
126
- return n;
124
+ y = o.web;
125
+ for (const t of C(l)) y[t] = p(t);
126
+ return o;
127
127
  };
128
128
  export const applyNonceToDynamicallyCreatedTags = (t, e, r) => {
129
129
  const o = `([\\w]+)\\s*=\\s*document.createElement\\(['"]${r}['"]\\)`,
@@ -1 +1 @@
1
- export const KeyCodes = { Wo: 32, Ao: 9, Xo: 13, _h: 27 };
1
+ export const KeyCodes = { $o: 32, Fo: 9, Co: 13, Oh: 27 };
package/src/util/net.js CHANGED
@@ -27,7 +27,7 @@ const l = {
27
27
  o = JSON.parse(e.responseText);
28
28
  } catch (o) {
29
29
  const n = {
30
- error: "" === e.responseText ? Xt.bu : Xt.Au,
30
+ error: "" === e.responseText ? Xt.hl : Xt.cl,
31
31
  response: e.responseText,
32
32
  };
33
33
  (0, t.tt)(n, r);
@@ -2,28 +2,28 @@ import { REQUEST_ATTEMPT_DEFAULT as Ae } from "../common/constants.js";
2
2
  import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
3
3
  const h = {
4
4
  O: {
5
- Nu: "data",
6
- wi: "content_cards/sync",
5
+ gl: "data",
6
+ vi: "content_cards/sync",
7
7
  Le: "feature_flags/sync",
8
- Er: "template",
8
+ Mr: "template",
9
9
  K: "banners/sync",
10
10
  },
11
- Vu: (t) => (null == t ? void 0 : t.ft(s.gt.lE)),
12
- sm: (t) => (null == t ? void 0 : t.ft(s.gt.SE)),
11
+ Hl: (t) => (null == t ? void 0 : t.ft(s.gt.SE)),
12
+ sm: (t) => (null == t ? void 0 : t.ft(s.gt._E)),
13
13
  nm: (t, e) => {
14
- null == t || t.Bt(s.gt.lE, e);
14
+ null == t || t.Bt(s.gt.SE, e);
15
15
  },
16
16
  rm: (t, e) => {
17
- null == t || t.Bt(s.gt.SE, e);
17
+ null == t || t.Bt(s.gt._E, e);
18
18
  },
19
- zu: (t, e) => {
19
+ Tl: (t, e) => {
20
20
  if (!t || !e) return -1;
21
- const s = h.Vu(t);
21
+ const s = h.Hl(t);
22
22
  if (null == s) return -1;
23
23
  const n = s[e];
24
24
  return null == n || isNaN(n) ? -1 : n;
25
25
  },
26
- ju: (t, e) => {
26
+ kl: (t, e) => {
27
27
  let s = Ae;
28
28
  if (!t || !e) return s;
29
29
  const n = h.sm(t);
@@ -31,21 +31,21 @@ const h = {
31
31
  },
32
32
  W: (t, e, s) => {
33
33
  if (!t || !e) return;
34
- let n = h.Vu(t);
34
+ let n = h.Hl(t);
35
35
  null == n && (n = {}), (n[e] = s), h.nm(t, n);
36
36
  },
37
- Mu: (t, e, s) => {
37
+ yl: (t, e, s) => {
38
38
  if (!t || !e) return;
39
39
  let n = h.sm(t);
40
40
  null == n && (n = {}), (n[e] = s), h.rm(t, n);
41
41
  },
42
- vi: (t, e) => {
43
- t && e && h.Mu(t, e, Ae);
42
+ bi: (t, e) => {
43
+ t && e && h.yl(t, e, Ae);
44
44
  },
45
- Uu: (t, e) => {
45
+ $l: (t, e) => {
46
46
  if (!t || !e) return;
47
- const s = h.ju(t, e);
48
- h.Mu(t, e, s + 1);
47
+ const s = h.kl(t, e);
48
+ h.yl(t, e, s + 1);
49
49
  },
50
50
  };
51
51
  export default h;
@@ -1,6 +1,6 @@
1
- import Oe from "./base-device-parser.js";
1
+ import ge from "./base-device-parser.js";
2
2
  import { Browsers as oi, OperatingSystems as so } from "./device-constants.js";
3
- export default class gi extends Oe {
3
+ export default class gi extends ge {
4
4
  constructor() {
5
5
  super(), (this.fd = gi.Bc(navigator.userAgent || ""));
6
6
  }
@@ -10,13 +10,13 @@ export default class gi extends Oe {
10
10
  ff() {
11
11
  return this.fd[1] || "Unknown Version";
12
12
  }
13
- ec(r) {
13
+ Ha(r) {
14
14
  for (let n = 0; n < r.length; n++) {
15
15
  const e = r[n].string;
16
16
  let i = gi.nf(e, r[n]);
17
17
  if (i)
18
18
  return (
19
- i === so.Pg && navigator.maxTouchPoints > 1 && (i = so.ao),
19
+ i === so.Pg && navigator.maxTouchPoints > 1 && (i = so.co),
20
20
  Promise.resolve(i)
21
21
  );
22
22
  }
@@ -1,14 +1,14 @@
1
1
  import {
2
- isArray as z,
2
+ isArray as D,
3
3
  isDate as Nt,
4
- isObject as yt,
4
+ isObject as It,
5
5
  keys as C,
6
6
  } from "./code-utils.js";
7
- import { getByteLength as er } from "./string-utils.js";
7
+ import { getByteLength as rr } from "./string-utils.js";
8
8
  import { logger as N } from "../../shared-lib/index.js";
9
- import { toValidBackendTimeString as Ft } from "./date-utils.js";
9
+ import { toValidBackendTimeString as Lt } from "./date-utils.js";
10
10
  import { BRAZE_ACTIONS as oo } from "./braze-actions.js";
11
- import { SET_CUSTOM_USER_ATTRIBUTE_STRING as Dt } from "../common/constants.js";
11
+ import { SET_CUSTOM_USER_ATTRIBUTE_STRING as Ft } from "../common/constants.js";
12
12
  export const CUSTOM_DATA_REGEX = /^[^\x00-\x1F\x22]+$/;
13
13
  export const CUSTOM_ATTRIBUTE_SPECIAL_CHARS_REGEX = /[$.]/;
14
14
  export const CUSTOM_ATTRIBUTE_RESERVED_OPERATORS = [
@@ -57,20 +57,20 @@ export function _validateNestedProperties(t, e, r) {
57
57
  if (n && r > 50)
58
58
  return N.error("Nested attributes cannot be more than 50 levels deep."), !1;
59
59
  const o = n ? r + 1 : -1;
60
- if (z(t) && z(e)) {
60
+ if (D(t) && D(e)) {
61
61
  for (let r = 0; r < t.length && r < e.length; r++)
62
62
  if (
63
- (Nt(t[r]) && (e[r] = Ft(t[r])),
63
+ (Nt(t[r]) && (e[r] = Lt(t[r])),
64
64
  !_validateNestedProperties(t[r], e[r], o))
65
65
  )
66
66
  return !1;
67
67
  } else {
68
- if (!yt(t)) return validatePropertyType(t);
68
+ if (!It(t)) return validatePropertyType(t);
69
69
  for (const r of C(t)) {
70
70
  const i = t[r];
71
71
  if (n && !validateCustomAttributeKey(r)) return !1;
72
72
  if (Nt(i)) {
73
- e[r] = Ft(i);
73
+ e[r] = Lt(i);
74
74
  }
75
75
  if (!_validateNestedProperties(i, e[r], o)) return !1;
76
76
  }
@@ -81,7 +81,7 @@ export function _validateEventPropertyValue(t, e, r, n, o) {
81
81
  let i;
82
82
  return (
83
83
  (i =
84
- yt(t) || z(t)
84
+ It(t) || D(t)
85
85
  ? _validateNestedProperties(t, e, o ? 1 : -1)
86
86
  : validatePropertyType(t)),
87
87
  i || N.error(`Cannot ${r} because ${n} "${t}" is invalid.`),
@@ -93,15 +93,15 @@ export function validateStandardString(t, e, r, n = !1) {
93
93
  return o || N.error(`Cannot ${e} because ${r} "${t}" is invalid.`), o;
94
94
  }
95
95
  export function validateCustomProperties(t, e, r, n, o) {
96
- if ((null == t && (t = {}), "object" != typeof t || z(t)))
96
+ if ((null == t && (t = {}), "object" != typeof t || D(t)))
97
97
  return (
98
98
  N.error(`${e} requires that ${r} be an object. Ignoring ${o}.`),
99
99
  [!1, null]
100
100
  );
101
101
  let i, a;
102
- e === Dt ? ((i = 76800), (a = "75KB")) : ((i = 51200), (a = "50KB"));
102
+ e === Ft ? ((i = 76800), (a = "75KB")) : ((i = 51200), (a = "50KB"));
103
103
  const s = JSON.stringify(t);
104
- if (er(s) > i)
104
+ if (rr(s) > i)
105
105
  return (
106
106
  N.error(
107
107
  `Could not ${n} because ${r} was greater than the max size of ${a}.`,
@@ -118,22 +118,22 @@ export function validateCustomProperties(t, e, r, n, o) {
118
118
  );
119
119
  }
120
120
  for (const r in t) {
121
- if (e === Dt && !validateCustomAttributeKey(r)) return [!1, null];
121
+ if (e === Ft && !validateCustomAttributeKey(r)) return [!1, null];
122
122
  if (!validateCustomString(r, n, `the ${o} property name`))
123
123
  return [!1, null];
124
124
  const i = t[r];
125
- if (e !== Dt && null == i) {
125
+ if (e !== Ft && null == i) {
126
126
  delete t[r], delete u[r];
127
127
  continue;
128
128
  }
129
- Nt(i) && (u[r] = Ft(i));
129
+ Nt(i) && (u[r] = Lt(i));
130
130
  if (
131
131
  !_validateEventPropertyValue(
132
132
  i,
133
133
  u[r],
134
134
  n,
135
135
  `the ${o} property "${r}"`,
136
- e === Dt,
136
+ e === Ft,
137
137
  )
138
138
  )
139
139
  return [!1, null];
@@ -161,12 +161,12 @@ export function validateCustomAttributeArrayType(t, e) {
161
161
  return [!1, !1];
162
162
  r = !0;
163
163
  } else {
164
- if (!yt(i)) return o(), [!1, !1];
164
+ if (!It(i)) return o(), [!1, !1];
165
165
  if (r) return o(), [!1, !1];
166
166
  if (
167
167
  !validateCustomProperties(
168
168
  i,
169
- Dt,
169
+ Ft,
170
170
  "attribute value",
171
171
  `set custom user attribute "${t}"`,
172
172
  "custom user attribute",
@@ -196,8 +196,8 @@ export function isValidBrazeActionJson(t) {
196
196
  case oo.types.removeFromSubscriptionGroup:
197
197
  case oo.types.addToCustomAttributeArray:
198
198
  case oo.types.removeFromCustomAttributeArray:
199
- case oo.types.co:
200
199
  case oo.types.mo:
200
+ case oo.types.uo:
201
201
  if (oo.properties.so in t) return !0;
202
202
  break;
203
203
  case oo.types.requestPushPermission:
@@ -30,5 +30,5 @@ export const WindowUtils = {
30
30
  openUri: _openUri,
31
31
  Uo: _isPhone,
32
32
  No: _getOrientation,
33
- $a: _getCurrentUrl,
33
+ Ua: _getCurrentUrl,
34
34
  };
@@ -1,11 +0,0 @@
1
- import { Card } from "./models/index.js";
2
- import _ from "./card-manager-factory.js";
3
- import { MUST_BE_CARD_WARNING_SUFFIX as L } from "../common/constants.js";
4
- import r from "../managers/braze-instance.js";
5
- import { logger as N } from "../../shared-lib/index.js";
6
- export function logCardClick(o, m) {
7
- return (
8
- !!r.rr() &&
9
- (o instanceof Card ? _.ea().logClick(o, m).tt : (N.error("card " + L), !1))
10
- );
11
- }
@@ -1,13 +0,0 @@
1
- import { Card } from "./models/index.js";
2
- import _ from "./card-manager-factory.js";
3
- import r from "../managers/braze-instance.js";
4
- import { isArray as z } from "../util/code-utils.js";
5
- import { MUST_BE_CARD_WARNING_SUFFIX as L } from "../common/constants.js";
6
- import { logger as N } from "../../shared-lib/index.js";
7
- export function logCardImpressions(o, n) {
8
- if (!r.rr()) return !1;
9
- if (!z(o)) return N.error("cards must be an array"), !1;
10
- for (const r of o)
11
- if (!(r instanceof Card)) return N.error(`Each card in cards ${L}`), !1;
12
- return _.ea().Xt(o, n).tt;
13
- }
@@ -1,18 +0,0 @@
1
- import r from "../managers/braze-instance.js";
2
- import re from "./feed-provider.js";
3
- const ie = {
4
- l: !1,
5
- provider: null,
6
- m: () => (
7
- ie.p(),
8
- ie.provider || ((ie.provider = new re(r.j(), r.rn())), r._(ie.provider)),
9
- ie.provider
10
- ),
11
- p: () => {
12
- ie.l || (r.h(ie), (ie.l = !0));
13
- },
14
- destroy: () => {
15
- (ie.provider = null), (ie.l = !1);
16
- },
17
- };
18
- export default ie;
@@ -1,90 +0,0 @@
1
- import t from "../common/base-provider.js";
2
- import r from "../managers/braze-instance.js";
3
- import Feed from "./feed.js";
4
- import {
5
- newCardFromFeedJson as lt,
6
- newCardFromSerializedValue as tt,
7
- } from "../Card/util/card-factory.js";
8
- import { rehydrateDateAfterJsonization as V } from "../util/date-utils.js";
9
- import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
10
- import u from "../managers/subscription-manager.js";
11
- export default class re extends t {
12
- constructor(t, s) {
13
- super(),
14
- (this.C = t),
15
- (this.Fi = s),
16
- (this.cards = []),
17
- (this.xi = null),
18
- (this.C = t),
19
- (this.Fi = s),
20
- (this.Ts = new u()),
21
- r.F(this.Ts),
22
- this.Ds();
23
- }
24
- Ds() {
25
- let t = [];
26
- this.C && (t = this.C.ft(s.gt.qi) || []);
27
- const i = [];
28
- for (let s = 0; s < t.length; s++) {
29
- const e = tt(t[s]);
30
- null != e && i.push(e);
31
- }
32
- (this.cards = i), this.C && (this.xi = V(this.C.ft(s.gt.zi)));
33
- }
34
- Ui(t) {
35
- const i = [];
36
- let e = null,
37
- r = {};
38
- this.C && (r = this.C.ft(s.gt.Zt) || {});
39
- const h = {};
40
- for (let s = 0; s < t.length; s++) {
41
- e = t[s];
42
- const o = lt(e);
43
- if (null != o) {
44
- const t = o.id;
45
- t && r[t] && ((o.viewed = !0), (h[t] = !0)), i.push(o);
46
- }
47
- }
48
- (this.cards = i),
49
- this.Ws(),
50
- (this.xi = new Date()),
51
- this.C && (this.C.Bt(s.gt.Zt, h), this.C.Bt(s.gt.zi, this.xi));
52
- }
53
- Ws() {
54
- var t;
55
- const i = [];
56
- for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].bt());
57
- null === (t = this.C) || void 0 === t || t.Bt(s.gt.qi, i);
58
- }
59
- U(t) {
60
- null != t &&
61
- t.feed &&
62
- (this.Ds(),
63
- this.Ui(t.feed),
64
- this.Ts.X(new Feed(this.cards.slice(), this.xi)));
65
- }
66
- ki() {
67
- this.Ds();
68
- const t = [],
69
- s = new Date();
70
- for (let i = 0; i < this.cards.length; i++) {
71
- const e = this.cards[i].expiresAt;
72
- let r = !0;
73
- null != e && (r = e >= s), r && t.push(this.cards[i]);
74
- }
75
- return new Feed(t, this.xi);
76
- }
77
- bi() {
78
- this.Fi && this.Fi.requestFeedRefresh();
79
- }
80
- qt(t) {
81
- return this.Ts.Dt(t);
82
- }
83
- clearData(t) {
84
- null == t && (t = !1),
85
- (this.cards = []),
86
- (this.xi = null),
87
- t && this.C && (this.C.Ut(s.gt.qi), this.C.Ut(s.gt.zi)),
88
- this.Ts.X(new Feed(this.cards.slice(), this.xi));
89
- }
90
- }
package/src/Feed/feed.js DELETED
@@ -1,20 +0,0 @@
1
- import rr from "../common/base-feed.js";
2
- import { logCardClick, logCardImpressions } from "../Card/index.js";
3
- import { requestFeedRefresh } from "./request-feed-refresh.js";
4
- export default class Feed extends rr {
5
- constructor(r, e) {
6
- super(r, e);
7
- }
8
- logCardImpressions(r) {
9
- logCardImpressions(r, !1);
10
- }
11
- logCardClick(r) {
12
- return logCardClick(r, !1);
13
- }
14
- sr() {
15
- requestFeedRefresh();
16
- }
17
- nr() {
18
- return !1;
19
- }
20
- }
@@ -1,5 +0,0 @@
1
- import r from "../managers/braze-instance.js";
2
- import ie from "./feed-provider-factory.js";
3
- export function getCachedFeed() {
4
- if (r.rr()) return ie.m().ki();
5
- }
package/src/Feed/index.js DELETED
@@ -1,8 +0,0 @@
1
- export { default as Feed } from "./feed.js";
2
- export { getCachedFeed } from "./get-cached-feed.js";
3
- export { destroyFeed } from "./ui/hide-feed.js";
4
- export { logFeedDisplayed } from "./log-feed-displayed.js";
5
- export { requestFeedRefresh } from "./request-feed-refresh.js";
6
- export { showFeed } from "./ui/show-feed.js";
7
- export { subscribeToFeedUpdates } from "./subscribe-to-feed-updates.js";
8
- export { toggleFeed } from "./ui/toggle-feed.js";
@@ -1,7 +0,0 @@
1
- import r from "../managers/braze-instance.js";
2
- import { InternalEventTypes as dr } from "../../shared-lib/index.js";
3
- export function logFeedDisplayed() {
4
- var e;
5
- if (r.rr())
6
- return null === (e = r.g()) || void 0 === e ? void 0 : e.zr(dr.Fr).tt;
7
- }
@@ -1,5 +0,0 @@
1
- import r from "../managers/braze-instance.js";
2
- import ie from "./feed-provider-factory.js";
3
- export function requestFeedRefresh() {
4
- if (r.rr()) return ie.m().bi();
5
- }