@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
@@ -1,106 +0,0 @@
1
- import React from 'react'
2
- import { render } from '@testing-library/react'
3
- import SEOComponent, { limitString } from './index'
4
-
5
- const getMeta = (metaName: string) => {
6
- const metas = document.getElementsByTagName('meta')
7
- for (let i = 0; i < metas.length; i += 1) {
8
- if (
9
- metas[i].getAttribute('name') === metaName ||
10
- metas[i].getAttribute('property') === metaName
11
- ) {
12
- return metas[i].getAttribute('content')
13
- }
14
- }
15
- return false
16
- }
17
-
18
- const getLink = (linkRel: string, attr: string) => {
19
- const link = document.getElementsByTagName('link')
20
- for (let i = 0; i < link.length; i += 1) {
21
- if (link[i].getAttribute('rel') === linkRel) {
22
- return link[i].getAttribute(attr)
23
- }
24
- }
25
- return false
26
- }
27
-
28
- jest.mock('next/head', () => {
29
- return {
30
- __esModule: true,
31
- default: ({ children }: { children: Array<React.ReactElement> }) => {
32
- return <>{children}</>
33
- },
34
- }
35
- })
36
-
37
- describe('SEOComponent tests', () => {
38
- const Props = {
39
- title: 'test title for SEOComponent',
40
- description:
41
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt blandit orci vel elementum. Integer malesuada quam in ullamcorper condimentum. Integer sollicitudin non enim sed posuere.',
42
- url: 'https://test-url/test',
43
- siteHost: 'https://siteHost.co.uk',
44
- fbType: 'article',
45
- fbImageUrl: 'https://test-uri/image',
46
- }
47
-
48
- test('SEOComponent with mandatory props', () => {
49
- render(<SEOComponent {...Props} />, {
50
- container: document.head,
51
- })
52
- expect(document.title).toBe(Props.title)
53
- expect(getMeta('description')).toBe(limitString(Props.description, 155))
54
- expect(getMeta('robots')).toBe('max-image-preview:large')
55
- expect(getMeta('og:title')).toBe(Props.title)
56
- expect(getMeta('og:type')).toBe(Props.fbType)
57
- expect(getMeta('og:url')).toBe(Props.url)
58
- expect(getMeta('twitter:card')).toBe('summary')
59
- expect(getMeta('twitter:title')).toBe(Props.title)
60
- expect(getMeta('twitter:site')).toBe(false)
61
- expect(getMeta('twitter:description')).toBe(false)
62
- expect(getMeta('twitter:image')).toBe(false)
63
- expect(getMeta('twitter:image:alt')).toBe(false)
64
- expect(getLink('canonical', 'href')).toBe(Props.url)
65
- expect(getLink('alternate', 'href')).toBe(Props.siteHost)
66
- expect(getLink('alternate', 'hreflang')).toBe('en')
67
- })
68
-
69
- test('SEOComponent with optional props', () => {
70
- const extraProps = {
71
- ...Props,
72
- gscId: 'asfdrtsdvs',
73
- fbTitle: 'test facebook title',
74
- twUsername: '@username',
75
- twTitle: 'test twitter title',
76
- twDescription:
77
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt blandit orci vel elementum. Integer malesuada quam in ullamcorper condimentum.',
78
- twImageUrl: 'https://test-uri/image-twitter',
79
- twImageAlt: 'test alt',
80
- hrefLang: 'en-GB',
81
- maxImagePreview: 'standard' as 'none' | 'standard' | 'large',
82
- }
83
- render(<SEOComponent {...extraProps} />, {
84
- container: document.head,
85
- })
86
- expect(document.title).toBe(extraProps.title)
87
- expect(getMeta('description')).toBe(
88
- limitString(extraProps.description, 155)
89
- )
90
- expect(getMeta('robots')).toBe(
91
- `max-image-preview:${extraProps.maxImagePreview}`
92
- )
93
- expect(getMeta('og:title')).toBe(extraProps.fbTitle)
94
- expect(getMeta('og:type')).toBe(extraProps.fbType)
95
- expect(getMeta('og:url')).toBe(extraProps.url)
96
- expect(getMeta('twitter:card')).toBe('summary')
97
- expect(getMeta('twitter:title')).toBe(extraProps.twTitle)
98
- expect(getMeta('twitter:site')).toBe(extraProps.twUsername)
99
- expect(getMeta('twitter:description')).toBe(extraProps.twDescription)
100
- expect(getMeta('twitter:image')).toBe(extraProps.twImageUrl)
101
- expect(getMeta('twitter:image:alt')).toBe(extraProps.twImageAlt)
102
- expect(getLink('canonical', 'href')).toBe(extraProps.url)
103
- expect(getLink('alternate', 'href')).toBe(extraProps.siteHost)
104
- expect(getLink('alternate', 'hreflang')).toBe(extraProps.hrefLang)
105
- })
106
- })
@@ -1,89 +0,0 @@
1
- import React from 'react'
2
- import Head from 'next/head'
3
- import striptags from 'striptags'
4
-
5
- export const limitString = (text: string, limit: number) =>
6
- text.length > limit ? text.substr(0, limit) : text
7
-
8
- type Props = {
9
- title: string
10
- description: string
11
- url: string
12
- siteHost: string
13
- hrefLang?: string
14
- maxImagePreview?: 'none' | 'standard' | 'large'
15
- gscId?: string
16
- fbTitle?: string
17
- fbType: string
18
- fbImageUrl: string
19
- twUsername?: string
20
- twTitle?: string
21
- twDescription?: string
22
- twImageUrl?: string
23
- twImageAlt?: string
24
- }
25
-
26
- const SEOComponent: React.FC<Props> = ({
27
- title,
28
- description,
29
- url,
30
- siteHost,
31
- hrefLang = 'en',
32
- maxImagePreview = 'large',
33
- gscId,
34
- fbTitle,
35
- fbType,
36
- fbImageUrl,
37
- twUsername,
38
- twTitle,
39
- twDescription,
40
- twImageUrl,
41
- twImageAlt,
42
- }) => (
43
- <Head>
44
- <title>{title}</title>
45
- <meta
46
- name="description"
47
- content={limitString(striptags(description), 155)}
48
- key="description"
49
- />
50
- <link rel="canonical" href={url} />
51
- <link rel="alternate" href={siteHost} hrefLang={hrefLang} />
52
- <meta
53
- name="robots"
54
- content={`max-image-preview:${maxImagePreview}`}
55
- key="max-image-preview"
56
- />
57
- {gscId && <meta name="google-site-verification" content={gscId} />}
58
-
59
- <meta property="og:title" content={fbTitle || title} key="ogtitle" />
60
- <meta property="og:type" content={fbType} key="ogtype" />
61
- <meta property="og:url" content={url} key="ogurl" />
62
- <meta property="og:image" content={fbImageUrl} key="ogimage" />
63
-
64
- <meta name="twitter:card" content="summary" key="twcard" />
65
- <meta
66
- name="twitter:title"
67
- content={limitString(twTitle || title, 70)}
68
- key="twtitle"
69
- />
70
- {twUsername && (
71
- <meta name="twitter:site" content={twUsername} key="twsite" />
72
- )}
73
- {twDescription && (
74
- <meta
75
- name="twitter:description"
76
- content={limitString(striptags(twDescription), 200)}
77
- key="twdescription"
78
- />
79
- )}
80
- {twImageUrl && (
81
- <meta name="twitter:image" content={twImageUrl} key="twImage" />
82
- )}
83
- {twImageAlt && (
84
- <meta name="twitter:image:alt" content={twImageAlt} key="twImageAlt" />
85
- )}
86
- </Head>
87
- )
88
-
89
- export default SEOComponent
@@ -1,7 +0,0 @@
1
- import { CheckoutPage, getProviderProps } from '@newskit-render/checkout'
2
-
3
- export default CheckoutPage
4
-
5
- export const getServerSideProps = async (context) => {
6
- return getProviderProps(context)
7
- }