@graphcommerce/magento-cart-shipping-method 4.13.2 → 4.14.0-canary.10

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
@@ -1,6 +1,26 @@
1
1
  # Change Log
2
2
 
3
- ## 4.13.2
3
+ ## 4.14.0-canary.10
4
+
5
+ ## 4.14.0-canary.9
6
+
7
+ ## 4.14.0-canary.8
8
+
9
+ ## 4.14.0-canary.7
10
+
11
+ ## 4.14.0-canary.6
12
+
13
+ ## 4.14.0-canary.5
14
+
15
+ ## 4.14.0-canary.4
16
+
17
+ ## 4.14.0-canary.3
18
+
19
+ ## 4.14.0-canary.2
20
+
21
+ ## 4.13.2-canary.1
22
+
23
+ ## 4.13.2-canary.0
4
24
 
5
25
  ## 4.13.1
6
26
 
@@ -15,6 +15,7 @@ import {
15
15
  useFormAutoSubmit,
16
16
  useFormCompose,
17
17
  UseFormComposeOptions,
18
+ UseFormGraphQlOptions,
18
19
  useFormPersist,
19
20
  useWatch,
20
21
  } from '@graphcommerce/react-hook-form'
@@ -33,14 +34,17 @@ import {
33
34
  export type ShippingMethodFormProps = Pick<UseFormComposeOptions, 'step'> & {
34
35
  sx?: SxProps<Theme>
35
36
  children?: React.ReactNode
36
- }
37
+ } & UseFormGraphQlOptions<
38
+ ShippingMethodFormMutation,
39
+ ShippingMethodFormMutationVariables & { carrierMethod?: string }
40
+ >
37
41
 
38
42
  function notEmpty<TValue>(value: TValue | null | undefined): value is TValue {
39
43
  return value !== null && value !== undefined
40
44
  }
41
45
 
42
46
  export function ShippingMethodForm(props: ShippingMethodFormProps) {
43
- const { step, sx, children } = props
47
+ const { step, sx, children, onBeforeSubmit = (vars) => vars, ...options } = props
44
48
  const { data: cartQuery, loading } = useCartQuery(GetShippingMethodsDocument)
45
49
  const availableMethods = (
46
50
  cartQuery?.cart?.shipping_addresses?.[0]?.available_shipping_methods ?? []
@@ -78,8 +82,9 @@ export function ShippingMethodForm(props: ShippingMethodFormProps) {
78
82
  defaultValues: { carrierMethod },
79
83
  onBeforeSubmit: (variables) => {
80
84
  const [carrier, method] = (variables.carrierMethod ?? '').split('-')
81
- return { ...variables, carrier, method }
85
+ return onBeforeSubmit({ ...variables, carrier, method })
82
86
  },
87
+ ...options,
83
88
  })
84
89
 
85
90
  const { handleSubmit, control, error } = form
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-cart-shipping-method",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "4.13.2",
5
+ "version": "4.14.0-canary.10",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -19,14 +19,14 @@
19
19
  "type-fest": "^2.12.2"
20
20
  },
21
21
  "dependencies": {
22
- "@graphcommerce/framer-scroller": "4.30.1",
23
- "@graphcommerce/graphql": "4.30.1",
24
- "@graphcommerce/image": "4.30.1",
25
- "@graphcommerce/magento-cart": "4.13.2",
26
- "@graphcommerce/magento-cart-shipping-address": "4.13.2",
27
- "@graphcommerce/magento-store": "4.13.2",
28
- "@graphcommerce/next-ui": "4.30.1",
29
- "@graphcommerce/react-hook-form": "4.30.1"
22
+ "@graphcommerce/framer-scroller": "4.31.0-canary.6",
23
+ "@graphcommerce/graphql": "4.31.0-canary.6",
24
+ "@graphcommerce/image": "4.31.0-canary.6",
25
+ "@graphcommerce/magento-cart": "4.14.0-canary.10",
26
+ "@graphcommerce/magento-cart-shipping-address": "4.14.0-canary.10",
27
+ "@graphcommerce/magento-store": "4.14.0-canary.10",
28
+ "@graphcommerce/next-ui": "4.31.0-canary.6",
29
+ "@graphcommerce/react-hook-form": "4.31.0-canary.6"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@lingui/react": "^3.13.2",