@graphcommerce/magento-cart-payment-method 3.1.16 → 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.
@@ -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: PaymentMethodContextFragment,
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,51 @@
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
+
22
+ ## 3.1.19
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [[`0ab7c5465`](https://github.com/graphcommerce-org/graphcommerce/commit/0ab7c5465441cba9bf8cd185a6790ce2f443f4ed)]:
27
+ - @graphcommerce/framer-scroller@2.1.15
28
+ - @graphcommerce/next-ui@4.8.4
29
+ - @graphcommerce/magento-cart@4.4.2
30
+ - @graphcommerce/magento-store@4.2.9
31
+
32
+ ## 3.1.18
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies [[`d205b037f`](https://github.com/graphcommerce-org/graphcommerce/commit/d205b037fee82b8c03993f2c586f477e826093bf)]:
37
+ - @graphcommerce/magento-cart@4.4.1
38
+
39
+ ## 3.1.17
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [[`ffec8800a`](https://github.com/graphcommerce-org/graphcommerce/commit/ffec8800a50ff2fe9b9fc5feeb5a0a878b573f0e), [`bed806ddd`](https://github.com/graphcommerce-org/graphcommerce/commit/bed806dddd7e025806a69798ef9587aa165d392f)]:
44
+ - @graphcommerce/react-hook-form@3.2.1
45
+ - @graphcommerce/graphql@3.2.0
46
+ - @graphcommerce/magento-cart@4.4.0
47
+ - @graphcommerce/magento-store@4.2.8
48
+
3
49
  ## 3.1.16
4
50
 
5
51
  ### 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 { PaymentMethod, PaymentMethodModules, PaymentModule } from '../Api/PaymentMethod'
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.1.16",
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.7",
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.24",
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.14",
24
- "@graphcommerce/graphql": "3.1.3",
25
- "@graphcommerce/image": "3.1.6",
26
- "@graphcommerce/magento-cart": "4.3.4",
27
- "@graphcommerce/magento-store": "4.2.7",
28
- "@graphcommerce/next-ui": "4.8.3",
29
- "@graphcommerce/react-hook-form": "3.2.0"
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
  }