@newskit-render/core 1.13.2 → 1.20.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.
Files changed (94) hide show
  1. package/.eslintignore +5 -1
  2. package/CHANGELOG.md +163 -0
  3. package/__tests__/pages/[articleSlug].test.tsx +1 -1
  4. package/__tests__/pages/__snapshots__/home.test.tsx.snap +175 -324
  5. package/__tests__/pages/home.test.tsx +1 -0
  6. package/components/article/__tests__/__snapshots__/index.test.tsx.snap +279 -517
  7. package/components/footer/__snapshots__/index.test.tsx.snap +7 -11
  8. package/components/header/index.test.tsx +1 -1
  9. package/components/header/index.tsx +60 -30
  10. package/components/section/__tests__/ArticleSlice.test.tsx +32 -24
  11. package/components/section/layouts/__tests__/__snapshots__/Lead.test.tsx.snap +30 -50
  12. package/components/section/layouts/__tests__/__snapshots__/SectionRow.test.tsx.snap +205 -358
  13. package/helpers/a11y.ts +8 -6
  14. package/helpers/mocks/articleMock.ts +8 -4
  15. package/helpers/mocks/getRadioPostMock.ts +4 -2
  16. package/helpers/mocks/getUniversalArticleMock.ts +8 -4
  17. package/package.json +53 -52
  18. package/pages/[section]/[articleId]/[articleSlug].tsx +1 -0
  19. package/pages/[section]/index.tsx +1 -0
  20. package/pages/_app.tsx +211 -13
  21. package/pages/_document.tsx +27 -14
  22. package/pages/checkout/account-creation/index.tsx +9 -1
  23. package/pages/index.tsx +1 -0
  24. package/public/fonts/bitter-medium.woff +0 -0
  25. package/public/fonts/bitter-medium.woff2 +0 -0
  26. package/public/fonts/bitter-mediumitalic.woff +0 -0
  27. package/public/fonts/bitter-mediumitalic.woff2 +0 -0
  28. package/public/fonts/bitter-regular.woff +0 -0
  29. package/public/fonts/bitter-regular.woff2 +0 -0
  30. package/public/fonts/bitter-semibold.woff +0 -0
  31. package/public/fonts/bitter-semibold.woff2 +0 -0
  32. package/public/fonts/dmmono-medium.woff +0 -0
  33. package/public/fonts/dmmono-medium.woff2 +0 -0
  34. package/public/fonts/dmsans-bold-webfont.woff +0 -0
  35. package/public/fonts/dmsans-bold-webfont.woff2 +0 -0
  36. package/public/fonts/dmsans-bolditalic-webfont.woff +0 -0
  37. package/public/fonts/dmsans-bolditalic-webfont.woff2 +0 -0
  38. package/public/fonts/dmsans-italic-webfont.woff +0 -0
  39. package/public/fonts/dmsans-italic-webfont.woff2 +0 -0
  40. package/public/fonts/dmsans-medium-webfont.woff +0 -0
  41. package/public/fonts/dmsans-medium-webfont.woff2 +0 -0
  42. package/public/fonts/dmsans-mediumitalic-webfont.woff +0 -0
  43. package/public/fonts/dmsans-mediumitalic-webfont.woff2 +0 -0
  44. package/public/fonts/dmsans-regular-webfont.woff +0 -0
  45. package/public/fonts/dmsans-regular-webfont.woff2 +0 -0
  46. package/public/fonts/notosans-bold-webfont.woff +0 -0
  47. package/public/fonts/notosans-bold-webfont.woff2 +0 -0
  48. package/public/fonts/notosans-italic-webfont.woff +0 -0
  49. package/public/fonts/notosans-italic-webfont.woff2 +0 -0
  50. package/public/fonts/notosans-medium-webfont.woff +0 -0
  51. package/public/fonts/notosans-medium-webfont.woff2 +0 -0
  52. package/public/fonts/notosans-regular-webfont.woff +0 -0
  53. package/public/fonts/notosans-regular-webfont.woff2 +0 -0
  54. package/public/fonts/poppins-bold-webfont.woff +0 -0
  55. package/public/fonts/poppins-bold-webfont.woff2 +0 -0
  56. package/public/fonts/poppins-bolditalic-webfont.woff +0 -0
  57. package/public/fonts/poppins-bolditalic-webfont.woff2 +0 -0
  58. package/public/fonts/poppins-extrabold-webfont.woff +0 -0
  59. package/public/fonts/poppins-extrabold-webfont.woff2 +0 -0
  60. package/public/fonts/poppins-extrabolditalic-webfont.woff +0 -0
  61. package/public/fonts/poppins-extrabolditalic-webfont.woff2 +0 -0
  62. package/public/fonts/poppins-italic-webfont.woff +0 -0
  63. package/public/fonts/poppins-italic-webfont.woff2 +0 -0
  64. package/public/fonts/poppins-light-webfont.woff +0 -0
  65. package/public/fonts/poppins-light-webfont.woff2 +0 -0
  66. package/public/fonts/poppins-lightitalic-webfont.woff +0 -0
  67. package/public/fonts/poppins-lightitalic-webfont.woff2 +0 -0
  68. package/public/fonts/poppins-medium-webfont.woff +0 -0
  69. package/public/fonts/poppins-medium-webfont.woff2 +0 -0
  70. package/public/fonts/poppins-mediumitalic-webfont.woff +0 -0
  71. package/public/fonts/poppins-mediumitalic-webfont.woff2 +0 -0
  72. package/public/fonts/poppins-regular-webfont.woff +0 -0
  73. package/public/fonts/poppins-regular-webfont.woff2 +0 -0
  74. package/public/fonts/poppins-semibold-webfont.woff +0 -0
  75. package/public/fonts/poppins-semibold-webfont.woff2 +0 -0
  76. package/public/fonts/poppins-semibolditalic-webfont.woff +0 -0
  77. package/public/fonts/poppins-semibolditalic-webfont.woff2 +0 -0
  78. package/public/fonts/source-serif-pro-600.woff +0 -0
  79. package/public/fonts/source-serif-pro-600.woff2 +0 -0
  80. package/public/fonts/source-serif-pro-600italic.woff +0 -0
  81. package/public/fonts/source-serif-pro-600italic.woff2 +0 -0
  82. package/public/fonts/source-serif-pro-700.woff +0 -0
  83. package/public/fonts/source-serif-pro-700.woff2 +0 -0
  84. package/public/fonts/source-serif-pro-700italic.woff +0 -0
  85. package/public/fonts/source-serif-pro-700italic.woff2 +0 -0
  86. package/public/fonts/source-serif-pro-italic.woff +0 -0
  87. package/public/fonts/source-serif-pro-italic.woff2 +0 -0
  88. package/public/fonts/source-serif-pro-regular.woff +0 -0
  89. package/public/fonts/source-serif-pro-regular.woff2 +0 -0
  90. package/public/prebid.min.js +1 -0
  91. package/temp/_document.tsx +1 -1
  92. package/theme/colours.json +4 -0
  93. package/theme/render-custom-theme.ts +5 -2
  94. package/helpers/articleUtil.ts +0 -4
package/helpers/a11y.ts CHANGED
@@ -1,7 +1,9 @@
1
- export const handleEnterKeyPress =
2
- (onClick: () => void) =>
3
- ({ key }: { key: string }) => {
4
- if (key === 'Enter') {
5
- onClick()
6
- }
1
+ export const handleEnterKeyPress = (onClick: () => void) => ({
2
+ key,
3
+ }: {
4
+ key: string
5
+ }) => {
6
+ if (key === 'Enter') {
7
+ onClick()
7
8
  }
9
+ }
@@ -26,25 +26,29 @@ export const relatedArticles = [
26
26
  {
27
27
  title: 'Prince Harry',
28
28
  tag: 'NEWS',
29
- text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
29
+ text:
30
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
30
31
  href: imagePlaceholderHref('70x50'),
31
32
  },
32
33
  {
33
34
  title: 'Meghan Markle',
34
35
  tag: 'SPORT',
35
- text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
36
+ text:
37
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
36
38
  href: imagePlaceholderHref('70x50'),
37
39
  },
38
40
  {
39
41
  title: 'Royal Family',
40
42
  tag: 'CULTURE',
41
- text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
43
+ text:
44
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
42
45
  href: imagePlaceholderHref('70x50'),
43
46
  },
44
47
  {
45
48
  title: 'Royal Family',
46
49
  tag: 'CORONAVIRUS',
47
- text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
50
+ text:
51
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
48
52
  href: imagePlaceholderHref('70x50'),
49
53
  },
50
54
  ]
@@ -29,7 +29,8 @@ export default [
29
29
  italic: false,
30
30
  underline: false,
31
31
  monospace: false,
32
- text: 'Proin eget tortor risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; ',
32
+ text:
33
+ 'Proin eget tortor risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; ',
33
34
  },
34
35
  {
35
36
  type: 'text',
@@ -45,7 +46,8 @@ export default [
45
46
  italic: false,
46
47
  underline: false,
47
48
  monospace: false,
48
- text: ', auctor sit amet aliquam vel, ullamcorper sit amet ligula. Donec rutrum congue leo eget malesuada. Proin eget tortor risus. Sed porttitor lectus nibh. Donec sollicitudin molestie malesuada.',
49
+ text:
50
+ ', auctor sit amet aliquam vel, ullamcorper sit amet ligula. Donec rutrum congue leo eget malesuada. Proin eget tortor risus. Sed porttitor lectus nibh. Donec sollicitudin molestie malesuada.',
49
51
  },
50
52
  ],
51
53
  },
@@ -51,17 +51,21 @@ export default [
51
51
  summary: {
52
52
  children: [
53
53
  {
54
- text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget lorem vel nunc feugiat malesuada ut ac nisi. Morbi odio ipsum, dignissim nec turpis vel, laoreet condimentum tortor. Duis laoreet tincidunt ullamcorper.',
54
+ text:
55
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget lorem vel nunc feugiat malesuada ut ac nisi. Morbi odio ipsum, dignissim nec turpis vel, laoreet condimentum tortor. Duis laoreet tincidunt ullamcorper.',
55
56
  },
56
57
  {
57
- text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget lorem vel nunc feugiat malesuada ut ac nisi. Morbi odio ipsum, dignissim nec turpis vel, laoreet condimentum tortor. Duis laoreet tincidunt ullamcorper.',
58
+ text:
59
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget lorem vel nunc feugiat malesuada ut ac nisi. Morbi odio ipsum, dignissim nec turpis vel, laoreet condimentum tortor. Duis laoreet tincidunt ullamcorper.',
58
60
  },
59
61
  {
60
62
  url: 'http://this-is-a-url/',
61
- text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget lorem vel nunc feugiat malesuada ut ac nisi. Morbi odio ipsum, dignissim nec turpis vel, laoreet condimentum tortor. Duis laoreet tincidunt ullamcorper.',
63
+ text:
64
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget lorem vel nunc feugiat malesuada ut ac nisi. Morbi odio ipsum, dignissim nec turpis vel, laoreet condimentum tortor. Duis laoreet tincidunt ullamcorper.',
62
65
  },
63
66
  {
64
- text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget lorem vel nunc feugiat malesuada ut ac nisi. Morbi odio ipsum, dignissim nec turpis vel, laoreet condimentum tortor. Duis laoreet tincidunt ullamcorper.',
67
+ text:
68
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget lorem vel nunc feugiat malesuada ut ac nisi. Morbi odio ipsum, dignissim nec turpis vel, laoreet condimentum tortor. Duis laoreet tincidunt ullamcorper.',
65
69
  },
66
70
  ],
67
71
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newskit-render/core",
3
- "version": "1.13.2",
3
+ "version": "1.20.0",
4
4
  "description": "Newskit Render - Core package",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
@@ -30,63 +30,64 @@
30
30
  "analyze": "ANALYZE=true next build"
31
31
  },
32
32
  "dependencies": {
33
- "@apollo/client": "^3.4.16",
34
- "@newskit-render/api": "^0.8.0",
35
- "@newskit-render/auth": "^0.25.0",
36
- "@newskit-render/checkout": "^0.15.0",
37
- "@newskit-render/my-account": "^0.122.0",
38
- "@newskit-render/shared-components": "^0.25.0",
39
- "@newskit-render/sitemap": "^0.28.0",
40
- "@newskit-render/validation": "^0.30.0",
41
- "cross-fetch": "^3.1.4",
42
- "graphql": "^15.6.0",
43
- "newrelic": "^7.1.0",
44
- "newskit": "4.3.1",
45
- "next": "^12.0.2",
46
- "react": "^17.0.1",
47
- "react-dom": "^17.0.2",
48
- "react-helmet": "^6.1.0",
33
+ "@apollo/client": "3.4.16",
34
+ "@newskit-render/api": "^0.12.0",
35
+ "@newskit-render/auth": "^0.27.0",
36
+ "@newskit-render/checkout": "^0.18.0",
37
+ "@newskit-render/feature-flags": "^0.9.0",
38
+ "@newskit-render/my-account": "^0.129.0",
39
+ "@newskit-render/shared-components": "^0.29.0",
40
+ "@newskit-render/sitemap": "^0.31.0",
41
+ "@newskit-render/validation": "^0.33.0",
42
+ "cross-fetch": "3.1.5",
43
+ "graphql": "15.6.0",
44
+ "newrelic": "7.1.0",
45
+ "newskit": "5.0.0",
46
+ "next": "12.0.8",
47
+ "react": "17.0.2",
48
+ "react-dom": "17.0.2",
49
+ "react-helmet": "6.1.0",
49
50
  "react-hook-form": "7.8.4"
50
51
  },
51
52
  "devDependencies": {
52
- "@apollo/react-testing": "^4.0.0",
53
- "@emotion/jest": "^11.3.0",
54
- "@next/bundle-analyzer": "^12.0.8",
55
- "@pact-foundation/pact": "^9.12.1",
56
- "@testing-library/jest-dom": "^5.11.4",
57
- "@testing-library/react": "^11.0.2",
58
- "@types/newrelic": "^7.0.0",
59
- "@types/react": "^16.9.49",
60
- "@types/react-helmet": "^6.1.0",
61
- "@typescript-eslint/eslint-plugin": "^3.7.1",
62
- "@typescript-eslint/parser": "^3.7.1",
63
- "babel-jest": "^26.3.0",
53
+ "@apollo/react-testing": "4.0.0",
54
+ "@emotion/jest": "11.3.0",
55
+ "@next/bundle-analyzer": "12.0.8",
56
+ "@pact-foundation/pact": "9.12.1",
57
+ "@testing-library/jest-dom": "5.11.4",
58
+ "@testing-library/react": "11.0.2",
59
+ "@types/newrelic": "7.0.0",
60
+ "@types/react": "17.0.2",
61
+ "@types/react-helmet": "6.1.0",
62
+ "@typescript-eslint/eslint-plugin": "3.7.1",
63
+ "@typescript-eslint/parser": "3.7.1",
64
+ "babel-jest": "26.3.0",
64
65
  "cypress": "9.0.0",
65
- "eslint": "^6.6.0",
66
- "eslint-config-airbnb": "^18.2.0",
67
- "eslint-config-airbnb-typescript": "^9.0.0",
68
- "eslint-config-prettier": "^6.11.0",
69
- "eslint-config-react-app": "^5.2.1",
70
- "eslint-import-resolver-typescript": "^2.0.0",
71
- "eslint-loader": "^4.0.2",
72
- "eslint-plugin-cypress": "^2.11.2",
73
- "eslint-plugin-flowtype": "^5.2.0",
74
- "eslint-plugin-import": "^2.22.1",
66
+ "eslint": "6.6.0",
67
+ "eslint-config-airbnb": "18.2.0",
68
+ "eslint-config-airbnb-typescript": "9.0.0",
69
+ "eslint-config-prettier": "6.11.0",
70
+ "eslint-config-react-app": "5.2.1",
71
+ "eslint-import-resolver-typescript": "2.0.0",
72
+ "eslint-loader": "4.0.2",
73
+ "eslint-plugin-cypress": "2.11.2",
74
+ "eslint-plugin-flowtype": "5.2.0",
75
+ "eslint-plugin-import": "2.22.1",
75
76
  "eslint-plugin-jsx-a11y": "6.2.3",
76
- "eslint-plugin-prettier": "^3.1.4",
77
+ "eslint-plugin-prettier": "3.1.4",
77
78
  "eslint-plugin-react": "7.19.0",
78
- "eslint-plugin-react-hooks": "^1.6.1",
79
- "jest": "^27.2.4",
80
- "jest-junit": "^12.0.0",
81
- "jest-watch-typeahead": "^0.6.3",
82
- "lint-staged": "^12.1.7",
83
- "next-transpile-modules": "^8.0.0",
84
- "prettier": "^2.0.5",
85
- "prettier-eslint": "^11.0.0",
86
- "prettier-eslint-cli": "^5.0.0",
87
- "ts-jest": "^27.0.5",
88
- "typescript": "^4.4.3",
89
- "wait-on": "^5.3.0"
79
+ "eslint-plugin-react-hooks": "1.6.1",
80
+ "jest": "27.2.4",
81
+ "jest-junit": "12.0.0",
82
+ "jest-watch-typeahead": "0.6.3",
83
+ "lint-staged": "12.1.7",
84
+ "next-transpile-modules": "8.0.0",
85
+ "prettier": "2.0.5",
86
+ "prettier-eslint": "11.0.0",
87
+ "prettier-eslint-cli": "5.0.0",
88
+ "ts-jest": "27.0.5",
89
+ "typescript": "4.4.3",
90
+ "wait-on": "5.3.0"
90
91
  },
91
92
  "precommit": [
92
93
  "precommit"
@@ -70,6 +70,7 @@ export async function getServerSideProps(context) {
70
70
  twitterUsername: process.env.TWITTER_USERNAME || '',
71
71
  siteHost: process.env.SITE_HOST || '',
72
72
  gscId: process.env.GSC_ID || '',
73
+ showAds: true,
73
74
  // user,
74
75
  },
75
76
  }
@@ -38,6 +38,7 @@ export async function getServerSideProps(context) {
38
38
  props: {
39
39
  page: data.page,
40
40
  isIndexPage: true,
41
+ showAds: true,
41
42
  // user,
42
43
  },
43
44
  }
package/pages/_app.tsx CHANGED
@@ -3,6 +3,12 @@ import { AppProps } from 'next/app'
3
3
  import Head from 'next/head'
4
4
  import { ThemeProvider, Global, css, styled } from 'newskit'
5
5
  import { SessionProvider } from '@newskit-render/auth'
6
+ import {
7
+ getFeatureFlags,
8
+ FeatureFlagsContextProvider,
9
+ FeatureFlag,
10
+ createFeatureFlagsInstance,
11
+ } from '@newskit-render/feature-flags'
6
12
  import { AppContextProvider, AppContext } from '../app-context/AppContext'
7
13
  import { logger } from '../helpers/logger'
8
14
 
@@ -12,6 +18,12 @@ if (!process.browser) {
12
18
  logger()
13
19
  }
14
20
 
21
+ if (process.env.OPTIMIZELY_SDK_KEY) {
22
+ createFeatureFlagsInstance({
23
+ optimizelyConfig: { sdkKey: process.env.OPTIMIZELY_SDK_KEY },
24
+ })
25
+ }
26
+
15
27
  const GlobalStyling = css`
16
28
  @font-face {
17
29
  font-family: GillSansMTStd-Medium;
@@ -49,6 +61,178 @@ const GlobalStyling = css`
49
61
  font-family: TheSun-Medium;
50
62
  src: url('/fonts/TheSun-Medium.ttf') format('truetype');
51
63
  }
64
+ @font-face {
65
+ font-family: 'DM Sans';
66
+ src: url('/fonts/dmsans-regular-webfont.woff2') format('woff2'),
67
+ url('/fonts/dmsans-regular-webfont.woff') format('woff');
68
+ font-style: normal;
69
+ font-weight: 400;
70
+ font-display: swap;
71
+ }
72
+ @font-face {
73
+ font-family: 'DM Sans';
74
+ src: url('/fonts/dmsans-italic-webfont.woff2') format('woff2'),
75
+ url('/fonts/dmsans-italic-webfont.woff') format('woff');
76
+ font-style: italic;
77
+ font-weight: 400;
78
+ font-display: swap;
79
+ }
80
+ @font-face {
81
+ font-family: 'DM Sans';
82
+ src: url('/fonts/dmsans-medium-webfont.woff2') format('woff2'),
83
+ url('/fonts/dmsans-medium-webfont.woff') format('woff');
84
+ font-style: normal;
85
+ font-weight: 500;
86
+ font-display: swap;
87
+ }
88
+ @font-face {
89
+ font-family: 'DM Sans';
90
+ src: url('/fonts/dmsans-mediumitalic-webfont.woff2') format('woff2'),
91
+ url('/fonts/dmsans-mediumitalic-webfont.woff') format('woff');
92
+ font-style: italic;
93
+ font-weight: 500;
94
+ font-display: swap;
95
+ }
96
+ @font-face {
97
+ font-family: 'DM Sans';
98
+ src: url('/fonts/dmsans-bold-webfont.woff2') format('woff2'),
99
+ url('/fonts/dmsans-bold-webfont.woff') format('woff');
100
+ font-style: normal;
101
+ font-weight: 700;
102
+ font-display: swap;
103
+ }
104
+ @font-face {
105
+ font-family: 'DM Sans';
106
+ src: url('/fonts/dmsans-bolditalic-webfont.woff2') format('woff2'),
107
+ url('/fonts/dmsans-bolditalic-webfont.woff') format('woff');
108
+ font-style: italic;
109
+ font-weight: 700;
110
+ font-display: swap;
111
+ }
112
+ @font-face {
113
+ font-family: 'Poppins';
114
+ src: url('/fonts/poppins-bold-webfont.woff2') format('woff2'),
115
+ url('/fonts/poppins-bold-webfont.woff') format('woff');
116
+ font-weight: 700;
117
+ font-style: normal;
118
+ }
119
+ @font-face {
120
+ font-family: 'Poppins';
121
+ src: url('/fonts/poppins-bolditalic-webfont.woff2') format('woff2'),
122
+ url('/fonts/poppins-bolditalic-webfont.woff') format('woff');
123
+ font-weight: normal;
124
+ font-style: italic;
125
+ }
126
+ @font-face {
127
+ font-family: 'Poppins';
128
+ src: url('/fonts/poppins-extrabold-webfont.woff2') format('woff2'),
129
+ url('/fonts/poppins-extrabold-webfont.woff') format('woff');
130
+ font-weight: 800;
131
+ font-style: normal;
132
+ }
133
+ @font-face {
134
+ font-family: 'Poppins';
135
+ src: url('/fonts/poppins-extrabolditalic-webfont.woff2') format('woff2'),
136
+ url('/fonts/poppins-extrabolditalic-webfont.woff') format('woff');
137
+ font-weight: 800;
138
+ font-style: italic;
139
+ }
140
+ @font-face {
141
+ font-family: 'Poppins';
142
+ src: url('/fonts/poppins-italic-webfont.woff2') format('woff2'),
143
+ url('/fonts/poppins-italic-webfont.woff') format('woff');
144
+ font-weight: 400;
145
+ font-style: italic;
146
+ }
147
+ @font-face {
148
+ font-family: 'Poppins';
149
+ src: url('/fonts/poppins-light-webfont.woff2') format('woff2'),
150
+ url('/fonts/poppins-light-webfont.woff') format('woff');
151
+ font-weight: 300;
152
+ font-style: normal;
153
+ }
154
+ @font-face {
155
+ font-family: 'Poppins';
156
+ src: url('/fonts/poppins-lightitalic-webfont.woff2') format('woff2'),
157
+ url('/fonts/poppins-lightitalic-webfont.woff') format('woff');
158
+ font-weight: 300;
159
+ font-style: italic;
160
+ }
161
+ @font-face {
162
+ font-family: 'Poppins';
163
+ src: url('/fonts/poppins-medium-webfont.woff2') format('woff2'),
164
+ url('/fonts/poppins-medium-webfont.woff') format('woff');
165
+ font-weight: 500;
166
+ font-style: normal;
167
+ }
168
+ @font-face {
169
+ font-family: 'Poppins';
170
+ src: url('/fonts/poppins-mediumitalic-webfont.woff2') format('woff2'),
171
+ url('/fonts/poppins-mediumitalic-webfont.woff') format('woff');
172
+ font-weight: 500;
173
+ font-style: italic;
174
+ }
175
+ @font-face {
176
+ font-family: 'Poppins';
177
+ src: url('/fonts/poppins-regular-webfont.woff2') format('woff2'),
178
+ url('/fonts/poppins-regular-webfont.woff') format('woff');
179
+ font-weight: 400;
180
+ font-style: normal;
181
+ }
182
+ @font-face {
183
+ font-family: 'Poppins';
184
+ src: url('/fonts/poppins-semibold-webfont.woff2') format('woff2'),
185
+ url('/fonts/poppins-semibold-webfont.woff') format('woff');
186
+ font-weight: 600;
187
+ font-style: normal;
188
+ }
189
+ @font-face {
190
+ font-family: 'Poppins';
191
+ src: url('/fonts/poppins-semibolditalic-webfont.woff2') format('woff2'),
192
+ url('/fonts/poppins-semibolditalic-webfont.woff') format('woff');
193
+ font-weight: 600;
194
+ font-style: italic;
195
+ }
196
+ @font-face {
197
+ font-family: 'DM Mono';
198
+ src: url('/fonts/dmmono-medium.woff2') format('woff2'),
199
+ url('/fonts/dmmono-medium.woff') format('woff');
200
+ font-style: normal;
201
+ font-weight: 500;
202
+ font-display: swap;
203
+ }
204
+ @font-face {
205
+ font-family: 'Bitter';
206
+ src: url('/fonts/bitter-regular.woff2') format('woff2'),
207
+ url('/fonts/bitter-regular.woff') format('woff');
208
+ font-style: normal;
209
+ font-weight: 400;
210
+ font-display: swap;
211
+ }
212
+ @font-face {
213
+ font-family: 'Bitter';
214
+ src: url('/fonts/bitter-medium.woff2') format('woff2'),
215
+ url('/fonts/bitter-medium.woff') format('woff');
216
+ font-style: normal;
217
+ font-weight: 500;
218
+ font-display: swap;
219
+ }
220
+ @font-face {
221
+ font-family: 'Bitter';
222
+ src: url('/fonts/bitter-mediumitalic.woff2') format('woff2'),
223
+ url('/fonts/bitter-mediumitalic.woff') format('woff');
224
+ font-style: italic;
225
+ font-weight: 500;
226
+ font-display: swap;
227
+ }
228
+ @font-face {
229
+ font-family: 'Bitter';
230
+ src: url('/fonts/bitter-semibold.woff2') format('woff2'),
231
+ url('/fonts/bitter-semibold.woff') format('woff');
232
+ font-style: normal;
233
+ font-weight: 600;
234
+ font-display: swap;
235
+ }
52
236
 
53
237
  html,
54
238
  body {
@@ -68,7 +252,11 @@ const PageContainer = styled.div`
68
252
  min-height: 100vh;
69
253
  `
70
254
 
71
- function MyApp({ Component, pageProps }: AppProps) {
255
+ interface MyAppProps extends AppProps {
256
+ featureFlags?: FeatureFlag
257
+ }
258
+
259
+ function MyApp({ Component, pageProps, featureFlags }: MyAppProps) {
72
260
  return (
73
261
  <AppContextProvider>
74
262
  <>
@@ -82,21 +270,31 @@ function MyApp({ Component, pageProps }: AppProps) {
82
270
  key="viewport"
83
271
  />
84
272
  </Head>
85
- <SessionProvider pageProps={pageProps}>
86
- <AppContext.Consumer>
87
- {({ theme }) => (
88
- <ThemeProvider theme={theme}>
89
- <Global styles={GlobalStyling} />
90
- <PageContainer>
91
- <Component {...pageProps} />
92
- </PageContainer>
93
- </ThemeProvider>
94
- )}
95
- </AppContext.Consumer>
96
- </SessionProvider>
273
+ <FeatureFlagsContextProvider context={featureFlags}>
274
+ <SessionProvider pageProps={pageProps}>
275
+ <AppContext.Consumer>
276
+ {({ theme }) => (
277
+ <ThemeProvider theme={theme}>
278
+ <Global styles={GlobalStyling} />
279
+ <PageContainer>
280
+ <Component {...pageProps} />
281
+ </PageContainer>
282
+ </ThemeProvider>
283
+ )}
284
+ </AppContext.Consumer>
285
+ </SessionProvider>
286
+ </FeatureFlagsContextProvider>
97
287
  </>
98
288
  </AppContextProvider>
99
289
  )
100
290
  }
101
291
 
292
+ MyApp.getInitialProps = async () => {
293
+ if (process.env.OPTIMIZELY_SDK_KEY) {
294
+ const featureFlags = await getFeatureFlags()
295
+ return { featureFlags }
296
+ }
297
+ return {}
298
+ }
299
+
102
300
  export default MyApp
@@ -32,6 +32,13 @@ export default class MyDocument extends Document {
32
32
 
33
33
  render() {
34
34
  const helmet = Helmet.rewind()
35
+ const showAds =
36
+ this.props.__NEXT_DATA__.props.pageProps &&
37
+ this.props.__NEXT_DATA__.props.pageProps.showAds
38
+ ? this.props.__NEXT_DATA__.props.pageProps.showAds
39
+ : false
40
+
41
+ const { featureFlags } = this.props.__NEXT_DATA__.props
35
42
  return (
36
43
  <Html lang="en">
37
44
  <Head>
@@ -46,12 +53,14 @@ export default class MyDocument extends Document {
46
53
  ),
47
54
  }}
48
55
  />
49
- {EXPERIMENTATION_WEB && (
50
- <ExperimentationWeb
51
- optimizelyWebConfig={{ scriptCdn: EXPERIMENTATION_WEB }}
52
- reactHelmet={Helmet}
53
- />
54
- )}
56
+ {EXPERIMENTATION_WEB &&
57
+ featureFlags &&
58
+ featureFlags.experimentation_web_flag && (
59
+ <ExperimentationWeb
60
+ optimizelyWebConfig={{ scriptCdn: EXPERIMENTATION_WEB }}
61
+ reactHelmet={Helmet}
62
+ />
63
+ )}
55
64
  {helmet.script.toComponent()}
56
65
  {SOURCEPOINT_ACCOUNT_ID && (
57
66
  <Consent
@@ -62,14 +71,18 @@ export default class MyDocument extends Document {
62
71
  />
63
72
  )}
64
73
  <meta name="robots" content="noindex" />
65
- <script
66
- type="text/javascript"
67
- src="https://ads.newskit.co.uk/prebid.newskit.min.js"
68
- />
69
- <script
70
- type="text/javascript"
71
- src="https://ads.newskit.co.uk/ads.newskit.min.js"
72
- />
74
+ {showAds && (
75
+ <>
76
+ <script
77
+ type="text/javascript"
78
+ src="https://ads.newskit.co.uk/prebid.newskit.min.js"
79
+ />
80
+ <script
81
+ type="text/javascript"
82
+ src="https://ads.newskit.co.uk/ads.newskit.min.js"
83
+ />
84
+ </>
85
+ )}
73
86
  </Head>
74
87
  <body>
75
88
  {TEALIUM_ACCOUNT_ID && (
@@ -1,10 +1,18 @@
1
1
  import { AccountCreation, getProviderProps } from '@newskit-render/checkout'
2
2
  import React, { useContext } from 'react'
3
3
  import { AppContext } from '../../../app-context/AppContext'
4
+ import validation from '../../../validation'
4
5
 
5
6
  const AccountCreationPage = (props) => {
6
7
  const { theme, setTheme } = useContext(AppContext)
7
- return <AccountCreation {...props} customTheme={theme} setTheme={setTheme} />
8
+ return (
9
+ <AccountCreation
10
+ {...props}
11
+ customTheme={theme}
12
+ setTheme={setTheme}
13
+ validation={validation}
14
+ />
15
+ )
8
16
  }
9
17
 
10
18
  export default AccountCreationPage
package/pages/index.tsx CHANGED
@@ -35,6 +35,7 @@ export async function getServerSideProps(context) {
35
35
  return {
36
36
  props: {
37
37
  page,
38
+ showAds: true,
38
39
  // user: (user || null),
39
40
  },
40
41
  }
Binary file
Binary file
Binary file
Binary file
Binary file