@braze/web-sdk 6.8.0 → 6.9.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 (137) hide show
  1. package/index.d.ts +99 -19
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +20 -20
  4. package/shared-lib/indexed-db-adapter.js +64 -64
  5. package/shared-lib/logger.js +18 -18
  6. package/shared-lib/supported-options.js +8 -8
  7. package/src/Banner/banner-provider.js +67 -59
  8. package/src/Banner/banner.js +40 -19
  9. package/src/Banner/dismiss-banner.js +4 -0
  10. package/src/Banner/display/banner-to-html.js +10 -10
  11. package/src/Banner/display/destroy-banner-html.js +2 -2
  12. package/src/Banner/get-all-banners.js +6 -6
  13. package/src/Banner/get-banner.js +6 -6
  14. package/src/Banner/index.js +1 -0
  15. package/src/Banner/log-banner-click.js +7 -7
  16. package/src/Banner/log-banner-dismissal.js +7 -7
  17. package/src/Banner/log-banner-impressions.js +10 -10
  18. package/src/Banner/request-banners-refresh.js +8 -8
  19. package/src/Banner/subscribe-to-banners-updates.js +5 -5
  20. package/src/Banner/ui/insert-banner.js +8 -8
  21. package/src/Card/card-manager.js +31 -31
  22. package/src/Card/log-card-dismissal.js +2 -2
  23. package/src/Card/log-content-card-click.js +2 -2
  24. package/src/Card/log-content-card-impressions.js +4 -4
  25. package/src/Card/models/captioned-image.js +15 -15
  26. package/src/Card/models/card.js +89 -89
  27. package/src/Card/models/classic-card.js +16 -16
  28. package/src/Card/models/control-card.js +7 -7
  29. package/src/Card/models/image-only.js +13 -13
  30. package/src/Card/util/card-factory.js +32 -32
  31. package/src/ContentCards/content-cards-provider.js +102 -102
  32. package/src/ContentCards/get-cached-content-cards.js +1 -1
  33. package/src/ContentCards/subscribe-to-content-cards-updates.js +3 -3
  34. package/src/ContentCards/ui/show-content-cards.js +5 -5
  35. package/src/Core/add-sdk-metadata.js +2 -2
  36. package/src/Core/change-user.js +3 -3
  37. package/src/Core/destroy.js +2 -2
  38. package/src/Core/disable-sdk.js +4 -4
  39. package/src/Core/enable-sdk.js +4 -4
  40. package/src/Core/get-device-id.js +2 -2
  41. package/src/Core/handle-braze-action.js +5 -5
  42. package/src/Core/log-custom-event.js +5 -5
  43. package/src/Core/log-ecommerce-event.js +5 -5
  44. package/src/Core/log-purchase.js +9 -9
  45. package/src/Core/open-session.js +7 -7
  46. package/src/Core/set-logger.js +2 -2
  47. package/src/Core/toggle-logging.js +2 -2
  48. package/src/Core/wipe-data.js +6 -6
  49. package/src/DUST/dust-provider.js +249 -240
  50. package/src/DUST/dust-shared-worker-code.js +1 -1
  51. package/src/DUST/dust-shared-worker-impl.js +15 -14
  52. package/src/DUST/dust-worker-bridge.js +50 -35
  53. package/src/DUST/subscribe-to-dust.js +7 -7
  54. package/src/FeatureFlags/feature-flag-factory.js +8 -8
  55. package/src/FeatureFlags/feature-flag.js +3 -3
  56. package/src/FeatureFlags/feature-flags-provider.js +21 -21
  57. package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
  58. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
  59. package/src/InAppMessage/constants.js +3 -3
  60. package/src/InAppMessage/defer-in-app-message.js +4 -4
  61. package/src/InAppMessage/display/html-message-to-html.js +4 -4
  62. package/src/InAppMessage/display/in-app-message-to-html.js +16 -16
  63. package/src/InAppMessage/in-app-message-factory.js +36 -36
  64. package/src/InAppMessage/in-app-message-manager.js +78 -78
  65. package/src/InAppMessage/log-in-app-message-button-click.js +4 -4
  66. package/src/InAppMessage/log-in-app-message-click.js +3 -3
  67. package/src/InAppMessage/log-in-app-message-html-click.js +5 -5
  68. package/src/InAppMessage/log-in-app-message-impression.js +4 -4
  69. package/src/InAppMessage/models/control-message.js +4 -4
  70. package/src/InAppMessage/models/full-screen-message.js +4 -4
  71. package/src/InAppMessage/models/html-message.js +3 -3
  72. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  73. package/src/InAppMessage/models/in-app-message.js +12 -12
  74. package/src/InAppMessage/models/modal-message.js +4 -4
  75. package/src/InAppMessage/models/slide-up-message.js +4 -4
  76. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  77. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  78. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  79. package/src/InAppMessage/ui/show-in-app-message.js +14 -14
  80. package/src/Push/push-manager-factory.js +2 -2
  81. package/src/Push/push-manager.js +38 -38
  82. package/src/Push/utils/push-utils.js +6 -6
  83. package/src/User/user-manager.js +14 -14
  84. package/src/User/user.js +25 -25
  85. package/src/common/base-provider.js +1 -1
  86. package/src/common/content-cards-display.js +7 -7
  87. package/src/common/event-logger.js +3 -3
  88. package/src/common/properties-base.js +3 -3
  89. package/src/l10n/l10n-manager-factory.js +1 -1
  90. package/src/l10n/l10n-manager.js +3 -3
  91. package/src/managers/auth-manager.js +11 -11
  92. package/src/managers/braze-instance.js +56 -56
  93. package/src/managers/device-manager.js +10 -10
  94. package/src/managers/network-manager.js +102 -101
  95. package/src/managers/server-config-manager.js +115 -98
  96. package/src/managers/session-manager.js +20 -20
  97. package/src/managers/storage-manager-factory.js +9 -9
  98. package/src/managers/storage-manager.js +74 -74
  99. package/src/managers/subscription-manager.js +2 -2
  100. package/src/managers/utils.js +1 -1
  101. package/src/models/backend-errors.js +5 -5
  102. package/src/models/braze-event.js +1 -1
  103. package/src/models/device.js +1 -1
  104. package/src/models/identifier.js +2 -2
  105. package/src/models/push-token.js +6 -6
  106. package/src/models/request-result.js +1 -1
  107. package/src/models/server-config.js +42 -24
  108. package/src/request-controller.js +126 -126
  109. package/src/triggers/models/custom-event-data.js +4 -4
  110. package/src/triggers/models/custom-event-property-data.js +5 -5
  111. package/src/triggers/models/filter-set.js +2 -2
  112. package/src/triggers/models/filter.js +1 -1
  113. package/src/triggers/models/in-app-message-click-data.js +1 -1
  114. package/src/triggers/models/purchase-data.js +1 -1
  115. package/src/triggers/models/purchase-property-data.js +2 -2
  116. package/src/triggers/models/push-click-data.js +1 -1
  117. package/src/triggers/models/trigger-condition.js +33 -33
  118. package/src/triggers/models/trigger-events.js +1 -1
  119. package/src/triggers/models/trigger.js +33 -33
  120. package/src/triggers/triggers-provider-factory.js +1 -1
  121. package/src/triggers/triggers-provider.js +68 -68
  122. package/src/types.js +2 -2
  123. package/src/ui/js/attach-css.js +1 -1
  124. package/src/util/braze-actions.js +7 -7
  125. package/src/util/browser-detector.js +2 -2
  126. package/src/util/client-hints-parser.js +4 -4
  127. package/src/util/code-utils.js +2 -2
  128. package/src/util/deprecation-utils.js +2 -2
  129. package/src/util/dom-utils.js +7 -7
  130. package/src/util/ecommerce-event-validation.js +52 -35
  131. package/src/util/html-display-utils.js +11 -11
  132. package/src/util/net.js +4 -4
  133. package/src/util/request-header-utils.js +17 -17
  134. package/src/util/string-utils.js +2 -2
  135. package/src/util/user-agent-parser.js +2 -2
  136. package/src/util/validation-utils.js +12 -12
  137. package/src/util/window-utils.js +2 -2
@@ -9,7 +9,7 @@ export default class Si extends Ve {
9
9
  (this.version = null),
10
10
  this.userAgentData)
11
11
  ) {
12
- const t = this.hf();
12
+ const t = this.Bc();
13
13
  (this.browser = t.browser || "Unknown Browser"),
14
14
  (this.version = t.version || "Unknown Version");
15
15
  }
@@ -36,12 +36,12 @@ export default class Si extends Ve {
36
36
  .then((t) => (t.platform ? s(t.platform) : navigator.platform))
37
37
  .catch(() => navigator.platform);
38
38
  }
39
- hf() {
39
+ Bc() {
40
40
  const t = {},
41
41
  s = this.userAgentData.brands;
42
42
  if (s && s.length)
43
43
  for (const r of s) {
44
- const s = this.uf(yi),
44
+ const s = this.Vc(yi),
45
45
  i = r.brand.match(s);
46
46
  if (i && i.length > 0) {
47
47
  (t.browser = i[0]), (t.version = r.version);
@@ -50,7 +50,7 @@ export default class Si extends Ve {
50
50
  }
51
51
  return t;
52
52
  }
53
- uf(t) {
53
+ Vc(t) {
54
54
  const s = [];
55
55
  for (const r in t) {
56
56
  const i = r;
@@ -1,4 +1,4 @@
1
- import { logger as E } from "../../shared-lib/index.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
2
  export function values(t) {
3
3
  const e = [];
4
4
  let r;
@@ -13,7 +13,7 @@ export function validateValueIsFromEnum(t, e, r, n) {
13
13
  const o = values(t);
14
14
  return (
15
15
  -1 !== o.indexOf(e) ||
16
- (E.error(`${r} Valid values from ${n} are "${o.join('"/"')}".`), !1)
16
+ (b.error(`${r} Valid values from ${n} are "${o.join('"/"')}".`), !1)
17
17
  );
18
18
  }
19
19
  export function isArray(t) {
@@ -1,5 +1,5 @@
1
- import { logger as E } from "../../shared-lib/index.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
2
  export function logDeprecationWarning(e, i, n) {
3
3
  let r = `The '${e}' ${i} is deprecated.`;
4
- n && (r += ` Please use '${n}' instead.`), E.warn(r);
4
+ n && (r += ` Please use '${n}' instead.`), b.warn(r);
5
5
  }
@@ -1,4 +1,4 @@
1
- import { logger as E } from "../../shared-lib/index.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
2
  import { getErrorMessage as hi } from "./error-utils.js";
3
3
  export function _isInView(t, n = !1, e = !1, s = !1) {
4
4
  if (null == t) return !1;
@@ -18,24 +18,24 @@ export function _isInView(t, n = !1, e = !1, s = !1) {
18
18
  !s)
19
19
  );
20
20
  }
21
- export const DOMUtils = { lp: null, td: _isInView };
21
+ export const DOMUtils = { Ic: null, td: _isInView };
22
22
  export const DIRECTIONS = { Uo: "up", Vo: "down", ie: "left", ne: "right" };
23
23
  export function supportsPassive() {
24
- if (null == DOMUtils.lp) {
25
- DOMUtils.lp = !1;
24
+ if (null == DOMUtils.Ic) {
25
+ DOMUtils.Ic = !1;
26
26
  try {
27
27
  const t = Object.defineProperty({}, "passive", {
28
28
  get: () => {
29
- DOMUtils.lp = !0;
29
+ DOMUtils.Ic = !0;
30
30
  },
31
31
  });
32
32
  window.addEventListener("testPassive", () => {}, t),
33
33
  window.removeEventListener("testPassive", () => {}, t);
34
34
  } catch (t) {
35
- E.error(hi(t));
35
+ b.error(hi(t));
36
36
  }
37
37
  }
38
- return DOMUtils.lp;
38
+ return DOMUtils.Ic;
39
39
  }
40
40
  export function addPassiveEventListener(t, n, e = () => {}) {
41
41
  t.addEventListener(n, e, !!supportsPassive() && { passive: !0 });
@@ -1,4 +1,4 @@
1
- import { logger as E } from "../../shared-lib/index.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
2
  import { isValidIso4217CurrencyCode as or } from "./iso-4217-currency-codes.js";
3
3
  import { CoreStrings as R } from "../common/constants.js";
4
4
  import { CartUpdatedActions as un } from "../types.js";
@@ -15,49 +15,49 @@ const ln = "log eCommerce event";
15
15
  function dn(n, t, e) {
16
16
  if (null == n) {
17
17
  if (!e) return;
18
- return E.error(`Cannot ${ln} because ${t} must be a non-empty string.`), !1;
18
+ return b.error(`Cannot ${ln} because ${t} must be a non-empty string.`), !1;
19
19
  }
20
20
  return "string" != typeof n || (e && n.length <= 0)
21
- ? (E.error(
21
+ ? (b.error(
22
22
  `Cannot ${ln} because ${t} must be a string${
23
23
  e ? "" : " when provided"
24
24
  }.`,
25
25
  ),
26
26
  !1)
27
27
  : n.length > 255
28
- ? (E.error(`Cannot ${ln} because ${t} must be at most 255 characters.`), !1)
28
+ ? (b.error(`Cannot ${ln} because ${t} must be at most 255 characters.`), !1)
29
29
  : !!mt(n, ln, t) && n;
30
30
  }
31
31
  function mn(n, t) {
32
32
  return "number" != typeof n || isNaN(n) || !isFinite(n)
33
- ? (E.error(`Cannot ${ln} because ${t} must be a finite number.`), !1)
33
+ ? (b.error(`Cannot ${ln} because ${t} must be a finite number.`), !1)
34
34
  : n;
35
35
  }
36
36
  function pn(n, t) {
37
37
  const e = mn(n, t);
38
38
  return (
39
39
  !1 !== e &&
40
- (e < 0 ? (E.error(`Cannot ${ln} because ${t} must be at least 0.`), !1) : e)
40
+ (e < 0 ? (b.error(`Cannot ${ln} because ${t} must be at least 0.`), !1) : e)
41
41
  );
42
42
  }
43
43
  const bn = /^[A-Za-z0-9\-_.,:;!?@#%&*()+={}[\]|\\/'`~^<>]+$/;
44
44
  function _n(n, t) {
45
45
  return 0 === n.length || n.length > 255
46
- ? (E.error(
46
+ ? (b.error(
47
47
  `Cannot ${ln} because each ${t} key must be between 1 and 255 characters.`,
48
48
  ),
49
49
  !1)
50
50
  : "$" === n.charAt(0)
51
- ? (E.error(`Cannot ${ln} because ${t} keys cannot begin with "$".`), !1)
51
+ ? (b.error(`Cannot ${ln} because ${t} keys cannot begin with "$".`), !1)
52
52
  : !!bn.test(n) ||
53
- (E.error(
53
+ (b.error(
54
54
  `Cannot ${ln} because ${t} key "${n}" contains invalid characters.`,
55
55
  ),
56
56
  !1);
57
57
  }
58
58
  function $n(n, t, e) {
59
59
  if (e > 50)
60
- return E.error(`Cannot ${ln} because ${t} is nested too deeply.`), !1;
60
+ return b.error(`Cannot ${ln} because ${t} is nested too deeply.`), !1;
61
61
  if (null == n || "object" != typeof n) return !0;
62
62
  if (g(n)) {
63
63
  const r = n;
@@ -66,7 +66,7 @@ function $n(n, t, e) {
66
66
  if ("string" == typeof u) {
67
67
  if (u.length > 255)
68
68
  return (
69
- E.error(
69
+ b.error(
70
70
  `Cannot ${ln} because a ${t} string value exceeds 255 characters.`,
71
71
  ),
72
72
  !1
@@ -84,7 +84,7 @@ function $n(n, t, e) {
84
84
  if ("string" == typeof u) {
85
85
  if (u.length > 255)
86
86
  return (
87
- E.error(
87
+ b.error(
88
88
  `Cannot ${ln} because a ${t} string value exceeds 255 characters.`,
89
89
  ),
90
90
  !1
@@ -96,7 +96,7 @@ function $n(n, t, e) {
96
96
  function vn(n, t) {
97
97
  if (!g(n))
98
98
  return (
99
- E.error(`Cannot ${ln} because ${t} must be an array of strings.`), !1
99
+ b.error(`Cannot ${ln} because ${t} must be an array of strings.`), !1
100
100
  );
101
101
  for (const e of n) if (!1 === dn(e, t, !0)) return !1;
102
102
  return !0;
@@ -109,7 +109,7 @@ function yn(n, t) {
109
109
  function gn(n) {
110
110
  if (null == n || "object" != typeof n || g(n))
111
111
  return (
112
- E.error(`Cannot ${ln} because each product must be an object.`), null
112
+ b.error(`Cannot ${ln} because each product must be an object.`), null
113
113
  );
114
114
  const t = n,
115
115
  e = dn(t.product_id, "product_id", !0),
@@ -119,10 +119,10 @@ function gn(n) {
119
119
  if (!1 === mn(n, "product quantity")) return !1;
120
120
  const t = parseInt(n.toString(), 10);
121
121
  return t !== n
122
- ? (E.error(`Cannot ${ln} because product quantity must be an integer.`),
122
+ ? (b.error(`Cannot ${ln} because product quantity must be an integer.`),
123
123
  !1)
124
124
  : n < 0 || n > Number.MAX_SAFE_INTEGER
125
- ? (E.error(
125
+ ? (b.error(
126
126
  `Cannot ${ln} because product quantity must be between 0 and Number.MAX_SAFE_INTEGER.`,
127
127
  ),
128
128
  !1)
@@ -151,7 +151,7 @@ function gn(n) {
151
151
  }
152
152
  function Cn(n) {
153
153
  if (null == n || !g(n))
154
- return E.error(`Cannot ${ln} because products must be an array.`), null;
154
+ return b.error(`Cannot ${ln} because products must be an array.`), null;
155
155
  const t = [],
156
156
  e = n;
157
157
  for (const n of e) {
@@ -161,17 +161,17 @@ function Cn(n) {
161
161
  }
162
162
  return t;
163
163
  }
164
- function jn(n) {
164
+ function hn(n) {
165
165
  const t = (function (n) {
166
166
  if (null == n || "string" != typeof n || n.length <= 0)
167
167
  return (
168
- E.error(`Cannot ${ln} because currency must be a non-empty string.`),
168
+ b.error(`Cannot ${ln} because currency must be a non-empty string.`),
169
169
  !1
170
170
  );
171
171
  const t = n.toUpperCase();
172
172
  return or(t)
173
173
  ? t
174
- : (E.error(
174
+ : (b.error(
175
175
  `${R.QE} requires a valid ISO 4217 currency code, got "${n}". Ignoring event.`,
176
176
  ),
177
177
  !1);
@@ -179,11 +179,21 @@ function jn(n) {
179
179
  e = dn(n.source, "source", !0);
180
180
  return !1 === t || !1 === e ? null : { currency: t, source: e };
181
181
  }
182
- function hn(n, t) {
182
+ function jn(n, t) {
183
+ const e = ["subtotal_value", "tax", "shipping"];
184
+ for (const r of e)
185
+ if (null != t[r]) {
186
+ const e = pn(t[r], r);
187
+ if (!1 === e) return !1;
188
+ n[r] = e;
189
+ }
190
+ return !0;
191
+ }
192
+ function wn(n, t) {
183
193
  const e = yn(t, "eCommerce event metadata");
184
194
  return !1 !== e && (null != e && (n.metadata = e), !0);
185
195
  }
186
- function wn(n, t) {
196
+ function kn(n, t) {
187
197
  const e = dn(n.cart_id, "cart_id", !0),
188
198
  r =
189
199
  void 0 === n.action
@@ -198,7 +208,7 @@ function wn(n, t) {
198
208
  var u;
199
209
  const o = Cn(n.products);
200
210
  if (!1 === e || !1 === r || null == o) return null;
201
- const c = r === un.Ed || r === un.Ad,
211
+ const c = r === un.Ld || r === un.Md,
202
212
  i =
203
213
  void 0 === n.total_value && c ? void 0 : pn(n.total_value, "total_value");
204
214
  if (!1 === i) return null;
@@ -209,23 +219,23 @@ function wn(n, t) {
209
219
  products: o,
210
220
  source: t.source,
211
221
  };
212
- return void 0 !== i && (a.total_value = i), hn(a, n.metadata) ? a : null;
222
+ return (
223
+ void 0 !== i && (a.total_value = i),
224
+ jn(a, n) && wn(a, n.metadata) ? a : null
225
+ );
213
226
  }
214
227
  export function sanitizeEcommerceEvent(n) {
215
228
  const t = n.properties;
216
229
  if (null == t || "object" != typeof t || g(t))
217
- return E.error(`${R.QE} requires a properties object.`), null;
230
+ return b.error(`${R.QE} requires a properties object.`), null;
218
231
  const e = t,
219
- r = jn(e);
232
+ r = hn(e);
220
233
  if (null == r) return null;
221
234
  switch (n.name) {
222
235
  case "ecommerce.product_viewed":
223
236
  return (function (n, t) {
224
237
  const e = n.metadata;
225
- if (null != e && "object" == typeof e && !g(e)) {
226
- const n = e;
227
- if (void 0 !== n.type && !vn(n.type, "metadata.type")) return null;
228
- }
238
+ if (void 0 !== n.type && !vn(n.type, "type")) return null;
229
239
  const r = dn(n.product_id, "product_id", !0),
230
240
  u = dn(n.product_name, "product_name", !0),
231
241
  o = dn(n.variant_id, "variant_id", !0),
@@ -252,11 +262,12 @@ export function sanitizeEcommerceEvent(n) {
252
262
  return (
253
263
  null != i && (s.image_url = i),
254
264
  null != a && (s.product_url = a),
255
- hn(s, e) ? s : null
265
+ void 0 !== n.type && (s.type = n.type),
266
+ wn(s, e) ? s : null
256
267
  );
257
268
  })(e, r);
258
269
  case "ecommerce.cart_updated":
259
- return wn(e, r);
270
+ return kn(e, r);
260
271
  case "ecommerce.checkout_started":
261
272
  return (function (n, t) {
262
273
  const e = dn(n.checkout_id, "checkout_id", !0),
@@ -271,7 +282,9 @@ export function sanitizeEcommerceEvent(n) {
271
282
  products: u,
272
283
  source: t.source,
273
284
  };
274
- return null != o && (c.cart_id = o), hn(c, n.metadata) ? c : null;
285
+ return (
286
+ null != o && (c.cart_id = o), jn(c, n) && wn(c, n.metadata) ? c : null
287
+ );
275
288
  })(e, r);
276
289
  case "ecommerce.order_placed":
277
290
  return (function (n, t) {
@@ -303,6 +316,10 @@ export function sanitizeEcommerceEvent(n) {
303
316
  i.total_discounts = t;
304
317
  }
305
318
  if (void 0 !== n.discounts) {
319
+ if (!g(n.discounts))
320
+ return (
321
+ b.error(`Cannot ${ln} because discounts must be an array.`), null
322
+ );
306
323
  const [t, e] = nt(
307
324
  { discounts: n.discounts },
308
325
  R.QE,
@@ -313,11 +330,11 @@ export function sanitizeEcommerceEvent(n) {
313
330
  if (!t || null == e) return null;
314
331
  i.discounts = e.discounts;
315
332
  }
316
- return hn(i, n.metadata) ? i : null;
333
+ return jn(i, n) && wn(i, n.metadata) ? i : null;
317
334
  })(e, r);
318
335
  default:
319
336
  return (
320
- E.error(
337
+ b.error(
321
338
  "logEcommerceEvent received an unknown event name. Ignoring event.",
322
339
  ),
323
340
  null
@@ -1,8 +1,8 @@
1
- import { logger as E } from "../../shared-lib/index.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
2
  import { getUser as ao } from "../Core/get-user.js";
3
3
  import { CoreStrings as R } from "../common/constants.js";
4
4
  import r from "../managers/braze-instance.js";
5
- import { keys as D } from "../util/code-utils.js";
5
+ import { keys as C } from "../util/code-utils.js";
6
6
  import User from "../User/user.js";
7
7
  export const buildBrazeBridge = (t, e) => {
8
8
  const o = { display: {}, web: {} },
@@ -12,7 +12,7 @@ export const buildBrazeBridge = (t, e) => {
12
12
  import("../Push/request-push-permission.js").then((e) => {
13
13
  r.ao()
14
14
  ? e.requestPushPermission(...Array.prototype.slice.call(t))
15
- : E.error(R.ee);
15
+ : b.error(R.ee);
16
16
  });
17
17
  };
18
18
  },
@@ -23,7 +23,7 @@ export const buildBrazeBridge = (t, e) => {
23
23
  ({ requestImmediateDataFlush: requestImmediateDataFlush }) => {
24
24
  r.ao()
25
25
  ? requestImmediateDataFlush(...Array.prototype.slice.call(t))
26
- : E.error(R.ee);
26
+ : b.error(R.ee);
27
27
  },
28
28
  );
29
29
  },
@@ -31,7 +31,7 @@ export const buildBrazeBridge = (t, e) => {
31
31
  const t = arguments;
32
32
  import("../Core/log-custom-event.js").then(
33
33
  ({ logCustomEvent: logCustomEvent }) => {
34
- if (!r.ao()) return void E.error(R.ee);
34
+ if (!r.ao()) return void b.error(R.ee);
35
35
  logCustomEvent(...Array.prototype.slice.call(t));
36
36
  },
37
37
  );
@@ -40,7 +40,7 @@ export const buildBrazeBridge = (t, e) => {
40
40
  const t = arguments;
41
41
  import("../Core/log-purchase.js").then(
42
42
  ({ logPurchase: logPurchase }) => {
43
- if (!r.ao()) return void E.error(R.ee);
43
+ if (!r.ao()) return void b.error(R.ee);
44
44
  logPurchase(...Array.prototype.slice.call(t));
45
45
  },
46
46
  );
@@ -51,7 +51,7 @@ export const buildBrazeBridge = (t, e) => {
51
51
  ({ unregisterPush: unregisterPush }) => {
52
52
  r.ao()
53
53
  ? unregisterPush(...Array.prototype.slice.call(t))
54
- : E.error(R.ee);
54
+ : b.error(R.ee);
55
55
  },
56
56
  );
57
57
  },
@@ -59,7 +59,7 @@ export const buildBrazeBridge = (t, e) => {
59
59
  changeUser: function () {
60
60
  const t = arguments;
61
61
  import("../Core/change-user.js").then(({ changeUser: changeUser }) => {
62
- if (!r.ao()) return void E.error(R.ee);
62
+ if (!r.ao()) return void b.error(R.ee);
63
63
  changeUser(...Array.prototype.slice.call(t));
64
64
  });
65
65
  },
@@ -69,7 +69,7 @@ export const buildBrazeBridge = (t, e) => {
69
69
  n[t](...Array.prototype.slice.call(arguments));
70
70
  };
71
71
  };
72
- for (const t of D(n)) o[t] = s(t);
72
+ for (const t of C(n)) o[t] = s(t);
73
73
  const i = [
74
74
  "setFirstName",
75
75
  "setLastName",
@@ -115,7 +115,7 @@ export const buildBrazeBridge = (t, e) => {
115
115
  };
116
116
  },
117
117
  f = o.display;
118
- for (const t of D(a)) f[t] = m(t);
118
+ for (const t of C(a)) f[t] = m(t);
119
119
  const l = { registerAppboyPushMessages: requestPushPermission() },
120
120
  p = function (t) {
121
121
  return function () {
@@ -123,7 +123,7 @@ export const buildBrazeBridge = (t, e) => {
123
123
  };
124
124
  },
125
125
  y = o.web;
126
- for (const t of D(l)) y[t] = p(t);
126
+ for (const t of C(l)) y[t] = p(t);
127
127
  return (
128
128
  (o.NotificationSubscriptionTypes = User.NotificationSubscriptionTypes), o
129
129
  );
package/src/util/net.js CHANGED
@@ -1,4 +1,4 @@
1
- import { logger as E } from "../../shared-lib/index.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
2
  import Ne from "../models/backend-errors.js";
3
3
  import { getErrorMessage as hi } from "./error-utils.js";
4
4
  const l = {
@@ -6,7 +6,7 @@ const l = {
6
6
  let e, o;
7
7
  try {
8
8
  const r = () => {
9
- E.error("This browser does not have any supported ajax options!");
9
+ b.error("This browser does not have any supported ajax options!");
10
10
  };
11
11
  let n = !1;
12
12
  if ((window.XMLHttpRequest && (n = !0), !n)) return void r();
@@ -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 ? Ne.Qa : Ne.Za,
30
+ error: "" === e.responseText ? Ne.Wa : Ne.Qa,
31
31
  response: e.responseText,
32
32
  };
33
33
  (0, t.lt)(n, r);
@@ -51,7 +51,7 @@ const l = {
51
51
  for (const t of i) e.setRequestHeader(t[0], t[1]);
52
52
  e.send(o);
53
53
  } catch (t) {
54
- E.error(`Network request error: ${hi(t)}`);
54
+ b.error(`Network request error: ${hi(t)}`);
55
55
  }
56
56
  },
57
57
  };
@@ -2,28 +2,28 @@ import { REQUEST_ATTEMPT_DEFAULT as Qe } from "../common/constants.js";
2
2
  import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
3
3
  const h = {
4
4
  it: {
5
- wn: "data",
6
- Ji: "content_cards/sync",
5
+ pn: "data",
6
+ Mi: "content_cards/sync",
7
7
  Co: "feature_flags/sync",
8
- ta: "template",
8
+ Yo: "template",
9
9
  st: "banners/sync",
10
10
  },
11
- xl: (t) => (null == t ? void 0 : t.Rt(s.Tt.ES)),
12
- Am: (t) => (null == t ? void 0 : t.Rt(s.Tt.SS)),
11
+ Pl: (t) => (null == t ? void 0 : t.St(s.It.ES)),
12
+ Am: (t) => (null == t ? void 0 : t.St(s.It.SS)),
13
13
  Rm: (t, e) => {
14
- null == t || t.It(s.Tt.ES, e);
14
+ null == t || t.Pt(s.It.ES, e);
15
15
  },
16
16
  qm: (t, e) => {
17
- null == t || t.It(s.Tt.SS, e);
17
+ null == t || t.Pt(s.It.SS, e);
18
18
  },
19
- Dl: (t, e) => {
19
+ ql: (t, e) => {
20
20
  if (!t || !e) return -1;
21
- const s = h.xl(t);
21
+ const s = h.Pl(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
- kl: (t, e) => {
26
+ Al: (t, e) => {
27
27
  let s = Qe;
28
28
  if (!t || !e) return s;
29
29
  const n = h.Am(t);
@@ -31,21 +31,21 @@ const h = {
31
31
  },
32
32
  nt: (t, e, s) => {
33
33
  if (!t || !e) return;
34
- let n = h.xl(t);
34
+ let n = h.Pl(t);
35
35
  null == n && (n = {}), (n[e] = s), h.Rm(t, n);
36
36
  },
37
- yl: (t, e, s) => {
37
+ Dl: (t, e, s) => {
38
38
  if (!t || !e) return;
39
39
  let n = h.Am(t);
40
40
  null == n && (n = {}), (n[e] = s), h.qm(t, n);
41
41
  },
42
- Li: (t, e) => {
43
- t && e && h.yl(t, e, Qe);
42
+ Ji: (t, e) => {
43
+ t && e && h.Dl(t, e, Qe);
44
44
  },
45
- Ml: (t, e) => {
45
+ zl: (t, e) => {
46
46
  if (!t || !e) return;
47
- const s = h.kl(t, e);
48
- h.yl(t, e, s + 1);
47
+ const s = h.Al(t, e);
48
+ h.Dl(t, e, s + 1);
49
49
  },
50
50
  };
51
51
  export default h;
@@ -1,4 +1,4 @@
1
- import { logger as E } from "../../shared-lib/index.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
2
  export function getByteLength(t) {
3
3
  let e = t.length;
4
4
  for (let n = t.length - 1; n >= 0; n--) {
@@ -17,6 +17,6 @@ export function decodeBrazeActions(t) {
17
17
  const r = new Uint16Array(n.buffer);
18
18
  return String.fromCharCode(...r);
19
19
  } catch (t) {
20
- return E.error("Unable to decode Base64: " + t), null;
20
+ return b.error("Unable to decode Base64: " + t), null;
21
21
  }
22
22
  }
@@ -2,7 +2,7 @@ import Ve from "./base-device-parser.js";
2
2
  import { Browsers as yi, OperatingSystems as so } from "./device-constants.js";
3
3
  export default class vi extends Ve {
4
4
  constructor() {
5
- super(), (this.Sd = vi.hf(navigator.userAgent || ""));
5
+ super(), (this.Sd = vi.Bc(navigator.userAgent || ""));
6
6
  }
7
7
  ef() {
8
8
  return this.Sd[0] || "Unknown Browser";
@@ -22,7 +22,7 @@ export default class vi extends Ve {
22
22
  }
23
23
  return Promise.resolve(navigator.platform);
24
24
  }
25
- static hf(r) {
25
+ static Bc(r) {
26
26
  let n,
27
27
  e =
28
28
  r.match(
@@ -2,10 +2,10 @@ import {
2
2
  isArray as g,
3
3
  isDate as Nt,
4
4
  isObject as Ct,
5
- keys as D,
5
+ keys as C,
6
6
  } from "./code-utils.js";
7
7
  import { getByteLength as er } from "./string-utils.js";
8
- import { logger as E } from "../../shared-lib/index.js";
8
+ import { logger as b } from "../../shared-lib/index.js";
9
9
  import { toValidBackendTimeString as $t } from "./date-utils.js";
10
10
  import { BRAZE_ACTIONS as oo } from "./braze-actions.js";
11
11
  import { CoreStrings as R } from "../common/constants.js";
@@ -36,14 +36,14 @@ export function validateCustomString(t, e, r) {
36
36
  null != t &&
37
37
  "string" == typeof t &&
38
38
  ("" === t || null != t.match(CUSTOM_DATA_REGEX));
39
- return n || E.error(`Cannot ${e} because ${r} "${t}" is invalid.`), n;
39
+ return n || b.error(`Cannot ${e} because ${r} "${t}" is invalid.`), n;
40
40
  }
41
41
  export function validateCustomAttributeKey(t) {
42
42
  return (
43
43
  null != t &&
44
44
  t.match(CUSTOM_ATTRIBUTE_SPECIAL_CHARS_REGEX) &&
45
45
  -1 === CUSTOM_ATTRIBUTE_RESERVED_OPERATORS.indexOf(t) &&
46
- E.warn("Custom attribute keys cannot contain '$' or '.'"),
46
+ b.warn("Custom attribute keys cannot contain '$' or '.'"),
47
47
  validateCustomString(t, "set custom user attribute", "the given key")
48
48
  );
49
49
  }
@@ -56,7 +56,7 @@ export function validatePropertyType(t) {
56
56
  export function _validateNestedProperties(t, e, r) {
57
57
  const n = -1 !== r;
58
58
  if (n && r > 50)
59
- return E.error("Nested attributes cannot be more than 50 levels deep."), !1;
59
+ return b.error("Nested attributes cannot be more than 50 levels deep."), !1;
60
60
  const o = n ? r + 1 : -1;
61
61
  if (g(t) && g(e)) {
62
62
  for (let r = 0; r < t.length && r < e.length; r++)
@@ -67,7 +67,7 @@ export function _validateNestedProperties(t, e, r) {
67
67
  return !1;
68
68
  } else {
69
69
  if (!Ct(t)) return validatePropertyType(t);
70
- for (const r of D(t)) {
70
+ for (const r of C(t)) {
71
71
  const i = t[r];
72
72
  if (n && !validateCustomAttributeKey(r)) return !1;
73
73
  if (Nt(i)) {
@@ -85,18 +85,18 @@ export function _validateEventPropertyValue(t, e, r, n, o) {
85
85
  Ct(t) || g(t)
86
86
  ? _validateNestedProperties(t, e, o ? 1 : -1)
87
87
  : validatePropertyType(t)),
88
- i || E.error(`Cannot ${r} because ${n} "${t}" is invalid.`),
88
+ i || b.error(`Cannot ${r} because ${n} "${t}" is invalid.`),
89
89
  i
90
90
  );
91
91
  }
92
92
  export function validateStandardString(t, e, r, n = !1) {
93
93
  const o = "string" == typeof t || (null === t && n);
94
- return o || E.error(`Cannot ${e} because ${r} "${t}" is invalid.`), o;
94
+ return o || b.error(`Cannot ${e} because ${r} "${t}" is invalid.`), o;
95
95
  }
96
96
  export function validateCustomProperties(t, e, r, n, o) {
97
97
  if ((null == t && (t = {}), "object" != typeof t || g(t)))
98
98
  return (
99
- E.error(`${e} requires that ${r} be an object. Ignoring ${o}.`),
99
+ b.error(`${e} requires that ${r} be an object. Ignoring ${o}.`),
100
100
  [!1, null]
101
101
  );
102
102
  let i, a;
@@ -104,7 +104,7 @@ export function validateCustomProperties(t, e, r, n, o) {
104
104
  const s = JSON.stringify(t);
105
105
  if (er(s) > i)
106
106
  return (
107
- E.error(
107
+ b.error(
108
108
  `Could not ${n} because ${r} was greater than the max size of ${a}.`,
109
109
  ),
110
110
  [!1, null]
@@ -114,7 +114,7 @@ export function validateCustomProperties(t, e, r, n, o) {
114
114
  u = JSON.parse(s);
115
115
  } catch (t) {
116
116
  return (
117
- E.error(`Could not ${n} because ${r} did not contain valid JSON.`),
117
+ b.error(`Could not ${n} because ${r} did not contain valid JSON.`),
118
118
  [!1, null]
119
119
  );
120
120
  }
@@ -145,7 +145,7 @@ export function validateCustomAttributeArrayType(t, e) {
145
145
  let r = !1,
146
146
  n = !1;
147
147
  const o = () => {
148
- E.error(
148
+ b.error(
149
149
  "Custom attribute arrays must be either string arrays or object arrays.",
150
150
  );
151
151
  };
@@ -28,7 +28,7 @@ export function _getCurrentUrl() {
28
28
  }
29
29
  export const WindowUtils = {
30
30
  openUri: _openUri,
31
- ja: _isPhone,
32
- ba: _getOrientation,
31
+ da: _isPhone,
32
+ ga: _getOrientation,
33
33
  Qh: _getCurrentUrl,
34
34
  };