@newskit-render/core 1.5.2 → 1.11.3

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 (96) hide show
  1. package/.eslintignore +1 -0
  2. package/CHANGELOG.md +184 -0
  3. package/README.md +1 -1
  4. package/__tests__/pages/[articleSlug].test.tsx +1 -3
  5. package/__tests__/pages/__snapshots__/home.test.tsx.snap +1 -1
  6. package/__tests__/pages/home.test.tsx +0 -5
  7. package/{context → app-context}/AppContext.test.tsx +3 -2
  8. package/{context → app-context}/AppContext.tsx +3 -3
  9. package/{context → app-context}/__snapshots__/AppContext.test.tsx.snap +0 -0
  10. package/components/article/__tests__/__snapshots__/index.test.tsx.snap +1 -2
  11. package/components/article/__tests__/index.test.tsx +0 -1
  12. package/components/article/index.tsx +1 -1
  13. package/components/header/index.tsx +1 -1
  14. package/components/section/layouts/__tests__/__snapshots__/Lead.test.tsx.snap +1 -1
  15. package/infrastructure/terraform-newrelic/dashboards.tf +176 -0
  16. package/infrastructure/terraform-newrelic/lighthouse-script-prod.js +46 -0
  17. package/infrastructure/terraform-newrelic/lighthouse-script.js +46 -0
  18. package/infrastructure/terraform-newrelic/monitors.tf +12 -0
  19. package/next-env.d.ts +0 -1
  20. package/package.json +10 -11
  21. package/pages/[section]/[articleId]/[articleSlug].tsx +10 -13
  22. package/pages/[section]/index.tsx +12 -9
  23. package/pages/_app.tsx +38 -1
  24. package/pages/account/cancellation/index.tsx +6 -5
  25. package/pages/account/edit/[field].tsx +11 -2
  26. package/pages/account/index.tsx +9 -2
  27. package/pages/account/newsletters-and-alerts/index.tsx +10 -1
  28. package/pages/account/payment/index.tsx +8 -1
  29. package/pages/account/subscription-and-billing/index.tsx +14 -1
  30. package/pages/checkout/account-creation/index.tsx +14 -0
  31. package/pages/checkout/payment-details/index.tsx +14 -0
  32. package/pages/index.tsx +11 -9
  33. package/public/MyAccount/display-personalDetails-header-sun.svg +55 -0
  34. package/public/MyAccount/display-personalDetails-header-times.svg +90 -0
  35. package/public/MyAccount/display-personalDetails-header-vr.svg +46 -0
  36. package/public/MyAccount/navigationPrimary-brandMark-sun.svg +3 -0
  37. package/public/MyAccount/navigationPrimary-brandMark-times.svg +18 -0
  38. package/public/MyAccount/navigationPrimary-brandMark-vr.svg +10 -0
  39. package/public/fonts/GillSansMTStd-Bold.otf +0 -0
  40. package/public/fonts/GillSansMTStd-BoldCondensed.otf +0 -0
  41. package/public/fonts/GillSansMTStd-BoldItalic.otf +0 -0
  42. package/public/fonts/GillSansMTStd-Book.otf +0 -0
  43. package/public/fonts/GillSansMTStd-BookItalic.otf +0 -0
  44. package/public/fonts/GillSansMTStd-Condensed.otf +0 -0
  45. package/public/fonts/GillSansMTStd-ExtraBold.otf +0 -0
  46. package/public/fonts/GillSansMTStd-Heavy.otf +0 -0
  47. package/public/fonts/GillSansMTStd-HeavyItalic.otf +0 -0
  48. package/public/fonts/GillSansMTStd-Light.otf +0 -0
  49. package/public/fonts/GillSansMTStd-LightItalic.otf +0 -0
  50. package/public/fonts/GillSansMTStd-Medium.otf +0 -0
  51. package/public/fonts/GillSansMTStd-MediumItalic.otf +0 -0
  52. package/public/fonts/GillSansMTStd-UltraBold.otf +0 -0
  53. package/public/fonts/GillSansMTStd-UltraBoldCond.otf +0 -0
  54. package/public/fonts/Montserrat-Black.ttf +0 -0
  55. package/public/fonts/Montserrat-BlackItalic.ttf +0 -0
  56. package/public/fonts/Montserrat-Bold.ttf +0 -0
  57. package/public/fonts/Montserrat-BoldItalic.ttf +0 -0
  58. package/public/fonts/Montserrat-ExtraBold.ttf +0 -0
  59. package/public/fonts/Montserrat-ExtraBoldItalic.ttf +0 -0
  60. package/public/fonts/Montserrat-ExtraLight.ttf +0 -0
  61. package/public/fonts/Montserrat-ExtraLightItalic.ttf +0 -0
  62. package/public/fonts/Montserrat-Italic.ttf +0 -0
  63. package/public/fonts/Montserrat-Light.ttf +0 -0
  64. package/public/fonts/Montserrat-LightItalic.ttf +0 -0
  65. package/public/fonts/Montserrat-Medium.ttf +0 -0
  66. package/public/fonts/Montserrat-MediumItalic.ttf +0 -0
  67. package/public/fonts/Montserrat-Regular.ttf +0 -0
  68. package/public/fonts/Montserrat-SemiBold.ttf +0 -0
  69. package/public/fonts/Montserrat-SemiBoldItalic.ttf +0 -0
  70. package/public/fonts/Montserrat-Thin.ttf +0 -0
  71. package/public/fonts/Montserrat-ThinItalic.ttf +0 -0
  72. package/public/fonts/TheSun-Bold.ttf +0 -0
  73. package/public/fonts/TheSun-BoldItalic.ttf +0 -0
  74. package/public/fonts/TheSun-HeavyCondensed.ttf +0 -0
  75. package/public/fonts/TheSun-HeavyNarrow.ttf +0 -0
  76. package/public/fonts/TheSun-Italic.ttf +0 -0
  77. package/public/fonts/TheSun-Medium.ttf +0 -0
  78. package/public/fonts/TheSun-MediumItalic.ttf +0 -0
  79. package/public/fonts/TheSun-Regular.ttf +0 -0
  80. package/public/fonts/TimesDigital-Bold.ttf +0 -0
  81. package/public/fonts/TimesDigital-BoldItalic.ttf +0 -0
  82. package/public/fonts/TimesDigital-BoldSC.ttf +0 -0
  83. package/public/fonts/TimesDigital-Italic.ttf +0 -0
  84. package/public/fonts/TimesDigital-Regular.ttf +0 -0
  85. package/public/fonts/TimesDigital-RegularSC.ttf +0 -0
  86. package/public/fonts/TimesDigitalW04-Bold.ttf +0 -0
  87. package/public/fonts/TimesDigitalW04-BoldItalic.ttf +0 -0
  88. package/public/fonts/TimesDigitalW04-BoldSC.ttf +0 -0
  89. package/public/fonts/TimesDigitalW04-Italic.ttf +0 -0
  90. package/public/fonts/TimesDigitalW04-Regular.ttf +0 -0
  91. package/public/fonts/TimesDigitalW04-RegularSC.ttf +0 -0
  92. package/queries/getUserSubscription.ts +0 -13
  93. package/tsconfig.json +1 -1
  94. package/components/seo/index.test.tsx +0 -106
  95. package/components/seo/index.tsx +0 -89
  96. package/pages/checkout/index.tsx +0 -7
package/.eslintignore CHANGED
@@ -13,3 +13,4 @@ next-env.d.ts
13
13
  helpers/setupTests.ts
14
14
  newrelic.js
15
15
  infrastructure/helm/*
16
+ infrastructure/terraform-newrelic/*.js
package/CHANGELOG.md CHANGED
@@ -3,6 +3,190 @@
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.11.3](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.11.2...@newskit-render/core@1.11.3) (2022-01-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * update release cli version ([#556](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/556)) ([d613fe1](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/d613fe1f5b96fc3f66547f2310a12c0b3810e940))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.11.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.11.1...@newskit-render/core@1.11.2) (2022-01-11)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * bump release-cli to latest to fix pipeline ([#554](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/554)) ([46a0c13](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/46a0c13231f89445360126bc596476ca13716b37))
23
+
24
+
25
+
26
+
27
+
28
+ ## [1.11.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.11.0...@newskit-render/core@1.11.1) (2022-01-07)
29
+
30
+ **Note:** Version bump only for package @newskit-render/core
31
+
32
+
33
+
34
+
35
+
36
+ # [1.11.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.10.1...@newskit-render/core@1.11.0) (2022-01-06)
37
+
38
+
39
+ ### Features
40
+
41
+ * **PPDSR-605:** Move PrimaryNavigation to Shared Components ([#550](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/550)) ([fcc1cda](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/fcc1cda59d4cfcc42b1487ee8ba782c7d5f83bb7))
42
+
43
+
44
+
45
+
46
+
47
+ ## [1.10.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.10.0...@newskit-render/core@1.10.1) (2022-01-05)
48
+
49
+ **Note:** Version bump only for package @newskit-render/core
50
+
51
+
52
+
53
+
54
+
55
+ # [1.10.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.9.3...@newskit-render/core@1.10.0) (2022-01-05)
56
+
57
+
58
+ ### Features
59
+
60
+ * **PPDSR-594:** Add themes to account package ([#538](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/538)) ([e34a53a](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/e34a53a944ae8d1420c27459f1ef5ca3ba4160d0))
61
+
62
+
63
+
64
+
65
+
66
+ ## [1.9.3](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.9.2...@newskit-render/core@1.9.3) (2022-01-05)
67
+
68
+ **Note:** Version bump only for package @newskit-render/core
69
+
70
+
71
+
72
+
73
+
74
+ ## [1.9.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.9.1...@newskit-render/core@1.9.2) (2022-01-04)
75
+
76
+ **Note:** Version bump only for package @newskit-render/core
77
+
78
+
79
+
80
+
81
+
82
+ ## [1.9.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.9.0...@newskit-render/core@1.9.1) (2022-01-04)
83
+
84
+ **Note:** Version bump only for package @newskit-render/core
85
+
86
+
87
+
88
+
89
+
90
+ # [1.9.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.8.0...@newskit-render/core@1.9.0) (2022-01-04)
91
+
92
+
93
+ ### Features
94
+
95
+ * **PPDSR-518:** add basic page context ([#544](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/544)) ([16d3cbd](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/16d3cbd561aadd124c1856a3297b515c1b164935))
96
+
97
+
98
+
99
+
100
+
101
+ # [1.8.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.7.1...@newskit-render/core@1.8.0) (2021-12-21)
102
+
103
+
104
+ ### Features
105
+
106
+ * **PPDSR-559:** Replace go MAIN with newest version ([#536](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/536)) ([ba9a571](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/ba9a571f8c6ce27c93d6d7ad9e35df6f61d627eb))
107
+
108
+
109
+
110
+
111
+
112
+ ## [1.7.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.7.0...@newskit-render/core@1.7.1) (2021-12-16)
113
+
114
+ **Note:** Version bump only for package @newskit-render/core
115
+
116
+
117
+
118
+
119
+
120
+ # [1.7.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.6.1...@newskit-render/core@1.7.0) (2021-12-16)
121
+
122
+
123
+ ### Features
124
+
125
+ * **PPDSR-590:** Commenting preferences page redesign ([#540](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/540)) ([0ac17d0](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/0ac17d0c1682a6a1497f8705017cefc0fc7c3bb1))
126
+
127
+
128
+
129
+
130
+
131
+ ## [1.6.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.6.0...@newskit-render/core@1.6.1) (2021-12-16)
132
+
133
+ **Note:** Version bump only for package @newskit-render/core
134
+
135
+
136
+
137
+
138
+
139
+ # [1.6.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.5.7...@newskit-render/core@1.6.0) (2021-12-15)
140
+
141
+
142
+ ### Features
143
+
144
+ * **PPDSR-520:** Add SEO Component ([#539](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/539)) ([f9a7103](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/f9a71034e9e7224975d785fb47c68b907b4e5935))
145
+
146
+
147
+
148
+
149
+
150
+ ## [1.5.7](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.5.6...@newskit-render/core@1.5.7) (2021-12-14)
151
+
152
+ **Note:** Version bump only for package @newskit-render/core
153
+
154
+
155
+
156
+
157
+
158
+ ## [1.5.6](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.5.5...@newskit-render/core@1.5.6) (2021-12-13)
159
+
160
+ **Note:** Version bump only for package @newskit-render/core
161
+
162
+
163
+
164
+
165
+
166
+ ## [1.5.5](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.5.4...@newskit-render/core@1.5.5) (2021-12-13)
167
+
168
+ **Note:** Version bump only for package @newskit-render/core
169
+
170
+
171
+
172
+
173
+
174
+ ## [1.5.4](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.5.3...@newskit-render/core@1.5.4) (2021-12-10)
175
+
176
+ **Note:** Version bump only for package @newskit-render/core
177
+
178
+
179
+
180
+
181
+
182
+ ## [1.5.3](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.5.2...@newskit-render/core@1.5.3) (2021-12-08)
183
+
184
+ **Note:** Version bump only for package @newskit-render/core
185
+
186
+
187
+
188
+
189
+
6
190
  ## [1.5.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.5.1...@newskit-render/core@1.5.2) (2021-12-03)
7
191
 
8
192
  **Note:** Version bump only for package @newskit-render/core
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @newskit-render/core
2
2
 
3
- А website blueprint built with Next.js.
3
+ А template website built using Next.js.
4
4
 
5
5
  This package is used by [@newskit-render/create-render-app](https://www.npmjs.com/package/@newskit-render/create-render-app) as a template structure to scaffold the newly created projects which the users of @newskit-render/create-render-app can use and modify for their purposes.
6
6
 
@@ -93,14 +93,12 @@ jest.mock('@newskit-render/api', () => ({
93
93
  }),
94
94
  })
95
95
  }),
96
- sessionParser: jest.fn(),
97
96
  getMainSession: jest.fn(),
98
97
  }))
99
98
 
100
99
  jest.mock('@newskit-render/my-account', () => {
101
100
  return {
102
101
  PastDueBannerExternal: 'PastDueBannerExternal',
103
- sessionParser: jest.fn(),
104
102
  getMainSession: jest.fn(),
105
103
  }
106
104
  })
@@ -140,7 +138,7 @@ describe('Article', () => {
140
138
  req: { headers: { cookie: 'some-cookie' } },
141
139
  res: { setHeader: setHeaderMock },
142
140
  })
143
- expect(response).toEqual({ props: { ...props, user: userMock } })
141
+ expect(response).toEqual({ props: { ...props } })
144
142
  expect(setHeaderMock).toHaveBeenCalledWith(
145
143
  'Cache-Control',
146
144
  'public, s-maxage=10, stale-while-revalidate=59'
@@ -881,8 +881,8 @@ exports[`getServerSideProps Homepage 1`] = `
881
881
  position: relative;
882
882
  width: 100%;
883
883
  display: block;
884
- height: auto;
885
884
  padding-top: 0;
885
+ height: auto;
886
886
  width: 100%;
887
887
  border-radius: 0;
888
888
  }
@@ -19,7 +19,6 @@ jest.mock('@newskit-render/api', () => ({
19
19
  }),
20
20
  })
21
21
  }),
22
- sessionParser: jest.fn(),
23
22
  getMainSession: jest.fn(),
24
23
  }))
25
24
 
@@ -37,7 +36,6 @@ jest.mock('cross-fetch', () =>
37
36
  jest.mock('@newskit-render/my-account', () => {
38
37
  return {
39
38
  PastDueBannerExternal: 'PastDueBannerExternal',
40
- sessionParser: jest.fn(),
41
39
  }
42
40
  })
43
41
 
@@ -63,9 +61,6 @@ describe('getServerSideProps', () => {
63
61
  title: 'Test title',
64
62
  },
65
63
  },
66
- user: {
67
- vxInstances: null,
68
- },
69
64
  },
70
65
  })
71
66
  )
@@ -1,7 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render } from 'react-dom'
3
3
  import { act } from 'react-dom/test-utils'
4
- import { renderCustomLightTheme, renderCustomDarkTheme } from '../theme'
4
+ import { sharedTheme } from '@newskit-render/shared-components'
5
+ import { renderCustomDarkTheme } from '../theme'
5
6
  import { AppContextProvider, AppContext } from './AppContext'
6
7
 
7
8
  const container = document.createElement('div')
@@ -30,7 +31,7 @@ describe('AppContext tests', () => {
30
31
  container
31
32
  )
32
33
 
33
- expect(container.textContent).toBe(JSON.stringify(renderCustomLightTheme))
34
+ expect(container.textContent).toBe(JSON.stringify(sharedTheme))
34
35
  })
35
36
 
36
37
  it('setTheme should switch the theme', () => {
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react'
2
2
  import { UncompiledTheme } from 'newskit'
3
- import { renderCustomLightTheme } from '../theme'
3
+ import { sharedTheme } from '@newskit-render/shared-components'
4
4
 
5
5
  type AppContextType = {
6
6
  theme: UncompiledTheme
@@ -8,11 +8,11 @@ type AppContextType = {
8
8
  }
9
9
 
10
10
  const AppContext = React.createContext({
11
- theme: renderCustomLightTheme,
11
+ theme: sharedTheme,
12
12
  } as AppContextType)
13
13
 
14
14
  const AppContextProvider = ({ children }: { children: JSX.Element }) => {
15
- const [theme, setTheme] = useState(renderCustomLightTheme)
15
+ const [theme, setTheme] = useState(sharedTheme)
16
16
 
17
17
  return (
18
18
  <AppContext.Provider value={{ theme, setTheme }}>
@@ -2503,9 +2503,8 @@ exports[`Article should render tile and sub title 1`] = `
2503
2503
  position: relative;
2504
2504
  width: 100%;
2505
2505
  display: block;
2506
- padding-top: 66%;
2507
- height: 0;
2508
2506
  width: 150px;
2507
+ height: 100px;
2509
2508
  border-radius: 0;
2510
2509
  background-color: #F4F4F4;
2511
2510
  }
@@ -95,7 +95,6 @@ const articleData: ArticleProps = {
95
95
  jest.mock('@newskit-render/my-account', () => {
96
96
  return {
97
97
  PastDueBannerExternal: 'PastDueBannerExternal',
98
- sessionParser: jest.fn(),
99
98
  }
100
99
  })
101
100
 
@@ -13,13 +13,13 @@ import {
13
13
  TextBlock,
14
14
  Divider,
15
15
  } from 'newskit'
16
+ import { SEOComponent } from '@newskit-render/shared-components'
16
17
  import MetaBoxComponent from './MetaBox'
17
18
  import Ad from '../ad'
18
19
  import Highlights from './Highlights'
19
20
  import RelatedArticles from './RelatedArticles'
20
21
  import RelatedTopics from './RelatedTopics'
21
22
  import ShareBarComponent from './ShareBarComponent'
22
- import SEOComponent from '../seo'
23
23
  import {
24
24
  URL,
25
25
  Slug,
@@ -21,7 +21,7 @@ import { MainGrid } from '../layout/MainGrid'
21
21
  import NewsKitLogoFull from '../common/NewskitLogo'
22
22
  import NewsKitLogoShort from '../common/NewskitLogoShort'
23
23
  import NavLink from '../common/NavLink'
24
- import { AppContext } from '../../context/AppContext'
24
+ import { AppContext } from '../../app-context/AppContext'
25
25
  import { getKey } from '../../helpers/articleUtil'
26
26
  import { handleEnterKeyPress } from '../../helpers/a11y'
27
27
  import { UserData, VxInstance } from '../../helpers/global-types'
@@ -134,8 +134,8 @@ exports[`Lead 1`] = `
134
134
  position: relative;
135
135
  width: 100%;
136
136
  display: block;
137
- height: auto;
138
137
  padding-top: 0;
138
+ height: auto;
139
139
  width: 100%;
140
140
  border-radius: 0;
141
141
  }
@@ -169,3 +169,179 @@ resource "newrelic_one_dashboard" "frontend_dashboard" {
169
169
  }
170
170
  }
171
171
  }
172
+
173
+ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
174
+ name = "${data.newrelic_entity.render_app.name} Lighthouse Dashboard"
175
+
176
+ page {
177
+ name = "${data.newrelic_entity.render_app.name} Lighthouse Metrics Dashboard"
178
+
179
+ widget_billboard {
180
+ title = "Lighthouse Metrics"
181
+ row = 1
182
+ column = 1
183
+ height = 3
184
+ width = 4
185
+
186
+ nrql_query {
187
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) as 'FCP', average(custom.largestContentfulPaint) as 'LCP', average(custom.interactive) as 'TTI', average(custom.totalBlockingTime) as 'TBT', average(custom.cumulativeLayoutShift) as 'CLS', average(custom.speedIndex) as 'Speed Index'"
188
+ }
189
+ }
190
+
191
+ widget_line {
192
+ title = "Lighthouse Metrics-trending"
193
+ row = 1
194
+ column = 5
195
+ height = 3
196
+ width = 8
197
+
198
+ nrql_query {
199
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) as 'FCP', average(custom.largestContentfulPaint) as 'LCP', average(custom.interactive) as 'TTI', average(custom.totalBlockingTime) as 'TBT', average(custom.cumulativeLayoutShift) as 'CLS', average(custom.speedIndex) as 'Speed Index' TIMESERIES AUTO"
200
+ }
201
+ }
202
+
203
+ widget_bar {
204
+ title = "First Contentful Paint"
205
+ row = 4
206
+ column = 1
207
+ height = 3
208
+ width = 4
209
+
210
+ nrql_query {
211
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) FACET custom.url"
212
+ }
213
+ }
214
+
215
+ widget_line {
216
+ title = "First Contentful Paint"
217
+ row = 4
218
+ column = 5
219
+ height = 3
220
+ width = 8
221
+
222
+ nrql_query {
223
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) FACET custom.url TIMESERIES AUTO"
224
+ }
225
+ }
226
+
227
+ widget_bar {
228
+ title = "Largest Contentful Paint"
229
+ row = 7
230
+ column = 1
231
+ height = 3
232
+ width = 4
233
+
234
+ nrql_query {
235
+ query = "FROM SyntheticCheck SELECT average(custom.largestContentfulPaint) FACET custom.url"
236
+ }
237
+ }
238
+
239
+ widget_line {
240
+ title = "Largest Contentful Paint"
241
+ row = 7
242
+ column = 5
243
+ height = 3
244
+ width = 8
245
+
246
+ nrql_query {
247
+ query = "FROM SyntheticCheck SELECT average(custom.largestContentfulPaint) FACET custom.url TIMESERIES AUTO"
248
+ }
249
+ }
250
+
251
+ widget_bar {
252
+ title = "TTI"
253
+ row = 10
254
+ column = 1
255
+ height = 3
256
+ width = 4
257
+
258
+ nrql_query {
259
+ query = "FROM SyntheticCheck SELECT average(custom.interactive) as 'TTI' FACET custom.url"
260
+ }
261
+ }
262
+
263
+ widget_line {
264
+ title = "TTI - trending"
265
+ row = 10
266
+ column = 5
267
+ height = 3
268
+ width = 8
269
+
270
+ nrql_query {
271
+ query = "FROM SyntheticCheck SELECT average(custom.interactive) FACET custom.url TIMESERIES AUTO"
272
+ }
273
+ }
274
+
275
+ widget_bar {
276
+ title = "Total Blocking Time (TBT)"
277
+ row = 13
278
+ column = 1
279
+ height = 3
280
+ width = 4
281
+
282
+ nrql_query {
283
+ query = "FROM SyntheticCheck SELECT average(custom.totalBlockingTime) FACET custom.url"
284
+ }
285
+ }
286
+
287
+ widget_line {
288
+ title = "Total Blocking Time (TBT) - trending"
289
+ row = 13
290
+ column = 5
291
+ height = 3
292
+ width = 8
293
+
294
+ nrql_query {
295
+ query = "FROM SyntheticCheck SELECT average(custom.totalBlockingTime) FACET custom.url TIMESERIES AUTO"
296
+ }
297
+ }
298
+
299
+ widget_bar {
300
+ title = "Cumulative Layout Shift (CLS)"
301
+ row = 16
302
+ column = 1
303
+ height = 3
304
+ width = 4
305
+
306
+ nrql_query {
307
+ query = "FROM SyntheticCheck SELECT average(custom.cumulativeLayoutShift) FACET custom.url"
308
+ }
309
+ }
310
+
311
+ widget_line {
312
+ title = "Cumulative Layout Shift (CLS)"
313
+ row = 16
314
+ column = 5
315
+ height = 3
316
+ width = 8
317
+
318
+ nrql_query {
319
+ query = "FROM SyntheticCheck SELECT average(custom.cumulativeLayoutShift) FACET custom.url TIMESERIES AUTO"
320
+ }
321
+ }
322
+
323
+ widget_bar {
324
+ title = "Speed Index"
325
+ row = 19
326
+ column = 1
327
+ height = 3
328
+ width = 4
329
+
330
+ nrql_query {
331
+ query = "FROM SyntheticCheck SELECT average(custom.speedIndex) FACET custom.url"
332
+ }
333
+ }
334
+
335
+ widget_line {
336
+ title = "Speed Index - trading"
337
+ row = 19
338
+ column = 5
339
+ height = 3
340
+ width = 8
341
+
342
+ nrql_query {
343
+ query = "FROM SyntheticCheck SELECT average(custom.speedIndex) FACET custom.url TIMESERIES AUTO"
344
+ }
345
+ }
346
+ }
347
+ }
@@ -0,0 +1,46 @@
1
+ /** API SETUP - remove this section to run in New Relic Synthetics **/
2
+ // if ($http == null) { var $http = require('request'); }
3
+ /** API SETUP - remove this section to run in New Relic Synthetics **/
4
+
5
+ var settings = {
6
+ url: 'https://newskit-render.prod.ceng.newsuk.tech/',
7
+ category: 'performance',
8
+ strategy: 'desktop',
9
+ }
10
+
11
+ var options = {
12
+ method: 'GET',
13
+ url: 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed',
14
+ headers: null,
15
+ qs: settings,
16
+ json: true,
17
+ }
18
+
19
+ $http(options, function (error, response, body) {
20
+ if (!error && response.statusCode == 200) {
21
+ if (response.statusCode == 200) {
22
+ var lighthouseMetrics =
23
+ body.lighthouseResult.audits.metrics.details.items[0]
24
+ $util.insights.set('url', settings.url)
25
+ $util.insights.set('deviceType', settings.strategy)
26
+ $util.insights.set(
27
+ 'performanceScore',
28
+ body.lighthouseResult.categories.performance.score
29
+ )
30
+
31
+ for (var attributeName in lighthouseMetrics) {
32
+ if (lighthouseMetrics.hasOwnProperty(attributeName)) {
33
+ if (!attributeName.includes('Ts')) {
34
+ console.log(attributeName + ': ' + lighthouseMetrics[attributeName])
35
+ $util.insights.set(attributeName, lighthouseMetrics[attributeName])
36
+ }
37
+ }
38
+ }
39
+ } else {
40
+ console.log('Non-200 HTTP response: ' + response.statusCode)
41
+ }
42
+ } else {
43
+ console.log('rsp code: ' + response.statusCode)
44
+ console.log(error)
45
+ }
46
+ })
@@ -0,0 +1,46 @@
1
+ /** API SETUP - remove this section to run in New Relic Synthetics **/
2
+ // if ($http == null) { var $http = require('request'); }
3
+ /** API SETUP - remove this section to run in New Relic Synthetics **/
4
+
5
+ var settings = {
6
+ url: 'https://newskit-render.ceng-dev.newsuk.tech/',
7
+ category: 'performance',
8
+ strategy: 'desktop',
9
+ }
10
+
11
+ var options = {
12
+ method: 'GET',
13
+ url: 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed',
14
+ headers: null,
15
+ qs: settings,
16
+ json: true,
17
+ }
18
+
19
+ $http(options, function (error, response, body) {
20
+ if (!error && response.statusCode == 200) {
21
+ if (response.statusCode == 200) {
22
+ var lighthouseMetrics =
23
+ body.lighthouseResult.audits.metrics.details.items[0]
24
+ $util.insights.set('url', settings.url)
25
+ $util.insights.set('deviceType', settings.strategy)
26
+ $util.insights.set(
27
+ 'performanceScore',
28
+ body.lighthouseResult.categories.performance.score
29
+ )
30
+
31
+ for (var attributeName in lighthouseMetrics) {
32
+ if (lighthouseMetrics.hasOwnProperty(attributeName)) {
33
+ if (!attributeName.includes('Ts')) {
34
+ console.log(attributeName + ': ' + lighthouseMetrics[attributeName])
35
+ $util.insights.set(attributeName, lighthouseMetrics[attributeName])
36
+ }
37
+ }
38
+ }
39
+ } else {
40
+ console.log('Non-200 HTTP response: ' + response.statusCode)
41
+ }
42
+ } else {
43
+ console.log('rsp code: ' + response.statusCode)
44
+ console.log(error)
45
+ }
46
+ })
@@ -0,0 +1,12 @@
1
+ resource "newrelic_synthetics_monitor" "lighthouse-monitor" {
2
+ name = "${data.newrelic_entity.render_app.name} Lighthouse Monitor"
3
+ type = "SCRIPT_API"
4
+ frequency = 30
5
+ status = "ENABLED"
6
+ locations = ["AWS_EU_WEST_2"]
7
+ }
8
+
9
+ resource "newrelic_synthetics_monitor_script" "lighthouse-script" {
10
+ monitor_id = newrelic_synthetics_monitor.lighthouse-monitor.id
11
+ text = "${var.environment}" == "prod" ? file("${path.module}/lighthouse-script-prod.js") : file("${path.module}/lighthouse-script.js")
12
+ }
package/next-env.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  /// <reference types="next" />
2
- /// <reference types="next/types/global" />
3
2
  /// <reference types="next/image-types/global" />
4
3
 
5
4
  // NOTE: This file should not be edited