@graphcommerce/magento-cart-payment-method 8.0.6-canary.4 → 8.0.7
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/Api/PaymentMethodContext.graphql +1 -1
- package/CHANGELOG.md +12 -26
- package/PaymentMethodActionCardList/PaymentMethodActionCardListForm.tsx +18 -20
- package/PaymentMethodContext/PaymentMethodContext.tsx +2 -6
- package/PaymentMethodPlaceOrderNoop/PaymentMethodPlaceOrderNoop.tsx +1 -1
- package/PaymentMethodToggles/PaymentMethodToggles.tsx +3 -2
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## 8.0.
|
|
3
|
+
## 8.0.7
|
|
4
4
|
|
|
5
|
-
## 8.0.6
|
|
6
|
-
|
|
7
|
-
## 8.0.6-canary.2
|
|
5
|
+
## 8.0.6
|
|
8
6
|
|
|
9
7
|
### Patch Changes
|
|
10
8
|
|
|
11
|
-
- [#
|
|
12
|
-
([@FrankHarland](https://github.com/FrankHarland))
|
|
13
|
-
|
|
14
|
-
- [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`530076e`](https://github.com/graphcommerce-org/graphcommerce/commit/530076e3664703cb8b577b7fcf1998a420819f60) - Moved all usages of useFormPersist to the <FormPersist/> component to prevent rerenders.
|
|
15
|
-
([@FrankHarland](https://github.com/FrankHarland))
|
|
16
|
-
|
|
17
|
-
- [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`43bd04a`](https://github.com/graphcommerce-org/graphcommerce/commit/43bd04a777c5800cc7e01bee1e123a5aad82f194) - Prevent BillingPage query from rerunning on each mutation
|
|
18
|
-
([@FrankHarland](https://github.com/FrankHarland))
|
|
19
|
-
|
|
20
|
-
## 8.0.6-canary.1
|
|
21
|
-
|
|
22
|
-
## 8.0.6-canary.0
|
|
9
|
+
- [#2248](https://github.com/graphcommerce-org/graphcommerce/pull/2248) [`e262419`](https://github.com/graphcommerce-org/graphcommerce/commit/e2624194cc1c1b9bb625892c2856900c071c936c) - Compatibility with Magento 2.4.7 ([@paales](https://github.com/paales))
|
|
23
10
|
|
|
24
11
|
## 8.0.5
|
|
25
12
|
|
|
@@ -93,8 +80,7 @@
|
|
|
93
80
|
|
|
94
81
|
### Patch Changes
|
|
95
82
|
|
|
96
|
-
- [#2115](https://github.com/graphcommerce-org/graphcommerce/pull/2115) [`105a1af`](https://github.com/graphcommerce-org/graphcommerce/commit/105a1af8b820de8873e430ae398f1922d39a9110) - Disabled ripple animations on all ActionCard ‘Select’ and ‘Change’ so the rendering is more subtle during checkout.
|
|
97
|
-
([@Jessevdpoel](https://github.com/Jessevdpoel))
|
|
83
|
+
- [#2115](https://github.com/graphcommerce-org/graphcommerce/pull/2115) [`105a1af`](https://github.com/graphcommerce-org/graphcommerce/commit/105a1af8b820de8873e430ae398f1922d39a9110) - Disabled ripple animations on all ActionCard ‘Select’ and ‘Change’ so the rendering is more subtle during checkout. ([@Jessevdpoel](https://github.com/Jessevdpoel))
|
|
98
84
|
|
|
99
85
|
## 8.0.0-canary.100
|
|
100
86
|
|
|
@@ -1427,31 +1413,31 @@
|
|
|
1427
1413
|
All occurences of `<Trans>` and `t` need to be replaced:
|
|
1428
1414
|
|
|
1429
1415
|
```tsx
|
|
1430
|
-
import { Trans, t } from
|
|
1416
|
+
import { Trans, t } from '@lingui/macro'
|
|
1431
1417
|
|
|
1432
1418
|
function MyComponent() {
|
|
1433
|
-
const foo =
|
|
1419
|
+
const foo = 'bar'
|
|
1434
1420
|
return (
|
|
1435
1421
|
<div aria-label={t`Account ${foo}`}>
|
|
1436
1422
|
<Trans>My Translation {foo}</Trans>
|
|
1437
1423
|
</div>
|
|
1438
|
-
)
|
|
1424
|
+
)
|
|
1439
1425
|
}
|
|
1440
1426
|
```
|
|
1441
1427
|
|
|
1442
1428
|
Needs to be replaced with:
|
|
1443
1429
|
|
|
1444
1430
|
```tsx
|
|
1445
|
-
import { Trans } from
|
|
1446
|
-
import { i18n } from
|
|
1431
|
+
import { Trans } from '@lingui/react'
|
|
1432
|
+
import { i18n } from '@lingui/core'
|
|
1447
1433
|
|
|
1448
1434
|
function MyComponent() {
|
|
1449
|
-
const foo =
|
|
1435
|
+
const foo = 'bar'
|
|
1450
1436
|
return (
|
|
1451
1437
|
<div aria-label={i18n._(/* i18n */ `Account {foo}`, { foo })}>
|
|
1452
|
-
<Trans key=
|
|
1438
|
+
<Trans key='My Translation {foo}' values={{ foo }}></Trans>
|
|
1453
1439
|
</div>
|
|
1454
|
-
)
|
|
1440
|
+
)
|
|
1455
1441
|
}
|
|
1456
1442
|
```
|
|
1457
1443
|
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
ActionCardProps,
|
|
8
8
|
} from '@graphcommerce/next-ui'
|
|
9
9
|
import {
|
|
10
|
-
FormPersist,
|
|
11
10
|
useForm,
|
|
12
11
|
useFormCompose,
|
|
13
12
|
UseFormComposeOptions,
|
|
13
|
+
useFormPersist,
|
|
14
14
|
} from '@graphcommerce/react-hook-form'
|
|
15
15
|
import { i18n } from '@lingui/core'
|
|
16
16
|
import { Trans } from '@lingui/react'
|
|
@@ -84,6 +84,7 @@ export function PaymentMethodActionCardListForm(props: PaymentMethodActionCardLi
|
|
|
84
84
|
|
|
85
85
|
const paymentMethod = watch('paymentMethod')
|
|
86
86
|
|
|
87
|
+
useFormPersist({ form, name: 'PaymentMethodActionCardList' })
|
|
87
88
|
useFormCompose({ form, step: 1, submit, key: 'PaymentMethodActionCardList' })
|
|
88
89
|
|
|
89
90
|
// todo: Do not useEffect to set value, usePaymentMethodContext should calculate these values.
|
|
@@ -108,24 +109,21 @@ export function PaymentMethodActionCardListForm(props: PaymentMethodActionCardLi
|
|
|
108
109
|
if (!methods || methods.length < 1) return null
|
|
109
110
|
|
|
110
111
|
return (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
render={PaymentMethodActionCard}
|
|
128
|
-
/>
|
|
129
|
-
</>
|
|
112
|
+
<ActionCardListForm<PaymentOptionsProps & ActionCardProps, FormFields>
|
|
113
|
+
control={control}
|
|
114
|
+
name='paymentMethod'
|
|
115
|
+
errorMessage={i18n._(/* i18n */ 'Please select a payment method')}
|
|
116
|
+
collapse
|
|
117
|
+
size='large'
|
|
118
|
+
color='secondary'
|
|
119
|
+
items={methods.map((method) => ({
|
|
120
|
+
...method,
|
|
121
|
+
value: `${method.code}___${method.child}`,
|
|
122
|
+
step,
|
|
123
|
+
Container: FormDiv,
|
|
124
|
+
disabled: !modules?.[method.code ?? ''],
|
|
125
|
+
}))}
|
|
126
|
+
render={PaymentMethodActionCard}
|
|
127
|
+
/>
|
|
130
128
|
)
|
|
131
129
|
}
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
} from '../Api/PaymentMethod'
|
|
12
12
|
import { PaymentMethodContextFragment } from '../Api/PaymentMethodContext.gql'
|
|
13
13
|
import { GetPaymentMethodContextDocument } from './GetPaymentMethodContext.gql'
|
|
14
|
-
import { filterNonNullableKeys, nonNullable } from '@graphcommerce/next-ui'
|
|
15
14
|
|
|
16
15
|
type PaymentMethodContextProps = {
|
|
17
16
|
methods: PaymentMethod[]
|
|
@@ -66,20 +65,17 @@ export function PaymentMethodContextProvider(props: PaymentMethodContextProvider
|
|
|
66
65
|
},
|
|
67
66
|
)
|
|
68
67
|
|
|
68
|
+
const [methods, setMethods] = useState<PaymentMethod[]>([])
|
|
69
69
|
const [selectedMethod, setSelectedMethod] = useState<PaymentMethod>()
|
|
70
70
|
const [selectedModule, setSelectedModule] = useState<PaymentModule>()
|
|
71
71
|
|
|
72
72
|
const availableMethods = useMemo(() => {
|
|
73
|
-
const allMethods =
|
|
73
|
+
const allMethods = cartContext?.available_payment_methods ?? []
|
|
74
74
|
const free = allMethods.find((method) => method?.code === 'free')
|
|
75
75
|
|
|
76
76
|
return free ? [free] : allMethods
|
|
77
77
|
}, [cartContext?.available_payment_methods])
|
|
78
78
|
|
|
79
|
-
const [methods, setMethods] = useState<PaymentMethod[]>(
|
|
80
|
-
availableMethods.map((m) => ({ ...m, code: `${m.code}_placeholder`, child: '' })),
|
|
81
|
-
)
|
|
82
|
-
|
|
83
79
|
// Expand the payment methods
|
|
84
80
|
useEffect(() => {
|
|
85
81
|
if (!cartContext) return // eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
@@ -10,7 +10,7 @@ export function PaymentMethodPlaceOrderNoop(props: PaymentPlaceOrderProps) {
|
|
|
10
10
|
|
|
11
11
|
const form = useFormGqlMutationCart(PaymentMethodPlaceOrderNoopDocument, {
|
|
12
12
|
onComplete: async (result) => {
|
|
13
|
-
if (!result.data?.placeOrder) return
|
|
13
|
+
if (!result.data?.placeOrder?.order) return
|
|
14
14
|
await onSuccess(result.data.placeOrder.order.order_number)
|
|
15
15
|
},
|
|
16
16
|
})
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
} from '@graphcommerce/next-ui'
|
|
12
12
|
import {
|
|
13
13
|
Controller,
|
|
14
|
-
FormPersist,
|
|
15
14
|
useForm,
|
|
16
15
|
useFormCompose,
|
|
17
16
|
UseFormComposeOptions,
|
|
17
|
+
useFormPersist,
|
|
18
18
|
} from '@graphcommerce/react-hook-form'
|
|
19
19
|
import { i18n } from '@lingui/core'
|
|
20
20
|
import { Box, FormControl, FormHelperText, SxProps, Theme } from '@mui/material'
|
|
@@ -51,6 +51,8 @@ export function PaymentMethodToggles(props: PaymentMethodTogglesProps) {
|
|
|
51
51
|
defaultValues: { code: lockState.method },
|
|
52
52
|
})
|
|
53
53
|
|
|
54
|
+
useFormPersist({ form, name: 'PaymentMethodToggle' })
|
|
55
|
+
|
|
54
56
|
const { control, handleSubmit, watch, register, setValue, formState } = form
|
|
55
57
|
|
|
56
58
|
const submitHandler = handleSubmit(() => {})
|
|
@@ -90,7 +92,6 @@ export function PaymentMethodToggles(props: PaymentMethodTogglesProps) {
|
|
|
90
92
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
91
93
|
]}
|
|
92
94
|
>
|
|
93
|
-
<FormPersist form={form} name='PaymentMethodToggles' />
|
|
94
95
|
<input type='hidden' {...register('code', { required: true })} required />
|
|
95
96
|
<FormRow className={classes.root} sx={{ position: 'relative', padding: 0 }}>
|
|
96
97
|
<ScrollerProvider scrollSnapAlign='center'>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-cart-payment-method",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "8.0.
|
|
5
|
+
"version": "8.0.7",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^8.0.
|
|
16
|
-
"@graphcommerce/framer-scroller": "^8.0.
|
|
17
|
-
"@graphcommerce/graphql": "^8.0.
|
|
18
|
-
"@graphcommerce/image": "^8.0.
|
|
19
|
-
"@graphcommerce/magento-cart": "^8.0.
|
|
20
|
-
"@graphcommerce/magento-cart-shipping-address": "^8.0.
|
|
21
|
-
"@graphcommerce/magento-store": "^8.0.
|
|
22
|
-
"@graphcommerce/next-ui": "^8.0.
|
|
23
|
-
"@graphcommerce/prettier-config-pwa": "^8.0.
|
|
24
|
-
"@graphcommerce/react-hook-form": "^8.0.
|
|
25
|
-
"@graphcommerce/typescript-config-pwa": "^8.0.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^8.0.7",
|
|
16
|
+
"@graphcommerce/framer-scroller": "^8.0.7",
|
|
17
|
+
"@graphcommerce/graphql": "^8.0.7",
|
|
18
|
+
"@graphcommerce/image": "^8.0.7",
|
|
19
|
+
"@graphcommerce/magento-cart": "^8.0.7",
|
|
20
|
+
"@graphcommerce/magento-cart-shipping-address": "^8.0.7",
|
|
21
|
+
"@graphcommerce/magento-store": "^8.0.7",
|
|
22
|
+
"@graphcommerce/next-ui": "^8.0.7",
|
|
23
|
+
"@graphcommerce/prettier-config-pwa": "^8.0.7",
|
|
24
|
+
"@graphcommerce/react-hook-form": "^8.0.7",
|
|
25
|
+
"@graphcommerce/typescript-config-pwa": "^8.0.7",
|
|
26
26
|
"@lingui/core": "^4.2.1",
|
|
27
27
|
"@lingui/macro": "^4.2.1",
|
|
28
28
|
"@lingui/react": "^4.2.1",
|