@newskit-render/core 3.1.1-alpha.0 → 3.1.1-alpha.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newskit-render/core",
3
- "version": "3.1.1-alpha.0",
3
+ "version": "3.1.1-alpha.2",
4
4
  "description": "Newskit Render - Core package",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
@@ -41,12 +41,12 @@
41
41
  "@emotion/styled": "11.9.3",
42
42
  "@newskit-render/api": "^1.6.7",
43
43
  "@newskit-render/auth": "^1.3.11",
44
- "@newskit-render/checkout": "^2.5.6-alpha.0",
44
+ "@newskit-render/checkout": "^2.5.6-alpha.1",
45
45
  "@newskit-render/feature-flags": "^1.4.11",
46
46
  "@newskit-render/feed": "^1.4.17",
47
- "@newskit-render/my-account": "^5.0.2-alpha.0",
47
+ "@newskit-render/my-account": "^5.0.2-alpha.1",
48
48
  "@newskit-render/shared-components": "^2.6.3-alpha.0",
49
- "@newskit-render/standalone-components": "^2.6.3-alpha.0",
49
+ "@newskit-render/standalone-components": "^2.6.3-alpha.1",
50
50
  "@newskit-render/validation": "^1.6.0",
51
51
  "@next/font": "13.1.6",
52
52
  "cross-fetch": "3.1.5",
package/pages/_error.tsx CHANGED
@@ -3,9 +3,11 @@ import { NotFound, GenericError } from '@newskit-render/my-account'
3
3
  import Error from 'next/error'
4
4
  import { getCircularReplacer } from '../helpers/getCircularReplacer'
5
5
  import ErrorPage from '../components/ErrorPage/ErrorPage'
6
+ import ErrorPageHelpHub from '../pages/help-hub/error'
6
7
 
7
8
  function CustomError({ statusCode, asPath }) {
8
9
  const isMyAccountApplication = asPath.startsWith('/account')
10
+ const isHelpHubApplication = asPath.startsWith('/help-hub')
9
11
 
10
12
  if (isMyAccountApplication) {
11
13
  if (statusCode === 404) {
@@ -13,16 +15,36 @@ function CustomError({ statusCode, asPath }) {
13
15
  }
14
16
  return <GenericError />
15
17
  }
18
+ if (isHelpHubApplication) {
19
+ if (statusCode === 500 || statusCode === 502) {
20
+ return (
21
+ <ErrorPageHelpHub
22
+ credentials={{
23
+ appId: '',
24
+ apiKey: '',
25
+ indexName: '',
26
+ }}
27
+ />
28
+ )
29
+ }
30
+ return (
31
+ <ErrorPage
32
+ title="Server-side error occurred"
33
+ errorMassage="We could not fetch the data from the server"
34
+ />
35
+ )
36
+ }
16
37
  if (statusCode === 404) {
17
38
  return (
18
39
  <ErrorPage
19
40
  title="Page not found"
20
41
  errorMassage={`
21
- We can't seem to find what you're looking for. If you typed a URL
22
- into your browser, it might be worth checking and trying again.`}
42
+ We can't seem to find what you're looking for. If you typed a URL
43
+ into your browser, it might be worth checking and trying again.`}
23
44
  />
24
45
  )
25
46
  }
47
+
26
48
  if (statusCode === 500 || statusCode === 502) {
27
49
  return (
28
50
  <ErrorPage
@@ -0,0 +1,25 @@
1
+ import React from 'react'
2
+ import newrelic from 'newrelic'
3
+ import {
4
+ HelpHubErrorPage,
5
+ helpHubErrorPageProvider,
6
+ AlgoliaCredentials,
7
+ } from '@newskit-render/standalone-components'
8
+ import { addCacheHeaders } from '../../helpers/addCacheHeaders'
9
+
10
+ const ErrorPageHelpHub: React.FC<{
11
+ credentials: AlgoliaCredentials
12
+ }> = (props) => {
13
+ return <HelpHubErrorPage {...props} />
14
+ }
15
+
16
+ export const getServerSideProps = async (context) => {
17
+ newrelic.setTransactionName('HelpHubArticlePage')
18
+ console.warn('context:')
19
+ console.warn(context.req && context.req.headers)
20
+
21
+ addCacheHeaders(context.res)
22
+ return helpHubErrorPageProvider()
23
+ }
24
+
25
+ export default ErrorPageHelpHub