@financial-times/n-myft-ui 32.0.2 → 33.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/build-state/npm-shrinkwrap.json +710 -613
- package/components/jsx/preferences-modal/index.js +6 -6
- package/karma.conf.js +1 -1
- package/myft/ui/lists.js +12 -0
- package/myft/ui/myft-buttons/init.js +2 -8
- package/package.json +3 -3
- package/secrets.js +0 -1
@@ -11,10 +11,10 @@ const renderError = ({ message, preferencesModal }) => {
|
|
11
11
|
|
12
12
|
const removeError = ({ preferencesModal }) => {
|
13
13
|
renderError({
|
14
|
-
message:
|
14
|
+
message: '',
|
15
15
|
preferencesModal,
|
16
16
|
});
|
17
|
-
}
|
17
|
+
};
|
18
18
|
|
19
19
|
/**
|
20
20
|
* This preference modal is part of a test
|
@@ -60,7 +60,7 @@ const toggleCheckboxStatus = ({ instantAlertsCheckbox, isChecked }) => {
|
|
60
60
|
instantAlertsCheckbox.dataset.trackable = 'pop-up-box|set-instant-alert-on';
|
61
61
|
instantAlertsCheckbox.checked = false;
|
62
62
|
}
|
63
|
-
}
|
63
|
+
};
|
64
64
|
|
65
65
|
const tracking = (conceptId) => {
|
66
66
|
const trackingData = {
|
@@ -72,7 +72,7 @@ const tracking = (conceptId) => {
|
|
72
72
|
name: 'pop-up-box',
|
73
73
|
id: '72de123e-5082-11ee-be56-0242ac120002',
|
74
74
|
}
|
75
|
-
}
|
75
|
+
};
|
76
76
|
|
77
77
|
const trackingEvent = new CustomEvent('oTracking.event', {
|
78
78
|
detail: trackingData,
|
@@ -218,7 +218,7 @@ const toggleInstantAlertsPreference = async ({ event, conceptId, preferencesModa
|
|
218
218
|
instantAlertsCheckbox.removeAttribute('disabled');
|
219
219
|
};
|
220
220
|
|
221
|
-
const setCheckboxForAlertConceptToOff =
|
221
|
+
const setCheckboxForAlertConceptToOff = ({ event, preferencesModal }) => {
|
222
222
|
const conceptId = preferencesModal.dataset.conceptId;
|
223
223
|
const instantAlertsCheckbox = preferencesModal.querySelector('[data-component-id="myft-preferences-modal-checkbox"]');
|
224
224
|
|
@@ -231,7 +231,7 @@ const setCheckboxForAlertConceptToOff = ({ event, preferencesModal }) => {
|
|
231
231
|
instantAlertsCheckbox,
|
232
232
|
isChecked: false,
|
233
233
|
});
|
234
|
-
}
|
234
|
+
};
|
235
235
|
|
236
236
|
export default () => {
|
237
237
|
/**
|
package/karma.conf.js
CHANGED
package/myft/ui/lists.js
CHANGED
@@ -500,6 +500,12 @@ function openCreateListAndAddArticleOverlay (contentId, config) {
|
|
500
500
|
function initialEventListeners () {
|
501
501
|
|
502
502
|
document.body.addEventListener('myft.user.saved.content.add', event => {
|
503
|
+
//Only show the create list overlay if the saved article is the main article, this is useful if there are other article listed in the article page
|
504
|
+
//For example having a related articles that can also be saved
|
505
|
+
const currentContentId = document.querySelector('[data-content-id]').dataset.contentId;
|
506
|
+
if (event && event.detail && currentContentId !== event.detail.subject) {
|
507
|
+
return;
|
508
|
+
}
|
503
509
|
event.stopPropagation();
|
504
510
|
const contentId = event.detail.subject;
|
505
511
|
const configSet = event.currentTarget.querySelector('[data-myft-ui-save-config]');
|
@@ -512,6 +518,12 @@ function initialEventListeners () {
|
|
512
518
|
});
|
513
519
|
|
514
520
|
document.body.addEventListener('myft.user.saved.content.remove', event => {
|
521
|
+
//Only show unsave notification if the saved article is the main article, this is useful if there are other article listed in the article page
|
522
|
+
//For example having a related articles that can also be saved
|
523
|
+
const currentContentId = document.querySelector('[data-content-id]').dataset.contentId;
|
524
|
+
if (event && event.detail && currentContentId !== event.detail.subject) {
|
525
|
+
return;
|
526
|
+
}
|
515
527
|
event.stopPropagation();
|
516
528
|
const contentId = event.detail.subject;
|
517
529
|
return showUnsavedNotification(contentId);
|
@@ -26,7 +26,7 @@ function getInteractionHandler (relationshipName) {
|
|
26
26
|
};
|
27
27
|
}
|
28
28
|
|
29
|
-
function anonEventListeners (
|
29
|
+
function anonEventListeners () {
|
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,12 +35,6 @@ function anonEventListeners (flags = {}) {
|
|
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?segmentID=ce23dd51-4421-32fc-23df-30099f38f1a4" data-trackable="Register">Register</a> for free or <a href="${signInLink}" data-trackable="Sign In">sign in</a> to save this article`;
|
42
|
-
};
|
43
|
-
|
44
38
|
['followed', 'saved'].forEach(action => {
|
45
39
|
createDelegate('submit', relationshipConfig[action].uiSelector, event => {
|
46
40
|
event.preventDefault();
|
@@ -105,7 +99,7 @@ export default function (opts) {
|
|
105
99
|
enhanceActionUrls();
|
106
100
|
|
107
101
|
if (opts && opts.anonymous) {
|
108
|
-
anonEventListeners(
|
102
|
+
anonEventListeners();
|
109
103
|
} else {
|
110
104
|
signedInEventListeners();
|
111
105
|
personaliseLinks();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@financial-times/n-myft-ui",
|
3
|
-
"version": "
|
3
|
+
"version": "33.1.0",
|
4
4
|
"description": "Client side component for interaction with myft",
|
5
5
|
"main": "server.js",
|
6
6
|
"scripts": {
|
@@ -63,7 +63,7 @@
|
|
63
63
|
"karma-chrome-launcher": "3.2.0",
|
64
64
|
"karma-firefox-launcher": "^1.0.0",
|
65
65
|
"karma-html-reporter": "^0.2.6",
|
66
|
-
"karma-mocha": "^
|
66
|
+
"karma-mocha": "^2.0.1",
|
67
67
|
"karma-sinon": "^1.0.5",
|
68
68
|
"karma-sinon-chai": "2.0.2",
|
69
69
|
"karma-sourcemap-loader": "^0.3.7",
|
@@ -71,7 +71,7 @@
|
|
71
71
|
"karma-webpack": "^4.0.2",
|
72
72
|
"lintspaces-cli": "^0.7.0",
|
73
73
|
"lolex": "5.1.2",
|
74
|
-
"mocha": "
|
74
|
+
"mocha": "^10.2.0",
|
75
75
|
"mockery": "2.1.0",
|
76
76
|
"node-fetch": "2.6.0",
|
77
77
|
"nodemon": "^1.9.2",
|
package/secrets.js
CHANGED
@@ -4,7 +4,6 @@ module.exports = {
|
|
4
4
|
'38d9c080-3301-11ea-9616-d1b31132c269', // components/unread-articles-indicator/README.md:3
|
5
5
|
'11df4800-391a-11ea-973b-4a52933561ab', // components/unread-articles-indicator/README.md:67
|
6
6
|
'190b4443-dc03-bd53-e79b-b4b6fbd04e64', // segment ID for subscribe URL
|
7
|
-
'ce23dd51-4421-32fc-23df-30099f38f1a4', // segment ID for USG test https://financialtimes.atlassian.net/browse/UG-1191
|
8
7
|
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx', // regex for uuid generator
|
9
8
|
'a5676e20-5c92-47f3-a76c-11f9761121f5', // test/navigationAlphaTest.spec.js
|
10
9
|
'72de123e-5082-11ee-be56-0242ac120002' // components/jsx/preferences-modal/index.js
|