@braze/web-sdk 5.9.1 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/index.d.ts +209 -283
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +1 -1
  4. package/shared-lib/event-types.js +27 -29
  5. package/shared-lib/guid.js +3 -3
  6. package/shared-lib/indexed-db-adapter.js +22 -22
  7. package/shared-lib/logger.js +18 -18
  8. package/shared-lib/supported-options.js +22 -23
  9. package/src/Banner/banner-factory.js +2 -1
  10. package/src/Banner/banner-provider-factory.js +7 -7
  11. package/src/Banner/banner-provider.js +92 -98
  12. package/src/Banner/banner.js +21 -18
  13. package/src/Banner/display/banner-to-html.js +18 -30
  14. package/src/Banner/display/detect-banner-impressions.js +11 -11
  15. package/src/Banner/get-all-banners.js +5 -5
  16. package/src/Banner/get-banner.js +7 -7
  17. package/src/Banner/index.js +0 -1
  18. package/src/Banner/log-banner-click.js +7 -7
  19. package/src/Banner/log-banner-impressions.js +9 -9
  20. package/src/Banner/request-banners-refresh.js +23 -27
  21. package/src/Banner/subscribe-to-banners-updates.js +9 -9
  22. package/src/Banner/ui/insert-banner.js +10 -10
  23. package/src/Card/card-manager-factory.js +7 -7
  24. package/src/Card/card-manager.js +45 -47
  25. package/src/Card/display/card-display.js +76 -74
  26. package/src/Card/index.js +0 -2
  27. package/src/Card/log-card-dismissal.js +4 -4
  28. package/src/Card/log-content-card-click.js +9 -2
  29. package/src/Card/log-content-card-impressions.js +11 -2
  30. package/src/Card/models/captioned-image.js +21 -21
  31. package/src/Card/models/card.js +116 -110
  32. package/src/Card/models/classic-card.js +21 -21
  33. package/src/Card/models/control-card.js +15 -15
  34. package/src/Card/models/image-only.js +20 -21
  35. package/src/Card/util/card-factory.js +58 -79
  36. package/src/ContentCards/content-cards-provider-factory.js +13 -13
  37. package/src/ContentCards/content-cards-provider.js +148 -148
  38. package/src/ContentCards/content-cards.js +21 -13
  39. package/src/ContentCards/get-cached-content-cards.js +2 -2
  40. package/src/ContentCards/request-content-cards-refresh.js +2 -2
  41. package/src/ContentCards/subscribe-to-content-cards-updates.js +8 -8
  42. package/src/ContentCards/ui/hide-content-cards.js +5 -5
  43. package/src/ContentCards/ui/show-content-cards.js +35 -35
  44. package/src/Core/add-sdk-metadata.js +5 -5
  45. package/src/Core/change-user.js +7 -7
  46. package/src/Core/destroy.js +2 -2
  47. package/src/Core/disable-sdk.js +10 -10
  48. package/src/Core/enable-sdk.js +7 -7
  49. package/src/Core/get-device-id.js +4 -4
  50. package/src/Core/get-user.js +1 -1
  51. package/src/Core/handle-braze-action.js +10 -10
  52. package/src/Core/is-disabled.js +2 -2
  53. package/src/Core/is-initialized.js +1 -1
  54. package/src/Core/log-custom-event.js +18 -18
  55. package/src/Core/log-purchase.js +19 -19
  56. package/src/Core/open-session.js +13 -13
  57. package/src/Core/request-immediate-data-flush.js +1 -1
  58. package/src/Core/set-logger.js +2 -2
  59. package/src/Core/toggle-logging.js +2 -2
  60. package/src/Core/wipe-data.js +9 -9
  61. package/src/FeatureFlags/feature-flag-factory.js +10 -10
  62. package/src/FeatureFlags/feature-flag.js +20 -71
  63. package/src/FeatureFlags/feature-flags-provider-factory.js +7 -7
  64. package/src/FeatureFlags/feature-flags-provider.js +86 -86
  65. package/src/FeatureFlags/get-all-feature-flags.js +3 -3
  66. package/src/FeatureFlags/get-feature-flag.js +3 -3
  67. package/src/FeatureFlags/log-feature-flag-impression.js +8 -8
  68. package/src/FeatureFlags/refresh-feature-flags.js +1 -1
  69. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
  70. package/src/InAppMessage/defer-in-app-message.js +4 -4
  71. package/src/InAppMessage/display/html-message-to-html.js +41 -41
  72. package/src/InAppMessage/display/in-app-message-to-html.js +145 -139
  73. package/src/InAppMessage/display/modal-utils.js +40 -42
  74. package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
  75. package/src/InAppMessage/in-app-message-factory.js +24 -16
  76. package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
  77. package/src/InAppMessage/in-app-message-manager.js +124 -122
  78. package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
  79. package/src/InAppMessage/log-in-app-message-click.js +9 -9
  80. package/src/InAppMessage/log-in-app-message-html-click.js +11 -11
  81. package/src/InAppMessage/log-in-app-message-impression.js +4 -4
  82. package/src/InAppMessage/models/control-message.js +5 -5
  83. package/src/InAppMessage/models/full-screen-message.js +41 -35
  84. package/src/InAppMessage/models/html-message.js +28 -26
  85. package/src/InAppMessage/models/in-app-message-button.js +5 -5
  86. package/src/InAppMessage/models/in-app-message.js +156 -152
  87. package/src/InAppMessage/models/modal-message.js +40 -34
  88. package/src/InAppMessage/models/slide-up-message.js +38 -32
  89. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  90. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  91. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  92. package/src/InAppMessage/ui/show-in-app-message.js +68 -74
  93. package/src/Push/is-push-blocked.js +2 -2
  94. package/src/Push/is-push-permission-granted.js +2 -2
  95. package/src/Push/is-push-supported.js +2 -2
  96. package/src/Push/push-manager-factory.js +17 -17
  97. package/src/Push/push-manager.js +127 -127
  98. package/src/Push/request-push-permission.js +1 -1
  99. package/src/Push/utils/push-utils.js +25 -15
  100. package/src/User/user-manager.js +20 -20
  101. package/src/User/user.js +60 -61
  102. package/src/common/base-provider.js +1 -1
  103. package/src/common/content-cards-display.js +211 -0
  104. package/src/common/event-logger.js +12 -12
  105. package/src/common/properties-base.js +56 -0
  106. package/src/index.js +0 -1
  107. package/src/l10n/l10n-manager-factory.js +10 -10
  108. package/src/l10n/l10n-manager.js +7 -7
  109. package/src/managers/auth-manager.js +36 -36
  110. package/src/managers/braze-instance.js +184 -185
  111. package/src/managers/device-manager.js +26 -26
  112. package/src/managers/network-manager.js +194 -193
  113. package/src/managers/server-config-manager.js +75 -75
  114. package/src/managers/session-manager.js +29 -29
  115. package/src/managers/storage-manager-factory.js +13 -13
  116. package/src/managers/storage-manager.js +162 -164
  117. package/src/managers/subscription-manager.js +12 -12
  118. package/src/managers/utils.js +1 -1
  119. package/src/models/backend-errors.js +5 -5
  120. package/src/models/braze-event.js +16 -16
  121. package/src/models/device.js +3 -3
  122. package/src/models/identifier.js +8 -8
  123. package/src/models/push-token.js +10 -10
  124. package/src/models/request-result.js +4 -4
  125. package/src/models/server-config.js +33 -33
  126. package/src/request-controller.js +193 -192
  127. package/src/triggers/models/custom-event-data.js +7 -7
  128. package/src/triggers/models/custom-event-property-data.js +8 -8
  129. package/src/triggers/models/filter-set.js +8 -8
  130. package/src/triggers/models/filter.js +43 -43
  131. package/src/triggers/models/in-app-message-click-data.js +4 -4
  132. package/src/triggers/models/purchase-data.js +2 -2
  133. package/src/triggers/models/purchase-property-data.js +6 -6
  134. package/src/triggers/models/push-click-data.js +2 -2
  135. package/src/triggers/models/trigger-condition.js +52 -52
  136. package/src/triggers/models/trigger-events.js +4 -4
  137. package/src/triggers/models/trigger.js +19 -19
  138. package/src/triggers/triggers-provider-factory.js +14 -14
  139. package/src/triggers/triggers-provider.js +70 -70
  140. package/src/ui/js/attach-css.js +3 -3
  141. package/src/ui/js/banner-css.js +1 -1
  142. package/src/ui/js/iam-css.js +1 -1
  143. package/src/ui/js/load-font-awesome.js +2 -2
  144. package/src/util/base-device-parser.js +4 -4
  145. package/src/util/braze-actions.js +12 -18
  146. package/src/util/browser-detector.js +27 -20
  147. package/src/util/client-hints-parser.js +8 -8
  148. package/src/util/code-utils.js +2 -2
  149. package/src/util/component-utils.js +14 -14
  150. package/src/util/deprecation-utils.js +2 -2
  151. package/src/util/device-constants.js +5 -5
  152. package/src/util/dom-utils.js +9 -9
  153. package/src/util/html-display-utils.js +38 -38
  154. package/src/util/key-codes.js +1 -1
  155. package/src/util/net.js +12 -12
  156. package/src/util/request-header-utils.js +22 -22
  157. package/src/util/string-utils.js +2 -2
  158. package/src/util/user-agent-parser.js +17 -17
  159. package/src/util/validation-utils.js +28 -28
  160. package/src/util/window-utils.js +2 -2
  161. package/src/Card/log-card-click.js +0 -11
  162. package/src/Card/log-card-impressions.js +0 -13
  163. package/src/Feed/feed-provider-factory.js +0 -18
  164. package/src/Feed/feed-provider.js +0 -90
  165. package/src/Feed/feed.js +0 -20
  166. package/src/Feed/get-cached-feed.js +0 -5
  167. package/src/Feed/index.js +0 -8
  168. package/src/Feed/log-feed-displayed.js +0 -7
  169. package/src/Feed/request-feed-refresh.js +0 -5
  170. package/src/Feed/subscribe-to-feed-updates.js +0 -5
  171. package/src/Feed/types.js +0 -1
  172. package/src/Feed/ui/hide-feed.js +0 -7
  173. package/src/Feed/ui/show-feed.js +0 -96
  174. package/src/Feed/ui/toggle-feed.js +0 -8
  175. package/src/common/base-feed.js +0 -29
  176. package/src/common/feed-display.js +0 -211
@@ -1,72 +1,72 @@
1
- import l from "../util/net.js";
1
+ import a from "../util/net.js";
2
2
  import t from "../common/base-provider.js";
3
3
  import r from "../managers/braze-instance.js";
4
4
  import ContentCards from "./content-cards.js";
5
- import { dateFromUnixTimestamp as P } from "../util/date-utils.js";
6
- import { isURIJavascriptOrData as Y } from "../util/url-utils.js";
5
+ import { dateFromUnixTimestamp as V } from "../util/date-utils.js";
6
+ import { isURIJavascriptOrData as tt } from "../util/url-utils.js";
7
7
  import {
8
- newCardFromContentCardsJson as Z,
9
- newCardFromSerializedValue as tt,
8
+ newCardFromContentCardsJson as st,
9
+ newCardFromSerializedValue as it,
10
10
  } from "../Card/util/card-factory.js";
11
11
  import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
12
12
  import u from "../managers/subscription-manager.js";
13
13
  import h from "../util/request-header-utils.js";
14
- import { randomInclusive as a } from "../util/math.js";
15
- import { logger as N, IndexedDBAdapter as st } from "../../shared-lib/index.js";
16
- export default class Q extends t {
14
+ import { randomInclusive as l } from "../util/math.js";
15
+ import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
16
+ export default class Z extends t {
17
17
  constructor(t, s, i, e, h) {
18
18
  super(),
19
19
  (this.Cs = t),
20
- (this.C = s),
21
- (this.B = i),
22
- (this.Ss = e),
23
- (this.S = h),
20
+ (this.j = s),
21
+ (this.h = i),
22
+ (this.vs = e),
23
+ (this.B = h),
24
24
  (this.Cs = t),
25
- (this.C = s),
26
- (this.B = i),
27
- (this.Ss = e),
28
- (this.S = h),
29
- (this.Ts = new u()),
30
- r.F(this.Ts),
31
- (this.Rs = 0),
32
- (this.Us = 0),
25
+ (this.j = s),
26
+ (this.h = i),
27
+ (this.vs = e),
28
+ (this.B = h),
29
+ (this.ws = new u()),
30
+ r.q(this.ws),
31
+ (this.ys = 0),
32
+ (this.Ss = 0),
33
33
  (this.cards = []),
34
- this.Ds();
35
- const n = st.Ls.Fs;
36
- new st(n, N).Ns(n.Ms.Js, (t) => {
37
- this.$s(t);
34
+ this.Ts();
35
+ const n = et.Us.Rs;
36
+ new et(n, E).Ds(n.Fs.As, (t) => {
37
+ this.Ls(t);
38
38
  }),
39
- (this.Bs = null),
40
- (this.N = null),
41
- (this.Es = null),
42
- (this.Ps = null),
43
- (this.Xs = 10);
39
+ (this.Ns = null),
40
+ (this.D = null),
41
+ (this.Js = null),
42
+ (this.Ms = null),
43
+ (this.$s = 10);
44
44
  }
45
- _s() {
46
- return this.Bs;
45
+ Bs() {
46
+ return this.Ns;
47
47
  }
48
- Gs(t) {
49
- this.Bs = t;
48
+ Es(t) {
49
+ this.Ns = t;
50
50
  }
51
- Ct() {
52
- return this.N;
51
+ jt() {
52
+ return this.D;
53
53
  }
54
- Tt(t) {
55
- this.N = t;
54
+ yt(t) {
55
+ this.D = t;
56
56
  }
57
- Ds() {
58
- if (!this.C) return;
59
- const t = this.C.ft(s.gt.Hs) || [],
57
+ Ts() {
58
+ if (!this.j) return;
59
+ const t = this.j.lt(s.ct.Ps) || [],
60
60
  i = [];
61
61
  for (let s = 0; s < t.length; s++) {
62
- const e = tt(t[s]);
62
+ const e = it(t[s]);
63
63
  null != e && i.push(e);
64
64
  }
65
- (this.cards = this.Is(this.Ks(i, !1))),
66
- (this.Rs = this.C.ft(s.gt.Os) || this.Rs),
67
- (this.Us = this.C.ft(s.gt.Qs) || this.Us);
65
+ (this.cards = this.Xs(this._s(i, !1))),
66
+ (this.ys = this.j.lt(s.ct.Gs) || this.ys),
67
+ (this.Ss = this.j.lt(s.ct.Hs) || this.Ss);
68
68
  }
69
- Vs(t, i = !1, e = 0, h = 0) {
69
+ Is(t, i = !1, e = 0, h = 0) {
70
70
  let r;
71
71
  if (i) {
72
72
  r = [];
@@ -81,10 +81,10 @@ export default class Q extends t {
81
81
  break;
82
82
  }
83
83
  if (i) {
84
- const t = Z(e);
84
+ const t = st(e);
85
85
  null != h && h.viewed && t && (t.viewed = !0), null != t && r.push(t);
86
86
  } else if (null == h) {
87
- const t = Z(e);
87
+ const t = st(e);
88
88
  null != t && r.push(t);
89
89
  } else {
90
90
  if (!h.ri(e))
@@ -95,28 +95,28 @@ export default class Q extends t {
95
95
  }
96
96
  }
97
97
  }
98
- (this.cards = this.Is(this.Ks(r, i))),
99
- this.Ws(),
100
- (this.Rs = e),
101
- (this.Us = h),
102
- this.C && (this.C.Bt(s.gt.Os, this.Rs), this.C.Bt(s.gt.Qs, this.Us));
98
+ (this.cards = this.Xs(this._s(r, i))),
99
+ this.Ks(),
100
+ (this.ys = e),
101
+ (this.Ss = h),
102
+ this.j && (this.j.ft(s.ct.Gs, this.ys), this.j.ft(s.ct.Hs, this.Ss));
103
103
  }
104
- U(t) {
105
- if (this.Ys() && null != t && t.cards) {
106
- this.C && this.C.Bt(s.gt.Zs, r.fi());
104
+ N(t) {
105
+ if (this.Os() && null != t && t.cards) {
106
+ this.j && this.j.ft(s.ct.Qs, r.Vs());
107
107
  const i = t.full_sync;
108
- i || this.Ds(),
109
- this.Vs(t.cards, i, t.last_full_sync_at, t.last_card_updated_at),
110
- this.Ts.X(this.di(!0));
108
+ i || this.Ts(),
109
+ this.Is(t.cards, i, t.last_full_sync_at, t.last_card_updated_at),
110
+ this.ws.L(this.Ws(!0));
111
111
  }
112
112
  }
113
- pi(t) {
114
- this.Ci(), (this.Es = t);
113
+ Ys(t) {
114
+ this.Zs(), (this.Js = t);
115
115
  }
116
- $s(t) {
116
+ Ls(t) {
117
117
  var s;
118
- if (!this.Ys()) return;
119
- this.Ds();
118
+ if (!this.Os()) return;
119
+ this.Ts();
120
120
  const i = this.cards.slice();
121
121
  let e = null;
122
122
  e = null === (s = this.Cs) || void 0 === s ? void 0 : s.getUserId();
@@ -130,7 +130,7 @@ export default class Q extends t {
130
130
  break;
131
131
  }
132
132
  if (null == h) {
133
- const t = Z(e);
133
+ const t = st(e);
134
134
  null != t && i.push(t);
135
135
  } else {
136
136
  if (!h.ri(e))
@@ -141,16 +141,16 @@ export default class Q extends t {
141
141
  }
142
142
  }
143
143
  }
144
- (this.cards = this.Is(this.Ks(i, !1))), this.Ws(), this.Ts.X(this.di(!0));
144
+ (this.cards = this.Xs(this._s(i, !1))), this.Ks(), this.ws.L(this.Ws(!0));
145
145
  }
146
- Ks(t, i) {
146
+ _s(t, i) {
147
147
  let e = {},
148
148
  h = {},
149
149
  r = {};
150
- this.C &&
151
- ((e = this.C.ft(s.gt.Kt) || {}),
152
- (h = this.C.ft(s.gt.Yt) || {}),
153
- (r = this.C.ft(s.gt.Vt) || {}));
150
+ this.j &&
151
+ ((e = this.j.lt(s.ct.Et) || {}),
152
+ (h = this.j.lt(s.ct.Pt) || {}),
153
+ (r = this.j.lt(s.ct.Lt) || {}));
154
154
  const n = {},
155
155
  o = {},
156
156
  l = {};
@@ -163,21 +163,21 @@ export default class Q extends t {
163
163
  }
164
164
  return (
165
165
  i &&
166
- this.C &&
167
- (this.C.Bt(s.gt.Kt, n), this.C.Bt(s.gt.Yt, o), this.C.Bt(s.gt.Vt, l)),
166
+ this.j &&
167
+ (this.j.ft(s.ct.Et, n), this.j.ft(s.ct.Pt, o), this.j.ft(s.ct.Lt, l)),
168
168
  t
169
169
  );
170
170
  }
171
- Is(t) {
171
+ Xs(t) {
172
172
  const i = [],
173
173
  e = new Date();
174
174
  let h = {};
175
- this.C && (h = this.C.ft(s.gt.Vt) || {});
175
+ this.j && (h = this.j.lt(s.ct.Lt) || {});
176
176
  let r = !1;
177
177
  for (let s = 0; s < t.length; s++) {
178
178
  const n = t[s].url;
179
- if (!this.Ss && n && Y(n)) {
180
- N.error(
179
+ if (!this.vs && n && tt(n)) {
180
+ E.error(
181
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.`,
182
182
  );
183
183
  continue;
@@ -191,85 +191,85 @@ export default class Q extends t {
191
191
  i && (h[i] = !0), (r = !0);
192
192
  }
193
193
  }
194
- return r && this.C && this.C.Bt(s.gt.Vt, h), i;
194
+ return r && this.j && this.j.ft(s.ct.Lt, h), i;
195
195
  }
196
- Ws() {
196
+ Ks() {
197
197
  var t;
198
198
  const i = [];
199
- for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].bt());
200
- null === (t = this.C) || void 0 === t || t.Bt(s.gt.Hs, i);
199
+ for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].dt());
200
+ null === (t = this.j) || void 0 === t || t.ft(s.ct.Ps, i);
201
201
  }
202
- Ci() {
203
- this.Es && (clearTimeout(this.Es), (this.Es = null));
202
+ Zs() {
203
+ this.Js && (clearTimeout(this.Js), (this.Js = null));
204
204
  }
205
- bi(t, i, e = !1) {
205
+ fi(t, i, e = !1) {
206
206
  var n;
207
- const o = this.S,
208
- u = this.C;
207
+ const o = this.B,
208
+ u = this.j;
209
209
  if (!o || !u) return void ("function" == typeof i && i());
210
- if ((e && (h.vi(u, h.O.wi), this.Ci()), !this.Ys()))
210
+ if ((e && (h.Ci(u, h.H.bi), this.Zs()), !this.Os()))
211
211
  return void (
212
- null === (n = this.B) ||
212
+ null === (n = this.h) ||
213
213
  void 0 === n ||
214
- n.gi(() => {
215
- this.bi(t, i, !0);
214
+ n.vi(() => {
215
+ this.fi(t, i, !0);
216
216
  })
217
217
  );
218
- const c = o.H({}, !0);
219
- u.ft(s.gt.Zs) !== r.fi() && this.ji(),
220
- (c.last_full_sync_at = this.Rs),
221
- (c.last_card_updated_at = this.Us);
222
- const f = o.J(c, h.O.wi, e);
218
+ const c = o.$({}, !0);
219
+ u.lt(s.ct.Qs) !== r.Vs() && this.wi(),
220
+ (c.last_full_sync_at = this.ys),
221
+ (c.last_card_updated_at = this.Ss);
222
+ const f = o.A(c, h.H.bi, e);
223
223
  let d = !1;
224
- o.V(
224
+ o.J(
225
225
  c,
226
226
  (s = -1) => {
227
- if (this.C) {
227
+ if (this.j) {
228
228
  const t = new Date().valueOf();
229
- h.W(this.C, h.O.wi, t);
229
+ h.K(this.j, h.H.bi, t);
230
230
  }
231
231
  -1 !== s && f.push(["X-Braze-Req-Tokens-Remaining", s.toString()]),
232
- l.Y({
233
- url: `${o.Z()}/content_cards/sync`,
232
+ a.O({
233
+ url: `${o.V()}/content_cards/sync`,
234
234
  data: c,
235
235
  headers: f,
236
- tt: (s) => {
237
- if (!o.st(c, s, f))
236
+ W: (s) => {
237
+ if (!o.Y(c, s, f))
238
238
  return (d = !0), void ("function" == typeof i && i());
239
- o.it(), this.U(s), (d = !1), "function" == typeof t && t();
239
+ o.Z(), this.N(s), (d = !1), "function" == typeof t && t();
240
240
  },
241
241
  error: (t) => {
242
- o.et(t, "retrieving content cards"),
242
+ o._(t, "retrieving content cards"),
243
243
  (d = !0),
244
244
  "function" == typeof i && i();
245
245
  },
246
- nt: (s, e) => {
246
+ tt: (s, e) => {
247
247
  let r;
248
248
  if (d) {
249
- let t = this.Ps;
250
- (null == t || t < 1e3 * this.Xs) && (t = 1e3 * this.Xs),
251
- (r = Math.min(3e5, a(1e3 * this.Xs, 3 * t)));
249
+ let t = this.Ms;
250
+ (null == t || t < 1e3 * this.$s) && (t = 1e3 * this.$s),
251
+ (r = Math.min(3e5, l(1e3 * this.$s, 3 * t)));
252
252
  }
253
- o.rt(
253
+ o.st(
254
254
  e,
255
255
  () => {
256
- this.bi(t, i, !1);
256
+ this.fi(t, i, !1);
257
257
  },
258
- h.O.wi,
259
- (t) => this.pi(t),
260
- () => this.Ci(),
258
+ h.H.bi,
259
+ (t) => this.Ys(t),
260
+ () => this.Zs(),
261
261
  r,
262
262
  );
263
263
  },
264
264
  });
265
265
  },
266
- h.O.wi,
266
+ h.H.bi,
267
267
  i,
268
268
  );
269
269
  }
270
- di(t) {
271
- t || this.Ds();
272
- const i = this.Is(this.cards);
270
+ Ws(t) {
271
+ t || this.Ts();
272
+ const i = this.Xs(this.cards);
273
273
  i.sort((t, s) =>
274
274
  t.pinned && !s.pinned
275
275
  ? -1
@@ -281,52 +281,52 @@ export default class Q extends t {
281
281
  ? 1
282
282
  : 0,
283
283
  );
284
- let e = Math.max(this.Us || 0, this.Rs || 0);
284
+ let e = Math.max(this.Ss || 0, this.ys || 0);
285
285
  return (
286
286
  0 === e && (e = void 0),
287
- this.C && this.C.ft(s.gt.Qs) === this.Us && void 0 === e && (e = this.Us),
288
- new ContentCards(i, P(e))
287
+ this.j && this.j.lt(s.ct.Hs) === this.Ss && void 0 === e && (e = this.Ss),
288
+ new ContentCards(i, V(e))
289
289
  );
290
290
  }
291
- qt(t) {
292
- return this.Ts.Dt(t);
291
+ St(t) {
292
+ return this.ws.wt(t);
293
293
  }
294
- ji() {
295
- (this.Rs = 0),
296
- (this.Us = 0),
297
- this.C && (this.C.Ut(s.gt.Os), this.C.Ut(s.gt.Qs));
294
+ wi() {
295
+ (this.ys = 0),
296
+ (this.Ss = 0),
297
+ this.j && (this.j.Nt(s.ct.Gs), this.j.Nt(s.ct.Hs));
298
298
  }
299
299
  changeUser(t) {
300
300
  t ||
301
301
  ((this.cards = []),
302
- this.Ts.X(new ContentCards(this.cards.slice(), null)),
303
- this.C &&
304
- (this.C.Ut(s.gt.Hs),
305
- this.C.Ut(s.gt.Kt),
306
- this.C.Ut(s.gt.Yt),
307
- this.C.Ut(s.gt.Vt))),
308
- this.Ci(),
309
- this.ji();
302
+ this.ws.L(new ContentCards(this.cards.slice(), null)),
303
+ this.j &&
304
+ (this.j.Nt(s.ct.Ps),
305
+ this.j.Nt(s.ct.Et),
306
+ this.j.Nt(s.ct.Pt),
307
+ this.j.Nt(s.ct.Lt))),
308
+ this.Zs(),
309
+ this.wi();
310
310
  }
311
311
  clearData(t) {
312
- (this.Rs = 0),
313
- (this.Us = 0),
312
+ (this.ys = 0),
313
+ (this.Ss = 0),
314
314
  (this.cards = []),
315
- this.Ts.X(new ContentCards(this.cards.slice(), null)),
315
+ this.ws.L(new ContentCards(this.cards.slice(), null)),
316
316
  t &&
317
- this.C &&
318
- (this.C.Ut(s.gt.Hs),
319
- this.C.Ut(s.gt.Kt),
320
- this.C.Ut(s.gt.Yt),
321
- this.C.Ut(s.gt.Vt),
322
- this.C.Ut(s.gt.Os),
323
- this.C.Ut(s.gt.Qs)),
324
- this.Ci();
317
+ this.j &&
318
+ (this.j.Nt(s.ct.Ps),
319
+ this.j.Nt(s.ct.Et),
320
+ this.j.Nt(s.ct.Pt),
321
+ this.j.Nt(s.ct.Lt),
322
+ this.j.Nt(s.ct.Gs),
323
+ this.j.Nt(s.ct.Hs)),
324
+ this.Zs();
325
325
  }
326
- Ys() {
327
- return !!this.B && (!!this.B.yi() || (0 !== this.B.Et() && this.Ri(), !1));
326
+ Os() {
327
+ return !!this.h && (!!this.h.gi() || (0 !== this.h.Ft() && this.ji(), !1));
328
328
  }
329
- Ri() {
330
- this.Ts.X(new ContentCards([], new Date())), this.C && this.C.Ut(s.gt.Hs);
329
+ ji() {
330
+ this.ws.L(new ContentCards([], new Date())), this.j && this.j.Nt(s.ct.Ps);
331
331
  }
332
332
  }
@@ -1,24 +1,32 @@
1
- import rr from "../common/base-feed.js";
2
- import { logCardClick, logCardImpressions } from "../Card/index.js";
1
+ import {
2
+ ControlCard,
3
+ logContentCardClick,
4
+ logContentCardImpressions,
5
+ } from "../Card/index.js";
3
6
  import { requestContentCardsRefresh } from "./request-content-cards-refresh.js";
4
- export default class ContentCards extends rr {
5
- constructor(r, e) {
6
- super(r, e);
7
+ export default class ContentCards {
8
+ constructor(r, t) {
9
+ (this.cards = r),
10
+ (this.lastUpdated = t),
11
+ (this.cards = r),
12
+ (this.lastUpdated = t);
7
13
  }
8
14
  getUnviewedCardCount() {
9
- return super.getUnreadCardCount();
15
+ let r = 0;
16
+ for (const t of this.cards) t.viewed || t instanceof ControlCard || r++;
17
+ return r;
10
18
  }
11
- logCardImpressions(r) {
12
- logCardImpressions(r, !0);
19
+ sr(r) {
20
+ logContentCardImpressions(r);
13
21
  }
14
- logCardClick(r) {
15
- return logCardClick(r, !0);
22
+ nr(r) {
23
+ return logContentCardClick(r);
16
24
  }
17
- sr() {
25
+ dr() {
18
26
  requestContentCardsRefresh();
19
27
  }
20
- nr() {
28
+ ar() {
21
29
  return !0;
22
30
  }
23
31
  }
24
- ContentCards.dr = 6e4;
32
+ (ContentCards.ur = 6e4), (ContentCards.cr = 500), (ContentCards.Cr = 1e4);
@@ -1,5 +1,5 @@
1
- import W from "./content-cards-provider-factory.js";
1
+ import rr from "./content-cards-provider-factory.js";
2
2
  import r from "../managers/braze-instance.js";
3
3
  export function getCachedContentCards() {
4
- if (r.rr()) return W.m().di(!1);
4
+ if (r.rr()) return rr.o().Ws(!1);
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import W from "./content-cards-provider-factory.js";
2
+ import rr from "./content-cards-provider-factory.js";
3
3
  export function requestContentCardsRefresh(e, t) {
4
- if (r.rr()) return W.m().bi(e, t, !0);
4
+ if (r.rr()) return rr.o().fi(e, t, !0);
5
5
  }
@@ -1,16 +1,16 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import W from "./content-cards-provider-factory.js";
2
+ import rr from "./content-cards-provider-factory.js";
3
3
  export function subscribeToContentCardsUpdates(o) {
4
4
  if (!r.rr()) return;
5
- const t = W.m(),
6
- n = t.qt(o);
7
- if (!t.Ct()) {
8
- const o = r.rn();
5
+ const t = rr.o(),
6
+ n = t.St(o);
7
+ if (!t.jt()) {
8
+ const o = r.nn();
9
9
  if (o) {
10
- const r = o.on(() => {
11
- t.bi(void 0, void 0, !0);
10
+ const r = o.rn(() => {
11
+ t.fi(void 0, void 0, !0);
12
12
  });
13
- r && t.Tt(r);
13
+ r && t.yt(r);
14
14
  }
15
15
  }
16
16
  return n;
@@ -1,8 +1,8 @@
1
1
  import r from "../../managers/braze-instance.js";
2
- import { destroyFeedHtml as ee } from "../../common/feed-display.js";
3
- export function hideContentCards(e) {
2
+ import { destroyContentCardsHtml as nn } from "../../common/content-cards-display.js";
3
+ export function hideContentCards(n) {
4
4
  if (!r.rr()) return;
5
- const n = document.querySelectorAll(".ab-feed");
6
- for (let o = 0; o < n.length; o++)
7
- (null == e || (null != e && n[o].parentNode === e)) && ee(n[o]);
5
+ const o = document.querySelectorAll(".ab-feed");
6
+ for (let t = 0; t < o.length; t++)
7
+ (null == n || (null != n && o[t].parentNode === n)) && nn(o[t]);
8
8
  }
@@ -1,44 +1,44 @@
1
- import r, { OPTIONS as w } from "../../managers/braze-instance.js";
1
+ import r, { OPTIONS as z } from "../../managers/braze-instance.js";
2
2
  import { ContentCards, subscribeToContentCardsUpdates } from "../index.js";
3
- import W from "../content-cards-provider-factory.js";
3
+ import rr from "../content-cards-provider-factory.js";
4
+ import { setCardHeight as tn } from "../../Card/display/card-display.js";
5
+ import { logger as E } from "../../../shared-lib/index.js";
4
6
  import {
5
- destroyFeedHtml as ee,
6
- detectFeedImpressions as nn,
7
- feedToHtml as tn,
8
- LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as en,
9
- refreshFeed as on,
10
- registerFeedSubscriptionId as rn,
11
- updateFeedCards as an,
12
- } from "../../common/feed-display.js";
13
- import { setCardHeight as sn } from "../../Card/display/card-display.js";
14
- import { setupFeedUI as fn } from "../../ui/js/index.js";
15
- import { logger as N } from "../../../shared-lib/index.js";
7
+ destroyContentCardsHtml as nn,
8
+ detectContentCardsImpressions as en,
9
+ contentCardsToHtml as on,
10
+ LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as rn,
11
+ refreshContentCardsUI as sn,
12
+ registerContentCardsSubscriptionId as an,
13
+ updateContentCards as cn,
14
+ } from "../../common/content-cards-display.js";
15
+ import { setupFeedUI as fn } from "../../ui/js/feed-css.js";
16
16
  export function showContentCards(n, t) {
17
17
  if (!r.rr()) return;
18
18
  fn();
19
19
  let e = !1;
20
20
  null == n && ((n = document.body), (e = !0));
21
- const o = r.ee(w.tn) || r.ee(w.en) || !1,
22
- i = W.m().di(!1);
23
- "function" == typeof t && an(i, t(i.cards.slice()), i.lastUpdated, null, o);
24
- const a = tn(i, o, e),
25
- s = W.m(),
26
- f = s._s();
27
- (null == i.lastUpdated ||
28
- new Date().valueOf() - i.lastUpdated.valueOf() > ContentCards.dr) &&
29
- (null == f || new Date().valueOf() - f > ContentCards.dr) &&
30
- (N.info(
31
- `Cached content cards were older than max TTL of ${ContentCards.dr} ms, requesting an update from the server.`,
21
+ const o = r.ee(z.tn) || !1,
22
+ s = rr.o().Ws(!1);
23
+ "function" == typeof t && cn(s, t(s.cards.slice()), s.lastUpdated, null, o);
24
+ const a = on(s, o, e),
25
+ i = rr.o(),
26
+ c = i.Bs();
27
+ (null == s.lastUpdated ||
28
+ new Date().valueOf() - s.lastUpdated.valueOf() > ContentCards.ur) &&
29
+ (null == c || new Date().valueOf() - c > ContentCards.ur) &&
30
+ (E.info(
31
+ `Cached content cards were older than max TTL of ${ContentCards.ur} ms, requesting an update from the server.`,
32
32
  ),
33
- on(i, a),
34
- s.Gs(new Date().valueOf()));
35
- const l = new Date().valueOf(),
36
- c = subscribeToContentCardsUpdates(function (n) {
33
+ sn(s, a),
34
+ i.Es(new Date().valueOf()));
35
+ const f = new Date().valueOf(),
36
+ l = subscribeToContentCardsUpdates(function (n) {
37
37
  const e = a.querySelectorAll(".ab-refresh-button")[0];
38
38
  if (null != e) {
39
39
  let n = 500,
40
- t = (n -= new Date().valueOf() - l);
41
- const o = a.getAttribute(en);
40
+ t = (n -= new Date().valueOf() - f);
41
+ const o = a.getAttribute(rn);
42
42
  o && ((t = parseInt(o)), isNaN(t) || (n -= new Date().valueOf() - t)),
43
43
  setTimeout(
44
44
  function () {
@@ -49,22 +49,22 @@ export function showContentCards(n, t) {
49
49
  }
50
50
  let r = n.cards;
51
51
  "function" == typeof t && (r = t(r.slice())),
52
- an(i, r, n.lastUpdated, a, o);
52
+ cn(s, r, n.lastUpdated, a, o);
53
53
  });
54
- rn(c, a);
54
+ an(l, a);
55
55
  const u = function (n) {
56
56
  const t = n.querySelectorAll(".ab-feed");
57
57
  let o = null;
58
58
  for (let e = 0; e < t.length; e++) t[e].parentNode === n && (o = t[e]);
59
59
  null != o
60
- ? (ee(o), null != o.parentNode && o.parentNode.replaceChild(a, o))
60
+ ? (nn(o), null != o.parentNode && o.parentNode.replaceChild(a, o))
61
61
  : n.appendChild(a),
62
62
  setTimeout(function () {
63
63
  a.className = a.className.replace("ab-hide", "ab-show");
64
64
  }, 0),
65
65
  e && a.focus(),
66
- nn(i, a),
67
- sn(i.cards, n);
66
+ en(s, a),
67
+ tn(s.cards, n);
68
68
  };
69
69
  var d;
70
70
  null != n