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