@newskit-render/core 1.54.0 → 1.59.0
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 +97 -0
- package/__tests__/pages/[articleSlug].test.tsx +6 -8
- package/__tests__/pages/__snapshots__/brightcove.test.tsx.snap +20 -0
- package/__tests__/pages/__snapshots__/home.test.tsx.snap +139 -139
- package/__tests__/pages/brightcove.test.tsx +34 -0
- package/__tests__/pages/home.test.tsx +22 -18
- package/__tests__/pages/mocks.ts +29 -0
- package/__tests__/pages/relatedArticles.test.tsx +76 -0
- package/components/article/RelatedArticles.tsx +48 -55
- package/components/article/__tests__/__snapshots__/index.test.tsx.snap +305 -308
- package/components/article/__tests__/index.test.tsx +46 -2
- package/components/article/index.tsx +28 -15
- package/components/footer/__snapshots__/index.test.tsx.snap +29 -29
- package/components/section/layouts/Rows.tsx +36 -17
- package/components/section/layouts/__tests__/Rows.test.tsx +12 -0
- package/components/section/layouts/__tests__/__snapshots__/Lead.test.tsx.snap +17 -17
- package/components/section/layouts/__tests__/__snapshots__/SectionTitle.test.tsx.snap +23 -23
- package/components/section/layouts/types.ts +3 -0
- package/config/index.ts +85 -0
- package/constants/index.ts +3 -1
- package/cypress/e2e/account/accessibility.spec.js +14 -17
- package/helpers/logger.ts +3 -1
- package/helpers/mocks/articleMock.ts +1 -1
- package/helpers/mocks/getUniversalArticleMock.ts +13 -0
- package/jest.config.js +1 -0
- package/package.json +11 -11
- package/pages/[section]/[articleId]/[articleSlug].tsx +9 -4
- package/pages/[section]/[articleId]/relatedArticles.tsx +85 -0
- package/pages/_app.tsx +4 -3
- package/pages/_document.tsx +17 -18
- package/pages/api/auth/[...nextauth].ts +2 -3
- package/pages/api/feed.ts +3 -5
- package/pages/api/news-sitemap.ts +4 -6
- package/pages/api/sitemap.ts +10 -7
- package/pages/index.tsx +1 -1
- package/pages/player/brightcove.tsx +19 -0
- package/pages/preview/[articleId]/version/[versionId]/index.tsx +9 -4
- package/queries/getRadioPosts.ts +1 -1
- package/queries/getUniversalArticle.ts +13 -0
- package/temp/header.tsx +7 -0
package/config/index.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const {
|
|
2
|
+
OKTA_CLIENT_ID,
|
|
3
|
+
OKTA_CLIENT_SECRET,
|
|
4
|
+
OKTA_DOMAIN,
|
|
5
|
+
NEWSKIT_API_ENV_URL,
|
|
6
|
+
NEWSKIT_API_X_API_KEY,
|
|
7
|
+
SITE_HOST,
|
|
8
|
+
OPTIMIZELY_SDK_KEY,
|
|
9
|
+
SITEMAP_FIRST_PUBLICATION_DATE,
|
|
10
|
+
SITEMAP_PUBLICATION_NAME,
|
|
11
|
+
NEW_RELIC_ENABLED,
|
|
12
|
+
EXPERIMENTATION_WEB,
|
|
13
|
+
SOURCEPOINT_ACCOUNT_ID,
|
|
14
|
+
SOURCEPOINT_PROPERTY_HREF,
|
|
15
|
+
TEALIUM_ACCOUNT_ID,
|
|
16
|
+
TEALIUM_PROFILE_ID,
|
|
17
|
+
TEALIUM_ENV,
|
|
18
|
+
TWITTER_USERNAME,
|
|
19
|
+
GSC_ID,
|
|
20
|
+
PUBLISHER,
|
|
21
|
+
} = process?.env
|
|
22
|
+
|
|
23
|
+
const requiredConfigFields: string[] = [
|
|
24
|
+
'SITE_HOST',
|
|
25
|
+
'NEWSKIT_API_ENV_URL',
|
|
26
|
+
'NEWSKIT_API_X_API_KEY',
|
|
27
|
+
'OKTA_CLIENT_ID',
|
|
28
|
+
'OKTA_CLIENT_SECRET',
|
|
29
|
+
'OKTA_DOMAIN',
|
|
30
|
+
'PUBLISHER',
|
|
31
|
+
]
|
|
32
|
+
const getSanitizedConfig = () => {
|
|
33
|
+
for (const key of requiredConfigFields) {
|
|
34
|
+
const value = process.env[key]
|
|
35
|
+
if (
|
|
36
|
+
typeof window == 'undefined' &&
|
|
37
|
+
(value === undefined || value.length <= 0)
|
|
38
|
+
) {
|
|
39
|
+
throw new Error(`Missing key ${key} in env`)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
oktaClientId: OKTA_CLIENT_ID,
|
|
44
|
+
oktaClientSecret: OKTA_CLIENT_SECRET,
|
|
45
|
+
oktaDomain: OKTA_DOMAIN,
|
|
46
|
+
newskitApiEnvUrl: NEWSKIT_API_ENV_URL,
|
|
47
|
+
newskitApiXApiKey: NEWSKIT_API_X_API_KEY,
|
|
48
|
+
optimizelysdkKey: OPTIMIZELY_SDK_KEY,
|
|
49
|
+
siteHost: SITE_HOST,
|
|
50
|
+
sitemapFirstPublicationDate: SITEMAP_FIRST_PUBLICATION_DATE,
|
|
51
|
+
sitemapPublicationName: SITEMAP_PUBLICATION_NAME,
|
|
52
|
+
newRelicEnabled: NEW_RELIC_ENABLED,
|
|
53
|
+
experimentationWeb: EXPERIMENTATION_WEB,
|
|
54
|
+
sourcepointAccountId: SOURCEPOINT_ACCOUNT_ID,
|
|
55
|
+
sourcepointPropertyHref: SOURCEPOINT_PROPERTY_HREF,
|
|
56
|
+
tealiumAccountId: TEALIUM_ACCOUNT_ID,
|
|
57
|
+
tealiumProfileId: TEALIUM_PROFILE_ID,
|
|
58
|
+
tealiumEnv: TEALIUM_ENV,
|
|
59
|
+
twitterUsername: TWITTER_USERNAME,
|
|
60
|
+
gscId: GSC_ID,
|
|
61
|
+
publisher: PUBLISHER,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const config = getSanitizedConfig()
|
|
65
|
+
export const {
|
|
66
|
+
oktaClientId,
|
|
67
|
+
oktaClientSecret,
|
|
68
|
+
oktaDomain,
|
|
69
|
+
newskitApiEnvUrl,
|
|
70
|
+
newskitApiXApiKey,
|
|
71
|
+
optimizelysdkKey,
|
|
72
|
+
siteHost,
|
|
73
|
+
sitemapFirstPublicationDate,
|
|
74
|
+
sitemapPublicationName,
|
|
75
|
+
newRelicEnabled,
|
|
76
|
+
experimentationWeb,
|
|
77
|
+
sourcepointAccountId,
|
|
78
|
+
sourcepointPropertyHref,
|
|
79
|
+
tealiumAccountId,
|
|
80
|
+
tealiumProfileId,
|
|
81
|
+
tealiumEnv,
|
|
82
|
+
twitterUsername,
|
|
83
|
+
gscId,
|
|
84
|
+
publisher,
|
|
85
|
+
} = config
|
package/constants/index.ts
CHANGED
|
@@ -22,39 +22,36 @@ const pages = [
|
|
|
22
22
|
{
|
|
23
23
|
url: '/account',
|
|
24
24
|
name: 'Personal Details',
|
|
25
|
-
skip: { skipFailures: true }, // error being caused by newskit update - https://nidigitalsolutions.jira.com/browse/PPDSC-1864 - removed once fixed
|
|
26
25
|
},
|
|
27
|
-
{ url: '/account/edit/name', name: 'Name form'
|
|
28
|
-
{ url: '/account/edit/displayName', name: 'Display Name form'
|
|
29
|
-
{ url: '/account/edit/email', name: 'Email form'
|
|
30
|
-
{ url: '/account/edit/password', name: 'Password form'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// { url: '/account/edit/landline', name: 'Landline phone form', skip: false },
|
|
26
|
+
{ url: '/account/edit/name', name: 'Name form' },
|
|
27
|
+
{ url: '/account/edit/displayName', name: 'Display Name form' },
|
|
28
|
+
{ url: '/account/edit/email', name: 'Email form' },
|
|
29
|
+
{ url: '/account/edit/password', name: 'Password form' },
|
|
30
|
+
{ url: '/account/edit/mobile', name: 'Mobile phone form' },
|
|
31
|
+
{ url: '/account/edit/landline', name: 'Landline phone form' },
|
|
34
32
|
{
|
|
35
33
|
url: '/account/edit/address',
|
|
36
34
|
name: 'Address form',
|
|
37
|
-
skip: { skipFailures: true },
|
|
35
|
+
skip: { skipFailures: true },
|
|
36
|
+
// error being caused by Loqate, ignore at this time
|
|
38
37
|
},
|
|
39
38
|
{
|
|
40
39
|
url: '/account/subscription-and-billing',
|
|
41
40
|
name: 'Subscription and Billing',
|
|
42
|
-
skip: { skipFailures: true }, // error being caused by newskit update - https://nidigitalsolutions.jira.com/browse/PPDSC-1864 - removed once fixed
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
url: '/account/payment',
|
|
46
|
-
name: 'Payment form',
|
|
47
|
-
skip: { skipFailures: true }, // error being caused by Stripe, ignore at this time
|
|
48
41
|
},
|
|
42
|
+
// TODO: Urgerntly find the reason why this state is failing! Uncomment immediately after that
|
|
43
|
+
// {
|
|
44
|
+
// url: '/account/payment',
|
|
45
|
+
// name: 'Payment form',
|
|
46
|
+
// skip: { skipFailures: true }, // error being caused by Stripe, ignore at this time
|
|
47
|
+
// },
|
|
49
48
|
{
|
|
50
49
|
url: '/account/newsletters-and-alerts',
|
|
51
50
|
name: 'Newsletters and Alerts',
|
|
52
|
-
skip: { skipFailures: true }, // error being caused by newskit update - https://nidigitalsolutions.jira.com/browse/PPDSC-1864 - removed once fixed
|
|
53
51
|
},
|
|
54
52
|
{
|
|
55
53
|
url: '/account/edit/commenting-notifications',
|
|
56
54
|
name: 'Commenting Notifications form',
|
|
57
|
-
skip: null,
|
|
58
55
|
},
|
|
59
56
|
]
|
|
60
57
|
|
package/helpers/logger.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { newRelicEnabled } from '../config'
|
|
2
|
+
|
|
1
3
|
export const logger = () => {
|
|
2
|
-
if (
|
|
4
|
+
if (newRelicEnabled === 'true') {
|
|
3
5
|
// Format Output logs to be properly logged for NewRelic
|
|
4
6
|
const { log, error, warn, info } = console
|
|
5
7
|
|
|
@@ -45,7 +45,7 @@ export const relatedArticles = [
|
|
|
45
45
|
href: imagePlaceholderHref('70x50'),
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
title: 'Royal
|
|
48
|
+
title: 'Royal',
|
|
49
49
|
tag: 'CORONAVIRUS',
|
|
50
50
|
text:
|
|
51
51
|
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
|
|
@@ -71,6 +71,19 @@ export default [
|
|
|
71
71
|
},
|
|
72
72
|
media: {
|
|
73
73
|
crops: null,
|
|
74
|
+
|
|
75
|
+
accountId: 'brightcove-acc-id-mock',
|
|
76
|
+
videoId: 'video-id-mock',
|
|
77
|
+
posterImage: {
|
|
78
|
+
crops: [
|
|
79
|
+
{
|
|
80
|
+
url:
|
|
81
|
+
'https://localhost:3000/video-thumbnail-artwork-mock.jpg',
|
|
82
|
+
alt: null,
|
|
83
|
+
aspectRatio: null,
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
74
87
|
},
|
|
75
88
|
},
|
|
76
89
|
},
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.59.0",
|
|
4
4
|
"description": "Newskit Render - Core package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@apollo/client": "3.4.16",
|
|
36
|
-
"@newskit-render/api": "^0.
|
|
37
|
-
"@newskit-render/auth": "^0.
|
|
38
|
-
"@newskit-render/checkout": "^0.
|
|
39
|
-
"@newskit-render/feature-flags": "^0.
|
|
40
|
-
"@newskit-render/feed": "^0.
|
|
41
|
-
"@newskit-render/my-account": "^0.
|
|
42
|
-
"@newskit-render/shared-components": "^0.
|
|
43
|
-
"@newskit-render/standalone-components": "^0.
|
|
44
|
-
"@newskit-render/validation": "^0.
|
|
36
|
+
"@newskit-render/api": "^0.27.0",
|
|
37
|
+
"@newskit-render/auth": "^0.37.0",
|
|
38
|
+
"@newskit-render/checkout": "^0.32.0",
|
|
39
|
+
"@newskit-render/feature-flags": "^0.18.0",
|
|
40
|
+
"@newskit-render/feed": "^0.15.0",
|
|
41
|
+
"@newskit-render/my-account": "^0.164.0",
|
|
42
|
+
"@newskit-render/shared-components": "^0.54.0",
|
|
43
|
+
"@newskit-render/standalone-components": "^0.12.0",
|
|
44
|
+
"@newskit-render/validation": "^0.44.0",
|
|
45
45
|
"cross-fetch": "3.1.5",
|
|
46
46
|
"graphql": "15.6.0",
|
|
47
47
|
"newrelic": "7.1.0",
|
|
48
|
-
"newskit": "5.
|
|
48
|
+
"newskit": "5.4.5",
|
|
49
49
|
"next": "12.1.0",
|
|
50
50
|
"react": "17.0.2",
|
|
51
51
|
"react-dom": "17.0.2",
|
|
@@ -16,6 +16,11 @@ import ArticlePage, { UniversalArticle } from '../../../components/article'
|
|
|
16
16
|
import { fetchUser } from '../../../helpers/getUser'
|
|
17
17
|
import { ACCOUNT_QUERY_URL } from '../../../constants'
|
|
18
18
|
import { addCacheHeaders } from '../../../helpers/addCacheHeaders'
|
|
19
|
+
import {
|
|
20
|
+
siteHost as configSiteHost,
|
|
21
|
+
twitterUsername as configTwitterUsername,
|
|
22
|
+
gscId as configGscId,
|
|
23
|
+
} from '../../../config'
|
|
19
24
|
|
|
20
25
|
export type ArticleSlug = {
|
|
21
26
|
universalArticle: UniversalArticle
|
|
@@ -79,10 +84,10 @@ export async function getServerSideProps(context) {
|
|
|
79
84
|
return {
|
|
80
85
|
props: {
|
|
81
86
|
universalArticle: data.universalArticle,
|
|
82
|
-
articleURL: `${
|
|
83
|
-
twitterUsername:
|
|
84
|
-
siteHost:
|
|
85
|
-
gscId:
|
|
87
|
+
articleURL: `${configSiteHost}/${section}/${articleId}/${articleSlug}`,
|
|
88
|
+
twitterUsername: configTwitterUsername || '',
|
|
89
|
+
siteHost: configSiteHost || '',
|
|
90
|
+
gscId: configGscId || '',
|
|
86
91
|
showAds: true,
|
|
87
92
|
recommendations,
|
|
88
93
|
user,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import newrelic from 'newrelic'
|
|
3
|
+
import { getAcsCookie, ClientTypes, Publisher } from '@newskit-render/api'
|
|
4
|
+
import {
|
|
5
|
+
recommendationsProvider,
|
|
6
|
+
Article,
|
|
7
|
+
} from '@newskit-render/standalone-components'
|
|
8
|
+
import { Block, Cell, TitleBar } from 'newskit'
|
|
9
|
+
import { UserData } from '@newskit-render/my-account'
|
|
10
|
+
import { fetchUser } from '../../../helpers/getUser'
|
|
11
|
+
import { ACCOUNT_QUERY_URL } from '../../../constants'
|
|
12
|
+
import { addCacheHeaders } from '../../../helpers/addCacheHeaders'
|
|
13
|
+
import Layout from '../../../components/layout'
|
|
14
|
+
import { BasicRow } from '../../../components/section/layouts'
|
|
15
|
+
|
|
16
|
+
export type RelatedArticles = {
|
|
17
|
+
user?: UserData
|
|
18
|
+
recommendations: Article[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const RelatedArticlesPage: React.FC<RelatedArticles> = ({
|
|
22
|
+
user,
|
|
23
|
+
recommendations,
|
|
24
|
+
}) => (
|
|
25
|
+
<Layout dataTestId="SectionGrid" user={user}>
|
|
26
|
+
<Cell xs={12} md={10} mdOffset={1} data-testid="SectionCell">
|
|
27
|
+
<Block spaceStack="space080" />
|
|
28
|
+
<Block spaceStack="space080">
|
|
29
|
+
<TitleBar
|
|
30
|
+
overrides={{
|
|
31
|
+
spaceInset: {
|
|
32
|
+
xs: 'spaceInsetSquish000',
|
|
33
|
+
},
|
|
34
|
+
heading: {
|
|
35
|
+
typographyPreset: {
|
|
36
|
+
xs: 'editorialHeadline050',
|
|
37
|
+
md: 'editorialHeadline060',
|
|
38
|
+
xl: 'editorialHeadline070',
|
|
39
|
+
},
|
|
40
|
+
stylePreset: 'inkContrast',
|
|
41
|
+
},
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
Related Articles
|
|
45
|
+
</TitleBar>
|
|
46
|
+
</Block>
|
|
47
|
+
<BasicRow
|
|
48
|
+
colums={{ xs: '1fr', md: '1fr 1fr', lg: '1fr 1fr 1fr' }}
|
|
49
|
+
articles={recommendations}
|
|
50
|
+
/>
|
|
51
|
+
</Cell>
|
|
52
|
+
</Layout>
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
export async function getServerSideProps(context) {
|
|
56
|
+
newrelic.setTransactionName('RelatedArticlesPage')
|
|
57
|
+
console.warn('context:')
|
|
58
|
+
console.warn(context.req && context.req.headers)
|
|
59
|
+
|
|
60
|
+
const {
|
|
61
|
+
params: { articleId },
|
|
62
|
+
} = context
|
|
63
|
+
|
|
64
|
+
const acsCookie = context.req.headers.cookie
|
|
65
|
+
? getAcsCookie(ClientTypes.main, context.req.headers.cookie)
|
|
66
|
+
: ''
|
|
67
|
+
|
|
68
|
+
const [recommendations, user] = await Promise.all([
|
|
69
|
+
await recommendationsProvider({ articleId, publisher: Publisher.SUN_UK }),
|
|
70
|
+
await fetchUser(acsCookie, ACCOUNT_QUERY_URL),
|
|
71
|
+
])
|
|
72
|
+
|
|
73
|
+
addCacheHeaders(context.res)
|
|
74
|
+
|
|
75
|
+
const recommendationsToShow = recommendations.slice(0, 18)
|
|
76
|
+
return {
|
|
77
|
+
props: {
|
|
78
|
+
recommendations: recommendationsToShow,
|
|
79
|
+
showAds: true,
|
|
80
|
+
user,
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default RelatedArticlesPage
|
package/pages/_app.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from '@newskit-render/feature-flags'
|
|
12
12
|
import { AppContextProvider, AppContext } from '../app-context/AppContext'
|
|
13
13
|
import { logger } from '../helpers/logger'
|
|
14
|
+
import { optimizelysdkKey } from '../config'
|
|
14
15
|
|
|
15
16
|
if (!process.browser) {
|
|
16
17
|
// eslint-disable-next-line global-require
|
|
@@ -18,9 +19,9 @@ if (!process.browser) {
|
|
|
18
19
|
logger()
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
if (
|
|
22
|
+
if (optimizelysdkKey) {
|
|
22
23
|
createFeatureFlagsInstance({
|
|
23
|
-
optimizelyConfig: { sdkKey:
|
|
24
|
+
optimizelyConfig: { sdkKey: optimizelysdkKey },
|
|
24
25
|
})
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -295,7 +296,7 @@ MyApp.getInitialProps = async ({ Component, ctx }) => {
|
|
|
295
296
|
pageProps = await Component.getInitialProps(ctx)
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
if (
|
|
299
|
+
if (optimizelysdkKey) {
|
|
299
300
|
const featureFlags = await getFeatureFlags()
|
|
300
301
|
return { featureFlags, pageProps }
|
|
301
302
|
}
|
package/pages/_document.tsx
CHANGED
|
@@ -11,15 +11,14 @@ import { ExperimentationWeb, Consent, Tealium } from 'newskit'
|
|
|
11
11
|
import Helmet from 'react-helmet'
|
|
12
12
|
import newrelic from 'newrelic'
|
|
13
13
|
import { getSubStringBetween } from '../components/utils'
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = process.env
|
|
14
|
+
import {
|
|
15
|
+
experimentationWeb,
|
|
16
|
+
sourcepointAccountId,
|
|
17
|
+
sourcepointPropertyHref,
|
|
18
|
+
tealiumAccountId,
|
|
19
|
+
tealiumProfileId,
|
|
20
|
+
tealiumEnv,
|
|
21
|
+
} from '../config'
|
|
23
22
|
|
|
24
23
|
export default class MyDocument extends Document {
|
|
25
24
|
static async getInitialProps(ctx: DocumentContext) {
|
|
@@ -53,20 +52,20 @@ export default class MyDocument extends Document {
|
|
|
53
52
|
),
|
|
54
53
|
}}
|
|
55
54
|
/>
|
|
56
|
-
{
|
|
55
|
+
{experimentationWeb &&
|
|
57
56
|
featureFlags &&
|
|
58
57
|
featureFlags.experimentation_web_flag && (
|
|
59
58
|
<ExperimentationWeb
|
|
60
|
-
optimizelyWebConfig={{ scriptCdn:
|
|
59
|
+
optimizelyWebConfig={{ scriptCdn: experimentationWeb }}
|
|
61
60
|
reactHelmet={Helmet}
|
|
62
61
|
/>
|
|
63
62
|
)}
|
|
64
63
|
{helmet.script.toComponent()}
|
|
65
|
-
{
|
|
64
|
+
{sourcepointAccountId && (
|
|
66
65
|
<Consent
|
|
67
66
|
sourcePointConfigTCFV2={{
|
|
68
|
-
accountId: Number(
|
|
69
|
-
propertyHref:
|
|
67
|
+
accountId: Number(sourcepointAccountId),
|
|
68
|
+
propertyHref: sourcepointPropertyHref,
|
|
70
69
|
}}
|
|
71
70
|
/>
|
|
72
71
|
)}
|
|
@@ -85,11 +84,11 @@ export default class MyDocument extends Document {
|
|
|
85
84
|
)}
|
|
86
85
|
</Head>
|
|
87
86
|
<body>
|
|
88
|
-
{
|
|
87
|
+
{tealiumAccountId && (
|
|
89
88
|
<Tealium
|
|
90
|
-
accountId={
|
|
91
|
-
profileId={
|
|
92
|
-
env={
|
|
89
|
+
accountId={tealiumAccountId}
|
|
90
|
+
profileId={tealiumProfileId as string}
|
|
91
|
+
env={tealiumEnv as string}
|
|
93
92
|
/>
|
|
94
93
|
)}
|
|
95
94
|
<Main />
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import createAuthRoute from '@newskit-render/auth/providers'
|
|
2
2
|
import { NextApiRequest, NextApiResponse } from 'next'
|
|
3
|
-
|
|
4
|
-
const { OKTA_CLIENT_ID, OKTA_CLIENT_SECRET, OKTA_DOMAIN } = process.env
|
|
3
|
+
import { oktaClientId, oktaClientSecret, oktaDomain } from '../../../config'
|
|
5
4
|
|
|
6
5
|
export default (req: NextApiRequest, res: NextApiResponse) =>
|
|
7
|
-
createAuthRoute(req, res, {
|
|
6
|
+
createAuthRoute(req, res, { oktaClientId, oktaClientSecret, oktaDomain })
|
package/pages/api/feed.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { NextApiRequest, NextApiResponse } from 'next'
|
|
2
2
|
import { rssFeed, UpdatePeriod } from '@newskit-render/feed'
|
|
3
3
|
import { Publisher } from '@newskit-render/api'
|
|
4
|
+
import { publisher, siteHost } from '../../config'
|
|
4
5
|
|
|
5
6
|
const handler = async (req: NextApiRequest, res: NextApiResponse) =>
|
|
6
7
|
rssFeed({
|
|
7
8
|
res,
|
|
8
9
|
publisher:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
: (process.env.PUBLISHER as Publisher),
|
|
12
|
-
domain: process.env.SITE_HOST,
|
|
10
|
+
publisher === 'DEMO' ? Publisher.VIRGIN : (publisher as Publisher),
|
|
11
|
+
domain: siteHost,
|
|
13
12
|
titeAttributes: {
|
|
14
13
|
title: 'Demo Site',
|
|
15
14
|
link: '/feed',
|
|
16
15
|
description: 'Newskit Render Demo site',
|
|
17
|
-
lastBuildDate: new Date().toUTCString(),
|
|
18
16
|
language: 'en-US',
|
|
19
17
|
updatePeriod: 'hourly' as UpdatePeriod,
|
|
20
18
|
updateFrequency: 1,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NextApiRequest, NextApiResponse } from 'next'
|
|
2
2
|
import { newsSitemap } from '@newskit-render/feed'
|
|
3
3
|
import { Publisher } from '@newskit-render/api'
|
|
4
|
-
|
|
4
|
+
import { publisher, siteHost, sitemapPublicationName } from '../../config'
|
|
5
5
|
/* We do not have sitemap date for Demo so using Virgin,
|
|
6
6
|
* This can be removed and replace with just - publisher: process.env.PUBLISHER as PublisherGroup, in created projects
|
|
7
7
|
*/
|
|
@@ -10,11 +10,9 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) =>
|
|
|
10
10
|
newsSitemap({
|
|
11
11
|
res,
|
|
12
12
|
publisher:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
domain: new URL(process.env.SITE_HOST as string).host,
|
|
17
|
-
publicationName: process.env.SITEMAP_PUBLICATION_NAME as string,
|
|
13
|
+
publisher === 'DEMO' ? Publisher.VIRGIN : (publisher as Publisher),
|
|
14
|
+
domain: new URL(siteHost as string).host,
|
|
15
|
+
publicationName: sitemapPublicationName as string,
|
|
18
16
|
})
|
|
19
17
|
|
|
20
18
|
export default handler
|
package/pages/api/sitemap.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { NextApiRequest, NextApiResponse } from 'next'
|
|
2
2
|
import { genericSitemap, CustomStaticPage } from '@newskit-render/feed'
|
|
3
3
|
import { Publisher } from '@newskit-render/api'
|
|
4
|
-
|
|
4
|
+
import {
|
|
5
|
+
publisher,
|
|
6
|
+
siteHost,
|
|
7
|
+
sitemapFirstPublicationDate,
|
|
8
|
+
sitemapPublicationName,
|
|
9
|
+
} from '../../config'
|
|
5
10
|
/* We do not have sitemap date for Demo so using Virgin,
|
|
6
11
|
* This can be removed and replace with just - publisher: process.env.PUBLISHER as PublisherGroup, in created projects
|
|
7
12
|
*/
|
|
@@ -16,12 +21,10 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) =>
|
|
|
16
21
|
res,
|
|
17
22
|
query: req.query,
|
|
18
23
|
publisher:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
firstArticleDate: process.env.SITEMAP_FIRST_PUBLICATION_DATE as string,
|
|
24
|
-
publicationName: process.env.SITEMAP_PUBLICATION_NAME as string,
|
|
24
|
+
publisher === 'DEMO' ? Publisher.VIRGIN : (publisher as Publisher),
|
|
25
|
+
domain: new URL(siteHost as string).host,
|
|
26
|
+
firstArticleDate: sitemapFirstPublicationDate as string,
|
|
27
|
+
publicationName: sitemapPublicationName as string,
|
|
25
28
|
customStaticPageCollection: defaultCustomStaticPagesCollection,
|
|
26
29
|
})
|
|
27
30
|
|
package/pages/index.tsx
CHANGED
|
@@ -12,9 +12,9 @@ import { addCacheHeaders } from '../helpers/addCacheHeaders'
|
|
|
12
12
|
|
|
13
13
|
export async function getServerSideProps(context) {
|
|
14
14
|
newrelic.setTransactionName('Homepage')
|
|
15
|
+
console.warn('config:')
|
|
15
16
|
console.warn('context:')
|
|
16
17
|
console.warn(context.req && context.req.headers)
|
|
17
|
-
|
|
18
18
|
const apolloClient = await createApolloClient(ClientTypes.nkapi)
|
|
19
19
|
const acsCookie = context.req.headers.cookie
|
|
20
20
|
? getAcsCookie(ClientTypes.main, context.req.headers.cookie)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { VideoPlayer } from 'newskit'
|
|
3
|
+
import { useRouter } from 'next/router'
|
|
4
|
+
|
|
5
|
+
const BrightcovePlayer: React.FC<{}> = () => {
|
|
6
|
+
const router = useRouter()
|
|
7
|
+
|
|
8
|
+
const videoConfig = {
|
|
9
|
+
'data-account': router.query.account_id as string,
|
|
10
|
+
'data-player': router.query.player_id as string,
|
|
11
|
+
'data-video-id': router.query.video_id as string,
|
|
12
|
+
'data-embed': 'default',
|
|
13
|
+
controls: true,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return <VideoPlayer config={videoConfig} />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default BrightcovePlayer
|
|
@@ -22,6 +22,11 @@ import {
|
|
|
22
22
|
relatedArticles,
|
|
23
23
|
} from '../../../../../helpers/mocks/articleMock'
|
|
24
24
|
import { addCacheHeaders } from '../../../../../helpers/addCacheHeaders'
|
|
25
|
+
import {
|
|
26
|
+
siteHost as configSiteHost,
|
|
27
|
+
twitterUsername as configTwitterUsername,
|
|
28
|
+
gscId as configGscId,
|
|
29
|
+
} from '../../../../../config'
|
|
25
30
|
|
|
26
31
|
const PreviewArticle = ({
|
|
27
32
|
universalArticle,
|
|
@@ -104,10 +109,10 @@ export async function getServerSideProps(context) {
|
|
|
104
109
|
props: {
|
|
105
110
|
universalArticle: data.universalArticle,
|
|
106
111
|
session,
|
|
107
|
-
articleURL: `${
|
|
108
|
-
twitterUsername:
|
|
109
|
-
siteHost:
|
|
110
|
-
gscId:
|
|
112
|
+
articleURL: `${configSiteHost}/preview/${articleId}/version/${versionId}`,
|
|
113
|
+
twitterUsername: configTwitterUsername || '',
|
|
114
|
+
siteHost: configSiteHost || '',
|
|
115
|
+
gscId: configGscId || '',
|
|
111
116
|
},
|
|
112
117
|
}
|
|
113
118
|
}
|
package/queries/getRadioPosts.ts
CHANGED
package/temp/header.tsx
CHANGED
|
@@ -121,6 +121,13 @@ const pastDueBanner = {
|
|
|
121
121
|
text:
|
|
122
122
|
'You have cancelled your subscription and will lose access to all benefits on ##DATE##. To re-activate your subscription call ##PHONE_NUMBER##.',
|
|
123
123
|
},
|
|
124
|
+
toBeCancelledWithRefund: {
|
|
125
|
+
title: 'Your subscription will end soon.',
|
|
126
|
+
phoneNumber: '0800 xxxx xxxxx',
|
|
127
|
+
text:
|
|
128
|
+
'We have successfully cancelled your subscription and will be processing your refund shortly. If you have any question please call ##PHONE_NUMBER##.',
|
|
129
|
+
dismissDays: 7,
|
|
130
|
+
},
|
|
124
131
|
treshold: {
|
|
125
132
|
firstNotice: 26,
|
|
126
133
|
secondNotice: 30,
|