@braze/web-sdk 5.6.1 → 5.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 (137) hide show
  1. package/README.md +1 -1
  2. package/index.d.ts +15 -5
  3. package/package.json +1 -1
  4. package/shared-lib/encoding-utils.js +1 -1
  5. package/shared-lib/event-types.js +23 -23
  6. package/shared-lib/indexed-db-adapter.js +20 -20
  7. package/shared-lib/logger.js +2 -2
  8. package/shared-lib/supported-options.js +17 -17
  9. package/src/Banner/banner-provider.js +53 -50
  10. package/src/Banner/banner.js +1 -1
  11. package/src/Banner/get-all-banners.js +3 -4
  12. package/src/Banner/get-banner.js +11 -11
  13. package/src/Banner/log-banner-click.js +1 -1
  14. package/src/Banner/log-banner-impressions.js +4 -4
  15. package/src/Banner/request-banners-refresh.js +21 -13
  16. package/src/Banner/subscribe-to-banners-updates.js +14 -13
  17. package/src/Banner/ui/insert-banner.js +11 -9
  18. package/src/Card/card-manager.js +10 -10
  19. package/src/Card/log-card-impressions.js +2 -2
  20. package/src/Card/models/captioned-image.js +1 -1
  21. package/src/Card/models/card.js +3 -3
  22. package/src/Card/models/classic-card.js +1 -1
  23. package/src/Card/models/control-card.js +1 -1
  24. package/src/Card/models/image-only.js +1 -1
  25. package/src/ContentCards/content-cards-provider-factory.js +1 -1
  26. package/src/ContentCards/content-cards-provider.js +139 -180
  27. package/src/ContentCards/content-cards.js +3 -3
  28. package/src/ContentCards/get-cached-content-cards.js +1 -1
  29. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  30. package/src/ContentCards/subscribe-to-content-cards-updates.js +10 -10
  31. package/src/ContentCards/ui/show-content-cards.js +8 -8
  32. package/src/Core/add-sdk-metadata.js +2 -2
  33. package/src/Core/change-user.js +3 -3
  34. package/src/Core/disable-sdk.js +7 -7
  35. package/src/Core/enable-sdk.js +5 -5
  36. package/src/Core/get-device-id.js +2 -2
  37. package/src/Core/get-user.js +1 -1
  38. package/src/Core/is-disabled.js +1 -1
  39. package/src/Core/log-custom-event.js +3 -3
  40. package/src/Core/log-purchase.js +1 -1
  41. package/src/Core/open-session.js +9 -9
  42. package/src/Core/wipe-data.js +5 -5
  43. package/src/FeatureFlags/feature-flag-factory.js +4 -4
  44. package/src/FeatureFlags/feature-flag.js +18 -18
  45. package/src/FeatureFlags/feature-flags-provider.js +81 -78
  46. package/src/FeatureFlags/get-all-feature-flags.js +6 -7
  47. package/src/FeatureFlags/get-feature-flag.js +5 -6
  48. package/src/FeatureFlags/log-feature-flag-impression.js +4 -4
  49. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
  50. package/src/Feed/feed-provider.js +34 -34
  51. package/src/Feed/feed.js +2 -2
  52. package/src/Feed/get-cached-feed.js +1 -1
  53. package/src/Feed/request-feed-refresh.js +1 -1
  54. package/src/Feed/subscribe-to-feed-updates.js +1 -1
  55. package/src/Feed/ui/show-feed.js +5 -5
  56. package/src/InAppMessage/defer-in-app-message.js +1 -1
  57. package/src/InAppMessage/display/html-message-to-html.js +10 -10
  58. package/src/InAppMessage/display/in-app-message-to-html.js +21 -21
  59. package/src/InAppMessage/display/modal-utils.js +6 -6
  60. package/src/InAppMessage/in-app-message-factory.js +4 -4
  61. package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
  62. package/src/InAppMessage/in-app-message-manager.js +115 -91
  63. package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
  64. package/src/InAppMessage/log-in-app-message-click.js +3 -3
  65. package/src/InAppMessage/log-in-app-message-html-click.js +4 -4
  66. package/src/InAppMessage/log-in-app-message-impression.js +2 -2
  67. package/src/InAppMessage/models/control-message.js +1 -1
  68. package/src/InAppMessage/models/full-screen-message.js +5 -5
  69. package/src/InAppMessage/models/html-message.js +10 -10
  70. package/src/InAppMessage/models/in-app-message-button.js +5 -5
  71. package/src/InAppMessage/models/in-app-message.js +42 -42
  72. package/src/InAppMessage/models/modal-message.js +5 -5
  73. package/src/InAppMessage/models/slide-up-message.js +8 -8
  74. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  75. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  76. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  77. package/src/InAppMessage/ui/show-in-app-message.js +24 -24
  78. package/src/Push/is-push-blocked.js +2 -2
  79. package/src/Push/is-push-permission-granted.js +2 -2
  80. package/src/Push/is-push-supported.js +2 -2
  81. package/src/Push/push-manager-factory.js +8 -8
  82. package/src/Push/push-manager.js +90 -90
  83. package/src/Push/utils/push-utils.js +12 -12
  84. package/src/User/user-manager.js +12 -12
  85. package/src/User/user.js +48 -36
  86. package/src/common/base-feed.js +3 -3
  87. package/src/common/constants.js +1 -1
  88. package/src/common/event-logger.js +4 -4
  89. package/src/common/feed-display.js +14 -14
  90. package/src/l10n/l10n-manager-factory.js +2 -2
  91. package/src/l10n/l10n-manager.js +1 -1
  92. package/src/managers/auth-manager.js +10 -10
  93. package/src/managers/braze-instance.js +128 -128
  94. package/src/managers/device-manager.js +18 -18
  95. package/src/managers/network-manager.js +184 -147
  96. package/src/managers/server-config-manager.js +63 -63
  97. package/src/managers/session-manager.js +27 -27
  98. package/src/managers/storage-manager-factory.js +10 -10
  99. package/src/managers/storage-manager.js +146 -146
  100. package/src/managers/subscription-manager.js +8 -8
  101. package/src/managers/utils.js +1 -1
  102. package/src/models/backend-errors.js +4 -4
  103. package/src/models/braze-event.js +8 -8
  104. package/src/models/device.js +2 -2
  105. package/src/models/identifier.js +12 -12
  106. package/src/models/push-token.js +8 -8
  107. package/src/models/server-config.js +31 -31
  108. package/src/request-controller.js +163 -151
  109. package/src/triggers/models/custom-event-data.js +5 -5
  110. package/src/triggers/models/custom-event-property-data.js +6 -6
  111. package/src/triggers/models/filter-set.js +8 -8
  112. package/src/triggers/models/filter.js +16 -16
  113. package/src/triggers/models/in-app-message-click-data.js +2 -2
  114. package/src/triggers/models/purchase-data.js +2 -2
  115. package/src/triggers/models/purchase-property-data.js +4 -4
  116. package/src/triggers/models/push-click-data.js +2 -2
  117. package/src/triggers/models/trigger-condition.js +37 -37
  118. package/src/triggers/models/trigger-events.js +2 -2
  119. package/src/triggers/models/trigger.js +11 -11
  120. package/src/triggers/triggers-provider-factory.js +3 -3
  121. package/src/triggers/triggers-provider.js +39 -39
  122. package/src/ui/js/attach-css.js +3 -3
  123. package/src/ui/js/iam-css.js +1 -1
  124. package/src/ui/js/load-font-awesome.js +2 -2
  125. package/src/util/base-device-parser.js +3 -3
  126. package/src/util/braze-actions.js +4 -4
  127. package/src/util/browser-detector.js +6 -6
  128. package/src/util/client-hints-parser.js +1 -1
  129. package/src/util/component-utils.js +2 -2
  130. package/src/util/dom-utils.js +6 -6
  131. package/src/util/html-display-utils.js +1 -0
  132. package/src/util/key-codes.js +1 -1
  133. package/src/util/net.js +22 -23
  134. package/src/util/request-header-utils.js +25 -22
  135. package/src/util/user-agent-parser.js +1 -1
  136. package/src/util/validation-utils.js +17 -17
  137. package/src/util/window-utils.js +2 -2
@@ -1,24 +1,26 @@
1
1
  import N from "../../../shared-lib/logger.js";
2
2
  import { SUBSCRIPTION_ID_DATA_ATTRIBUTE as f } from "../../common/constants.js";
3
- import r, { OPTIONS as z } from "../../managers/braze-instance.js";
3
+ import r, { OPTIONS as w } from "../../managers/braze-instance.js";
4
4
  import { setupBannerUI as U } from "../../ui/js/banner-css.js";
5
5
  import { addPassiveEventListener as J } from "../../util/dom-utils.js";
6
6
  import { bannerToHtml as S } from "../display/banner-to-html.js";
7
7
  import { destroyBannerHtml as A } from "../display/destroy-banner-html.js";
8
8
  import { detectBannerImpressions as C } from "../display/detect-banner-impressions.js";
9
9
  import { subscribeToBannersUpdates } from "../subscribe-to-banners-updates.js";
10
- export function insertBanner(o, s) {
10
+ export function insertBanner(o, e) {
11
11
  if (!r.rr()) return;
12
- if (!o || !s) return void N.error("Banner or parentNode is not provided.");
13
- if (!r.sr(z.er))
12
+ if (!o) return void N.error("Not inserting banner: banner was not provided.");
13
+ if (!e)
14
+ return void N.error("Not inserting banner: parentNode was not provided.");
15
+ if (!r.ee(w.re))
14
16
  return void N.error(
15
17
  "Banners are disabled. Use the 'allowUserSuppliedJavascript' option for braze.initialize to enable these messages.",
16
18
  );
17
19
  U();
18
- const e = S(o, r.sr(z.ir)),
19
- i = subscribeToBannersUpdates((i) => {
20
- const t = i[o.placementId];
21
- t ? s.replaceChildren(S(t, r.sr(z.ir))) : A(e);
20
+ const n = S(o, r.ee(w.er)),
21
+ s = subscribeToBannersUpdates((s) => {
22
+ const i = s[o.placementId];
23
+ i ? e.replaceChildren(S(i, r.ee(w.er))) : A(n);
22
24
  });
23
- i && e.setAttribute(f, i), s.replaceChildren(e), J(window, "scroll", C), C();
25
+ s && n.setAttribute(f, s), e.replaceChildren(n), J(window, "scroll", C), C();
24
26
  }
@@ -15,13 +15,13 @@ export default class M {
15
15
  r
16
16
  );
17
17
  if (n && s.id && this.C) {
18
- const n = this.C.ps(t.bs.ot) || {};
19
- (n[s.id] = !0), this.C.js(t.bs.ot, n);
18
+ const n = this.C.vs(t.gs.ot) || {};
19
+ (n[s.id] = !0), this.C.Bs(t.gs.ot, n);
20
20
  }
21
21
  const i = this.et([s]);
22
22
  if (null == i) return r;
23
23
  const o = n ? d.lt : d.ut;
24
- return c.ds(o, i);
24
+ return c.cs(o, i);
25
25
  }
26
26
  ct(s) {
27
27
  const n = new E();
@@ -33,18 +33,18 @@ export default class M {
33
33
  n
34
34
  );
35
35
  if (s.id && this.C) {
36
- const n = this.C.ps(t.bs.gt) || {};
37
- (n[s.id] = !0), this.C.js(t.bs.gt, n);
36
+ const n = this.C.vs(t.gs.gt) || {};
37
+ (n[s.id] = !0), this.C.Bs(t.gs.gt, n);
38
38
  }
39
39
  const r = this.et([s]);
40
- return null == r ? n : c.ds(d.dt, r);
40
+ return null == r ? n : c.cs(d.dt, r);
41
41
  }
42
42
  jt(s, n) {
43
43
  const r = new E(!0),
44
44
  i = [],
45
45
  o = [];
46
46
  let e = {};
47
- this.C && (e = n ? this.C.ps(t.bs.vt) || {} : this.C.ps(t.bs.Ct) || {});
47
+ this.C && (e = n ? this.C.vs(t.gs.vt) || {} : this.C.vs(t.gs.Ct) || {});
48
48
  for (const t of s) {
49
49
  t.wt()
50
50
  ? (t instanceof ControlCard ? o.push(t) : i.push(t),
@@ -57,14 +57,14 @@ export default class M {
57
57
  a = this.et(o);
58
58
  if (null == l && null == a) return (r.ss = !1), r;
59
59
  if (
60
- (this.C && (n ? this.C.js(t.bs.vt, e) : this.C.js(t.bs.Ct, e)), null != l)
60
+ (this.C && (n ? this.C.Bs(t.gs.vt, e) : this.C.Bs(t.gs.Ct, e)), null != l)
61
61
  ) {
62
62
  const t = n ? d.xt : d.yt,
63
- s = c.ds(t, l);
63
+ s = c.cs(t, l);
64
64
  r.It(s);
65
65
  }
66
66
  if (null != a && n) {
67
- const t = c.ds(d.$t, a);
67
+ const t = c.cs(d.$t, a);
68
68
  r.It(t);
69
69
  }
70
70
  return r;
@@ -1,12 +1,12 @@
1
1
  import { Card } from "./models/index.js";
2
2
  import _ from "./card-manager-factory.js";
3
3
  import r from "../managers/braze-instance.js";
4
- import { isArray as w } from "../util/code-utils.js";
4
+ import { isArray as z } from "../util/code-utils.js";
5
5
  import { MUST_BE_CARD_WARNING_SUFFIX as K } from "../common/constants.js";
6
6
  import { logger as N } from "../../shared-lib/index.js";
7
7
  export function logCardImpressions(o, n) {
8
8
  if (!r.rr()) return !1;
9
- if (!w(o)) return N.error("cards must be an array"), !1;
9
+ if (!z(o)) return N.error("cards must be an array"), !1;
10
10
  for (const r of o)
11
11
  if (!(r instanceof Card)) return N.error(`Each card in cards ${K}`), !1;
12
12
  return _.ea().jt(o, n).ss;
@@ -6,7 +6,7 @@ export default class CaptionedImage extends Card {
6
6
  (this.Tt = !0),
7
7
  (this.test = !1);
8
8
  }
9
- Bs() {
9
+ bs() {
10
10
  const t = {};
11
11
  return (
12
12
  (t[Card.qt.zt] = Card.Dt.Bt),
@@ -50,10 +50,10 @@ export default class Card {
50
50
  (this.Zt = null);
51
51
  }
52
52
  subscribeToClickedEvent(t) {
53
- return this.ti().Ns(t);
53
+ return this.ti().Fs(t);
54
54
  }
55
55
  subscribeToDismissedEvent(t) {
56
- return this.ii().Ns(t);
56
+ return this.ii().Fs(t);
57
57
  }
58
58
  removeSubscription(t) {
59
59
  this.ti().removeSubscription(t), this.ii().removeSubscription(t);
@@ -142,7 +142,7 @@ export default class Card {
142
142
  !0
143
143
  );
144
144
  }
145
- Bs() {
145
+ bs() {
146
146
  N.error("Must be implemented in a subclass");
147
147
  }
148
148
  }
@@ -5,7 +5,7 @@ export default class ClassicCard extends Card {
5
5
  (this.At = "ab-classic-card"),
6
6
  (this.Tt = !0);
7
7
  }
8
- Bs() {
8
+ bs() {
9
9
  const s = {};
10
10
  return (
11
11
  (s[Card.qt.zt] = Card.Dt.Ei),
@@ -6,7 +6,7 @@ export default class ControlCard extends Card {
6
6
  (this.At = "ab-control-card"),
7
7
  (this.Tt = !1);
8
8
  }
9
- Bs() {
9
+ bs() {
10
10
  const l = {};
11
11
  return (
12
12
  (l[Card.qt.zt] = Card.Dt.Ti),
@@ -6,7 +6,7 @@ export default class ImageOnly extends Card {
6
6
  (this.Tt = !1),
7
7
  (this.test = !1);
8
8
  }
9
- Bs() {
9
+ bs() {
10
10
  const s = {};
11
11
  return (
12
12
  (s[Card.qt.zt] = Card.Dt.oi),
@@ -6,7 +6,7 @@ const W = {
6
6
  m: () => (
7
7
  W.p(),
8
8
  W.provider ||
9
- ((W.provider = new Q(r.tr(), r.j(), r.v(), r.nr(), r.g())),
9
+ ((W.provider = new Q(r.ir(), r.j(), r.v(), r.tr(), r.g())),
10
10
  r._(W.provider)),
11
11
  W.provider
12
12
  ),
@@ -1,80 +1,72 @@
1
- import l, { readResponseHeaders as X } from "../util/net.js";
1
+ import l from "../util/net.js";
2
2
  import s from "../common/base-provider.js";
3
3
  import r from "../managers/braze-instance.js";
4
4
  import ContentCards from "./content-cards.js";
5
5
  import { dateFromUnixTimestamp as O } from "../util/date-utils.js";
6
- import { isURIJavascriptOrData as Y } from "../util/url-utils.js";
6
+ import { isURIJavascriptOrData as X } from "../util/url-utils.js";
7
7
  import {
8
- newCardFromContentCardsJson as Z,
9
- newCardFromSerializedValue as tt,
8
+ newCardFromContentCardsJson as Y,
9
+ newCardFromSerializedValue as Z,
10
10
  } from "../Card/util/card-factory.js";
11
11
  import { STORAGE_KEYS as t } from "../managers/storage-manager.js";
12
12
  import u from "../managers/subscription-manager.js";
13
- import c from "../common/event-logger.js";
14
13
  import h from "../util/request-header-utils.js";
15
14
  import { randomInclusive as a } from "../util/math.js";
16
- import { MAX_ERROR_RETRIES_CONTENT_CARDS as st } from "../common/constants.js";
17
- import {
18
- logger as N,
19
- IndexedDBAdapter as it,
20
- EventTypes as d,
21
- } from "../../shared-lib/index.js";
15
+ import { logger as N, IndexedDBAdapter as tt } from "../../shared-lib/index.js";
22
16
  export default class Q extends s {
23
17
  constructor(t, s, i, e, h) {
24
18
  super(),
25
19
  (this.As = t),
26
20
  (this.C = s),
27
21
  (this.B = i),
28
- (this.Js = e),
22
+ (this.Ls = e),
29
23
  (this.S = h),
30
24
  (this.As = t),
31
25
  (this.C = s),
32
26
  (this.B = i),
33
- (this.Js = e),
27
+ (this.Ls = e),
34
28
  (this.S = h),
35
- (this.Ms = new u()),
36
- r.N(this.Ms),
29
+ (this.Js = new u()),
30
+ r.N(this.Js),
31
+ (this.Ms = 0),
37
32
  (this.$s = 0),
38
- (this.Ps = 0),
39
33
  (this.cards = []),
40
- this.Xs();
41
- const n = it.Gs._s;
42
- new it(n, N).Hs(n.Os.Ks, (t) => {
43
- this.Qs(t);
34
+ this.Ps();
35
+ const n = tt._s.Xs;
36
+ new tt(n, N).Gs(n.Ks.Hs, (t) => {
37
+ this.Os(t);
44
38
  }),
45
- (this.Vs = null),
39
+ (this.Qs = null),
46
40
  (this.k = null),
41
+ (this.Vs = null),
47
42
  (this.Ws = null),
48
- (this.Ys = null),
49
- (this.Zs = null),
50
- (this.fi = 10),
51
- (this.di = 0);
43
+ (this.Ys = 10);
52
44
  }
53
- pi() {
54
- return this.Vs;
45
+ Zs() {
46
+ return this.Qs;
55
47
  }
56
- vi(t) {
57
- this.Vs = t;
48
+ fi(t) {
49
+ this.Qs = t;
58
50
  }
59
- Ts() {
51
+ Cs() {
60
52
  return this.k;
61
53
  }
62
- Rs(t) {
54
+ Ts(t) {
63
55
  this.k = t;
64
56
  }
65
- Xs() {
57
+ Ps() {
66
58
  if (!this.C) return;
67
- const s = this.C.ps(t.bs.wi) || [],
59
+ const s = this.C.vs(t.gs.di) || [],
68
60
  i = [];
69
61
  for (let t = 0; t < s.length; t++) {
70
- const e = tt(s[t]);
62
+ const e = Z(s[t]);
71
63
  null != e && i.push(e);
72
64
  }
73
- (this.cards = this.Ci(this.bi(i, !1))),
74
- (this.$s = this.C.ps(t.bs.gi) || this.$s),
75
- (this.Ps = this.C.ps(t.bs.yi) || this.Ps);
65
+ (this.cards = this.pi(this.Ci(i, !1))),
66
+ (this.Ms = this.C.vs(t.gs.bi) || this.Ms),
67
+ (this.$s = this.C.vs(t.gs.vi) || this.$s);
76
68
  }
77
- ji(s, i = !1, e = 0, h = 0) {
69
+ wi(s, i = !1, e = 0, h = 0) {
78
70
  let r;
79
71
  if (i) {
80
72
  r = [];
@@ -89,10 +81,10 @@ export default class Q extends s {
89
81
  break;
90
82
  }
91
83
  if (i) {
92
- const t = Z(e);
84
+ const t = Y(e);
93
85
  null != h && h.viewed && t && (t.viewed = !0), null != t && r.push(t);
94
86
  } else if (null == h) {
95
- const t = Z(e);
87
+ const t = Y(e);
96
88
  null != t && r.push(t);
97
89
  } else {
98
90
  if (!h.ni(e))
@@ -103,54 +95,28 @@ export default class Q extends s {
103
95
  }
104
96
  }
105
97
  }
106
- (this.cards = this.Ci(this.bi(r, i))),
107
- this.Ri(),
108
- (this.$s = e),
109
- (this.Ps = h),
110
- this.C && (this.C.js(t.bs.gi, this.$s), this.C.js(t.bs.yi, this.Ps));
98
+ (this.cards = this.pi(this.Ci(r, i))),
99
+ this.gi(),
100
+ (this.Ms = e),
101
+ (this.$s = h),
102
+ this.C && (this.C.Bs(t.gs.bi, this.Ms), this.C.Bs(t.gs.vi, this.$s));
111
103
  }
112
104
  U(s) {
113
- if (this.Si() && null != s && s.cards) {
114
- this.C && this.C.js(t.bs.Di, r.Ui());
105
+ if (this.ji() && null != s && s.cards) {
106
+ this.C && this.C.Bs(t.gs.yi, r.Si());
115
107
  const i = s.full_sync;
116
- i || this.Xs(),
117
- this.ji(s.cards, i, s.last_full_sync_at, s.last_card_updated_at),
118
- this.Ms.X(this.ki(!0));
108
+ i || this.Ps(),
109
+ this.wi(s.cards, i, s.last_full_sync_at, s.last_card_updated_at),
110
+ this.Js.X(this.Ri(!0));
119
111
  }
120
112
  }
121
- Ai(s) {
122
- this.C && this.C.js(t.bs.Fi, s);
113
+ Ui(t) {
114
+ this.ki(), (this.Vs = t);
123
115
  }
124
- xi(s, i, e) {
125
- const h = () => {
126
- this.zi(i, e, !0);
127
- },
128
- r = s ? X(s) : null;
129
- let n;
130
- if ((this.qi(), !r || !r["retry-after"])) return void this.Ai(0);
131
- const o = r["retry-after"];
132
- if (isNaN(o) && !isNaN(Date.parse(o)))
133
- (n = Date.parse(o) - new Date().getTime()), n < 0 && h();
134
- else {
135
- if (isNaN(parseFloat(o.toString()))) {
136
- const t =
137
- "Received unexpected value for retry-after header in /sync response";
138
- return c.ds(d.Li, { e: t + ": " + o }), void this.Ai(0);
139
- }
140
- n = 1e3 * parseFloat(o.toString());
141
- }
142
- this.Ws = window.setTimeout(() => {
143
- h();
144
- }, n);
145
- let l = 0;
146
- this.C && (l = this.C.ps(t.bs.Fi)),
147
- (null == l || isNaN(parseInt(l.toString()))) && (l = 0),
148
- this.Ai(parseInt(l.toString()) + 1);
149
- }
150
- Qs(t) {
116
+ Os(t) {
151
117
  var s;
152
- if (!this.Si()) return;
153
- this.Xs();
118
+ if (!this.ji()) return;
119
+ this.Ps();
154
120
  const i = this.cards.slice();
155
121
  let e = null;
156
122
  e = null === (s = this.As) || void 0 === s ? void 0 : s.getUserId();
@@ -164,7 +130,7 @@ export default class Q extends s {
164
130
  break;
165
131
  }
166
132
  if (null == h) {
167
- const t = Z(e);
133
+ const t = Y(e);
168
134
  null != t && i.push(t);
169
135
  } else {
170
136
  if (!h.ni(e))
@@ -175,16 +141,16 @@ export default class Q extends s {
175
141
  }
176
142
  }
177
143
  }
178
- (this.cards = this.Ci(this.bi(i, !1))), this.Ri(), this.Ms.X(this.ki(!0));
144
+ (this.cards = this.pi(this.Ci(i, !1))), this.gi(), this.Js.X(this.Ri(!0));
179
145
  }
180
- bi(s, i) {
146
+ Ci(s, i) {
181
147
  let e = {},
182
148
  h = {},
183
149
  r = {};
184
150
  this.C &&
185
- ((e = this.C.ps(t.bs.ot) || {}),
186
- (h = this.C.ps(t.bs.vt) || {}),
187
- (r = this.C.ps(t.bs.gt) || {}));
151
+ ((e = this.C.vs(t.gs.ot) || {}),
152
+ (h = this.C.vs(t.gs.vt) || {}),
153
+ (r = this.C.vs(t.gs.gt) || {}));
188
154
  const n = {},
189
155
  o = {},
190
156
  l = {};
@@ -198,19 +164,19 @@ export default class Q extends s {
198
164
  return (
199
165
  i &&
200
166
  this.C &&
201
- (this.C.js(t.bs.ot, n), this.C.js(t.bs.vt, o), this.C.js(t.bs.gt, l)),
167
+ (this.C.Bs(t.gs.ot, n), this.C.Bs(t.gs.vt, o), this.C.Bs(t.gs.gt, l)),
202
168
  s
203
169
  );
204
170
  }
205
- Ci(s) {
171
+ pi(s) {
206
172
  const i = [],
207
173
  e = new Date();
208
174
  let h = {};
209
- this.C && (h = this.C.ps(t.bs.gt) || {});
175
+ this.C && (h = this.C.vs(t.gs.gt) || {});
210
176
  let r = !1;
211
177
  for (let t = 0; t < s.length; t++) {
212
178
  const n = s[t].url;
213
- if (!this.Js && n && Y(n)) {
179
+ if (!this.Ls && n && X(n)) {
214
180
  N.error(
215
181
  `Card with url ${n} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`,
216
182
  );
@@ -225,92 +191,85 @@ export default class Q extends s {
225
191
  i && (h[i] = !0), (r = !0);
226
192
  }
227
193
  }
228
- return r && this.C && this.C.js(t.bs.gt, h), i;
194
+ return r && this.C && this.C.Bs(t.gs.gt, h), i;
229
195
  }
230
- Ri() {
196
+ gi() {
231
197
  var s;
232
198
  const i = [];
233
- for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].Bs());
234
- null === (s = this.C) || void 0 === s || s.js(t.bs.wi, i);
235
- }
236
- qi() {
237
- this.Ws && (clearTimeout(this.Ws), (this.Ws = null));
238
- }
239
- Ji() {
240
- null != this.Ys && (clearTimeout(this.Ys), (this.Ys = null));
199
+ for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].bs());
200
+ null === (s = this.C) || void 0 === s || s.Bs(t.gs.di, i);
241
201
  }
242
- Mi(t = 1e3 * this.fi, s, i) {
243
- this.Ji(),
244
- (this.Ys = window.setTimeout(() => {
245
- this.zi(s, i, !0);
246
- }, t)),
247
- (this.Zs = t);
202
+ ki() {
203
+ this.Vs && (clearTimeout(this.Vs), (this.Vs = null));
248
204
  }
249
- zi(s, i, e = !1, n = !0) {
250
- var o;
251
- const u = this.S,
252
- c = this.C;
253
- if (!u || !c) return void ("function" == typeof i && i());
254
- if ((!e && (this.qi(), this.Ai(0)), !this.Si()))
205
+ Di(s, i, e = !1) {
206
+ var n;
207
+ const o = this.S,
208
+ u = this.C;
209
+ if (!o || !u) return void ("function" == typeof i && i());
210
+ if ((e && (h.zi(u, h.O.Ai), this.ki()), !this.ji()))
255
211
  return void (
256
- null === (o = this.B) ||
257
- void 0 === o ||
258
- o.$i(() => {
259
- this.zi(s, i);
212
+ null === (n = this.B) ||
213
+ void 0 === n ||
214
+ n.qi(() => {
215
+ this.Di(s, i, !0);
260
216
  })
261
217
  );
262
- n && this.Ji();
263
- const f = u.H({}, !0);
264
- c.ps(t.bs.Di) !== r.Ui() && this.Bi(),
265
- (f.last_full_sync_at = this.$s),
266
- (f.last_card_updated_at = this.Ps);
267
- const d = u.J(f, h.O.Pi, e);
268
- let m = !1;
269
- u.V(
270
- f,
218
+ const c = o.H({}, !0);
219
+ u.vs(t.gs.yi) !== r.Si() && this.xi(),
220
+ (c.last_full_sync_at = this.Ms),
221
+ (c.last_card_updated_at = this.$s);
222
+ const f = o.J(c, h.O.Ai, e);
223
+ let d = !1;
224
+ o.V(
225
+ c,
271
226
  (t = -1) => {
272
227
  if (this.C) {
273
228
  const t = new Date().valueOf();
274
- h.W(this.C, h.O.Pi, t);
229
+ h.W(this.C, h.O.Ai, t);
275
230
  }
276
- -1 !== t && d.push(["X-Braze-Req-Tokens-Remaining", t.toString()]),
231
+ -1 !== t && f.push(["X-Braze-Req-Tokens-Remaining", t.toString()]),
277
232
  l.Y({
278
- url: `${u.Z()}/content_cards/sync`,
279
- data: f,
280
- headers: d,
281
- ss: (t, e) => {
282
- if (!u.ts(f, t, d))
283
- return (m = !0), void ("function" == typeof i && i());
284
- u.es(),
285
- this.xi(e, s, i),
286
- this.U(t),
287
- (m = !1),
288
- h.ns(this.C, h.O.Pi, 1),
289
- "function" == typeof s && s();
233
+ url: `${o.Z()}/content_cards/sync`,
234
+ data: c,
235
+ headers: f,
236
+ ss: (t) => {
237
+ if (!o.ts(c, t, f))
238
+ return (d = !0), void ("function" == typeof i && i());
239
+ o.es(), this.U(t), (d = !1), "function" == typeof s && s();
290
240
  },
291
241
  error: (t) => {
292
- u.rs(t, "retrieving content cards"),
293
- (m = !0),
242
+ o.ns(t, "retrieving content cards"),
243
+ (d = !0),
294
244
  "function" == typeof i && i();
295
245
  },
296
- os: () => {
297
- if (m && n && !this.Ys && this.di + 1 < st) {
298
- h.hs(this.C, h.O.Pi);
299
- let t = this.Zs;
300
- (null == t || t < 1e3 * this.fi) && (t = 1e3 * this.fi),
301
- this.Mi(Math.min(3e5, a(1e3 * this.fi, 3 * t)), s, i),
302
- (this.di = this.di + 1);
246
+ rs: (t, e) => {
247
+ let r;
248
+ if (d) {
249
+ let t = this.Ws;
250
+ (null == t || t < 1e3 * this.Ys) && (t = 1e3 * this.Ys),
251
+ (r = Math.min(3e5, a(1e3 * this.Ys, 3 * t)));
303
252
  }
253
+ o.os(
254
+ e,
255
+ () => {
256
+ this.Di(s, i, !1);
257
+ },
258
+ h.O.Ai,
259
+ (t) => this.Ui(t),
260
+ () => this.ki(),
261
+ r,
262
+ );
304
263
  },
305
264
  });
306
265
  },
307
- h.O.Pi,
266
+ h.O.Ai,
308
267
  i,
309
268
  );
310
269
  }
311
- ki(s) {
312
- s || this.Xs();
313
- const i = this.Ci(this.cards);
270
+ Ri(s) {
271
+ s || this.Ps();
272
+ const i = this.pi(this.cards);
314
273
  i.sort((t, s) =>
315
274
  t.pinned && !s.pinned
316
275
  ? -1
@@ -322,50 +281,50 @@ export default class Q extends s {
322
281
  ? 1
323
282
  : 0,
324
283
  );
325
- let e = Math.max(this.Ps || 0, this.$s || 0);
284
+ let e = Math.max(this.$s || 0, this.Ms || 0);
326
285
  return (
327
286
  0 === e && (e = void 0),
328
- this.C && this.C.ps(t.bs.yi) === this.Ps && void 0 === e && (e = this.Ps),
287
+ this.C && this.C.vs(t.gs.vi) === this.$s && void 0 === e && (e = this.$s),
329
288
  new ContentCards(i, O(e))
330
289
  );
331
290
  }
332
- Fs(t) {
333
- return this.Ms.Ns(t);
291
+ qs(t) {
292
+ return this.Js.Fs(t);
334
293
  }
335
- Bi() {
336
- (this.$s = 0),
337
- (this.Ps = 0),
338
- this.C && (this.C.Ls(t.bs.gi), this.C.Ls(t.bs.yi));
294
+ xi() {
295
+ (this.Ms = 0),
296
+ (this.$s = 0),
297
+ this.C && (this.C.Es(t.gs.bi), this.C.Es(t.gs.vi));
339
298
  }
340
299
  changeUser(s) {
341
300
  s ||
342
301
  ((this.cards = []),
343
- this.Ms.X(new ContentCards(this.cards.slice(), null)),
302
+ this.Js.X(new ContentCards(this.cards.slice(), null)),
344
303
  this.C &&
345
- (this.C.Ls(t.bs.wi),
346
- this.C.Ls(t.bs.ot),
347
- this.C.Ls(t.bs.vt),
348
- this.C.Ls(t.bs.gt))),
349
- this.Bi();
304
+ (this.C.Es(t.gs.di),
305
+ this.C.Es(t.gs.ot),
306
+ this.C.Es(t.gs.vt),
307
+ this.C.Es(t.gs.gt))),
308
+ this.xi();
350
309
  }
351
310
  clearData(s) {
352
- (this.$s = 0),
353
- (this.Ps = 0),
311
+ (this.Ms = 0),
312
+ (this.$s = 0),
354
313
  (this.cards = []),
355
- this.Ms.X(new ContentCards(this.cards.slice(), null)),
314
+ this.Js.X(new ContentCards(this.cards.slice(), null)),
356
315
  s &&
357
316
  this.C &&
358
- (this.C.Ls(t.bs.wi),
359
- this.C.Ls(t.bs.ot),
360
- this.C.Ls(t.bs.vt),
361
- this.C.Ls(t.bs.gt),
362
- this.C.Ls(t.bs.gi),
363
- this.C.Ls(t.bs.yi));
317
+ (this.C.Es(t.gs.di),
318
+ this.C.Es(t.gs.ot),
319
+ this.C.Es(t.gs.vt),
320
+ this.C.Es(t.gs.gt),
321
+ this.C.Es(t.gs.bi),
322
+ this.C.Es(t.gs.vi));
364
323
  }
365
- Si() {
366
- return !!this.B && (!!this.B.Xi() || (0 !== this.B.Es() && this._i(), !1));
324
+ ji() {
325
+ return !!this.B && (!!this.B.Fi() || (0 !== this.B.Us() && this.Li(), !1));
367
326
  }
368
- _i() {
369
- this.Ms.X(new ContentCards([], new Date())), this.C && this.C.Ls(t.bs.wi);
327
+ Li() {
328
+ this.Js.X(new ContentCards([], new Date())), this.C && this.C.Es(t.gs.di);
370
329
  }
371
330
  }