@graphcommerce/magento-product 4.13.2-canary.1 → 4.13.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
@@ -1,12 +1,8 @@
1
1
  # Change Log
2
2
 
3
- ## 4.13.2-canary.1
3
+ ## 4.13.3
4
4
 
5
- ### Patch Changes
6
-
7
- - [#1722](https://github.com/graphcommerce-org/graphcommerce/pull/1722) [`7b36ea1d1`](https://github.com/graphcommerce-org/graphcommerce/commit/7b36ea1d100239892f21f67e5606852dd29b7c75) Thanks [@FrankHarland](https://github.com/FrankHarland)! - Feature/fix cross sell item
8
-
9
- ## 4.13.2-canary.0
5
+ ## 4.13.2
10
6
 
11
7
  ## 4.13.1
12
8
 
@@ -50,13 +50,17 @@ declare module '@mui/material/styles/components' {
50
50
  * - Redirects the user to the cart/checkout/added page after successful submission.
51
51
  */
52
52
  export function AddProductsToCartForm(props: AddProductsToCartFormProps) {
53
- let { children, redirect, onComplete, sx, errorSnackbar, successSnackbar, ...formProps } =
54
- useThemeProps({ name, props })
53
+ const {
54
+ children,
55
+ redirect = 'cart',
56
+ onComplete,
57
+ sx,
58
+ errorSnackbar,
59
+ successSnackbar,
60
+ ...formProps
61
+ } = useThemeProps({ name, props })
55
62
  const router = useRouter()
56
63
 
57
- if (typeof redirect !== 'undefined' && redirect !== 'added' && router.pathname === redirect)
58
- redirect = undefined
59
-
60
64
  const form = useFormGqlMutationCart<
61
65
  AddProductsToCartMutation,
62
66
  AddProductsToCartMutationVariables
@@ -86,15 +90,9 @@ export function AddProductsToCartForm(props: AddProductsToCartFormProps) {
86
90
  if (result.data?.addProductsToCart?.user_errors?.length || result.errors?.length || !redirect)
87
91
  return
88
92
 
89
- if (redirect === 'added') {
90
- const method = router.pathname.startsWith('/checkout/added') ? router.replace : router.push
91
- await method({
92
- pathname: '/checkout/added',
93
- query: { sku: variables.cartItems.map((i) => i.sku) },
94
- })
95
- } else {
96
- await router.push({ pathname: redirect })
97
- }
93
+ if (redirect === 'checkout') await router.push('/checkout')
94
+ if (redirect === 'added') await router.push({ pathname: '/checkout/added' })
95
+ if (redirect === 'cart') await router.push({ pathname: '/cart' })
98
96
  },
99
97
  })
100
98
 
@@ -1,12 +1,11 @@
1
1
  import { UseFormGqlMutationReturn } from '@graphcommerce/ecommerce-ui'
2
2
  import { createContext, useContext } from 'react'
3
- import type { LiteralUnion } from 'type-fest'
4
3
  import {
5
4
  AddProductsToCartMutation,
6
5
  AddProductsToCartMutationVariables,
7
6
  } from './AddProductsToCart.gql'
8
7
 
9
- export type RedirectType = LiteralUnion<'added' | undefined, `/${string}`>
8
+ export type RedirectType = 'added' | 'cart' | 'checkout' | undefined
10
9
 
11
10
  export type AddProductsToCartContextType = { redirect: RedirectType } & UseFormGqlMutationReturn<
12
11
  AddProductsToCartMutation,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-product",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "4.13.2-canary.1",
5
+ "version": "4.13.3",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -19,15 +19,15 @@
19
19
  "type-fest": "^2.12.2"
20
20
  },
21
21
  "dependencies": {
22
- "@graphcommerce/ecommerce-ui": "4.31.0-canary.0",
23
- "@graphcommerce/framer-scroller": "4.31.0-canary.0",
24
- "@graphcommerce/framer-next-pages": "4.31.0-canary.0",
25
- "@graphcommerce/graphql": "4.31.0-canary.0",
26
- "@graphcommerce/graphql-mesh": "4.31.0-canary.0",
27
- "@graphcommerce/image": "4.31.0-canary.0",
28
- "@graphcommerce/magento-cart": "4.13.2-canary.1",
29
- "@graphcommerce/magento-store": "4.13.2-canary.1",
30
- "@graphcommerce/next-ui": "4.31.0-canary.0",
22
+ "@graphcommerce/ecommerce-ui": "4.30.2",
23
+ "@graphcommerce/framer-scroller": "4.30.2",
24
+ "@graphcommerce/framer-next-pages": "4.30.2",
25
+ "@graphcommerce/graphql": "4.30.2",
26
+ "@graphcommerce/graphql-mesh": "4.30.2",
27
+ "@graphcommerce/image": "4.30.2",
28
+ "@graphcommerce/magento-cart": "4.13.3",
29
+ "@graphcommerce/magento-store": "4.13.3",
30
+ "@graphcommerce/next-ui": "4.30.2",
31
31
  "schema-dts": "^1.1.0"
32
32
  },
33
33
  "peerDependencies": {