@braze/web-sdk 5.0.1 → 5.1.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 (158) hide show
  1. package/README.md +1 -1
  2. package/index.d.ts +10 -5
  3. package/package.json +1 -1
  4. package/shared-lib/encoding-utils.js +3 -3
  5. package/shared-lib/event-types.js +29 -29
  6. package/shared-lib/guid.js +3 -3
  7. package/shared-lib/index.js +6 -0
  8. package/shared-lib/indexed-db-adapter.js +70 -70
  9. package/shared-lib/logger.js +18 -18
  10. package/shared-lib/supported-options.js +21 -21
  11. package/src/Card/card-manager.js +43 -45
  12. package/src/Card/display/card-display.js +60 -60
  13. package/src/Card/log-card-click.js +4 -4
  14. package/src/Card/log-card-dismissal.js +2 -3
  15. package/src/Card/log-card-impressions.js +7 -7
  16. package/src/Card/models/captioned-image.js +21 -21
  17. package/src/Card/models/card.js +73 -73
  18. package/src/Card/models/classic-card.js +21 -21
  19. package/src/Card/models/control-card.js +11 -11
  20. package/src/Card/models/image-only.js +19 -19
  21. package/src/Card/util/card-factory.js +68 -68
  22. package/src/ContentCards/content-cards-provider-factory.js +3 -3
  23. package/src/ContentCards/content-cards-provider.js +255 -245
  24. package/src/ContentCards/content-cards.js +2 -2
  25. package/src/ContentCards/get-cached-content-cards.js +1 -1
  26. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  27. package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
  28. package/src/ContentCards/ui/hide-content-cards.js +1 -1
  29. package/src/ContentCards/ui/show-content-cards.js +24 -24
  30. package/src/ContentCards/ui/toggle-content-cards.js +1 -1
  31. package/src/Core/add-sdk-metadata.js +21 -19
  32. package/src/Core/change-user.js +10 -10
  33. package/src/Core/destroy.js +2 -2
  34. package/src/Core/disable-sdk.js +11 -11
  35. package/src/Core/enable-sdk.js +7 -7
  36. package/src/Core/get-device-id.js +6 -6
  37. package/src/Core/get-user.js +1 -1
  38. package/src/Core/handle-braze-action.js +41 -41
  39. package/src/Core/is-disabled.js +2 -2
  40. package/src/Core/log-custom-event.js +15 -15
  41. package/src/Core/log-purchase.js +31 -37
  42. package/src/Core/open-session.js +12 -12
  43. package/src/Core/remove-all-subscriptions.js +1 -1
  44. package/src/Core/remove-subscription.js +1 -1
  45. package/src/Core/request-immediate-data-flush.js +1 -1
  46. package/src/Core/set-logger.js +2 -2
  47. package/src/Core/set-sdk-authentication-signature.js +3 -3
  48. package/src/Core/subscribe-to-sdk-authentication-failures.js +6 -4
  49. package/src/Core/toggle-logging.js +2 -2
  50. package/src/Core/wipe-data.js +9 -9
  51. package/src/FeatureFlags/feature-flag-factory.js +12 -12
  52. package/src/FeatureFlags/feature-flag.js +10 -10
  53. package/src/FeatureFlags/feature-flags-provider-factory.js +3 -2
  54. package/src/FeatureFlags/feature-flags-provider.js +108 -80
  55. package/src/FeatureFlags/get-all-feature-flags.js +5 -5
  56. package/src/FeatureFlags/get-feature-flag.js +6 -6
  57. package/src/FeatureFlags/log-feature-flag-impression.js +15 -13
  58. package/src/FeatureFlags/refresh-feature-flags.js +1 -1
  59. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +7 -4
  60. package/src/Feed/feed-provider-factory.js +2 -2
  61. package/src/Feed/feed-provider.js +44 -44
  62. package/src/Feed/feed.js +1 -1
  63. package/src/Feed/get-cached-feed.js +1 -1
  64. package/src/Feed/log-feed-displayed.js +4 -4
  65. package/src/Feed/request-feed-refresh.js +1 -1
  66. package/src/Feed/subscribe-to-feed-updates.js +1 -1
  67. package/src/Feed/ui/hide-feed.js +1 -1
  68. package/src/Feed/ui/show-feed.js +28 -28
  69. package/src/Feed/ui/toggle-feed.js +1 -1
  70. package/src/InAppMessage/defer-in-app-message.js +5 -5
  71. package/src/InAppMessage/display/html-message-to-html.js +54 -54
  72. package/src/InAppMessage/display/in-app-message-to-html.js +79 -79
  73. package/src/InAppMessage/display/modal-utils.js +8 -8
  74. package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
  75. package/src/InAppMessage/in-app-message-factory.js +49 -49
  76. package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
  77. package/src/InAppMessage/in-app-message-manager.js +143 -138
  78. package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
  79. package/src/InAppMessage/log-in-app-message-click.js +9 -9
  80. package/src/InAppMessage/log-in-app-message-html-click.js +12 -12
  81. package/src/InAppMessage/log-in-app-message-impression.js +6 -6
  82. package/src/InAppMessage/models/full-screen-message.js +33 -33
  83. package/src/InAppMessage/models/html-message.js +20 -20
  84. package/src/InAppMessage/models/in-app-message-button.js +6 -6
  85. package/src/InAppMessage/models/in-app-message.js +99 -99
  86. package/src/InAppMessage/models/modal-message.js +32 -32
  87. package/src/InAppMessage/models/slide-up-message.js +28 -28
  88. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  89. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  90. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +4 -4
  91. package/src/InAppMessage/ui/show-in-app-message.js +81 -81
  92. package/src/Push/is-push-blocked.js +1 -1
  93. package/src/Push/is-push-permission-granted.js +1 -1
  94. package/src/Push/is-push-supported.js +1 -1
  95. package/src/Push/push-manager-factory.js +5 -5
  96. package/src/Push/push-manager.js +176 -173
  97. package/src/Push/request-push-permission.js +1 -1
  98. package/src/Push/unregister-push.js +1 -1
  99. package/src/Push/utils/push-utils.js +4 -4
  100. package/src/User/user-manager.js +29 -29
  101. package/src/User/user.js +72 -74
  102. package/src/common/base-feed.js +7 -7
  103. package/src/common/base-provider.js +1 -1
  104. package/src/common/constants.js +2 -0
  105. package/src/common/event-logger.js +21 -18
  106. package/src/common/feed-display.js +44 -44
  107. package/src/l10n/l10n-manager-factory.js +3 -3
  108. package/src/l10n/l10n-manager.js +7 -7
  109. package/src/managers/auth-manager.js +32 -32
  110. package/src/managers/braze-instance.js +188 -190
  111. package/src/managers/device-manager.js +28 -28
  112. package/src/managers/network-manager.js +189 -138
  113. package/src/managers/server-config-manager.js +69 -53
  114. package/src/managers/session-manager.js +34 -30
  115. package/src/managers/storage-manager-factory.js +16 -16
  116. package/src/managers/storage-manager.js +178 -163
  117. package/src/managers/subscription-manager.js +12 -12
  118. package/src/models/backend-errors.js +5 -5
  119. package/src/models/braze-event.js +4 -4
  120. package/src/models/device.js +2 -2
  121. package/src/models/identifier.js +34 -14
  122. package/src/models/push-token.js +8 -8
  123. package/src/models/request-result.js +3 -3
  124. package/src/models/server-config.js +32 -23
  125. package/src/request-controller.js +186 -179
  126. package/src/triggers/models/custom-event-data.js +7 -7
  127. package/src/triggers/models/custom-event-property-data.js +10 -10
  128. package/src/triggers/models/filter-set.js +13 -13
  129. package/src/triggers/models/filter.js +45 -45
  130. package/src/triggers/models/in-app-message-click-data.js +12 -12
  131. package/src/triggers/models/purchase-data.js +2 -2
  132. package/src/triggers/models/purchase-property-data.js +10 -10
  133. package/src/triggers/models/push-click-data.js +7 -7
  134. package/src/triggers/models/trigger-condition.js +57 -59
  135. package/src/triggers/models/trigger-events.js +4 -4
  136. package/src/triggers/models/trigger.js +38 -38
  137. package/src/triggers/triggers-provider-factory.js +4 -4
  138. package/src/triggers/triggers-provider.js +127 -130
  139. package/src/ui/js/attach-css.js +2 -2
  140. package/src/ui/js/iam-css.js +1 -1
  141. package/src/ui/js/load-font-awesome.js +1 -1
  142. package/src/util/base-device-parser.js +3 -3
  143. package/src/util/braze-actions.js +35 -35
  144. package/src/util/browser-detector.js +21 -21
  145. package/src/util/client-hints-parser.js +8 -8
  146. package/src/util/code-utils.js +2 -2
  147. package/src/util/component-utils.js +1 -1
  148. package/src/util/deprecation-utils.js +4 -4
  149. package/src/util/device-constants.js +1 -1
  150. package/src/util/dom-utils.js +18 -18
  151. package/src/util/key-codes.js +1 -1
  152. package/src/util/net.js +18 -18
  153. package/src/util/request-header-utils.js +39 -37
  154. package/src/util/string-utils.js +10 -10
  155. package/src/util/user-agent-parser.js +18 -18
  156. package/src/util/validation-utils.js +37 -39
  157. package/src/util/window-utils.js +3 -3
  158. package/shared-lib/braze-shared-lib.js +0 -8
@@ -1,63 +1,63 @@
1
1
  import _t from "../models/identifier.js";
2
- import { getByteLength as U } from "../util/string-utils.js";
2
+ import { getByteLength as O } from "../util/string-utils.js";
3
3
  import ti from "../models/push-token.js";
4
- import r from "../../shared-lib/braze-shared-lib.js";
5
- import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
4
+ import { logger as r, IndexedDBAdapter as A } from "../../shared-lib/index.js";
5
+ import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
6
6
  import { User } from "../User/index.js";
7
7
  export default class bt {
8
8
  constructor(t, s) {
9
9
  (this.yt = t), (this.u = s), (this.yt = t), (this.u = s);
10
10
  }
11
11
  getUserId() {
12
- const t = this.u.tu(i.eu.su);
12
+ const t = this.u.tu(o.iu.su);
13
13
  if (null == t) return null;
14
- let s = t.iu,
15
- e = U(s);
16
- if (e > User.lr) {
17
- for (; e > User.lr; ) (s = s.slice(0, s.length - 1)), (e = U(s));
18
- (t.iu = s), this.u.uu(i.eu.su, t);
14
+ let s = t.eu,
15
+ i = O(s);
16
+ if (i > User.lr) {
17
+ for (; i > User.lr; ) (s = s.slice(0, s.length - 1)), (i = O(s));
18
+ (t.eu = s), this.u.uu(o.iu.su, t);
19
19
  }
20
20
  return s;
21
21
  }
22
- ru(t) {
22
+ ou(t) {
23
23
  const s = null == this.getUserId();
24
- this.u.uu(i.eu.su, new _t(t)), s && this.u.ou(t);
24
+ this.u.uu(o.iu.su, new _t(t)), s && this.u.ru(t);
25
25
  }
26
26
  setCustomUserAttribute(t, s) {
27
27
  if (this.yt.hu(t))
28
28
  return (
29
- r.j.info('Custom Attribute "' + t + '" is blocklisted, ignoring.'), !1
29
+ r.info('Custom Attribute "' + t + '" is blocklisted, ignoring.'), !1
30
30
  );
31
- const e = {};
32
- return (e[t] = s), this.nu(User.lu, e, !0);
31
+ const i = {};
32
+ return (i[t] = s), this.nu(User.lu, i, !0);
33
33
  }
34
- nu(t, s, e = !1, i = !1) {
34
+ nu(t, s, i = !1, e = !1) {
35
35
  const u = this.u.mu(this.getUserId(), t, s);
36
36
  let o = "",
37
37
  h = t,
38
38
  n = s;
39
39
  return (
40
- e &&
40
+ i &&
41
41
  ((o = " custom"),
42
42
  "object" == typeof s &&
43
43
  ((h = Object.keys(s)[0]),
44
44
  (n = s[h]),
45
45
  "object" == typeof n && (n = JSON.stringify(n, null, 2)))),
46
- !i && u && r.j.info(`Logged${o} attribute ${h} with value ${n}`),
46
+ !e && u && r.info(`Logged${o} attribute ${h} with value ${n}`),
47
47
  u
48
48
  );
49
49
  }
50
- _n(t, s, e, u, o) {
50
+ Sn(t, s, i, e, u) {
51
51
  this.nu("push_token", t, !1, !0),
52
- this.nu("custom_push_public_key", e, !1, !0),
53
- this.nu("custom_push_user_auth", u, !1, !0),
54
- this.nu("custom_push_vapid_public_key", o, !1, !0);
55
- const h = r.ts.Zt,
56
- n = new r.es(h, r.j),
57
- l = new ti(t, s, e, u, o);
58
- this.u.D(i.k.Bn, l.tt()), n.setItem(h.rs.cu, h.ie, !0);
52
+ this.nu("custom_push_public_key", i, !1, !0),
53
+ this.nu("custom_push_user_auth", e, !1, !0),
54
+ this.nu("custom_push_vapid_public_key", u, !1, !0);
55
+ const h = A.Yt.Qt,
56
+ n = new A(h, r),
57
+ l = new ti(t, s, i, e, u);
58
+ this.u.k(o.C.zn, l.Y()), n.setItem(h.ss.cu, h.ie, !0);
59
59
  }
60
- Nn(t) {
60
+ jn(t) {
61
61
  if (
62
62
  (this.nu("push_token", null, !1, !0),
63
63
  this.nu("custom_push_public_key", null, !1, !0),
@@ -65,9 +65,9 @@ export default class bt {
65
65
  this.nu("custom_push_vapid_public_key", null, !1, !0),
66
66
  t)
67
67
  ) {
68
- const t = r.ts.Zt,
69
- s = new r.es(t, r.j);
70
- this.u.D(i.k.Bn, !1), s.setItem(t.rs.cu, t.ie, !1);
68
+ const t = A.Yt.Qt,
69
+ s = new A(t, r);
70
+ this.u.k(o.C.zn, !1), s.setItem(t.ss.cu, t.ie, !1);
71
71
  }
72
72
  }
73
73
  }
package/src/User/user.js CHANGED
@@ -1,55 +1,55 @@
1
1
  import {
2
- isArray as p,
2
+ isArray as j,
3
3
  isDate as yt,
4
4
  isObject as Nt,
5
- validateValueIsFromEnum as G,
5
+ validateValueIsFromEnum as J,
6
6
  } from "../util/code-utils.js";
7
- import r from "../../shared-lib/braze-shared-lib.js";
7
+ import { logger as r, EventTypes as i } from "../../shared-lib/index.js";
8
8
  import {
9
9
  isValidEmail as Ct,
10
10
  validateCustomAttributeArrayType as St,
11
11
  validateCustomAttributeKey as At,
12
- validateCustomProperties as rt,
13
- validateCustomString as ot,
12
+ validateCustomProperties as ot,
13
+ validateCustomString as rt,
14
14
  validatePropertyType as Ut,
15
- validateStandardString as H,
15
+ validateStandardString as P,
16
16
  } from "../util/validation-utils.js";
17
17
  import { SET_CUSTOM_USER_ATTRIBUTE_STRING as Ft } from "../common/constants.js";
18
18
  import { toValidBackendTimeString as $t } from "../util/date-utils.js";
19
19
  export default class User {
20
20
  constructor(t, e) {
21
- (this.wt = t), (this.ki = e), (this.wt = t), (this.ki = e);
21
+ (this.wt = t), (this.Ei = e), (this.wt = t), (this.Ei = e);
22
22
  }
23
23
  getUserId(t) {
24
24
  const e = this.wt.getUserId();
25
25
  if ("function" != typeof t) return e;
26
- r.j.warn(
26
+ r.warn(
27
27
  "The callback for getUserId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getUser().getUserId()`)",
28
28
  ),
29
29
  t(e);
30
30
  }
31
31
  addAlias(t, e) {
32
- return !H(t, "add alias", "the alias", !1) || t.length <= 0
33
- ? (r.j.error("addAlias requires a non-empty alias"), !1)
34
- : !H(e, "add alias", "the label", !1) || e.length <= 0
35
- ? (r.j.error("addAlias requires a non-empty label"), !1)
36
- : this.ki.$n(t, e).O;
32
+ return !P(t, "add alias", "the alias", !1) || t.length <= 0
33
+ ? (r.error("addAlias requires a non-empty alias"), !1)
34
+ : !P(e, "add alias", "the label", !1) || e.length <= 0
35
+ ? (r.error("addAlias requires a non-empty label"), !1)
36
+ : this.Ei.Fn(t, e).L;
37
37
  }
38
38
  setFirstName(t) {
39
39
  return (
40
- !!H(t, "set first name", "the firstName", !0) &&
40
+ !!P(t, "set first name", "the firstName", !0) &&
41
41
  this.wt.nu("first_name", t)
42
42
  );
43
43
  }
44
44
  setLastName(t) {
45
45
  return (
46
- !!H(t, "set last name", "the lastName", !0) && this.wt.nu("last_name", t)
46
+ !!P(t, "set last name", "the lastName", !0) && this.wt.nu("last_name", t)
47
47
  );
48
48
  }
49
49
  setEmail(t) {
50
50
  return null === t || Ct(t)
51
51
  ? this.wt.nu("email", t)
52
- : (r.j.error(
52
+ : (r.error(
53
53
  `Cannot set email address - "${t}" did not pass RFC-5322 validation.`,
54
54
  ),
55
55
  !1);
@@ -59,7 +59,7 @@ export default class User {
59
59
  "string" == typeof t && (t = t.toLowerCase()),
60
60
  !(
61
61
  null !== t &&
62
- !G(
62
+ !J(
63
63
  User.Genders,
64
64
  t,
65
65
  `Gender "${t}" is not a valid gender.`,
@@ -84,28 +84,28 @@ export default class User {
84
84
  e < 1 ||
85
85
  s > 31 ||
86
86
  s < 1
87
- ? (r.j.error(
87
+ ? (r.error(
88
88
  "Cannot set date of birth - parameters should comprise a valid date e.g. setDateOfBirth(1776, 7, 4);",
89
89
  ),
90
90
  !1)
91
91
  : this.wt.nu("dob", `${t}-${e}-${s}`));
92
92
  }
93
93
  setCountry(t) {
94
- return !!H(t, "set country", "the country", !0) && this.wt.nu("country", t);
94
+ return !!P(t, "set country", "the country", !0) && this.wt.nu("country", t);
95
95
  }
96
96
  setHomeCity(t) {
97
97
  return (
98
- !!H(t, "set home city", "the homeCity", !0) && this.wt.nu("home_city", t)
98
+ !!P(t, "set home city", "the homeCity", !0) && this.wt.nu("home_city", t)
99
99
  );
100
100
  }
101
101
  setLanguage(t) {
102
102
  return (
103
- !!H(t, "set language", "the language", !0) && this.wt.nu("language", t)
103
+ !!P(t, "set language", "the language", !0) && this.wt.nu("language", t)
104
104
  );
105
105
  }
106
106
  setEmailNotificationSubscriptionType(t) {
107
107
  return (
108
- !!G(
108
+ !!J(
109
109
  User.NotificationSubscriptionTypes,
110
110
  t,
111
111
  `Email notification setting "${t}" is not a valid subscription type.`,
@@ -115,7 +115,7 @@ export default class User {
115
115
  }
116
116
  setPushNotificationSubscriptionType(t) {
117
117
  return (
118
- !!G(
118
+ !!J(
119
119
  User.NotificationSubscriptionTypes,
120
120
  t,
121
121
  `Push notification setting "${t}" is not a valid subscription type.`,
@@ -125,51 +125,49 @@ export default class User {
125
125
  }
126
126
  setPhoneNumber(t) {
127
127
  return (
128
- !!H(t, "set phone number", "the phoneNumber", !0) &&
129
- (null === t || t.match(User.Ln)
128
+ !!P(t, "set phone number", "the phoneNumber", !0) &&
129
+ (null === t || t.match(User.$n)
130
130
  ? this.wt.nu("phone", t)
131
- : (r.j.error(
132
- `Cannot set phone number - "${t}" did not pass validation.`,
133
- ),
131
+ : (r.error(`Cannot set phone number - "${t}" did not pass validation.`),
134
132
  !1))
135
133
  );
136
134
  }
137
- setLastKnownLocation(t, e, s, i, n) {
135
+ setLastKnownLocation(t, e, s, n, i) {
138
136
  return null == t || null == e
139
- ? (r.j.error(
137
+ ? (r.error(
140
138
  "Cannot set last-known location - latitude and longitude are required.",
141
139
  ),
142
140
  !1)
143
141
  : ((t = parseFloat(t.toString())),
144
142
  (e = parseFloat(e.toString())),
145
143
  null != s && (s = parseFloat(s.toString())),
146
- null != i && (i = parseFloat(i.toString())),
147
144
  null != n && (n = parseFloat(n.toString())),
145
+ null != i && (i = parseFloat(i.toString())),
148
146
  isNaN(t) ||
149
147
  isNaN(e) ||
150
148
  (null != s && isNaN(s)) ||
151
- (null != i && isNaN(i)) ||
152
- (null != n && isNaN(n))
153
- ? (r.j.error(
149
+ (null != n && isNaN(n)) ||
150
+ (null != i && isNaN(i))
151
+ ? (r.error(
154
152
  "Cannot set last-known location - all supplied parameters must be numeric.",
155
153
  ),
156
154
  !1)
157
155
  : t > 90 || t < -90 || e > 180 || e < -180
158
- ? (r.j.error(
156
+ ? (r.error(
159
157
  "Cannot set last-known location - latitude and longitude are bounded by ±90 and ±180 respectively.",
160
158
  ),
161
159
  !1)
162
- : (null != s && s < 0) || (null != n && n < 0)
163
- ? (r.j.error(
160
+ : (null != s && s < 0) || (null != i && i < 0)
161
+ ? (r.error(
164
162
  "Cannot set last-known location - accuracy and altitudeAccuracy may not be negative.",
165
163
  ),
166
164
  !1)
167
- : this.ki.setLastKnownLocation(this.wt.getUserId(), t, e, i, s, n).O);
165
+ : this.Ei.setLastKnownLocation(this.wt.getUserId(), t, e, n, s, i).L);
168
166
  }
169
- setCustomUserAttribute(t, e, s) {
167
+ setCustomUserAttribute(t, e, r) {
170
168
  if (!At(t)) return !1;
171
- const i = (e) => {
172
- const [r] = rt(
169
+ const s = (e) => {
170
+ const [r] = ot(
173
171
  e,
174
172
  Ft,
175
173
  "attribute value",
@@ -178,20 +176,20 @@ export default class User {
178
176
  );
179
177
  return r;
180
178
  };
181
- if (p(e)) {
182
- const [s, n] = St(t, e);
183
- if (!s && !n && 0 !== e.length) return !1;
184
- if (s || 0 === e.length) return this.ki.Gn(r.q.Hn, t, e).O;
185
- for (const t of e) if (!i(t)) return !1;
179
+ if (j(e)) {
180
+ const [r, n] = St(t, e);
181
+ if (!r && !n && 0 !== e.length) return !1;
182
+ if (r || 0 === e.length) return this.Ei.Bn(i.Ln, t, e).L;
183
+ for (const t of e) if (!s(t)) return !1;
186
184
  } else if (Nt(e)) {
187
- if (!i(e)) return !1;
188
- if (s) return this.ki.Gn(r.q.Kn, t, e).O;
185
+ if (!s(e)) return !1;
186
+ if (r) return this.Ei.Bn(i.Rn, t, e).L;
189
187
  } else {
190
188
  if (!(void 0 !== e && Ut(e))) return !1;
191
189
  if (
192
190
  (yt(e) && (e = $t(e)),
193
191
  "string" == typeof e &&
194
- !ot(
192
+ !rt(
195
193
  e,
196
194
  `set custom user attribute "${t}"`,
197
195
  "the element in the given array",
@@ -203,38 +201,38 @@ export default class User {
203
201
  }
204
202
  addToCustomAttributeArray(t, e) {
205
203
  return (
206
- !!ot(t, "add to custom user attribute array", "the given key") &&
204
+ !!rt(t, "add to custom user attribute array", "the given key") &&
207
205
  !(
208
206
  null != e &&
209
- !ot(e, "add to custom user attribute array", "the given value")
207
+ !rt(e, "add to custom user attribute array", "the given value")
210
208
  ) &&
211
- this.ki.Gn(r.q.Jn, t, e).O
209
+ this.Ei.Bn(i.On, t, e).L
212
210
  );
213
211
  }
214
212
  removeFromCustomAttributeArray(t, e) {
215
213
  return (
216
- !!ot(t, "remove from custom user attribute array", "the given key") &&
214
+ !!rt(t, "remove from custom user attribute array", "the given key") &&
217
215
  !(
218
216
  null != e &&
219
- !ot(e, "remove from custom user attribute array", "the given value")
217
+ !rt(e, "remove from custom user attribute array", "the given value")
220
218
  ) &&
221
- this.ki.Gn(r.q.Qn, t, e).O
219
+ this.Ei.Bn(i.Gn, t, e).L
222
220
  );
223
221
  }
224
222
  incrementCustomUserAttribute(t, e) {
225
- if (!ot(t, "increment custom user attribute", "the given key")) return !1;
223
+ if (!rt(t, "increment custom user attribute", "the given key")) return !1;
226
224
  null == e && (e = 1);
227
225
  const s = parseInt(e.toString());
228
226
  return isNaN(s) || s !== parseFloat(e.toString())
229
- ? (r.j.error(
227
+ ? (r.error(
230
228
  `Cannot increment custom user attribute because the given incrementValue "${e}" is not an integer.`,
231
229
  ),
232
230
  !1)
233
- : this.ki.Gn(r.q.Xn, t, s).O;
231
+ : this.Ei.Bn(i.Hn, t, s).L;
234
232
  }
235
233
  setCustomLocationAttribute(t, e, s) {
236
234
  return (
237
- !!ot(t, "set custom location attribute", "the given key") &&
235
+ !!rt(t, "set custom location attribute", "the given key") &&
238
236
  ((null !== e || null !== s) &&
239
237
  ((e = null != e ? parseFloat(e.toString()) : null),
240
238
  (s = null != s ? parseFloat(s.toString()) : null),
@@ -242,44 +240,44 @@ export default class User {
242
240
  (null != e && null == s) ||
243
241
  (null != e && (isNaN(e) || e > 90 || e < -90)) ||
244
242
  (null != s && (isNaN(s) || s > 180 || s < -180)))
245
- ? (r.j.error(
243
+ ? (r.error(
246
244
  "Received invalid values for latitude and/or longitude. Latitude and longitude are bounded by ±90 and ±180 respectively, or must both be null for removal.",
247
245
  ),
248
246
  !1)
249
- : this.ki.Zn(t, e, s).O)
247
+ : this.Ei.Kn(t, e, s).L)
250
248
  );
251
249
  }
252
250
  addToSubscriptionGroup(t) {
253
- return !H(
251
+ return !P(
254
252
  t,
255
253
  "add user to subscription group",
256
254
  "subscription group ID",
257
255
  !1,
258
256
  ) || t.length <= 0
259
- ? (r.j.error(
257
+ ? (r.error(
260
258
  "addToSubscriptionGroup requires a non-empty subscription group ID",
261
259
  ),
262
260
  !1)
263
- : this.ki.au(t, User.du.SUBSCRIBED).O;
261
+ : this.Ei.Mn(t, User.Yn.SUBSCRIBED).L;
264
262
  }
265
263
  removeFromSubscriptionGroup(t) {
266
- return !H(
264
+ return !P(
267
265
  t,
268
266
  "remove user from subscription group",
269
267
  "subscription group ID",
270
268
  !1,
271
269
  ) || t.length <= 0
272
- ? (r.j.error(
270
+ ? (r.error(
273
271
  "removeFromSubscriptionGroup requires a non-empty subscription group ID",
274
272
  ),
275
273
  !1)
276
- : this.ki.au(t, User.du.UNSUBSCRIBED).O;
274
+ : this.Ei.Mn(t, User.Yn.UNSUBSCRIBED).L;
277
275
  }
278
- _n(t, e, r, s, i) {
279
- this.wt._n(t, e, r, s, i), this.ki.pu();
276
+ Sn(t, e, r, s, n) {
277
+ this.wt.Sn(t, e, r, s, n), this.Ei.Jn();
280
278
  }
281
- Nn(t) {
282
- this.wt.Nn(t);
279
+ jn(t) {
280
+ this.wt.jn(t);
283
281
  }
284
282
  }
285
283
  (User.Genders = {
@@ -295,8 +293,8 @@ export default class User {
295
293
  SUBSCRIBED: "subscribed",
296
294
  UNSUBSCRIBED: "unsubscribed",
297
295
  }),
298
- (User.Ln = /^[0-9 .\\(\\)\\+\\-]+$/),
299
- (User.du = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
300
- (User.bu = "user_id"),
296
+ (User.$n = /^[0-9 .\\(\\)\\+\\-]+$/),
297
+ (User.Yn = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
298
+ (User.Qn = "user_id"),
301
299
  (User.lu = "custom"),
302
300
  (User.lr = 997);
@@ -1,4 +1,4 @@
1
- import r from "../../shared-lib/braze-shared-lib.js";
1
+ import { logger as r } from "../../shared-lib/index.js";
2
2
  import { ControlCard } from "../Card/index.js";
3
3
  export const FEED_ANIMATION_DURATION = 500;
4
4
  export default class x {
@@ -13,17 +13,17 @@ export default class x {
13
13
  for (const e of this.cards) e.viewed || e instanceof ControlCard || s++;
14
14
  return s;
15
15
  }
16
- ur() {
17
- r.j.error("Must be implemented in a subclass");
16
+ dr() {
17
+ r.error("Must be implemented in a subclass");
18
18
  }
19
19
  logCardImpressions(s) {
20
- r.j.error("Must be implemented in a subclass");
20
+ r.error("Must be implemented in a subclass");
21
21
  }
22
22
  logCardClick(s) {
23
- r.j.error("Must be implemented in a subclass");
23
+ r.error("Must be implemented in a subclass");
24
24
  }
25
25
  sr() {
26
- r.j.error("Must be implemented in a subclass");
26
+ r.error("Must be implemented in a subclass");
27
27
  }
28
28
  }
29
- (x.mr = 6e4), (x.Oh = 500), (x.uo = 1e4);
29
+ (x.ur = 6e4), (x.Oh = 500), (x.Co = 1e4);
@@ -1,6 +1,6 @@
1
1
  export default class y {
2
2
  constructor() {}
3
- Ss(a) {}
3
+ Rs(a) {}
4
4
  changeUser(a = !1) {}
5
5
  clearData(a = !1) {}
6
6
  }
@@ -9,6 +9,8 @@ export const BRAZE_MUST_BE_INITIALIZED_ERROR =
9
9
  "Braze must be initialized before calling methods.";
10
10
  export const CONTENT_CARDS_RATE_LIMIT_CAPACITY_DEFAULT = 5;
11
11
  export const CONTENT_CARDS_RATE_LIMIT_REFILL_RATE_DEFAULT = 90;
12
+ export const GLOBAL_RATE_LIMIT_CAPACITY_DEFAULT = 30;
13
+ export const GLOBAL_RATE_LIMIT_REFILL_RATE_DEFAULT = 30;
12
14
  export const LAST_REQUEST_TO_ENDPOINT_MS_AGO_DEFAULT = 72e5;
13
15
  export const MAX_ERROR_RETRIES_CONTENT_CARDS = 3;
14
16
  export const REQUEST_ATTEMPT_DEFAULT = 1;
@@ -1,31 +1,34 @@
1
- import r from "../../shared-lib/braze-shared-lib.js";
1
+ import { logger as r } from "../../shared-lib/index.js";
2
2
  import e from "../managers/braze-instance.js";
3
3
  import ue from "../models/braze-event.js";
4
4
  import t from "../models/request-result.js";
5
5
  const s = {
6
- N: (o, n, s) => {
7
- var i;
8
- const a = new t(),
9
- l = e.aa();
10
- if (!l)
6
+ q: (o, n, s) => {
7
+ var i, l;
8
+ const d = new t(),
9
+ m = e.zr();
10
+ if (!m)
11
11
  return (
12
- r.j.info(
12
+ r.info(
13
13
  `Not logging event with type "${o}" because the current session ID could not be found.`,
14
14
  ),
15
- a
15
+ d
16
16
  );
17
- const m = l.co();
18
- a.ve.push(
19
- new ue(
20
- s || (null === (i = e.ir()) || void 0 === i ? void 0 : i.getUserId()),
21
- o,
22
- new Date().valueOf(),
23
- m,
24
- n,
17
+ const u = m.xo();
18
+ return (
19
+ d.ge.push(
20
+ new ue(
21
+ s || (null === (i = e.er()) || void 0 === i ? void 0 : i.getUserId()),
22
+ o,
23
+ new Date().valueOf(),
24
+ u,
25
+ n,
26
+ ),
25
27
  ),
28
+ (d.L =
29
+ (null === (l = e.l()) || void 0 === l ? void 0 : l.zo(d.ge)) || !1),
30
+ d
26
31
  );
27
- const u = e.l();
28
- return u && (a.O = u.bo(a.ve)), a;
29
32
  },
30
33
  };
31
34
  export default s;