@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.
- package/index.d.ts +27 -24
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +5 -5
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +24 -24
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +17 -17
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +18 -18
- package/src/Card/card-manager-factory.js +2 -2
- package/src/Card/card-manager.js +47 -41
- package/src/Card/display/card-display.js +70 -67
- package/src/Card/log-card-click.js +1 -1
- package/src/Card/log-card-dismissal.js +1 -1
- package/src/Card/log-card-impressions.js +3 -3
- package/src/Card/models/banner.js +3 -2
- package/src/Card/models/captioned-image.js +6 -5
- package/src/Card/models/card.js +107 -87
- package/src/Card/models/classic-card.js +5 -5
- package/src/Card/models/control-card.js +5 -21
- package/src/Card/types.js +1 -0
- package/src/Card/util/card-factory.js +32 -32
- package/src/ContentCards/content-cards-provider-factory.js +3 -3
- package/src/ContentCards/content-cards-provider.js +283 -175
- package/src/ContentCards/content-cards.js +2 -2
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/log-content-cards-displayed.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +9 -6
- package/src/ContentCards/types.js +1 -0
- package/src/ContentCards/ui/hide-content-cards.js +2 -2
- package/src/ContentCards/ui/show-content-cards.js +35 -33
- package/src/Core/add-sdk-metadata.js +17 -18
- package/src/Core/change-user.js +12 -14
- package/src/Core/destroy.js +1 -1
- package/src/Core/disable-sdk.js +7 -6
- package/src/Core/enable-sdk.js +4 -4
- package/src/Core/get-device-id.js +7 -6
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +57 -40
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +22 -15
- package/src/Core/log-purchase.js +33 -33
- package/src/Core/open-session.js +17 -15
- package/src/Core/request-immediate-data-flush.js +4 -2
- package/src/Core/set-logger.js +1 -1
- package/src/Core/set-sdk-authentication-signature.js +5 -6
- package/src/Core/subscribe-to-sdk-authentication-failures.js +3 -1
- package/src/Core/toggle-logging.js +1 -1
- package/src/Core/types.js +1 -0
- package/src/Core/wipe-data.js +11 -10
- package/src/FeatureFlags/feature-flag-factory.js +6 -6
- package/src/FeatureFlags/feature-flag.js +17 -17
- package/src/FeatureFlags/feature-flags-provider-factory.js +2 -2
- package/src/FeatureFlags/feature-flags-provider.js +67 -65
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +4 -4
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -1
- package/src/Feed/feed-provider-factory.js +8 -8
- package/src/Feed/feed-provider.js +57 -46
- package/src/Feed/feed.js +1 -1
- package/src/Feed/get-cached-feed.js +2 -2
- package/src/Feed/log-feed-displayed.js +3 -1
- package/src/Feed/request-feed-refresh.js +2 -2
- package/src/Feed/subscribe-to-feed-updates.js +2 -2
- package/src/Feed/types.js +1 -0
- package/src/Feed/ui/hide-feed.js +2 -2
- package/src/Feed/ui/show-feed.js +40 -36
- package/src/InAppMessage/display/html-message-to-html.js +125 -119
- package/src/InAppMessage/display/in-app-message-to-html.js +72 -69
- package/src/InAppMessage/display/modal-utils.js +18 -13
- package/src/InAppMessage/in-app-message-factory.js +9 -8
- package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager.js +122 -108
- package/src/InAppMessage/log-in-app-message-button-click.js +10 -10
- package/src/InAppMessage/log-in-app-message-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-html-click.js +10 -10
- package/src/InAppMessage/log-in-app-message-impression.js +5 -5
- package/src/InAppMessage/models/control-message.js +4 -1
- package/src/InAppMessage/models/full-screen-message.js +35 -37
- package/src/InAppMessage/models/html-message.js +34 -33
- package/src/InAppMessage/models/in-app-message-button.js +23 -16
- package/src/InAppMessage/models/in-app-message.js +147 -105
- package/src/InAppMessage/models/modal-message.js +34 -36
- package/src/InAppMessage/models/slide-up-message.js +25 -27
- package/src/InAppMessage/models/templated-in-app-message.js +12 -7
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/types.js +1 -0
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +4 -4
- package/src/InAppMessage/ui/show-in-app-message.js +95 -89
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -0
- package/src/Push/is-push-blocked.js +2 -2
- package/src/Push/is-push-permission-granted.js +2 -2
- package/src/Push/is-push-supported.js +2 -2
- package/src/Push/push-manager-factory.js +20 -20
- package/src/Push/push-manager.js +192 -174
- package/src/Push/request-push-permission.js +4 -3
- package/src/Push/types.js +1 -0
- package/src/Push/unregister-push.js +2 -2
- package/src/Push/utils/push-utils.js +10 -10
- package/src/User/types.js +1 -0
- package/src/User/user-manager.js +24 -24
- package/src/User/user.js +117 -105
- package/src/common/base-feed.js +7 -7
- package/src/common/base-provider.js +2 -2
- package/src/common/constants.js +6 -0
- package/src/common/event-logger.js +6 -6
- package/src/common/feed-display.js +18 -18
- package/src/common/types.js +1 -0
- package/src/l10n/l10n-manager-factory.js +5 -5
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +32 -32
- package/src/managers/braze-instance.js +202 -202
- package/src/managers/device-manager.js +23 -23
- package/src/managers/network-manager.js +96 -82
- package/src/managers/server-config-manager.js +60 -42
- package/src/managers/session-manager.js +41 -41
- package/src/managers/storage-manager-factory.js +15 -15
- package/src/managers/storage-manager.js +163 -160
- package/src/managers/subscription-manager.js +11 -11
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +7 -7
- package/src/models/push-token.js +7 -7
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +20 -20
- package/src/request-controller.js +176 -174
- package/src/triggers/models/custom-event-data.js +6 -6
- package/src/triggers/models/custom-event-property-data.js +9 -9
- package/src/triggers/models/filter-set.js +9 -9
- package/src/triggers/models/filter.js +64 -64
- package/src/triggers/models/in-app-message-click-data.js +12 -12
- package/src/triggers/models/purchase-data.js +3 -3
- package/src/triggers/models/purchase-property-data.js +9 -9
- package/src/triggers/models/push-click-data.js +5 -5
- package/src/triggers/models/trigger-condition.js +52 -52
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +8 -8
- package/src/triggers/triggers-provider.js +165 -162
- package/src/types.js +1 -0
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +20 -20
- package/src/util/browser-detector.js +22 -22
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/code-utils.js +1 -1
- package/src/util/color-utils.js +2 -2
- package/src/util/component-utils.js +2 -2
- package/src/util/deprecation-utils.js +1 -1
- package/src/util/device-constants.js +5 -5
- package/src/util/dom-utils.js +2 -2
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +11 -11
- package/src/util/request-header-utils.js +23 -0
- package/src/util/string-utils.js +1 -1
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +44 -44
- package/src/util/window-utils.js +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createCloseButton as
|
|
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",
|
|
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",
|
|
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
|
|
31
|
-
t.title || t.description || (
|
|
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
|
|
35
|
-
let
|
|
34
|
+
const e = o.querySelectorAll(".ab-image-area");
|
|
35
|
+
let a,
|
|
36
36
|
n = 0;
|
|
37
|
-
|
|
37
|
+
e.length > 0 && (n = e[0].offsetWidth);
|
|
38
38
|
for (const o of t)
|
|
39
|
-
if (((
|
|
39
|
+
if (((a = o._), a && o.imageUrl && "number" == typeof o.aspectRatio)) {
|
|
40
40
|
const t = n / o.aspectRatio;
|
|
41
|
-
t && (
|
|
41
|
+
t && (a.style.height = `${t}px`);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
export function cardToHtml(t, logCardClick,
|
|
44
|
+
export function cardToHtml(t, logCardClick, e) {
|
|
45
45
|
const a = document.createElement("div");
|
|
46
|
-
(a.className = "ab-card ab-effect-card " + t.
|
|
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
|
-
|
|
51
|
-
|
|
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
|
|
63
|
+
const e = document.createElement("img");
|
|
62
64
|
if (
|
|
63
|
-
(
|
|
64
|
-
(
|
|
65
|
+
(e.setAttribute("src", t.imageUrl),
|
|
66
|
+
(e.onload = () => {
|
|
65
67
|
a.style.height = "auto";
|
|
66
68
|
}),
|
|
67
|
-
_setImageAltText(t,
|
|
68
|
-
o.appendChild(
|
|
69
|
+
_setImageAltText(t, e),
|
|
70
|
+
o.appendChild(e),
|
|
69
71
|
(a.className += " with-image"),
|
|
70
|
-
|
|
72
|
+
i && !t.V)
|
|
71
73
|
) {
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
(
|
|
75
|
-
|
|
76
|
-
a.appendChild(
|
|
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
|
|
80
|
-
if (((
|
|
81
|
-
t.
|
|
82
|
-
const
|
|
83
|
-
a.appendChild(
|
|
84
|
-
d(
|
|
85
|
-
(a.className += " ab-swiped-left"),
|
|
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(
|
|
88
|
-
(a.className += " ab-swiped-right"),
|
|
89
|
+
d(u, c.X, t => {
|
|
90
|
+
(a.className += " ab-swiped-right"), e.onclick(t);
|
|
89
91
|
});
|
|
90
92
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
((
|
|
96
|
-
(
|
|
97
|
-
a.setAttribute("aria-labelledby",
|
|
98
|
-
|
|
98
|
+
((t.className = "ab-title"),
|
|
99
|
+
(t.id = r.Z.Y()),
|
|
100
|
+
a.setAttribute("aria-labelledby", t.id),
|
|
101
|
+
i)
|
|
99
102
|
) {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
} else
|
|
106
|
-
|
|
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
|
|
111
|
+
const l = document.createElement("div");
|
|
109
112
|
if (
|
|
110
|
-
((
|
|
111
|
-
(
|
|
112
|
-
a.setAttribute("aria-describedby",
|
|
113
|
-
|
|
114
|
-
|
|
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
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
(
|
|
122
|
-
o.appendChild(
|
|
123
|
-
|
|
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
|
-
|
|
126
|
-
const
|
|
128
|
+
u.appendChild(l), a.appendChild(u);
|
|
129
|
+
const f = document.createElement("div");
|
|
127
130
|
return (
|
|
128
|
-
(
|
|
129
|
-
t.viewed && (
|
|
130
|
-
a.appendChild(
|
|
131
|
-
(t.
|
|
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().
|
|
9
|
+
(o instanceof Card ? n.m().h(o, a).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.
|
|
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.
|
|
12
|
-
return n.m().
|
|
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.
|
|
6
|
-
(this.
|
|
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.
|
|
6
|
-
(this.
|
|
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.
|
|
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.
|
|
15
|
+
(t[Card.hs.st] = this.title),
|
|
15
16
|
(t[Card.hs.os] = this.imageUrl),
|
|
16
|
-
(t[Card.hs.
|
|
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),
|
package/src/Card/models/card.js
CHANGED
|
@@ -1,151 +1,171 @@
|
|
|
1
1
|
import {
|
|
2
|
-
convertMsToSeconds as
|
|
3
|
-
dateFromUnixTimestamp as
|
|
2
|
+
convertMsToSeconds as h,
|
|
3
|
+
dateFromUnixTimestamp as l
|
|
4
4
|
} from "../../util/date-utils.js";
|
|
5
|
-
import { FEED_ANIMATION_DURATION as
|
|
6
|
-
import
|
|
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,
|
|
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 =
|
|
13
|
-
(this.description =
|
|
14
|
-
(this.created =
|
|
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 =
|
|
18
|
-
(this.url =
|
|
19
|
-
(this.linkText =
|
|
20
|
-
|
|
21
|
-
|
|
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 =
|
|
44
|
+
(this.clicked = c || !1),
|
|
27
45
|
(this.isControl = !1),
|
|
28
46
|
(this.test = !1),
|
|
29
|
-
(this.
|
|
30
|
-
(this.
|
|
47
|
+
(this.ht = null),
|
|
48
|
+
(this.nt = null);
|
|
31
49
|
}
|
|
32
50
|
subscribeToClickedEvent(t) {
|
|
33
|
-
return this.
|
|
51
|
+
return this.et().lt(t);
|
|
34
52
|
}
|
|
35
53
|
subscribeToDismissedEvent(t) {
|
|
36
|
-
return this.
|
|
54
|
+
return this.rt().lt(t);
|
|
37
55
|
}
|
|
38
56
|
removeSubscription(t) {
|
|
39
|
-
this.
|
|
57
|
+
this.et().removeSubscription(t), this.rt().removeSubscription(t);
|
|
40
58
|
}
|
|
41
59
|
removeAllSubscriptions() {
|
|
42
|
-
this.
|
|
60
|
+
this.et().removeAllSubscriptions(), this.rt().removeAllSubscriptions();
|
|
43
61
|
}
|
|
44
62
|
dismissCard() {
|
|
45
|
-
if (this.dismissible
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
63
|
-
return null == this.
|
|
79
|
+
et() {
|
|
80
|
+
return null == this.ht && (this.ht = new E()), this.ht;
|
|
64
81
|
}
|
|
65
|
-
|
|
66
|
-
return null == this.
|
|
82
|
+
rt() {
|
|
83
|
+
return null == this.nt && (this.nt = new E()), this.nt;
|
|
67
84
|
}
|
|
68
|
-
|
|
85
|
+
M() {
|
|
69
86
|
this.viewed = !0;
|
|
70
87
|
}
|
|
71
|
-
|
|
72
|
-
(this.viewed = !0), (this.clicked = !0), this.
|
|
88
|
+
p() {
|
|
89
|
+
(this.viewed = !0), (this.clicked = !0), this.et().Et();
|
|
73
90
|
}
|
|
74
|
-
|
|
91
|
+
F() {
|
|
75
92
|
return (
|
|
76
93
|
!(!this.dismissible || this.dismissed) &&
|
|
77
|
-
((this.dismissed = !0), this.
|
|
94
|
+
((this.dismissed = !0), this.rt().Et(), !0)
|
|
78
95
|
);
|
|
79
96
|
}
|
|
80
|
-
|
|
81
|
-
if (null == t || t[Card.
|
|
82
|
-
if (t[Card.
|
|
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.
|
|
101
|
+
null != t[Card.Tt.us] &&
|
|
85
102
|
null != this.updated &&
|
|
86
|
-
t[Card.
|
|
103
|
+
parseInt(t[Card.Tt.us]) < h(this.updated.valueOf())
|
|
87
104
|
)
|
|
88
105
|
return !0;
|
|
89
106
|
if (
|
|
90
|
-
(t[Card.
|
|
91
|
-
t[Card.
|
|
92
|
-
null != t[Card.
|
|
93
|
-
null != t[Card.
|
|
94
|
-
null != t[Card.
|
|
95
|
-
null != t[Card.
|
|
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 =
|
|
114
|
+
const i = l(t[Card.Tt.us]);
|
|
98
115
|
null != i && (this.updated = i);
|
|
99
116
|
}
|
|
100
|
-
if (null != t[Card.
|
|
117
|
+
if (null != t[Card.Tt.ps]) {
|
|
101
118
|
let i;
|
|
102
|
-
(i = t[Card.
|
|
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.
|
|
107
|
-
null != t[Card.
|
|
108
|
-
null != t[Card.
|
|
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.
|
|
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.
|
|
115
|
-
null != t[Card.
|
|
116
|
-
null != t[Card.
|
|
117
|
-
null != t[Card.
|
|
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.
|
|
123
|
-
(Card.
|
|
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
|
-
|
|
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
|
-
|
|
142
|
-
|
|
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
|
-
|
|
162
|
-
|
|
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.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
189
|
+
(Card.Dt = {
|
|
190
|
+
dt: "ADVERTISING",
|
|
191
|
+
Ct: "ANNOUNCEMENTS",
|
|
192
|
+
Rt: "NEWS",
|
|
193
|
+
bt: "SOCIAL"
|
|
174
194
|
}),
|
|
175
|
-
(Card.
|
|
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.
|
|
6
|
-
(this.
|
|
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.
|
|
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.
|
|
14
|
+
(s[Card.hs.st] = this.title),
|
|
15
15
|
(s[Card.hs.os] = this.imageUrl),
|
|
16
|
-
(s[Card.hs.
|
|
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,
|
|
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.
|
|
23
|
-
(this.
|
|
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.
|
|
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 {};
|