@braze/web-sdk 6.11.0 → 6.12.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 (102) hide show
  1. package/index.d.ts +36 -5
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +4 -4
  4. package/shared-lib/indexed-db-adapter.js +51 -51
  5. package/shared-lib/logger.js +7 -7
  6. package/shared-lib/supported-options.js +9 -9
  7. package/src/DUST/dust-config-store.js +89 -0
  8. package/src/DUST/dust-connection-core.js +7 -21
  9. package/src/DUST/dust-message-dedup.js +33 -0
  10. package/src/DUST/dust-provider.js +367 -397
  11. package/src/DUST/dust-tab-identity.js +30 -0
  12. package/src/DUST/index.js +7 -9
  13. package/src/DUST/subscribe-to-dust.js +5 -5
  14. package/src/FeatureFlags/feature-flag-factory.js +4 -4
  15. package/src/FeatureFlags/feature-flag.js +5 -5
  16. package/src/FeatureFlags/feature-flags-provider-factory.js +8 -1
  17. package/src/FeatureFlags/feature-flags-provider.js +74 -74
  18. package/src/FeatureFlags/get-all-feature-flags.js +2 -2
  19. package/src/FeatureFlags/get-feature-flag.js +2 -2
  20. package/src/FeatureFlags/log-feature-flag-impression.js +3 -3
  21. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
  22. package/src/InAppMessage/defer-in-app-message.js +2 -2
  23. package/src/InAppMessage/display/get-animation-effect.js +1 -1
  24. package/src/InAppMessage/display/html-message-display-utils.js +4 -4
  25. package/src/InAppMessage/display/html-message-to-html.js +10 -10
  26. package/src/InAppMessage/display/in-app-message-to-html.js +42 -42
  27. package/src/InAppMessage/display/modal-utils.js +14 -14
  28. package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
  29. package/src/InAppMessage/in-app-message-factory.js +6 -6
  30. package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
  31. package/src/InAppMessage/in-app-message-manager.js +73 -73
  32. package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
  33. package/src/InAppMessage/log-in-app-message-click.js +2 -2
  34. package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
  35. package/src/InAppMessage/log-in-app-message-impression.js +2 -2
  36. package/src/InAppMessage/models/full-screen-message.js +9 -9
  37. package/src/InAppMessage/models/html-message.js +4 -4
  38. package/src/InAppMessage/models/in-app-message-button.js +2 -2
  39. package/src/InAppMessage/models/in-app-message.js +52 -52
  40. package/src/InAppMessage/models/modal-message.js +7 -7
  41. package/src/InAppMessage/models/slide-up-message.js +11 -11
  42. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  43. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  44. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
  45. package/src/InAppMessage/ui/show-in-app-message.js +36 -36
  46. package/src/Push/is-push-blocked.js +2 -2
  47. package/src/Push/is-push-permission-granted.js +2 -2
  48. package/src/Push/is-push-supported.js +2 -2
  49. package/src/Push/push-manager-factory.js +6 -6
  50. package/src/Push/push-manager.js +14 -14
  51. package/src/Push/unregister-push-token-on-server.js +3 -3
  52. package/src/Push/utils/push-utils.js +10 -10
  53. package/src/User/user.js +19 -19
  54. package/src/common/content-cards-display.js +21 -21
  55. package/src/common/event-logger.js +2 -2
  56. package/src/l10n/l10n-manager-factory.js +7 -7
  57. package/src/l10n/l10n-manager.js +5 -5
  58. package/src/managers/auth-manager.js +1 -1
  59. package/src/managers/braze-instance.js +41 -41
  60. package/src/managers/device-manager.js +22 -22
  61. package/src/managers/network-manager.js +108 -108
  62. package/src/managers/server-config-manager.js +83 -83
  63. package/src/managers/session-manager.js +6 -6
  64. package/src/managers/storage-manager-factory.js +4 -4
  65. package/src/managers/storage-manager.js +127 -125
  66. package/src/managers/subscription-manager.js +1 -1
  67. package/src/managers/utils.js +1 -1
  68. package/src/models/backend-errors.js +5 -5
  69. package/src/models/braze-event.js +7 -7
  70. package/src/models/device.js +3 -3
  71. package/src/models/identifier.js +3 -3
  72. package/src/models/push-token.js +3 -3
  73. package/src/models/server-config.js +31 -31
  74. package/src/request-controller.js +39 -39
  75. package/src/triggers/models/filter.js +58 -58
  76. package/src/triggers/models/in-app-message-click-data.js +4 -4
  77. package/src/triggers/models/push-click-data.js +2 -2
  78. package/src/triggers/models/trigger-condition.js +35 -35
  79. package/src/triggers/models/trigger.js +37 -37
  80. package/src/triggers/triggers-provider-factory.js +3 -3
  81. package/src/triggers/triggers-provider.js +50 -50
  82. package/src/types.js +2 -2
  83. package/src/ui/js/attach-css.js +1 -1
  84. package/src/ui/js/feed-css.js +2 -2
  85. package/src/ui/js/iam-css.js +2 -2
  86. package/src/util/base-device-parser.js +2 -2
  87. package/src/util/braze-actions.js +2 -2
  88. package/src/util/browser-detector.js +15 -15
  89. package/src/util/client-hints-parser.js +5 -5
  90. package/src/util/component-utils.js +4 -4
  91. package/src/util/dom-utils.js +5 -5
  92. package/src/util/ecommerce-event-validation.js +77 -48
  93. package/src/util/key-codes.js +1 -1
  94. package/src/util/net.js +4 -4
  95. package/src/util/request-header-utils.js +20 -20
  96. package/src/util/string-utils.js +5 -0
  97. package/src/util/user-agent-parser.js +18 -18
  98. package/src/util/validation-utils.js +4 -4
  99. package/src/util/window-utils.js +2 -2
  100. package/src/DUST/dust-shared-worker-code.js +0 -2
  101. package/src/DUST/dust-shared-worker-impl.js +0 -234
  102. package/src/DUST/dust-worker-bridge.js +0 -151
@@ -3,27 +3,27 @@ import ControlMessage from "../models/control-message.js";
3
3
  import HtmlMessage from "../models/html-message.js";
4
4
  import InAppMessage from "../models/in-app-message.js";
5
5
  import SlideUpMessage from "../models/slide-up-message.js";
6
- import be from "../display/get-animation-effect.js";
7
- import Fe from "../display/in-app-message-to-html.js";
6
+ import me from "../display/get-animation-effect.js";
7
+ import ge from "../display/in-app-message-to-html.js";
8
8
  import { logInAppMessageImpression } from "../log-in-app-message-impression.js";
9
9
  import {
10
- ORIENTATION as Ue,
10
+ ORIENTATION as je,
11
11
  WindowUtils as no,
12
12
  } from "../../util/window-utils.js";
13
13
  import { isURIJavascriptOrData as tt } from "../../util/url-utils.js";
14
- import { KeyCodes as Ce } from "../../util/key-codes.js";
14
+ import { KeyCodes as le } from "../../util/key-codes.js";
15
15
  import { setupInAppMessageUI as rs } from "../../ui/js/index.js";
16
16
  import { logger as b } from "../../../shared-lib/index.js";
17
- import { toRgba as ke } from "../../util/color-utils.js";
18
- import { isIFrame as St } from "../utils/in-app-message-utils.js";
19
- import Je from "../../l10n/l10n-manager-factory.js";
17
+ import { toRgba as ae } from "../../util/color-utils.js";
18
+ import { isIFrame as xt } from "../utils/in-app-message-utils.js";
19
+ import he from "../../l10n/l10n-manager-factory.js";
20
20
  import {
21
- IamTiming as At,
22
- IamClickAction as Le,
21
+ IamTiming as kt,
22
+ IamClickAction as ce,
23
23
  IamDismissType as pr,
24
- IamOrientation as Ae,
25
- IamSlideFrom as De,
26
- IAM_SHOWING_CLASS as Se,
24
+ IamOrientation as be,
25
+ IamSlideFrom as fe,
26
+ IAM_SHOWING_CLASS as we,
27
27
  } from "../constants.js";
28
28
  export function showInAppMessage(e, t, s) {
29
29
  if (!r.rr()) return;
@@ -48,7 +48,7 @@ export function showInAppMessage(e, t, s) {
48
48
  !1
49
49
  );
50
50
  if ((null == t && (t = document.body), e.zo())) {
51
- if (t.querySelectorAll(`.ab-modal-interactions, .${Se}`).length > 0)
51
+ if (t.querySelectorAll(`.ab-modal-interactions, .${we}`).length > 0)
52
52
  return (
53
53
  b.info(
54
54
  `Cannot show in-app message ${e.message} because another message is being shown.`,
@@ -56,14 +56,14 @@ export function showInAppMessage(e, t, s) {
56
56
  !1
57
57
  );
58
58
  }
59
- if (no.ba()) {
60
- const t = no.wa();
59
+ if (no.pa()) {
60
+ const t = no.fa();
61
61
  if (
62
- (t === Ue.PORTRAIT && e.orientation === Ae.LANDSCAPE) ||
63
- (t === Ue.LANDSCAPE && e.orientation === Ae.PORTRAIT)
62
+ (t === je.PORTRAIT && e.orientation === be.LANDSCAPE) ||
63
+ (t === je.LANDSCAPE && e.orientation === be.PORTRAIT)
64
64
  ) {
65
- const s = t === Ue.PORTRAIT ? "portrait" : "landscape",
66
- o = e.orientation === Ae.PORTRAIT ? "portrait" : "landscape";
65
+ const s = t === je.PORTRAIT ? "portrait" : "landscape",
66
+ o = e.orientation === be.PORTRAIT ? "portrait" : "landscape";
67
67
  return (
68
68
  b.info(
69
69
  `Not showing ${o} in-app message ${e.message} because the screen is currently ${s}`,
@@ -77,11 +77,11 @@ export function showInAppMessage(e, t, s) {
77
77
  if (e.buttons && e.buttons.length > 0) {
78
78
  const s = e.buttons;
79
79
  for (let e = 0; e < s.length; e++)
80
- if (s[e].clickAction === Le.URI) {
80
+ if (s[e].clickAction === ce.URI) {
81
81
  const o = s[e].uri;
82
82
  t = tt(o);
83
83
  }
84
- } else e.clickAction === Le.URI && (t = tt(e.uri));
84
+ } else e.clickAction === ce.URI && (t = tt(e.uri));
85
85
  if (t)
86
86
  return (
87
87
  b.error(
@@ -93,36 +93,36 @@ export function showInAppMessage(e, t, s) {
93
93
  const i = document.createElement("div");
94
94
  if (
95
95
  ((i.className = "ab-iam-root v3"),
96
- e.zo() && (i.className += ` ${Se}`),
97
- (i.className += be(e)),
96
+ e.zo() && (i.className += ` ${we}`),
97
+ (i.className += me(e)),
98
98
  e.language && !o && (i.lang = e.language),
99
- e.Bo() && (i.id = e.htmlId),
100
- r.er(U.va) && (i.style.zIndex = (r.er(U.va) + 1).toString()),
99
+ e.ko() && (i.id = e.htmlId),
100
+ r.er(U.ca) && (i.style.zIndex = (r.er(U.ca) + 1).toString()),
101
101
  t.appendChild(i),
102
102
  e.Mo())
103
103
  ) {
104
104
  const t = document.createElement("style");
105
105
  (t.innerHTML = e.css),
106
- (t.id = e.Oo()),
106
+ (t.id = e.Co()),
107
107
  null != r.er(U.sr) && t.setAttribute("nonce", r.er(U.sr)),
108
108
  document.getElementsByTagName("head")[0].appendChild(t);
109
109
  }
110
110
  const n = e instanceof SlideUpMessage,
111
- a = Fe(
111
+ a = ge(
112
112
  e,
113
113
  (t) => {
114
114
  if (e.zo() && e.od()) {
115
115
  const s = document.createElement("div");
116
116
  if (
117
117
  ((s.className = "ab-page-blocker"),
118
- e.Mo() || (s.style.backgroundColor = ke(e.frameColor)),
119
- r.er(U.va) && (s.style.zIndex = r.er(U.va).toString()),
118
+ e.Mo() || (s.style.backgroundColor = ae(e.frameColor)),
119
+ r.er(U.ca) && (s.style.zIndex = r.er(U.ca).toString()),
120
120
  i.appendChild(s),
121
121
  !r.er(U.lh))
122
122
  ) {
123
123
  const o = new Date().valueOf();
124
124
  s.onclick = (s) => {
125
- new Date().valueOf() - o > At.sE &&
125
+ new Date().valueOf() - o > kt.sE &&
126
126
  (e.tl(t), s.stopPropagation());
127
127
  };
128
128
  }
@@ -135,7 +135,7 @@ export function showInAppMessage(e, t, s) {
135
135
  o = s[e];
136
136
  break;
137
137
  }
138
- if (e.slideFrom === De.TOP) {
138
+ if (e.slideFrom === fe.TOP) {
139
139
  let e = 0;
140
140
  null != o && (e = o.offsetTop + o.offsetHeight),
141
141
  (t.style.top = Math.max(e, 0) + "px");
@@ -149,10 +149,10 @@ export function showInAppMessage(e, t, s) {
149
149
  }
150
150
  } else if (o && !r.er(U.lh)) {
151
151
  const s = e;
152
- St(t) &&
152
+ xt(t) &&
153
153
  t.contentWindow &&
154
154
  t.contentWindow.addEventListener("keydown", function (e) {
155
- e.keyCode === Ce.oh && s.closeMessage();
155
+ e.keyCode === le.oh && s.closeMessage();
156
156
  });
157
157
  }
158
158
  logInAppMessageImpression(e),
@@ -165,11 +165,11 @@ export function showInAppMessage(e, t, s) {
165
165
  (e) => {
166
166
  b.info(e), i.parentNode && i.parentNode.removeChild(i);
167
167
  },
168
- r.er(U.ya),
169
- r.er(U.va),
168
+ r.er(U.da),
169
+ r.er(U.ca),
170
170
  r.er(U.sr),
171
171
  t,
172
- Je.ra().za(),
172
+ he.ra().ga(),
173
173
  );
174
174
  return (o || n) && (i.appendChild(a), e.nh(i)), !0;
175
175
  }
@@ -1,5 +1,5 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import It from "./utils/push-utils.js";
2
+ import Dt from "./utils/push-utils.js";
3
3
  export function isPushBlocked() {
4
- if (r.rr()) return It.isPushBlocked();
4
+ if (r.rr()) return Dt.isPushBlocked();
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import It from "./utils/push-utils.js";
2
+ import Dt from "./utils/push-utils.js";
3
3
  export function isPushPermissionGranted() {
4
- if (r.rr()) return It.isPushPermissionGranted();
4
+ if (r.rr()) return Dt.isPushPermissionGranted();
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import It from "./utils/push-utils.js";
2
+ import Dt from "./utils/push-utils.js";
3
3
  export function isPushSupported() {
4
- if (r.rr()) return It.isPushSupported();
4
+ if (r.rr()) return Dt.isPushSupported();
5
5
  }
@@ -8,15 +8,15 @@ const ra = {
8
8
  ra.na ||
9
9
  (ra.na = new na(
10
10
  r.zr(),
11
- r.xa(),
11
+ r.ja(),
12
12
  r.ue(),
13
13
  r.ht(),
14
- r.er(U.Ma),
15
- r.er(U._a),
16
- r.er(U.ka),
14
+ r.er(U.za),
15
+ r.er(U.ba),
16
+ r.er(U.ha),
17
17
  r.l(),
18
- r.er(U.qa),
19
- r.er(U.Aa),
18
+ r.er(U.wa),
19
+ r.er(U.xa),
20
20
  r.p(),
21
21
  )),
22
22
  ra.na
@@ -3,8 +3,8 @@ import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
3
3
  import ui from "../models/push-token.js";
4
4
  import { User } from "../User/index.js";
5
5
  import { isArray as g, isEqual as hi } from "../util/code-utils.js";
6
- import { getErrorMessage as ai } from "../util/error-utils.js";
7
- import It from "./utils/push-utils.js";
6
+ import { getErrorMessage as ci } from "../util/error-utils.js";
7
+ import Dt from "./utils/push-utils.js";
8
8
  export default class na {
9
9
  constructor(i, e, t, s, r, o, n, u, h, a, c) {
10
10
  (this.iu = i),
@@ -27,8 +27,8 @@ export default class na {
27
27
  (this.nu = h || !1),
28
28
  (this.uu = a || !1),
29
29
  (this.j = c),
30
- (this.au = It.cu()),
31
- (this.fu = It.du());
30
+ (this.au = Dt.cu()),
31
+ (this.fu = Dt.du());
32
32
  }
33
33
  lu() {
34
34
  return this.uu;
@@ -71,7 +71,7 @@ export default class na {
71
71
  (o = btoa(String.fromCharCode.apply(null, i))),
72
72
  (n = btoa(String.fromCharCode.apply(null, e)));
73
73
  } catch (i) {
74
- b.error(ai(i));
74
+ b.error(ci(i));
75
75
  }
76
76
  const h = ((i) => {
77
77
  let e;
@@ -169,7 +169,7 @@ export default class na {
169
169
  this.mu(i, new Date(), t);
170
170
  })
171
171
  .catch((i) => {
172
- It.isPushBlocked()
172
+ Dt.isPushBlocked()
173
173
  ? (b.info("Permission for push notifications was denied."),
174
174
  "function" == typeof s && s(!1))
175
175
  : (b.error("Push subscription failed: " + i),
@@ -197,7 +197,7 @@ export default class na {
197
197
  (i.unregister(), b.info("Service worker successfully unregistered."));
198
198
  }
199
199
  subscribe(i, e) {
200
- if (!It.isPushSupported())
200
+ if (!Dt.isPushSupported())
201
201
  return b.info(na.Au), void ("function" == typeof e && e(!1));
202
202
  if (this.au) {
203
203
  if (!this.nu && null != window.location) {
@@ -207,7 +207,7 @@ export default class na {
207
207
  -1 === i.indexOf(window.location.protocol) &&
208
208
  (i = window.location.protocol + "//" + i);
209
209
  }
210
- if (It.isPushBlocked())
210
+ if (Dt.isPushBlocked())
211
211
  return void this.Pu(
212
212
  "Notifications from this site are blocked. This may be a temporary embargo or a permanent denial.",
213
213
  e,
@@ -227,13 +227,13 @@ export default class na {
227
227
  },
228
228
  s = () => {
229
229
  let i = "Permission for push notifications was ignored.";
230
- It.isPushBlocked() &&
230
+ Dt.isPushBlocked() &&
231
231
  (i +=
232
232
  " The browser has automatically blocked further permission requests for a period (probably 1 week)."),
233
233
  b.info(i),
234
234
  "function" == typeof e && e(!0);
235
235
  },
236
- r = It.isPushPermissionGranted(),
236
+ r = Dt.isPushPermissionGranted(),
237
237
  o = () => {
238
238
  !r &&
239
239
  this.iu &&
@@ -256,10 +256,10 @@ export default class na {
256
256
  }
257
257
  }
258
258
  registerPush(i, e) {
259
- if (!It.isPushSupported())
259
+ if (!Dt.isPushSupported())
260
260
  return b.info(na.Au), void ("function" == typeof e && e(!1));
261
261
  if (this.au) {
262
- if (It.isPushBlocked())
262
+ if (Dt.isPushBlocked())
263
263
  return void this.Pu(
264
264
  "Notifications from this site are blocked. This may be a temporary embargo or a permanent denial.",
265
265
  e,
@@ -273,7 +273,7 @@ export default class na {
273
273
  this.registerPush(i, e);
274
274
  })
275
275
  );
276
- if (!It.isPushPermissionGranted())
276
+ if (!Dt.isPushPermissionGranted())
277
277
  return void b.info(
278
278
  "Push permission has not been granted, so registerPush is a no-op. Call requestPushPermission to prompt the user for permission.",
279
279
  );
@@ -382,7 +382,7 @@ export default class na {
382
382
  });
383
383
  }
384
384
  unsubscribe(i, e) {
385
- if (!It.isPushSupported())
385
+ if (!Dt.isPushSupported())
386
386
  return b.info(na.Au), void ("function" == typeof i && i());
387
387
  this.au
388
388
  ? navigator.serviceWorker.getRegistration(this.su).then((t) => {
@@ -14,12 +14,12 @@ export function unregisterPushTokenOnServer() {
14
14
  if (!o.endpoint) return;
15
15
  const i = e.Z({}, !0);
16
16
  i.push_token = o.endpoint;
17
- const a = e.tt(i, h.it.Ra);
17
+ const a = e.tt(i, h.it.ka);
18
18
  e.et(
19
19
  i,
20
20
  (n = -1) => {
21
21
  r.rr() &&
22
- (h.nt(t, h.it.Ra, new Date().valueOf()),
22
+ (h.nt(t, h.it.ka, new Date().valueOf()),
23
23
  -1 !== n && a.push(["X-Braze-Req-Tokens-Remaining", n.toString()]),
24
24
  l.ot({
25
25
  url: `${e.ht()}/push/unregister`,
@@ -30,6 +30,6 @@ export function unregisterPushTokenOnServer() {
30
30
  },
31
31
  }));
32
32
  },
33
- h.it.Ra,
33
+ h.it.ka,
34
34
  );
35
35
  }
@@ -1,4 +1,4 @@
1
- const It = {
1
+ const Dt = {
2
2
  cu: () =>
3
3
  "serviceWorker" in navigator &&
4
4
  "undefined" != typeof ServiceWorkerRegistration &&
@@ -9,38 +9,38 @@ const It = {
9
9
  "pushNotification" in window.safari &&
10
10
  "function" == typeof window.safari.pushNotification.permission &&
11
11
  "function" == typeof window.safari.pushNotification.requestPermission,
12
- isPushSupported: () => It.cu() || It.du(),
12
+ isPushSupported: () => Dt.cu() || Dt.du(),
13
13
  isPushBlocked: () => {
14
14
  const o =
15
- It.isPushSupported() &&
15
+ Dt.isPushSupported() &&
16
16
  "Notification" in window &&
17
17
  null != window.Notification &&
18
18
  null != window.Notification.permission &&
19
19
  "denied" === window.Notification.permission,
20
20
  i =
21
- It.isPushSupported() &&
21
+ Dt.isPushSupported() &&
22
22
  (!("Notification" in window) || null == window.Notification);
23
23
  return o || i;
24
24
  },
25
25
  isPushPermissionGranted: () =>
26
- It.isPushSupported() &&
26
+ Dt.isPushSupported() &&
27
27
  "Notification" in window &&
28
28
  null != window.Notification &&
29
29
  null != window.Notification.permission &&
30
30
  "granted" === window.Notification.permission,
31
31
  Yn: () =>
32
- It.isPushBlocked()
32
+ Dt.isPushBlocked()
33
33
  ? { Zn: !1, reason: "blocked" }
34
- : It.isPushSupported()
35
- ? It.isPushPermissionGranted()
34
+ : Dt.isPushSupported()
35
+ ? Dt.isPushPermissionGranted()
36
36
  ? { Zn: !1, reason: "permissionGranted" }
37
37
  : { Zn: !0 }
38
38
  : { Zn: !1, reason: "unsupported" },
39
- _o: (o, i) =>
39
+ So: (o, i) =>
40
40
  "blocked" === o
41
41
  ? `${i} containing a push prompt is not being shown because the user has already declined push permission prompt.`
42
42
  : "unsupported" === o
43
43
  ? `${i} containing a push prompt is not being shown because the browser doesn't support push notifications.`
44
44
  : `${i} containing a push prompt is not being shown because the user has already accepted the permission prompt.`,
45
45
  };
46
- export default It;
46
+ export default Dt;
package/src/User/user.js CHANGED
@@ -6,16 +6,16 @@ import {
6
6
  } from "../util/code-utils.js";
7
7
  import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
8
8
  import {
9
- isValidEmail as Et,
10
- validateCustomAttributeArrayType as Dt,
11
- validateCustomAttributeKey as Ft,
9
+ isValidEmail as Ft,
10
+ validateCustomAttributeArrayType as Lt,
11
+ validateCustomAttributeKey as $t,
12
12
  validateCustomProperties as nt,
13
13
  validateCustomString as mt,
14
- validatePropertyType as Lt,
14
+ validatePropertyType as Bt,
15
15
  validateStandardString as tr,
16
16
  } from "../util/validation-utils.js";
17
17
  import { CoreStrings as R } from "../common/constants.js";
18
- import { toValidBackendTimeString as $t } from "../util/date-utils.js";
18
+ import { toValidBackendTimeString as Rt } from "../util/date-utils.js";
19
19
  export default class User {
20
20
  constructor(t, e) {
21
21
  (this.Ss = t), (this.Ru = e), (this.Ss = t), (this.Ru = e);
@@ -47,7 +47,7 @@ export default class User {
47
47
  );
48
48
  }
49
49
  setEmail(t) {
50
- return null === t || Et(t)
50
+ return null === t || Ft(t)
51
51
  ? this.Ss.Bu("email", t)
52
52
  : (b.error(
53
53
  `Cannot set email address - "${t}" did not pass RFC-5322 validation.`,
@@ -168,7 +168,7 @@ export default class User {
168
168
  .lt);
169
169
  }
170
170
  setCustomUserAttribute(t, e, r) {
171
- if (!Ft(t)) return !1;
171
+ if (!$t(t)) return !1;
172
172
  const s = (e) => {
173
173
  const [r] = nt(
174
174
  e,
@@ -180,7 +180,7 @@ export default class User {
180
180
  return r;
181
181
  };
182
182
  if (g(e)) {
183
- const [r, n] = Dt(t, e);
183
+ const [r, n] = Lt(t, e);
184
184
  if (!r && !n && 0 !== e.length) return !1;
185
185
  if (r || 0 === e.length) return this.Ru.Yu(p.Vu, t, e).lt;
186
186
  for (const t of e) if (!s(t)) return !1;
@@ -188,9 +188,9 @@ export default class User {
188
188
  if (!s(e)) return !1;
189
189
  if (r) return this.Ru.Yu(p.Qu, t, e).lt;
190
190
  } else {
191
- if (!(void 0 !== e && Lt(e))) return !1;
191
+ if (!(void 0 !== e && Bt(e))) return !1;
192
192
  if (
193
- (Nt(e) && (e = $t(e)),
193
+ (Nt(e) && (e = Rt(e)),
194
194
  "string" == typeof e &&
195
195
  !mt(
196
196
  e,
@@ -247,7 +247,7 @@ export default class User {
247
247
  "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.",
248
248
  ),
249
249
  !1)
250
- : this.Ru.Ia(t, e, r).lt)
250
+ : this.Ru.ya(t, e, r).lt)
251
251
  );
252
252
  }
253
253
  addToSubscriptionGroup(t) {
@@ -261,7 +261,7 @@ export default class User {
261
261
  "addToSubscriptionGroup requires a non-empty subscription group ID",
262
262
  ),
263
263
  !1)
264
- : this.Ru.Ca(t, User.Ea.SUBSCRIBED).lt;
264
+ : this.Ru.va(t, User.Ia.SUBSCRIBED).lt;
265
265
  }
266
266
  removeFromSubscriptionGroup(t) {
267
267
  return !tr(
@@ -274,21 +274,21 @@ export default class User {
274
274
  "removeFromSubscriptionGroup requires a non-empty subscription group ID",
275
275
  ),
276
276
  !1)
277
- : this.Ru.Ca(t, User.Ea.UNSUBSCRIBED).lt;
277
+ : this.Ru.va(t, User.Ia.UNSUBSCRIBED).lt;
278
278
  }
279
279
  setLineId(t) {
280
280
  return tr(t, "set LINE user ID", "the ID", !0) &&
281
281
  0 !== (null == t ? void 0 : t.length)
282
- ? t && t.length > User.Sa
282
+ ? t && t.length > User.Ca
283
283
  ? (b.error(
284
- `Rejected LINE user ID ${t} because it is longer than ${User.Sa} characters.`,
284
+ `Rejected LINE user ID ${t} because it is longer than ${User.Ca} characters.`,
285
285
  ),
286
286
  !1)
287
287
  : this.Ss.Bu("native_line_id", t)
288
288
  : (b.error("setLineId requires a non-empty ID"), !1);
289
289
  }
290
290
  yu(t, e, r, s, n) {
291
- this.Ss.yu(t, e, r, s, n), this.Ru.Ua();
291
+ this.Ss.yu(t, e, r, s, n), this.Ru.Ea();
292
292
  }
293
293
  wu(t) {
294
294
  this.Ss.wu(t);
@@ -308,8 +308,8 @@ export default class User {
308
308
  UNSUBSCRIBED: "unsubscribed",
309
309
  }),
310
310
  (User.Ku = /^[0-9 .\\(\\)\\+\\-]+$/),
311
- (User.Ea = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
312
- (User.Da = "user_id"),
311
+ (User.Ia = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
312
+ (User.Sa = "user_id"),
313
313
  (User.Eu = "custom"),
314
314
  (User.br = 997),
315
- (User.Sa = 33);
315
+ (User.Ca = 33);
@@ -1,27 +1,27 @@
1
1
  import {
2
- getCardId as Rt,
3
- markCardAsRead as Ht,
2
+ getCardId as qt,
3
+ markCardAsRead as Ot,
4
4
  } from "../Card/display/card-display.js";
5
5
  import { bottomIsInView as q, topIsInView as k } from "../util/dom-utils.js";
6
6
  import { Card, ControlCard } from "../Card/index.js";
7
- import { cardToHtml as qt } from "../Card/display/card-display.js";
7
+ import { cardToHtml as Gt } from "../Card/display/card-display.js";
8
8
  import { isArray as g } from "../util/code-utils.js";
9
- import { KeyCodes as Ce } from "../util/key-codes.js";
10
- import Je from "../l10n/l10n-manager-factory.js";
9
+ import { KeyCodes as le } from "../util/key-codes.js";
10
+ import he from "../l10n/l10n-manager-factory.js";
11
11
  import { removeSubscription } from "../Core/remove-subscription.js";
12
12
  import { logger as b, Guid as V } 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 bt,
16
- ineligibleBrazeActionURLErrorMessage as vt,
15
+ INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as Tt,
16
+ ineligibleBrazeActionURLErrorMessage as Mt,
17
17
  getDecodedBrazeAction as eo,
18
- containsUnknownBrazeAction as yt,
18
+ containsUnknownBrazeAction as At,
19
19
  } from "../util/braze-actions.js";
20
20
  import {
21
- bottomHadImpression as Ot,
21
+ bottomHadImpression as Qt,
22
22
  impressOnBottom as $,
23
23
  impressOnTop as B,
24
- topHadImpression as Bt,
24
+ topHadImpression as Kt,
25
25
  } from "./detect-impression.js";
26
26
  import { BannerStrings as x } from "../Banner/constants.js";
27
27
  import ContentCards from "../ContentCards/content-cards.js";
@@ -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 = Je.ra(),
46
+ const n = he.ra(),
47
47
  o = document.createElement("div");
48
48
  if (
49
49
  ((o.className = "ab-feed-body"),
@@ -63,7 +63,7 @@ export function generateContentCardsUI(t, e) {
63
63
  for (const a of t.cards) {
64
64
  const i = a instanceof ControlCard;
65
65
  !i || t.hr()
66
- ? (o.appendChild(qt(a, r, e, n.za())), (s = s || !i))
66
+ ? (o.appendChild(Gt(a, r, e, n.ga())), (s = s || !i))
67
67
  : b.error(
68
68
  "Received a control card for a legacy news feed. Control cards are only supported with content cards.",
69
69
  );
@@ -84,15 +84,15 @@ export function detectContentCardsImpressions(t, e) {
84
84
  o = e.querySelectorAll(".ab-card");
85
85
  t.Ta || (t.Ta = {});
86
86
  for (let e = 0; e < o.length; e++) {
87
- const s = Rt(o[e]),
87
+ const s = qt(o[e]),
88
88
  r = k(o[e]),
89
89
  a = q(o[e]);
90
90
  if (t.Ta[s]) {
91
- r || a || Ht(o[e]);
91
+ r || a || Ot(o[e]);
92
92
  continue;
93
93
  }
94
- let i = Bt(o[e]),
95
- l = Ot(o[e]);
94
+ let i = Kt(o[e]),
95
+ l = Qt(o[e]);
96
96
  const d = i,
97
97
  c = l;
98
98
  if (
@@ -124,7 +124,7 @@ 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 = Je.ra().get("FEED_TIMEOUT_MESSAGE") || ""),
127
+ (t.innerHTML = he.ra().get("FEED_TIMEOUT_MESSAGE") || ""),
128
128
  null != n.parentNode &&
129
129
  (n.parentNode.appendChild(t), n.parentNode.removeChild(n));
130
130
  }
@@ -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 !== Ce.Ao && t.keyCode !== Ce.Lo) || a(t);
156
+ (t.keyCode !== le.To && t.keyCode !== le.Lo) || 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 !== Ce.Ao && t.keyCode !== Ce.Lo) || l(t);
169
+ (t.keyCode !== le.To && t.keyCode !== le.Lo) || l(t);
170
170
  }),
171
171
  (i.onclick = l),
172
172
  s.appendChild(i),
@@ -187,8 +187,8 @@ export function updateContentCards(t, e, n, o, s) {
187
187
  if (t instanceof Card) {
188
188
  if (t.url && to.test(t.url)) {
189
189
  const e = eo(t.url);
190
- if (yt(e)) {
191
- b.error(vt(bt.Wn, "Content Card"));
190
+ if (At(e)) {
191
+ b.error(Mt(Tt.Wn, "Content Card"));
192
192
  continue;
193
193
  }
194
194
  }
@@ -1,6 +1,6 @@
1
1
  import { logger as b } from "../../shared-lib/index.js";
2
2
  import r from "../managers/braze-instance.js";
3
- import Ie from "../models/braze-event.js";
3
+ import ve from "../models/braze-event.js";
4
4
  import L from "../models/request-result.js";
5
5
  const v = {
6
6
  Dt: (e, o, t) => {
@@ -17,7 +17,7 @@ const v = {
17
17
  const d = l.el();
18
18
  return (
19
19
  i.Ce.push(
20
- new Ie(
20
+ new ve(
21
21
  t || (null === (n = r.ir()) || void 0 === n ? void 0 : n.getUserId()),
22
22
  e,
23
23
  new Date().valueOf(),
@@ -1,22 +1,22 @@
1
1
  import r, { OPTIONS as U } from "../managers/braze-instance.js";
2
2
  import ro from "../util/browser-detector.js";
3
3
  import jr from "./l10n-manager.js";
4
- const Je = {
4
+ const he = {
5
5
  i: !1,
6
6
  na: null,
7
7
  ra: () => {
8
- if ((Je.t(), !Je.na)) {
8
+ if ((he.t(), !he.na)) {
9
9
  let e = ro.language,
10
10
  t = !1;
11
- r.er(U.Ba) && ((e = r.er(U.Ba)), (t = !0)), (Je.na = new jr(e, t));
11
+ r.er(U.Ma) && ((e = r.er(U.Ma)), (t = !0)), (he.na = new jr(e, t));
12
12
  }
13
- return Je.na;
13
+ return he.na;
14
14
  },
15
15
  t: () => {
16
- Je.i || (r.g(Je), (Je.i = !0));
16
+ he.i || (r.g(he), (he.i = !0));
17
17
  },
18
18
  destroy: () => {
19
- (Je.na = null), (Je.i = !1);
19
+ (he.na = null), (he.i = !1);
20
20
  },
21
21
  };
22
- export default Je;
22
+ export default he;