@newskit-render/core 1.6.0 → 1.13.2
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 +1 -0
- package/CHANGELOG.md +187 -0
- package/README.md +1 -1
- package/__tests__/pages/[articleSlug].test.tsx +1 -3
- package/__tests__/pages/__snapshots__/home.test.tsx.snap +1 -1
- package/__tests__/pages/home.test.tsx +0 -5
- package/{context → app-context}/AppContext.test.tsx +3 -2
- package/{context → app-context}/AppContext.tsx +3 -3
- package/{context → app-context}/__snapshots__/AppContext.test.tsx.snap +0 -0
- package/components/article/__tests__/__snapshots__/index.test.tsx.snap +1 -2
- package/components/article/__tests__/index.test.tsx +0 -1
- package/components/header/index.tsx +1 -1
- package/components/section/layouts/__tests__/__snapshots__/Lead.test.tsx.snap +1 -1
- package/infrastructure/.circleci/config.yml +1 -0
- package/infrastructure/terraform-newrelic/dashboards.tf +176 -0
- package/infrastructure/terraform-newrelic/lighthouse-script-prod.js +46 -0
- package/infrastructure/terraform-newrelic/lighthouse-script.js +46 -0
- package/infrastructure/terraform-newrelic/monitors.tf +12 -0
- package/next-env.d.ts +0 -1
- package/next.config.js +37 -32
- package/package.json +23 -10
- package/pages/[section]/[articleId]/[articleSlug].tsx +10 -13
- package/pages/[section]/index.tsx +12 -9
- package/pages/_app.tsx +38 -1
- package/pages/account/cancellation/index.tsx +6 -5
- package/pages/account/edit/[field].tsx +11 -2
- package/pages/account/index.tsx +9 -2
- package/pages/account/newsletters-and-alerts/index.tsx +10 -1
- package/pages/account/payment/index.tsx +8 -1
- package/pages/account/subscription-and-billing/index.tsx +14 -1
- package/pages/checkout/account-creation/index.tsx +14 -0
- package/pages/checkout/payment-details/index.tsx +14 -0
- package/pages/index.tsx +11 -9
- package/public/MyAccount/display-personalDetails-header-sun.svg +55 -0
- package/public/MyAccount/display-personalDetails-header-times.svg +90 -0
- package/public/MyAccount/display-personalDetails-header-vr.svg +46 -0
- package/public/MyAccount/navigationPrimary-brandMark-sun.svg +3 -0
- package/public/MyAccount/navigationPrimary-brandMark-times.svg +18 -0
- package/public/MyAccount/navigationPrimary-brandMark-vr.svg +10 -0
- package/public/fonts/GillSansMTStd-Bold.otf +0 -0
- package/public/fonts/GillSansMTStd-BoldCondensed.otf +0 -0
- package/public/fonts/GillSansMTStd-BoldItalic.otf +0 -0
- package/public/fonts/GillSansMTStd-Book.otf +0 -0
- package/public/fonts/GillSansMTStd-BookItalic.otf +0 -0
- package/public/fonts/GillSansMTStd-Condensed.otf +0 -0
- package/public/fonts/GillSansMTStd-ExtraBold.otf +0 -0
- package/public/fonts/GillSansMTStd-Heavy.otf +0 -0
- package/public/fonts/GillSansMTStd-HeavyItalic.otf +0 -0
- package/public/fonts/GillSansMTStd-Light.otf +0 -0
- package/public/fonts/GillSansMTStd-LightItalic.otf +0 -0
- package/public/fonts/GillSansMTStd-Medium.otf +0 -0
- package/public/fonts/GillSansMTStd-MediumItalic.otf +0 -0
- package/public/fonts/GillSansMTStd-UltraBold.otf +0 -0
- package/public/fonts/GillSansMTStd-UltraBoldCond.otf +0 -0
- package/public/fonts/Montserrat-Black.ttf +0 -0
- package/public/fonts/Montserrat-BlackItalic.ttf +0 -0
- package/public/fonts/Montserrat-Bold.ttf +0 -0
- package/public/fonts/Montserrat-BoldItalic.ttf +0 -0
- package/public/fonts/Montserrat-ExtraBold.ttf +0 -0
- package/public/fonts/Montserrat-ExtraBoldItalic.ttf +0 -0
- package/public/fonts/Montserrat-ExtraLight.ttf +0 -0
- package/public/fonts/Montserrat-ExtraLightItalic.ttf +0 -0
- package/public/fonts/Montserrat-Italic.ttf +0 -0
- package/public/fonts/Montserrat-Light.ttf +0 -0
- package/public/fonts/Montserrat-LightItalic.ttf +0 -0
- package/public/fonts/Montserrat-Medium.ttf +0 -0
- package/public/fonts/Montserrat-MediumItalic.ttf +0 -0
- package/public/fonts/Montserrat-Regular.ttf +0 -0
- package/public/fonts/Montserrat-SemiBold.ttf +0 -0
- package/public/fonts/Montserrat-SemiBoldItalic.ttf +0 -0
- package/public/fonts/Montserrat-Thin.ttf +0 -0
- package/public/fonts/Montserrat-ThinItalic.ttf +0 -0
- package/public/fonts/TheSun-Bold.ttf +0 -0
- package/public/fonts/TheSun-BoldItalic.ttf +0 -0
- package/public/fonts/TheSun-HeavyCondensed.ttf +0 -0
- package/public/fonts/TheSun-HeavyNarrow.ttf +0 -0
- package/public/fonts/TheSun-Italic.ttf +0 -0
- package/public/fonts/TheSun-Medium.ttf +0 -0
- package/public/fonts/TheSun-MediumItalic.ttf +0 -0
- package/public/fonts/TheSun-Regular.ttf +0 -0
- package/public/fonts/TimesDigital-Bold.ttf +0 -0
- package/public/fonts/TimesDigital-BoldItalic.ttf +0 -0
- package/public/fonts/TimesDigital-BoldSC.ttf +0 -0
- package/public/fonts/TimesDigital-Italic.ttf +0 -0
- package/public/fonts/TimesDigital-Regular.ttf +0 -0
- package/public/fonts/TimesDigital-RegularSC.ttf +0 -0
- package/public/fonts/TimesDigitalW04-Bold.ttf +0 -0
- package/public/fonts/TimesDigitalW04-BoldItalic.ttf +0 -0
- package/public/fonts/TimesDigitalW04-BoldSC.ttf +0 -0
- package/public/fonts/TimesDigitalW04-Italic.ttf +0 -0
- package/public/fonts/TimesDigitalW04-Regular.ttf +0 -0
- package/public/fonts/TimesDigitalW04-RegularSC.ttf +0 -0
- package/queries/getUserSubscription.ts +0 -13
- package/tsconfig.json +1 -1
- package/pages/checkout/index.tsx +0 -7
package/next.config.js
CHANGED
|
@@ -5,38 +5,43 @@ const withTM = require('next-transpile-modules')([
|
|
|
5
5
|
'@newskit-render/my-account',
|
|
6
6
|
'@newskit-render/validation',
|
|
7
7
|
])
|
|
8
|
+
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
|
9
|
+
enabled: process.env.ANALYZE === 'true',
|
|
10
|
+
})
|
|
8
11
|
|
|
9
|
-
module.exports =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
module.exports = withBundleAnalyzer(
|
|
13
|
+
withTM({
|
|
14
|
+
webpack: (config, options) => {
|
|
15
|
+
if (options.isServer) {
|
|
16
|
+
config.externals = ['react', ...config.externals]
|
|
17
|
+
}
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
config.resolve.alias.newskit = path.resolve(
|
|
20
|
+
__dirname,
|
|
21
|
+
'.',
|
|
22
|
+
'node_modules',
|
|
23
|
+
'newskit'
|
|
24
|
+
)
|
|
25
|
+
config.resolve.alias.react = path.resolve(
|
|
26
|
+
__dirname,
|
|
27
|
+
'.',
|
|
28
|
+
'node_modules',
|
|
29
|
+
'react'
|
|
30
|
+
)
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
})
|
|
32
|
+
return config
|
|
33
|
+
},
|
|
34
|
+
async rewrites() {
|
|
35
|
+
return [
|
|
36
|
+
{
|
|
37
|
+
source: '/sitemap.xml',
|
|
38
|
+
destination: '/api/sitemap',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
source: '/news-sitemap.xml',
|
|
42
|
+
destination: '/api/news-sitemap',
|
|
43
|
+
},
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.2",
|
|
4
4
|
"description": "Newskit Render - Core package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -24,21 +24,24 @@
|
|
|
24
24
|
"pact:test": "NEWSKIT_API_ENV_URL='http://localhost:4343' jest --config=jest.config.pact.js",
|
|
25
25
|
"pact:publish": "pact-broker publish ./__pacts__/pacts --consumer-app-version=$(git describe --match '*core*' --abbrev=0) --tag='dev' --broker-base-url=$PACT_BROKER_URL --broker-token=$PACT_BROKER_TOKEN",
|
|
26
26
|
"lint": "eslint --ext .js,.jsx,.ts,.tsx . --color && prettier --check './**/*.{js,jsx,ts,tsx,json}'",
|
|
27
|
-
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --color --fix && prettier --write './**/*.{js,jsx,ts,tsx,json}'"
|
|
27
|
+
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --color --fix && prettier --write './**/*.{js,jsx,ts,tsx,json}'",
|
|
28
|
+
"precommit:lint": "eslint",
|
|
29
|
+
"precommit": "lint-staged",
|
|
30
|
+
"analyze": "ANALYZE=true next build"
|
|
28
31
|
},
|
|
29
32
|
"dependencies": {
|
|
30
33
|
"@apollo/client": "^3.4.16",
|
|
31
|
-
"@newskit-render/api": "^0.
|
|
32
|
-
"@newskit-render/auth": "^0.
|
|
33
|
-
"@newskit-render/checkout": "^0.
|
|
34
|
-
"@newskit-render/my-account": "^0.
|
|
35
|
-
"@newskit-render/shared-components": "^0.
|
|
36
|
-
"@newskit-render/sitemap": "^0.
|
|
37
|
-
"@newskit-render/validation": "^0.
|
|
34
|
+
"@newskit-render/api": "^0.8.0",
|
|
35
|
+
"@newskit-render/auth": "^0.25.0",
|
|
36
|
+
"@newskit-render/checkout": "^0.15.0",
|
|
37
|
+
"@newskit-render/my-account": "^0.122.0",
|
|
38
|
+
"@newskit-render/shared-components": "^0.25.0",
|
|
39
|
+
"@newskit-render/sitemap": "^0.28.0",
|
|
40
|
+
"@newskit-render/validation": "^0.30.0",
|
|
38
41
|
"cross-fetch": "^3.1.4",
|
|
39
42
|
"graphql": "^15.6.0",
|
|
40
43
|
"newrelic": "^7.1.0",
|
|
41
|
-
"newskit": "4.
|
|
44
|
+
"newskit": "4.3.1",
|
|
42
45
|
"next": "^12.0.2",
|
|
43
46
|
"react": "^17.0.1",
|
|
44
47
|
"react-dom": "^17.0.2",
|
|
@@ -48,6 +51,7 @@
|
|
|
48
51
|
"devDependencies": {
|
|
49
52
|
"@apollo/react-testing": "^4.0.0",
|
|
50
53
|
"@emotion/jest": "^11.3.0",
|
|
54
|
+
"@next/bundle-analyzer": "^12.0.8",
|
|
51
55
|
"@pact-foundation/pact": "^9.12.1",
|
|
52
56
|
"@testing-library/jest-dom": "^5.11.4",
|
|
53
57
|
"@testing-library/react": "^11.0.2",
|
|
@@ -75,6 +79,7 @@
|
|
|
75
79
|
"jest": "^27.2.4",
|
|
76
80
|
"jest-junit": "^12.0.0",
|
|
77
81
|
"jest-watch-typeahead": "^0.6.3",
|
|
82
|
+
"lint-staged": "^12.1.7",
|
|
78
83
|
"next-transpile-modules": "^8.0.0",
|
|
79
84
|
"prettier": "^2.0.5",
|
|
80
85
|
"prettier-eslint": "^11.0.0",
|
|
@@ -83,6 +88,14 @@
|
|
|
83
88
|
"typescript": "^4.4.3",
|
|
84
89
|
"wait-on": "^5.3.0"
|
|
85
90
|
},
|
|
91
|
+
"precommit": [
|
|
92
|
+
"precommit"
|
|
93
|
+
],
|
|
94
|
+
"lint-staged": {
|
|
95
|
+
"**/*.(ts|tsx)": [
|
|
96
|
+
"yarn run precommit:lint"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
86
99
|
"publishConfig": {
|
|
87
100
|
"access": "public"
|
|
88
101
|
},
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import newrelic from 'newrelic'
|
|
3
|
-
import {
|
|
4
|
-
createApolloClient,
|
|
5
|
-
sessionParser,
|
|
6
|
-
getMainSession,
|
|
7
|
-
ClientTypes,
|
|
8
|
-
} from '@newskit-render/api'
|
|
3
|
+
import { createApolloClient, ClientTypes } from '@newskit-render/api'
|
|
9
4
|
import { GET_UNIVERSAL_ARTICLE } from '../../../queries'
|
|
10
5
|
import ArticlePage, { UniversalArticle } from '../../../components/article'
|
|
11
6
|
import { highlights, relatedArticles } from '../../../helpers/mocks/articleMock'
|
|
12
7
|
import { UserData } from '../../../helpers/global-types'
|
|
13
|
-
import { fetchUser } from '../../../helpers/getUser'
|
|
14
|
-
import { ACCOUNT_QUERY_URL } from '../../../constants'
|
|
8
|
+
// import { fetchUser } from '../../../helpers/getUser'
|
|
9
|
+
// import { ACCOUNT_QUERY_URL } from '../../../constants'
|
|
15
10
|
import { addCacheHeaders } from '../../../helpers/addCacheHeaders'
|
|
16
11
|
|
|
17
12
|
export type ArticleSlug = {
|
|
@@ -46,8 +41,7 @@ const Article: React.FC<ArticleSlug> = ({
|
|
|
46
41
|
|
|
47
42
|
export async function getServerSideProps(context) {
|
|
48
43
|
const apolloClient = await createApolloClient(ClientTypes.nkapi)
|
|
49
|
-
const mainSession = getMainSession(context.req.headers.cookie)
|
|
50
|
-
const session = sessionParser(mainSession)
|
|
44
|
+
// const mainSession = getMainSession(context.req.headers.cookie)
|
|
51
45
|
|
|
52
46
|
const {
|
|
53
47
|
params: { articleId, section, articleSlug },
|
|
@@ -57,12 +51,15 @@ export async function getServerSideProps(context) {
|
|
|
57
51
|
`Article: /${section}/${articleId}/${articleSlug}`
|
|
58
52
|
)
|
|
59
53
|
|
|
60
|
-
const [
|
|
54
|
+
const [
|
|
55
|
+
{ data },
|
|
56
|
+
// user
|
|
57
|
+
] = await Promise.all([
|
|
61
58
|
apolloClient.query({
|
|
62
59
|
query: GET_UNIVERSAL_ARTICLE,
|
|
63
60
|
variables: { publisher: 'DEMO', id: articleId },
|
|
64
61
|
}),
|
|
65
|
-
await fetchUser(
|
|
62
|
+
// await fetchUser(mainSession, ACCOUNT_QUERY_URL),
|
|
66
63
|
])
|
|
67
64
|
|
|
68
65
|
addCacheHeaders(context.res)
|
|
@@ -73,7 +70,7 @@ export async function getServerSideProps(context) {
|
|
|
73
70
|
twitterUsername: process.env.TWITTER_USERNAME || '',
|
|
74
71
|
siteHost: process.env.SITE_HOST || '',
|
|
75
72
|
gscId: process.env.GSC_ID || '',
|
|
76
|
-
user,
|
|
73
|
+
// user,
|
|
77
74
|
},
|
|
78
75
|
}
|
|
79
76
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import newrelic from 'newrelic'
|
|
2
2
|
import {
|
|
3
3
|
createApolloClient,
|
|
4
|
-
|
|
5
|
-
getMainSession,
|
|
4
|
+
// getMainSession,
|
|
6
5
|
ClientTypes,
|
|
7
6
|
} from '@newskit-render/api'
|
|
8
7
|
import { GET_PAGE } from '../../queries'
|
|
9
8
|
import SectionPage from '../../components/section'
|
|
10
|
-
import { fetchUser } from '../../helpers/getUser'
|
|
11
|
-
import { ACCOUNT_QUERY_URL } from '../../constants'
|
|
9
|
+
// import { fetchUser } from '../../helpers/getUser'
|
|
10
|
+
// import { ACCOUNT_QUERY_URL } from '../../constants'
|
|
12
11
|
import { addCacheHeaders } from '../../helpers/addCacheHeaders'
|
|
13
12
|
|
|
14
13
|
export async function getServerSideProps(context) {
|
|
@@ -18,16 +17,20 @@ export async function getServerSideProps(context) {
|
|
|
18
17
|
params: { section },
|
|
19
18
|
} = context
|
|
20
19
|
|
|
21
|
-
const mainSession = getMainSession(context.req.headers.cookie)
|
|
22
|
-
const session = sessionParser(mainSession)
|
|
20
|
+
// const mainSession = getMainSession(context.req.headers.cookie)
|
|
23
21
|
|
|
24
22
|
newrelic.setTransactionName(`Section: ${section}`)
|
|
25
|
-
const [
|
|
23
|
+
const [
|
|
24
|
+
{ data },
|
|
25
|
+
// user
|
|
26
|
+
] = await Promise.all([
|
|
26
27
|
apolloClient.query({
|
|
27
28
|
query: GET_PAGE,
|
|
28
29
|
variables: { channel: section, publisher: 'DEMO' },
|
|
29
30
|
}),
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
// TODO: Enable once Main add Subscriptions
|
|
33
|
+
// await fetchUser(mainSession, ACCOUNT_QUERY_URL),
|
|
31
34
|
])
|
|
32
35
|
|
|
33
36
|
addCacheHeaders(context.res)
|
|
@@ -35,7 +38,7 @@ export async function getServerSideProps(context) {
|
|
|
35
38
|
props: {
|
|
36
39
|
page: data.page,
|
|
37
40
|
isIndexPage: true,
|
|
38
|
-
user,
|
|
41
|
+
// user,
|
|
39
42
|
},
|
|
40
43
|
}
|
|
41
44
|
}
|
package/pages/_app.tsx
CHANGED
|
@@ -3,7 +3,7 @@ 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 { AppContextProvider, AppContext } from '../context/AppContext'
|
|
6
|
+
import { AppContextProvider, AppContext } from '../app-context/AppContext'
|
|
7
7
|
import { logger } from '../helpers/logger'
|
|
8
8
|
|
|
9
9
|
if (!process.browser) {
|
|
@@ -13,6 +13,43 @@ if (!process.browser) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const GlobalStyling = css`
|
|
16
|
+
@font-face {
|
|
17
|
+
font-family: GillSansMTStd-Medium;
|
|
18
|
+
src: url('/fonts/GillSansMTStd-Medium.otf');
|
|
19
|
+
}
|
|
20
|
+
@font-face {
|
|
21
|
+
font-family: TimesModern-Bold;
|
|
22
|
+
src: url('/fonts/TimesDigital-Bold.ttf') format('truetype');
|
|
23
|
+
}
|
|
24
|
+
@font-face {
|
|
25
|
+
font-family: TimesModern-Regular;
|
|
26
|
+
src: url('/fonts/TimesDigital-Regular.ttf') format('truetype');
|
|
27
|
+
}
|
|
28
|
+
@font-face {
|
|
29
|
+
font-family: TimesDigitalW04-Regular;
|
|
30
|
+
src: url('/fonts/TimesDigitalW04-Regular.ttf') format('truetype');
|
|
31
|
+
}
|
|
32
|
+
@font-face {
|
|
33
|
+
font-family: Montserrat;
|
|
34
|
+
src: url('/fonts/Montserrat-Regular.ttf') format('truetype');
|
|
35
|
+
}
|
|
36
|
+
@font-face {
|
|
37
|
+
font-family: TheSun-Bold;
|
|
38
|
+
src: url('/fonts/TheSun-Bold.ttf') format('truetype');
|
|
39
|
+
}
|
|
40
|
+
@font-face {
|
|
41
|
+
font-family: TheSun-HeavyNarrow;
|
|
42
|
+
src: url('/fonts/TheSun-HeavyNarrow.ttf') format('truetype');
|
|
43
|
+
}
|
|
44
|
+
@font-face {
|
|
45
|
+
font-family: TheSun-Regular;
|
|
46
|
+
src: url('/fonts/TheSun-Regular.ttf') format('truetype');
|
|
47
|
+
}
|
|
48
|
+
@font-face {
|
|
49
|
+
font-family: TheSun-Medium;
|
|
50
|
+
src: url('/fonts/TheSun-Medium.ttf') format('truetype');
|
|
51
|
+
}
|
|
52
|
+
|
|
16
53
|
html,
|
|
17
54
|
body {
|
|
18
55
|
padding: 0;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useContext } from 'react'
|
|
2
2
|
import { Cancellation, getProviderProps } from '@newskit-render/my-account'
|
|
3
3
|
import newrelic from 'newrelic'
|
|
4
|
-
import
|
|
4
|
+
import { AppContext } from '../../../app-context/AppContext'
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const AccountCancellation = (props) => {
|
|
7
|
+
const { theme, setTheme } = useContext(AppContext)
|
|
8
|
+
return <Cancellation {...props} customTheme={theme} setTheme={setTheme} />
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
export default
|
|
11
|
+
export default AccountCancellation
|
|
11
12
|
|
|
12
13
|
export const getServerSideProps = async (context) => {
|
|
13
14
|
newrelic.setTransactionName('Account: Cancellation')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useContext } from 'react'
|
|
2
2
|
import newrelic from 'newrelic'
|
|
3
3
|
import {
|
|
4
4
|
EditField,
|
|
@@ -7,12 +7,21 @@ import {
|
|
|
7
7
|
componentMap,
|
|
8
8
|
} from '@newskit-render/my-account'
|
|
9
9
|
import validation from '../../../validation'
|
|
10
|
+
import { AppContext } from '../../../app-context/AppContext'
|
|
10
11
|
|
|
11
12
|
const AccountEditField = (props) => {
|
|
12
13
|
const doesEditPageExist = Object.keys(componentMap).includes(props.data.type)
|
|
14
|
+
const { theme, setTheme } = useContext(AppContext)
|
|
13
15
|
|
|
14
16
|
if (doesEditPageExist) {
|
|
15
|
-
return
|
|
17
|
+
return (
|
|
18
|
+
<EditField
|
|
19
|
+
{...props}
|
|
20
|
+
validation={validation}
|
|
21
|
+
customTheme={theme}
|
|
22
|
+
setTheme={setTheme}
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
16
25
|
}
|
|
17
26
|
return <NotFound />
|
|
18
27
|
}
|
package/pages/account/index.tsx
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { PersonalDetails, getProviderProps } from '@newskit-render/my-account'
|
|
2
1
|
import newrelic from 'newrelic'
|
|
2
|
+
import { PersonalDetails, getProviderProps } from '@newskit-render/my-account'
|
|
3
|
+
import React, { useContext } from 'react'
|
|
4
|
+
import { AppContext } from '../../app-context/AppContext'
|
|
5
|
+
|
|
6
|
+
const AccountPersonalDetails = (props) => {
|
|
7
|
+
const { theme, setTheme } = useContext(AppContext)
|
|
8
|
+
return <PersonalDetails {...props} customTheme={theme} setTheme={setTheme} />
|
|
9
|
+
}
|
|
3
10
|
|
|
4
|
-
export default
|
|
11
|
+
export default AccountPersonalDetails
|
|
5
12
|
|
|
6
13
|
export const getServerSideProps = async (context) => {
|
|
7
14
|
newrelic.setTransactionName('Account: Personal details')
|
|
@@ -3,8 +3,17 @@ import {
|
|
|
3
3
|
getProviderProps,
|
|
4
4
|
} from '@newskit-render/my-account'
|
|
5
5
|
import newrelic from 'newrelic'
|
|
6
|
+
import React, { useContext } from 'react'
|
|
7
|
+
import { AppContext } from '../../../app-context/AppContext'
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
const AccountNewslettersAndAlerts = (props) => {
|
|
10
|
+
const { theme, setTheme } = useContext(AppContext)
|
|
11
|
+
return (
|
|
12
|
+
<NewslettersAndAlerts {...props} customTheme={theme} setTheme={setTheme} />
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default AccountNewslettersAndAlerts
|
|
8
17
|
|
|
9
18
|
export const getServerSideProps = async (context) => {
|
|
10
19
|
newrelic.setTransactionName('Account: Newsletters and Alerts')
|
|
@@ -4,8 +4,15 @@ import {
|
|
|
4
4
|
getProviderProps,
|
|
5
5
|
PaymentProvider,
|
|
6
6
|
} from '@newskit-render/my-account'
|
|
7
|
+
import React, { useContext } from 'react'
|
|
8
|
+
import { AppContext } from '../../../app-context/AppContext'
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
const AccountCancellation = (props) => {
|
|
11
|
+
const { theme, setTheme } = useContext(AppContext)
|
|
12
|
+
return <Payment {...props} customTheme={theme} setTheme={setTheme} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default AccountCancellation
|
|
9
16
|
|
|
10
17
|
export const getServerSideProps = async (context) => {
|
|
11
18
|
newrelic.setTransactionName('Edit Payment method')
|
|
@@ -3,8 +3,21 @@ import {
|
|
|
3
3
|
getProviderProps,
|
|
4
4
|
} from '@newskit-render/my-account'
|
|
5
5
|
import newrelic from 'newrelic'
|
|
6
|
+
import React, { useContext } from 'react'
|
|
7
|
+
import { AppContext } from '../../../app-context/AppContext'
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
const AccountSubscriptionAndBilling = (props) => {
|
|
10
|
+
const { theme, setTheme } = useContext(AppContext)
|
|
11
|
+
return (
|
|
12
|
+
<SubscriptionAndBilling
|
|
13
|
+
{...props}
|
|
14
|
+
customTheme={theme}
|
|
15
|
+
setTheme={setTheme}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default AccountSubscriptionAndBilling
|
|
8
21
|
|
|
9
22
|
export const getServerSideProps = async (context) => {
|
|
10
23
|
newrelic.setTransactionName('Account: Subscription and Billing')
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AccountCreation, getProviderProps } from '@newskit-render/checkout'
|
|
2
|
+
import React, { useContext } from 'react'
|
|
3
|
+
import { AppContext } from '../../../app-context/AppContext'
|
|
4
|
+
|
|
5
|
+
const AccountCreationPage = (props) => {
|
|
6
|
+
const { theme, setTheme } = useContext(AppContext)
|
|
7
|
+
return <AccountCreation {...props} customTheme={theme} setTheme={setTheme} />
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default AccountCreationPage
|
|
11
|
+
|
|
12
|
+
export const getServerSideProps = async (context) => {
|
|
13
|
+
return getProviderProps({ ...context, provider: 'accountCreation' })
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PaymentDetails, getProviderProps } from '@newskit-render/checkout'
|
|
2
|
+
import React, { useContext } from 'react'
|
|
3
|
+
import { AppContext } from '../../../app-context/AppContext'
|
|
4
|
+
|
|
5
|
+
const PaymentDetailsPage = (props) => {
|
|
6
|
+
const { theme, setTheme } = useContext(AppContext)
|
|
7
|
+
return <PaymentDetails {...props} customTheme={theme} setTheme={setTheme} />
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default PaymentDetailsPage
|
|
11
|
+
|
|
12
|
+
export const getServerSideProps = async (context) => {
|
|
13
|
+
return getProviderProps({ ...context, provider: 'paymentDetails' })
|
|
14
|
+
}
|
package/pages/index.tsx
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import newrelic from 'newrelic'
|
|
2
2
|
import {
|
|
3
3
|
createApolloClient,
|
|
4
|
-
|
|
5
|
-
getMainSession,
|
|
4
|
+
// getMainSession,
|
|
6
5
|
ClientTypes,
|
|
7
6
|
} from '@newskit-render/api'
|
|
8
7
|
import { GET_PAGE } from '../queries'
|
|
9
8
|
import SectionPage from '../components/section'
|
|
10
|
-
import { fetchUser } from '../helpers/getUser'
|
|
11
|
-
import { ACCOUNT_QUERY_URL } from '../constants'
|
|
9
|
+
// import { fetchUser } from '../helpers/getUser'
|
|
10
|
+
// import { ACCOUNT_QUERY_URL } from '../constants'
|
|
12
11
|
import { addCacheHeaders } from '../helpers/addCacheHeaders'
|
|
13
12
|
|
|
14
13
|
export async function getServerSideProps(context) {
|
|
@@ -17,15 +16,18 @@ export async function getServerSideProps(context) {
|
|
|
17
16
|
console.warn(context.req && context.req.headers)
|
|
18
17
|
|
|
19
18
|
const apolloClient = await createApolloClient(ClientTypes.nkapi)
|
|
20
|
-
const mainSession = getMainSession(context.req.headers.cookie)
|
|
21
|
-
const session = sessionParser(mainSession)
|
|
19
|
+
// const mainSession = getMainSession(context.req.headers.cookie)
|
|
22
20
|
|
|
23
|
-
const [
|
|
21
|
+
const [
|
|
22
|
+
{ data },
|
|
23
|
+
// user
|
|
24
|
+
] = await Promise.all([
|
|
24
25
|
apolloClient.query({
|
|
25
26
|
query: GET_PAGE,
|
|
26
27
|
variables: { channel: 'homepage', publisher: 'DEMO' },
|
|
27
28
|
}),
|
|
28
|
-
|
|
29
|
+
// TODO: Enable once Main add Subscriptions
|
|
30
|
+
// await fetchUser(mainSession, ACCOUNT_QUERY_URL),
|
|
29
31
|
])
|
|
30
32
|
|
|
31
33
|
addCacheHeaders(context.res)
|
|
@@ -33,7 +35,7 @@ export async function getServerSideProps(context) {
|
|
|
33
35
|
return {
|
|
34
36
|
props: {
|
|
35
37
|
page,
|
|
36
|
-
user,
|
|
38
|
+
// user: (user || null),
|
|
37
39
|
},
|
|
38
40
|
}
|
|
39
41
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<svg width="560" height="315" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="560" height="315" rx="4" fill="#FAFAFA"/>
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M303.777 84.36H109.405c-5.288 0-9.797 4.339-9.797 9.714V221.92h213.966V94.074c0-5.375-4.492-9.715-9.797-9.715z" fill="#fff" stroke="#000" stroke-width=".417"/>
|
|
4
|
+
<path d="M206.983 93.373a1.568 1.568 0 10-.001-3.135 1.568 1.568 0 00.001 3.135z" stroke="#000" stroke-width=".417"/>
|
|
5
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M322.12 234.06H91.099c-12.01 0-20.099-4.121-20.099-5.873v-5.327c0-.527.523-.952 1.174-.952h268.871c.651 0 1.175.425 1.175.952v5.537c-.003 1.385-6.267 5.663-20.1 5.663z" fill="#fff" stroke="#000" stroke-width=".417"/>
|
|
6
|
+
<path d="M71.197 227.588h270.295" stroke="#000" stroke-width=".208" stroke-linecap="square"/>
|
|
7
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M235.979 222.301v1.21c0 .862-1.698 1.123-2.984 1.123H180.26c-1.352 0-3.063-.261-3.063-1.123v-1.21" fill="#fff"/>
|
|
8
|
+
<path d="M235.979 222.301v1.21c0 .862-1.698 1.123-2.984 1.123H180.26c-1.352 0-3.063-.261-3.063-1.123v-1.21" stroke="#000" stroke-width=".208"/>
|
|
9
|
+
<path d="M304.586 99.643H108.227v114.431h196.359V99.643z" fill="#EB1701" stroke="#000" stroke-width=".208"/>
|
|
10
|
+
<mask id="a" maskUnits="userSpaceOnUse" x="109" y="100" width="195" height="114">
|
|
11
|
+
<path d="M303.554 100.082H109.068v113.381h194.486V100.082z" fill="#0072EE"/>
|
|
12
|
+
</mask>
|
|
13
|
+
<g mask="url(#a)">
|
|
14
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M285.362 40.523c-64.413 0-116.691 52.278-116.691 116.692 0 64.413 52.278 116.691 116.691 116.691 64.414 0 116.692-52.278 116.692-116.691 0-64.414-52.278-116.692-116.692-116.692zm74.214 173.053c-16.686-20.304-57.178-27.189-74.215-27.189-17.037 0-57.529 6.885-74.216 27.189-11.902-15.637-19.137-35.124-19.137-56.362 0-51.461 41.892-93.353 93.353-93.353 51.461 0 93.353 41.892 93.353 93.353 0 21.238-7.235 40.725-19.138 56.362zm-115.055-85.53a40.737 40.737 0 0140.842-40.842 40.738 40.738 0 0140.842 40.842 40.738 40.738 0 01-40.842 40.842 40.737 40.737 0 01-40.842-40.842z" fill="#fff"/>
|
|
15
|
+
</g>
|
|
16
|
+
<path d="M108.447 213.468V99.476h195.919v113.992H108.447z" stroke="#000" stroke-width=".44"/>
|
|
17
|
+
<g clip-path="url(#display-personalDetails-header__clip0)" fill="#fff">
|
|
18
|
+
<path d="M136.298 112.022c-1.111-1.967-3.926-3.043-7.962-3.043-4.828 0-7.761 1.5-7.761 3.998 0 1.575 1.364 2.626 4.233 3.303l1.254.293 1.218.292 1.253.292c.055.018.146.032.225.075.449.164.713.399.713.659 0 .531-.847.898-2.105.898-2.022 0-3.042-.367-3.61-1.279l-5.451.677c1.391 2.277 4.351 3.41 8.951 3.41 4.892 0 8.266-1.746 8.266-4.276 0-1.397-1.534-2.719-3.863-3.232l-1.084-.235-1.084-.253-1.084-.236a16.018 16.018 0 01-.847-.221c-.623-.164-.911-.384-.911-.695 0-.498.713-.808 1.825-.808 1.506 0 2.59.424 2.925 1.19l4.899-.809zm13.78 1.153h-4.849l-1.064 4.088c-.362 1.372-1.092 2.063-2.183 2.063-.568 0-.883-.221-.883-.62 0-.132 0-.235.153-.809l1.246-4.725h-4.927l-1.328 5.164c-.154.62-.261 1.143-.261 1.411 0 1.069 1.506 1.91 3.43 1.91 1.951 0 3.141-.488 4.331-1.764l-.413 1.543h4.619l2.129-8.261zm1.049-.002l-2.156 8.268h4.745l1.301-4.961c.237-.873.859-1.322 1.813-1.322.777 0 1.191.221 1.191.652 0 .114-.056.385-.127.67l-1.273 4.961h4.856l1.455-5.649c.083-.303.126-.588.126-.841 0-1.208-1.482-2.031-3.654-2.031-1.994 0-3.449.556-4.178 1.593l.363-1.34h-4.462zm-8.538-3.084h.922l.154-.62h-3.007l-.162.62h.895l-.54 2.081h1.21l.528-2.081zm3.358 1.005l-.28 1.076h1.203l.693-2.683h-1.21l-.252.987h-1.084l.252-.987h-1.202l-.694 2.683h1.203l.28-1.076h1.091zm4.592.463h-1.86l.126-.474h1.498l.154-.588h-1.498l.106-.424h1.786l.153-.588h-2.979l-.694 2.683h3.047l.161-.609z"/>
|
|
19
|
+
</g>
|
|
20
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M468.147 226.296c0 4.324-3.519 7.828-7.861 7.828h-47.903c-4.342 0-7.862-3.504-7.862-7.828V107.907c0-4.323 3.52-7.827 7.862-7.827h47.903c4.342 0 7.861 3.504 7.861 7.827v118.389z" fill="#fff" stroke="#000" stroke-width=".52"/>
|
|
21
|
+
<path d="M463.709 117.658h-54.782v97.438h54.782v-97.438z" fill="#EB1701" stroke="#000" stroke-width=".26"/>
|
|
22
|
+
<path clip-rule="evenodd" d="M442.208 112.642c0 .311-.215.562-.48.562h-9.838c-.265 0-.48-.251-.48-.562v-1.262c0-.311.215-.562.48-.562h9.838c.265 0 .48.251.48.562v1.262z" stroke="#000" stroke-width=".26"/>
|
|
23
|
+
<path d="M436.824 107.382a1.468 1.468 0 100-2.935 1.468 1.468 0 000 2.935zm-.469 121.871c2.714 0 4.914-2.192 4.914-4.895 0-2.704-2.2-4.895-4.914-4.895-2.714 0-4.914 2.191-4.914 4.895 0 2.703 2.2 4.895 4.914 4.895z" stroke="#000" stroke-width=".26"/>
|
|
24
|
+
<path d="M464.108 117.461h-55.449v96.829h55.449v-96.829z" fill="#EB1701" stroke="#000" stroke-width=".208"/>
|
|
25
|
+
<path d="M408.879 214.898v-97.217h55.009v97.217h-55.009z" stroke="#000" stroke-width=".44"/>
|
|
26
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M406.156 237.16h-96.524a6.074 6.074 0 01-6.075-6.073V82.981a6.073 6.073 0 016.075-6.073h96.524a6.073 6.073 0 016.075 6.073v148.106a6.073 6.073 0 01-6.075 6.073z" fill="#fff" stroke="#000" stroke-width=".538"/>
|
|
27
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M406.156 237.16h-96.524a6.074 6.074 0 01-6.075-6.073V82.981a6.073 6.073 0 016.075-6.073h96.524a6.073 6.073 0 016.075 6.073v148.106a6.073 6.073 0 01-6.075 6.073z" fill="#fff" stroke="#000" stroke-width=".538"/>
|
|
28
|
+
<path d="M404.14 93.05h-92.03v127.891h92.03V93.051z" fill="#EB1701" stroke="#000" stroke-width=".269"/>
|
|
29
|
+
<path d="M358.136 232.631a4.056 4.056 0 100-8.112 4.056 4.056 0 000 8.112zm-.523-145.66a1.512 1.512 0 100-3.024 1.512 1.512 0 000 3.024z" stroke="#000" stroke-width=".269"/>
|
|
30
|
+
<path d="M404.522 93.46h-92.691v126.623h92.691V93.461z" fill="#EB1701" stroke="#000" stroke-width=".208"/>
|
|
31
|
+
<mask id="b" maskUnits="userSpaceOnUse" x="311" y="93" width="94" height="128">
|
|
32
|
+
<path d="M404.522 93.46h-92.691v126.623h92.691V93.461z" fill="#0072EE"/>
|
|
33
|
+
</mask>
|
|
34
|
+
<g mask="url(#b)">
|
|
35
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M285.362 39.693c-64.413 0-116.691 52.278-116.691 116.692 0 64.413 52.278 116.691 116.691 116.691 64.414 0 116.692-52.278 116.692-116.691 0-64.414-52.278-116.692-116.692-116.692zm74.214 173.055c-16.686-20.304-57.178-27.189-74.215-27.189-17.037 0-57.529 6.885-74.216 27.189-11.902-15.636-19.137-35.124-19.137-56.362 0-51.46 41.892-93.353 93.353-93.353 51.461 0 93.353 41.893 93.353 93.353 0 21.238-7.235 40.726-19.138 56.362zm-115.055-85.534a40.737 40.737 0 0140.842-40.842 40.738 40.738 0 0140.842 40.842 40.738 40.738 0 01-40.842 40.842 40.737 40.737 0 01-40.842-40.842z" fill="#fff"/>
|
|
36
|
+
</g>
|
|
37
|
+
<path d="M312.051 220.691V93.681h92.251v127.01h-92.251z" stroke="#000" stroke-width=".44"/>
|
|
38
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M329.918 230.548c0 4.097-3.335 7.418-7.45 7.418h-45.395c-4.115 0-7.45-3.321-7.45-7.418V118.357c0-4.097 3.335-7.418 7.45-7.418h45.395c4.115 0 7.45 3.321 7.45 7.418v112.191z" fill="#fff" stroke="#000" stroke-width=".493"/>
|
|
39
|
+
<path d="M325.71 127.602h-51.914v92.337h51.914v-92.337z" fill="#EB1701" stroke="#000" stroke-width=".247"/>
|
|
40
|
+
<path clip-rule="evenodd" d="M305.337 122.846c0 .294-.204.532-.454.532h-9.324c-.251 0-.455-.238-.455-.532v-1.197c0-.294.204-.532.455-.532h9.324c.25 0 .454.238.454.532v1.197z" stroke="#000" stroke-width=".247"/>
|
|
41
|
+
<path d="M300.235 117.861a1.392 1.392 0 10.001-2.783 1.392 1.392 0 00-.001 2.783zm-.447 115.488c2.571 0 4.656-2.076 4.656-4.638s-2.085-4.639-4.656-4.639c-2.572 0-4.657 2.077-4.657 4.639 0 2.562 2.085 4.638 4.657 4.638z" stroke="#000" stroke-width=".247"/>
|
|
42
|
+
<path d="M325.899 127.391h-52.138v92.691h52.138v-92.691z" fill="#EB1701" stroke="#000" stroke-width=".208"/>
|
|
43
|
+
<mask id="c" maskUnits="userSpaceOnUse" x="273" y="127" width="53" height="94">
|
|
44
|
+
<path d="M325.899 127.391h-52.138v92.691h52.138v-92.691z" fill="#0072EE"/>
|
|
45
|
+
</mask>
|
|
46
|
+
<g mask="url(#c)">
|
|
47
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M285.362 39.693c-64.413 0-116.691 52.278-116.691 116.692 0 64.413 52.278 116.691 116.691 116.691 64.414 0 116.692-52.278 116.692-116.691 0-64.414-52.278-116.692-116.692-116.692zm74.214 173.055c-16.686-20.304-57.178-27.189-74.215-27.189-17.037 0-57.529 6.885-74.216 27.189-11.902-15.636-19.137-35.124-19.137-56.362 0-51.46 41.892-93.353 93.353-93.353 51.461 0 93.353 41.893 93.353 93.353 0 21.238-7.235 40.726-19.138 56.362zm-115.055-85.534a40.737 40.737 0 0140.842-40.842 40.738 40.738 0 0140.842 40.842 40.738 40.738 0 01-40.842 40.842 40.737 40.737 0 01-40.842-40.842z" fill="#fff"/>
|
|
48
|
+
</g>
|
|
49
|
+
<path d="M273.981 220.689v-93.078h51.698v93.078h-51.698z" stroke="#000" stroke-width=".44"/>
|
|
50
|
+
<defs>
|
|
51
|
+
<clipPath id="display-personalDetails-header__clip0">
|
|
52
|
+
<path fill="#fff" transform="translate(118.022 108.781)" d="M0 0h45.142v13.166H0z"/>
|
|
53
|
+
</clipPath>
|
|
54
|
+
</defs>
|
|
55
|
+
</svg>
|