@braze/web-sdk 5.3.1 → 5.3.2

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 (63) hide show
  1. package/index.d.ts +1 -1
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +3 -3
  4. package/shared-lib/logger.js +2 -2
  5. package/src/InAppMessage/display/html-message-display-utils.js +172 -0
  6. package/src/InAppMessage/display/html-message-to-html.js +54 -219
  7. package/src/InAppMessage/display/in-app-message-to-html.js +21 -21
  8. package/src/InAppMessage/display/modal-utils.js +7 -7
  9. package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
  10. package/src/InAppMessage/in-app-message-factory.js +4 -4
  11. package/src/InAppMessage/in-app-message-manager.js +56 -56
  12. package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
  13. package/src/InAppMessage/log-in-app-message-click.js +1 -1
  14. package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
  15. package/src/InAppMessage/log-in-app-message-impression.js +1 -1
  16. package/src/InAppMessage/models/full-screen-message.js +2 -2
  17. package/src/InAppMessage/models/html-message.js +2 -2
  18. package/src/InAppMessage/models/in-app-message-button.js +2 -2
  19. package/src/InAppMessage/models/in-app-message.js +26 -26
  20. package/src/InAppMessage/models/modal-message.js +2 -2
  21. package/src/InAppMessage/models/slide-up-message.js +4 -4
  22. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  23. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  24. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  25. package/src/InAppMessage/ui/show-in-app-message.js +10 -10
  26. package/src/InAppMessage/utils/in-app-message-utils.js +1 -18
  27. package/src/Push/is-push-blocked.js +2 -2
  28. package/src/Push/is-push-permission-granted.js +2 -2
  29. package/src/Push/is-push-supported.js +2 -2
  30. package/src/Push/push-manager.js +9 -9
  31. package/src/Push/utils/push-utils.js +10 -10
  32. package/src/User/user-manager.js +1 -1
  33. package/src/User/user.js +15 -15
  34. package/src/common/feed-display.js +8 -8
  35. package/src/managers/auth-manager.js +1 -1
  36. package/src/managers/braze-instance.js +13 -13
  37. package/src/managers/device-manager.js +2 -2
  38. package/src/managers/network-manager.js +17 -17
  39. package/src/managers/server-config-manager.js +3 -3
  40. package/src/managers/storage-manager-factory.js +3 -3
  41. package/src/managers/storage-manager.js +1 -1
  42. package/src/models/braze-event.js +7 -7
  43. package/src/models/device.js +2 -2
  44. package/src/models/server-config.js +7 -7
  45. package/src/request-controller.js +3 -3
  46. package/src/triggers/models/custom-event-data.js +2 -2
  47. package/src/triggers/models/custom-event-property-data.js +4 -4
  48. package/src/triggers/models/filter-set.js +3 -3
  49. package/src/triggers/models/filter.js +6 -6
  50. package/src/triggers/models/purchase-data.js +2 -2
  51. package/src/triggers/models/purchase-property-data.js +4 -4
  52. package/src/triggers/models/trigger-condition.js +38 -38
  53. package/src/triggers/models/trigger.js +12 -12
  54. package/src/triggers/triggers-provider-factory.js +1 -1
  55. package/src/triggers/triggers-provider.js +12 -12
  56. package/src/ui/js/attach-css.js +1 -1
  57. package/src/util/braze-actions.js +4 -4
  58. package/src/util/component-utils.js +2 -2
  59. package/src/util/date-utils.js +2 -2
  60. package/src/util/dom-utils.js +3 -3
  61. package/src/util/net.js +2 -2
  62. package/src/util/request-header-utils.js +1 -1
  63. package/src/util/validation-utils.js +17 -17
package/src/util/net.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { logger as r } from "../../shared-lib/index.js";
2
- import qt from "../models/backend-errors.js";
2
+ import Xt from "../models/backend-errors.js";
3
3
  import { getErrorMessage as si } from "./error-utils.js";
4
4
  const C = {
5
5
  Gs: (t) => {
@@ -28,7 +28,7 @@ const C = {
28
28
  (r = e.getAllResponseHeaders());
29
29
  } catch (o) {
30
30
  const n = {
31
- error: "" === e.responseText ? qt.Zh : qt.Ra,
31
+ error: "" === e.responseText ? Xt.Zh : Xt.Ra,
32
32
  response: e.responseText,
33
33
  };
34
34
  (0, t.L)(n, r);
@@ -5,7 +5,7 @@ const D = {
5
5
  $a: "data",
6
6
  Bs: "content_cards/sync",
7
7
  bi: "feature_flags/sync",
8
- Mr: "template",
8
+ Ir: "template",
9
9
  },
10
10
  qu: (t) => (null == t ? void 0 : t.j(o.C.lE)),
11
11
  sm: (t) => (null == t ? void 0 : t.j(o.C.SE)),
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  isArray as j,
3
- isDate as yt,
4
- isObject as Nt,
3
+ isDate as Nt,
4
+ isObject as Ct,
5
5
  keys as to,
6
6
  } from "./code-utils.js";
7
7
  import { getByteLength as O } from "./string-utils.js";
8
8
  import { logger as r } from "../../shared-lib/index.js";
9
- import { toValidBackendTimeString as $t } from "./date-utils.js";
9
+ import { toValidBackendTimeString as Bt } from "./date-utils.js";
10
10
  import { BRAZE_ACTIONS as V } from "./braze-actions.js";
11
- import { SET_CUSTOM_USER_ATTRIBUTE_STRING as Ft } from "../common/constants.js";
11
+ import { SET_CUSTOM_USER_ATTRIBUTE_STRING as $t } 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 = [
@@ -48,7 +48,7 @@ export function validateCustomAttributeKey(t) {
48
48
  export function validatePropertyType(t) {
49
49
  const e = typeof t;
50
50
  return (
51
- null == t || "number" === e || "boolean" === e || yt(t) || "string" === e
51
+ null == t || "number" === e || "boolean" === e || Nt(t) || "string" === e
52
52
  );
53
53
  }
54
54
  export function _validateNestedProperties(t, e, n) {
@@ -59,17 +59,17 @@ export function _validateNestedProperties(t, e, n) {
59
59
  if (j(t) && j(e)) {
60
60
  for (let r = 0; r < t.length && r < e.length; r++)
61
61
  if (
62
- (yt(t[r]) && (e[r] = $t(t[r])),
62
+ (Nt(t[r]) && (e[r] = Bt(t[r])),
63
63
  !_validateNestedProperties(t[r], e[r], i))
64
64
  )
65
65
  return !1;
66
66
  } else {
67
- if (!Nt(t)) return validatePropertyType(t);
67
+ if (!Ct(t)) return validatePropertyType(t);
68
68
  for (const r of to(t)) {
69
69
  const n = t[r];
70
70
  if (o && !validateCustomAttributeKey(r)) return !1;
71
- if (yt(n)) {
72
- e[r] = $t(n);
71
+ if (Nt(n)) {
72
+ e[r] = Bt(n);
73
73
  }
74
74
  if (!_validateNestedProperties(n, e[r], i)) return !1;
75
75
  }
@@ -80,7 +80,7 @@ export function _validateEventPropertyValue(t, e, n, o, i) {
80
80
  let a;
81
81
  return (
82
82
  (a =
83
- Nt(t) || j(t)
83
+ Ct(t) || j(t)
84
84
  ? _validateNestedProperties(t, e, i ? 1 : -1)
85
85
  : validatePropertyType(t)),
86
86
  a || r.error(`Cannot ${n} because ${o} "${t}" is invalid.`),
@@ -98,7 +98,7 @@ export function validateCustomProperties(t, e, n, o, i) {
98
98
  [!1, null]
99
99
  );
100
100
  let a, s;
101
- e === Ft ? ((a = 76800), (s = "75KB")) : ((a = 51200), (s = "50KB"));
101
+ e === $t ? ((a = 76800), (s = "75KB")) : ((a = 51200), (s = "50KB"));
102
102
  const u = JSON.stringify(t);
103
103
  if (O(u) > a)
104
104
  return (
@@ -117,22 +117,22 @@ export function validateCustomProperties(t, e, n, o, i) {
117
117
  );
118
118
  }
119
119
  for (const r in t) {
120
- if (e === Ft && !validateCustomAttributeKey(r)) return [!1, null];
120
+ if (e === $t && !validateCustomAttributeKey(r)) return [!1, null];
121
121
  if (!validateCustomString(r, o, `the ${i} property name`))
122
122
  return [!1, null];
123
123
  const n = t[r];
124
- if (e !== Ft && null == n) {
124
+ if (e !== $t && null == n) {
125
125
  delete t[r], delete l[r];
126
126
  continue;
127
127
  }
128
- yt(n) && (l[r] = $t(n));
128
+ Nt(n) && (l[r] = Bt(n));
129
129
  if (
130
130
  !_validateEventPropertyValue(
131
131
  n,
132
132
  l[r],
133
133
  o,
134
134
  `the ${i} property "${r}"`,
135
- e === Ft,
135
+ e === $t,
136
136
  )
137
137
  )
138
138
  return [!1, null];
@@ -160,12 +160,12 @@ export function validateCustomAttributeArrayType(t, e) {
160
160
  return [!1, !1];
161
161
  n = !0;
162
162
  } else {
163
- if (!Nt(r)) return i(), [!1, !1];
163
+ if (!Ct(r)) return i(), [!1, !1];
164
164
  if (n) return i(), [!1, !1];
165
165
  if (
166
166
  !validateCustomProperties(
167
167
  r,
168
- Ft,
168
+ $t,
169
169
  "attribute value",
170
170
  `set custom user attribute "${t}"`,
171
171
  "custom user attribute",