@graphcommerce/magento-cart-shipping-method 9.0.3 → 9.0.4-canary.1

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,8 +1,8 @@
1
1
  # Change Log
2
2
 
3
- ## 9.0.3
3
+ ## 9.0.4-canary.1
4
4
 
5
- ## 9.0.3-canary.0
5
+ ## 9.0.4-canary.0
6
6
 
7
7
  ## 9.0.2
8
8
 
@@ -10,16 +10,6 @@
10
10
 
11
11
  - [`6b28b60`](https://github.com/graphcommerce-org/graphcommerce/commit/6b28b60db3f4d58b346275dfb8bcbb85744861b9) - Make sure we are correctly selecting the shipping method form when a user selects a previously selected method again. ([@paales](https://github.com/paales))
12
12
 
13
- ## 9.0.2-canary.0
14
-
15
- ### Patch Changes
16
-
17
- - [`6b28b60`](https://github.com/graphcommerce-org/graphcommerce/commit/6b28b60db3f4d58b346275dfb8bcbb85744861b9) - Make sure we are correctly selecting the shipping method form when a user selects a previously selected method again. ([@paales](https://github.com/paales))
18
-
19
- ## 9.0.1
20
-
21
- ## 9.0.1-canary.1
22
-
23
13
  ## 9.0.0
24
14
 
25
15
  ### Major Changes
@@ -25,13 +25,12 @@ import type {
25
25
  } from './ShippingMethodForm.gql'
26
26
  import { ShippingMethodFormDocument } from './ShippingMethodForm.gql'
27
27
 
28
+ type ShippingMethodFormValues = ShippingMethodFormMutationVariables & { carrierMethod?: string }
29
+
28
30
  export type ShippingMethodFormProps = Pick<UseFormComposeOptions, 'step'> & {
29
31
  sx?: SxProps<Theme>
30
32
  children?: React.ReactNode
31
- } & UseFormGraphQlOptions<
32
- ShippingMethodFormMutation,
33
- ShippingMethodFormMutationVariables & { carrierMethod?: string }
34
- >
33
+ } & UseFormGraphQlOptions<ShippingMethodFormMutation, ShippingMethodFormValues>
35
34
 
36
35
  function notEmpty<TValue>(value: TValue | null | undefined): value is TValue {
37
36
  return value !== null && value !== undefined
@@ -68,17 +67,17 @@ export function ShippingMethodForm(props: ShippingMethodFormProps) {
68
67
  ? `${selectedMethod.carrier_code}-${selectedMethod.method_code}`
69
68
  : undefined
70
69
 
71
- const form = useFormGqlMutationCart<
72
- ShippingMethodFormMutation,
73
- ShippingMethodFormMutationVariables & { carrierMethod?: string }
74
- >(ShippingMethodFormDocument, {
75
- defaultValues: { carrierMethod },
76
- onBeforeSubmit: (variables) => {
77
- const [carrier, method] = (variables.carrierMethod ?? '').split('-')
78
- return onBeforeSubmit({ ...variables, carrier, method })
70
+ const form = useFormGqlMutationCart<ShippingMethodFormMutation, ShippingMethodFormValues>(
71
+ ShippingMethodFormDocument,
72
+ {
73
+ defaultValues: { carrierMethod },
74
+ onBeforeSubmit: (variables) => {
75
+ const [carrier, method] = (variables.carrierMethod ?? '').split('-')
76
+ return onBeforeSubmit({ ...variables, carrier, method })
77
+ },
78
+ ...options,
79
79
  },
80
- ...options,
81
- })
80
+ )
82
81
 
83
82
  const { handleSubmit, control, error, setValue } = form
84
83
  const submit = handleSubmit(() => {})
@@ -114,7 +113,7 @@ export function ShippingMethodForm(props: ShippingMethodFormProps) {
114
113
  }, [shippingAddress, firstCarrierMethod, carrierMethod, setValue])
115
114
 
116
115
  return (
117
- <FormProvider {...form}>
116
+ <FormProvider<ShippingMethodFormValues> {...form}>
118
117
  <FormAutoSubmit
119
118
  control={control}
120
119
  submit={submit}
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": "9.0.3",
5
+ "version": "9.0.4-canary.1",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,18 +12,18 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/ecommerce-ui": "^9.0.3",
16
- "@graphcommerce/eslint-config-pwa": "^9.0.3",
17
- "@graphcommerce/framer-scroller": "^9.0.3",
18
- "@graphcommerce/graphql": "^9.0.3",
19
- "@graphcommerce/image": "^9.0.3",
20
- "@graphcommerce/magento-cart": "^9.0.3",
21
- "@graphcommerce/magento-cart-shipping-address": "^9.0.3",
22
- "@graphcommerce/magento-store": "^9.0.3",
23
- "@graphcommerce/next-ui": "^9.0.3",
24
- "@graphcommerce/prettier-config-pwa": "^9.0.3",
25
- "@graphcommerce/react-hook-form": "^9.0.3",
26
- "@graphcommerce/typescript-config-pwa": "^9.0.3",
15
+ "@graphcommerce/ecommerce-ui": "^9.0.4-canary.1",
16
+ "@graphcommerce/eslint-config-pwa": "^9.0.4-canary.1",
17
+ "@graphcommerce/framer-scroller": "^9.0.4-canary.1",
18
+ "@graphcommerce/graphql": "^9.0.4-canary.1",
19
+ "@graphcommerce/image": "^9.0.4-canary.1",
20
+ "@graphcommerce/magento-cart": "^9.0.4-canary.1",
21
+ "@graphcommerce/magento-cart-shipping-address": "^9.0.4-canary.1",
22
+ "@graphcommerce/magento-store": "^9.0.4-canary.1",
23
+ "@graphcommerce/next-ui": "^9.0.4-canary.1",
24
+ "@graphcommerce/prettier-config-pwa": "^9.0.4-canary.1",
25
+ "@graphcommerce/react-hook-form": "^9.0.4-canary.1",
26
+ "@graphcommerce/typescript-config-pwa": "^9.0.4-canary.1",
27
27
  "@lingui/core": "^4.2.1",
28
28
  "@lingui/macro": "^4.2.1",
29
29
  "@lingui/react": "^4.2.1",