@financial-times/n-myft-ui 30.2.0 → 30.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/myft/ui/lists.js +8 -1
- package/myft/ui/lists.scss +2 -0
- package/myft/ui/myft-buttons/init.js +8 -2
- package/package.json +1 -1
package/myft/ui/lists.js
CHANGED
@@ -87,6 +87,11 @@ async function openSaveArticleToList (contentId, options = {}) {
|
|
87
87
|
class: 'myft-ui-create-list',
|
88
88
|
});
|
89
89
|
|
90
|
+
function addCloseButtonDataTrackable () {
|
91
|
+
const closeBtn = document.querySelector('.o-overlay__close');
|
92
|
+
closeBtn.setAttribute('data-trackable', 'close-button');
|
93
|
+
}
|
94
|
+
|
90
95
|
function outsideClickHandler (e) {
|
91
96
|
const overlayContent = document.querySelector('.o-overlay__content');
|
92
97
|
const overlayContainer = document.querySelector('.o-overlay');
|
@@ -150,6 +155,8 @@ async function openSaveArticleToList (contentId, options = {}) {
|
|
150
155
|
|
151
156
|
document.body.removeEventListener('click', outsideClickHandler);
|
152
157
|
});
|
158
|
+
|
159
|
+
addCloseButtonDataTrackable();
|
153
160
|
}
|
154
161
|
|
155
162
|
function getScrollHandler (target) {
|
@@ -192,7 +199,7 @@ function FormElement (createList, attachDescription, onListCreated, onCancel, mo
|
|
192
199
|
<button class="o-buttons o-buttons--primary o-buttons--inverse o-buttons--big" type="button" data-trackable="cancel-link" text="cancel">
|
193
200
|
Cancel
|
194
201
|
</button>
|
195
|
-
<button class="o-buttons o-buttons--big o-buttons--secondary" type="submit">
|
202
|
+
<button class="o-buttons o-buttons--big o-buttons--secondary" type="submit" data-trackable="add-button">
|
196
203
|
Add
|
197
204
|
</button>
|
198
205
|
</div>
|
package/myft/ui/lists.scss
CHANGED
@@ -26,7 +26,7 @@ function getInteractionHandler (relationshipName) {
|
|
26
26
|
};
|
27
27
|
}
|
28
28
|
|
29
|
-
function anonEventListeners () {
|
29
|
+
function anonEventListeners (flags = {}) {
|
30
30
|
const currentPath = window.location.pathname;
|
31
31
|
const subscribeUrl = '/products?segID=400863&segmentID=190b4443-dc03-bd53-e79b-b4b6fbd04e64';
|
32
32
|
const signInLink = `/login${currentPath.length ? `?location=${currentPath}` : ''}`;
|
@@ -35,6 +35,12 @@ function anonEventListeners () {
|
|
35
35
|
saved: `Please <a href="${subscribeUrl}" class="myft-ui-subscribe" data-trackable="Subscribe">subscribe</a> or <a href="${signInLink}" data-trackable="Sign In">sign in</a> to save this article.`
|
36
36
|
};
|
37
37
|
|
38
|
+
// 11/5/23 - US Growth test for Free Article Demand, see https://financialtimes.atlassian.net/browse/UG-1191
|
39
|
+
// This will be cleaned up after the test as part of https://financialtimes.atlassian.net/browse/UG-1221
|
40
|
+
if (flags.get && flags.get('podcastReferral')) {
|
41
|
+
messages.saved = `<a href="/register/access?multistepRegForm=multistep" data-trackable="Register">Register</a> for free or <a href="${signInLink}" data-trackable="Sign In">sign in</a> to save this article`;
|
42
|
+
};
|
43
|
+
|
38
44
|
['followed', 'saved'].forEach(action => {
|
39
45
|
createDelegate('submit', relationshipConfig[action].uiSelector, event => {
|
40
46
|
event.preventDefault();
|
@@ -99,7 +105,7 @@ export default function (opts) {
|
|
99
105
|
enhanceActionUrls();
|
100
106
|
|
101
107
|
if (opts && opts.anonymous) {
|
102
|
-
anonEventListeners();
|
108
|
+
anonEventListeners(opts.flags);
|
103
109
|
} else {
|
104
110
|
signedInEventListeners();
|
105
111
|
personaliseLinks();
|