@newskit-render/core 0.0.0-bcf1bb580 → 0.0.0-bd288ac57
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/CHANGELOG.md +560 -0
- package/Dockerfile.withNewRelic +1 -2
- package/__tests__/pages/__snapshots__/home.test.tsx.snap +0 -3
- package/components/article/__tests__/__snapshots__/index.test.tsx.snap +0 -3
- package/cypress/e2e/account/newsletters-page.cy.js +22 -20
- package/cypress/e2e/account/subscription-and-billing.cy.js +10 -38
- package/cypress/support/commands.js +0 -5
- package/cypress/support/users.js +6 -2
- package/helpers/getProviderPropsUtil.ts +17 -0
- package/next.config.js +55 -57
- package/package.json +12 -13
- package/pages/account/add/[field].tsx +11 -2
- package/pages/account/{family → bonus-accounts}/index.tsx +9 -4
- package/pages/account/cancellation/index.tsx +3 -2
- package/pages/account/delete/confirm/index.tsx +3 -5
- package/pages/account/delete/error/index.tsx +3 -5
- package/pages/account/delete/index.tsx +3 -5
- package/pages/account/delete/success/index.tsx +3 -5
- package/pages/account/dream-team/index.tsx +3 -2
- package/pages/account/edit/[field].tsx +17 -4
- package/pages/account/holiday-stop/index.tsx +3 -2
- package/pages/account/holiday-stop/previous-holiday-stops.tsx +3 -2
- package/pages/account/holiday-stop/upcoming-holiday-stops.tsx +3 -2
- package/pages/account/index.tsx +3 -2
- package/pages/account/newsletters/index.tsx +3 -2
- package/pages/account/newsletters-and-alerts/index.tsx +3 -5
- package/pages/account/payment/[paymentMethod].tsx +2 -2
- package/pages/account/payment/index.tsx +3 -2
- package/pages/account/payment-methods/index.tsx +3 -2
- package/pages/account/subscription-and-billing/index.tsx +3 -5
- package/pages/account/user-hub/index.tsx +4 -6
- package/temp/_document.tsx +1 -0
- package/cypress/support/blaizeValues.js +0 -3
|
@@ -1,50 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
registration_blaize_jwt,
|
|
3
|
-
subscription_blaize_jwt,
|
|
4
|
-
} from '../../support/blaizeValues'
|
|
5
|
-
|
|
6
1
|
describe('Newsletters page', () => {
|
|
7
2
|
beforeEach(() => {
|
|
8
3
|
cy.GetTnlAcsSession()
|
|
9
4
|
cy.mockConsent()
|
|
10
5
|
})
|
|
11
6
|
|
|
12
|
-
it('Should display all the newsletters on the newsletters page when user
|
|
13
|
-
cy.
|
|
7
|
+
it('Should display all the newsletters on the newsletters page when user has a subscription', () => {
|
|
8
|
+
cy.mockConsentAndVisit('/account/newsletters')
|
|
14
9
|
cy.contains('Newsletters')
|
|
15
10
|
cy.contains(
|
|
16
11
|
'Exclusive content and a curated selection of our top stories straight to your inbox.'
|
|
17
12
|
)
|
|
18
|
-
cy.get('[data-testid="newsletters-grid"] > div').should(
|
|
13
|
+
cy.get('[data-testid="newsletters-grid"] > div > div').should(
|
|
14
|
+
'have.length',
|
|
15
|
+
22
|
|
16
|
+
)
|
|
19
17
|
})
|
|
20
18
|
|
|
21
19
|
it('Should only display selected newsletters on the newsletters page when user is registered', () => {
|
|
22
|
-
cy.
|
|
20
|
+
cy.GetTnlAcsSession('tnlNoSubscription')
|
|
21
|
+
cy.mockConsentAndVisit('/account/newsletters')
|
|
23
22
|
cy.contains('Newsletters')
|
|
24
23
|
cy.contains(
|
|
25
24
|
'Exclusive content and a curated selection of our top stories straight to your inbox.'
|
|
26
25
|
)
|
|
27
|
-
cy.get('[data-testid="newsletters-grid"] > div').should(
|
|
26
|
+
cy.get('[data-testid="newsletters-grid"] > div > div').should(
|
|
27
|
+
'have.length',
|
|
28
|
+
6
|
|
29
|
+
)
|
|
28
30
|
})
|
|
29
31
|
|
|
30
32
|
it('Should display all required newsletter text in the first grid card', () => {
|
|
31
|
-
cy.
|
|
32
|
-
cy.get('[data-testid="newsletters-grid"]').then(($parentDiv) => {
|
|
33
|
+
cy.mockConsentAndVisit('/account/newsletters')
|
|
34
|
+
cy.get('[data-testid="newsletters-grid-featured"]').then(($parentDiv) => {
|
|
33
35
|
const firstNewsletter = $parentDiv.find('div:first-child')
|
|
34
36
|
|
|
35
|
-
cy.wrap(firstNewsletter).contains('
|
|
37
|
+
cy.wrap(firstNewsletter).contains('Daily Briefing').should('be.visible')
|
|
36
38
|
cy.wrap(firstNewsletter).contains('Daily').should('be.visible')
|
|
37
39
|
cy.wrap(firstNewsletter)
|
|
38
40
|
.contains(
|
|
39
|
-
|
|
41
|
+
'Our flagship newsletter with our top stories and exclusive analysis every morning.'
|
|
40
42
|
)
|
|
41
43
|
.should('be.visible')
|
|
42
44
|
})
|
|
43
45
|
})
|
|
44
46
|
|
|
45
47
|
it('Should successfully subscribe to a newsletter', () => {
|
|
46
|
-
cy.
|
|
47
|
-
cy.get('[data-testid="newsletters-grid"]').then(($parentDiv) => {
|
|
48
|
+
cy.mockConsentAndVisit('/account/newsletters')
|
|
49
|
+
cy.get('[data-testid="newsletters-grid-featured"]').then(($parentDiv) => {
|
|
48
50
|
cy.intercept('POST', '/api/account/mutate', { statusCode: 200, ok: true })
|
|
49
51
|
|
|
50
52
|
const firstNewsletter = $parentDiv.find('div:first-child')
|
|
@@ -57,14 +59,14 @@ describe('Newsletters page', () => {
|
|
|
57
59
|
|
|
58
60
|
cy.contains(
|
|
59
61
|
'[data-testid="toast-container"]',
|
|
60
|
-
'Thank you, you are now signed up to the
|
|
62
|
+
'Thank you, you are now signed up to the Daily Briefing newsletter'
|
|
61
63
|
)
|
|
62
64
|
})
|
|
63
65
|
})
|
|
64
66
|
|
|
65
67
|
it('Should show the error toast on server error', () => {
|
|
66
|
-
cy.
|
|
67
|
-
cy.get('[data-testid="newsletters-grid"]').then(($parentDiv) => {
|
|
68
|
+
cy.mockConsentAndVisit('/account/newsletters')
|
|
69
|
+
cy.get('[data-testid="newsletters-grid-featured"]').then(($parentDiv) => {
|
|
68
70
|
cy.intercept('POST', '/api/account/mutate', {
|
|
69
71
|
statusCode: 500,
|
|
70
72
|
ok: false,
|
|
@@ -80,7 +82,7 @@ describe('Newsletters page', () => {
|
|
|
80
82
|
|
|
81
83
|
cy.contains(
|
|
82
84
|
'[data-testid="toast-container"]',
|
|
83
|
-
'Sorry we were unable to sign you up to the
|
|
85
|
+
'Sorry we were unable to sign you up to the Daily Briefing newsletter, please try again'
|
|
84
86
|
)
|
|
85
87
|
})
|
|
86
88
|
})
|
|
@@ -134,18 +134,18 @@ describe('Subscription and billing details for Digital user', () => {
|
|
|
134
134
|
cy.contains('[data-testid="ContentListIntroduction"]', 'Billing details')
|
|
135
135
|
cy.contains('Payment method')
|
|
136
136
|
cy.get('[data-testid="visa-icon"]').should('exist')
|
|
137
|
-
cy.contains('************
|
|
138
|
-
cy.contains('expiry date
|
|
137
|
+
cy.contains('************4242')
|
|
138
|
+
cy.contains('expiry date 02/27')
|
|
139
139
|
})
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
cy.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
141
|
+
// Section no longer displayed when Invoice history is empty due to graphql change
|
|
142
|
+
// Invoices are no longer fetched if older than 1 year
|
|
143
|
+
// This test would periodically fail as it depends on changing user data
|
|
144
|
+
it('Should not display empty Invoice history section', () => {
|
|
145
|
+
cy.get('[data-testid="ContentListIntroduction"]').should(
|
|
146
|
+
'not.contain',
|
|
147
|
+
'Invoice history'
|
|
148
|
+
)
|
|
149
149
|
})
|
|
150
150
|
|
|
151
151
|
it('Should NOT display Your deliveries section', () => {
|
|
@@ -226,16 +226,6 @@ describe('Subscription and billing details for Print user', () => {
|
|
|
226
226
|
)
|
|
227
227
|
})
|
|
228
228
|
|
|
229
|
-
it('Should display Invoice history section', () => {
|
|
230
|
-
cy.contains('[data-testid="ContentListIntroduction"]', 'Invoice history')
|
|
231
|
-
cy.contains('Print pack')
|
|
232
|
-
cy.contains('24 Apr 2023')
|
|
233
|
-
cy.contains('Paid')
|
|
234
|
-
cy.get('a[data-testid="download-button"]')
|
|
235
|
-
.should('have.attr', 'href', '#')
|
|
236
|
-
.contains('View')
|
|
237
|
-
})
|
|
238
|
-
|
|
239
229
|
it('Should display Your deliveries section for users with vouchers', () => {
|
|
240
230
|
cy.GetTnlAcsSession('printVouchers')
|
|
241
231
|
cy.mockConsentAndVisit('/account/subscription-and-billing')
|
|
@@ -277,16 +267,6 @@ describe('Subscription and billing details for Digi-Print user', () => {
|
|
|
277
267
|
cy.contains('Digi-Print')
|
|
278
268
|
//...rest is same as Print user
|
|
279
269
|
})
|
|
280
|
-
|
|
281
|
-
it('Should display Invoice history section', () => {
|
|
282
|
-
cy.contains('[data-testid="ContentListIntroduction"]', 'Invoice history')
|
|
283
|
-
cy.contains('Digi-Print pack')
|
|
284
|
-
cy.contains('12 Nov 2023')
|
|
285
|
-
cy.contains('Paid')
|
|
286
|
-
cy.get('a[data-testid="download-button"]')
|
|
287
|
-
.should('have.attr', 'href', '#')
|
|
288
|
-
.contains('View')
|
|
289
|
-
})
|
|
290
270
|
})
|
|
291
271
|
|
|
292
272
|
describe('Subscription and billing details for Paypal user', () => {
|
|
@@ -302,14 +282,6 @@ describe('Subscription and billing details for Paypal user', () => {
|
|
|
302
282
|
cy.get('[data-testid="paypal-icon"]').should('exist')
|
|
303
283
|
cy.contains('cmp.paypal.user.verified.test@news.co.uk')
|
|
304
284
|
})
|
|
305
|
-
|
|
306
|
-
it('Should show inline banner for Paypal subscription', () => {
|
|
307
|
-
cy.get('a[href="/account/payment"]').should('be.visible').click()
|
|
308
|
-
cy.contains(
|
|
309
|
-
'[data-testid="Zuora-inline"]',
|
|
310
|
-
'To update your Paypal credentials, please speak to one of our advisors on xxxx-xxx-xxxx or add a new payment method via credit/debit card using the form below.'
|
|
311
|
-
)
|
|
312
|
-
})
|
|
313
285
|
})
|
|
314
286
|
|
|
315
287
|
describe('Subscription and billing edit pages', () => {
|
|
@@ -31,11 +31,6 @@ Cypress.Commands.add('mockConsent', () => {
|
|
|
31
31
|
setConsentLocalStorage()
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
Cypress.Commands.add('mockBlaizeJwtAndVisit', (jwtValue, url) => {
|
|
35
|
-
cy.setCookie('blaize_jwt', jwtValue)
|
|
36
|
-
cy.visit(url)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
34
|
Cypress.Commands.add('GetAcsSession', (user = 'default') => {
|
|
40
35
|
const { username, password } = userMap[user]
|
|
41
36
|
|
package/cypress/support/users.js
CHANGED
|
@@ -54,5 +54,9 @@ export const userMap = {
|
|
|
54
54
|
username: 'digi-print-card-15-11-22@yopmail.com',
|
|
55
55
|
password: 'Password123Testing123$',
|
|
56
56
|
},
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
tnlNoSubscription: {
|
|
58
|
+
//registered user with no subscription, tests the number of newsletters displayed
|
|
59
|
+
username: 'tm-test+staging-registered-user@news.co.uk',
|
|
60
|
+
password: 'Growth123',
|
|
61
|
+
},
|
|
62
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getProviderProps,
|
|
3
|
+
getProviderPropsTimes,
|
|
4
|
+
} from '@newskit-render/my-account'
|
|
5
|
+
import { publisher } from '../config'
|
|
6
|
+
|
|
7
|
+
export const getProviderPropsUtil = (context, options?) => {
|
|
8
|
+
if (process.env.NODE_ENV === 'development' && publisher === 'TIMES') {
|
|
9
|
+
return getProviderPropsTimes(context, {
|
|
10
|
+
...options,
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return getProviderProps(context, {
|
|
15
|
+
...options,
|
|
16
|
+
})
|
|
17
|
+
}
|
package/next.config.js
CHANGED
|
@@ -29,67 +29,65 @@ module.exports = (phase) => {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const path = require('path')
|
|
32
|
-
const withTM = require('next-transpile-modules')([
|
|
33
|
-
'@newskit-render/auth',
|
|
34
|
-
'@newskit-render/my-account',
|
|
35
|
-
'@newskit-render/validation',
|
|
36
|
-
])
|
|
37
32
|
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
|
38
33
|
enabled: process.env.ANALYZE === 'true',
|
|
39
34
|
})
|
|
40
35
|
|
|
41
|
-
return withBundleAnalyzer(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
return withBundleAnalyzer({
|
|
37
|
+
transpilePackages: [
|
|
38
|
+
'@newskit-render/auth',
|
|
39
|
+
'@newskit-render/my-account',
|
|
40
|
+
'@newskit-render/validation',
|
|
41
|
+
],
|
|
42
|
+
webpack: (config, options) => {
|
|
43
|
+
if (options.isServer) {
|
|
44
|
+
config.externals = ['react', ...config.externals]
|
|
45
|
+
}
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
config.resolve.alias.newskit = path.resolve(
|
|
48
|
+
__dirname,
|
|
49
|
+
'.',
|
|
50
|
+
'node_modules',
|
|
51
|
+
'newskit'
|
|
52
|
+
)
|
|
53
|
+
config.resolve.alias.react = path.resolve(
|
|
54
|
+
__dirname,
|
|
55
|
+
'.',
|
|
56
|
+
'node_modules',
|
|
57
|
+
'react'
|
|
58
|
+
)
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
)
|
|
60
|
+
return config
|
|
61
|
+
},
|
|
62
|
+
images,
|
|
63
|
+
output: 'standalone',
|
|
64
|
+
async rewrites() {
|
|
65
|
+
return [
|
|
66
|
+
{
|
|
67
|
+
source: '/sitemap.xml',
|
|
68
|
+
destination: '/api/sitemap',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
source: '/pages-sitemap.xml',
|
|
72
|
+
destination: '/api/pages-sitemap',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
source: '/competitions-sitemap.xml',
|
|
76
|
+
destination: '/api/competitions-sitemap',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
source: '/news-sitemap.xml',
|
|
80
|
+
destination: '/api/news-sitemap',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
source: '/feed',
|
|
84
|
+
destination: '/api/feed',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
source: '/robots.txt',
|
|
88
|
+
destination: '/api/robots',
|
|
89
|
+
},
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
})
|
|
95
93
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/core",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-bd288ac57",
|
|
4
4
|
"description": "Newskit Render - Core package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -42,21 +42,21 @@
|
|
|
42
42
|
"@emotion/styled": "11.9.3",
|
|
43
43
|
"@newrelic/next": "0.5.2",
|
|
44
44
|
"@newrelic/winston-enricher": "4.0.1",
|
|
45
|
-
"@newskit-render/api": "^1.
|
|
46
|
-
"@newskit-render/auth": "^1.8.
|
|
47
|
-
"@newskit-render/checkout": "^3.10.
|
|
48
|
-
"@newskit-render/feature-flags": "^1.
|
|
49
|
-
"@newskit-render/feed": "^1.8.
|
|
50
|
-
"@newskit-render/my-account": "^7.
|
|
51
|
-
"@newskit-render/shared-components": "^4.
|
|
52
|
-
"@newskit-render/standalone-components": "^3.
|
|
53
|
-
"@newskit-render/validation": "^1.
|
|
45
|
+
"@newskit-render/api": "^1.15.2",
|
|
46
|
+
"@newskit-render/auth": "^1.8.5",
|
|
47
|
+
"@newskit-render/checkout": "^3.10.38",
|
|
48
|
+
"@newskit-render/feature-flags": "^1.11.3",
|
|
49
|
+
"@newskit-render/feed": "^1.8.19",
|
|
50
|
+
"@newskit-render/my-account": "^7.100.4",
|
|
51
|
+
"@newskit-render/shared-components": "^4.45.2",
|
|
52
|
+
"@newskit-render/standalone-components": "^3.25.8",
|
|
53
|
+
"@newskit-render/validation": "^1.19.2",
|
|
54
54
|
"cross-fetch": "3.1.5",
|
|
55
55
|
"graphql": "16.6.0",
|
|
56
56
|
"lodash.get": "4.4.2",
|
|
57
57
|
"newrelic": "10.6.1",
|
|
58
58
|
"newskit": "7.7.0",
|
|
59
|
-
"next": "13.
|
|
59
|
+
"next": "13.5.8",
|
|
60
60
|
"react": "18.2.0",
|
|
61
61
|
"react-dom": "18.2.0",
|
|
62
62
|
"react-helmet": "6.1.0",
|
|
@@ -100,11 +100,10 @@
|
|
|
100
100
|
"jest-junit": "15.0.0",
|
|
101
101
|
"jest-watch-typeahead": "2.2.1",
|
|
102
102
|
"lint-staged": "13.1.0",
|
|
103
|
-
"next-transpile-modules": "10.0.0",
|
|
104
103
|
"prettier": "2.8.3",
|
|
105
104
|
"prettier-eslint": "15.0.1",
|
|
106
105
|
"prettier-eslint-cli": "7.1.0",
|
|
107
|
-
"typescript": "
|
|
106
|
+
"typescript": "5.6.3",
|
|
108
107
|
"wait-on": "7.0.1"
|
|
109
108
|
},
|
|
110
109
|
"precommit": [
|
|
@@ -3,6 +3,8 @@ import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
|
3
3
|
import { AddField, addComponentMap } from '@newskit-render/my-account'
|
|
4
4
|
import validation from '../../../validation'
|
|
5
5
|
import { DynamicPage } from '@newskit-render/my-account'
|
|
6
|
+
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
7
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
6
8
|
|
|
7
9
|
const AccountAddField = (props) => (
|
|
8
10
|
<DynamicPage
|
|
@@ -28,7 +30,14 @@ export const getServerSideProps = async (context) => {
|
|
|
28
30
|
console.error(`An error ${context.res.statusCode} occurred on server`)
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
const featureFlags = await getAllFeatureFlags()
|
|
34
|
+
const providerProps = (await getProviderPropsUtil(
|
|
35
|
+
{ ...context, provider: 'AddField' },
|
|
36
|
+
{ featureFlags } /* cra-effected */
|
|
37
|
+
)) as unknown as { props: { data: { type: string } } }
|
|
38
|
+
|
|
39
|
+
if (providerProps?.props) {
|
|
40
|
+
providerProps.props = { ...providerProps.props, data: { type: field } }
|
|
33
41
|
}
|
|
42
|
+
return providerProps
|
|
34
43
|
}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Family
|
|
2
|
+
import { Family } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
4
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
5
6
|
|
|
6
7
|
const AccountFamily = (props) => <Family {...props} />
|
|
7
8
|
|
|
8
9
|
export default AccountFamily
|
|
9
10
|
|
|
10
11
|
export const getServerSideProps = async (context) => {
|
|
11
|
-
replaceConsoleAndSetTransactionName('Account:
|
|
12
|
+
replaceConsoleAndSetTransactionName('Account: Bonus Accounts')
|
|
12
13
|
/* start cra-effected */
|
|
13
14
|
const featureFlags = await getAllFeatureFlags()
|
|
15
|
+
|
|
14
16
|
/* end cra-effected */
|
|
15
|
-
return
|
|
16
|
-
{
|
|
17
|
+
return getProviderPropsUtil(
|
|
18
|
+
{
|
|
19
|
+
...context,
|
|
20
|
+
provider: 'GroupAccountsV2',
|
|
21
|
+
},
|
|
17
22
|
{ featureFlags } /* cra-effected */
|
|
18
23
|
)
|
|
19
24
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Cancellation
|
|
2
|
+
import { Cancellation } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
4
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
5
|
import validation from '../../../validation'
|
|
6
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
6
7
|
|
|
7
8
|
const AccountCancellation = (props) => (
|
|
8
9
|
<Cancellation {...props} validation={validation} />
|
|
@@ -15,7 +16,7 @@ export const getServerSideProps = async (context) => {
|
|
|
15
16
|
/* start cra-effected */
|
|
16
17
|
const featureFlags = await getAllFeatureFlags()
|
|
17
18
|
/* end cra-effected */
|
|
18
|
-
return
|
|
19
|
+
return getProviderPropsUtil(
|
|
19
20
|
{ ...context, provider: 'Cancellation' },
|
|
20
21
|
{ featureFlags } /* cra-effected */
|
|
21
22
|
)
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
ConfirmAccountDeletion,
|
|
4
|
-
getProviderProps,
|
|
5
|
-
} from '@newskit-render/my-account'
|
|
2
|
+
import { ConfirmAccountDeletion } from '@newskit-render/my-account'
|
|
6
3
|
import { replaceConsoleAndSetTransactionName } from '../../../../helpers/logger'
|
|
4
|
+
import { getProviderPropsUtil } from '../../../../helpers/getProviderPropsUtil'
|
|
7
5
|
|
|
8
6
|
const ConfirmDeletion = (props) => <ConfirmAccountDeletion {...props} />
|
|
9
7
|
|
|
@@ -12,5 +10,5 @@ export default ConfirmDeletion
|
|
|
12
10
|
export const getServerSideProps = async (context) => {
|
|
13
11
|
replaceConsoleAndSetTransactionName('Account: Deletion - Confirmation')
|
|
14
12
|
|
|
15
|
-
return
|
|
13
|
+
return getProviderPropsUtil({ ...context })
|
|
16
14
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
AccountDeletionError,
|
|
4
|
-
getProviderProps,
|
|
5
|
-
} from '@newskit-render/my-account'
|
|
2
|
+
import { AccountDeletionError } from '@newskit-render/my-account'
|
|
6
3
|
import { replaceConsoleAndSetTransactionName } from '../../../../helpers/logger'
|
|
4
|
+
import { getProviderPropsUtil } from '../../../../helpers/getProviderPropsUtil'
|
|
7
5
|
|
|
8
6
|
const Error = (props) => <AccountDeletionError {...props} />
|
|
9
7
|
|
|
@@ -12,5 +10,5 @@ export default Error
|
|
|
12
10
|
export const getServerSideProps = async (context) => {
|
|
13
11
|
replaceConsoleAndSetTransactionName('Account: Deletion - Error')
|
|
14
12
|
|
|
15
|
-
return
|
|
13
|
+
return getProviderPropsUtil({ ...context })
|
|
16
14
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
InitiateAccountDeletion,
|
|
4
|
-
getProviderProps,
|
|
5
|
-
} from '@newskit-render/my-account'
|
|
2
|
+
import { InitiateAccountDeletion } from '@newskit-render/my-account'
|
|
6
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
7
5
|
|
|
8
6
|
const AccountDeletion = (props) => <InitiateAccountDeletion {...props} />
|
|
9
7
|
|
|
@@ -12,5 +10,5 @@ export default AccountDeletion
|
|
|
12
10
|
export const getServerSideProps = async (context) => {
|
|
13
11
|
replaceConsoleAndSetTransactionName('Account: Deletion')
|
|
14
12
|
|
|
15
|
-
return
|
|
13
|
+
return getProviderPropsUtil({ ...context })
|
|
16
14
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
AccountDeletionSuccess,
|
|
4
|
-
getProviderProps,
|
|
5
|
-
} from '@newskit-render/my-account'
|
|
2
|
+
import { AccountDeletionSuccess } from '@newskit-render/my-account'
|
|
6
3
|
import { replaceConsoleAndSetTransactionName } from '../../../../helpers/logger'
|
|
4
|
+
import { getProviderPropsUtil } from '../../../../helpers/getProviderPropsUtil'
|
|
7
5
|
|
|
8
6
|
const Success = (props) => <AccountDeletionSuccess {...props} />
|
|
9
7
|
|
|
@@ -12,5 +10,5 @@ export default Success
|
|
|
12
10
|
export const getServerSideProps = async (context) => {
|
|
13
11
|
replaceConsoleAndSetTransactionName('Account: Deletion - Success')
|
|
14
12
|
|
|
15
|
-
return
|
|
13
|
+
return getProviderPropsUtil({ ...context })
|
|
16
14
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { DreamTeam
|
|
2
|
+
import { DreamTeam } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
4
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
5
6
|
|
|
6
7
|
const AccountNewslettersAndAlerts = (props) => <DreamTeam {...props} />
|
|
7
8
|
|
|
@@ -12,7 +13,7 @@ export const getServerSideProps = async (context) => {
|
|
|
12
13
|
/* start cra-effected */
|
|
13
14
|
const featureFlags = await getAllFeatureFlags()
|
|
14
15
|
/* end cra-effected */
|
|
15
|
-
return
|
|
16
|
+
return getProviderPropsUtil(
|
|
16
17
|
{ ...context, provider: 'DreamTeam' },
|
|
17
18
|
{ featureFlags } /* cra-effected */
|
|
18
19
|
)
|
|
@@ -2,16 +2,20 @@ import React from 'react'
|
|
|
2
2
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
3
3
|
import {
|
|
4
4
|
EditField,
|
|
5
|
-
getProviderProps,
|
|
6
5
|
editComponentMap,
|
|
6
|
+
broadcastingOnlyEditComponentMap,
|
|
7
7
|
DynamicPage,
|
|
8
8
|
} from '@newskit-render/my-account'
|
|
9
9
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
10
10
|
import validation from '../../../validation'
|
|
11
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
12
|
+
import { publisher } from '../../../config'
|
|
13
|
+
import { Publisher } from '@newskit-render/api'
|
|
11
14
|
|
|
12
15
|
const AccountEditField = (props) => (
|
|
13
16
|
<DynamicPage
|
|
14
17
|
objectMap={editComponentMap}
|
|
18
|
+
isPageRestricted={props.isPageRestricted}
|
|
15
19
|
pageName={props.data.type}
|
|
16
20
|
Component={EditField}
|
|
17
21
|
componentProps={props}
|
|
@@ -27,9 +31,15 @@ export const getServerSideProps = async (context) => {
|
|
|
27
31
|
} = context
|
|
28
32
|
const doesEditPageExist = Object.keys(editComponentMap).includes(field)
|
|
29
33
|
|
|
34
|
+
const isBroadcasting = publisher === Publisher.BROADCASTING
|
|
35
|
+
const broadcastingOnlyPages = Object.keys(broadcastingOnlyEditComponentMap)
|
|
36
|
+
|
|
37
|
+
const isPageRestricted =
|
|
38
|
+
!isBroadcasting && broadcastingOnlyPages.includes(field)
|
|
39
|
+
|
|
30
40
|
replaceConsoleAndSetTransactionName(`Account: edit ${field}`)
|
|
31
41
|
|
|
32
|
-
if (!doesEditPageExist) {
|
|
42
|
+
if (!doesEditPageExist || isPageRestricted) {
|
|
33
43
|
context.res.statusCode = 404
|
|
34
44
|
// Logging the error for being captured by New Relic
|
|
35
45
|
console.error(`An error ${context.res.statusCode} occurred on server`)
|
|
@@ -38,8 +48,11 @@ export const getServerSideProps = async (context) => {
|
|
|
38
48
|
const featureFlags = await getAllFeatureFlags()
|
|
39
49
|
/* end cra-effected */
|
|
40
50
|
|
|
41
|
-
return
|
|
51
|
+
return getProviderPropsUtil(
|
|
42
52
|
{ ...context, provider: 'EditField' },
|
|
43
|
-
{
|
|
53
|
+
{
|
|
54
|
+
featureFlags,
|
|
55
|
+
isPageRestricted,
|
|
56
|
+
} /* cra-effected */
|
|
44
57
|
)
|
|
45
58
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { HolidayStop } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
4
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
5
6
|
|
|
6
7
|
const AccountHolidayStop = (props) => <HolidayStop {...props} />
|
|
7
8
|
|
|
@@ -12,7 +13,7 @@ export const getServerSideProps = async (context) => {
|
|
|
12
13
|
/* start cra-effected */
|
|
13
14
|
const featureFlags = await getAllFeatureFlags()
|
|
14
15
|
/* end cra-effected */
|
|
15
|
-
return
|
|
16
|
+
return getProviderPropsUtil(
|
|
16
17
|
{ ...context, provider: 'HolidayStop' },
|
|
17
18
|
{ featureFlags } /* cra-effected */
|
|
18
19
|
)
|