@braze/web-sdk 6.3.1 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/README.md +1 -1
  2. package/index.d.ts +38 -5
  3. package/package.json +1 -1
  4. package/shared-lib/encoding-utils.js +3 -3
  5. package/shared-lib/event-types.js +30 -30
  6. package/shared-lib/guid.js +1 -1
  7. package/shared-lib/indexed-db-adapter.js +60 -60
  8. package/shared-lib/logger.js +7 -7
  9. package/shared-lib/supported-options.js +24 -23
  10. package/src/Banner/banner-provider.js +95 -81
  11. package/src/Banner/banner.js +9 -9
  12. package/src/Banner/constants.js +4 -0
  13. package/src/Banner/display/banner-to-html.js +3 -3
  14. package/src/Banner/display/destroy-banner-html.js +3 -3
  15. package/src/Banner/display/detect-banner-impressions.js +16 -16
  16. package/src/Banner/get-all-banners.js +4 -4
  17. package/src/Banner/get-banner.js +5 -4
  18. package/src/Banner/index.js +2 -0
  19. package/src/Banner/log-banner-click.js +2 -2
  20. package/src/Banner/log-banner-impressions.js +6 -6
  21. package/src/Banner/request-banners-refresh.js +18 -20
  22. package/src/Banner/subscribe-to-banners-updates.js +5 -5
  23. package/src/Banner/ui/insert-banner.js +17 -14
  24. package/src/Card/card-manager-factory.js +6 -6
  25. package/src/Card/card-manager.js +28 -28
  26. package/src/Card/constants.js +1 -0
  27. package/src/Card/display/card-display.js +7 -7
  28. package/src/Card/log-card-dismissal.js +3 -3
  29. package/src/Card/log-content-card-click.js +3 -3
  30. package/src/Card/log-content-card-impressions.js +6 -6
  31. package/src/Card/models/captioned-image.js +3 -3
  32. package/src/Card/models/card.js +9 -9
  33. package/src/Card/models/classic-card.js +3 -3
  34. package/src/Card/models/control-card.js +3 -3
  35. package/src/Card/models/image-only.js +3 -3
  36. package/src/ContentCards/content-cards-provider-factory.js +6 -2
  37. package/src/ContentCards/content-cards-provider.js +101 -87
  38. package/src/ContentCards/content-cards.js +4 -4
  39. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  40. package/src/ContentCards/subscribe-to-content-cards-updates.js +4 -4
  41. package/src/ContentCards/ui/show-content-cards.js +5 -5
  42. package/src/Core/add-sdk-metadata.js +2 -2
  43. package/src/Core/change-user.js +1 -1
  44. package/src/Core/disable-sdk.js +5 -5
  45. package/src/Core/enable-sdk.js +3 -3
  46. package/src/Core/get-device-id.js +2 -2
  47. package/src/Core/get-user.js +1 -1
  48. package/src/Core/handle-braze-action.js +3 -3
  49. package/src/Core/is-disabled.js +1 -1
  50. package/src/Core/log-custom-event.js +7 -7
  51. package/src/Core/log-purchase.js +4 -4
  52. package/src/Core/open-session.js +6 -6
  53. package/src/Core/wipe-data.js +3 -3
  54. package/src/DUST/dust-connection-core.js +23 -0
  55. package/src/DUST/dust-provider-factory.js +22 -0
  56. package/src/DUST/dust-provider.js +520 -0
  57. package/src/DUST/dust-shared-worker-code.js +2 -0
  58. package/src/DUST/dust-shared-worker-impl.js +240 -0
  59. package/src/DUST/dust-worker-bridge.js +136 -0
  60. package/src/DUST/index.js +13 -0
  61. package/src/DUST/subscribe-to-dust.js +24 -0
  62. package/src/DUST/types.js +1 -0
  63. package/src/FeatureFlags/feature-flag-factory.js +8 -8
  64. package/src/FeatureFlags/feature-flag.js +6 -6
  65. package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
  66. package/src/FeatureFlags/feature-flags-provider.js +98 -84
  67. package/src/FeatureFlags/get-all-feature-flags.js +3 -3
  68. package/src/FeatureFlags/get-feature-flag.js +3 -3
  69. package/src/FeatureFlags/log-feature-flag-impression.js +7 -7
  70. package/src/FeatureFlags/refresh-feature-flags.js +5 -5
  71. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
  72. package/src/InAppMessage/constants.js +4 -0
  73. package/src/InAppMessage/defer-in-app-message.js +2 -2
  74. package/src/InAppMessage/display/get-animation-effect.js +1 -1
  75. package/src/InAppMessage/display/html-message-to-html.js +6 -6
  76. package/src/InAppMessage/display/in-app-message-to-html.js +34 -34
  77. package/src/InAppMessage/display/modal-utils.js +14 -14
  78. package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
  79. package/src/InAppMessage/in-app-message-factory.js +4 -4
  80. package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
  81. package/src/InAppMessage/in-app-message-manager.js +98 -98
  82. package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
  83. package/src/InAppMessage/log-in-app-message-click.js +11 -11
  84. package/src/InAppMessage/log-in-app-message-html-click.js +9 -9
  85. package/src/InAppMessage/log-in-app-message-impression.js +8 -8
  86. package/src/InAppMessage/models/control-message.js +5 -5
  87. package/src/InAppMessage/models/full-screen-message.js +21 -21
  88. package/src/InAppMessage/models/html-message.js +18 -18
  89. package/src/InAppMessage/models/in-app-message-button.js +7 -7
  90. package/src/InAppMessage/models/in-app-message.js +145 -145
  91. package/src/InAppMessage/models/modal-message.js +21 -21
  92. package/src/InAppMessage/models/slide-up-message.js +27 -27
  93. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  94. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  95. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
  96. package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +18 -0
  97. package/src/InAppMessage/ui/show-in-app-message.js +36 -36
  98. package/src/Push/is-push-blocked.js +2 -2
  99. package/src/Push/is-push-permission-granted.js +2 -2
  100. package/src/Push/is-push-supported.js +2 -2
  101. package/src/Push/push-manager-factory.js +15 -15
  102. package/src/Push/push-manager.js +97 -97
  103. package/src/Push/request-push-permission.js +1 -1
  104. package/src/Push/unregister-push.js +1 -1
  105. package/src/Push/utils/push-utils.js +17 -17
  106. package/src/User/user-manager.js +24 -24
  107. package/src/User/user.js +55 -55
  108. package/src/common/constants.js +8 -10
  109. package/src/common/content-cards-display.js +40 -40
  110. package/src/common/event-logger.js +8 -8
  111. package/src/common/properties-base.js +16 -16
  112. package/src/l10n/l10n-manager-factory.js +11 -11
  113. package/src/l10n/l10n-manager.js +2 -2
  114. package/src/managers/auth-manager.js +30 -30
  115. package/src/managers/braze-instance.js +170 -162
  116. package/src/managers/device-manager.js +24 -24
  117. package/src/managers/network-manager.js +149 -149
  118. package/src/managers/server-config-manager.js +140 -95
  119. package/src/managers/session-manager.js +39 -39
  120. package/src/managers/storage-manager-factory.js +10 -10
  121. package/src/managers/storage-manager.js +145 -141
  122. package/src/managers/subscription-manager.js +11 -11
  123. package/src/managers/utils.js +1 -1
  124. package/src/models/backend-errors.js +5 -5
  125. package/src/models/braze-event.js +11 -11
  126. package/src/models/device.js +3 -3
  127. package/src/models/identifier.js +16 -16
  128. package/src/models/push-token.js +13 -13
  129. package/src/models/request-result.js +3 -3
  130. package/src/models/server-config.js +45 -37
  131. package/src/request-controller.js +163 -158
  132. package/src/triggers/models/custom-event-data.js +5 -5
  133. package/src/triggers/models/custom-event-property-data.js +6 -6
  134. package/src/triggers/models/filter-set.js +10 -10
  135. package/src/triggers/models/filter.js +27 -27
  136. package/src/triggers/models/in-app-message-click-data.js +13 -13
  137. package/src/triggers/models/purchase-data.js +2 -2
  138. package/src/triggers/models/purchase-property-data.js +6 -6
  139. package/src/triggers/models/push-click-data.js +6 -6
  140. package/src/triggers/models/trigger-condition.js +47 -47
  141. package/src/triggers/models/trigger-events.js +3 -3
  142. package/src/triggers/models/trigger.js +36 -36
  143. package/src/triggers/triggers-provider-factory.js +5 -5
  144. package/src/triggers/triggers-provider.js +63 -63
  145. package/src/ui/js/attach-css.js +3 -3
  146. package/src/ui/js/load-font-awesome.js +2 -2
  147. package/src/util/base-device-parser.js +9 -9
  148. package/src/util/braze-actions.js +5 -5
  149. package/src/util/browser-detector.js +37 -37
  150. package/src/util/client-hints-parser.js +11 -11
  151. package/src/util/component-utils.js +5 -5
  152. package/src/util/dom-utils.js +13 -13
  153. package/src/util/html-display-utils.js +7 -7
  154. package/src/util/key-codes.js +1 -1
  155. package/src/util/net.js +5 -5
  156. package/src/util/request-header-utils.js +27 -27
  157. package/src/util/user-agent-parser.js +21 -21
  158. package/src/util/validation-utils.js +17 -17
  159. package/src/util/window-utils.js +3 -3
package/src/User/user.js CHANGED
@@ -1,27 +1,27 @@
1
1
  import {
2
- isArray as D,
2
+ isArray as R,
3
3
  isDate as Nt,
4
- isObject as It,
4
+ isObject as yt,
5
5
  validateValueIsFromEnum as ta,
6
6
  } from "../util/code-utils.js";
7
- import { logger as E, EventTypes as m } from "../../shared-lib/index.js";
7
+ import { logger as E, EventTypes as f } from "../../shared-lib/index.js";
8
8
  import {
9
- isValidEmail as Ct,
10
- validateCustomAttributeArrayType as St,
11
- validateCustomAttributeKey as Ut,
9
+ isValidEmail as It,
10
+ validateCustomAttributeArrayType as Ct,
11
+ validateCustomAttributeKey as St,
12
12
  validateCustomProperties as nt,
13
13
  validateCustomString as mt,
14
- validatePropertyType as Dt,
14
+ validatePropertyType as Ut,
15
15
  validateStandardString as ir,
16
16
  } from "../util/validation-utils.js";
17
- import { SET_CUSTOM_USER_ATTRIBUTE_STRING as Ft } from "../common/constants.js";
18
- import { toValidBackendTimeString as Lt } from "../util/date-utils.js";
17
+ import { CoreStrings as z } from "../common/constants.js";
18
+ import { toValidBackendTimeString as Dt } from "../util/date-utils.js";
19
19
  export default class User {
20
20
  constructor(t, e) {
21
- (this.Cs = t), (this.Cn = e), (this.Cs = t), (this.Cn = e);
21
+ (this.vs = t), (this.Ru = e), (this.vs = t), (this.Ru = e);
22
22
  }
23
23
  getUserId(t) {
24
- const e = this.Cs.getUserId();
24
+ const e = this.vs.getUserId();
25
25
  if ("function" != typeof t) return e;
26
26
  E.warn(
27
27
  "The callback for getUserId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getUser().getUserId()`)",
@@ -33,22 +33,22 @@ export default class User {
33
33
  ? (E.error("addAlias requires a non-empty alias"), !1)
34
34
  : !ir(e, "add alias", "the label", !1) || e.length <= 0
35
35
  ? (E.error("addAlias requires a non-empty label"), !1)
36
- : this.Cn.En(t, e).W;
36
+ : this.Ru.Gu(t, e).W;
37
37
  }
38
38
  setFirstName(t) {
39
39
  return (
40
40
  !!ir(t, "set first name", "the firstName", !0) &&
41
- this.Cs.nu("first_name", t)
41
+ this.vs.zu("first_name", t)
42
42
  );
43
43
  }
44
44
  setLastName(t) {
45
45
  return (
46
- !!ir(t, "set last name", "the lastName", !0) && this.Cs.nu("last_name", t)
46
+ !!ir(t, "set last name", "the lastName", !0) && this.vs.zu("last_name", t)
47
47
  );
48
48
  }
49
49
  setEmail(t) {
50
- return null === t || Ct(t)
51
- ? this.Cs.nu("email", t)
50
+ return null === t || It(t)
51
+ ? this.vs.zu("email", t)
52
52
  : (E.error(
53
53
  `Cannot set email address - "${t}" did not pass RFC-5322 validation.`,
54
54
  ),
@@ -65,12 +65,12 @@ export default class User {
65
65
  `Gender "${t}" is not a valid gender.`,
66
66
  "User.Genders",
67
67
  )
68
- ) && this.Cs.nu("gender", t)
68
+ ) && this.vs.zu("gender", t)
69
69
  );
70
70
  }
71
71
  setDateOfBirth(t, e, r) {
72
72
  return null === t && null === e && null === r
73
- ? this.Cs.nu("dob", null)
73
+ ? this.vs.zu("dob", null)
74
74
  : ((t = null != t ? parseInt(t.toString()) : null),
75
75
  (e = null != e ? parseInt(e.toString()) : null),
76
76
  (r = null != r ? parseInt(r.toString()) : null),
@@ -88,21 +88,21 @@ export default class User {
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
- : this.Cs.nu("dob", `${t}-${e}-${r}`));
91
+ : this.vs.zu("dob", `${t}-${e}-${r}`));
92
92
  }
93
93
  setCountry(t) {
94
94
  return (
95
- !!ir(t, "set country", "the country", !0) && this.Cs.nu("country", t)
95
+ !!ir(t, "set country", "the country", !0) && this.vs.zu("country", t)
96
96
  );
97
97
  }
98
98
  setHomeCity(t) {
99
99
  return (
100
- !!ir(t, "set home city", "the homeCity", !0) && this.Cs.nu("home_city", t)
100
+ !!ir(t, "set home city", "the homeCity", !0) && this.vs.zu("home_city", t)
101
101
  );
102
102
  }
103
103
  setLanguage(t) {
104
104
  return (
105
- !!ir(t, "set language", "the language", !0) && this.Cs.nu("language", t)
105
+ !!ir(t, "set language", "the language", !0) && this.vs.zu("language", t)
106
106
  );
107
107
  }
108
108
  setEmailNotificationSubscriptionType(t) {
@@ -112,7 +112,7 @@ export default class User {
112
112
  t,
113
113
  `Email notification setting "${t}" is not a valid subscription type.`,
114
114
  "User.NotificationSubscriptionTypes",
115
- ) && this.Cs.nu("email_subscribe", t)
115
+ ) && this.vs.zu("email_subscribe", t)
116
116
  );
117
117
  }
118
118
  setPushNotificationSubscriptionType(t) {
@@ -122,14 +122,14 @@ export default class User {
122
122
  t,
123
123
  `Push notification setting "${t}" is not a valid subscription type.`,
124
124
  "User.NotificationSubscriptionTypes",
125
- ) && this.Cs.nu("push_subscribe", t)
125
+ ) && this.vs.zu("push_subscribe", t)
126
126
  );
127
127
  }
128
128
  setPhoneNumber(t) {
129
129
  return (
130
130
  !!ir(t, "set phone number", "the phoneNumber", !0) &&
131
- (null === t || t.match(User.Fn)
132
- ? this.Cs.nu("phone", t)
131
+ (null === t || t.match(User.Hu)
132
+ ? this.vs.zu("phone", t)
133
133
  : (E.error(`Cannot set phone number - "${t}" did not pass validation.`),
134
134
  !1))
135
135
  );
@@ -164,32 +164,32 @@ export default class User {
164
164
  "Cannot set last-known location - accuracy and altitudeAccuracy may not be negative.",
165
165
  ),
166
166
  !1)
167
- : this.Cn.setLastKnownLocation(this.Cs.getUserId(), t, e, s, r, n).W);
167
+ : this.Ru.setLastKnownLocation(this.vs.getUserId(), t, e, s, r, n).W);
168
168
  }
169
169
  setCustomUserAttribute(t, e, r) {
170
- if (!Ut(t)) return !1;
170
+ if (!St(t)) return !1;
171
171
  const s = (e) => {
172
172
  const [r] = nt(
173
173
  e,
174
- Ft,
174
+ z.Ku,
175
175
  "attribute value",
176
176
  `set custom user attribute "${t}"`,
177
177
  "custom user attribute",
178
178
  );
179
179
  return r;
180
180
  };
181
- if (D(e)) {
182
- const [r, n] = St(t, e);
181
+ if (R(e)) {
182
+ const [r, n] = Ct(t, e);
183
183
  if (!r && !n && 0 !== e.length) return !1;
184
- if (r || 0 === e.length) return this.Cn.Ln(m.$n, t, e).W;
184
+ if (r || 0 === e.length) return this.Ru.Mu(f.Yu, t, e).W;
185
185
  for (const t of e) if (!s(t)) return !1;
186
- } else if (It(e)) {
186
+ } else if (yt(e)) {
187
187
  if (!s(e)) return !1;
188
- if (r) return this.Cn.Ln(m.Bn, t, e).W;
188
+ if (r) return this.Ru.Mu(f.Vu, t, e).W;
189
189
  } else {
190
- if (!(void 0 !== e && Dt(e))) return !1;
190
+ if (!(void 0 !== e && Ut(e))) return !1;
191
191
  if (
192
- (Nt(e) && (e = Lt(e)),
192
+ (Nt(e) && (e = Dt(e)),
193
193
  "string" == typeof e &&
194
194
  !mt(
195
195
  e,
@@ -199,7 +199,7 @@ export default class User {
199
199
  )
200
200
  return !1;
201
201
  }
202
- return this.Cs.setCustomUserAttribute(t, e);
202
+ return this.vs.setCustomUserAttribute(t, e);
203
203
  }
204
204
  addToCustomAttributeArray(t, e) {
205
205
  return (
@@ -208,7 +208,7 @@ export default class User {
208
208
  null != e &&
209
209
  !mt(e, "add to custom user attribute array", "the given value")
210
210
  ) &&
211
- this.Cn.Ln(m.Rn, t, e).W
211
+ this.Ru.Mu(f.Qu, t, e).W
212
212
  );
213
213
  }
214
214
  removeFromCustomAttributeArray(t, e) {
@@ -218,7 +218,7 @@ export default class User {
218
218
  null != e &&
219
219
  !mt(e, "remove from custom user attribute array", "the given value")
220
220
  ) &&
221
- this.Cn.Ln(m.On, t, e).W
221
+ this.Ru.Mu(f.Xu, t, e).W
222
222
  );
223
223
  }
224
224
  incrementCustomUserAttribute(t, e) {
@@ -230,7 +230,7 @@ export default class User {
230
230
  `Cannot increment custom user attribute because the given incrementValue "${e}" is not an integer.`,
231
231
  ),
232
232
  !1)
233
- : this.Cn.Ln(m.Gn, t, r).W;
233
+ : this.Ru.Mu(f.Zu, t, r).W;
234
234
  }
235
235
  setCustomLocationAttribute(t, e, r) {
236
236
  return (
@@ -246,7 +246,7 @@ export default class User {
246
246
  "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
247
  ),
248
248
  !1)
249
- : this.Cn.Hn(t, e, r).W)
249
+ : this.Ru.Na(t, e, r).W)
250
250
  );
251
251
  }
252
252
  addToSubscriptionGroup(t) {
@@ -260,7 +260,7 @@ export default class User {
260
260
  "addToSubscriptionGroup requires a non-empty subscription group ID",
261
261
  ),
262
262
  !1)
263
- : this.Cn.Kn(t, User.Mn.SUBSCRIBED).W;
263
+ : this.Ru.Ra(t, User.Pa.SUBSCRIBED).W;
264
264
  }
265
265
  removeFromSubscriptionGroup(t) {
266
266
  return !ir(
@@ -273,24 +273,24 @@ export default class User {
273
273
  "removeFromSubscriptionGroup requires a non-empty subscription group ID",
274
274
  ),
275
275
  !1)
276
- : this.Cn.Kn(t, User.Mn.UNSUBSCRIBED).W;
276
+ : this.Ru.Ra(t, User.Pa.UNSUBSCRIBED).W;
277
277
  }
278
278
  setLineId(t) {
279
279
  return ir(t, "set LINE user ID", "the ID", !0) &&
280
280
  0 !== (null == t ? void 0 : t.length)
281
- ? t && t.length > User.Yn
281
+ ? t && t.length > User.Oa
282
282
  ? (E.error(
283
- `Rejected LINE user ID ${t} because it is longer than ${User.Yn} characters.`,
283
+ `Rejected LINE user ID ${t} because it is longer than ${User.Oa} characters.`,
284
284
  ),
285
285
  !1)
286
- : this.Cs.nu("native_line_id", t)
286
+ : this.vs.zu("native_line_id", t)
287
287
  : (E.error("setLineId requires a non-empty ID"), !1);
288
288
  }
289
- Pn(t, e, r, s, n) {
290
- this.Cs.Pn(t, e, r, s, n), this.Cn.zn();
289
+ gu(t, e, r, s, n) {
290
+ this.vs.gu(t, e, r, s, n), this.Ru.Ya();
291
291
  }
292
- Sn(t) {
293
- this.Cs.Sn(t);
292
+ wu(t) {
293
+ this.vs.wu(t);
294
294
  }
295
295
  }
296
296
  (User.Genders = {
@@ -306,9 +306,9 @@ export default class User {
306
306
  SUBSCRIBED: "subscribed",
307
307
  UNSUBSCRIBED: "unsubscribed",
308
308
  }),
309
- (User.Fn = /^[0-9 .\\(\\)\\+\\-]+$/),
310
- (User.Mn = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
311
- (User.Jn = "user_id"),
312
- (User.lu = "custom"),
309
+ (User.Hu = /^[0-9 .\\(\\)\\+\\-]+$/),
310
+ (User.Pa = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
311
+ (User.Va = "user_id"),
312
+ (User.Bu = "custom"),
313
313
  (User.mr = 997),
314
- (User.Yn = 33);
314
+ (User.Oa = 33);
@@ -1,17 +1,15 @@
1
1
  export const MAX_PURCHASE_QUANTITY = 100;
2
- export const MUST_BE_IN_APP_MESSAGE_WARNING =
3
- "inAppMessage must be an InAppMessage object";
4
- export const MUST_BE_CARD_WARNING_SUFFIX = "must be a Card object";
5
2
  export const FEED_ANIMATION_DURATION = 500;
6
- export const LOG_CUSTOM_EVENT_STRING = "logCustomEvent";
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
3
  export const GLOBAL_RATE_LIMIT_CAPACITY_DEFAULT = 30;
11
4
  export const GLOBAL_RATE_LIMIT_REFILL_RATE_DEFAULT = 30;
12
5
  export const LAST_REQUEST_TO_ENDPOINT_MS_AGO_DEFAULT = 72e5;
13
6
  export const MAX_RETRY_COUNT_PER_REQUEST = 15;
14
7
  export const REQUEST_ATTEMPT_DEFAULT = 1;
15
- export const SUBSCRIPTION_ID_DATA_ATTRIBUTE = "data-update-subscription-id";
16
- export const BANNERS_DISABLED_MESSAGE =
17
- "Banners are disabled. Make sure you have at least one campaign and relaunch the app.";
8
+ export const REQUEST_BACKOFF_MIN_SLEEP_MS_DEFAULT = 1e4;
9
+ export const REQUEST_BACKOFF_SCALE_FACTOR_DEFAULT = 3;
10
+ export const REQUEST_BACKOFF_MAX_SLEEP_MS_DEFAULT = 3e5;
11
+ export const CoreStrings = {
12
+ ee: "Braze must be initialized before calling methods.",
13
+ $e: "logCustomEvent",
14
+ Ku: "setCustomUserAttribute",
15
+ };
@@ -2,28 +2,28 @@ import {
2
2
  getCardId as xt,
3
3
  markCardAsRead as Rt,
4
4
  } from "../Card/display/card-display.js";
5
- import { bottomIsInView as x, topIsInView as g } from "../util/dom-utils.js";
5
+ import { bottomIsInView as I, topIsInView as B } from "../util/dom-utils.js";
6
6
  import { Card, ControlCard } from "../Card/index.js";
7
- import { cardToHtml as Ht } from "../Card/display/card-display.js";
8
- import { isArray as D } from "../util/code-utils.js";
9
- import { KeyCodes as ie } from "../util/key-codes.js";
10
- import fe from "../l10n/l10n-manager-factory.js";
7
+ import { cardToHtml as Lt } from "../Card/display/card-display.js";
8
+ import { isArray as R } from "../util/code-utils.js";
9
+ import { KeyCodes as Ce } from "../util/key-codes.js";
10
+ import Me from "../l10n/l10n-manager-factory.js";
11
11
  import { removeSubscription } from "../Core/remove-subscription.js";
12
12
  import { logger as E, Guid as P } from "../../shared-lib/index.js";
13
13
  import { BRAZE_ACTION_URI_REGEX as to } from "../util/validation-utils.js";
14
14
  import {
15
- INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as vt,
16
- ineligibleBrazeActionURLErrorMessage as jt,
15
+ INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as jt,
16
+ ineligibleBrazeActionURLErrorMessage as dt,
17
17
  getDecodedBrazeAction as eo,
18
- containsUnknownBrazeAction as dt,
18
+ containsUnknownBrazeAction as gt,
19
19
  } from "../util/braze-actions.js";
20
20
  import {
21
- bottomHadImpression as kt,
22
- impressOnBottom as d,
23
- impressOnTop as j,
24
- topHadImpression as qt,
21
+ bottomHadImpression as Ft,
22
+ impressOnBottom as $,
23
+ impressOnTop as g,
24
+ topHadImpression as Ht,
25
25
  } from "./detect-impression.js";
26
- import { SUBSCRIPTION_ID_DATA_ATTRIBUTE as f } from "./constants.js";
26
+ import { BannerStrings as j } from "../Banner/constants.js";
27
27
  import ContentCards from "../ContentCards/content-cards.js";
28
28
  export const LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE =
29
29
  "data-last-requested-refresh";
@@ -34,8 +34,8 @@ export function destroyContentCardsHtml(t) {
34
34
  ((t.className = t.className.replace("ab-show", "ab-hide")),
35
35
  setTimeout(() => {
36
36
  t && t.parentNode && t.parentNode.removeChild(t);
37
- }, ContentCards.cr));
38
- const e = t.getAttribute(f);
37
+ }, ContentCards.hr));
38
+ const e = t.getAttribute(j.ea);
39
39
  null != e && removeSubscription(e);
40
40
  const n = t.getAttribute("data-listener-id");
41
41
  null != n &&
@@ -43,7 +43,7 @@ export function destroyContentCardsHtml(t) {
43
43
  delete scrollListeners[n]);
44
44
  }
45
45
  export function generateContentCardsUI(t, e) {
46
- const n = fe.ea(),
46
+ const n = Me.ra(),
47
47
  o = document.createElement("div");
48
48
  if (
49
49
  ((o.className = "ab-feed-body"),
@@ -59,11 +59,11 @@ export function generateContentCardsUI(t, e) {
59
59
  o.appendChild(t);
60
60
  } else {
61
61
  let s = !1;
62
- const r = (e) => t.nr(e);
62
+ const r = (e) => t.dr(e);
63
63
  for (const a of t.cards) {
64
64
  const i = a instanceof ControlCard;
65
- !i || t.ar()
66
- ? (o.appendChild(Ht(a, r, e, n.So())), (s = s || !i))
65
+ !i || t.cr()
66
+ ? (o.appendChild(Lt(a, r, e, n.Ta())), (s = s || !i))
67
67
  : E.error(
68
68
  "Received a control card for a legacy news feed. Control cards are only supported with content cards.",
69
69
  );
@@ -82,26 +82,26 @@ export function detectContentCardsImpressions(t, e) {
82
82
  if (null != t && null != e) {
83
83
  const n = [],
84
84
  o = e.querySelectorAll(".ab-card");
85
- t.Qn || (t.Qn = {});
85
+ t.Qa || (t.Qa = {});
86
86
  for (let e = 0; e < o.length; e++) {
87
87
  const s = xt(o[e]),
88
- r = g(o[e]),
89
- a = x(o[e]);
90
- if (t.Qn[s]) {
88
+ r = B(o[e]),
89
+ a = I(o[e]);
90
+ if (t.Qa[s]) {
91
91
  r || a || Rt(o[e]);
92
92
  continue;
93
93
  }
94
- let i = qt(o[e]),
95
- l = kt(o[e]);
96
- const c = i,
97
- f = l;
94
+ let i = Ht(o[e]),
95
+ l = Ft(o[e]);
96
+ const d = i,
97
+ c = l;
98
98
  if (
99
- (!i && r && ((i = !0), j(o[e])), !l && a && ((l = !0), d(o[e])), i && l)
99
+ (!i && r && ((i = !0), g(o[e])), !l && a && ((l = !0), $(o[e])), i && l)
100
100
  ) {
101
- if (c && f) continue;
101
+ if (d && c) continue;
102
102
  for (const e of t.cards)
103
103
  if (e.id === s) {
104
- (t.Qn[e.id] = !0), n.push(e);
104
+ (t.Qa[e.id] = !0), n.push(e);
105
105
  break;
106
106
  }
107
107
  }
@@ -124,15 +124,15 @@ export function refreshContentCardsUI(t, e) {
124
124
  const n = e.querySelectorAll(".ab-initial-spinner")[0];
125
125
  if (null != n) {
126
126
  const t = document.createElement("span");
127
- (t.innerHTML = fe.ea().get("FEED_TIMEOUT_MESSAGE") || ""),
127
+ (t.innerHTML = Me.ra().get("FEED_TIMEOUT_MESSAGE") || ""),
128
128
  null != n.parentNode &&
129
129
  (n.parentNode.appendChild(t), n.parentNode.removeChild(n));
130
130
  }
131
131
  "true" === e.getAttribute("aria-busy") &&
132
132
  e.setAttribute("aria-busy", "false");
133
133
  }
134
- }, ContentCards.Cr),
135
- t.dr();
134
+ }, ContentCards.lr),
135
+ t.ur();
136
136
  }
137
137
  export function contentCardsToHtml(t, e, n) {
138
138
  const o = document.createElement("div");
@@ -153,7 +153,7 @@ export function contentCardsToHtml(t, e, n) {
153
153
  destroyContentCardsHtml(o), t.stopPropagation();
154
154
  };
155
155
  r.addEventListener("keydown", (t) => {
156
- (t.keyCode !== ie.lo && t.keyCode !== ie.Ze) || a(t);
156
+ (t.keyCode !== Ce.Ho && t.keyCode !== Ce.Go) || a(t);
157
157
  }),
158
158
  (r.onclick = a);
159
159
  const i = document.createElement("i");
@@ -166,7 +166,7 @@ export function contentCardsToHtml(t, e, n) {
166
166
  refreshContentCardsUI(t, o), e.stopPropagation();
167
167
  };
168
168
  i.addEventListener("keydown", (t) => {
169
- (t.keyCode !== ie.lo && t.keyCode !== ie.Ze) || l(t);
169
+ (t.keyCode !== Ce.Ho && t.keyCode !== Ce.Go) || l(t);
170
170
  }),
171
171
  (i.onclick = l),
172
172
  s.appendChild(i),
@@ -175,20 +175,20 @@ export function contentCardsToHtml(t, e, n) {
175
175
  const d = () => detectContentCardsImpressions(t, o);
176
176
  if ((o.addEventListener("scroll", d), !n)) {
177
177
  window.addEventListener("scroll", d);
178
- const t = P.oe();
178
+ const t = P.se();
179
179
  (scrollListeners[t] = d), o.setAttribute("data-listener-id", t);
180
180
  }
181
181
  return o;
182
182
  }
183
183
  export function updateContentCards(t, e, n, o, s) {
184
- if (!D(e)) return;
184
+ if (!R(e)) return;
185
185
  const r = [];
186
186
  for (const t of e)
187
187
  if (t instanceof Card) {
188
188
  if (t.url && to.test(t.url)) {
189
189
  const e = eo(t.url);
190
- if (dt(e)) {
191
- E.error(jt(vt.Li, "Content Card"));
190
+ if (gt(e)) {
191
+ E.error(dt(jt.Pn, "Content Card"));
192
192
  continue;
193
193
  }
194
194
  }
@@ -207,5 +207,5 @@ export function updateContentCards(t, e, n, o, s) {
207
207
  }
208
208
  }
209
209
  export function registerContentCardsSubscriptionId(t, e) {
210
- t && e.setAttribute(f, t);
210
+ t && e.setAttribute(j.ea, t);
211
211
  }
@@ -1,9 +1,9 @@
1
1
  import { logger as E } from "../../shared-lib/index.js";
2
2
  import r from "../managers/braze-instance.js";
3
- import ue from "../models/braze-event.js";
3
+ import De from "../models/braze-event.js";
4
4
  import H from "../models/request-result.js";
5
- const c = {
6
- rt: (e, o, t) => {
5
+ const v = {
6
+ lt: (e, o, t) => {
7
7
  var n, s;
8
8
  const i = new H(),
9
9
  l = r.u();
@@ -14,10 +14,10 @@ const c = {
14
14
  ),
15
15
  i
16
16
  );
17
- const d = l.qo();
17
+ const d = l.el();
18
18
  return (
19
- i.ue.push(
20
- new ue(
19
+ i.Ee.push(
20
+ new De(
21
21
  t || (null === (n = r.ir()) || void 0 === n ? void 0 : n.getUserId()),
22
22
  e,
23
23
  new Date().valueOf(),
@@ -26,9 +26,9 @@ const c = {
26
26
  ),
27
27
  ),
28
28
  (i.W =
29
- (null === (s = r.p()) || void 0 === s ? void 0 : s.Eo(i.ue)) || !1),
29
+ (null === (s = r.p()) || void 0 === s ? void 0 : s.ol(i.Ee)) || !1),
30
30
  i
31
31
  );
32
32
  },
33
33
  };
34
- export default c;
34
+ export default v;
@@ -3,54 +3,54 @@ export class PropertiesBase {
3
3
  constructor(t) {
4
4
  (this.properties = t), (this.properties = t || {});
5
5
  }
6
- To(t, r, e) {
6
+ tp(t, r, e) {
7
7
  const o = this.properties[t];
8
- return null == o ? (this.No(t), null) : r(o) ? o.value : (this.Oo(e), null);
8
+ return null == o ? (this.rp(t), null) : r(o) ? o.value : (this.ep(e), null);
9
9
  }
10
10
  getStringProperty(t) {
11
- return this.To(t, this.Fo, "string");
11
+ return this.tp(t, this.op, "string");
12
12
  }
13
13
  getNumberProperty(t) {
14
- return this.To(t, this.Go, "number");
14
+ return this.tp(t, this.sp, "number");
15
15
  }
16
16
  getBooleanProperty(t) {
17
- return this.To(t, this.Ho, "boolean");
17
+ return this.tp(t, this.ip, "boolean");
18
18
  }
19
19
  getImageProperty(t) {
20
- return this.To(t, this.Ko, "image");
20
+ return this.tp(t, this.np, "image");
21
21
  }
22
22
  getJsonProperty(t) {
23
- return this.To(t, this.Lo, "jsonobject");
23
+ return this.tp(t, this.pp, "jsonobject");
24
24
  }
25
25
  getTimestampProperty(t) {
26
- return this.To(t, this.Qo, "datetime");
26
+ return this.tp(t, this.up, "datetime");
27
27
  }
28
- Oo(t) {
28
+ ep(t) {
29
29
  E.info(`Property is not of type ${t}.`);
30
30
  }
31
- No(t) {
31
+ rp(t) {
32
32
  E.info(`${t} not found in properties.`);
33
33
  }
34
- Fo(t) {
34
+ op(t) {
35
35
  return "string" === t.type && "string" == typeof t.value;
36
36
  }
37
- Go(t) {
37
+ sp(t) {
38
38
  return "number" === t.type && "number" == typeof t.value;
39
39
  }
40
- Ho(t) {
40
+ ip(t) {
41
41
  return "boolean" === t.type && "boolean" == typeof t.value;
42
42
  }
43
- Ko(t) {
43
+ np(t) {
44
44
  return "image" === t.type && "string" == typeof t.value;
45
45
  }
46
- Lo(t) {
46
+ pp(t) {
47
47
  return (
48
48
  "jsonobject" === t.type &&
49
49
  "object" == typeof t.value &&
50
50
  t.value.constructor == Object
51
51
  );
52
52
  }
53
- Qo(t) {
53
+ up(t) {
54
54
  return "datetime" === t.type && "number" == typeof t.value;
55
55
  }
56
56
  }
@@ -1,22 +1,22 @@
1
- import r, { OPTIONS as z } from "../managers/braze-instance.js";
1
+ import r, { OPTIONS as D } from "../managers/braze-instance.js";
2
2
  import ro from "../util/browser-detector.js";
3
- import lr from "./l10n-manager.js";
4
- const fe = {
3
+ import mr from "./l10n-manager.js";
4
+ const Me = {
5
5
  i: !1,
6
- aa: null,
7
- ea: () => {
8
- if ((fe.t(), !fe.aa)) {
6
+ na: null,
7
+ ra: () => {
8
+ if ((Me.t(), !Me.na)) {
9
9
  let e = ro.language,
10
10
  t = !1;
11
- r.ee(z.Xn) && ((e = r.ee(z.Xn)), (t = !0)), (fe.aa = new lr(e, t));
11
+ r.re(D.Wa) && ((e = r.re(D.Wa)), (t = !0)), (Me.na = new mr(e, t));
12
12
  }
13
- return fe.aa;
13
+ return Me.na;
14
14
  },
15
15
  t: () => {
16
- fe.i || (r.g(fe), (fe.i = !0));
16
+ Me.i || (r.g(Me), (Me.i = !0));
17
17
  },
18
18
  destroy: () => {
19
- (fe.aa = null), (fe.i = !1);
19
+ (Me.na = null), (Me.i = !1);
20
20
  },
21
21
  };
22
- export default fe;
22
+ export default Me;
@@ -1,6 +1,6 @@
1
1
  import { logger as E } from "../../shared-lib/index.js";
2
2
  import zt from "../common/translations.js";
3
- export default class lr {
3
+ export default class mr {
4
4
  constructor(t, e = !1) {
5
5
  if (
6
6
  ((this.language = t),
@@ -22,7 +22,7 @@ export default class lr {
22
22
  get(t) {
23
23
  return zt[this.language][t];
24
24
  }
25
- So() {
25
+ Ta() {
26
26
  switch (this.language) {
27
27
  case "ar":
28
28
  case "he":