@newskit-render/core 0.0.0-e5471e20 → 0.0.0-e7417826d
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 +664 -0
- package/Dockerfile.withNewRelic +1 -2
- package/__tests__/pages/__snapshots__/home.test.tsx.snap +0 -3
- package/components/article/__tests__/__snapshots__/index.test.tsx.snap +0 -3
- package/cypress/e2e/account/newsletters-page.cy.js +29 -9
- package/cypress/e2e/account/personal-details.cy.js +16 -2
- package/cypress/e2e/account/subscription-and-billing.cy.js +12 -40
- package/cypress/support/commands.js +1 -1
- package/cypress/support/users.js +13 -9
- package/helpers/getProviderPropsUtil.ts +17 -0
- package/next.config.js +55 -57
- package/package.json +12 -13
- package/pages/account/add/[field].tsx +11 -2
- package/pages/account/cancellation/index.tsx +3 -2
- package/pages/account/delete/confirm/index.tsx +3 -5
- package/pages/account/delete/error/index.tsx +3 -5
- package/pages/account/delete/index.tsx +3 -5
- package/pages/account/delete/success/index.tsx +3 -5
- package/pages/account/dream-team/index.tsx +3 -2
- package/pages/account/edit/[field].tsx +17 -4
- package/pages/account/family/index.tsx +11 -3
- package/pages/account/holiday-stop/index.tsx +3 -2
- package/pages/account/holiday-stop/previous-holiday-stops.tsx +3 -2
- package/pages/account/holiday-stop/upcoming-holiday-stops.tsx +3 -2
- package/pages/account/index.tsx +3 -2
- package/pages/account/newsletters/index.tsx +3 -2
- package/pages/account/newsletters-and-alerts/index.tsx +3 -5
- package/pages/account/payment/[paymentMethod].tsx +2 -2
- package/pages/account/payment/index.tsx +3 -2
- package/pages/account/payment-methods/index.tsx +3 -2
- package/pages/account/subscription-and-billing/index.tsx +3 -5
- package/pages/account/user-hub/index.tsx +4 -6
- package/temp/_document.tsx +1 -0
|
@@ -2,16 +2,20 @@ import React from 'react'
|
|
|
2
2
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
3
3
|
import {
|
|
4
4
|
EditField,
|
|
5
|
-
getProviderProps,
|
|
6
5
|
editComponentMap,
|
|
6
|
+
broadcastingOnlyEditComponentMap,
|
|
7
7
|
DynamicPage,
|
|
8
8
|
} from '@newskit-render/my-account'
|
|
9
9
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
10
10
|
import validation from '../../../validation'
|
|
11
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
12
|
+
import { publisher } from '../../../config'
|
|
13
|
+
import { Publisher } from '@newskit-render/api'
|
|
11
14
|
|
|
12
15
|
const AccountEditField = (props) => (
|
|
13
16
|
<DynamicPage
|
|
14
17
|
objectMap={editComponentMap}
|
|
18
|
+
isPageRestricted={props.isPageRestricted}
|
|
15
19
|
pageName={props.data.type}
|
|
16
20
|
Component={EditField}
|
|
17
21
|
componentProps={props}
|
|
@@ -27,9 +31,15 @@ export const getServerSideProps = async (context) => {
|
|
|
27
31
|
} = context
|
|
28
32
|
const doesEditPageExist = Object.keys(editComponentMap).includes(field)
|
|
29
33
|
|
|
34
|
+
const isBroadcasting = publisher === Publisher.BROADCASTING
|
|
35
|
+
const broadcastingOnlyPages = Object.keys(broadcastingOnlyEditComponentMap)
|
|
36
|
+
|
|
37
|
+
const isPageRestricted =
|
|
38
|
+
!isBroadcasting && broadcastingOnlyPages.includes(field)
|
|
39
|
+
|
|
30
40
|
replaceConsoleAndSetTransactionName(`Account: edit ${field}`)
|
|
31
41
|
|
|
32
|
-
if (!doesEditPageExist) {
|
|
42
|
+
if (!doesEditPageExist || isPageRestricted) {
|
|
33
43
|
context.res.statusCode = 404
|
|
34
44
|
// Logging the error for being captured by New Relic
|
|
35
45
|
console.error(`An error ${context.res.statusCode} occurred on server`)
|
|
@@ -38,8 +48,11 @@ export const getServerSideProps = async (context) => {
|
|
|
38
48
|
const featureFlags = await getAllFeatureFlags()
|
|
39
49
|
/* end cra-effected */
|
|
40
50
|
|
|
41
|
-
return
|
|
51
|
+
return getProviderPropsUtil(
|
|
42
52
|
{ ...context, provider: 'EditField' },
|
|
43
|
-
{
|
|
53
|
+
{
|
|
54
|
+
featureFlags,
|
|
55
|
+
isPageRestricted,
|
|
56
|
+
} /* cra-effected */
|
|
44
57
|
)
|
|
45
58
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Family
|
|
2
|
+
import { Family } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
4
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
5
6
|
|
|
6
7
|
const AccountFamily = (props) => <Family {...props} />
|
|
7
8
|
|
|
@@ -11,9 +12,16 @@ export const getServerSideProps = async (context) => {
|
|
|
11
12
|
replaceConsoleAndSetTransactionName('Account: Family')
|
|
12
13
|
/* start cra-effected */
|
|
13
14
|
const featureFlags = await getAllFeatureFlags()
|
|
15
|
+
|
|
16
|
+
const provider = featureFlags?.enable_invite_family_v2_query
|
|
17
|
+
? 'GroupAccountsV2'
|
|
18
|
+
: 'GroupAccounts'
|
|
14
19
|
/* end cra-effected */
|
|
15
|
-
return
|
|
16
|
-
{
|
|
20
|
+
return getProviderPropsUtil(
|
|
21
|
+
{
|
|
22
|
+
...context,
|
|
23
|
+
provider,
|
|
24
|
+
},
|
|
17
25
|
{ featureFlags } /* cra-effected */
|
|
18
26
|
)
|
|
19
27
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { HolidayStop } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
4
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
5
6
|
|
|
6
7
|
const AccountHolidayStop = (props) => <HolidayStop {...props} />
|
|
7
8
|
|
|
@@ -12,7 +13,7 @@ export const getServerSideProps = async (context) => {
|
|
|
12
13
|
/* start cra-effected */
|
|
13
14
|
const featureFlags = await getAllFeatureFlags()
|
|
14
15
|
/* end cra-effected */
|
|
15
|
-
return
|
|
16
|
+
return getProviderPropsUtil(
|
|
16
17
|
{ ...context, provider: 'HolidayStop' },
|
|
17
18
|
{ featureFlags } /* cra-effected */
|
|
18
19
|
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { HolidayStopList } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
4
|
import { holidayStopListContextOverrides } from '../../../context/app-context/holidayStopListContextOverrides'
|
|
5
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
5
6
|
|
|
6
7
|
const AccountPreviousHolidayStops = (props) => (
|
|
7
8
|
<HolidayStopList
|
|
@@ -15,5 +16,5 @@ export default AccountPreviousHolidayStops
|
|
|
15
16
|
|
|
16
17
|
export const getServerSideProps = async (context) => {
|
|
17
18
|
replaceConsoleAndSetTransactionName('Account: Previous Holiday Stops')
|
|
18
|
-
return
|
|
19
|
+
return getProviderPropsUtil({ ...context, provider: 'HolidayStop' })
|
|
19
20
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { HolidayStopList } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
4
|
import { holidayStopListContextOverrides } from '../../../context/app-context/holidayStopListContextOverrides'
|
|
5
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
5
6
|
|
|
6
7
|
const AccountUpcomingHolidayStops = (props) => (
|
|
7
8
|
<HolidayStopList
|
|
@@ -15,5 +16,5 @@ export default AccountUpcomingHolidayStops
|
|
|
15
16
|
|
|
16
17
|
export const getServerSideProps = async (context) => {
|
|
17
18
|
replaceConsoleAndSetTransactionName('Account: Upcoming Holiday Stops')
|
|
18
|
-
return
|
|
19
|
+
return getProviderPropsUtil({ ...context, provider: 'HolidayStop' })
|
|
19
20
|
}
|
package/pages/account/index.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { PersonalDetails
|
|
2
|
+
import { PersonalDetails } from '@newskit-render/my-account'
|
|
3
3
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
4
4
|
import { AccountDropdown } from '../../components/AccountDropdown' /* cra-disabled */
|
|
5
5
|
import { replaceConsoleAndSetTransactionName } from '../../helpers/logger'
|
|
6
|
+
import { getProviderPropsUtil } from '../../helpers/getProviderPropsUtil'
|
|
6
7
|
|
|
7
8
|
const AccountPersonalDetails = (props) => {
|
|
8
9
|
return (
|
|
@@ -24,7 +25,7 @@ export const getServerSideProps = async (context) => {
|
|
|
24
25
|
|
|
25
26
|
const featureFlags = await getAllFeatureFlags()
|
|
26
27
|
|
|
27
|
-
return
|
|
28
|
+
return getProviderPropsUtil(
|
|
28
29
|
{ ...context, provider: 'PersonalDetails' },
|
|
29
30
|
{ featureFlags } /* cra-effected */
|
|
30
31
|
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Newsletters
|
|
2
|
+
import { Newsletters } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
4
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
5
6
|
|
|
6
7
|
const AccountNewsletters = (props) => <Newsletters {...props} />
|
|
7
8
|
|
|
@@ -12,7 +13,7 @@ export const getServerSideProps = async (context) => {
|
|
|
12
13
|
/* start cra-effected */
|
|
13
14
|
const featureFlags = await getAllFeatureFlags()
|
|
14
15
|
/* end cra-effected */
|
|
15
|
-
return
|
|
16
|
+
return getProviderPropsUtil(
|
|
16
17
|
{ ...context, provider: 'Newsletters' },
|
|
17
18
|
{ featureFlags } /* cra-effected */
|
|
18
19
|
)
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
NewslettersAndAlerts,
|
|
4
|
-
getProviderProps,
|
|
5
|
-
} from '@newskit-render/my-account'
|
|
2
|
+
import { NewslettersAndAlerts } from '@newskit-render/my-account'
|
|
6
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
7
4
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
8
6
|
|
|
9
7
|
const AccountNewslettersAndAlerts = (props) => (
|
|
10
8
|
<NewslettersAndAlerts {...props} />
|
|
@@ -17,7 +15,7 @@ export const getServerSideProps = async (context) => {
|
|
|
17
15
|
/* start cra-effected */
|
|
18
16
|
const featureFlags = await getAllFeatureFlags()
|
|
19
17
|
/* end cra-effected */
|
|
20
|
-
return
|
|
18
|
+
return getProviderPropsUtil(
|
|
21
19
|
{ ...context, provider: 'NewslettersAndAlerts' },
|
|
22
20
|
{ featureFlags } /* cra-effected */
|
|
23
21
|
)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
3
3
|
import {
|
|
4
|
-
getProviderProps,
|
|
5
4
|
Payment,
|
|
6
5
|
paymentMethodsMap,
|
|
7
6
|
DynamicPage,
|
|
8
7
|
} from '@newskit-render/my-account'
|
|
9
8
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
9
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
10
10
|
|
|
11
11
|
const PaymentPage = (props) => {
|
|
12
12
|
return (
|
|
@@ -27,7 +27,7 @@ export const getServerSideProps = async (context) => {
|
|
|
27
27
|
const featureFlags = await getAllFeatureFlags()
|
|
28
28
|
/* end cra-effected */
|
|
29
29
|
|
|
30
|
-
return
|
|
30
|
+
return getProviderPropsUtil(
|
|
31
31
|
{
|
|
32
32
|
...context,
|
|
33
33
|
provider: 'Payment',
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
3
|
-
import { Payment
|
|
3
|
+
import { Payment } from '@newskit-render/my-account'
|
|
4
4
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
5
6
|
|
|
6
7
|
const AccountPayment = (props) => <Payment {...props} />
|
|
7
8
|
|
|
@@ -13,7 +14,7 @@ export const getServerSideProps = async (context) => {
|
|
|
13
14
|
const featureFlags = await getAllFeatureFlags()
|
|
14
15
|
/* end cra-effected */
|
|
15
16
|
|
|
16
|
-
return
|
|
17
|
+
return getProviderPropsUtil(
|
|
17
18
|
{
|
|
18
19
|
...context,
|
|
19
20
|
provider: 'Payment',
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { PaymentMethods } from '@newskit-render/my-account'
|
|
3
3
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' // create-render-app effected
|
|
4
4
|
import { paymentMethodContext } from '../../../context/app-context/paymentMethodContext'
|
|
5
5
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
6
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
6
7
|
|
|
7
8
|
const AccountPaymentMethods = (props) => (
|
|
8
9
|
<PaymentMethods {...props} context={paymentMethodContext} />
|
|
@@ -14,7 +15,7 @@ export const getServerSideProps = async (context) => {
|
|
|
14
15
|
replaceConsoleAndSetTransactionName('Account: Payment Methods')
|
|
15
16
|
const featureFlags = await getAllFeatureFlags()
|
|
16
17
|
// create-render-app effected
|
|
17
|
-
return
|
|
18
|
+
return getProviderPropsUtil(
|
|
18
19
|
{ ...context, provider: 'PaymentMethods' },
|
|
19
20
|
{ featureFlags } // create-render-app effected
|
|
20
21
|
)
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
SubscriptionAndBilling,
|
|
4
|
-
getProviderProps,
|
|
5
|
-
} from '@newskit-render/my-account'
|
|
2
|
+
import { SubscriptionAndBilling } from '@newskit-render/my-account'
|
|
6
3
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
7
4
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
5
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
8
6
|
|
|
9
7
|
const AccountSubscriptionAndBilling = (props) => (
|
|
10
8
|
<SubscriptionAndBilling {...props} />
|
|
@@ -17,7 +15,7 @@ export const getServerSideProps = async (context) => {
|
|
|
17
15
|
/* start cra-effected */
|
|
18
16
|
const featureFlags = await getAllFeatureFlags()
|
|
19
17
|
/* end cra-effected */
|
|
20
|
-
const result = await
|
|
18
|
+
const result = await getProviderPropsUtil(
|
|
21
19
|
{
|
|
22
20
|
...context,
|
|
23
21
|
provider: 'SubscriptionAndBilling',
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
UserHub as UserHubPage,
|
|
4
|
-
getProviderProps,
|
|
5
|
-
} from '@newskit-render/my-account'
|
|
2
|
+
import { UserHub as UserHubPage } from '@newskit-render/my-account'
|
|
6
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
7
4
|
import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
|
+
import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
|
|
8
6
|
|
|
9
7
|
const UserHub = (props) => <UserHubPage {...props} />
|
|
10
8
|
|
|
@@ -15,8 +13,8 @@ export const getServerSideProps = async (context) => {
|
|
|
15
13
|
/* start cra-effected */
|
|
16
14
|
const featureFlags = await getAllFeatureFlags()
|
|
17
15
|
/* end cra-effected */
|
|
18
|
-
return
|
|
19
|
-
{ ...context, provider: '
|
|
16
|
+
return getProviderPropsUtil(
|
|
17
|
+
{ ...context, provider: 'UserHub' },
|
|
20
18
|
{ featureFlags } /* cra-effected */
|
|
21
19
|
)
|
|
22
20
|
}
|
package/temp/_document.tsx
CHANGED