@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,125 +1,127 @@
1
1
  import { createCloseButton as T } from "../../util/component-utils.js";
2
- import { detectSwipe as H, DIRECTIONS as R } from "../../util/dom-utils.js";
3
- import { _handleBrazeAction as G } from "../../Core/handle-braze-action.js";
2
+ import { detectSwipe as K, DIRECTIONS as L } from "../../util/dom-utils.js";
3
+ import { _handleBrazeAction as O } from "../../Core/handle-braze-action.js";
4
4
  import { logCardDismissal } from "../index.js";
5
- import { Guid as K } from "../../../shared-lib/index.js";
5
+ import { Guid as P } from "../../../shared-lib/index.js";
6
6
  export function markCardAsRead(t) {
7
7
  if (null != t) {
8
8
  const e = t.querySelectorAll(".ab-unread-indicator")[0];
9
- null != e && (e.className += " read");
9
+ null == e || e.classList.contains("read") || (e.className += " read");
10
10
  }
11
11
  }
12
12
  export function getCardId(t) {
13
13
  return t.getAttribute("data-ab-card-id");
14
14
  }
15
15
  export function _setImageAltText(t, e) {
16
- let o = "";
17
- t.title || t.description || (o = "Feed Image"), e.setAttribute("alt", o);
16
+ e.setAttribute("alt", t.altImageText || "");
18
17
  }
19
18
  export function setCardHeight(t, e) {
20
- const o = e.querySelectorAll(".ab-image-area");
21
- let a,
19
+ const a = e.querySelectorAll(".ab-image-area");
20
+ let o,
22
21
  i = 0;
23
- o.length > 0 && (i = o[0].offsetWidth);
22
+ a.length > 0 && (i = a[0].offsetWidth);
24
23
  for (const e of t)
25
- if (((a = e.te), a && e.imageUrl && "number" == typeof e.aspectRatio)) {
24
+ if (((o = e._t), o && e.imageUrl && "number" == typeof e.aspectRatio)) {
26
25
  const t = i / e.aspectRatio;
27
- t && (a.style.height = `${t}px`);
26
+ t && (o.style.height = `${t}px`);
28
27
  }
29
28
  }
30
- export function cardToHtml(t, logCardClick, e, o = "ltr") {
31
- const a = document.createElement("div");
32
- (a.dir = o),
33
- (a.className = "ab-card ab-effect-card " + t.oe),
29
+ export function cardToHtml(t, e, a, o = "ltr") {
30
+ const i = document.createElement("div");
31
+ (i.dir = o),
32
+ t.language && (i.lang = t.language),
33
+ (i.className = "ab-card ab-effect-card " + t.Xt),
34
34
  t.id &&
35
- (a.setAttribute("data-ab-card-id", t.id), a.setAttribute("id", t.id)),
36
- a.setAttribute("role", "article"),
37
- a.setAttribute("tabindex", "0");
38
- let i = "",
39
- n = !1;
40
- t.url && "" !== t.url && ((i = t.url), (n = !0));
41
- const d = (o) => (markCardAsRead(a), n && (logCardClick(t), G(i, e, o)), !1);
35
+ (i.setAttribute("data-ab-card-id", t.id), i.setAttribute("id", t.id)),
36
+ i.setAttribute("role", "article");
37
+ let n = "",
38
+ d = !1;
39
+ t.url && "" !== t.url && ((n = t.url), (d = !0));
40
+ const r = (o) => (markCardAsRead(i), d && (e(t), O(n, a, o)), !1);
42
41
  if (t.pinned) {
43
42
  const t = document.createElement("div");
44
43
  t.className = "ab-pinned-indicator";
45
44
  const e = document.createElement("i");
46
- (e.className = "fa fa-star"), t.appendChild(e), a.appendChild(t);
45
+ (e.className = "fa fa-star"), t.appendChild(e), i.appendChild(t);
47
46
  }
48
47
  if (t.imageUrl && "" !== t.imageUrl) {
49
48
  const e = document.createElement("div");
50
49
  (e.dir = o), (e.className = "ab-image-area");
51
- const r = document.createElement("img");
50
+ const a = document.createElement("img");
52
51
  if (
53
- (r.setAttribute("src", t.imageUrl),
54
- (r.onload = () => {
55
- a.style.height = "auto";
52
+ (a.setAttribute("src", t.imageUrl),
53
+ (a.onload = () => {
54
+ i.style.height = "auto";
56
55
  }),
57
- _setImageAltText(t, r),
58
- e.appendChild(r),
59
- (a.className += " with-image"),
60
- n && !t.ae)
56
+ _setImageAltText(t, a),
57
+ e.appendChild(a),
58
+ (i.className += " with-image"),
59
+ d && !t.Yt)
61
60
  ) {
62
- const t = document.createElement("a");
63
- t.setAttribute("href", i),
64
- (t.onclick = d),
65
- t.appendChild(e),
66
- a.appendChild(t);
67
- } else a.appendChild(e);
61
+ const a = document.createElement("a");
62
+ a.setAttribute("href", n),
63
+ (a.onclick = r),
64
+ t.altImageText ||
65
+ (t.title
66
+ ? a.setAttribute("aria-label", t.title)
67
+ : a.setAttribute("aria-label", "Feed Image")),
68
+ a.appendChild(e),
69
+ i.appendChild(a);
70
+ } else i.appendChild(e);
68
71
  }
69
- const r = document.createElement("div");
70
- if (((r.className = "ab-card-body"), (r.dir = o), t.dismissible)) {
72
+ const c = document.createElement("div");
73
+ if (((c.className = "ab-card-body"), (c.dir = o), t.dismissible)) {
71
74
  t.logCardDismissal = () => logCardDismissal(t);
72
75
  const e = T("Dismiss Card", void 0, t.dismissCard.bind(t), o);
73
- a.appendChild(e),
74
- H(r, R.ie, (t) => {
75
- (a.className += " ab-swiped-left"), e.onclick(t);
76
+ i.appendChild(e),
77
+ K(c, L.Zt, (t) => {
78
+ (i.className += " ab-swiped-left"), e.onclick(t);
76
79
  }),
77
- H(r, R.de, (t) => {
78
- (a.className += " ab-swiped-right"), e.onclick(t);
80
+ K(c, L.ae, (t) => {
81
+ (i.className += " ab-swiped-right"), e.onclick(t);
79
82
  });
80
83
  }
81
- let c = "",
82
- s = !1;
83
- if ((t.title && "" !== t.title && ((c = t.title), (s = !0)), s)) {
84
+ let s = "",
85
+ m = !1;
86
+ if ((t.title && "" !== t.title && ((s = t.title), (m = !0)), m)) {
84
87
  const t = document.createElement("h1");
85
88
  if (
86
89
  ((t.className = "ab-title"),
87
- (t.id = K.ce()),
88
- a.setAttribute("aria-labelledby", t.id),
89
- n)
90
+ (t.id = P.oe()),
91
+ i.setAttribute("aria-labelledby", t.id),
92
+ d)
90
93
  ) {
91
94
  const e = document.createElement("a");
92
- e.setAttribute("href", i),
93
- (e.onclick = d),
94
- e.appendChild(document.createTextNode(c)),
95
+ e.setAttribute("href", n),
96
+ (e.onclick = r),
97
+ e.appendChild(document.createTextNode(s)),
95
98
  t.appendChild(e);
96
- } else t.appendChild(document.createTextNode(c));
97
- r.appendChild(t);
99
+ } else t.appendChild(document.createTextNode(s));
100
+ c.appendChild(t);
98
101
  }
99
- const m = document.createElement("div");
102
+ const u = document.createElement("div");
100
103
  if (
101
- ((m.className = s ? "ab-description" : "ab-description ab-no-title"),
102
- (m.id = K.ce()),
103
- a.setAttribute("aria-describedby", m.id),
104
- t.description && m.appendChild(document.createTextNode(t.description)),
105
- n)
104
+ ((u.className = m ? "ab-description" : "ab-description ab-no-title"),
105
+ t.language && (u.lang = t.language),
106
+ t.description && u.appendChild(document.createTextNode(t.description)),
107
+ d)
106
108
  ) {
107
109
  const e = document.createElement("div");
108
110
  e.className = "ab-url-area";
109
- const o = document.createElement("a");
110
- o.setAttribute("href", i),
111
- t.linkText && o.appendChild(document.createTextNode(t.linkText)),
112
- (o.onclick = d),
113
- e.appendChild(o),
114
- m.appendChild(e);
111
+ const a = document.createElement("a");
112
+ a.setAttribute("href", n),
113
+ t.linkText && a.appendChild(document.createTextNode(t.linkText)),
114
+ (a.onclick = r),
115
+ e.appendChild(a),
116
+ u.appendChild(e);
115
117
  }
116
- r.appendChild(m), a.appendChild(r);
117
- const u = document.createElement("div");
118
+ c.appendChild(u), i.appendChild(c);
119
+ const l = document.createElement("div");
118
120
  return (
119
- (u.className = "ab-unread-indicator"),
120
- t.viewed && (u.className += " read"),
121
- a.appendChild(u),
122
- (t.te = a),
123
- a
121
+ (l.className = "ab-unread-indicator"),
122
+ t.viewed && (l.className += " read"),
123
+ i.appendChild(l),
124
+ (t._t = i),
125
+ i
124
126
  );
125
127
  }
package/src/Card/index.js CHANGED
@@ -1,6 +1,4 @@
1
1
  export * from "./models/index.js";
2
- export { logCardClick } from "./log-card-click.js";
3
2
  export { logCardDismissal } from "./log-card-dismissal.js";
4
- export { logCardImpressions } from "./log-card-impressions.js";
5
3
  export { logContentCardImpressions } from "./log-content-card-impressions.js";
6
4
  export { logContentCardClick } from "./log-content-card-click.js";
@@ -1,11 +1,11 @@
1
1
  import { Card } from "./models/index.js";
2
- import _ from "./card-manager-factory.js";
3
- import { MUST_BE_CARD_WARNING_SUFFIX as L } from "../common/constants.js";
2
+ import G from "./card-manager-factory.js";
3
+ import { MUST_BE_CARD_WARNING_SUFFIX as Q } from "../common/constants.js";
4
4
  import r from "../managers/braze-instance.js";
5
- import { logger as N } from "../../shared-lib/index.js";
5
+ import { logger as E } from "../../shared-lib/index.js";
6
6
  export function logCardDismissal(o) {
7
7
  return (
8
8
  !!r.rr() &&
9
- (o instanceof Card ? _.ea().Pt(o).tt : (N.error("card " + L), !1))
9
+ (o instanceof Card ? G.ea().Jt(o).W : (E.error("card " + Q), !1))
10
10
  );
11
11
  }
@@ -1,4 +1,11 @@
1
- import { logCardClick } from "./log-card-click.js";
1
+ import E from "../../shared-lib/logger.js";
2
+ import { MUST_BE_CARD_WARNING_SUFFIX as Q } from "../common/constants.js";
3
+ import r from "../managers/braze-instance.js";
4
+ import G from "./card-manager-factory.js";
5
+ import { Card } from "./models/index.js";
2
6
  export function logContentCardClick(o) {
3
- return logCardClick(o, !0);
7
+ return (
8
+ !!r.rr() &&
9
+ (o instanceof Card ? G.ea().logClick(o).W : (E.error("card " + Q), !1))
10
+ );
4
11
  }
@@ -1,4 +1,13 @@
1
- import { logCardImpressions } from "./log-card-impressions.js";
1
+ import { Card } from "./models/index.js";
2
+ import r from "../managers/braze-instance.js";
3
+ import { isArray as D } from "../util/code-utils.js";
4
+ import E from "../../shared-lib/logger.js";
5
+ import { MUST_BE_CARD_WARNING_SUFFIX as Q } from "../common/constants.js";
6
+ import G from "./card-manager-factory.js";
2
7
  export function logContentCardImpressions(o) {
3
- return logCardImpressions(o, !0);
8
+ if (!r.rr()) return !1;
9
+ if (!D(o)) return E.error("cards must be an array"), !1;
10
+ for (const r of o)
11
+ if (!(r instanceof Card)) return E.error(`Each card in cards ${Q}`), !1;
12
+ return G.ea().Ot(o).W;
4
13
  }
@@ -2,31 +2,31 @@ import Card from "./card.js";
2
2
  export default class CaptionedImage extends Card {
3
3
  constructor(t, s, i, h, e, r, a, o, c, n, d, p, u, l, m, f) {
4
4
  super(t, s, i, h, e, r, a, o, c, n, d, p, u, l, m, f),
5
- (this.oe = "ab-captioned-image"),
6
- (this.ae = !0),
5
+ (this.Xt = "ab-captioned-image"),
6
+ (this.Yt = !0),
7
7
  (this.test = !1);
8
8
  }
9
- bt() {
9
+ dt() {
10
10
  const t = {};
11
11
  return (
12
- (t[Card.es.hs] = Card.cs.os),
13
- (t[Card.es.ds] = this.id),
14
- (t[Card.es.ps] = this.viewed),
15
- (t[Card.es.us] = this.title),
16
- (t[Card.es.ls] = this.imageUrl),
17
- (t[Card.es.fs] = this.description),
18
- (t[Card.es.xs] = this.updated),
19
- (t[Card.es.bs] = this.created),
20
- (t[Card.es.gs] = this.categories),
21
- (t[Card.es.js] = this.expiresAt),
22
- (t[Card.es.URL] = this.url),
23
- (t[Card.es.zs] = this.linkText),
24
- (t[Card.es.ks] = this.aspectRatio),
25
- (t[Card.es.qs] = this.extras),
26
- (t[Card.es.vs] = this.pinned),
27
- (t[Card.es.ws] = this.dismissible),
28
- (t[Card.es.ys] = this.clicked),
29
- (t[Card.es.As] = this.test),
12
+ (t[Card.ss.ts] = Card.es.hs),
13
+ (t[Card.ss.rs] = this.id),
14
+ (t[Card.ss.os] = this.viewed),
15
+ (t[Card.ss.cs] = this.title),
16
+ (t[Card.ss.ns] = this.imageUrl),
17
+ (t[Card.ss.ds] = this.description),
18
+ (t[Card.ss.ps] = this.updated),
19
+ (t[Card.ss.us] = this.expiresAt),
20
+ (t[Card.ss.URL] = this.url),
21
+ (t[Card.ss.ls] = this.linkText),
22
+ (t[Card.ss.fs] = this.aspectRatio),
23
+ (t[Card.ss.xs] = this.extras),
24
+ (t[Card.ss.bs] = this.pinned),
25
+ (t[Card.ss.gs] = this.dismissible),
26
+ (t[Card.ss.js] = this.clicked),
27
+ (t[Card.ss.zs] = this.language),
28
+ (t[Card.ss.ks] = this.altImageText),
29
+ (t[Card.ss.qs] = this.test),
30
30
  t
31
31
  );
32
32
  }
@@ -1,70 +1,70 @@
1
1
  import {
2
- convertMsToSeconds as O,
3
- dateFromUnixTimestamp as P,
2
+ convertMsToSeconds as X,
3
+ dateFromUnixTimestamp as V,
4
4
  } from "../../util/date-utils.js";
5
- import { FEED_ANIMATION_DURATION as X } from "../../common/constants.js";
5
+ import { FEED_ANIMATION_DURATION as W } from "../../common/constants.js";
6
6
  import u from "../../managers/subscription-manager.js";
7
- import N from "../../../shared-lib/logger.js";
7
+ import E from "../../../shared-lib/logger.js";
8
8
  export default class Card {
9
- constructor(t, i, s, h, n, l, e, r, u, E, o, T, I, a, c, N) {
9
+ constructor(t, i, s, h, l, n, e, r, u, E, T, o, a, I, N, A) {
10
10
  (this.id = t),
11
11
  (this.viewed = i),
12
12
  (this.title = s),
13
13
  (this.imageUrl = h),
14
- (this.description = n),
15
- (this.created = l),
16
- (this.updated = e),
17
- (this.categories = r),
18
- (this.expiresAt = u),
19
- (this.url = E),
20
- (this.linkText = o),
21
- (this.aspectRatio = T),
22
- (this.extras = I),
23
- (this.pinned = a),
24
- (this.dismissible = c),
25
- (this.clicked = N),
14
+ (this.description = l),
15
+ (this.updated = n),
16
+ (this.expiresAt = e),
17
+ (this.url = r),
18
+ (this.linkText = u),
19
+ (this.aspectRatio = E),
20
+ (this.extras = T),
21
+ (this.pinned = o),
22
+ (this.dismissible = a),
23
+ (this.clicked = I),
24
+ (this.language = N),
25
+ (this.altImageText = A),
26
26
  (this.id = t),
27
27
  (this.viewed = i || !1),
28
28
  (this.title = s || ""),
29
29
  (this.imageUrl = h),
30
- (this.description = n || ""),
31
- (this.created = l || null),
32
- (this.updated = e || null),
33
- (this.categories = r || []),
34
- (this.expiresAt = u || null),
35
- (this.url = E),
36
- (this.linkText = o),
37
- null == T
30
+ (this.description = l || ""),
31
+ (this.updated = n || null),
32
+ (this.expiresAt = e || null),
33
+ (this.url = r),
34
+ (this.linkText = u),
35
+ null == E
38
36
  ? (this.aspectRatio = null)
39
- : ((T = parseFloat(T.toString())),
40
- (this.aspectRatio = isNaN(T) ? null : T)),
41
- (this.extras = I || {}),
42
- (this.pinned = a || !1),
43
- (this.dismissible = c || !1),
37
+ : ((E = parseFloat(E.toString())),
38
+ (this.aspectRatio = isNaN(E) ? null : E)),
39
+ (this.extras = T || {}),
40
+ (this.pinned = o || !1),
41
+ (this.dismissible = a || !1),
44
42
  (this.dismissed = !1),
45
- (this.clicked = N || !1),
43
+ (this.clicked = I || !1),
46
44
  (this.isControl = !1),
45
+ (this.language = N || null),
46
+ (this.altImageText = A || null),
47
47
  (this.test = !1),
48
48
  (this.ti = null),
49
49
  (this.ii = null),
50
50
  (this.si = null);
51
51
  }
52
52
  subscribeToClickedEvent(t) {
53
- return this.hi().Dt(t);
53
+ return this.hi().wt(t);
54
54
  }
55
55
  subscribeToDismissedEvent(t) {
56
- return this.ni().Dt(t);
56
+ return this.li().wt(t);
57
57
  }
58
58
  removeSubscription(t) {
59
- this.hi().removeSubscription(t), this.ni().removeSubscription(t);
59
+ this.hi().removeSubscription(t), this.li().removeSubscription(t);
60
60
  }
61
61
  removeAllSubscriptions() {
62
- this.hi().removeAllSubscriptions(), this.ni().removeAllSubscriptions();
62
+ this.hi().removeAllSubscriptions(), this.li().removeAllSubscriptions();
63
63
  }
64
64
  dismissCard() {
65
65
  if (!this.dismissible || this.dismissed) return;
66
66
  "function" == typeof this.logCardDismissal && this.logCardDismissal();
67
- let t = this.te;
67
+ let t = this._t;
68
68
  !t && this.id && (t = document.getElementById(this.id)),
69
69
  t &&
70
70
  ((t.style.height = t.offsetHeight + "px"),
@@ -76,16 +76,16 @@ export default class Card {
76
76
  (t.style.margin = "0"),
77
77
  setTimeout(function () {
78
78
  t && t.parentNode && t.parentNode.removeChild(t);
79
- }, Card.li));
80
- }, X));
79
+ }, Card.ni));
80
+ }, W));
81
81
  }
82
82
  hi() {
83
83
  return null == this.ti && (this.ti = new u()), this.ti;
84
84
  }
85
- ni() {
85
+ li() {
86
86
  return null == this.ii && (this.ii = new u()), this.ii;
87
87
  }
88
- _t() {
88
+ Qt() {
89
89
  const t = new Date().valueOf();
90
90
  return (
91
91
  !(null != this.si && t - this.si < Card.ei) &&
@@ -93,111 +93,117 @@ export default class Card {
93
93
  );
94
94
  }
95
95
  $t() {
96
- (this.viewed = !0), (this.clicked = !0), this.hi().X();
96
+ (this.viewed = !0), (this.clicked = !0), this.hi().L();
97
97
  }
98
- Qt() {
98
+ Kt() {
99
99
  return (
100
100
  !(!this.dismissible || this.dismissed) &&
101
- ((this.dismissed = !0), this.ni().X(), !0)
101
+ ((this.dismissed = !0), this.li().L(), !0)
102
102
  );
103
103
  }
104
104
  ri(t) {
105
- if (null == t || t[Card.ui.ds] !== this.id) return !0;
105
+ if (null == t || t[Card.ui.rs] !== this.id) return !0;
106
106
  if (t[Card.ui.Ei]) return !1;
107
107
  if (
108
- null != t[Card.ui.xs] &&
108
+ null != t[Card.ui.ps] &&
109
109
  null != this.updated &&
110
- parseInt(t[Card.ui.xs]) < O(this.updated.valueOf())
110
+ parseInt(t[Card.ui.ps]) < X(this.updated.valueOf())
111
111
  )
112
112
  return !0;
113
113
  if (
114
- (t[Card.ui.ps] && !this.viewed && (this.viewed = !0),
115
- t[Card.ui.ys] && !this.clicked && (this.clicked = t[Card.ui.ys]),
116
- null != t[Card.ui.us] && (this.title = t[Card.ui.us]),
117
- null != t[Card.ui.ls] && (this.imageUrl = t[Card.ui.ls]),
118
- null != t[Card.ui.fs] && (this.description = t[Card.ui.fs]),
119
- null != t[Card.ui.xs])
114
+ (t[Card.ui.os] && !this.viewed && (this.viewed = !0),
115
+ t[Card.ui.js] && !this.clicked && (this.clicked = t[Card.ui.js]),
116
+ null != t[Card.ui.cs] && (this.title = t[Card.ui.cs]),
117
+ null != t[Card.ui.ns] && (this.imageUrl = t[Card.ui.ns]),
118
+ null != t[Card.ui.ds] && (this.description = t[Card.ui.ds]),
119
+ null != t[Card.ui.ps])
120
120
  ) {
121
- const i = P(t[Card.ui.xs]);
121
+ const i = V(t[Card.ui.ps]);
122
122
  null != i && (this.updated = i);
123
123
  }
124
- if (null != t[Card.ui.js]) {
124
+ if (null != t[Card.ui.us]) {
125
125
  let i;
126
- (i = t[Card.ui.js] === Card.oi ? null : P(t[Card.ui.js])),
126
+ (i = t[Card.ui.us] === Card.Ti ? null : V(t[Card.ui.us])),
127
127
  (this.expiresAt = i);
128
128
  }
129
129
  if (
130
130
  (null != t[Card.ui.URL] && (this.url = t[Card.ui.URL]),
131
- null != t[Card.ui.zs] && (this.linkText = t[Card.ui.zs]),
132
- null != t[Card.ui.ks])
131
+ null != t[Card.ui.ls] && (this.linkText = t[Card.ui.ls]),
132
+ null != t[Card.ui.fs])
133
133
  ) {
134
- const i = parseFloat(t[Card.ui.ks].toString());
134
+ const i = parseFloat(t[Card.ui.fs].toString());
135
135
  this.aspectRatio = isNaN(i) ? null : i;
136
136
  }
137
137
  return (
138
- null != t[Card.ui.qs] && (this.extras = t[Card.ui.qs]),
139
- null != t[Card.ui.vs] && (this.pinned = t[Card.ui.vs]),
140
- null != t[Card.ui.ws] && (this.dismissible = t[Card.ui.ws]),
141
- null != t[Card.ui.As] && (this.test = t[Card.ui.As]),
138
+ null != t[Card.ui.xs] && (this.extras = t[Card.ui.xs]),
139
+ null != t[Card.ui.bs] && (this.pinned = t[Card.ui.bs]),
140
+ null != t[Card.ui.gs] && (this.dismissible = t[Card.ui.gs]),
141
+ null != t[Card.ui.zs] && (this.language = t[Card.ui.zs]),
142
+ null != t[Card.ui.ks] && (this.altImageText = t[Card.ui.ks]),
143
+ null != t[Card.ui.qs] && (this.test = t[Card.ui.qs]),
142
144
  !0
143
145
  );
144
146
  }
145
- bt() {
146
- N.error("Must be implemented in a subclass");
147
+ dt() {
148
+ E.error("Must be implemented in a subclass");
147
149
  }
148
150
  }
149
- (Card.oi = -1),
151
+ (Card.Ti = -1),
150
152
  (Card.ui = {
151
- ds: "id",
152
- ps: "v",
153
- ws: "db",
153
+ rs: "id",
154
+ os: "v",
155
+ gs: "db",
154
156
  Ei: "r",
155
- xs: "ca",
156
- vs: "p",
157
- js: "ea",
158
- qs: "e",
159
- hs: "tp",
160
- ls: "i",
161
- us: "tt",
162
- fs: "ds",
157
+ ps: "ca",
158
+ bs: "p",
159
+ us: "ea",
160
+ xs: "e",
161
+ ts: "tp",
162
+ ns: "i",
163
+ cs: "tt",
164
+ ds: "ds",
163
165
  URL: "u",
164
- zs: "dm",
165
- ks: "ar",
166
- ys: "cl",
167
- As: "t",
168
- }),
169
- (Card.cs = {
170
- os: "captioned_image",
171
- Ti: "text_announcement",
172
- Ii: "short_news",
173
- ai: "banner_image",
174
- ci: "control",
166
+ ls: "dm",
167
+ fs: "ar",
168
+ js: "cl",
169
+ qs: "t",
170
+ zs: "language",
171
+ ks: "image_alt",
175
172
  }),
176
173
  (Card.es = {
177
- ds: "id",
178
- ps: "v",
179
- ws: "db",
180
- bs: "cr",
181
- xs: "ca",
182
- vs: "p",
183
- gs: "t",
184
- js: "ea",
185
- qs: "e",
186
- hs: "tp",
187
- ls: "i",
188
- us: "tt",
189
- fs: "ds",
174
+ hs: "captioned_image",
175
+ oi: "text_announcement",
176
+ ai: "short_news",
177
+ Ii: "banner_image",
178
+ Ni: "control",
179
+ }),
180
+ (Card.ss = {
181
+ rs: "id",
182
+ os: "v",
183
+ gs: "db",
184
+ Ai: "cr",
185
+ ps: "ca",
186
+ bs: "p",
187
+ ci: "t",
188
+ us: "ea",
189
+ xs: "e",
190
+ ts: "tp",
191
+ ns: "i",
192
+ cs: "tt",
193
+ ds: "ds",
190
194
  URL: "u",
191
- zs: "dm",
192
- ks: "ar",
193
- ys: "cl",
194
- As: "s",
195
+ ls: "dm",
196
+ fs: "ar",
197
+ js: "cl",
198
+ qs: "s",
199
+ zs: "l",
200
+ ks: "ia",
195
201
  }),
196
- (Card.Ni = {
197
- mi: "ADVERTISING",
198
- Si: "ANNOUNCEMENTS",
199
- Ai: "NEWS",
200
- Di: "SOCIAL",
202
+ (Card.mi = {
203
+ Si: "ADVERTISING",
204
+ Di: "ANNOUNCEMENTS",
205
+ pi: "NEWS",
206
+ di: "SOCIAL",
201
207
  }),
202
- (Card.li = 400),
208
+ (Card.ni = 400),
203
209
  (Card.ei = 1e4);