@graphcommerce/magento-cart-payment-method 2.105.11 → 2.106.3
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
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.106.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.105.11...@graphcommerce/magento-cart-payment-method@2.106.0) (2021-10-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* sort payment methods by availability ([52f5d45](https://github.com/ho-nl/m2-pwa/commit/52f5d450a7a2fdec0c7eea9cd5d48336cb304138))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.105.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.105.0...@graphcommerce/magento-cart-payment-method@2.105.1) (2021-09-27)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @graphcommerce/magento-cart-payment-method
|
|
@@ -13,17 +13,16 @@ import { FormControl, makeStyles, Theme } from '@material-ui/core'
|
|
|
13
13
|
import clsx from 'clsx'
|
|
14
14
|
import { m } from 'framer-motion'
|
|
15
15
|
import React, { useEffect } from 'react'
|
|
16
|
-
import { PaymentMethod, PaymentToggleProps } from '../Api/PaymentMethod'
|
|
17
16
|
import { usePaymentMethodContext } from '../PaymentMethodContext/PaymentMethodContext'
|
|
18
17
|
|
|
19
|
-
export type
|
|
18
|
+
export type PaymentMethodTogglesProps = Record<string, unknown>
|
|
20
19
|
|
|
21
|
-
function Content(props: PaymentMethod) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
20
|
+
// function Content(props: PaymentMethod) {
|
|
21
|
+
// const { code } = props
|
|
22
|
+
// const { modules } = usePaymentMethodContext()
|
|
23
|
+
// const Component = modules[code]?.PaymentToggle ?? ((p: PaymentToggleProps) => <>{p.title}</>)
|
|
24
|
+
// return <Component {...props} />
|
|
25
|
+
// }
|
|
27
26
|
|
|
28
27
|
const useStyles = makeStyles(
|
|
29
28
|
(theme: Theme) => ({
|
|
@@ -98,10 +97,10 @@ const useStyles = makeStyles(
|
|
|
98
97
|
right: 0,
|
|
99
98
|
},
|
|
100
99
|
}),
|
|
101
|
-
{ name: '
|
|
100
|
+
{ name: 'PaymentMethodToggles' },
|
|
102
101
|
)
|
|
103
102
|
|
|
104
|
-
export default function
|
|
103
|
+
export default function PaymentMethodToggles(props: PaymentMethodTogglesProps) {
|
|
105
104
|
const { methods, selectedMethod, setSelectedMethod, setSelectedModule, modules } =
|
|
106
105
|
usePaymentMethodContext()
|
|
107
106
|
|
|
@@ -133,6 +132,10 @@ export default function PaymentMethodToggle(props: PaymentMethodToggleProps) {
|
|
|
133
132
|
|
|
134
133
|
if (!methods || methods.length < 1) return <></>
|
|
135
134
|
|
|
135
|
+
const sortedMethods = [...methods].sort((a, b) =>
|
|
136
|
+
!modules?.[a?.code] ? 0 : !modules?.[b?.code] ? -1 : 1,
|
|
137
|
+
)
|
|
138
|
+
|
|
136
139
|
return (
|
|
137
140
|
<Form onSubmit={submitHandler} noValidate classes={{ root: classes.formRoot }}>
|
|
138
141
|
<input type='hidden' {...register('code', { required: true })} required />
|
|
@@ -157,7 +160,7 @@ export default function PaymentMethodToggle(props: PaymentMethodToggleProps) {
|
|
|
157
160
|
rules={{ required: 'Please select a payment method' }}
|
|
158
161
|
render={({ field: { onChange, value, name, ref, onBlur } }) => (
|
|
159
162
|
<Scroller className={classes.scrollerRoot} hideScrollbar>
|
|
160
|
-
{
|
|
163
|
+
{sortedMethods?.map((pm) => {
|
|
161
164
|
const buttonValue = `${pm.code}___${pm.child}`
|
|
162
165
|
|
|
163
166
|
return (
|
package/index.ts
CHANGED
|
@@ -14,5 +14,5 @@ export { default as PaymentMethodOptionsNoop } from './PaymentMethodOptionsNoop/
|
|
|
14
14
|
export { default as PaymentMethodPlaceOrder } from './PaymentMethodPlaceOrder/PaymentMethodPlaceOrder'
|
|
15
15
|
export { default as PaymentMethodPlaceOrderNoop } from './PaymentMethodPlaceOrderNoop/PaymentMethodPlaceOrderNoop'
|
|
16
16
|
|
|
17
|
-
export * from './
|
|
18
|
-
export { default as PaymentMethodToggle } from './
|
|
17
|
+
export * from './PaymentMethodToggles/PaymentMethodToggles'
|
|
18
|
+
export { default as PaymentMethodToggle } from './PaymentMethodToggles/PaymentMethodToggles'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphcommerce/magento-cart-payment-method",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.106.3",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "14.x"
|
|
@@ -17,19 +17,20 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@graphcommerce/browserslist-config-pwa": "^3.0.1",
|
|
20
|
-
"@graphcommerce/eslint-config-pwa": "^3.0.
|
|
20
|
+
"@graphcommerce/eslint-config-pwa": "^3.0.5",
|
|
21
21
|
"@graphcommerce/prettier-config-pwa": "^3.0.2",
|
|
22
22
|
"@graphcommerce/typescript-config-pwa": "^3.1.0",
|
|
23
23
|
"@playwright/test": "^1.15.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@apollo/client": "^3.
|
|
27
|
-
"@graphcommerce/
|
|
28
|
-
"@graphcommerce/
|
|
29
|
-
"@graphcommerce/
|
|
30
|
-
"@graphcommerce/magento-
|
|
31
|
-
"@graphcommerce/
|
|
32
|
-
"@graphcommerce/
|
|
26
|
+
"@apollo/client": "^3.4.16",
|
|
27
|
+
"@graphcommerce/framer-scroller": "^0.2.6",
|
|
28
|
+
"@graphcommerce/graphql": "^2.103.5",
|
|
29
|
+
"@graphcommerce/image": "^2.104.6",
|
|
30
|
+
"@graphcommerce/magento-cart": "^3.1.2",
|
|
31
|
+
"@graphcommerce/magento-store": "^3.0.13",
|
|
32
|
+
"@graphcommerce/next-ui": "^3.1.5",
|
|
33
|
+
"@graphcommerce/react-hook-form": "^2.102.5",
|
|
33
34
|
"@graphql-typed-document-node/core": "^3.1.0",
|
|
34
35
|
"@material-ui/core": "^4.12.3",
|
|
35
36
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
|
@@ -40,5 +41,5 @@
|
|
|
40
41
|
"react-dom": "^17.0.1",
|
|
41
42
|
"type-fest": "^2.3.4"
|
|
42
43
|
},
|
|
43
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "f1d0e488921787f39a260c410790ec13d32c8143"
|
|
44
45
|
}
|