@newskit-render/core 2.13.2 → 2.15.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.15.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.15.0-alpha.0...@newskit-render/core@2.15.0) (2022-11-04)
7
+
8
+ **Note:** Version bump only for package @newskit-render/core
9
+
10
+
11
+
12
+
13
+
14
+ # [2.14.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.14.0-alpha.0...@newskit-render/core@2.14.0) (2022-11-04)
15
+
16
+ **Note:** Version bump only for package @newskit-render/core
17
+
18
+
19
+
20
+
21
+
6
22
  ## [2.13.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.13.2-alpha.0...@newskit-render/core@2.13.2) (2022-11-03)
7
23
 
8
24
  **Note:** Version bump only for package @newskit-render/core
package/README.md CHANGED
@@ -22,6 +22,7 @@ or with npm
22
22
  ```
23
23
  npm start
24
24
  ```
25
+
25
26
  ## Rquired Environment Variables
26
27
 
27
28
  In order to run the application,we need the following required environment variables.
@@ -34,6 +35,7 @@ OKTA_CLIENT_SECRET=""
34
35
  OKTA_DOMAIN=""
35
36
  PUBLISHER=""
36
37
  ```
38
+
37
39
  ## Endpoints
38
40
 
39
41
  GET /api/recommendations - Returns a list on recommendations articles based on the recommendations slug.The recommendations slug is provided be the query param `articleId`.Also accepts a `userId` which allows us to fetch personalised recommendations.
@@ -139,8 +141,6 @@ export const themesMap = {
139
141
  }
140
142
  ```
141
143
 
142
-
143
-
144
144
  - `translationsMap` is used for re-mapping variables like site title, or any other string for each brand. Example:
145
145
 
146
146
  ```
@@ -153,11 +153,8 @@ export const timesStrings = {
153
153
  }
154
154
  ```
155
155
 
156
-
157
-
158
- - `themesMap` is used for mapping the theme for each brand.
159
- Brand names live in the `PUBLISHER` object
160
-
156
+ - `themesMap` is used for mapping the theme for each brand.
157
+ Brand names live in the `PUBLISHER` object
161
158
 
162
159
  In context folder `context/multi-tenancy`
163
160
  Add a multi-tenancy context that will keep the current tenant:
@@ -196,8 +193,7 @@ export const useMultiTenancy = () => useContext(MultiTenancyContext)
196
193
  export default MultiTenancyProvider
197
194
  ```
198
195
 
199
-
200
- Now you need to update `_app.js`. To pass the tenant to the app, you need to wrap it in `MultitenancyProvide`:
196
+ Now you need to update `_app.js`. To pass the tenant to the app, you need to wrap it in `MultitenancyProvide`:
201
197
 
202
198
  ```
203
199
  interface MyAppProps extends AppProps {
@@ -217,7 +213,6 @@ function MyApp({ Component, pageProps, tenant }: MyAppProps) {
217
213
  export default MyApp
218
214
  ```
219
215
 
220
-
221
216
  Then call the `getTenant()` helper function in `getInitialProps()`. This function extracts the brands' hostname ( domain name ) from the request headers and then we save the tenant in the context provider:
222
217
 
223
218
  ```
@@ -232,10 +227,9 @@ MyApp.getInitialProps = async ({ Component, ctx }: AppContextType) => {
232
227
  }
233
228
  ```
234
229
 
235
-
236
230
  ### How to set the theme for each tenant
237
231
 
238
- You can use the `useMultiTenancy` hook anywhere in the code to get the current tenant
232
+ You can use the `useMultiTenancy` hook anywhere in the code to get the current tenant
239
233
 
240
234
  In `context/app-context.js`:
241
235
 
@@ -277,4 +271,4 @@ code here
277
271
 
278
272
  This comment is to denote that the line or lines in between are effected by the running of the [@newskit-render/create-render-app package](https://github.com/newscorp-ghfb/ncu-newskit-render/tree/master/packages/create-render-app).
279
273
 
280
- If you our touching / modifiying code with these comments you need to be aware that you may affect the successful running of the [@newskit-render/create-render-app package](https://github.com/newscorp-ghfb/ncu-newskit-render/tree/master/packages/create-render-app).
274
+ If you our touching / modifiying code with these comments you need to be aware that you may affect the successful running of the [@newskit-render/create-render-app package](https://github.com/newscorp-ghfb/ncu-newskit-render/tree/master/packages/create-render-app).
@@ -1,3 +1,5 @@
1
+ import * as userHolidayStops from '../../fixtures/holiday-stops.json'
2
+
1
3
  describe('Book a holiday stop', () => {
2
4
  beforeEach(() => {
3
5
  cy.GetAcsSession()
@@ -17,22 +19,55 @@ describe('Book a holiday stop', () => {
17
19
  })
18
20
  })
19
21
 
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
- })
22
+ describe('Upcoming holiday stops', () => {
23
+ beforeEach(() => {
24
+ cy.mockConsent()
25
+ })
32
26
 
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)
27
+ it('should navigate to the Upcoming holiday stops and display the list of upcoming holiday stops', () => {
28
+ cy.visitAndOverrideNextData(
29
+ '/account/holiday-stop/book',
30
+ 'props.pageProps.user.holidayStops',
31
+ userHolidayStops.holidayStops
32
+ )
33
+ cy.get('a[href="/account/holiday-stop/upcoming-holiday-stops"]').should(
34
+ 'exist'
35
+ )
36
+ cy.visitAndOverrideNextData(
37
+ '/account/holiday-stop/upcoming-holiday-stops',
38
+ 'props.pageProps.user.holidayStops',
39
+ userHolidayStops.holidayStops
40
+ )
41
+ cy.get('[data-testid="content-list"] > ul > li').should(
42
+ 'have.length.of.at.least',
43
+ 6
44
+ )
45
+ })
46
+ })
47
+
48
+ describe('Cancel holiday stop', () => {
49
+ beforeEach(() => {
50
+ cy.mockConsent()
51
+ cy.visitAndOverrideNextData(
52
+ '/account/holiday-stop/book',
53
+ 'props.pageProps.user.holidayStops',
54
+ userHolidayStops.holidayStops
55
+ )
56
+ })
57
+
58
+ it('should show popup and cancel holiday stop', () => {
59
+ cy.intercept('POST', '/api/account/mutate', {
60
+ statusCode: 200,
61
+ body: { data: { deleteUserHolidayStop: { success: true } } },
36
62
  })
37
- }
38
- )
63
+ cy.get('[data-testid="content-list"] > ul > li')
64
+ .eq(1)
65
+ .contains('Cancel')
66
+ .click()
67
+ cy.get('[data-testid="primary-button"]').click()
68
+ cy.contains(
69
+ '[data-testid="toast-container"]',
70
+ 'Your holiday stop was successfully cancelled'
71
+ )
72
+ })
73
+ })
@@ -0,0 +1,40 @@
1
+ {
2
+ "holidayStops": [
3
+ {
4
+ "id": "a2U7Y000001r8c9UAA",
5
+ "startDate": "2022-10-10T00:00:00",
6
+ "endDate": "2022-11-11T00:00:00",
7
+ "status": "Requested"
8
+ },
9
+ {
10
+ "id": "a2U7Y000001sijmUAA",
11
+ "startDate": "2024-04-25T00:00:00",
12
+ "endDate": "2024-04-28T00:00:00",
13
+ "status": "Requested"
14
+ },
15
+ {
16
+ "id": "a2U7Y000001sijwUAA",
17
+ "startDate": "2024-06-25T00:00:00",
18
+ "endDate": "2024-06-28T00:00:00",
19
+ "status": "Requested"
20
+ },
21
+ {
22
+ "id": "a2U7Y000001sijXUAQ",
23
+ "startDate": "2024-01-25T00:00:00",
24
+ "endDate": "2024-01-28T00:00:00",
25
+ "status": "Requested"
26
+ },
27
+ {
28
+ "id": "a2U7Y000001sijcUAA",
29
+ "startDate": "2024-02-25T00:00:00",
30
+ "endDate": "2024-02-28T00:00:00",
31
+ "status": "Requested"
32
+ },
33
+ {
34
+ "id": "a2U7Y000001sijrUAA",
35
+ "startDate": "2024-05-25T00:00:00",
36
+ "endDate": "2024-05-28T00:00:00",
37
+ "status": "Requested"
38
+ }
39
+ ]
40
+ }
@@ -1,8 +1,8 @@
1
1
  //Note: Check periodically if these consent cookie values exprire
2
2
  import _ from 'lodash'
3
- import {
4
- nuktSPConsentValue,
5
- consentUUIDValue,
3
+ import {
4
+ nuktSPConsentValue,
5
+ consentUUIDValue,
6
6
  _sp_local_state,
7
7
  _sp_user_consent_7377,
8
8
  _sp_non_keyed_local_state,
@@ -10,8 +10,14 @@ import {
10
10
 
11
11
  const setConentLocalStorage = () => {
12
12
  localStorage.setItem('_sp_local_state', JSON.stringify(_sp_local_state))
13
- localStorage.setItem('_sp_user_consent_7377', JSON.stringify(_sp_user_consent_7377))
14
- localStorage.setItem('_sp_non_keyed_local_state', JSON.stringify(_sp_non_keyed_local_state))
13
+ localStorage.setItem(
14
+ '_sp_user_consent_7377',
15
+ JSON.stringify(_sp_user_consent_7377)
16
+ )
17
+ localStorage.setItem(
18
+ '_sp_non_keyed_local_state',
19
+ JSON.stringify(_sp_non_keyed_local_state)
20
+ )
15
21
  }
16
22
 
17
23
  Cypress.Commands.add('mockConsentAndVisit', (url) => {
@@ -87,7 +93,7 @@ Cypress.Commands.add('GetTnlAcsSession', (user = 'tnl') => {
87
93
  },
88
94
  body: {
89
95
  rememberMe: false,
90
- gotoUrl: 'https://login.staging-thesun.co.uk/',
96
+ gotoUrl: 'https://login.staging-thetimes.co.uk/',
91
97
  sso: false,
92
98
  authCredentials: {
93
99
  username,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newskit-render/core",
3
- "version": "2.13.2",
3
+ "version": "2.15.0",
4
4
  "description": "Newskit Render - Core package",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
@@ -40,13 +40,13 @@
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.5.2",
43
+ "@newskit-render/checkout": "^1.5.3",
44
44
  "@newskit-render/feature-flags": "^1.2.0",
45
45
  "@newskit-render/feed": "^1.1.1",
46
- "@newskit-render/my-account": "^3.12.0",
47
- "@newskit-render/shared-components": "^1.11.0",
48
- "@newskit-render/standalone-components": "^1.9.0",
49
- "@newskit-render/validation": "^1.2.1",
46
+ "@newskit-render/my-account": "^3.13.0",
47
+ "@newskit-render/shared-components": "^1.12.0",
48
+ "@newskit-render/standalone-components": "^1.9.1",
49
+ "@newskit-render/validation": "^1.3.0",
50
50
  "cross-fetch": "3.1.5",
51
51
  "graphql": "15.6.0",
52
52
  "lodash.get": "4.4.2",