@newskit-render/core 1.6.0 → 1.9.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,55 @@
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.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)
7
+
8
+
9
+ ### Features
10
+
11
+ * **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))
12
+
13
+
14
+
15
+
16
+
17
+ # [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)
18
+
19
+
20
+ ### Features
21
+
22
+ * **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))
23
+
24
+
25
+
26
+
27
+
28
+ ## [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)
29
+
30
+ **Note:** Version bump only for package @newskit-render/core
31
+
32
+
33
+
34
+
35
+
36
+ # [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)
37
+
38
+
39
+ ### Features
40
+
41
+ * **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))
42
+
43
+
44
+
45
+
46
+
47
+ ## [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)
48
+
49
+ **Note:** Version bump only for package @newskit-render/core
50
+
51
+
52
+
53
+
54
+
6
55
  # [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)
7
56
 
8
57
 
@@ -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
  )
@@ -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
 
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newskit-render/core",
3
- "version": "1.6.0",
3
+ "version": "1.9.0",
4
4
  "description": "Newskit Render - Core package",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
@@ -28,17 +28,17 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@apollo/client": "^3.4.16",
31
- "@newskit-render/api": "^0.4.2",
31
+ "@newskit-render/api": "^0.5.0",
32
32
  "@newskit-render/auth": "^0.22.2",
33
- "@newskit-render/checkout": "^0.7.0",
34
- "@newskit-render/my-account": "^0.114.2",
35
- "@newskit-render/shared-components": "^0.18.0",
33
+ "@newskit-render/checkout": "^0.9.0",
34
+ "@newskit-render/my-account": "^0.116.1",
35
+ "@newskit-render/shared-components": "^0.20.0",
36
36
  "@newskit-render/sitemap": "^0.25.2",
37
- "@newskit-render/validation": "^0.26.2",
37
+ "@newskit-render/validation": "^0.27.0",
38
38
  "cross-fetch": "^3.1.4",
39
39
  "graphql": "^15.6.0",
40
40
  "newrelic": "^7.1.0",
41
- "newskit": "4.0.1",
41
+ "newskit": "4.3.1",
42
42
  "next": "^12.0.2",
43
43
  "react": "^17.0.1",
44
44
  "react-dom": "^17.0.2",
@@ -1,17 +1,12 @@
1
1
  import React from 'react'
2
2
  import newrelic from 'newrelic'
3
- import {
4
- createApolloClient,
5
- sessionParser,
6
- getMainSession,
7
- ClientTypes,
8
- } from '@newskit-render/api'
3
+ import { createApolloClient, ClientTypes } from '@newskit-render/api'
9
4
  import { GET_UNIVERSAL_ARTICLE } from '../../../queries'
10
5
  import ArticlePage, { UniversalArticle } from '../../../components/article'
11
6
  import { highlights, relatedArticles } from '../../../helpers/mocks/articleMock'
12
7
  import { UserData } from '../../../helpers/global-types'
13
- import { fetchUser } from '../../../helpers/getUser'
14
- import { ACCOUNT_QUERY_URL } from '../../../constants'
8
+ // import { fetchUser } from '../../../helpers/getUser'
9
+ // import { ACCOUNT_QUERY_URL } from '../../../constants'
15
10
  import { addCacheHeaders } from '../../../helpers/addCacheHeaders'
16
11
 
17
12
  export type ArticleSlug = {
@@ -46,8 +41,7 @@ const Article: React.FC<ArticleSlug> = ({
46
41
 
47
42
  export async function getServerSideProps(context) {
48
43
  const apolloClient = await createApolloClient(ClientTypes.nkapi)
49
- const mainSession = getMainSession(context.req.headers.cookie)
50
- const session = sessionParser(mainSession)
44
+ // const mainSession = getMainSession(context.req.headers.cookie)
51
45
 
52
46
  const {
53
47
  params: { articleId, section, articleSlug },
@@ -57,12 +51,15 @@ export async function getServerSideProps(context) {
57
51
  `Article: /${section}/${articleId}/${articleSlug}`
58
52
  )
59
53
 
60
- const [{ data }, user] = await Promise.all([
54
+ const [
55
+ { data },
56
+ // user
57
+ ] = await Promise.all([
61
58
  apolloClient.query({
62
59
  query: GET_UNIVERSAL_ARTICLE,
63
60
  variables: { publisher: 'DEMO', id: articleId },
64
61
  }),
65
- await fetchUser(session, ACCOUNT_QUERY_URL),
62
+ // await fetchUser(mainSession, ACCOUNT_QUERY_URL),
66
63
  ])
67
64
 
68
65
  addCacheHeaders(context.res)
@@ -73,7 +70,7 @@ export async function getServerSideProps(context) {
73
70
  twitterUsername: process.env.TWITTER_USERNAME || '',
74
71
  siteHost: process.env.SITE_HOST || '',
75
72
  gscId: process.env.GSC_ID || '',
76
- user,
73
+ // user,
77
74
  },
78
75
  }
79
76
  }
@@ -1,14 +1,13 @@
1
1
  import newrelic from 'newrelic'
2
2
  import {
3
3
  createApolloClient,
4
- sessionParser,
5
- getMainSession,
4
+ // getMainSession,
6
5
  ClientTypes,
7
6
  } from '@newskit-render/api'
8
7
  import { GET_PAGE } from '../../queries'
9
8
  import SectionPage from '../../components/section'
10
- import { fetchUser } from '../../helpers/getUser'
11
- import { ACCOUNT_QUERY_URL } from '../../constants'
9
+ // import { fetchUser } from '../../helpers/getUser'
10
+ // import { ACCOUNT_QUERY_URL } from '../../constants'
12
11
  import { addCacheHeaders } from '../../helpers/addCacheHeaders'
13
12
 
14
13
  export async function getServerSideProps(context) {
@@ -18,16 +17,20 @@ export async function getServerSideProps(context) {
18
17
  params: { section },
19
18
  } = context
20
19
 
21
- const mainSession = getMainSession(context.req.headers.cookie)
22
- const session = sessionParser(mainSession)
20
+ // const mainSession = getMainSession(context.req.headers.cookie)
23
21
 
24
22
  newrelic.setTransactionName(`Section: ${section}`)
25
- const [{ data }, user] = await Promise.all([
23
+ const [
24
+ { data },
25
+ // user
26
+ ] = await Promise.all([
26
27
  apolloClient.query({
27
28
  query: GET_PAGE,
28
29
  variables: { channel: section, publisher: 'DEMO' },
29
30
  }),
30
- await fetchUser(session, ACCOUNT_QUERY_URL),
31
+
32
+ // TODO: Enable once Main add Subscriptions
33
+ // await fetchUser(mainSession, ACCOUNT_QUERY_URL),
31
34
  ])
32
35
 
33
36
  addCacheHeaders(context.res)
@@ -35,7 +38,7 @@ export async function getServerSideProps(context) {
35
38
  props: {
36
39
  page: data.page,
37
40
  isIndexPage: true,
38
- user,
41
+ // user,
39
42
  },
40
43
  }
41
44
  }
@@ -0,0 +1,7 @@
1
+ import { AccountCreation, getProviderProps } from '@newskit-render/checkout'
2
+
3
+ export default AccountCreation
4
+
5
+ export const getServerSideProps = async (context) => {
6
+ return getProviderProps({ ...context, provider: 'accountCreation' })
7
+ }
@@ -0,0 +1,7 @@
1
+ import { PaymentDetails, getProviderProps } from '@newskit-render/checkout'
2
+
3
+ export default PaymentDetails
4
+
5
+ export const getServerSideProps = async (context) => {
6
+ return getProviderProps({ ...context, provider: 'paymentDetails' })
7
+ }
package/pages/index.tsx CHANGED
@@ -1,14 +1,13 @@
1
1
  import newrelic from 'newrelic'
2
2
  import {
3
3
  createApolloClient,
4
- sessionParser,
5
- getMainSession,
4
+ // getMainSession,
6
5
  ClientTypes,
7
6
  } from '@newskit-render/api'
8
7
  import { GET_PAGE } from '../queries'
9
8
  import SectionPage from '../components/section'
10
- import { fetchUser } from '../helpers/getUser'
11
- import { ACCOUNT_QUERY_URL } from '../constants'
9
+ // import { fetchUser } from '../helpers/getUser'
10
+ // import { ACCOUNT_QUERY_URL } from '../constants'
12
11
  import { addCacheHeaders } from '../helpers/addCacheHeaders'
13
12
 
14
13
  export async function getServerSideProps(context) {
@@ -17,15 +16,18 @@ export async function getServerSideProps(context) {
17
16
  console.warn(context.req && context.req.headers)
18
17
 
19
18
  const apolloClient = await createApolloClient(ClientTypes.nkapi)
20
- const mainSession = getMainSession(context.req.headers.cookie)
21
- const session = sessionParser(mainSession)
19
+ // const mainSession = getMainSession(context.req.headers.cookie)
22
20
 
23
- const [{ data }, user] = await Promise.all([
21
+ const [
22
+ { data },
23
+ // user
24
+ ] = await Promise.all([
24
25
  apolloClient.query({
25
26
  query: GET_PAGE,
26
27
  variables: { channel: 'homepage', publisher: 'DEMO' },
27
28
  }),
28
- await fetchUser(session, ACCOUNT_QUERY_URL),
29
+ // TODO: Enable once Main add Subscriptions
30
+ // await fetchUser(mainSession, ACCOUNT_QUERY_URL),
29
31
  ])
30
32
 
31
33
  addCacheHeaders(context.res)
@@ -33,7 +35,7 @@ export async function getServerSideProps(context) {
33
35
  return {
34
36
  props: {
35
37
  page,
36
- user,
38
+ // user: (user || null),
37
39
  },
38
40
  }
39
41
  }
@@ -4,19 +4,6 @@ export const GET_USER_SUBSCRIPTION = gql`
4
4
  query UserSubscription {
5
5
  user {
6
6
  email
7
- vxInstances {
8
- isActive
9
- expiryDate
10
- interactions {
11
- ... on SubscriptionPaymentInstance {
12
- startAt
13
- pastDue {
14
- isPastDue
15
- since
16
- }
17
- }
18
- }
19
- }
20
7
  }
21
8
  }
22
9
  `
@@ -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
- }