@newskit-render/core 1.66.0 → 1.68.1

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/README.md +16 -0
  3. package/__tests__/pages/[articleSlug].test.tsx +1 -55
  4. package/__tests__/pages/__snapshots__/home.test.tsx.snap +657 -626
  5. package/__tests__/pages/__snapshots__/relatedArticles.test.tsx.snap +651 -0
  6. package/__tests__/pages/relatedArticles.test.tsx +23 -11
  7. package/components/article/__tests__/__snapshots__/index.test.tsx.snap +1091 -1060
  8. package/components/footer/index.tsx +1 -1
  9. package/components/header/banner-messages.ts +45 -0
  10. package/components/header/index.tsx +31 -287
  11. package/components/header/navigation-links.ts +20 -0
  12. package/components/layout/LayoutTemplate.tsx +4 -1
  13. package/config/__tests__/index.test.ts +53 -0
  14. package/config/environment.ts +67 -0
  15. package/config/index.ts +2 -85
  16. package/config/multiTenancy.ts +12 -0
  17. package/{app-context → context/app-context}/AppContext.test.tsx +7 -3
  18. package/{app-context/AppContext.tsx → context/app-context/index.tsx} +5 -1
  19. package/context/index.tsx +2 -0
  20. package/context/multi-tenancy/MultiTenancy.test.tsx +47 -0
  21. package/context/multi-tenancy/index.tsx +31 -0
  22. package/css/index.ts +224 -0
  23. package/cypress/support/commands.js +8 -4
  24. package/helpers/__tests__/createThemeDropdownObject.test.ts +3 -3
  25. package/helpers/__tests__/getRecommendation.test.ts +62 -0
  26. package/helpers/createThemeDropdownObject.ts +3 -3
  27. package/helpers/getRecommendations.ts +29 -0
  28. package/helpers/global-types.ts +8 -0
  29. package/{__tests__/pages/mocks.ts → helpers/mocks/getRecommendationsMock.ts} +2 -6
  30. package/helpers/multiTenancy.ts +19 -0
  31. package/jest.config.js +1 -2
  32. package/package.json +11 -9
  33. package/pages/[section]/[articleId]/[articleSlug].tsx +17 -10
  34. package/pages/[section]/[articleId]/relatedArticles.tsx +49 -40
  35. package/pages/_app.tsx +42 -257
  36. package/pages/account/cancellation/index.tsx +1 -1
  37. package/pages/account/edit/[field].tsx +1 -1
  38. package/pages/account/index.tsx +1 -1
  39. package/pages/account/newsletters-and-alerts/index.tsx +1 -1
  40. package/pages/account/payment/index.tsx +1 -1
  41. package/pages/account/subscription-and-billing/index.tsx +1 -1
  42. package/pages/api/auth/[...nextauth].ts +5 -1
  43. package/pages/api/recommendations/[...slug].ts +21 -0
  44. package/pages/checkout/account-creation/index.tsx +1 -1
  45. package/pages/checkout/payment-details/index.tsx +1 -1
  46. package/pages/help-hub/[id]/index.tsx +22 -9
  47. package/pages/help-hub/index.tsx +22 -9
  48. package/pages/help-hub/results.tsx +24 -0
  49. package/theme/strings/demo.ts +1 -0
  50. package/theme/strings/index.ts +1 -0
  51. package/components/header/index.test.tsx +0 -73
package/CHANGELOG.md CHANGED
@@ -3,6 +3,139 @@
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
+ # [1.68.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.68.0-alpha.5...@newskit-render/core@1.68.0) (2022-06-27)
7
+
8
+ **Note:** Version bump only for package @newskit-render/core
9
+
10
+
11
+
12
+
13
+
14
+ # [1.68.0-alpha.4](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.67.0...@newskit-render/core@1.68.0-alpha.4) (2022-06-27)
15
+
16
+
17
+ ### Features
18
+
19
+ * **PPDSR-827:** 2/3 Help Hub - Layout ([#761](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/761)) ([cb340a6](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/cb340a61229f49cd0899371adcf51155b74eb471))
20
+ * **PPDSR-827:** 1/3 Help Hub - Introduce common NavigationPrimary header ([#752](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/752)) ([5b55fd1](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/5b55fd130a1fea5d5440a93b2cb67a026a52558b))
21
+ * **PPDSR-843:** Add multi-tenancy ([#756](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/756)) ([0481497](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/04814974fb49007506b3534f2d6de8a617fa4589))
22
+ * **PPDSR-XXX:** add install deps for security ([#766](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/766)) ([69ff219](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/69ff219254c0deb3da1c8de480706635d74cf229))
23
+
24
+
25
+
26
+
27
+
28
+ # [1.68.0-alpha.3](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.67.0...@newskit-render/core@1.68.0-alpha.3) (2022-06-27)
29
+
30
+
31
+ ### Features
32
+
33
+ * **PPDSR-827:** 2/3 Help Hub - Layout ([#761](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/761)) ([cb340a6](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/cb340a61229f49cd0899371adcf51155b74eb471))
34
+ * **PPDSR-827:** 1/3 Help Hub - Introduce common NavigationPrimary header ([#752](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/752)) ([5b55fd1](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/5b55fd130a1fea5d5440a93b2cb67a026a52558b))
35
+ * **PPDSR-843:** Add multi-tenancy ([#756](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/756)) ([0481497](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/04814974fb49007506b3534f2d6de8a617fa4589))
36
+
37
+
38
+
39
+
40
+
41
+ # [1.68.0-alpha.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.67.0...@newskit-render/core@1.68.0-alpha.2) (2022-06-23)
42
+
43
+
44
+ ### Features
45
+
46
+ * **PPDSR-827:** 2/3 Help Hub - Layout ([#761](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/761)) ([cb340a6](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/cb340a61229f49cd0899371adcf51155b74eb471))
47
+ * **PPDSR-827:** 1/3 Help Hub - Introduce common NavigationPrimary header ([#752](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/752)) ([5b55fd1](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/5b55fd130a1fea5d5440a93b2cb67a026a52558b))
48
+ * **PPDSR-843:** Add multi-tenancy ([#756](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/756)) ([0481497](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/04814974fb49007506b3534f2d6de8a617fa4589))
49
+
50
+
51
+
52
+
53
+
54
+ # [1.68.0-alpha.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.67.0...@newskit-render/core@1.68.0-alpha.1) (2022-06-22)
55
+
56
+
57
+ ### Features
58
+
59
+ * **PPDSR-827:** 1/3 Help Hub - Introduce common NavigationPrimary header ([#752](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/752)) ([5b55fd1](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/5b55fd130a1fea5d5440a93b2cb67a026a52558b))
60
+ * **PPDSR-843:** Add multi-tenancy ([#756](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/756)) ([0481497](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/04814974fb49007506b3534f2d6de8a617fa4589))
61
+
62
+
63
+
64
+
65
+
66
+ # [1.68.0-alpha.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.67.0...@newskit-render/core@1.68.0-alpha.0) (2022-06-21)
67
+
68
+
69
+ ### Features
70
+
71
+ * **PPDSR-827:** 1/3 Help Hub - Introduce common NavigationPrimary header ([#752](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/752)) ([5b55fd1](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/5b55fd130a1fea5d5440a93b2cb67a026a52558b))
72
+
73
+
74
+
75
+
76
+
77
+ ## [1.67.1-alpha.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.67.0...@newskit-render/core@1.67.1-alpha.2) (2022-06-20)
78
+
79
+ **Note:** Version bump only for package @newskit-render/core
80
+
81
+
82
+
83
+
84
+
85
+ ## [1.67.1-alpha.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.67.0...@newskit-render/core@1.67.1-alpha.1) (2022-06-16)
86
+
87
+ **Note:** Version bump only for package @newskit-render/core
88
+
89
+
90
+
91
+
92
+
93
+ ## [1.67.1-alpha.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.67.0...@newskit-render/core@1.67.1-alpha.0) (2022-06-16)
94
+
95
+ **Note:** Version bump only for package @newskit-render/core
96
+
97
+
98
+
99
+
100
+
101
+ # [1.67.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.67.0-alpha.0...@newskit-render/core@1.67.0) (2022-06-16)
102
+
103
+ **Note:** Version bump only for package @newskit-render/core
104
+
105
+
106
+
107
+
108
+
109
+ ## [1.66.2-alpha.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.66.1...@newskit-render/core@1.66.2-alpha.1) (2022-06-14)
110
+
111
+
112
+ ### Bug Fixes
113
+
114
+ * **PPDSR-998:** update cookie values ([#757](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/757)) ([142d7f6](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/142d7f6213294460e2b454da7da2c93693d3121a))
115
+
116
+
117
+
118
+
119
+
120
+ ## [1.66.2-alpha.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.66.1...@newskit-render/core@1.66.2-alpha.0) (2022-06-10)
121
+
122
+
123
+ ### Bug Fixes
124
+
125
+ * **PPDSR-998:** update cookie values ([#757](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/757)) ([142d7f6](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/142d7f6213294460e2b454da7da2c93693d3121a))
126
+
127
+
128
+
129
+
130
+
131
+ ## [1.66.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.66.1-alpha.0...@newskit-render/core@1.66.1) (2022-06-07)
132
+
133
+ **Note:** Version bump only for package @newskit-render/core
134
+
135
+
136
+
137
+
138
+
6
139
  # [1.66.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.66.0-alpha.0...@newskit-render/core@1.66.0) (2022-06-02)
7
140
 
8
141
  **Note:** Version bump only for package @newskit-render/core
package/README.md CHANGED
@@ -22,6 +22,22 @@ or with npm
22
22
  ```
23
23
  npm start
24
24
  ```
25
+ ## Rquired Environment Variables
26
+
27
+ In order to run the application,we need the following required environment variables.
28
+
29
+ ```
30
+ SITE_HOST=""
31
+ NEWSKIT_API_ENV_URL=""
32
+ NEWSKIT_API_X_API_KEY=""
33
+ OKTA_CLIENT_ID=""
34
+ OKTA_CLIENT_SECRET=""
35
+ OKTA_DOMAIN=""
36
+ PUBLISHER=""
37
+ ```
38
+ ## Endpoints
39
+
40
+ 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.
25
41
 
26
42
  ## Ads Library
27
43
 
@@ -54,31 +54,7 @@ const props: ArticleSlug = {
54
54
  twitterUsername: 'D_Trump',
55
55
  siteHost: 'hostname',
56
56
  gscId: '4320982',
57
- recommendations: [
58
- {
59
- href:
60
- 'https://www.thesun.co.uk/wp-content/uploads/2022/03/image-656eaa885d.jpg?strip=all&w=600&h=338&crop=1',
61
- tag: 'FOOT ON THE GAZ',
62
- text:
63
- 'Bale considering short deal with new club before RETIRING after World Cup',
64
- title: 'FOOT ON THE GAZ',
65
- },
66
- {
67
- href:
68
- 'https://www.thesun.co.uk/wp-content/uploads/2022/03/image-a21f115694-1.jpg?strip=all&w=600&h=338&crop=1',
69
- tag: 'TOUGH TIMES',
70
- text:
71
- 'I only made £5k last year - I sold £801k villa for cash, says Claire Sweeney',
72
- title: 'TOUGH TIMES',
73
- },
74
- {
75
- href: null,
76
- tag: 'TOUGH TIMES',
77
- text:
78
- 'I only made £5k last year - I sold £801k villa for cash, says Claire Sweeney',
79
- title: 'TOUGH TIMES',
80
- },
81
- ],
57
+ articleId: 'test-1',
82
58
  }
83
59
 
84
60
  const user = {
@@ -131,36 +107,6 @@ jest.mock('@newskit-render/my-account', () => {
131
107
  }
132
108
  })
133
109
 
134
- jest.mock('@newskit-render/standalone-components', () => {
135
- return {
136
- recommendationsProvider: jest.fn().mockResolvedValueOnce([
137
- {
138
- href:
139
- 'https://www.thesun.co.uk/wp-content/uploads/2022/03/image-656eaa885d.jpg?strip=all&w=600&h=338&crop=1',
140
- tag: 'FOOT ON THE GAZ',
141
- text:
142
- 'Bale considering short deal with new club before RETIRING after World Cup',
143
- title: 'FOOT ON THE GAZ',
144
- },
145
- {
146
- href:
147
- 'https://www.thesun.co.uk/wp-content/uploads/2022/03/image-a21f115694-1.jpg?strip=all&w=600&h=338&crop=1',
148
- tag: 'TOUGH TIMES',
149
- text:
150
- 'I only made £5k last year - I sold £801k villa for cash, says Claire Sweeney',
151
- title: 'TOUGH TIMES',
152
- },
153
- {
154
- href: null,
155
- tag: 'TOUGH TIMES',
156
- text:
157
- 'I only made £5k last year - I sold £801k villa for cash, says Claire Sweeney',
158
- title: 'TOUGH TIMES',
159
- },
160
- ]),
161
- }
162
- })
163
-
164
110
  describe('Article', () => {
165
111
  describe('getServerSideProps', () => {
166
112
  it('should return props', async () => {