@newskit-render/core 1.13.3 → 1.22.1
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/.eslintignore +5 -1
- package/.eslintrc +1 -1
- package/CHANGELOG.md +212 -0
- package/__tests__/pages/[articleSlug].test.tsx +1 -1
- package/__tests__/pages/__snapshots__/home.test.tsx.snap +175 -324
- package/__tests__/pages/home.test.tsx +1 -0
- package/applitools.config.js +9 -0
- package/components/article/__tests__/__snapshots__/index.test.tsx.snap +279 -517
- package/components/footer/__snapshots__/index.test.tsx.snap +7 -11
- package/components/header/index.test.tsx +1 -1
- package/components/header/index.tsx +60 -30
- package/components/section/__tests__/ArticleSlice.test.tsx +32 -24
- package/components/section/layouts/__tests__/__snapshots__/Lead.test.tsx.snap +30 -50
- package/components/section/layouts/__tests__/__snapshots__/SectionRow.test.tsx.snap +205 -358
- package/cypress/config/config.e2e.json +14 -0
- package/cypress/config/config.visual.json +8 -0
- package/cypress/e2e/account/SkipToContent.spec.js +12 -0
- package/cypress/e2e/account/accessibility.spec.js +69 -0
- package/cypress/e2e/account/account-page.spec.js +339 -0
- package/cypress/e2e/account/commenting-notifications.spec.js +44 -0
- package/cypress/e2e/account/main-api.spec.js +93 -0
- package/cypress/e2e/account/payment-page.spec.js +42 -0
- package/cypress/{integration → e2e/core}/home-page.spec.js +0 -0
- package/cypress/plugins/index.js +31 -0
- package/cypress/support/commands.js +48 -25
- package/cypress/support/index.js +2 -0
- package/cypress/visual/account/visual-regression.spec.js +31 -0
- package/helpers/a11y.ts +8 -6
- package/helpers/mocks/articleMock.ts +8 -4
- package/helpers/mocks/getRadioPostMock.ts +4 -2
- package/helpers/mocks/getUniversalArticleMock.ts +8 -4
- package/infrastructure/.circleci/config.yml +2 -2
- package/package.json +60 -54
- package/pages/[section]/[articleId]/[articleSlug].tsx +1 -0
- package/pages/[section]/index.tsx +1 -0
- package/pages/_app.tsx +216 -13
- package/pages/_document.tsx +27 -14
- package/pages/checkout/account-creation/index.tsx +9 -1
- package/pages/index.tsx +1 -0
- package/public/MyAccount/primary-navigation-logo-white.svg +6 -0
- package/public/fonts/bitter-medium.woff +0 -0
- package/public/fonts/bitter-medium.woff2 +0 -0
- package/public/fonts/bitter-mediumitalic.woff +0 -0
- package/public/fonts/bitter-mediumitalic.woff2 +0 -0
- package/public/fonts/bitter-regular.woff +0 -0
- package/public/fonts/bitter-regular.woff2 +0 -0
- package/public/fonts/bitter-semibold.woff +0 -0
- package/public/fonts/bitter-semibold.woff2 +0 -0
- package/public/fonts/dmmono-medium.woff +0 -0
- package/public/fonts/dmmono-medium.woff2 +0 -0
- package/public/fonts/dmsans-bold-webfont.woff +0 -0
- package/public/fonts/dmsans-bold-webfont.woff2 +0 -0
- package/public/fonts/dmsans-bolditalic-webfont.woff +0 -0
- package/public/fonts/dmsans-bolditalic-webfont.woff2 +0 -0
- package/public/fonts/dmsans-italic-webfont.woff +0 -0
- package/public/fonts/dmsans-italic-webfont.woff2 +0 -0
- package/public/fonts/dmsans-medium-webfont.woff +0 -0
- package/public/fonts/dmsans-medium-webfont.woff2 +0 -0
- package/public/fonts/dmsans-mediumitalic-webfont.woff +0 -0
- package/public/fonts/dmsans-mediumitalic-webfont.woff2 +0 -0
- package/public/fonts/dmsans-regular-webfont.woff +0 -0
- package/public/fonts/dmsans-regular-webfont.woff2 +0 -0
- package/public/fonts/notosans-bold-webfont.woff +0 -0
- package/public/fonts/notosans-bold-webfont.woff2 +0 -0
- package/public/fonts/notosans-italic-webfont.woff +0 -0
- package/public/fonts/notosans-italic-webfont.woff2 +0 -0
- package/public/fonts/notosans-medium-webfont.woff +0 -0
- package/public/fonts/notosans-medium-webfont.woff2 +0 -0
- package/public/fonts/notosans-regular-webfont.woff +0 -0
- package/public/fonts/notosans-regular-webfont.woff2 +0 -0
- package/public/fonts/poppins-bold-webfont.woff +0 -0
- package/public/fonts/poppins-bold-webfont.woff2 +0 -0
- package/public/fonts/poppins-bolditalic-webfont.woff +0 -0
- package/public/fonts/poppins-bolditalic-webfont.woff2 +0 -0
- package/public/fonts/poppins-extrabold-webfont.woff +0 -0
- package/public/fonts/poppins-extrabold-webfont.woff2 +0 -0
- package/public/fonts/poppins-extrabolditalic-webfont.woff +0 -0
- package/public/fonts/poppins-extrabolditalic-webfont.woff2 +0 -0
- package/public/fonts/poppins-italic-webfont.woff +0 -0
- package/public/fonts/poppins-italic-webfont.woff2 +0 -0
- package/public/fonts/poppins-light-webfont.woff +0 -0
- package/public/fonts/poppins-light-webfont.woff2 +0 -0
- package/public/fonts/poppins-lightitalic-webfont.woff +0 -0
- package/public/fonts/poppins-lightitalic-webfont.woff2 +0 -0
- package/public/fonts/poppins-medium-webfont.woff +0 -0
- package/public/fonts/poppins-medium-webfont.woff2 +0 -0
- package/public/fonts/poppins-mediumitalic-webfont.woff +0 -0
- package/public/fonts/poppins-mediumitalic-webfont.woff2 +0 -0
- package/public/fonts/poppins-regular-webfont.woff +0 -0
- package/public/fonts/poppins-regular-webfont.woff2 +0 -0
- package/public/fonts/poppins-semibold-webfont.woff +0 -0
- package/public/fonts/poppins-semibold-webfont.woff2 +0 -0
- package/public/fonts/poppins-semibolditalic-webfont.woff +0 -0
- package/public/fonts/poppins-semibolditalic-webfont.woff2 +0 -0
- package/public/fonts/source-serif-pro-600.woff +0 -0
- package/public/fonts/source-serif-pro-600.woff2 +0 -0
- package/public/fonts/source-serif-pro-600italic.woff +0 -0
- package/public/fonts/source-serif-pro-600italic.woff2 +0 -0
- package/public/fonts/source-serif-pro-700.woff +0 -0
- package/public/fonts/source-serif-pro-700.woff2 +0 -0
- package/public/fonts/source-serif-pro-700italic.woff +0 -0
- package/public/fonts/source-serif-pro-700italic.woff2 +0 -0
- package/public/fonts/source-serif-pro-italic.woff +0 -0
- package/public/fonts/source-serif-pro-italic.woff2 +0 -0
- package/public/fonts/source-serif-pro-regular.woff +0 -0
- package/public/fonts/source-serif-pro-regular.woff2 +0 -0
- package/public/prebid.min.js +1 -0
- package/temp/_document.tsx +1 -1
- package/theme/colours.json +4 -0
- package/theme/render-custom-theme.ts +5 -2
- package/tsconfig.json +4 -1
- package/helpers/articleUtil.ts +0 -4
|
@@ -1,25 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
Cypress.Commands.add('mockConsentAndVisit', (url) => {
|
|
2
|
+
cy.setCookie('nukt_sp_consent', 'JABCDEFGHI')
|
|
3
|
+
cy.setCookie('consentUUID', '28cfcd1e-6916-4488-9d84-54f2618eaa14')
|
|
4
|
+
cy.visit(url)
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
Cypress.Commands.add('GetAcsSession', () => {
|
|
8
|
+
cy.request({
|
|
9
|
+
method: 'POST',
|
|
10
|
+
url: 'https://login.staging-thesun.co.uk/services/session',
|
|
11
|
+
headers: {
|
|
12
|
+
'Content-Type': 'application/vnd.newsuk.acs.createsession-v1+json',
|
|
13
|
+
},
|
|
14
|
+
body: {
|
|
15
|
+
rememberMe: false,
|
|
16
|
+
gotoUrl: 'https://login.staging-thesun.co.uk/',
|
|
17
|
+
sso: false,
|
|
18
|
+
authCredentials: {
|
|
19
|
+
username: 'temp.account@tempaccount.com',
|
|
20
|
+
password: 'asdasd1A',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
}).then((response) => {
|
|
24
|
+
const acs_ngn = response.body.acsCookies.cookies[0].value
|
|
25
|
+
cy.setCookie('acs_ngn', acs_ngn)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
Cypress.Commands.add('createNewEmail', () => {
|
|
30
|
+
const newEmail =
|
|
31
|
+
Cypress.env('MAIN_USER_EMAIL').split('@')[0].split('').reverse().join('') +
|
|
32
|
+
'@' +
|
|
33
|
+
Cypress.env('MAIN_USER_EMAIL').split('@')[1]
|
|
34
|
+
Cypress.env('newEmail', newEmail)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
Cypress.Commands.add('getZuoraElement', (selector) => {
|
|
38
|
+
if (Cypress.config('chromeWebSecurity')) {
|
|
39
|
+
throw new Error('To get Zuora element `chromeWebSecurity` must be disabled')
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return cy
|
|
43
|
+
.get('iframe')
|
|
44
|
+
.its('0.contentDocument.body')
|
|
45
|
+
.should('not.be.empty')
|
|
46
|
+
.then(cy.wrap)
|
|
47
|
+
.find(selector)
|
|
48
|
+
})
|
package/cypress/support/index.js
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const pages = [
|
|
2
|
+
{ url: '/account', pageName: 'Personal Details' },
|
|
3
|
+
{ url: '/account/edit/name', pageName: 'Name form' },
|
|
4
|
+
{ url: '/account/edit/email', pageName: 'Email form' },
|
|
5
|
+
{ url: '/account/edit/password', pageName: 'Password from' },
|
|
6
|
+
{ url: '/account/edit/mobile', pageName: 'Mobile phone from' },
|
|
7
|
+
{ url: '/account/edit/address', pageName: 'Address form' },
|
|
8
|
+
{
|
|
9
|
+
url: '/account/subscription-and-billing',
|
|
10
|
+
pageName: 'Subscription and Billing',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
url: '/account/newsletters-and-alerts',
|
|
14
|
+
pageName: 'Newsletters and Alerts',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
url: '/account/edit/commenting-notifications',
|
|
18
|
+
pageName: 'Commenting Notifications form',
|
|
19
|
+
},
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
describe('Visual regression', () => {
|
|
23
|
+
pages.forEach(({ url, pageName }) => {
|
|
24
|
+
it(`should pass regression: ${pageName}`, () => {
|
|
25
|
+
cy.mockConsentAndVisit(url)
|
|
26
|
+
cy.eyesOpen()
|
|
27
|
+
cy.eyesCheckWindow(`${pageName} page`)
|
|
28
|
+
cy.eyesClose()
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
})
|
package/helpers/a11y.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export const handleEnterKeyPress =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export const handleEnterKeyPress = (onClick: () => void) => ({
|
|
2
|
+
key,
|
|
3
|
+
}: {
|
|
4
|
+
key: string
|
|
5
|
+
}) => {
|
|
6
|
+
if (key === 'Enter') {
|
|
7
|
+
onClick()
|
|
7
8
|
}
|
|
9
|
+
}
|
|
@@ -26,25 +26,29 @@ export const relatedArticles = [
|
|
|
26
26
|
{
|
|
27
27
|
title: 'Prince Harry',
|
|
28
28
|
tag: 'NEWS',
|
|
29
|
-
text:
|
|
29
|
+
text:
|
|
30
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
|
|
30
31
|
href: imagePlaceholderHref('70x50'),
|
|
31
32
|
},
|
|
32
33
|
{
|
|
33
34
|
title: 'Meghan Markle',
|
|
34
35
|
tag: 'SPORT',
|
|
35
|
-
text:
|
|
36
|
+
text:
|
|
37
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
|
|
36
38
|
href: imagePlaceholderHref('70x50'),
|
|
37
39
|
},
|
|
38
40
|
{
|
|
39
41
|
title: 'Royal Family',
|
|
40
42
|
tag: 'CULTURE',
|
|
41
|
-
text:
|
|
43
|
+
text:
|
|
44
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
|
|
42
45
|
href: imagePlaceholderHref('70x50'),
|
|
43
46
|
},
|
|
44
47
|
{
|
|
45
48
|
title: 'Royal Family',
|
|
46
49
|
tag: 'CORONAVIRUS',
|
|
47
|
-
text:
|
|
50
|
+
text:
|
|
51
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
|
|
48
52
|
href: imagePlaceholderHref('70x50'),
|
|
49
53
|
},
|
|
50
54
|
]
|
|
@@ -29,7 +29,8 @@ export default [
|
|
|
29
29
|
italic: false,
|
|
30
30
|
underline: false,
|
|
31
31
|
monospace: false,
|
|
32
|
-
text:
|
|
32
|
+
text:
|
|
33
|
+
'Proin eget tortor risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; ',
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
36
|
type: 'text',
|
|
@@ -45,7 +46,8 @@ export default [
|
|
|
45
46
|
italic: false,
|
|
46
47
|
underline: false,
|
|
47
48
|
monospace: false,
|
|
48
|
-
text:
|
|
49
|
+
text:
|
|
50
|
+
', auctor sit amet aliquam vel, ullamcorper sit amet ligula. Donec rutrum congue leo eget malesuada. Proin eget tortor risus. Sed porttitor lectus nibh. Donec sollicitudin molestie malesuada.',
|
|
49
51
|
},
|
|
50
52
|
],
|
|
51
53
|
},
|
|
@@ -51,17 +51,21 @@ export default [
|
|
|
51
51
|
summary: {
|
|
52
52
|
children: [
|
|
53
53
|
{
|
|
54
|
-
text:
|
|
54
|
+
text:
|
|
55
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget lorem vel nunc feugiat malesuada ut ac nisi. Morbi odio ipsum, dignissim nec turpis vel, laoreet condimentum tortor. Duis laoreet tincidunt ullamcorper.',
|
|
55
56
|
},
|
|
56
57
|
{
|
|
57
|
-
text:
|
|
58
|
+
text:
|
|
59
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget lorem vel nunc feugiat malesuada ut ac nisi. Morbi odio ipsum, dignissim nec turpis vel, laoreet condimentum tortor. Duis laoreet tincidunt ullamcorper.',
|
|
58
60
|
},
|
|
59
61
|
{
|
|
60
62
|
url: 'http://this-is-a-url/',
|
|
61
|
-
text:
|
|
63
|
+
text:
|
|
64
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget lorem vel nunc feugiat malesuada ut ac nisi. Morbi odio ipsum, dignissim nec turpis vel, laoreet condimentum tortor. Duis laoreet tincidunt ullamcorper.',
|
|
62
65
|
},
|
|
63
66
|
{
|
|
64
|
-
text:
|
|
67
|
+
text:
|
|
68
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget lorem vel nunc feugiat malesuada ut ac nisi. Morbi odio ipsum, dignissim nec turpis vel, laoreet condimentum tortor. Duis laoreet tincidunt ullamcorper.',
|
|
65
69
|
},
|
|
66
70
|
],
|
|
67
71
|
},
|
|
@@ -994,11 +994,11 @@ workflows:
|
|
|
994
994
|
jobs:
|
|
995
995
|
- newskit/init_aws:
|
|
996
996
|
<<: *only_on_master_branch
|
|
997
|
-
context:
|
|
997
|
+
context: <% PROJECT_NAME >-dev
|
|
998
998
|
name: init_aws_eks_pr
|
|
999
999
|
job_type: 'eks_pr'
|
|
1000
1000
|
- newskit/remove_all_pr_environments:
|
|
1001
1001
|
<<: *only_on_master_branch
|
|
1002
|
-
context:
|
|
1002
|
+
context: <% PROJECT_NAME >-dev
|
|
1003
1003
|
requires:
|
|
1004
1004
|
- init_aws_eks_pr
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.1",
|
|
4
4
|
"description": "Newskit Render - Core package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
"test:unit": "jest --coverage --verbose --silent --i",
|
|
17
17
|
"test:unit:ci": "JEST_JUNIT_OUTPUT_NAME=core.xml node --max_old_space_size=4096 --expose-gc ./node_modules/.bin/jest --ci --coverage --reporters=default --reporters=jest-junit --runInBand --logHeapUsage",
|
|
18
18
|
"test:watch": "jest --watch",
|
|
19
|
-
"cy:run": "cypress run -b chrome --headless",
|
|
20
|
-
"cy:
|
|
19
|
+
"cy:run": "cypress run --config-file cypress/config/config.e2e.json -b chrome --headless",
|
|
20
|
+
"cy:vis": "cypress run --config-file cypress/config/config.visual.json -b chrome --headless",
|
|
21
|
+
"cy:open": "cypress open --config-file cypress/config/config.e2e.json -b chrome",
|
|
21
22
|
"test:e2e": "yarn cy:run",
|
|
23
|
+
"test:e2e:ci": "cypress run --env -b chrome --headless",
|
|
22
24
|
"start:test:server": "next build && next start",
|
|
23
25
|
"wait:server": "wait-on http://localhost:3000",
|
|
24
26
|
"pact:test": "NEWSKIT_API_ENV_URL='http://localhost:4343' jest --config=jest.config.pact.js",
|
|
@@ -30,63 +32,67 @@
|
|
|
30
32
|
"analyze": "ANALYZE=true next build"
|
|
31
33
|
},
|
|
32
34
|
"dependencies": {
|
|
33
|
-
"@apollo/client": "
|
|
34
|
-
"@newskit-render/api": "^0.
|
|
35
|
-
"@newskit-render/auth": "^0.
|
|
36
|
-
"@newskit-render/checkout": "^0.
|
|
37
|
-
"@newskit-render/
|
|
38
|
-
"@newskit-render/
|
|
39
|
-
"@newskit-render/
|
|
40
|
-
"@newskit-render/
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"react
|
|
48
|
-
"react-
|
|
35
|
+
"@apollo/client": "3.4.16",
|
|
36
|
+
"@newskit-render/api": "^0.13.0",
|
|
37
|
+
"@newskit-render/auth": "^0.27.0",
|
|
38
|
+
"@newskit-render/checkout": "^0.19.1",
|
|
39
|
+
"@newskit-render/feature-flags": "^0.9.0",
|
|
40
|
+
"@newskit-render/my-account": "^0.133.0",
|
|
41
|
+
"@newskit-render/shared-components": "^0.31.0",
|
|
42
|
+
"@newskit-render/sitemap": "^0.31.1",
|
|
43
|
+
"@newskit-render/validation": "^0.33.0",
|
|
44
|
+
"cross-fetch": "3.1.5",
|
|
45
|
+
"graphql": "15.6.0",
|
|
46
|
+
"newrelic": "7.1.0",
|
|
47
|
+
"newskit": "5.0.0",
|
|
48
|
+
"next": "12.0.8",
|
|
49
|
+
"react": "17.0.2",
|
|
50
|
+
"react-dom": "17.0.2",
|
|
51
|
+
"react-helmet": "6.1.0",
|
|
49
52
|
"react-hook-form": "7.8.4"
|
|
50
53
|
},
|
|
51
54
|
"devDependencies": {
|
|
52
|
-
"@apollo/react-testing": "
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@testing-library/
|
|
58
|
-
"@
|
|
59
|
-
"@types/
|
|
60
|
-
"@types/react
|
|
61
|
-
"@
|
|
62
|
-
"@typescript-eslint/
|
|
63
|
-
"
|
|
55
|
+
"@apollo/react-testing": "4.0.0",
|
|
56
|
+
"@applitools/eyes-cypress": "3.23.2",
|
|
57
|
+
"@emotion/jest": "11.3.0",
|
|
58
|
+
"@next/bundle-analyzer": "12.0.8",
|
|
59
|
+
"@pact-foundation/pact": "9.12.1",
|
|
60
|
+
"@testing-library/jest-dom": "5.11.4",
|
|
61
|
+
"@testing-library/react": "11.0.2",
|
|
62
|
+
"@types/newrelic": "7.0.0",
|
|
63
|
+
"@types/react": "17.0.2",
|
|
64
|
+
"@types/react-helmet": "6.1.0",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "3.7.1",
|
|
66
|
+
"@typescript-eslint/parser": "3.7.1",
|
|
67
|
+
"axe-core": "4.3.4",
|
|
68
|
+
"babel-jest": "26.3.0",
|
|
64
69
|
"cypress": "9.0.0",
|
|
65
|
-
"
|
|
66
|
-
"eslint
|
|
67
|
-
"eslint-config-airbnb
|
|
68
|
-
"eslint-config-
|
|
69
|
-
"eslint-config-
|
|
70
|
-
"eslint-
|
|
71
|
-
"eslint-
|
|
72
|
-
"eslint-
|
|
73
|
-
"eslint-plugin-
|
|
74
|
-
"eslint-plugin-
|
|
70
|
+
"cypress-axe": "0.13.0",
|
|
71
|
+
"eslint": "6.6.0",
|
|
72
|
+
"eslint-config-airbnb": "18.2.0",
|
|
73
|
+
"eslint-config-airbnb-typescript": "9.0.0",
|
|
74
|
+
"eslint-config-prettier": "6.11.0",
|
|
75
|
+
"eslint-config-react-app": "5.2.1",
|
|
76
|
+
"eslint-import-resolver-typescript": "2.0.0",
|
|
77
|
+
"eslint-loader": "4.0.2",
|
|
78
|
+
"eslint-plugin-cypress": "2.11.2",
|
|
79
|
+
"eslint-plugin-flowtype": "5.2.0",
|
|
80
|
+
"eslint-plugin-import": "2.22.1",
|
|
75
81
|
"eslint-plugin-jsx-a11y": "6.2.3",
|
|
76
|
-
"eslint-plugin-prettier": "
|
|
82
|
+
"eslint-plugin-prettier": "3.1.4",
|
|
77
83
|
"eslint-plugin-react": "7.19.0",
|
|
78
|
-
"eslint-plugin-react-hooks": "
|
|
79
|
-
"jest": "
|
|
80
|
-
"jest-junit": "
|
|
81
|
-
"jest-watch-typeahead": "
|
|
82
|
-
"lint-staged": "
|
|
83
|
-
"next-transpile-modules": "
|
|
84
|
-
"prettier": "
|
|
85
|
-
"prettier-eslint": "
|
|
86
|
-
"prettier-eslint-cli": "
|
|
87
|
-
"ts-jest": "
|
|
88
|
-
"typescript": "
|
|
89
|
-
"wait-on": "
|
|
84
|
+
"eslint-plugin-react-hooks": "1.6.1",
|
|
85
|
+
"jest": "27.2.4",
|
|
86
|
+
"jest-junit": "12.0.0",
|
|
87
|
+
"jest-watch-typeahead": "0.6.3",
|
|
88
|
+
"lint-staged": "12.1.7",
|
|
89
|
+
"next-transpile-modules": "8.0.0",
|
|
90
|
+
"prettier": "2.0.5",
|
|
91
|
+
"prettier-eslint": "11.0.0",
|
|
92
|
+
"prettier-eslint-cli": "5.0.0",
|
|
93
|
+
"ts-jest": "27.0.5",
|
|
94
|
+
"typescript": "4.4.3",
|
|
95
|
+
"wait-on": "5.3.0"
|
|
90
96
|
},
|
|
91
97
|
"precommit": [
|
|
92
98
|
"precommit"
|
package/pages/_app.tsx
CHANGED
|
@@ -3,6 +3,12 @@ import { AppProps } from 'next/app'
|
|
|
3
3
|
import Head from 'next/head'
|
|
4
4
|
import { ThemeProvider, Global, css, styled } from 'newskit'
|
|
5
5
|
import { SessionProvider } from '@newskit-render/auth'
|
|
6
|
+
import {
|
|
7
|
+
getFeatureFlags,
|
|
8
|
+
FeatureFlagsContextProvider,
|
|
9
|
+
FeatureFlag,
|
|
10
|
+
createFeatureFlagsInstance,
|
|
11
|
+
} from '@newskit-render/feature-flags'
|
|
6
12
|
import { AppContextProvider, AppContext } from '../app-context/AppContext'
|
|
7
13
|
import { logger } from '../helpers/logger'
|
|
8
14
|
|
|
@@ -12,6 +18,12 @@ if (!process.browser) {
|
|
|
12
18
|
logger()
|
|
13
19
|
}
|
|
14
20
|
|
|
21
|
+
if (process.env.OPTIMIZELY_SDK_KEY) {
|
|
22
|
+
createFeatureFlagsInstance({
|
|
23
|
+
optimizelyConfig: { sdkKey: process.env.OPTIMIZELY_SDK_KEY },
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
15
27
|
const GlobalStyling = css`
|
|
16
28
|
@font-face {
|
|
17
29
|
font-family: GillSansMTStd-Medium;
|
|
@@ -49,6 +61,178 @@ const GlobalStyling = css`
|
|
|
49
61
|
font-family: TheSun-Medium;
|
|
50
62
|
src: url('/fonts/TheSun-Medium.ttf') format('truetype');
|
|
51
63
|
}
|
|
64
|
+
@font-face {
|
|
65
|
+
font-family: 'DM Sans';
|
|
66
|
+
src: url('/fonts/dmsans-regular-webfont.woff2') format('woff2'),
|
|
67
|
+
url('/fonts/dmsans-regular-webfont.woff') format('woff');
|
|
68
|
+
font-style: normal;
|
|
69
|
+
font-weight: 400;
|
|
70
|
+
font-display: swap;
|
|
71
|
+
}
|
|
72
|
+
@font-face {
|
|
73
|
+
font-family: 'DM Sans';
|
|
74
|
+
src: url('/fonts/dmsans-italic-webfont.woff2') format('woff2'),
|
|
75
|
+
url('/fonts/dmsans-italic-webfont.woff') format('woff');
|
|
76
|
+
font-style: italic;
|
|
77
|
+
font-weight: 400;
|
|
78
|
+
font-display: swap;
|
|
79
|
+
}
|
|
80
|
+
@font-face {
|
|
81
|
+
font-family: 'DM Sans';
|
|
82
|
+
src: url('/fonts/dmsans-medium-webfont.woff2') format('woff2'),
|
|
83
|
+
url('/fonts/dmsans-medium-webfont.woff') format('woff');
|
|
84
|
+
font-style: normal;
|
|
85
|
+
font-weight: 500;
|
|
86
|
+
font-display: swap;
|
|
87
|
+
}
|
|
88
|
+
@font-face {
|
|
89
|
+
font-family: 'DM Sans';
|
|
90
|
+
src: url('/fonts/dmsans-mediumitalic-webfont.woff2') format('woff2'),
|
|
91
|
+
url('/fonts/dmsans-mediumitalic-webfont.woff') format('woff');
|
|
92
|
+
font-style: italic;
|
|
93
|
+
font-weight: 500;
|
|
94
|
+
font-display: swap;
|
|
95
|
+
}
|
|
96
|
+
@font-face {
|
|
97
|
+
font-family: 'DM Sans';
|
|
98
|
+
src: url('/fonts/dmsans-bold-webfont.woff2') format('woff2'),
|
|
99
|
+
url('/fonts/dmsans-bold-webfont.woff') format('woff');
|
|
100
|
+
font-style: normal;
|
|
101
|
+
font-weight: 700;
|
|
102
|
+
font-display: swap;
|
|
103
|
+
}
|
|
104
|
+
@font-face {
|
|
105
|
+
font-family: 'DM Sans';
|
|
106
|
+
src: url('/fonts/dmsans-bolditalic-webfont.woff2') format('woff2'),
|
|
107
|
+
url('/fonts/dmsans-bolditalic-webfont.woff') format('woff');
|
|
108
|
+
font-style: italic;
|
|
109
|
+
font-weight: 700;
|
|
110
|
+
font-display: swap;
|
|
111
|
+
}
|
|
112
|
+
@font-face {
|
|
113
|
+
font-family: 'Poppins';
|
|
114
|
+
src: url('/fonts/poppins-bold-webfont.woff2') format('woff2'),
|
|
115
|
+
url('/fonts/poppins-bold-webfont.woff') format('woff');
|
|
116
|
+
font-weight: 700;
|
|
117
|
+
font-style: normal;
|
|
118
|
+
}
|
|
119
|
+
@font-face {
|
|
120
|
+
font-family: 'Poppins';
|
|
121
|
+
src: url('/fonts/poppins-bolditalic-webfont.woff2') format('woff2'),
|
|
122
|
+
url('/fonts/poppins-bolditalic-webfont.woff') format('woff');
|
|
123
|
+
font-weight: normal;
|
|
124
|
+
font-style: italic;
|
|
125
|
+
}
|
|
126
|
+
@font-face {
|
|
127
|
+
font-family: 'Poppins';
|
|
128
|
+
src: url('/fonts/poppins-extrabold-webfont.woff2') format('woff2'),
|
|
129
|
+
url('/fonts/poppins-extrabold-webfont.woff') format('woff');
|
|
130
|
+
font-weight: 800;
|
|
131
|
+
font-style: normal;
|
|
132
|
+
}
|
|
133
|
+
@font-face {
|
|
134
|
+
font-family: 'Poppins';
|
|
135
|
+
src: url('/fonts/poppins-extrabolditalic-webfont.woff2') format('woff2'),
|
|
136
|
+
url('/fonts/poppins-extrabolditalic-webfont.woff') format('woff');
|
|
137
|
+
font-weight: 800;
|
|
138
|
+
font-style: italic;
|
|
139
|
+
}
|
|
140
|
+
@font-face {
|
|
141
|
+
font-family: 'Poppins';
|
|
142
|
+
src: url('/fonts/poppins-italic-webfont.woff2') format('woff2'),
|
|
143
|
+
url('/fonts/poppins-italic-webfont.woff') format('woff');
|
|
144
|
+
font-weight: 400;
|
|
145
|
+
font-style: italic;
|
|
146
|
+
}
|
|
147
|
+
@font-face {
|
|
148
|
+
font-family: 'Poppins';
|
|
149
|
+
src: url('/fonts/poppins-light-webfont.woff2') format('woff2'),
|
|
150
|
+
url('/fonts/poppins-light-webfont.woff') format('woff');
|
|
151
|
+
font-weight: 300;
|
|
152
|
+
font-style: normal;
|
|
153
|
+
}
|
|
154
|
+
@font-face {
|
|
155
|
+
font-family: 'Poppins';
|
|
156
|
+
src: url('/fonts/poppins-lightitalic-webfont.woff2') format('woff2'),
|
|
157
|
+
url('/fonts/poppins-lightitalic-webfont.woff') format('woff');
|
|
158
|
+
font-weight: 300;
|
|
159
|
+
font-style: italic;
|
|
160
|
+
}
|
|
161
|
+
@font-face {
|
|
162
|
+
font-family: 'Poppins';
|
|
163
|
+
src: url('/fonts/poppins-medium-webfont.woff2') format('woff2'),
|
|
164
|
+
url('/fonts/poppins-medium-webfont.woff') format('woff');
|
|
165
|
+
font-weight: 500;
|
|
166
|
+
font-style: normal;
|
|
167
|
+
}
|
|
168
|
+
@font-face {
|
|
169
|
+
font-family: 'Poppins';
|
|
170
|
+
src: url('/fonts/poppins-mediumitalic-webfont.woff2') format('woff2'),
|
|
171
|
+
url('/fonts/poppins-mediumitalic-webfont.woff') format('woff');
|
|
172
|
+
font-weight: 500;
|
|
173
|
+
font-style: italic;
|
|
174
|
+
}
|
|
175
|
+
@font-face {
|
|
176
|
+
font-family: 'Poppins';
|
|
177
|
+
src: url('/fonts/poppins-regular-webfont.woff2') format('woff2'),
|
|
178
|
+
url('/fonts/poppins-regular-webfont.woff') format('woff');
|
|
179
|
+
font-weight: 400;
|
|
180
|
+
font-style: normal;
|
|
181
|
+
}
|
|
182
|
+
@font-face {
|
|
183
|
+
font-family: 'Poppins';
|
|
184
|
+
src: url('/fonts/poppins-semibold-webfont.woff2') format('woff2'),
|
|
185
|
+
url('/fonts/poppins-semibold-webfont.woff') format('woff');
|
|
186
|
+
font-weight: 600;
|
|
187
|
+
font-style: normal;
|
|
188
|
+
}
|
|
189
|
+
@font-face {
|
|
190
|
+
font-family: 'Poppins';
|
|
191
|
+
src: url('/fonts/poppins-semibolditalic-webfont.woff2') format('woff2'),
|
|
192
|
+
url('/fonts/poppins-semibolditalic-webfont.woff') format('woff');
|
|
193
|
+
font-weight: 600;
|
|
194
|
+
font-style: italic;
|
|
195
|
+
}
|
|
196
|
+
@font-face {
|
|
197
|
+
font-family: 'DM Mono';
|
|
198
|
+
src: url('/fonts/dmmono-medium.woff2') format('woff2'),
|
|
199
|
+
url('/fonts/dmmono-medium.woff') format('woff');
|
|
200
|
+
font-style: normal;
|
|
201
|
+
font-weight: 500;
|
|
202
|
+
font-display: swap;
|
|
203
|
+
}
|
|
204
|
+
@font-face {
|
|
205
|
+
font-family: 'Bitter';
|
|
206
|
+
src: url('/fonts/bitter-regular.woff2') format('woff2'),
|
|
207
|
+
url('/fonts/bitter-regular.woff') format('woff');
|
|
208
|
+
font-style: normal;
|
|
209
|
+
font-weight: 400;
|
|
210
|
+
font-display: swap;
|
|
211
|
+
}
|
|
212
|
+
@font-face {
|
|
213
|
+
font-family: 'Bitter';
|
|
214
|
+
src: url('/fonts/bitter-medium.woff2') format('woff2'),
|
|
215
|
+
url('/fonts/bitter-medium.woff') format('woff');
|
|
216
|
+
font-style: normal;
|
|
217
|
+
font-weight: 500;
|
|
218
|
+
font-display: swap;
|
|
219
|
+
}
|
|
220
|
+
@font-face {
|
|
221
|
+
font-family: 'Bitter';
|
|
222
|
+
src: url('/fonts/bitter-mediumitalic.woff2') format('woff2'),
|
|
223
|
+
url('/fonts/bitter-mediumitalic.woff') format('woff');
|
|
224
|
+
font-style: italic;
|
|
225
|
+
font-weight: 500;
|
|
226
|
+
font-display: swap;
|
|
227
|
+
}
|
|
228
|
+
@font-face {
|
|
229
|
+
font-family: 'Bitter';
|
|
230
|
+
src: url('/fonts/bitter-semibold.woff2') format('woff2'),
|
|
231
|
+
url('/fonts/bitter-semibold.woff') format('woff');
|
|
232
|
+
font-style: normal;
|
|
233
|
+
font-weight: 600;
|
|
234
|
+
font-display: swap;
|
|
235
|
+
}
|
|
52
236
|
|
|
53
237
|
html,
|
|
54
238
|
body {
|
|
@@ -68,7 +252,11 @@ const PageContainer = styled.div`
|
|
|
68
252
|
min-height: 100vh;
|
|
69
253
|
`
|
|
70
254
|
|
|
71
|
-
|
|
255
|
+
interface MyAppProps extends AppProps {
|
|
256
|
+
featureFlags?: FeatureFlag
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function MyApp({ Component, pageProps, featureFlags }: MyAppProps) {
|
|
72
260
|
return (
|
|
73
261
|
<AppContextProvider>
|
|
74
262
|
<>
|
|
@@ -82,21 +270,36 @@ function MyApp({ Component, pageProps }: AppProps) {
|
|
|
82
270
|
key="viewport"
|
|
83
271
|
/>
|
|
84
272
|
</Head>
|
|
85
|
-
<
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
273
|
+
<FeatureFlagsContextProvider context={featureFlags}>
|
|
274
|
+
<SessionProvider pageProps={pageProps}>
|
|
275
|
+
<AppContext.Consumer>
|
|
276
|
+
{({ theme }) => (
|
|
277
|
+
<ThemeProvider theme={theme}>
|
|
278
|
+
<Global styles={GlobalStyling} />
|
|
279
|
+
<PageContainer>
|
|
280
|
+
<Component {...pageProps} />
|
|
281
|
+
</PageContainer>
|
|
282
|
+
</ThemeProvider>
|
|
283
|
+
)}
|
|
284
|
+
</AppContext.Consumer>
|
|
285
|
+
</SessionProvider>
|
|
286
|
+
</FeatureFlagsContextProvider>
|
|
97
287
|
</>
|
|
98
288
|
</AppContextProvider>
|
|
99
289
|
)
|
|
100
290
|
}
|
|
101
291
|
|
|
292
|
+
MyApp.getInitialProps = async ({ Component, ctx }) => {
|
|
293
|
+
let pageProps = {}
|
|
294
|
+
if (Component.getInitialProps) {
|
|
295
|
+
pageProps = await Component.getInitialProps(ctx)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (process.env.OPTIMIZELY_SDK_KEY) {
|
|
299
|
+
const featureFlags = await getFeatureFlags()
|
|
300
|
+
return { featureFlags, pageProps }
|
|
301
|
+
}
|
|
302
|
+
return { pageProps }
|
|
303
|
+
}
|
|
304
|
+
|
|
102
305
|
export default MyApp
|