@newskit-render/core 2.10.3 → 2.12.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 CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.12.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.12.0-alpha.0...@newskit-render/core@2.12.0) (2022-10-28)
7
+
8
+ **Note:** Version bump only for package @newskit-render/core
9
+
10
+
11
+
12
+
13
+
14
+ # [2.11.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.11.0-alpha.0...@newskit-render/core@2.11.0) (2022-10-27)
15
+
16
+ **Note:** Version bump only for package @newskit-render/core
17
+
18
+
19
+
20
+
21
+
6
22
  ## [2.10.3](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.10.3-alpha.0...@newskit-render/core@2.10.3) (2022-10-27)
7
23
 
8
24
  **Note:** Version bump only for package @newskit-render/core
@@ -1,12 +1,38 @@
1
- // describe('Book a holiday stop', () => {
2
- // beforeEach(() => {
3
- // cy.GetAcsSession()
4
- // cy.mockConsentAndVisit('/account/holiday-stop/book')
5
- // })
1
+ describe('Book a holiday stop', () => {
2
+ beforeEach(() => {
3
+ cy.GetAcsSession()
4
+ cy.mockConsentAndVisit('/account/holiday-stop/book')
5
+ })
6
6
 
7
- // it('should display book a holiday stop page', () => {
8
- // cy.get('a[href="/account/subscription-and-billing"]').should('be.visible')
9
- // cy.contains('[data-testid="introduction-title"]', 'Book a holiday stop')
10
- // cy.contains('Add a Holiday Stop')
11
- // })
12
- // })
7
+ it('should display book a holiday stop page', () => {
8
+ cy.get('a[href="/account/subscription-and-billing"]').should('be.visible')
9
+ cy.contains('[data-testid="introduction-title"]', 'Book a holiday stop')
10
+ cy.contains('Add a Holiday Stop')
11
+ cy.get('a[href="/account/holiday-stop/upcoming-holiday-stops"]').should(
12
+ 'not.exist'
13
+ )
14
+ cy.get('a[href="/account/holiday-stop/previous-holiday-stops"]').should(
15
+ 'not.exist'
16
+ )
17
+ })
18
+ })
19
+
20
+ describe.skip(
21
+ 'Upcoming holiday stops',
22
+ {
23
+ env: {
24
+ MAIN_COOKIE_NAME: 'acs_tnl',
25
+ },
26
+ },
27
+ () => {
28
+ beforeEach(() => {
29
+ cy.GetTnlAcsSession()
30
+ cy.mockConsentAndVisit('/account/holiday-stop/book')
31
+ })
32
+
33
+ it('should navigate to the Upcoming holiday stops and display the list of upcoming holiday stops', () => {
34
+ cy.get('a[href="/account/holiday-stop/upcoming-holiday-stops"]').click()
35
+ cy.get('[data-testid="content-list"] > ul > li').should('have.length', 6)
36
+ })
37
+ }
38
+ )
@@ -48,6 +48,10 @@ const userMap = {
48
48
  username: 'render-paypal-payment@yopmail.com',
49
49
  password: 'testing123',
50
50
  },
51
+ tnl: {
52
+ username: 'cmp1aug2022printstag@yopmail.com',
53
+ password: 'Password123',
54
+ },
51
55
  }
52
56
 
53
57
  Cypress.Commands.add('GetAcsSession', (user = 'default') => {
@@ -73,6 +77,29 @@ Cypress.Commands.add('GetAcsSession', (user = 'default') => {
73
77
  })
74
78
  })
75
79
 
80
+ Cypress.Commands.add('GetTnlAcsSession', (user = 'tnl') => {
81
+ const { username, password } = userMap[user]
82
+ cy.request({
83
+ method: 'POST',
84
+ url: 'https://login.staging-thetimes.co.uk/services/session',
85
+ headers: {
86
+ 'Content-Type': 'application/vnd.newsuk.acs.createsession-v1+json',
87
+ },
88
+ body: {
89
+ rememberMe: false,
90
+ gotoUrl: 'https://login.staging-thesun.co.uk/',
91
+ sso: false,
92
+ authCredentials: {
93
+ username,
94
+ password,
95
+ },
96
+ },
97
+ }).then((response) => {
98
+ const acs_tnl = response.body.acsCookies.cookies[0].value
99
+ cy.setCookie('acs_tnl', acs_tnl)
100
+ })
101
+ })
102
+
76
103
  Cypress.Commands.add('createNewEmail', () => {
77
104
  const newEmail =
78
105
  Cypress.env('MAIN_USER_EMAIL').split('@')[0].split('').reverse().join('') +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newskit-render/core",
3
- "version": "2.10.3",
3
+ "version": "2.12.0",
4
4
  "description": "Newskit Render - Core package",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
@@ -40,12 +40,12 @@
40
40
  "@emotion/styled": "11.10.4",
41
41
  "@newskit-render/api": "^1.2.1",
42
42
  "@newskit-render/auth": "^1.1.1",
43
- "@newskit-render/checkout": "^1.3.5",
43
+ "@newskit-render/checkout": "^1.3.7",
44
44
  "@newskit-render/feature-flags": "^1.2.0",
45
45
  "@newskit-render/feed": "^1.1.1",
46
- "@newskit-render/my-account": "^3.8.1",
47
- "@newskit-render/shared-components": "^1.8.0",
48
- "@newskit-render/standalone-components": "^1.6.0",
46
+ "@newskit-render/my-account": "^3.9.0",
47
+ "@newskit-render/shared-components": "^1.9.0",
48
+ "@newskit-render/standalone-components": "^1.7.1",
49
49
  "@newskit-render/validation": "^1.2.1",
50
50
  "cross-fetch": "3.1.5",
51
51
  "graphql": "15.6.0",
@@ -0,0 +1,25 @@
1
+ import { getProviderProps, HolidayStopList } from '@newskit-render/my-account'
2
+ import newrelic from 'newrelic'
3
+ import React, { useContext } from 'react'
4
+ import { AppContext } from '../../../context/app-context'
5
+ import { createThemeDropdownObject } from '../../../helpers/createThemeDropdownObject'
6
+
7
+ const AccountPreviousHolidayStops = (props) => {
8
+ const { theme, setTheme } = useContext(AppContext)
9
+ const themeDropdownObject = createThemeDropdownObject(setTheme)
10
+ return (
11
+ <HolidayStopList
12
+ {...props}
13
+ customTheme={theme}
14
+ themeDropdownObject={themeDropdownObject}
15
+ holidayStopType="previous"
16
+ />
17
+ )
18
+ }
19
+
20
+ export default AccountPreviousHolidayStops
21
+
22
+ export const getServerSideProps = async (context) => {
23
+ newrelic.setTransactionName('Account: Previous Holiday Stops')
24
+ return getProviderProps({ ...context, provider: 'HolidayStop' })
25
+ }
@@ -0,0 +1,25 @@
1
+ import { getProviderProps, HolidayStopList } from '@newskit-render/my-account'
2
+ import newrelic from 'newrelic'
3
+ import React, { useContext } from 'react'
4
+ import { AppContext } from '../../../context/app-context'
5
+ import { createThemeDropdownObject } from '../../../helpers/createThemeDropdownObject'
6
+
7
+ const AccountUpcomingHolidayStops = (props) => {
8
+ const { theme, setTheme } = useContext(AppContext)
9
+ const themeDropdownObject = createThemeDropdownObject(setTheme)
10
+ return (
11
+ <HolidayStopList
12
+ {...props}
13
+ customTheme={theme}
14
+ themeDropdownObject={themeDropdownObject}
15
+ holidayStopType="upcoming"
16
+ />
17
+ )
18
+ }
19
+
20
+ export default AccountUpcomingHolidayStops
21
+
22
+ export const getServerSideProps = async (context) => {
23
+ newrelic.setTransactionName('Account: Upcoming Holiday Stops')
24
+ return getProviderProps({ ...context, provider: 'HolidayStop' })
25
+ }
@@ -1,6 +1,7 @@
1
1
  import React, { useContext } from 'react'
2
2
  import newrelic from 'newrelic'
3
3
  import {
4
+ AlgoliaCredentials,
4
5
  HelpHubArticlePage,
5
6
  helpHubArticleProvider,
6
7
  } from '@newskit-render/standalone-components'
@@ -8,7 +9,11 @@ import { createThemeDropdownObject } from '../../../../helpers/createThemeDropdo
8
9
  import { AppContext } from '../../../../context'
9
10
  import { addCacheHeaders } from '../../../../helpers/addCacheHeaders'
10
11
 
11
- const ArticlePage = (props) => {
12
+ const ArticlePage: React.FC<{
13
+ credentials: AlgoliaCredentials
14
+ title: string
15
+ content: string
16
+ }> = (props) => {
12
17
  const { theme, setTheme } = useContext(AppContext)
13
18
  const themeDropdownObject = createThemeDropdownObject(setTheme)
14
19
 
@@ -21,12 +26,13 @@ const ArticlePage = (props) => {
21
26
  )
22
27
  }
23
28
 
29
+ export default ArticlePage
30
+
24
31
  export const getServerSideProps = async (context) => {
25
32
  newrelic.setTransactionName('HelpHubArticlePage')
26
33
  console.warn('context:')
27
34
  console.warn(context.req && context.req.headers)
28
-
29
35
  addCacheHeaders(context.res)
30
- return helpHubArticleProvider({ ...context })
36
+
37
+ return helpHubArticleProvider(context)
31
38
  }
32
- export default ArticlePage
@@ -1,6 +1,7 @@
1
1
  import React, { useContext } from 'react'
2
2
  import newrelic from 'newrelic'
3
3
  import {
4
+ AlgoliaCredentials,
4
5
  HelpHubLandingPage,
5
6
  helpHubLandingPageProvider,
6
7
  } from '@newskit-render/standalone-components'
@@ -37,13 +38,15 @@ const mostReadArticles = [
37
38
  },
38
39
  ]
39
40
 
40
- const LandingPage = ({ credentials }) => {
41
+ const LandingPage: React.FC<{
42
+ credentials: AlgoliaCredentials
43
+ }> = (props) => {
41
44
  const { theme, setTheme } = useContext(AppContext)
42
45
  const themeDropdownObject = createThemeDropdownObject(setTheme)
43
46
 
44
47
  return (
45
48
  <HelpHubLandingPage
46
- credentials={credentials}
49
+ {...props}
47
50
  context={{ mostReadArticles }}
48
51
  customTheme={theme}
49
52
  themeDropdownObject={themeDropdownObject}
@@ -16,13 +16,12 @@ const ResultsPage: React.FC<{
16
16
  }> = (props) => {
17
17
  const { theme, setTheme } = useContext(AppContext)
18
18
  const themeDropdownObject = createThemeDropdownObject(setTheme)
19
- const { credentials } = props
19
+
20
20
  return (
21
21
  <HelpHubResultsPage
22
22
  {...props}
23
23
  customTheme={theme}
24
24
  themeDropdownObject={themeDropdownObject}
25
- credentials={credentials}
26
25
  />
27
26
  )
28
27
  }
@@ -33,9 +32,7 @@ export const getServerSideProps = async (context) => {
33
32
  newrelic.setTransactionName('HelpHubResultsPage')
34
33
  console.warn('context:')
35
34
  console.warn(context.req && context.req.headers)
36
-
37
35
  addCacheHeaders(context.res)
38
36
 
39
- const results = await helpHubResultsProvider({ ...context })
40
- return results
37
+ return helpHubResultsProvider(context)
41
38
  }