@braze/web-sdk 5.4.0 → 5.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 (77) hide show
  1. package/index.d.ts +3 -3
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +12 -12
  4. package/shared-lib/indexed-db-adapter.js +14 -14
  5. package/shared-lib/logger.js +2 -2
  6. package/shared-lib/supported-options.js +5 -5
  7. package/src/Card/card-manager.js +46 -42
  8. package/src/Card/models/card.js +61 -55
  9. package/src/Card/models/classic-card.js +1 -1
  10. package/src/Card/models/control-card.js +1 -1
  11. package/src/Card/models/image-only.js +1 -1
  12. package/src/Card/util/card-factory.js +20 -20
  13. package/src/ContentCards/content-cards-provider.js +140 -140
  14. package/src/ContentCards/get-cached-content-cards.js +1 -1
  15. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  16. package/src/ContentCards/subscribe-to-content-cards-updates.js +4 -4
  17. package/src/ContentCards/ui/show-content-cards.js +3 -3
  18. package/src/Core/disable-sdk.js +2 -2
  19. package/src/Core/enable-sdk.js +2 -2
  20. package/src/Core/log-custom-event.js +14 -14
  21. package/src/Core/log-purchase.js +8 -8
  22. package/src/Core/open-session.js +4 -4
  23. package/src/Core/wipe-data.js +2 -2
  24. package/src/FeatureFlags/feature-flag-factory.js +5 -5
  25. package/src/FeatureFlags/feature-flag.js +1 -1
  26. package/src/FeatureFlags/feature-flags-provider.js +74 -74
  27. package/src/FeatureFlags/get-all-feature-flags.js +2 -2
  28. package/src/FeatureFlags/get-feature-flag.js +2 -2
  29. package/src/FeatureFlags/log-feature-flag-impression.js +12 -12
  30. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
  31. package/src/Feed/feed-provider.js +29 -29
  32. package/src/Feed/get-cached-feed.js +1 -1
  33. package/src/Feed/request-feed-refresh.js +1 -1
  34. package/src/Feed/subscribe-to-feed-updates.js +1 -1
  35. package/src/Feed/ui/show-feed.js +1 -1
  36. package/src/InAppMessage/in-app-message-manager.js +63 -63
  37. package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
  38. package/src/InAppMessage/log-in-app-message-click.js +2 -2
  39. package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
  40. package/src/InAppMessage/log-in-app-message-impression.js +1 -1
  41. package/src/InAppMessage/models/full-screen-message.js +10 -10
  42. package/src/InAppMessage/models/html-message.js +13 -13
  43. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  44. package/src/InAppMessage/models/in-app-message.js +59 -59
  45. package/src/InAppMessage/models/modal-message.js +9 -9
  46. package/src/InAppMessage/models/slide-up-message.js +11 -11
  47. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  48. package/src/Push/push-manager-factory.js +4 -4
  49. package/src/Push/push-manager.js +6 -6
  50. package/src/Push/utils/push-utils.js +1 -1
  51. package/src/User/user-manager.js +6 -6
  52. package/src/User/user.js +27 -27
  53. package/src/common/base-provider.js +1 -1
  54. package/src/common/event-logger.js +7 -7
  55. package/src/common/feed-display.js +1 -1
  56. package/src/managers/auth-manager.js +9 -9
  57. package/src/managers/braze-instance.js +44 -44
  58. package/src/managers/network-manager.js +100 -100
  59. package/src/managers/server-config-manager.js +24 -24
  60. package/src/managers/session-manager.js +10 -10
  61. package/src/managers/storage-manager.js +20 -20
  62. package/src/managers/subscription-manager.js +2 -2
  63. package/src/models/backend-errors.js +4 -4
  64. package/src/models/braze-event.js +1 -1
  65. package/src/models/device.js +1 -1
  66. package/src/models/request-result.js +1 -1
  67. package/src/models/server-config.js +5 -5
  68. package/src/request-controller.js +121 -121
  69. package/src/triggers/models/filter.js +9 -9
  70. package/src/triggers/models/trigger-condition.js +26 -26
  71. package/src/triggers/models/trigger-events.js +1 -1
  72. package/src/triggers/models/trigger.js +7 -7
  73. package/src/triggers/triggers-provider.js +27 -27
  74. package/src/ui/js/attach-css.js +1 -1
  75. package/src/util/braze-actions.js +4 -4
  76. package/src/util/net.js +4 -4
  77. package/src/util/request-header-utils.js +17 -17
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Type definitions for @braze/web-sdk v5.4.0
2
+ * Type definitions for @braze/web-sdk v5.5.0
3
3
  * Project: https://github.com/braze-inc/braze-web-sdk
4
4
  * (c) Braze, Inc. 2024 - http://braze.com
5
5
  * License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
@@ -2138,7 +2138,7 @@ export function openSession(): void;
2138
2138
  * - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
2139
2139
  *
2140
2140
  * ```
2141
- * self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.4/service-worker.js');
2141
+ * self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.5/service-worker.js');
2142
2142
  * ```
2143
2143
  *
2144
2144
  * For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
@@ -2518,7 +2518,7 @@ export type InitializationOptions = {
2518
2518
  * lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
2519
2519
  * option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
2520
2520
  * `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
2521
- * `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.4/service-worker.js');` or by including the content
2521
+ * `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.5/service-worker.js');` or by including the content
2522
2522
  * of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
2523
2523
  */
2524
2524
  manageServiceWorkerExternally?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braze/web-sdk",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "description": "Braze SDK for web sites and other JS platforms.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,33 +1,33 @@
1
1
  const i = {
2
2
  CustomEvent: "ce",
3
3
  Pr: "p",
4
- Eu: "pc",
4
+ Ku: "pc",
5
5
  vc: "ca",
6
- Ka: "i",
7
- qs: "ie",
6
+ Ua: "i",
7
+ Ls: "ie",
8
8
  M: "cci",
9
9
  R: "ccic",
10
- I: "ccc",
10
+ k: "ccc",
11
11
  F: "ccd",
12
12
  ql: "ss",
13
13
  xl: "se",
14
- Gi: "si",
14
+ Xi: "si",
15
15
  $i: "sc",
16
- Ei: "sbc",
16
+ Oi: "sbc",
17
17
  Cc: "sfe",
18
18
  mo: "iec",
19
- Bu: "lr",
20
- _u: "uae",
19
+ Ju: "lr",
20
+ Eu: "uae",
21
21
  O: "ci",
22
- $: "cc",
23
- Wu: "lcaa",
24
- Ku: "lcar",
22
+ D: "cc",
23
+ Xu: "lcaa",
24
+ Gu: "lcar",
25
25
  On: "inc",
26
26
  Ln: "add",
27
27
  Rn: "rem",
28
28
  $n: "set",
29
29
  Bn: "ncam",
30
- Gu: "sgu",
30
+ Hu: "sgu",
31
31
  Fr: "ffi",
32
32
  },
33
33
  or = { Ar: "feed_displayed", Ec: "content_cards_displayed" };
@@ -64,11 +64,11 @@ export default class A {
64
64
  "...",
65
65
  );
66
66
  const n = null === (e = t.target) || void 0 === e ? void 0 : e.result;
67
- for (const t in i.database.ss) {
67
+ for (const t in i.database.hs) {
68
68
  const e = t;
69
- i.database.ss.hasOwnProperty(t) &&
70
- !n.objectStoreNames.contains(i.database.ss[e]) &&
71
- n.createObjectStore(i.database.ss[e]);
69
+ i.database.hs.hasOwnProperty(t) &&
70
+ !n.objectStoreNames.contains(i.database.hs[e]) &&
71
+ n.createObjectStore(i.database.hs[e]);
72
72
  }
73
73
  }),
74
74
  (o.onsuccess = (n) => {
@@ -249,7 +249,7 @@ export default class A {
249
249
  };
250
250
  });
251
251
  }
252
- Zt(t, e) {
252
+ ss(t, e) {
253
253
  if (!this.isSupported()) return !1;
254
254
  const n = this;
255
255
  return this.Bd((o) => {
@@ -304,11 +304,11 @@ export default class A {
304
304
  clearData() {
305
305
  if (!this.isSupported()) return !1;
306
306
  const t = [];
307
- for (const e in this.database.ss) {
307
+ for (const e in this.database.hs) {
308
308
  const n = e;
309
- this.database.ss.hasOwnProperty(e) &&
310
- this.database.ss[n] !== this.database.ss.ae &&
311
- t.push(this.database.ss[n]);
309
+ this.database.hs.hasOwnProperty(e) &&
310
+ this.database.hs[n] !== this.database.hs.ae &&
311
+ t.push(this.database.hs[n]);
312
312
  }
313
313
  const e = this;
314
314
  return this.Bd(function (n) {
@@ -333,16 +333,16 @@ export default class A {
333
333
  });
334
334
  }
335
335
  }
336
- A.Yt = {
337
- Qt: {
336
+ A.ts = {
337
+ Zt: {
338
338
  Sd: "AppboyServiceWorkerAsyncStorage",
339
339
  VERSION: 6,
340
- ss: {
341
- La: "data",
340
+ hs: {
341
+ Ka: "data",
342
342
  hr: "pushClicks",
343
343
  cu: "pushSubscribed",
344
344
  Cd: "fallbackDevice",
345
- ts: "cardUpdates",
345
+ es: "cardUpdates",
346
346
  ae: "optOut",
347
347
  wr: "pendingData",
348
348
  jh: "sdkAuthenticationSignature",
@@ -24,13 +24,13 @@ const r = {
24
24
  },
25
25
  warn: function (n) {
26
26
  if (r.zg) {
27
- const o = "Braze SDK Warning: " + n + " (v5.4.0)";
27
+ const o = "Braze SDK Warning: " + n + " (v5.5.0)";
28
28
  null != r.vd ? r.vd(o) : console.warn(o);
29
29
  }
30
30
  },
31
31
  error: function (n) {
32
32
  if (r.zg) {
33
- const o = "Braze SDK Error: " + n + " (v5.4.0)";
33
+ const o = "Braze SDK Error: " + n + " (v5.5.0)";
34
34
  null != r.vd ? r.vd(o) : console.error(o);
35
35
  }
36
36
  },
@@ -3,16 +3,16 @@ export default {
3
3
  _o: "baseUrl",
4
4
  Io: "noCookies",
5
5
  So: "devicePropertyAllowlist",
6
- ka: "disablePushTokenMaintenance",
6
+ Aa: "disablePushTokenMaintenance",
7
7
  Ao: "enableLogging",
8
8
  No: "enableSdkAuthentication",
9
- _a: "manageServiceWorkerExternally",
9
+ qa: "manageServiceWorkerExternally",
10
10
  Oo: "minimumIntervalBetweenTriggerActionsInSeconds",
11
11
  Ro: "sessionTimeoutInSeconds",
12
12
  Po: "appVersion",
13
13
  Lo: "appVersionNumber",
14
- wa: "serviceWorkerLocation",
15
- Ma: "safariWebsitePushId",
14
+ Ma: "serviceWorkerLocation",
15
+ ka: "safariWebsitePushId",
16
16
  zn: "localization",
17
17
  bo: "contentSecurityNonce",
18
18
  Do: "allowUserSuppliedJavascript",
@@ -22,7 +22,7 @@ export default {
22
22
  Lh: "requireExplicitInAppMessageDismissal",
23
23
  Mo: "doNotLoadFontAwesome",
24
24
  Uo: "deviceId",
25
- ya: "serviceWorkerScope",
25
+ _a: "serviceWorkerScope",
26
26
  Wo: "sdkFlavor",
27
27
  tn: "openCardsInNewTab",
28
28
  };
@@ -1,30 +1,30 @@
1
1
  import { ControlCard } from "./models/index.js";
2
- import s from "../common/event-logger.js";
3
- import t from "../models/request-result.js";
2
+ import t from "../common/event-logger.js";
3
+ import s from "../models/request-result.js";
4
4
  import { logger as r, EventTypes as i } from "../../shared-lib/index.js";
5
5
  import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
6
6
  export default class a {
7
- constructor(s) {
8
- (this.u = s), (this.u = s);
7
+ constructor(t) {
8
+ (this.u = t), (this.u = t);
9
9
  }
10
10
  h(n, e) {
11
- const l = new t();
11
+ const l = new s();
12
12
  if ((n.p(), null == n.url || "" === n.url))
13
13
  return (
14
14
  r.info(`Card ${n.id} has no url. Not logging click to Braze servers.`),
15
15
  l
16
16
  );
17
17
  if (e && n.id && this.u) {
18
- const s = this.u.j(o.C.v) || {};
19
- (s[n.id] = !0), this.u.k(o.C.v, s);
18
+ const t = this.u.j(o.C.v) || {};
19
+ (t[n.id] = !0), this.u.I(o.C.v, t);
20
20
  }
21
- const u = this.D([n]);
22
- if (null == u) return l;
23
- const c = e ? i.I : i.$;
24
- return s.q(c, u);
21
+ const a = this.$([n]);
22
+ if (null == a) return l;
23
+ const u = e ? i.k : i.D;
24
+ return t.q(u, a);
25
25
  }
26
26
  B(n) {
27
- const e = new t();
27
+ const e = new s();
28
28
  if (!n.N())
29
29
  return (
30
30
  r.info(
@@ -33,44 +33,48 @@ export default class a {
33
33
  e
34
34
  );
35
35
  if (n.id && this.u) {
36
- const s = this.u.j(o.C.A) || {};
37
- (s[n.id] = !0), this.u.k(o.C.A, s);
36
+ const t = this.u.j(o.C.A) || {};
37
+ (t[n.id] = !0), this.u.I(o.C.A, t);
38
38
  }
39
- const l = this.D([n]);
40
- return null == l ? e : s.q(i.F, l);
39
+ const l = this.$([n]);
40
+ return null == l ? e : t.q(i.F, l);
41
41
  }
42
- G(n, r) {
43
- const e = new t(!0),
44
- l = [],
42
+ G(n, e) {
43
+ const l = new s(!0),
44
+ a = [],
45
45
  u = [];
46
46
  let c = {};
47
- this.u && (c = r ? this.u.j(o.C.H) || {} : this.u.j(o.C.J) || {});
48
- for (const s of n)
49
- s.K(),
50
- s instanceof ControlCard ? u.push(s) : l.push(s),
51
- s.id && (c[s.id] = !0);
52
- const h = this.D(l),
53
- a = this.D(u);
54
- if (null == h && null == a) return (e.L = !1), e;
55
- if ((this.u && (r ? this.u.k(o.C.H, c) : this.u.k(o.C.J, c)), null != h)) {
56
- const t = r ? i.M : i.O,
57
- n = s.q(t, h);
58
- e.P(n);
47
+ this.u && (c = e ? this.u.j(o.C.H) || {} : this.u.j(o.C.J) || {});
48
+ for (const t of n) {
49
+ t.K()
50
+ ? (t instanceof ControlCard ? u.push(t) : a.push(t),
51
+ t.id && (c[t.id] = !0))
52
+ : r.info(
53
+ `Card ${t.id} logged an impression too recently. Ignoring analytics event.`,
54
+ );
59
55
  }
60
- if (null != a && r) {
61
- const t = s.q(i.R, a);
62
- e.P(t);
56
+ const h = this.$(a),
57
+ m = this.$(u);
58
+ if (null == h && null == m) return (l.L = !1), l;
59
+ if ((this.u && (e ? this.u.I(o.C.H, c) : this.u.I(o.C.J, c)), null != h)) {
60
+ const s = e ? i.M : i.O,
61
+ n = t.q(s, h);
62
+ l.P(n);
63
63
  }
64
- return e;
64
+ if (null != m && e) {
65
+ const s = t.q(i.R, m);
66
+ l.P(s);
67
+ }
68
+ return l;
65
69
  }
66
- D(s) {
67
- let t,
70
+ $(t) {
71
+ let s,
68
72
  n = null;
69
- for (let r = 0; r < s.length; r++)
70
- (t = s[r].id),
71
- null != t &&
72
- "" !== t &&
73
- ((n = n || {}), (n.ids = n.ids || []), n.ids.push(t));
73
+ for (let r = 0; r < t.length; r++)
74
+ (s = t[r].id),
75
+ null != s &&
76
+ "" !== s &&
77
+ ((n = n || {}), (n.ids = n.ids || []), n.ids.push(s));
74
78
  return n;
75
79
  }
76
80
  }
@@ -6,13 +6,13 @@ import { FEED_ANIMATION_DURATION as E } from "../../common/constants.js";
6
6
  import T from "../../managers/subscription-manager.js";
7
7
  import r from "../../../shared-lib/logger.js";
8
8
  export default class Card {
9
- constructor(t, i, s, h, l, n, e, r, u, E, o, T, I, a, N, c) {
9
+ constructor(t, i, s, h, n, l, e, r, u, E, o, T, I, a, c, N) {
10
10
  (this.id = t),
11
11
  (this.viewed = i),
12
12
  (this.title = s),
13
13
  (this.imageUrl = h),
14
- (this.description = l),
15
- (this.created = n),
14
+ (this.description = n),
15
+ (this.created = l),
16
16
  (this.updated = e),
17
17
  (this.categories = r),
18
18
  (this.expiresAt = u),
@@ -21,14 +21,14 @@ export default class Card {
21
21
  (this.aspectRatio = T),
22
22
  (this.extras = I),
23
23
  (this.pinned = a),
24
- (this.dismissible = N),
25
- (this.clicked = c),
24
+ (this.dismissible = c),
25
+ (this.clicked = N),
26
26
  (this.id = t),
27
27
  (this.viewed = i || !1),
28
28
  (this.title = s || ""),
29
29
  (this.imageUrl = h),
30
- (this.description = l || ""),
31
- (this.created = n || null),
30
+ (this.description = n || ""),
31
+ (this.created = l || null),
32
32
  (this.updated = e || null),
33
33
  (this.categories = r || []),
34
34
  (this.expiresAt = u || null),
@@ -40,25 +40,26 @@ export default class Card {
40
40
  (this.aspectRatio = isNaN(T) ? null : T)),
41
41
  (this.extras = I || {}),
42
42
  (this.pinned = a || !1),
43
- (this.dismissible = N || !1),
43
+ (this.dismissible = c || !1),
44
44
  (this.dismissed = !1),
45
- (this.clicked = c || !1),
45
+ (this.clicked = N || !1),
46
46
  (this.isControl = !1),
47
47
  (this.test = !1),
48
48
  (this.Et = null),
49
- (this.Tt = null);
49
+ (this.Tt = null),
50
+ (this.It = null);
50
51
  }
51
52
  subscribeToClickedEvent(t) {
52
- return this.Nt().It(t);
53
+ return this.St().Nt(t);
53
54
  }
54
55
  subscribeToDismissedEvent(t) {
55
- return this.St().It(t);
56
+ return this.At().Nt(t);
56
57
  }
57
58
  removeSubscription(t) {
58
- this.Nt().removeSubscription(t), this.St().removeSubscription(t);
59
+ this.St().removeSubscription(t), this.At().removeSubscription(t);
59
60
  }
60
61
  removeAllSubscriptions() {
61
- this.Nt().removeAllSubscriptions(), this.St().removeAllSubscriptions();
62
+ this.St().removeAllSubscriptions(), this.At().removeAllSubscriptions();
62
63
  }
63
64
  dismissCard() {
64
65
  if (!this.dismissible || this.dismissed) return;
@@ -75,65 +76,69 @@ export default class Card {
75
76
  (t.style.margin = "0"),
76
77
  setTimeout(function () {
77
78
  t && t.parentNode && t.parentNode.removeChild(t);
78
- }, Card.At));
79
+ }, Card.Dt));
79
80
  }, E));
80
81
  }
81
- Nt() {
82
+ St() {
82
83
  return null == this.Et && (this.Et = new T()), this.Et;
83
84
  }
84
- St() {
85
+ At() {
85
86
  return null == this.Tt && (this.Tt = new T()), this.Tt;
86
87
  }
87
88
  K() {
88
- this.viewed = !0;
89
+ const t = new Date().valueOf();
90
+ return (
91
+ !(null != this.It && t - this.It < Card.Ct) &&
92
+ ((this.It = t), (this.viewed = !0), !0)
93
+ );
89
94
  }
90
95
  p() {
91
- (this.viewed = !0), (this.clicked = !0), this.Nt().Dt();
96
+ (this.viewed = !0), (this.clicked = !0), this.St().Rt();
92
97
  }
93
98
  N() {
94
99
  return (
95
100
  !(!this.dismissible || this.dismissed) &&
96
- ((this.dismissed = !0), this.St().Dt(), !0)
101
+ ((this.dismissed = !0), this.At().Rt(), !0)
97
102
  );
98
103
  }
99
- Ct(t) {
100
- if (null == t || t[Card.Rt.ht] !== this.id) return !0;
101
- if (t[Card.Rt.Lt]) return !1;
104
+ Lt(t) {
105
+ if (null == t || t[Card._t.ht] !== this.id) return !0;
106
+ if (t[Card._t.Ot]) return !1;
102
107
  if (
103
- null != t[Card.Rt.nt] &&
108
+ null != t[Card._t.nt] &&
104
109
  null != this.updated &&
105
- parseInt(t[Card.Rt.nt]) < h(this.updated.valueOf())
110
+ parseInt(t[Card._t.nt]) < h(this.updated.valueOf())
106
111
  )
107
112
  return !0;
108
113
  if (
109
- (t[Card.Rt.et] && !this.viewed && (this.viewed = !0),
110
- t[Card.Rt.zt] && !this.clicked && (this.clicked = t[Card.Rt.zt]),
111
- null != t[Card.Rt.rt] && (this.title = t[Card.Rt.rt]),
112
- null != t[Card.Rt.ot] && (this.imageUrl = t[Card.Rt.ot]),
113
- null != t[Card.Rt.ct] && (this.description = t[Card.Rt.ct]),
114
- null != t[Card.Rt.nt])
114
+ (t[Card._t.et] && !this.viewed && (this.viewed = !0),
115
+ t[Card._t.zt] && !this.clicked && (this.clicked = t[Card._t.zt]),
116
+ null != t[Card._t.rt] && (this.title = t[Card._t.rt]),
117
+ null != t[Card._t.ot] && (this.imageUrl = t[Card._t.ot]),
118
+ null != t[Card._t.ct] && (this.description = t[Card._t.ct]),
119
+ null != t[Card._t.nt])
115
120
  ) {
116
- const i = l(t[Card.Rt.nt]);
121
+ const i = l(t[Card._t.nt]);
117
122
  null != i && (this.updated = i);
118
123
  }
119
- if (null != t[Card.Rt.lt]) {
124
+ if (null != t[Card._t.lt]) {
120
125
  let i;
121
- (i = t[Card.Rt.lt] === Card._t ? null : l(t[Card.Rt.lt])),
126
+ (i = t[Card._t.lt] === Card.Mt ? null : l(t[Card._t.lt])),
122
127
  (this.expiresAt = i);
123
128
  }
124
129
  if (
125
- (null != t[Card.Rt.URL] && (this.url = t[Card.Rt.URL]),
126
- null != t[Card.Rt.ft] && (this.linkText = t[Card.Rt.ft]),
127
- null != t[Card.Rt.xt])
130
+ (null != t[Card._t.URL] && (this.url = t[Card._t.URL]),
131
+ null != t[Card._t.ft] && (this.linkText = t[Card._t.ft]),
132
+ null != t[Card._t.xt])
128
133
  ) {
129
- const i = parseFloat(t[Card.Rt.xt].toString());
134
+ const i = parseFloat(t[Card._t.xt].toString());
130
135
  this.aspectRatio = isNaN(i) ? null : i;
131
136
  }
132
137
  return (
133
- null != t[Card.Rt.bt] && (this.extras = t[Card.Rt.bt]),
134
- null != t[Card.Rt.gt] && (this.pinned = t[Card.Rt.gt]),
135
- null != t[Card.Rt.jt] && (this.dismissible = t[Card.Rt.jt]),
136
- null != t[Card.Rt.kt] && (this.test = t[Card.Rt.kt]),
138
+ null != t[Card._t.bt] && (this.extras = t[Card._t.bt]),
139
+ null != t[Card._t.gt] && (this.pinned = t[Card._t.gt]),
140
+ null != t[Card._t.jt] && (this.dismissible = t[Card._t.jt]),
141
+ null != t[Card._t.kt] && (this.test = t[Card._t.kt]),
137
142
  !0
138
143
  );
139
144
  }
@@ -141,12 +146,12 @@ export default class Card {
141
146
  r.error("Must be implemented in a subclass");
142
147
  }
143
148
  }
144
- (Card._t = -1),
145
- (Card.Rt = {
149
+ (Card.Mt = -1),
150
+ (Card._t = {
146
151
  ht: "id",
147
152
  et: "v",
148
153
  jt: "db",
149
- Lt: "r",
154
+ Ot: "r",
150
155
  nt: "ca",
151
156
  gt: "p",
152
157
  lt: "ea",
@@ -163,10 +168,10 @@ export default class Card {
163
168
  }),
164
169
  (Card.it = {
165
170
  st: "captioned_image",
166
- Ot: "text_announcement",
167
- Mt: "short_news",
168
- Pt: "banner_image",
169
- Ut: "control",
171
+ Pt: "text_announcement",
172
+ Ut: "short_news",
173
+ Gt: "banner_image",
174
+ Xt: "control",
170
175
  }),
171
176
  (Card.tt = {
172
177
  ht: "id",
@@ -188,10 +193,11 @@ export default class Card {
188
193
  zt: "cl",
189
194
  kt: "s",
190
195
  }),
191
- (Card.Gt = {
192
- Xt: "ADVERTISING",
193
- vt: "ANNOUNCEMENTS",
194
- Vt: "NEWS",
195
- Wt: "SOCIAL",
196
+ (Card.vt = {
197
+ Vt: "ADVERTISING",
198
+ Wt: "ANNOUNCEMENTS",
199
+ wt: "NEWS",
200
+ Ft: "SOCIAL",
196
201
  }),
197
- (Card.At = 400);
202
+ (Card.Dt = 400),
203
+ (Card.Ct = 1e4);
@@ -8,7 +8,7 @@ export default class ClassicCard extends Card {
8
8
  Y() {
9
9
  const s = {};
10
10
  return (
11
- (s[Card.tt.Z] = Card.it.Mt),
11
+ (s[Card.tt.Z] = Card.it.Ut),
12
12
  (s[Card.tt.ht] = this.id),
13
13
  (s[Card.tt.et] = this.viewed),
14
14
  (s[Card.tt.rt] = this.title),
@@ -9,7 +9,7 @@ export default class ControlCard extends Card {
9
9
  Y() {
10
10
  const l = {};
11
11
  return (
12
- (l[Card.tt.Z] = Card.it.Ut),
12
+ (l[Card.tt.Z] = Card.it.Xt),
13
13
  (l[Card.tt.ht] = this.id),
14
14
  (l[Card.tt.et] = this.viewed),
15
15
  (l[Card.tt.nt] = this.updated),
@@ -9,7 +9,7 @@ export default class ImageOnly extends Card {
9
9
  Y() {
10
10
  const s = {};
11
11
  return (
12
- (s[Card.tt.Z] = Card.it.Pt),
12
+ (s[Card.tt.Z] = Card.it.Gt),
13
13
  (s[Card.tt.ht] = this.id),
14
14
  (s[Card.tt.et] = this.viewed),
15
15
  (s[Card.tt.ot] = this.imageUrl),
@@ -12,31 +12,31 @@ import {
12
12
  import { logger as r } from "../../../shared-lib/index.js";
13
13
  export function newCard(n, e, t, o, i, l, u, d, a, w, f, s, m, C, p, c, x, F) {
14
14
  let j;
15
- if (e === Card.it.Ot || e === Card.it.Mt)
15
+ if (e === Card.it.Pt || e === Card.it.Ut)
16
16
  j = new ClassicCard(n, t, o, i, l, u, d, a, w, f, s, m, C, p, c, x);
17
17
  else if (e === Card.it.st)
18
18
  j = new CaptionedImage(n, t, o, i, l, u, d, a, w, f, s, m, C, p, c, x);
19
- else if (e === Card.it.Pt)
19
+ else if (e === Card.it.Gt)
20
20
  j = new ImageOnly(n, t, i, u, d, a, w, f, s, m, C, p, c, x);
21
21
  else {
22
- if (e !== Card.it.Ut)
22
+ if (e !== Card.it.Xt)
23
23
  return r.error("Ignoring card with unknown type " + e), null;
24
24
  j = new ControlCard(n, t, d, w, C, p);
25
25
  }
26
26
  return F && (j.test = F), j;
27
27
  }
28
28
  export function newCardFromContentCardsJson(n) {
29
- if (n[Card.Rt.Lt]) return null;
30
- const e = n[Card.Rt.ht],
31
- r = n[Card.Rt.Z],
32
- t = n[Card.Rt.et],
33
- o = n[Card.Rt.rt],
34
- i = n[Card.Rt.ot],
35
- u = n[Card.Rt.ct],
36
- d = l(n[Card.Rt.nt]),
29
+ if (n[Card._t.Ot]) return null;
30
+ const e = n[Card._t.ht],
31
+ r = n[Card._t.Z],
32
+ t = n[Card._t.et],
33
+ o = n[Card._t.rt],
34
+ i = n[Card._t.ot],
35
+ u = n[Card._t.ct],
36
+ d = l(n[Card._t.nt]),
37
37
  a = d;
38
38
  let w;
39
- w = n[Card.Rt.lt] === Card._t ? null : l(n[Card.Rt.lt]);
39
+ w = n[Card._t.lt] === Card.Mt ? null : l(n[Card._t.lt]);
40
40
  return newCard(
41
41
  e,
42
42
  r,
@@ -48,14 +48,14 @@ export function newCardFromContentCardsJson(n) {
48
48
  d,
49
49
  null,
50
50
  w,
51
- n[Card.Rt.URL],
52
- n[Card.Rt.ft],
53
- n[Card.Rt.xt],
54
- n[Card.Rt.bt],
55
- n[Card.Rt.gt],
56
- n[Card.Rt.jt],
57
- n[Card.Rt.zt],
58
- n[Card.Rt.kt] || !1,
51
+ n[Card._t.URL],
52
+ n[Card._t.ft],
53
+ n[Card._t.xt],
54
+ n[Card._t.bt],
55
+ n[Card._t.gt],
56
+ n[Card._t.jt],
57
+ n[Card._t.zt],
58
+ n[Card._t.kt] || !1,
59
59
  );
60
60
  }
61
61
  export function newCardFromFeedJson(n) {