@newskit-render/core 4.8.0-alpha.0 → 4.8.0-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/context/app-context/paymentMethodContext.tsx +2 -2
- package/cypress/e2e/account/payment-page.cy.js +41 -2
- package/cypress.config.ts +0 -2
- package/package.json +5 -5
- package/pages/account/add/[field].tsx +11 -11
- package/pages/account/edit/[field].tsx +10 -11
- package/pages/account/payment/[paymentMethod].tsx +38 -0
- package/pages/account/payment/index.tsx +3 -8
- package/gitignore +0 -39
|
@@ -18,7 +18,7 @@ export const paymentMethodContext = {
|
|
|
18
18
|
items: [
|
|
19
19
|
{
|
|
20
20
|
label: 'Debit/Credit Card',
|
|
21
|
-
href: '[baseURL]/payment',
|
|
21
|
+
href: '[baseURL]/payment/credit-card',
|
|
22
22
|
default: 'Debit/Credit Card',
|
|
23
23
|
labelIcon: {
|
|
24
24
|
Icon: IconCreditCard,
|
|
@@ -33,7 +33,7 @@ export const paymentMethodContext = {
|
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
label: 'Direct Debit',
|
|
36
|
-
href: '[baseURL]/payment
|
|
36
|
+
href: '[baseURL]/payment/direct-debit',
|
|
37
37
|
default: 'Direct Debit',
|
|
38
38
|
labelIcon: {
|
|
39
39
|
Icon: IconDirectDebit,
|
|
@@ -6,15 +6,54 @@ describe('My account Payment methods page', () => {
|
|
|
6
6
|
|
|
7
7
|
it('should show payment options', () => {
|
|
8
8
|
cy.get('[data-testid="content-list-item-0"]')
|
|
9
|
-
.should('have.attr', 'href', '/account/payment')
|
|
9
|
+
.should('have.attr', 'href', '/account/payment/credit-card')
|
|
10
10
|
.contains('Debit/Credit Card')
|
|
11
11
|
|
|
12
12
|
cy.get('[data-testid="content-list-item-1"]')
|
|
13
|
-
.should('have.attr', 'href', '/account/payment
|
|
13
|
+
.should('have.attr', 'href', '/account/payment/direct-debit')
|
|
14
14
|
.contains('Direct Debit')
|
|
15
15
|
})
|
|
16
16
|
})
|
|
17
17
|
|
|
18
|
+
describe('My account credit card payment method page', () => {
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
cy.mockConsentAndVisit('/account/payment/credit-card')
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('should load the zuora iFrame', () => {
|
|
24
|
+
cy.get('iframe').should('exist')
|
|
25
|
+
})
|
|
26
|
+
it('should show the credit card payment page title', () => {
|
|
27
|
+
cy.get('[data-testid="introduction-title"]').contains('Debit/Credit Card')
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
describe('My account direct debit payment method page', () => {
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
cy.mockConsentAndVisit('/account/payment/direct-debit')
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('should load the zuora iFrame', () => {
|
|
36
|
+
cy.get('iframe').should('exist')
|
|
37
|
+
})
|
|
38
|
+
it('should show the credit card payment page title', () => {
|
|
39
|
+
cy.get('[data-testid="introduction-title"]').contains(
|
|
40
|
+
'Set up a Direct Debit'
|
|
41
|
+
)
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
describe('My account /payment when used without payment method', () => {
|
|
45
|
+
beforeEach(() => {
|
|
46
|
+
cy.mockConsentAndVisit('/account/payment')
|
|
47
|
+
})
|
|
48
|
+
it('should load the Zuora iframe', () => {
|
|
49
|
+
cy.get('iframe').should('exist')
|
|
50
|
+
})
|
|
51
|
+
it('should show the generic payment page - the Zuora credit card iframe', () => {
|
|
52
|
+
cy.get('[data-testid="introduction-title"]').contains(
|
|
53
|
+
'Edit your payment method'
|
|
54
|
+
)
|
|
55
|
+
})
|
|
56
|
+
})
|
|
18
57
|
// describe('My account Payment page', () => {
|
|
19
58
|
// beforeEach(() => {
|
|
20
59
|
// cy.mockConsentAndVisit('/account/payment')
|
package/cypress.config.ts
CHANGED
|
@@ -32,8 +32,6 @@ export default defineConfig({
|
|
|
32
32
|
return config
|
|
33
33
|
},
|
|
34
34
|
baseUrl: 'http://localhost:3000',
|
|
35
|
-
video: false,
|
|
36
|
-
screenshotOnRunFailure: false,
|
|
37
35
|
specPattern: './cypress/e2e/**/*.cy.{js,jsx,ts,tsx}',
|
|
38
36
|
excludeSpecPattern: './cypress/e2e/checkout/*.cy.{js,jsx,ts,tsx}',
|
|
39
37
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/core",
|
|
3
|
-
"version": "4.8.0-alpha.
|
|
3
|
+
"version": "4.8.0-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.8",
|
|
43
43
|
"@newskit-render/auth": "^1.4.0",
|
|
44
|
-
"@newskit-render/checkout": "^3.3.4-alpha.
|
|
44
|
+
"@newskit-render/checkout": "^3.3.4-alpha.1",
|
|
45
45
|
"@newskit-render/feature-flags": "^1.4.11",
|
|
46
46
|
"@newskit-render/feed": "^1.5.0",
|
|
47
|
-
"@newskit-render/my-account": "^6.10.0-alpha.
|
|
48
|
-
"@newskit-render/shared-components": "^3.13.0-alpha.
|
|
49
|
-
"@newskit-render/standalone-components": "^3.10.2-alpha.
|
|
47
|
+
"@newskit-render/my-account": "^6.10.0-alpha.1",
|
|
48
|
+
"@newskit-render/shared-components": "^3.13.0-alpha.1",
|
|
49
|
+
"@newskit-render/standalone-components": "^3.10.2-alpha.1",
|
|
50
50
|
"@newskit-render/validation": "^1.8.1",
|
|
51
51
|
"@next/font": "13.1.6",
|
|
52
52
|
"cross-fetch": "3.1.5",
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import newrelic from 'newrelic'
|
|
3
|
-
import { AddField,
|
|
3
|
+
import { AddField, addComponentMap } from '@newskit-render/my-account'
|
|
4
4
|
import validation from '../../../validation'
|
|
5
|
+
import { DynamicPage } from '@newskit-render/my-account'
|
|
5
6
|
|
|
6
|
-
const AccountAddField = (props) =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
7
|
+
const AccountAddField = (props) => (
|
|
8
|
+
<DynamicPage
|
|
9
|
+
objectMap={addComponentMap}
|
|
10
|
+
pageName={props.data.type}
|
|
11
|
+
Component={AddField}
|
|
12
|
+
componentProps={props}
|
|
13
|
+
validation={validation}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
16
|
|
|
17
17
|
export default AccountAddField
|
|
18
18
|
export const getServerSideProps = async (context) => {
|
|
@@ -3,23 +3,22 @@ import newrelic from 'newrelic'
|
|
|
3
3
|
import {
|
|
4
4
|
EditField,
|
|
5
5
|
getProviderProps,
|
|
6
|
-
NotFound,
|
|
7
6
|
editComponentMap,
|
|
7
|
+
DynamicPage,
|
|
8
8
|
} from '@newskit-render/my-account'
|
|
9
9
|
import { initAndGetFeatureFlag } from '@newskit-render/feature-flags' /* cra-effected */
|
|
10
10
|
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
11
11
|
import validation from '../../../validation'
|
|
12
12
|
|
|
13
|
-
const AccountEditField = (props) =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
13
|
+
const AccountEditField = (props) => (
|
|
14
|
+
<DynamicPage
|
|
15
|
+
objectMap={editComponentMap}
|
|
16
|
+
pageName={props.data.type}
|
|
17
|
+
Component={EditField}
|
|
18
|
+
componentProps={props}
|
|
19
|
+
validation={validation}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
23
22
|
|
|
24
23
|
export default AccountEditField
|
|
25
24
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import newrelic from 'newrelic'
|
|
3
|
+
import {
|
|
4
|
+
getProviderProps,
|
|
5
|
+
Payment,
|
|
6
|
+
paymentMethodsMap,
|
|
7
|
+
DynamicPage,
|
|
8
|
+
} from '@newskit-render/my-account'
|
|
9
|
+
import { initAndGetFeatureFlag } from '@newskit-render/feature-flags' /* cra-effected */
|
|
10
|
+
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
11
|
+
|
|
12
|
+
const PaymentPage = (props) => {
|
|
13
|
+
return (
|
|
14
|
+
<DynamicPage
|
|
15
|
+
objectMap={paymentMethodsMap}
|
|
16
|
+
pageName={props.paymentType}
|
|
17
|
+
Component={Payment}
|
|
18
|
+
componentProps={props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default PaymentPage
|
|
24
|
+
|
|
25
|
+
export const getServerSideProps = async (context) => {
|
|
26
|
+
newrelic.setTransactionName('Payment method')
|
|
27
|
+
/* start cra-effected */
|
|
28
|
+
const featureFlags = await initAndGetFeatureFlag(optimizelysdkKey)
|
|
29
|
+
/* end cra-effected */
|
|
30
|
+
|
|
31
|
+
return getProviderProps(
|
|
32
|
+
{
|
|
33
|
+
...context,
|
|
34
|
+
provider: 'Payment',
|
|
35
|
+
},
|
|
36
|
+
{ featureFlags } /* cra-effected */
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import newrelic from 'newrelic'
|
|
3
|
-
import {
|
|
4
|
-
Payment,
|
|
5
|
-
getProviderProps,
|
|
6
|
-
PaymentProvider,
|
|
7
|
-
} from '@newskit-render/my-account'
|
|
3
|
+
import { Payment, getProviderProps } from '@newskit-render/my-account'
|
|
8
4
|
import { initAndGetFeatureFlag } from '@newskit-render/feature-flags' /* cra-effected */
|
|
9
5
|
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
10
6
|
|
|
11
|
-
const
|
|
7
|
+
const AccountPayment = (props) => <Payment {...props} />
|
|
12
8
|
|
|
13
|
-
export default
|
|
9
|
+
export default AccountPayment
|
|
14
10
|
|
|
15
11
|
export const getServerSideProps = async (context) => {
|
|
16
12
|
newrelic.setTransactionName('Edit Payment method')
|
|
@@ -22,7 +18,6 @@ export const getServerSideProps = async (context) => {
|
|
|
22
18
|
{
|
|
23
19
|
...context,
|
|
24
20
|
provider: 'Payment',
|
|
25
|
-
paymentProvider: PaymentProvider.Zuora,
|
|
26
21
|
},
|
|
27
22
|
{ featureFlags } /* cra-effected */
|
|
28
23
|
)
|
package/gitignore
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
-
|
|
3
|
-
# dependencies
|
|
4
|
-
/node_modules
|
|
5
|
-
/.pnp
|
|
6
|
-
.pnp.js
|
|
7
|
-
|
|
8
|
-
# testing
|
|
9
|
-
/coverage
|
|
10
|
-
/cypress/videos
|
|
11
|
-
/cypress/screenshots
|
|
12
|
-
/__pacts__/logs
|
|
13
|
-
/__pacts__/pacts
|
|
14
|
-
|
|
15
|
-
# next.js
|
|
16
|
-
/.next/
|
|
17
|
-
/out/
|
|
18
|
-
|
|
19
|
-
# production
|
|
20
|
-
/build
|
|
21
|
-
|
|
22
|
-
# misc
|
|
23
|
-
.DS_Store
|
|
24
|
-
*.pem
|
|
25
|
-
|
|
26
|
-
# debug
|
|
27
|
-
npm-debug.log*
|
|
28
|
-
yarn-debug.log*
|
|
29
|
-
yarn-error.log*
|
|
30
|
-
newrelic_agent.log
|
|
31
|
-
|
|
32
|
-
# local env files
|
|
33
|
-
.env.local
|
|
34
|
-
.env.development.local
|
|
35
|
-
.env.test.local
|
|
36
|
-
.env.production.local
|
|
37
|
-
|
|
38
|
-
# vercel
|
|
39
|
-
.vercel
|