@newskit-render/core 0.0.0-b7fba40c6 → 0.0.0-caeaa514b
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/cypress/e2e/account/subscription-and-billing.cy.js +2 -1
- package/package.json +1 -1
- package/pages/account/add/[field].tsx +57 -5
- package/pages/account/edit/[field].tsx +3 -2
- package/pages/account/family/index.tsx +2 -2
- package/pages/account/holiday-stop/index.tsx +6 -2
- package/pages/account/holiday-stop/previous-holiday-stops.tsx +6 -2
- package/pages/account/holiday-stop/upcoming-holiday-stops.tsx +6 -2
- package/pages/account/index.tsx +6 -2
- package/pages/account/newsletters/index.tsx +2 -2
- package/pages/account/newsletters-and-alerts/index.tsx +3 -2
- package/pages/account/payment/[paymentMethod].tsx +3 -2
- package/pages/account/payment-methods/index.tsx +6 -2
- package/pages/account/subscription-and-billing/index.tsx +3 -2
|
@@ -307,7 +307,8 @@ describe('Subscription and billing details for Paypal user', () => {
|
|
|
307
307
|
cy.get('a[href="/account/payment"]').should('be.visible').click()
|
|
308
308
|
cy.contains(
|
|
309
309
|
'[data-testid="Zuora-inline"]',
|
|
310
|
-
'To update your Paypal credentials, please speak to one of our advisors on xxxx-xxx-xxxx or add a new payment method via credit/debit card using the form below.'
|
|
310
|
+
'To update your Paypal credentials, please speak to one of our advisors on xxxx-xxx-xxxx or add a new payment method via credit/debit card using the form below.',
|
|
311
|
+
{ timeout: 15000 }
|
|
311
312
|
)
|
|
312
313
|
})
|
|
313
314
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
AddField,
|
|
5
|
+
addComponentMap,
|
|
6
|
+
getProviderPropsTimes,
|
|
7
|
+
// getProviderProps,
|
|
8
|
+
} from '@newskit-render/my-account'
|
|
4
9
|
import validation from '../../../validation'
|
|
5
10
|
import { DynamicPage } from '@newskit-render/my-account'
|
|
6
11
|
|
|
@@ -15,20 +20,67 @@ const AccountAddField = (props) => (
|
|
|
15
20
|
)
|
|
16
21
|
|
|
17
22
|
export default AccountAddField
|
|
23
|
+
// export const getServerSideProps = async (context) => {
|
|
24
|
+
// const {
|
|
25
|
+
// params: { field },
|
|
26
|
+
// } = context
|
|
27
|
+
// const doesAddpageExist = Object.keys(addComponentMap).includes(field)
|
|
28
|
+
// replaceConsoleAndSetTransactionName(`Account: add ${field}`)
|
|
29
|
+
|
|
30
|
+
// if (!doesAddpageExist) {
|
|
31
|
+
// context.res.statusCode = 404
|
|
32
|
+
// // Logging the error for being captured by New Relic
|
|
33
|
+
// console.error(`An error ${context.res.statusCode} occurred on server`)
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
// return {
|
|
37
|
+
// props: { data: { type: field } },
|
|
38
|
+
// }
|
|
39
|
+
// }
|
|
40
|
+
|
|
18
41
|
export const getServerSideProps = async (context) => {
|
|
42
|
+
// const featureFlags = await getAllFeatureFlags(
|
|
43
|
+
// getUserAttributes(context?.req?.headers)
|
|
44
|
+
// )
|
|
45
|
+
|
|
19
46
|
const {
|
|
20
47
|
params: { field },
|
|
21
48
|
} = context
|
|
22
|
-
const
|
|
49
|
+
const doesAddPageExist = Object.keys(addComponentMap).includes(field)
|
|
50
|
+
|
|
23
51
|
replaceConsoleAndSetTransactionName(`Account: add ${field}`)
|
|
24
52
|
|
|
25
|
-
|
|
53
|
+
const defaultPageResponse = {
|
|
54
|
+
props: { data: { type: field }, requestHeaders: context.req.headers },
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const getProviderPropsResponse = (await getProviderPropsTimes({
|
|
58
|
+
...context,
|
|
59
|
+
provider: 'AddField',
|
|
60
|
+
})) as unknown as { props: unknown }
|
|
61
|
+
console.log('getProviderPropsResponse', getProviderPropsResponse)
|
|
62
|
+
|
|
63
|
+
if (!doesAddPageExist) {
|
|
26
64
|
context.res.statusCode = 404
|
|
27
65
|
// Logging the error for being captured by New Relic
|
|
28
66
|
console.error(`An error ${context.res.statusCode} occurred on server`)
|
|
67
|
+
|
|
68
|
+
// The 404 logic for non-existent [add] components is added in the DynamicPage
|
|
69
|
+
return defaultPageResponse
|
|
29
70
|
}
|
|
30
71
|
|
|
31
|
-
|
|
32
|
-
|
|
72
|
+
const { isUserFamilyAccountPrimary } =
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
getProviderPropsResponse.props.user
|
|
75
|
+
|
|
76
|
+
if (field === 'family' && !isUserFamilyAccountPrimary) {
|
|
77
|
+
return {
|
|
78
|
+
redirect: {
|
|
79
|
+
permanent: false,
|
|
80
|
+
destination: '/404',
|
|
81
|
+
},
|
|
82
|
+
}
|
|
33
83
|
}
|
|
84
|
+
|
|
85
|
+
return defaultPageResponse
|
|
34
86
|
}
|
|
@@ -2,7 +2,8 @@ import React from 'react'
|
|
|
2
2
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
3
3
|
import {
|
|
4
4
|
EditField,
|
|
5
|
-
getProviderProps,
|
|
5
|
+
// getProviderProps,
|
|
6
|
+
getProviderPropsTimes,
|
|
6
7
|
editComponentMap,
|
|
7
8
|
DynamicPage,
|
|
8
9
|
} from '@newskit-render/my-account'
|
|
@@ -38,7 +39,7 @@ export const getServerSideProps = async (context) => {
|
|
|
38
39
|
const featureFlags = await getAllFeatureFlags()
|
|
39
40
|
/* end cra-effected */
|
|
40
41
|
|
|
41
|
-
return
|
|
42
|
+
return getProviderPropsTimes(
|
|
42
43
|
{ ...context, provider: 'EditField' },
|
|
43
44
|
{ featureFlags } /* cra-effected */
|
|
44
45
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Family,
|
|
2
|
+
import { Family, getProviderPropsTimes } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
4
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
5
|
|
|
@@ -12,7 +12,7 @@ export const getServerSideProps = async (context) => {
|
|
|
12
12
|
/* start cra-effected */
|
|
13
13
|
const featureFlags = await getAllFeatureFlags()
|
|
14
14
|
/* end cra-effected */
|
|
15
|
-
return
|
|
15
|
+
return getProviderPropsTimes(
|
|
16
16
|
{ ...context, provider: 'GroupAccounts' },
|
|
17
17
|
{ featureFlags } /* cra-effected */
|
|
18
18
|
)
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
// getProviderProps,
|
|
4
|
+
getProviderPropsTimes,
|
|
5
|
+
HolidayStop,
|
|
6
|
+
} from '@newskit-render/my-account'
|
|
3
7
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
8
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
9
|
|
|
@@ -12,7 +16,7 @@ export const getServerSideProps = async (context) => {
|
|
|
12
16
|
/* start cra-effected */
|
|
13
17
|
const featureFlags = await getAllFeatureFlags()
|
|
14
18
|
/* end cra-effected */
|
|
15
|
-
return
|
|
19
|
+
return getProviderPropsTimes(
|
|
16
20
|
{ ...context, provider: 'HolidayStop' },
|
|
17
21
|
{ featureFlags } /* cra-effected */
|
|
18
22
|
)
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
// getProviderProps,
|
|
4
|
+
getProviderPropsTimes,
|
|
5
|
+
HolidayStopList,
|
|
6
|
+
} from '@newskit-render/my-account'
|
|
3
7
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
8
|
import { holidayStopListContextOverrides } from '../../../context/app-context/holidayStopListContextOverrides'
|
|
5
9
|
|
|
@@ -15,5 +19,5 @@ export default AccountPreviousHolidayStops
|
|
|
15
19
|
|
|
16
20
|
export const getServerSideProps = async (context) => {
|
|
17
21
|
replaceConsoleAndSetTransactionName('Account: Previous Holiday Stops')
|
|
18
|
-
return
|
|
22
|
+
return getProviderPropsTimes({ ...context, provider: 'HolidayStop' })
|
|
19
23
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
// getProviderProps,
|
|
4
|
+
getProviderPropsTimes,
|
|
5
|
+
HolidayStopList,
|
|
6
|
+
} from '@newskit-render/my-account'
|
|
3
7
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
8
|
import { holidayStopListContextOverrides } from '../../../context/app-context/holidayStopListContextOverrides'
|
|
5
9
|
|
|
@@ -15,5 +19,5 @@ export default AccountUpcomingHolidayStops
|
|
|
15
19
|
|
|
16
20
|
export const getServerSideProps = async (context) => {
|
|
17
21
|
replaceConsoleAndSetTransactionName('Account: Upcoming Holiday Stops')
|
|
18
|
-
return
|
|
22
|
+
return getProviderPropsTimes({ ...context, provider: 'HolidayStop' })
|
|
19
23
|
}
|
package/pages/account/index.tsx
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
PersonalDetails,
|
|
4
|
+
getProviderPropsTimes,
|
|
5
|
+
// getProviderProps,
|
|
6
|
+
} from '@newskit-render/my-account'
|
|
3
7
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
4
8
|
import { AccountDropdown } from '../../components/AccountDropdown' /* cra-disabled */
|
|
5
9
|
import { replaceConsoleAndSetTransactionName } from '../../helpers/logger'
|
|
@@ -24,7 +28,7 @@ export const getServerSideProps = async (context) => {
|
|
|
24
28
|
|
|
25
29
|
const featureFlags = await getAllFeatureFlags()
|
|
26
30
|
|
|
27
|
-
return
|
|
31
|
+
return getProviderPropsTimes(
|
|
28
32
|
{ ...context, provider: 'PersonalDetails' },
|
|
29
33
|
{ featureFlags } /* cra-effected */
|
|
30
34
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Newsletters,
|
|
2
|
+
import { Newsletters, getProviderPropsTimes } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
4
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
5
|
|
|
@@ -12,7 +12,7 @@ export const getServerSideProps = async (context) => {
|
|
|
12
12
|
/* start cra-effected */
|
|
13
13
|
const featureFlags = await getAllFeatureFlags()
|
|
14
14
|
/* end cra-effected */
|
|
15
|
-
return
|
|
15
|
+
return getProviderPropsTimes(
|
|
16
16
|
{ ...context, provider: 'Newsletters' },
|
|
17
17
|
{ featureFlags } /* cra-effected */
|
|
18
18
|
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import {
|
|
3
3
|
NewslettersAndAlerts,
|
|
4
|
-
|
|
4
|
+
getProviderPropsTimes,
|
|
5
|
+
// getProviderProps
|
|
5
6
|
} from '@newskit-render/my-account'
|
|
6
7
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
7
8
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
@@ -17,7 +18,7 @@ export const getServerSideProps = async (context) => {
|
|
|
17
18
|
/* start cra-effected */
|
|
18
19
|
const featureFlags = await getAllFeatureFlags()
|
|
19
20
|
/* end cra-effected */
|
|
20
|
-
return
|
|
21
|
+
return getProviderPropsTimes(
|
|
21
22
|
{ ...context, provider: 'NewslettersAndAlerts' },
|
|
22
23
|
{ featureFlags } /* cra-effected */
|
|
23
24
|
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
3
3
|
import {
|
|
4
|
-
getProviderProps,
|
|
4
|
+
// getProviderProps,
|
|
5
|
+
getProviderPropsTimes,
|
|
5
6
|
Payment,
|
|
6
7
|
paymentMethodsMap,
|
|
7
8
|
DynamicPage,
|
|
@@ -27,7 +28,7 @@ export const getServerSideProps = async (context) => {
|
|
|
27
28
|
const featureFlags = await getAllFeatureFlags()
|
|
28
29
|
/* end cra-effected */
|
|
29
30
|
|
|
30
|
-
return
|
|
31
|
+
return getProviderPropsTimes(
|
|
31
32
|
{
|
|
32
33
|
...context,
|
|
33
34
|
provider: 'Payment',
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
// getProviderProps,
|
|
4
|
+
getProviderPropsTimes,
|
|
5
|
+
PaymentMethods,
|
|
6
|
+
} from '@newskit-render/my-account'
|
|
3
7
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' // create-render-app effected
|
|
4
8
|
import { paymentMethodContext } from '../../../context/app-context/paymentMethodContext'
|
|
5
9
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
@@ -14,7 +18,7 @@ export const getServerSideProps = async (context) => {
|
|
|
14
18
|
replaceConsoleAndSetTransactionName('Account: Payment Methods')
|
|
15
19
|
const featureFlags = await getAllFeatureFlags()
|
|
16
20
|
// create-render-app effected
|
|
17
|
-
return
|
|
21
|
+
return getProviderPropsTimes(
|
|
18
22
|
{ ...context, provider: 'PaymentMethods' },
|
|
19
23
|
{ featureFlags } // create-render-app effected
|
|
20
24
|
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import {
|
|
3
3
|
SubscriptionAndBilling,
|
|
4
|
-
|
|
4
|
+
getProviderPropsTimes,
|
|
5
|
+
// getProviderProps,
|
|
5
6
|
} from '@newskit-render/my-account'
|
|
6
7
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
7
8
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
@@ -17,7 +18,7 @@ export const getServerSideProps = async (context) => {
|
|
|
17
18
|
/* start cra-effected */
|
|
18
19
|
const featureFlags = await getAllFeatureFlags()
|
|
19
20
|
/* end cra-effected */
|
|
20
|
-
const result = await
|
|
21
|
+
const result = await getProviderPropsTimes(
|
|
21
22
|
{
|
|
22
23
|
...context,
|
|
23
24
|
provider: 'SubscriptionAndBilling',
|