@graphcommerce/magento-cart-payment-method 3.1.19 → 3.2.0
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/PaymentMethod.ts +7 -2
- package/CHANGELOG.md +19 -0
- package/PaymentMethodContext/PaymentMethodContext.tsx +13 -2
- package/package.json +11 -11
package/Api/PaymentMethod.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApolloClient } from '@graphcommerce/graphql'
|
|
1
2
|
import { LinkOrButtonProps } from '@graphcommerce/next-ui'
|
|
2
3
|
import { UseFormComposeOptions } from '@graphcommerce/react-hook-form'
|
|
3
4
|
import React from 'react'
|
|
@@ -13,7 +14,7 @@ export type PaymentMethod = Partial<AvailablePaymentMethodFragment> &
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export type PaymentMethodOptionsProps = Pick<UseFormComposeOptions, 'step'> & {
|
|
16
|
-
Container: React.FC
|
|
17
|
+
Container: React.FC<{ children?: React.ReactNode }>
|
|
17
18
|
}
|
|
18
19
|
export type PaymentButtonProps = PaymentMethod & { buttonProps: LinkOrButtonProps }
|
|
19
20
|
export type PaymentOptionsProps = PaymentMethod & PaymentMethodOptionsProps
|
|
@@ -21,9 +22,13 @@ export type PaymentOptionsProps = PaymentMethod & PaymentMethodOptionsProps
|
|
|
21
22
|
export type PaymentToggleProps = PaymentMethod
|
|
22
23
|
export type PaymentHandlerProps = { code: string }
|
|
23
24
|
|
|
25
|
+
export type ExpandPaymentMethodsContext = Partial<PaymentMethodContextFragment> & {
|
|
26
|
+
client: ApolloClient<object>
|
|
27
|
+
}
|
|
28
|
+
|
|
24
29
|
export type ExpandPaymentMethods = (
|
|
25
30
|
available: AvailablePaymentMethodFragment,
|
|
26
|
-
context:
|
|
31
|
+
context: ExpandPaymentMethodsContext,
|
|
27
32
|
) => Promise<PaymentMethod[]> | PaymentMethod[]
|
|
28
33
|
|
|
29
34
|
export type PaymentPlaceOrderProps = PaymentMethod & Pick<UseFormComposeOptions, 'step'>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1511](https://github.com/graphcommerce-org/graphcommerce/pull/1511) [`a2b4d7804`](https://github.com/graphcommerce-org/graphcommerce/commit/a2b4d78046a55d70194bd8bcd1efa499d5a73b74) Thanks [@paales](https://github.com/paales)! - make the apollo client available in the expandMethods call
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#1490](https://github.com/graphcommerce-org/graphcommerce/pull/1490) [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb) Thanks [@paales](https://github.com/paales)! - upgraded packages
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`a9213f1f5`](https://github.com/graphcommerce-org/graphcommerce/commit/a9213f1f5a410d217768386ccb6d9b5ce7bd5782), [`ddb6d6329`](https://github.com/graphcommerce-org/graphcommerce/commit/ddb6d6329bfad361b2fbe96402ca2bfc0ab3d98c), [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb)]:
|
|
14
|
+
- @graphcommerce/next-ui@4.9.0
|
|
15
|
+
- @graphcommerce/framer-scroller@2.1.16
|
|
16
|
+
- @graphcommerce/graphql@3.2.1
|
|
17
|
+
- @graphcommerce/image@3.1.7
|
|
18
|
+
- @graphcommerce/magento-cart@4.4.3
|
|
19
|
+
- @graphcommerce/magento-store@4.2.10
|
|
20
|
+
- @graphcommerce/react-hook-form@3.2.2
|
|
21
|
+
|
|
3
22
|
## 3.1.19
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { useApolloClient } from '@graphcommerce/graphql'
|
|
1
2
|
import { useCartQuery } from '@graphcommerce/magento-cart'
|
|
2
3
|
import React, { PropsWithChildren, useContext, useEffect, useMemo, useState } from 'react'
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ExpandPaymentMethodsContext,
|
|
6
|
+
PaymentMethod,
|
|
7
|
+
PaymentMethodModules,
|
|
8
|
+
PaymentModule,
|
|
9
|
+
} from '../Api/PaymentMethod'
|
|
4
10
|
import { GetPaymentMethodContextDocument } from './GetPaymentMethodContext.gql'
|
|
5
11
|
|
|
6
12
|
type PaymentMethodContextProps = {
|
|
@@ -26,8 +32,13 @@ export function PaymentMethodContextProvider(props: PaymentMethodContextProvider
|
|
|
26
32
|
const { modules, children } = props
|
|
27
33
|
|
|
28
34
|
const context = useCartQuery(GetPaymentMethodContextDocument)
|
|
35
|
+
const client = useApolloClient()
|
|
36
|
+
|
|
37
|
+
const cartContext: ExpandPaymentMethodsContext = useMemo(
|
|
38
|
+
() => ({ ...context?.data?.cart, client }),
|
|
39
|
+
[client, context?.data?.cart],
|
|
40
|
+
)
|
|
29
41
|
|
|
30
|
-
const cartContext = context?.data?.cart
|
|
31
42
|
const [methods, setMethods] = useState<PaymentMethod[]>([])
|
|
32
43
|
const [selectedMethod, setSelectedMethod] = useState<PaymentMethod>()
|
|
33
44
|
const [selectedModule, setSelectedModule] = useState<PaymentModule>()
|
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": "3.
|
|
5
|
+
"version": "3.2.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,28 +12,28 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^4.1.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.8",
|
|
16
16
|
"@graphcommerce/prettier-config-pwa": "^4.0.6",
|
|
17
17
|
"@graphcommerce/typescript-config-pwa": "^4.0.3",
|
|
18
|
-
"@graphcommerce/magento-cart-shipping-address": "3.0
|
|
18
|
+
"@graphcommerce/magento-cart-shipping-address": "3.1.0",
|
|
19
19
|
"@playwright/test": "^1.21.1",
|
|
20
20
|
"type-fest": "^2.12.2"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@graphcommerce/framer-scroller": "2.1.
|
|
24
|
-
"@graphcommerce/graphql": "3.2.
|
|
25
|
-
"@graphcommerce/image": "3.1.
|
|
26
|
-
"@graphcommerce/magento-cart": "4.4.
|
|
27
|
-
"@graphcommerce/magento-store": "4.2.
|
|
28
|
-
"@graphcommerce/next-ui": "4.
|
|
29
|
-
"@graphcommerce/react-hook-form": "3.2.
|
|
23
|
+
"@graphcommerce/framer-scroller": "2.1.16",
|
|
24
|
+
"@graphcommerce/graphql": "3.2.1",
|
|
25
|
+
"@graphcommerce/image": "3.1.7",
|
|
26
|
+
"@graphcommerce/magento-cart": "4.4.3",
|
|
27
|
+
"@graphcommerce/magento-store": "4.2.10",
|
|
28
|
+
"@graphcommerce/next-ui": "4.9.0",
|
|
29
|
+
"@graphcommerce/react-hook-form": "3.2.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@lingui/react": "^3.13.2",
|
|
33
33
|
"@lingui/core": "^3.13.2",
|
|
34
34
|
"@mui/material": "5.5.3",
|
|
35
35
|
"framer-motion": "^6.2.4",
|
|
36
|
-
"next": "12.1.2",
|
|
36
|
+
"next": "^12.1.2",
|
|
37
37
|
"react": "^17.0.1",
|
|
38
38
|
"react-dom": "^17.0.1"
|
|
39
39
|
}
|