@braze/web-sdk 4.7.2 → 4.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 (161) hide show
  1. package/index.d.ts +27 -24
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +5 -5
  4. package/shared-lib/encoding-utils.js +1 -1
  5. package/shared-lib/event-types.js +24 -24
  6. package/shared-lib/guid.js +3 -3
  7. package/shared-lib/indexed-db-adapter.js +17 -17
  8. package/shared-lib/logger.js +18 -18
  9. package/shared-lib/supported-options.js +18 -18
  10. package/src/Card/card-manager-factory.js +2 -2
  11. package/src/Card/card-manager.js +47 -41
  12. package/src/Card/display/card-display.js +70 -67
  13. package/src/Card/log-card-click.js +1 -1
  14. package/src/Card/log-card-dismissal.js +1 -1
  15. package/src/Card/log-card-impressions.js +3 -3
  16. package/src/Card/models/banner.js +3 -2
  17. package/src/Card/models/captioned-image.js +6 -5
  18. package/src/Card/models/card.js +107 -87
  19. package/src/Card/models/classic-card.js +5 -5
  20. package/src/Card/models/control-card.js +5 -21
  21. package/src/Card/types.js +1 -0
  22. package/src/Card/util/card-factory.js +32 -32
  23. package/src/ContentCards/content-cards-provider-factory.js +3 -3
  24. package/src/ContentCards/content-cards-provider.js +283 -175
  25. package/src/ContentCards/content-cards.js +2 -2
  26. package/src/ContentCards/get-cached-content-cards.js +1 -1
  27. package/src/ContentCards/log-content-cards-displayed.js +2 -2
  28. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  29. package/src/ContentCards/subscribe-to-content-cards-updates.js +9 -6
  30. package/src/ContentCards/types.js +1 -0
  31. package/src/ContentCards/ui/hide-content-cards.js +2 -2
  32. package/src/ContentCards/ui/show-content-cards.js +35 -33
  33. package/src/Core/add-sdk-metadata.js +17 -18
  34. package/src/Core/change-user.js +12 -14
  35. package/src/Core/destroy.js +1 -1
  36. package/src/Core/disable-sdk.js +7 -6
  37. package/src/Core/enable-sdk.js +4 -4
  38. package/src/Core/get-device-id.js +7 -6
  39. package/src/Core/get-user.js +1 -1
  40. package/src/Core/handle-braze-action.js +57 -40
  41. package/src/Core/is-disabled.js +2 -2
  42. package/src/Core/log-custom-event.js +22 -15
  43. package/src/Core/log-purchase.js +33 -33
  44. package/src/Core/open-session.js +17 -15
  45. package/src/Core/request-immediate-data-flush.js +4 -2
  46. package/src/Core/set-logger.js +1 -1
  47. package/src/Core/set-sdk-authentication-signature.js +5 -6
  48. package/src/Core/subscribe-to-sdk-authentication-failures.js +3 -1
  49. package/src/Core/toggle-logging.js +1 -1
  50. package/src/Core/types.js +1 -0
  51. package/src/Core/wipe-data.js +11 -10
  52. package/src/FeatureFlags/feature-flag-factory.js +6 -6
  53. package/src/FeatureFlags/feature-flag.js +17 -17
  54. package/src/FeatureFlags/feature-flags-provider-factory.js +2 -2
  55. package/src/FeatureFlags/feature-flags-provider.js +67 -65
  56. package/src/FeatureFlags/get-all-feature-flags.js +3 -3
  57. package/src/FeatureFlags/get-feature-flag.js +4 -4
  58. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -1
  59. package/src/Feed/feed-provider-factory.js +8 -8
  60. package/src/Feed/feed-provider.js +57 -46
  61. package/src/Feed/feed.js +1 -1
  62. package/src/Feed/get-cached-feed.js +2 -2
  63. package/src/Feed/log-feed-displayed.js +3 -1
  64. package/src/Feed/request-feed-refresh.js +2 -2
  65. package/src/Feed/subscribe-to-feed-updates.js +2 -2
  66. package/src/Feed/types.js +1 -0
  67. package/src/Feed/ui/hide-feed.js +2 -2
  68. package/src/Feed/ui/show-feed.js +40 -36
  69. package/src/InAppMessage/display/html-message-to-html.js +125 -119
  70. package/src/InAppMessage/display/in-app-message-to-html.js +72 -69
  71. package/src/InAppMessage/display/modal-utils.js +18 -13
  72. package/src/InAppMessage/in-app-message-factory.js +9 -8
  73. package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
  74. package/src/InAppMessage/in-app-message-manager.js +122 -108
  75. package/src/InAppMessage/log-in-app-message-button-click.js +10 -10
  76. package/src/InAppMessage/log-in-app-message-click.js +9 -9
  77. package/src/InAppMessage/log-in-app-message-html-click.js +10 -10
  78. package/src/InAppMessage/log-in-app-message-impression.js +5 -5
  79. package/src/InAppMessage/models/control-message.js +4 -1
  80. package/src/InAppMessage/models/full-screen-message.js +35 -37
  81. package/src/InAppMessage/models/html-message.js +34 -33
  82. package/src/InAppMessage/models/in-app-message-button.js +23 -16
  83. package/src/InAppMessage/models/in-app-message.js +147 -105
  84. package/src/InAppMessage/models/modal-message.js +34 -36
  85. package/src/InAppMessage/models/slide-up-message.js +25 -27
  86. package/src/InAppMessage/models/templated-in-app-message.js +12 -7
  87. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  88. package/src/InAppMessage/types.js +1 -0
  89. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +4 -4
  90. package/src/InAppMessage/ui/show-in-app-message.js +95 -89
  91. package/src/InAppMessage/utils/in-app-message-utils.js +1 -0
  92. package/src/Push/is-push-blocked.js +2 -2
  93. package/src/Push/is-push-permission-granted.js +2 -2
  94. package/src/Push/is-push-supported.js +2 -2
  95. package/src/Push/push-manager-factory.js +20 -20
  96. package/src/Push/push-manager.js +192 -174
  97. package/src/Push/request-push-permission.js +4 -3
  98. package/src/Push/types.js +1 -0
  99. package/src/Push/unregister-push.js +2 -2
  100. package/src/Push/utils/push-utils.js +10 -10
  101. package/src/User/types.js +1 -0
  102. package/src/User/user-manager.js +24 -24
  103. package/src/User/user.js +117 -105
  104. package/src/common/base-feed.js +7 -7
  105. package/src/common/base-provider.js +2 -2
  106. package/src/common/constants.js +6 -0
  107. package/src/common/event-logger.js +6 -6
  108. package/src/common/feed-display.js +18 -18
  109. package/src/common/types.js +1 -0
  110. package/src/l10n/l10n-manager-factory.js +5 -5
  111. package/src/l10n/l10n-manager.js +1 -1
  112. package/src/managers/auth-manager.js +32 -32
  113. package/src/managers/braze-instance.js +202 -202
  114. package/src/managers/device-manager.js +23 -23
  115. package/src/managers/network-manager.js +96 -82
  116. package/src/managers/server-config-manager.js +60 -42
  117. package/src/managers/session-manager.js +41 -41
  118. package/src/managers/storage-manager-factory.js +15 -15
  119. package/src/managers/storage-manager.js +163 -160
  120. package/src/managers/subscription-manager.js +11 -11
  121. package/src/models/backend-errors.js +5 -5
  122. package/src/models/braze-event.js +7 -7
  123. package/src/models/device.js +2 -2
  124. package/src/models/identifier.js +7 -7
  125. package/src/models/push-token.js +7 -7
  126. package/src/models/request-result.js +3 -3
  127. package/src/models/server-config.js +20 -20
  128. package/src/request-controller.js +176 -174
  129. package/src/triggers/models/custom-event-data.js +6 -6
  130. package/src/triggers/models/custom-event-property-data.js +9 -9
  131. package/src/triggers/models/filter-set.js +9 -9
  132. package/src/triggers/models/filter.js +64 -64
  133. package/src/triggers/models/in-app-message-click-data.js +12 -12
  134. package/src/triggers/models/purchase-data.js +3 -3
  135. package/src/triggers/models/purchase-property-data.js +9 -9
  136. package/src/triggers/models/push-click-data.js +5 -5
  137. package/src/triggers/models/trigger-condition.js +52 -52
  138. package/src/triggers/models/trigger-events.js +2 -2
  139. package/src/triggers/models/trigger.js +36 -36
  140. package/src/triggers/triggers-provider-factory.js +8 -8
  141. package/src/triggers/triggers-provider.js +165 -162
  142. package/src/types.js +1 -0
  143. package/src/ui/js/attach-css.js +3 -3
  144. package/src/ui/js/load-font-awesome.js +2 -2
  145. package/src/util/base-device-parser.js +1 -1
  146. package/src/util/braze-actions.js +20 -20
  147. package/src/util/browser-detector.js +22 -22
  148. package/src/util/client-hints-parser.js +6 -6
  149. package/src/util/code-utils.js +1 -1
  150. package/src/util/color-utils.js +2 -2
  151. package/src/util/component-utils.js +2 -2
  152. package/src/util/deprecation-utils.js +1 -1
  153. package/src/util/device-constants.js +5 -5
  154. package/src/util/dom-utils.js +2 -2
  155. package/src/util/key-codes.js +1 -1
  156. package/src/util/net.js +11 -11
  157. package/src/util/request-header-utils.js +23 -0
  158. package/src/util/string-utils.js +1 -1
  159. package/src/util/user-agent-parser.js +20 -20
  160. package/src/util/validation-utils.js +44 -44
  161. package/src/util/window-utils.js +3 -3
@@ -1,4 +1,4 @@
1
- import { createCloseButton as i } from "../../util/component-utils.js";
1
+ import { createCloseButton as o } from "../../util/component-utils.js";
2
2
  import { detectSwipe as d, DIRECTIONS as c } from "../../util/dom-utils.js";
3
3
  import { _handleBrazeAction as m } from "../../Core/handle-braze-action.js";
4
4
  import { logCardDismissal } from "../index.js";
@@ -9,13 +9,13 @@ export function topHadImpression(t) {
9
9
  return null != t && !!t.getAttribute("data-ab-had-top-impression");
10
10
  }
11
11
  export function impressOnTop(t) {
12
- null != t && t.setAttribute("data-ab-had-top-impression", !0);
12
+ null != t && t.setAttribute("data-ab-had-top-impression", "true");
13
13
  }
14
14
  export function bottomHadImpression(t) {
15
15
  return null != t && !!t.getAttribute("data-ab-had-bottom-impression");
16
16
  }
17
17
  export function impressOnBottom(t) {
18
- null != t && t.setAttribute("data-ab-had-bottom-impression", !0);
18
+ null != t && t.setAttribute("data-ab-had-bottom-impression", "true");
19
19
  }
20
20
  export function markCardAsRead(t) {
21
21
  if (null != t) {
@@ -27,28 +27,30 @@ export function getCardId(t) {
27
27
  return t.getAttribute("data-ab-card-id");
28
28
  }
29
29
  export function _setImageAltText(t, o) {
30
- let a = "";
31
- t.title || t.description || (a = "Feed Image"), o.setAttribute("alt", a);
30
+ let e = "";
31
+ t.title || t.description || (e = "Feed Image"), o.setAttribute("alt", e);
32
32
  }
33
33
  export function setCardHeight(t, o) {
34
- const a = o.querySelectorAll(".ab-image-area");
35
- let e,
34
+ const e = o.querySelectorAll(".ab-image-area");
35
+ let a,
36
36
  n = 0;
37
- a.length > 0 && (n = a[0].offsetWidth);
37
+ e.length > 0 && (n = e[0].offsetWidth);
38
38
  for (const o of t)
39
- if (((e = o.X), e && o.imageUrl && !isNaN(o.aspectRatio))) {
39
+ if (((a = o._), a && o.imageUrl && "number" == typeof o.aspectRatio)) {
40
40
  const t = n / o.aspectRatio;
41
- t && (e.style.height = `${t}px`);
41
+ t && (a.style.height = `${t}px`);
42
42
  }
43
43
  }
44
- export function cardToHtml(t, logCardClick, o) {
44
+ export function cardToHtml(t, logCardClick, e) {
45
45
  const a = document.createElement("div");
46
- (a.className = "ab-card ab-effect-card " + t.Y),
47
- a.setAttribute("data-ab-card-id", t.id),
46
+ (a.className = "ab-card ab-effect-card " + t.U),
47
+ t.id && a.setAttribute("data-ab-card-id", t.id),
48
48
  a.setAttribute("role", "article"),
49
49
  a.setAttribute("tabindex", "0");
50
- const e = t.url && "" !== t.url,
51
- n = n => (markCardAsRead(a), e && (logCardClick(t), m(t.url, n, o)), !1);
50
+ let n = "",
51
+ i = !1;
52
+ t.url && "" !== t.url && ((n = t.url), (i = !0));
53
+ const s = o => (markCardAsRead(a), i && (logCardClick(t), m(n, e, o)), !1);
52
54
  if (t.pinned) {
53
55
  const t = document.createElement("div");
54
56
  t.className = "ab-pinned-indicator";
@@ -58,77 +60,78 @@ export function cardToHtml(t, logCardClick, o) {
58
60
  if (t.imageUrl && "" !== t.imageUrl) {
59
61
  const o = document.createElement("div");
60
62
  o.className = "ab-image-area";
61
- const i = document.createElement("img");
63
+ const e = document.createElement("img");
62
64
  if (
63
- (i.setAttribute("src", t.imageUrl),
64
- (i.onload = () => {
65
+ (e.setAttribute("src", t.imageUrl),
66
+ (e.onload = () => {
65
67
  a.style.height = "auto";
66
68
  }),
67
- _setImageAltText(t, i),
68
- o.appendChild(i),
69
+ _setImageAltText(t, e),
70
+ o.appendChild(e),
69
71
  (a.className += " with-image"),
70
- e && !t.Z)
72
+ i && !t.V)
71
73
  ) {
72
- const e = document.createElement("a");
73
- e.setAttribute("href", t.url),
74
- (e.onclick = n),
75
- e.appendChild(o),
76
- a.appendChild(e);
74
+ const t = document.createElement("a");
75
+ t.setAttribute("href", n),
76
+ (t.onclick = s),
77
+ t.appendChild(o),
78
+ a.appendChild(t);
77
79
  } else a.appendChild(o);
78
80
  }
79
- const s = document.createElement("div");
80
- if (((s.className = "ab-card-body"), t.dismissible)) {
81
- t.tt = () => logCardDismissal(t);
82
- const o = i("Dismiss Card", void 0, t.dismissCard.bind(t));
83
- a.appendChild(o),
84
- d(s, c.ot, t => {
85
- (a.className += " ab-swiped-left"), o.onclick(t);
81
+ const u = document.createElement("div");
82
+ if (((u.className = "ab-card-body"), t.dismissible)) {
83
+ t.logCardDismissal = () => logCardDismissal(t);
84
+ const e = o("Dismiss Card", void 0, t.dismissCard.bind(t));
85
+ a.appendChild(e),
86
+ d(u, c.W, t => {
87
+ (a.className += " ab-swiped-left"), e.onclick(t);
86
88
  }),
87
- d(s, c.et, t => {
88
- (a.className += " ab-swiped-right"), o.onclick(t);
89
+ d(u, c.X, t => {
90
+ (a.className += " ab-swiped-right"), e.onclick(t);
89
91
  });
90
92
  }
91
- const u = t.title && "" !== t.title;
92
- if (u) {
93
- const o = document.createElement("h1");
93
+ let p = "",
94
+ b = !1;
95
+ if ((t.title && "" !== t.title && ((p = t.title), (b = !0)), b)) {
96
+ const t = document.createElement("h1");
94
97
  if (
95
- ((o.className = "ab-title"),
96
- (o.id = r.it.nt()),
97
- a.setAttribute("aria-labelledby", o.id),
98
- e)
98
+ ((t.className = "ab-title"),
99
+ (t.id = r.Z.Y()),
100
+ a.setAttribute("aria-labelledby", t.id),
101
+ i)
99
102
  ) {
100
- const a = document.createElement("a");
101
- a.setAttribute("href", t.url),
102
- (a.onclick = n),
103
- a.appendChild(document.createTextNode(t.title)),
104
- o.appendChild(a);
105
- } else o.appendChild(document.createTextNode(t.title));
106
- s.appendChild(o);
103
+ const o = document.createElement("a");
104
+ o.setAttribute("href", n),
105
+ (o.onclick = s),
106
+ o.appendChild(document.createTextNode(p)),
107
+ t.appendChild(o);
108
+ } else t.appendChild(document.createTextNode(p));
109
+ u.appendChild(t);
107
110
  }
108
- const p = document.createElement("div");
111
+ const l = document.createElement("div");
109
112
  if (
110
- ((p.className = u ? "ab-description" : "ab-description ab-no-title"),
111
- (p.id = r.it.nt()),
112
- a.setAttribute("aria-describedby", p.id),
113
- p.appendChild(document.createTextNode(t.description)),
114
- e)
113
+ ((l.className = b ? "ab-description" : "ab-description ab-no-title"),
114
+ (l.id = r.Z.Y()),
115
+ a.setAttribute("aria-describedby", l.id),
116
+ t.description && l.appendChild(document.createTextNode(t.description)),
117
+ i)
115
118
  ) {
116
119
  const o = document.createElement("div");
117
120
  o.className = "ab-url-area";
118
- const a = document.createElement("a");
119
- a.setAttribute("href", t.url),
120
- a.appendChild(document.createTextNode(t.linkText)),
121
- (a.onclick = n),
122
- o.appendChild(a),
123
- p.appendChild(o);
121
+ const e = document.createElement("a");
122
+ e.setAttribute("href", n),
123
+ t.linkText && e.appendChild(document.createTextNode(t.linkText)),
124
+ (e.onclick = s),
125
+ o.appendChild(e),
126
+ l.appendChild(o);
124
127
  }
125
- s.appendChild(p), a.appendChild(s);
126
- const b = document.createElement("div");
128
+ u.appendChild(l), a.appendChild(u);
129
+ const f = document.createElement("div");
127
130
  return (
128
- (b.className = "ab-unread-indicator"),
129
- t.viewed && (b.className += " read"),
130
- a.appendChild(b),
131
- (t.X = a),
131
+ (f.className = "ab-unread-indicator"),
132
+ t.viewed && (f.className += " read"),
133
+ a.appendChild(f),
134
+ (t._ = a),
132
135
  a
133
136
  );
134
137
  }
@@ -6,6 +6,6 @@ import r from "../../shared-lib/braze-shared-lib.js";
6
6
  export function logCardClick(o, a) {
7
7
  return (
8
8
  !!e.rr() &&
9
- (o instanceof Card ? n.m().C(o, a).S : (r.D.error("card " + f), !1))
9
+ (o instanceof Card ? n.m().h(o, a).O : (r.j.error("card " + f), !1))
10
10
  );
11
11
  }
@@ -6,6 +6,6 @@ import r from "../../shared-lib/braze-shared-lib.js";
6
6
  export function logCardDismissal(o) {
7
7
  return (
8
8
  !!e.rr() &&
9
- (o instanceof Card ? n.m().H(o).S : (r.D.error("card " + f), !1))
9
+ (o instanceof Card ? n.m().A(o).O : (r.j.error("card " + f), !1))
10
10
  );
11
11
  }
@@ -6,8 +6,8 @@ import { MUST_BE_CARD_WARNING_SUFFIX as f } from "../common/constants.js";
6
6
  import r from "../../shared-lib/braze-shared-lib.js";
7
7
  export function logCardImpressions(o, s) {
8
8
  if (!e.rr()) return !1;
9
- if (!p(o)) return r.D.error("cards must be an array"), !1;
9
+ if (!p(o)) return r.j.error("cards must be an array"), !1;
10
10
  for (const s of o)
11
- if (!(s instanceof Card)) return r.D.error(`Each card in cards ${f}`), !1;
12
- return n.m().M(o, s).S;
11
+ if (!(s instanceof Card)) return r.j.error(`Each card in cards ${f}`), !1;
12
+ return n.m().J(o, s).O;
13
13
  }
@@ -2,8 +2,9 @@ import Card from "./card.js";
2
2
  export default class Banner extends Card {
3
3
  constructor(s, t, i, h, r, e, n, l, a, o, u, c, d, p) {
4
4
  super(s, t, null, i, null, h, r, e, n, l, a, o, u, c, d, p),
5
- (this.Y = "ab-banner"),
6
- (this.Z = !1);
5
+ (this.U = "ab-banner"),
6
+ (this.V = !1),
7
+ (this.test = !1);
7
8
  }
8
9
  ss() {
9
10
  const s = {};
@@ -2,18 +2,19 @@ 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.Y = "ab-captioned-image"),
6
- (this.Z = !0);
5
+ (this.U = "ab-captioned-image"),
6
+ (this.V = !0),
7
+ (this.test = !1);
7
8
  }
8
9
  ss() {
9
10
  const t = {};
10
11
  return (
11
- (t[Card.hs.ts] = Card.es.st),
12
+ (t[Card.hs.ts] = Card.es.tt),
12
13
  (t[Card.hs.ns] = this.id),
13
14
  (t[Card.hs.ls] = this.viewed),
14
- (t[Card.hs.ht] = this.title),
15
+ (t[Card.hs.st] = this.title),
15
16
  (t[Card.hs.os] = this.imageUrl),
16
- (t[Card.hs.rt] = this.description),
17
+ (t[Card.hs.it] = this.description),
17
18
  (t[Card.hs.us] = this.updated),
18
19
  (t[Card.hs.cs] = this.created),
19
20
  (t[Card.hs.ds] = this.categories),
@@ -1,151 +1,171 @@
1
1
  import {
2
- convertMsToSeconds as l,
3
- dateFromUnixTimestamp as h
2
+ convertMsToSeconds as h,
3
+ dateFromUnixTimestamp as l
4
4
  } from "../../util/date-utils.js";
5
- import { FEED_ANIMATION_DURATION as E } from "../../common/constants.js";
6
- import u from "../../managers/subscription-manager.js";
5
+ import { FEED_ANIMATION_DURATION as u } from "../../common/constants.js";
6
+ import E from "../../managers/subscription-manager.js";
7
7
  export default class Card {
8
- constructor(t, i, s, n, l, h, e, r, E, u, T, o, I, a, N, S) {
8
+ constructor(t, i, s, h, n, l, e, r, u, E, o, T, I, a, N, c) {
9
9
  (this.id = t),
10
+ (this.viewed = i),
11
+ (this.title = s),
12
+ (this.imageUrl = h),
13
+ (this.description = n),
14
+ (this.created = l),
15
+ (this.updated = e),
16
+ (this.categories = r),
17
+ (this.expiresAt = u),
18
+ (this.url = E),
19
+ (this.linkText = o),
20
+ (this.aspectRatio = T),
21
+ (this.extras = I),
22
+ (this.pinned = a),
23
+ (this.dismissible = N),
24
+ (this.clicked = c),
25
+ (this.id = t),
10
26
  (this.viewed = i || !1),
11
27
  (this.title = s || ""),
12
- (this.imageUrl = n),
13
- (this.description = l || ""),
14
- (this.created = h || null),
28
+ (this.imageUrl = h),
29
+ (this.description = n || ""),
30
+ (this.created = l || null),
15
31
  (this.updated = e || null),
16
32
  (this.categories = r || []),
17
- (this.expiresAt = E || null),
18
- (this.url = u),
19
- (this.linkText = T),
20
- (o = parseFloat(o)),
21
- (this.aspectRatio = isNaN(o) ? null : o),
33
+ (this.expiresAt = u || null),
34
+ (this.url = E),
35
+ (this.linkText = o),
36
+ null == T
37
+ ? (this.aspectRatio = null)
38
+ : ((T = parseFloat(T.toString())),
39
+ (this.aspectRatio = isNaN(T) ? null : T)),
22
40
  (this.extras = I || {}),
23
41
  (this.pinned = a || !1),
24
42
  (this.dismissible = N || !1),
25
43
  (this.dismissed = !1),
26
- (this.clicked = S || !1),
44
+ (this.clicked = c || !1),
27
45
  (this.isControl = !1),
28
46
  (this.test = !1),
29
- (this.lt = null),
30
- (this.Et = null);
47
+ (this.ht = null),
48
+ (this.nt = null);
31
49
  }
32
50
  subscribeToClickedEvent(t) {
33
- return this.Tt().ut(t);
51
+ return this.et().lt(t);
34
52
  }
35
53
  subscribeToDismissedEvent(t) {
36
- return this.It().ut(t);
54
+ return this.rt().lt(t);
37
55
  }
38
56
  removeSubscription(t) {
39
- this.Tt().removeSubscription(t), this.It().removeSubscription(t);
57
+ this.et().removeSubscription(t), this.rt().removeSubscription(t);
40
58
  }
41
59
  removeAllSubscriptions() {
42
- this.Tt().removeAllSubscriptions(), this.It().removeAllSubscriptions();
60
+ this.et().removeAllSubscriptions(), this.rt().removeAllSubscriptions();
43
61
  }
44
62
  dismissCard() {
45
- if (this.dismissible && !this.dismissed) {
46
- this.tt && this.tt(this);
47
- var t = this.X;
48
- t &&
49
- ((t.style.height = t.offsetHeight + "px"),
50
- (t.className = t.className + " ab-hide"),
51
- setTimeout(function() {
52
- t &&
53
- t.parentNode &&
54
- ((t.style.height = "0"),
55
- (t.style.margin = "0"),
56
- setTimeout(function() {
57
- t && t.parentNode && t.parentNode.removeChild(t);
58
- }, Card.Nt));
59
- }, E));
60
- }
63
+ if (!this.dismissible || this.dismissed) return;
64
+ "function" == typeof this.logCardDismissal && this.logCardDismissal();
65
+ const t = this._;
66
+ t &&
67
+ ((t.style.height = t.offsetHeight + "px"),
68
+ (t.className = t.className + " ab-hide"),
69
+ setTimeout(function() {
70
+ t &&
71
+ t.parentNode &&
72
+ ((t.style.height = "0"),
73
+ (t.style.margin = "0"),
74
+ setTimeout(function() {
75
+ t && t.parentNode && t.parentNode.removeChild(t);
76
+ }, Card.ut));
77
+ }, u));
61
78
  }
62
- Tt() {
63
- return null == this.lt && (this.lt = new u()), this.lt;
79
+ et() {
80
+ return null == this.ht && (this.ht = new E()), this.ht;
64
81
  }
65
- It() {
66
- return null == this.Et && (this.Et = new u()), this.Et;
82
+ rt() {
83
+ return null == this.nt && (this.nt = new E()), this.nt;
67
84
  }
68
- R() {
85
+ M() {
69
86
  this.viewed = !0;
70
87
  }
71
- k() {
72
- (this.viewed = !0), (this.clicked = !0), this.Tt().St();
88
+ p() {
89
+ (this.viewed = !0), (this.clicked = !0), this.et().Et();
73
90
  }
74
- J() {
91
+ F() {
75
92
  return (
76
93
  !(!this.dismissible || this.dismissed) &&
77
- ((this.dismissed = !0), this.It().St(), !0)
94
+ ((this.dismissed = !0), this.rt().Et(), !0)
78
95
  );
79
96
  }
80
- ct(t) {
81
- if (null == t || t[Card.At.ns] !== this.id) return !0;
82
- if (t[Card.At.Dt]) return !1;
97
+ ot(t) {
98
+ if (null == t || t[Card.Tt.ns] !== this.id) return !0;
99
+ if (t[Card.Tt.It]) return !1;
83
100
  if (
84
- null != t[Card.At.us] &&
101
+ null != t[Card.Tt.us] &&
85
102
  null != this.updated &&
86
- t[Card.At.us] < l(this.updated.valueOf())
103
+ parseInt(t[Card.Tt.us]) < h(this.updated.valueOf())
87
104
  )
88
105
  return !0;
89
106
  if (
90
- (t[Card.At.ls] && !this.viewed && (this.viewed = !0),
91
- t[Card.At.gs] && !this.clicked && (this.clicked = t[Card.At.gs]),
92
- null != t[Card.At.ht] && (this.title = t[Card.At.ht]),
93
- null != t[Card.At.os] && (this.imageUrl = t[Card.At.os]),
94
- null != t[Card.At.rt] && (this.description = t[Card.At.rt]),
95
- null != t[Card.At.us])
107
+ (t[Card.Tt.ls] && !this.viewed && (this.viewed = !0),
108
+ t[Card.Tt.gs] && !this.clicked && (this.clicked = t[Card.Tt.gs]),
109
+ null != t[Card.Tt.st] && (this.title = t[Card.Tt.st]),
110
+ null != t[Card.Tt.os] && (this.imageUrl = t[Card.Tt.os]),
111
+ null != t[Card.Tt.it] && (this.description = t[Card.Tt.it]),
112
+ null != t[Card.Tt.us])
96
113
  ) {
97
- const i = h(t[Card.At.us]);
114
+ const i = l(t[Card.Tt.us]);
98
115
  null != i && (this.updated = i);
99
116
  }
100
- if (null != t[Card.At.ps]) {
117
+ if (null != t[Card.Tt.ps]) {
101
118
  let i;
102
- (i = t[Card.At.ps] === Card.Ct ? null : h(t[Card.At.ps])),
119
+ (i = t[Card.Tt.ps] === Card.Nt ? null : l(t[Card.Tt.ps])),
103
120
  (this.expiresAt = i);
104
121
  }
105
122
  if (
106
- (null != t[Card.At.URL] && (this.url = t[Card.At.URL]),
107
- null != t[Card.At.bs] && (this.linkText = t[Card.At.bs]),
108
- null != t[Card.At.fs])
123
+ (null != t[Card.Tt.URL] && (this.url = t[Card.Tt.URL]),
124
+ null != t[Card.Tt.bs] && (this.linkText = t[Card.Tt.bs]),
125
+ null != t[Card.Tt.fs])
109
126
  ) {
110
- const i = parseFloat(t[Card.At.fs]);
127
+ const i = parseFloat(t[Card.Tt.fs].toString());
111
128
  this.aspectRatio = isNaN(i) ? null : i;
112
129
  }
113
130
  return (
114
- null != t[Card.At.xs] && (this.extras = t[Card.At.xs]),
115
- null != t[Card.At.js] && (this.pinned = t[Card.At.js]),
116
- null != t[Card.At.zs] && (this.dismissible = t[Card.At.zs]),
117
- null != t[Card.At.ks] && (this.test = t[Card.At.ks]),
131
+ null != t[Card.Tt.xs] && (this.extras = t[Card.Tt.xs]),
132
+ null != t[Card.Tt.js] && (this.pinned = t[Card.Tt.js]),
133
+ null != t[Card.Tt.zs] && (this.dismissible = t[Card.Tt.zs]),
134
+ null != t[Card.Tt.ks] && (this.test = t[Card.Tt.ks]),
118
135
  !0
119
136
  );
120
137
  }
138
+ ss() {
139
+ throw new Error("Must be implemented in a subclass");
140
+ }
121
141
  }
122
- (Card.Ct = -1),
123
- (Card.es = {
124
- st: "captioned_image",
125
- dt: "text_announcement",
126
- Rt: "short_news",
127
- rs: "banner_image",
128
- _t: "control"
129
- }),
130
- (Card.At = {
142
+ (Card.Nt = -1),
143
+ (Card.Tt = {
131
144
  ns: "id",
132
145
  ls: "v",
133
146
  zs: "db",
134
- Dt: "r",
147
+ It: "r",
135
148
  us: "ca",
136
149
  js: "p",
137
150
  ps: "ea",
138
151
  xs: "e",
139
152
  ts: "tp",
140
153
  os: "i",
141
- ht: "tt",
142
- rt: "ds",
154
+ st: "tt",
155
+ it: "ds",
143
156
  URL: "u",
144
157
  bs: "dm",
145
158
  fs: "ar",
146
159
  gs: "cl",
147
160
  ks: "t"
148
161
  }),
162
+ (Card.es = {
163
+ tt: "captioned_image",
164
+ ct: "text_announcement",
165
+ St: "short_news",
166
+ rs: "banner_image",
167
+ At: "control"
168
+ }),
149
169
  (Card.hs = {
150
170
  ns: "id",
151
171
  ls: "v",
@@ -158,18 +178,18 @@ export default class Card {
158
178
  xs: "e",
159
179
  ts: "tp",
160
180
  os: "i",
161
- ht: "tt",
162
- rt: "ds",
181
+ st: "tt",
182
+ it: "ds",
163
183
  URL: "u",
164
184
  bs: "dm",
165
185
  fs: "ar",
166
186
  gs: "cl",
167
187
  ks: "s"
168
188
  }),
169
- (Card.Lt = {
170
- Ot: "ADVERTISING",
171
- bt: "ANNOUNCEMENTS",
172
- ft: "NEWS",
173
- Pt: "SOCIAL"
189
+ (Card.Dt = {
190
+ dt: "ADVERTISING",
191
+ Ct: "ANNOUNCEMENTS",
192
+ Rt: "NEWS",
193
+ bt: "SOCIAL"
174
194
  }),
175
- (Card.Nt = 400);
195
+ (Card.ut = 400);
@@ -2,18 +2,18 @@ import Card from "./card.js";
2
2
  export default class ClassicCard extends Card {
3
3
  constructor(s, t, i, h, r, c, e, a, o, d, l, n, u, p, f, m) {
4
4
  super(s, t, i, h, r, c, e, a, o, d, l, n, u, p, f, m),
5
- (this.Y = "ab-classic-card"),
6
- (this.Z = !0);
5
+ (this.U = "ab-classic-card"),
6
+ (this.V = !0);
7
7
  }
8
8
  ss() {
9
9
  const s = {};
10
10
  return (
11
- (s[Card.hs.ts] = Card.es.Rt),
11
+ (s[Card.hs.ts] = Card.es.St),
12
12
  (s[Card.hs.ns] = this.id),
13
13
  (s[Card.hs.ls] = this.viewed),
14
- (s[Card.hs.ht] = this.title),
14
+ (s[Card.hs.st] = this.title),
15
15
  (s[Card.hs.os] = this.imageUrl),
16
- (s[Card.hs.rt] = this.description),
16
+ (s[Card.hs.it] = this.description),
17
17
  (s[Card.hs.us] = this.updated),
18
18
  (s[Card.hs.cs] = this.created),
19
19
  (s[Card.hs.ds] = this.categories),
@@ -1,31 +1,15 @@
1
1
  import Card from "./card.js";
2
2
  export default class ControlCard extends Card {
3
- constructor(l, t, s, n, i, u) {
4
- super(
5
- l,
6
- t,
7
- null,
8
- null,
9
- null,
10
- null,
11
- s,
12
- null,
13
- n,
14
- null,
15
- null,
16
- null,
17
- i,
18
- u,
19
- null
20
- ),
3
+ constructor(l, t, s, i, n, r) {
4
+ super(l, t, null, null, null, null, s, null, i, null, null, null, n, r),
21
5
  (this.isControl = !0),
22
- (this.Y = "ab-control-card"),
23
- (this.Z = !1);
6
+ (this.U = "ab-control-card"),
7
+ (this.V = !1);
24
8
  }
25
9
  ss() {
26
10
  const l = {};
27
11
  return (
28
- (l[Card.hs.ts] = Card.es._t),
12
+ (l[Card.hs.ts] = Card.es.At),
29
13
  (l[Card.hs.ns] = this.id),
30
14
  (l[Card.hs.ls] = this.viewed),
31
15
  (l[Card.hs.us] = this.updated),
@@ -0,0 +1 @@
1
+ export {};