@newskit-render/core 1.44.2 → 1.48.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/CHANGELOG.md +111 -0
- package/__tests__/pages/[articleSlug].test.tsx +59 -18
- package/__tests__/pages/__snapshots__/home.test.tsx.snap +769 -1261
- package/components/article/Highlights.tsx +4 -33
- package/components/article/RelatedArticles.tsx +4 -53
- package/components/article/__tests__/__snapshots__/index.test.tsx.snap +53 -43
- package/components/section/ArticleSlice.tsx +17 -43
- package/components/section/CollectionBlock.tsx +38 -6
- package/components/section/__tests__/ArticleSlice.test.tsx +37 -51
- package/components/section/__tests__/CollectionBlock.test.tsx +63 -13
- package/components/section/__tests__/pageBlock.test.tsx +8 -4
- package/components/section/index.tsx +17 -12
- package/components/section/layouts/Lead.tsx +36 -15
- package/components/section/layouts/Rows.tsx +67 -0
- package/components/section/layouts/{SectionRow.tsx → SectionTitle.tsx} +24 -52
- package/components/section/layouts/__tests__/Lead.test.tsx +31 -6
- package/components/section/layouts/__tests__/Rows.test.tsx +28 -0
- package/components/section/layouts/__tests__/SectionTitle.test.tsx +36 -0
- package/components/section/layouts/__tests__/__snapshots__/Lead.test.tsx.snap +274 -315
- package/components/section/layouts/__tests__/__snapshots__/SectionTitle.test.tsx.snap +942 -0
- package/components/section/layouts/gridUtils.ts +12 -9
- package/components/section/layouts/index.tsx +2 -1
- package/components/section/layouts/types.ts +5 -1
- package/components/section/{pageBlock.ts → pageBlock.tsx} +5 -2
- package/components/teaser/index.tsx +7 -6
- package/components/teaser/teaserVariants.ts +2 -0
- package/components/teaser/variants/horizontal.ts +14 -0
- package/cypress/e2e/account/account-page.spec.js +27 -1
- package/cypress/e2e/account/account-subscription.spec.js +2 -2
- package/cypress/e2e/account/main-api.spec.js +4 -4
- package/cypress/support/commands.js +4 -4
- package/helpers/mocks/getPageMock.ts +2 -59
- package/next.config.js +4 -0
- package/package.json +8 -7
- package/pages/[section]/[articleId]/[articleSlug].tsx +14 -3
- package/pages/api/feed.ts +19 -0
- package/pages/api/news-sitemap.ts +10 -2
- package/pages/api/sitemap.ts +10 -6
- package/components/section/layouts/Row.tsx +0 -28
- package/components/section/layouts/__tests__/SectionRow.test.tsx +0 -56
- package/components/section/layouts/__tests__/__snapshots__/SectionRow.test.tsx.snap +0 -4542
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
// xsColumnGutter="space000" padding on left and right of cells
|
|
3
3
|
// xsRowGutter="space000" margin-top of cells
|
|
4
4
|
|
|
5
|
+
// TODO: figure out column gutters
|
|
6
|
+
|
|
5
7
|
export const outerGridOverride = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
rowGap: {
|
|
9
|
+
xs: 'space070',
|
|
10
|
+
md: 'space060',
|
|
11
|
+
xl: 'space000',
|
|
12
|
+
},
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export const innerGridOverride = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
rowGap: {
|
|
17
|
+
xs: 'space070',
|
|
18
|
+
md: 'space060',
|
|
19
|
+
xl: 'space050',
|
|
20
|
+
},
|
|
18
21
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { MQ } from 'newskit'
|
|
1
2
|
import { ArticleSlice } from '../../../helpers/global-types'
|
|
3
|
+
import { VariantsName } from '../../teaser/teaserVariants'
|
|
2
4
|
|
|
3
5
|
export type LayoutProps = {
|
|
4
|
-
slice
|
|
6
|
+
slice?: ArticleSlice
|
|
5
7
|
sectionURL?: string
|
|
8
|
+
variant?: VariantsName
|
|
9
|
+
colums?: MQ<string>
|
|
6
10
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import React from 'react'
|
|
1
2
|
import CollectionBlock from './CollectionBlock'
|
|
2
3
|
import { CollectionBlock as Collection } from '../../helpers/global-types'
|
|
3
4
|
/*
|
|
4
5
|
We are using collections from the page schema but there are other block types that could be implemented (image, paragraph, tweet and more).
|
|
5
6
|
See the schema for the full list
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
// CollectionBlock(collection, i)
|
|
8
9
|
const pageBlock = (type: string) => {
|
|
9
10
|
const blockTypes = {
|
|
10
|
-
collection: (collection: Collection) =>
|
|
11
|
+
collection: (collection: Collection, i: number) => (
|
|
12
|
+
<CollectionBlock collection={collection} index={i} />
|
|
13
|
+
),
|
|
11
14
|
image: () => null,
|
|
12
15
|
paragraph: () => null,
|
|
13
16
|
tweet: () => null,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Card, Block, TextBlock, ImageProps } from 'newskit'
|
|
2
|
+
import { Card, Block, TextBlock, ImageProps, Headline } from 'newskit'
|
|
3
3
|
import teaserVariants, { VariantsName } from './teaserVariants'
|
|
4
4
|
|
|
5
5
|
export interface TeaserProps {
|
|
@@ -29,13 +29,14 @@ const Teaser: React.FC<TeaserProps> = ({
|
|
|
29
29
|
overrides={presets.card}
|
|
30
30
|
>
|
|
31
31
|
<Block spaceStack={presets.title.spaceStack}>
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
<Headline
|
|
33
|
+
overrides={{
|
|
34
|
+
typographyPreset: presets.title.typographyPreset,
|
|
35
|
+
}}
|
|
36
|
+
headingAs="h3"
|
|
36
37
|
>
|
|
37
38
|
{title}
|
|
38
|
-
</
|
|
39
|
+
</Headline>
|
|
39
40
|
</Block>
|
|
40
41
|
{teaser && presets.teaser && (
|
|
41
42
|
<Block spaceStack={presets.teaser.spaceStack}>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import titleTeaserVertical from './variants/titleTeaserVariant'
|
|
2
2
|
import titleVertical from './variants/titleVertical'
|
|
3
3
|
import featureVertical from './variants/featureVariant'
|
|
4
|
+
import horizontal from './variants/horizontal'
|
|
4
5
|
import { VariantsObject } from './variant-types'
|
|
5
6
|
|
|
6
7
|
const base: VariantsObject = {
|
|
@@ -21,6 +22,7 @@ const base: VariantsObject = {
|
|
|
21
22
|
|
|
22
23
|
const teaserVariants = {
|
|
23
24
|
base,
|
|
25
|
+
horizontal,
|
|
24
26
|
titleTeaserVertical,
|
|
25
27
|
titleVertical,
|
|
26
28
|
featureVertical,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VariantsObject } from '../variant-types'
|
|
2
|
+
|
|
3
|
+
const horizontalVariant: VariantsObject = {
|
|
4
|
+
layout: 'horizontal',
|
|
5
|
+
card: {
|
|
6
|
+
horizontalRatio: '1:1',
|
|
7
|
+
},
|
|
8
|
+
title: {
|
|
9
|
+
stylePreset: 'inkContrast',
|
|
10
|
+
spaceStack: 'space020',
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default horizontalVariant
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
describe('Account without user', () => {
|
|
2
|
+
beforeEach(() => {
|
|
3
|
+
cy.mockConsentAndVisit('/account')
|
|
4
|
+
})
|
|
5
|
+
|
|
6
|
+
it('Should Display default fallback values', () => {
|
|
7
|
+
cy.get('[data-testid="ContentListIntroduction"]').should('have.length', 3)
|
|
8
|
+
cy.get('[data-testid="ContentListItems"]').should('have.length', 3)
|
|
9
|
+
cy.contains('Please enter your name')
|
|
10
|
+
cy.contains('Please call customer service on xxxx-xxx-xxxx')
|
|
11
|
+
cy.contains('Please enter your display name')
|
|
12
|
+
cy.contains(
|
|
13
|
+
'Your display name is used across our websites or apps when leaving comments on articles'
|
|
14
|
+
)
|
|
15
|
+
cy.contains('[email@address]')
|
|
16
|
+
cy.contains('******************')
|
|
17
|
+
cy.contains('Please enter your mobile telephone number')
|
|
18
|
+
cy.contains('Please enter your landline telephone number')
|
|
19
|
+
cy.contains('Please enter your address')
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
|
|
1
23
|
describe('My account personal details', () => {
|
|
2
24
|
beforeEach(() => {
|
|
3
25
|
cy.GetAcsSession()
|
|
@@ -77,6 +99,10 @@ describe('My account personal details', () => {
|
|
|
77
99
|
)
|
|
78
100
|
})
|
|
79
101
|
|
|
102
|
+
it.only('Should Display date of birth', () => {
|
|
103
|
+
cy.contains('21/03/1988')
|
|
104
|
+
})
|
|
105
|
+
|
|
80
106
|
it('Should go to edit page and change display name ', () => {
|
|
81
107
|
cy.get('a[href="/account/edit/displayName"]')
|
|
82
108
|
.should('be.visible')
|
|
@@ -176,7 +202,7 @@ describe('My account personal details', () => {
|
|
|
176
202
|
.children()
|
|
177
203
|
.should(
|
|
178
204
|
'contain',
|
|
179
|
-
'Email sent to
|
|
205
|
+
'Email sent to render.e2e.default@yopmail.com with a password reset link. If you haven’t received it in a couple of minutes, you may request a new link by clicking on the button below.'
|
|
180
206
|
)
|
|
181
207
|
})
|
|
182
208
|
|
|
@@ -81,9 +81,9 @@ describe('Account Subscription & Cancellation', () => {
|
|
|
81
81
|
cy.contains(
|
|
82
82
|
'All your subscription details, including payment info and transactions.'
|
|
83
83
|
)
|
|
84
|
-
cy.contains('
|
|
84
|
+
cy.contains('4AAA038786047')
|
|
85
85
|
cy.contains('************1111')
|
|
86
|
-
cy.contains('expiry date 01/
|
|
86
|
+
cy.contains('expiry date 01/24')
|
|
87
87
|
|
|
88
88
|
cy.get('a[href="/account/cancellation"]').should('be.visible').click()
|
|
89
89
|
|
|
@@ -21,7 +21,7 @@ describe('MAIN API', () => {
|
|
|
21
21
|
cy.get('@mutateUser').then((updatedUser) => {
|
|
22
22
|
expect(updatedUser.status).to.eq(200)
|
|
23
23
|
expect(updatedUser.body.data.updateUser.email).to.eq(
|
|
24
|
-
'
|
|
24
|
+
'render.e2e.default@yopmail.com'
|
|
25
25
|
)
|
|
26
26
|
})
|
|
27
27
|
})
|
|
@@ -43,7 +43,7 @@ describe('MAIN API', () => {
|
|
|
43
43
|
cy.get('@mutateUser').then((updatedUser) => {
|
|
44
44
|
expect(updatedUser.status).to.eq(200)
|
|
45
45
|
expect(updatedUser.body.data.updateUser.email).to.eq(
|
|
46
|
-
'
|
|
46
|
+
'render.e2e.default@yopmail.com'
|
|
47
47
|
)
|
|
48
48
|
})
|
|
49
49
|
})
|
|
@@ -63,7 +63,7 @@ describe('MAIN API', () => {
|
|
|
63
63
|
}).as('user')
|
|
64
64
|
cy.get('@user').then((response) => {
|
|
65
65
|
expect(response.status).to.eq(200)
|
|
66
|
-
expect(response.body.email).to.eq('
|
|
66
|
+
expect(response.body.email).to.eq('render.e2e.default@yopmail.com')
|
|
67
67
|
expect(response.body.mobile).to.eq('+447777777778')
|
|
68
68
|
expect(response.body.firstName).to.eq('John')
|
|
69
69
|
expect(response.body.lastName).to.eq('Smith')
|
|
@@ -85,7 +85,7 @@ describe('MAIN API', () => {
|
|
|
85
85
|
}).as('userSubscription')
|
|
86
86
|
cy.get('@userSubscription').then((response) => {
|
|
87
87
|
expect(response.status).to.eq(200)
|
|
88
|
-
expect(response.body.cpn).to.eq('
|
|
88
|
+
expect(response.body.cpn).to.eq('4AAA038765003')
|
|
89
89
|
assert.isArray(response.body.subscriptions)
|
|
90
90
|
})
|
|
91
91
|
})
|
|
@@ -11,8 +11,8 @@ Cypress.Commands.add('mockConsent', () => {
|
|
|
11
11
|
|
|
12
12
|
const userMap = {
|
|
13
13
|
default: {
|
|
14
|
-
username: '
|
|
15
|
-
password: '
|
|
14
|
+
username: 'render.e2e.default@yopmail.com',
|
|
15
|
+
password: 'Ad45p0-swq151@',
|
|
16
16
|
},
|
|
17
17
|
noSub: {
|
|
18
18
|
username: 'render.e2e.no-sub@yopmail.com',
|
|
@@ -23,8 +23,8 @@ const userMap = {
|
|
|
23
23
|
password: 'Ad45p0-swq151@',
|
|
24
24
|
},
|
|
25
25
|
withSub: {
|
|
26
|
-
username: 'render
|
|
27
|
-
password: '
|
|
26
|
+
username: 'render-e2e-sub@yopmail.com',
|
|
27
|
+
password: 'testing123',
|
|
28
28
|
},
|
|
29
29
|
paypalSub: {
|
|
30
30
|
username: 'render-paypal-payment@yopmail.com',
|
|
@@ -8,6 +8,7 @@ const data = {
|
|
|
8
8
|
id: '123a',
|
|
9
9
|
name: 'name',
|
|
10
10
|
type: 'collection',
|
|
11
|
+
title: 'Section 1',
|
|
11
12
|
link: {
|
|
12
13
|
url: '/section-one',
|
|
13
14
|
},
|
|
@@ -302,7 +303,7 @@ const data = {
|
|
|
302
303
|
],
|
|
303
304
|
},
|
|
304
305
|
{
|
|
305
|
-
name: '
|
|
306
|
+
name: 'SECONDARY_2_AND_2',
|
|
306
307
|
type: 'slice',
|
|
307
308
|
children: [
|
|
308
309
|
{
|
|
@@ -363,64 +364,6 @@ const data = {
|
|
|
363
364
|
},
|
|
364
365
|
},
|
|
365
366
|
},
|
|
366
|
-
{
|
|
367
|
-
type: 'article-block',
|
|
368
|
-
article: {
|
|
369
|
-
id: 'demo-3',
|
|
370
|
-
slug: 'some-location',
|
|
371
|
-
headline: 'test headline 3',
|
|
372
|
-
categories: [
|
|
373
|
-
{
|
|
374
|
-
slug: 'catagory-one',
|
|
375
|
-
},
|
|
376
|
-
],
|
|
377
|
-
summary: {
|
|
378
|
-
children: [
|
|
379
|
-
{
|
|
380
|
-
text: 'teaser test text 3',
|
|
381
|
-
},
|
|
382
|
-
],
|
|
383
|
-
},
|
|
384
|
-
media: {
|
|
385
|
-
crops: [
|
|
386
|
-
{
|
|
387
|
-
url:
|
|
388
|
-
'https://www.thesun.co.uk/wp-content/uploads/2022/03/SPORT-PREVIEW-Amadou-Onana-to-WHU.jpg?strip=all&w=620&h=413&crop=1',
|
|
389
|
-
alt: 'image alt 3',
|
|
390
|
-
},
|
|
391
|
-
],
|
|
392
|
-
},
|
|
393
|
-
},
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
type: 'article-block',
|
|
397
|
-
article: {
|
|
398
|
-
id: 'demo-4',
|
|
399
|
-
slug: 'some-location',
|
|
400
|
-
headline: 'test headline 4',
|
|
401
|
-
categories: [
|
|
402
|
-
{
|
|
403
|
-
slug: 'catagory-one',
|
|
404
|
-
},
|
|
405
|
-
],
|
|
406
|
-
summary: {
|
|
407
|
-
children: [
|
|
408
|
-
{
|
|
409
|
-
text: 'teaser test text 4',
|
|
410
|
-
},
|
|
411
|
-
],
|
|
412
|
-
},
|
|
413
|
-
media: {
|
|
414
|
-
crops: [
|
|
415
|
-
{
|
|
416
|
-
url:
|
|
417
|
-
'https://www.thesun.co.uk/wp-content/uploads/2022/03/SPORT-PREVIEW-Amadou-Onana-to-WHU.jpg?strip=all&w=620&h=413&crop=1',
|
|
418
|
-
alt: 'image alt 3',
|
|
419
|
-
},
|
|
420
|
-
],
|
|
421
|
-
},
|
|
422
|
-
},
|
|
423
|
-
},
|
|
424
367
|
],
|
|
425
368
|
},
|
|
426
369
|
],
|
package/next.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.48.2",
|
|
4
4
|
"description": "Newskit Render - Core package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -33,14 +33,15 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@apollo/client": "3.4.16",
|
|
36
|
-
"@newskit-render/api": "^0.18.
|
|
36
|
+
"@newskit-render/api": "^0.18.1",
|
|
37
37
|
"@newskit-render/auth": "^0.31.3",
|
|
38
|
-
"@newskit-render/checkout": "^0.26.
|
|
38
|
+
"@newskit-render/checkout": "^0.26.7",
|
|
39
39
|
"@newskit-render/feature-flags": "^0.13.0",
|
|
40
|
-
"@newskit-render/feed": "^0.
|
|
41
|
-
"@newskit-render/my-account": "^0.
|
|
42
|
-
"@newskit-render/shared-components": "^0.
|
|
43
|
-
"@newskit-render/
|
|
40
|
+
"@newskit-render/feed": "^0.6.0",
|
|
41
|
+
"@newskit-render/my-account": "^0.153.2",
|
|
42
|
+
"@newskit-render/shared-components": "^0.46.0",
|
|
43
|
+
"@newskit-render/standalone-components": "^0.2.1",
|
|
44
|
+
"@newskit-render/validation": "^0.39.2",
|
|
44
45
|
"cross-fetch": "3.1.5",
|
|
45
46
|
"graphql": "15.6.0",
|
|
46
47
|
"newrelic": "7.1.0",
|
|
@@ -4,11 +4,15 @@ import {
|
|
|
4
4
|
createApolloClient,
|
|
5
5
|
ClientTypes,
|
|
6
6
|
getAcsCookie,
|
|
7
|
+
Publisher,
|
|
7
8
|
} from '@newskit-render/api'
|
|
8
9
|
import { UserData } from '@newskit-render/my-account'
|
|
10
|
+
import {
|
|
11
|
+
recommendationsProvider,
|
|
12
|
+
Article,
|
|
13
|
+
} from '@newskit-render/standalone-components'
|
|
9
14
|
import { GET_UNIVERSAL_ARTICLE } from '../../../queries'
|
|
10
15
|
import ArticlePage, { UniversalArticle } from '../../../components/article'
|
|
11
|
-
import { highlights, relatedArticles } from '../../../helpers/mocks/articleMock'
|
|
12
16
|
import { fetchUser } from '../../../helpers/getUser'
|
|
13
17
|
import { ACCOUNT_QUERY_URL } from '../../../constants'
|
|
14
18
|
import { addCacheHeaders } from '../../../helpers/addCacheHeaders'
|
|
@@ -20,6 +24,7 @@ export type ArticleSlug = {
|
|
|
20
24
|
siteHost: string
|
|
21
25
|
gscId?: string
|
|
22
26
|
user?: UserData
|
|
27
|
+
recommendations: Article[]
|
|
23
28
|
}
|
|
24
29
|
const Article: React.FC<ArticleSlug> = ({
|
|
25
30
|
universalArticle,
|
|
@@ -28,7 +33,11 @@ const Article: React.FC<ArticleSlug> = ({
|
|
|
28
33
|
siteHost,
|
|
29
34
|
gscId,
|
|
30
35
|
user,
|
|
36
|
+
recommendations,
|
|
31
37
|
}) => {
|
|
38
|
+
const highlitedArticles = recommendations.slice(0, 4)
|
|
39
|
+
const relatedArticles = recommendations.slice(4, 12)
|
|
40
|
+
|
|
32
41
|
return (
|
|
33
42
|
<ArticlePage
|
|
34
43
|
articleURL={articleURL}
|
|
@@ -36,7 +45,7 @@ const Article: React.FC<ArticleSlug> = ({
|
|
|
36
45
|
siteHost={siteHost}
|
|
37
46
|
gscId={gscId}
|
|
38
47
|
twitterUsername={twitterUsername}
|
|
39
|
-
highlights={
|
|
48
|
+
highlights={highlitedArticles}
|
|
40
49
|
relatedArticles={relatedArticles}
|
|
41
50
|
user={user}
|
|
42
51
|
/>
|
|
@@ -57,11 +66,12 @@ export async function getServerSideProps(context) {
|
|
|
57
66
|
`Article: /${section}/${articleId}/${articleSlug}`
|
|
58
67
|
)
|
|
59
68
|
|
|
60
|
-
const [{ data }, user] = await Promise.all([
|
|
69
|
+
const [{ data }, recommendations, user] = await Promise.all([
|
|
61
70
|
apolloClient.query({
|
|
62
71
|
query: GET_UNIVERSAL_ARTICLE,
|
|
63
72
|
variables: { publisher: 'DEMO', id: articleId },
|
|
64
73
|
}),
|
|
74
|
+
await recommendationsProvider({ articleId, publisher: Publisher.SUN_UK }),
|
|
65
75
|
await fetchUser(acsCookie, ACCOUNT_QUERY_URL),
|
|
66
76
|
])
|
|
67
77
|
|
|
@@ -74,6 +84,7 @@ export async function getServerSideProps(context) {
|
|
|
74
84
|
siteHost: process.env.SITE_HOST || '',
|
|
75
85
|
gscId: process.env.GSC_ID || '',
|
|
76
86
|
showAds: true,
|
|
87
|
+
recommendations,
|
|
77
88
|
user,
|
|
78
89
|
},
|
|
79
90
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NextApiRequest, NextApiResponse } from 'next'
|
|
2
|
+
import { rssFeed, UpdatePeriod } from '@newskit-render/feed'
|
|
3
|
+
|
|
4
|
+
const handler = async (req: NextApiRequest, res: NextApiResponse) =>
|
|
5
|
+
rssFeed({
|
|
6
|
+
res,
|
|
7
|
+
titeAttributes: {
|
|
8
|
+
title: 'Demo Site',
|
|
9
|
+
link: `${process.env.SITE_HOST}/feed`,
|
|
10
|
+
description: 'Newskit Render Demo site',
|
|
11
|
+
lastBuildDate: new Date().toUTCString(),
|
|
12
|
+
language: 'en-US',
|
|
13
|
+
updatePeriod: 'hourly' as UpdatePeriod,
|
|
14
|
+
updateFrequency: 1,
|
|
15
|
+
logoUrl: `${process.env.SITE_HOST}/favicon.ico`,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export default handler
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { NextApiRequest, NextApiResponse } from 'next'
|
|
2
|
-
import { newsSitemap
|
|
2
|
+
import { newsSitemap } from '@newskit-render/feed'
|
|
3
|
+
import { Publisher } from '@newskit-render/api'
|
|
4
|
+
|
|
5
|
+
/* We do not have sitemap date for Demo so using Virgin,
|
|
6
|
+
* This can be removed and replace with just - publisher: process.env.PUBLISHER as PublisherGroup, in created projects
|
|
7
|
+
*/
|
|
3
8
|
|
|
4
9
|
const handler = async (req: NextApiRequest, res: NextApiResponse) =>
|
|
5
10
|
newsSitemap({
|
|
6
11
|
res,
|
|
7
|
-
publisher:
|
|
12
|
+
publisher:
|
|
13
|
+
process.env.PUBLISHER === 'DEMO'
|
|
14
|
+
? Publisher.VIRGIN
|
|
15
|
+
: (process.env.PUBLISHER as Publisher),
|
|
8
16
|
domain: new URL(process.env.SITE_HOST as string).host,
|
|
9
17
|
publicationName: process.env.SITEMAP_PUBLICATION_NAME as string,
|
|
10
18
|
})
|
package/pages/api/sitemap.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { NextApiRequest, NextApiResponse } from 'next'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { genericSitemap, CustomStaticPage } from '@newskit-render/feed'
|
|
3
|
+
import { Publisher } from '@newskit-render/api'
|
|
4
|
+
|
|
5
|
+
/* We do not have sitemap date for Demo so using Virgin,
|
|
6
|
+
* This can be removed and replace with just - publisher: process.env.PUBLISHER as PublisherGroup, in created projects
|
|
7
|
+
*/
|
|
7
8
|
|
|
8
9
|
const defaultCustomStaticPagesCollection: CustomStaticPage[] = [
|
|
9
10
|
{
|
|
@@ -14,7 +15,10 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) =>
|
|
|
14
15
|
genericSitemap({
|
|
15
16
|
res,
|
|
16
17
|
query: req.query,
|
|
17
|
-
publisher:
|
|
18
|
+
publisher:
|
|
19
|
+
process.env.PUBLISHER === 'DEMO'
|
|
20
|
+
? Publisher.VIRGIN
|
|
21
|
+
: (process.env.PUBLISHER as Publisher),
|
|
18
22
|
domain: new URL(process.env.SITE_HOST as string).host,
|
|
19
23
|
firstArticleDate: process.env.SITEMAP_FIRST_PUBLICATION_DATE as string,
|
|
20
24
|
publicationName: process.env.SITEMAP_PUBLICATION_NAME as string,
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Grid, Cell } from 'newskit'
|
|
3
|
-
import { LayoutProps } from './types'
|
|
4
|
-
import { outerGridOverride } from './gridUtils'
|
|
5
|
-
import { getBlock } from './Block'
|
|
6
|
-
|
|
7
|
-
const Row: React.FC<LayoutProps> = ({ slice }) => (
|
|
8
|
-
<Grid {...outerGridOverride} data-testid={`${slice.name}-Grid`}>
|
|
9
|
-
{slice.children.map((block, i) => (
|
|
10
|
-
<Cell
|
|
11
|
-
xs={12}
|
|
12
|
-
md={6}
|
|
13
|
-
xl={3}
|
|
14
|
-
key={
|
|
15
|
-
('article' in block && block.article.id) ||
|
|
16
|
-
('author' in block && block.author.id) ||
|
|
17
|
-
('accountId' in block && block.id) ||
|
|
18
|
-
i
|
|
19
|
-
}
|
|
20
|
-
data-testid={`titleTeaserVertical-${i}`}
|
|
21
|
-
>
|
|
22
|
-
{getBlock(block, 'titleTeaserVertical')}
|
|
23
|
-
</Cell>
|
|
24
|
-
))}
|
|
25
|
-
</Grid>
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
export default Row
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { renderWithTheme } from '../../../../helpers/test-utils'
|
|
2
|
-
import { SectionRow } from '../SectionRow'
|
|
3
|
-
import { getPageMock } from '../../../../helpers/mocks'
|
|
4
|
-
import { ArticleSlice } from '../../../../helpers/global-types'
|
|
5
|
-
|
|
6
|
-
describe('SectionRow', () => {
|
|
7
|
-
test('SectionRow with title', () => {
|
|
8
|
-
const { asFragment } = renderWithTheme(SectionRow, {
|
|
9
|
-
slice: getPageMock.page.body[0].children[1] as ArticleSlice,
|
|
10
|
-
sectionURL: getPageMock.page.body[0].link.url,
|
|
11
|
-
collection: getPageMock.page.body[0],
|
|
12
|
-
})
|
|
13
|
-
expect(asFragment()).toMatchSnapshot()
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
test('SectionRow without title', () => {
|
|
17
|
-
const { asFragment } = renderWithTheme(SectionRow, {
|
|
18
|
-
slice: getPageMock.page.body[0].children[1] as ArticleSlice,
|
|
19
|
-
sectionURL: getPageMock.page.body[0].link.url,
|
|
20
|
-
collection: getPageMock.page.body[0],
|
|
21
|
-
showTitle: false,
|
|
22
|
-
})
|
|
23
|
-
expect(asFragment()).toMatchSnapshot()
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
test('SectionRow isDarkBackground', () => {
|
|
27
|
-
const { asFragment } = renderWithTheme(SectionRow, {
|
|
28
|
-
slice: getPageMock.page.body[0].children[1] as ArticleSlice,
|
|
29
|
-
sectionURL: getPageMock.page.body[0].link.url,
|
|
30
|
-
collection: getPageMock.page.body[0],
|
|
31
|
-
isDarkBackground: true,
|
|
32
|
-
})
|
|
33
|
-
expect(asFragment()).toMatchSnapshot()
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
test('SectionRow without extra space', () => {
|
|
37
|
-
const { asFragment } = renderWithTheme(SectionRow, {
|
|
38
|
-
slice: getPageMock.page.body[0].children[1] as ArticleSlice,
|
|
39
|
-
sectionURL: getPageMock.page.body[0].link.url,
|
|
40
|
-
collection: getPageMock.page.body[0],
|
|
41
|
-
addTopSpace: true,
|
|
42
|
-
})
|
|
43
|
-
expect(asFragment()).toMatchSnapshot()
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
test('SectionRow alternative titlebar', () => {
|
|
47
|
-
const { asFragment } = renderWithTheme(SectionRow, {
|
|
48
|
-
slice: getPageMock.page.body[0].children[1] as ArticleSlice,
|
|
49
|
-
sectionURL: getPageMock.page.body[0].link.url,
|
|
50
|
-
collection: getPageMock.page.body[0],
|
|
51
|
-
titleBarStylePreset: 'inkContrast',
|
|
52
|
-
titleBarColour: 'transparent',
|
|
53
|
-
})
|
|
54
|
-
expect(asFragment()).toMatchSnapshot()
|
|
55
|
-
})
|
|
56
|
-
})
|