@graphcommerce/magento-cart 4.8.7 → 4.9.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/Api/CartItemCountChanged.graphql +9 -0
- package/CHANGELOG.md +33 -0
- package/components/CartAdded/CartAdded.graphql +5 -0
- package/components/CartAdded/Crosssells.graphql +15 -0
- package/components/CartAdded/index.ts +2 -0
- package/components/CartStartCheckout/CartStartCheckout.graphql +1 -1
- package/components/CartStartCheckout/CartStartCheckout.tsx +2 -1
- package/components/CartSummary/CartSummary.graphql +2 -0
- package/components/CartSummary/CartSummary.tsx +51 -51
- package/components/index.ts +2 -0
- package/hooks/useCurrentCartId.ts +6 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`e76df6dc3`](https://github.com/graphcommerce-org/graphcommerce/commit/e76df6dc37c11c793a5d008ba36932d17dc23855), [`0bd9ea582`](https://github.com/graphcommerce-org/graphcommerce/commit/0bd9ea58230dde79c5fe2cdb07e9860151460270)]:
|
|
8
|
+
- @graphcommerce/next-ui@4.29.0
|
|
9
|
+
- @graphcommerce/ecommerce-ui@1.5.5
|
|
10
|
+
- @graphcommerce/framer-scroller@2.1.42
|
|
11
|
+
- @graphcommerce/magento-customer@4.12.1
|
|
12
|
+
- @graphcommerce/magento-store@4.3.3
|
|
13
|
+
|
|
14
|
+
## 4.9.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- [#1675](https://github.com/graphcommerce-org/graphcommerce/pull/1675) [`1b1504c9b`](https://github.com/graphcommerce-org/graphcommerce/commit/1b1504c9b0e51f2787bce91e1ff1940f540411d6) Thanks [@paales](https://github.com/paales)! - Added crosssel functionality
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#1655](https://github.com/graphcommerce-org/graphcommerce/pull/1655) [`3dde492ad`](https://github.com/graphcommerce-org/graphcommerce/commit/3dde492ad3a49d96481eeb7453fb305d0017b1a5) Thanks [@FrankHarland](https://github.com/FrankHarland)! - Added Google Analytics support.
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [[`9e630670f`](https://github.com/graphcommerce-org/graphcommerce/commit/9e630670ff6c952ab7b938d890b5509804985cf3), [`cf3518499`](https://github.com/graphcommerce-org/graphcommerce/commit/cf351849999ad6fe73ce2bb258098a7dd301d517), [`81f31d1e5`](https://github.com/graphcommerce-org/graphcommerce/commit/81f31d1e54397368088a4289aaddd29facfceeef), [`2e9fa5984`](https://github.com/graphcommerce-org/graphcommerce/commit/2e9fa5984a07ff14fc1b3a4f62189a26e8e3ecdd), [`adf13069a`](https://github.com/graphcommerce-org/graphcommerce/commit/adf13069af6460c960276b402237371c12fc6dec), [`a8905d263`](https://github.com/graphcommerce-org/graphcommerce/commit/a8905d263273cb9322583d5759a5fdc66eceb8e4), [`1b1504c9b`](https://github.com/graphcommerce-org/graphcommerce/commit/1b1504c9b0e51f2787bce91e1ff1940f540411d6), [`8a34f8081`](https://github.com/graphcommerce-org/graphcommerce/commit/8a34f808186274a6fe1d4f309472f1a9c6d00efd), [`6c2e27b1b`](https://github.com/graphcommerce-org/graphcommerce/commit/6c2e27b1be4aaa888e65a2bd69eaeb467a54a023), [`3dde492ad`](https://github.com/graphcommerce-org/graphcommerce/commit/3dde492ad3a49d96481eeb7453fb305d0017b1a5)]:
|
|
25
|
+
- @graphcommerce/next-ui@4.28.1
|
|
26
|
+
- @graphcommerce/graphql@3.5.0
|
|
27
|
+
- @graphcommerce/framer-scroller@2.1.41
|
|
28
|
+
- @graphcommerce/framer-utils@3.2.1
|
|
29
|
+
- @graphcommerce/magento-customer@4.12.0
|
|
30
|
+
- @graphcommerce/ecommerce-ui@1.5.4
|
|
31
|
+
- @graphcommerce/magento-store@4.3.2
|
|
32
|
+
- @graphcommerce/magento-graphql@3.1.9
|
|
33
|
+
- @graphcommerce/framer-next-pages@3.3.2
|
|
34
|
+
- @graphcommerce/image@3.1.10
|
|
35
|
+
|
|
3
36
|
## 4.8.7
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
query Crosssells(
|
|
2
|
+
$pageSize: Int = 8
|
|
3
|
+
$currentPage: Int = 1
|
|
4
|
+
$filters: ProductAttributeFilterInput = {}
|
|
5
|
+
) {
|
|
6
|
+
products(pageSize: $pageSize, currentPage: $currentPage, filter: $filters) {
|
|
7
|
+
items {
|
|
8
|
+
__typename
|
|
9
|
+
uid
|
|
10
|
+
crosssell_products {
|
|
11
|
+
...ProductListItem
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -21,7 +21,7 @@ const parts = [
|
|
|
21
21
|
const { classes } = extendableComponent(name, parts)
|
|
22
22
|
|
|
23
23
|
export function CartStartCheckout(props: CartStartCheckoutProps) {
|
|
24
|
-
const { prices, children, sx = []
|
|
24
|
+
const { prices, children, buttonProps, sx = [] } = props
|
|
25
25
|
|
|
26
26
|
const hasTotals = (prices?.grand_total?.value ?? 0) > 0
|
|
27
27
|
return (
|
|
@@ -37,6 +37,7 @@ export function CartStartCheckout(props: CartStartCheckoutProps) {
|
|
|
37
37
|
>
|
|
38
38
|
<PageLink href='/checkout' passHref>
|
|
39
39
|
<Button
|
|
40
|
+
href='/checkout'
|
|
40
41
|
id='cart-start-checkout'
|
|
41
42
|
variant='pill'
|
|
42
43
|
color='secondary'
|
|
@@ -29,7 +29,7 @@ export function CartSummary(props: CartSummaryProps) {
|
|
|
29
29
|
|
|
30
30
|
if (!data?.cart) return null
|
|
31
31
|
|
|
32
|
-
const { email, shipping_addresses, billing_address } = data.cart
|
|
32
|
+
const { email, shipping_addresses, billing_address, is_virtual } = data.cart
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
35
|
<Box
|
|
@@ -93,61 +93,61 @@ export function CartSummary(props: CartSummaryProps) {
|
|
|
93
93
|
/>
|
|
94
94
|
<Typography variant='body1'>{email || ''}</Typography>
|
|
95
95
|
</Box>
|
|
96
|
+
{!is_virtual && (
|
|
97
|
+
<Box>
|
|
98
|
+
<SectionContainer
|
|
99
|
+
variantLeft='h5'
|
|
100
|
+
labelLeft={<Trans id='Shipping method' />}
|
|
101
|
+
sx={{ '& .SectionHeader-root': { marginTop: 0, paddingBottom: '8px' } }}
|
|
102
|
+
/>
|
|
103
|
+
<Typography variant='body1'>
|
|
104
|
+
{shipping_addresses?.[0]?.selected_shipping_method?.carrier_title}
|
|
105
|
+
{shipping_addresses?.[0]?.selected_shipping_method?.method_title}
|
|
106
|
+
</Typography>
|
|
107
|
+
</Box>
|
|
108
|
+
)}
|
|
109
|
+
{!is_virtual && shipping_addresses && (
|
|
110
|
+
<Box>
|
|
111
|
+
<SectionContainer
|
|
112
|
+
variantLeft='h5'
|
|
113
|
+
labelLeft={<Trans id='Shipping address' />}
|
|
114
|
+
sx={{ '& .SectionHeader-root': { marginTop: 0, paddingBottom: '8px' } }}
|
|
115
|
+
labelRight={
|
|
116
|
+
editable ? (
|
|
117
|
+
<PageLink href={historyHref} passHref>
|
|
118
|
+
<Link
|
|
119
|
+
color='secondary'
|
|
120
|
+
variant='body2'
|
|
121
|
+
onClick={historyOnClick}
|
|
122
|
+
underline='hover'
|
|
123
|
+
>
|
|
124
|
+
<Trans id='Edit' />
|
|
125
|
+
</Link>
|
|
126
|
+
</PageLink>
|
|
127
|
+
) : undefined
|
|
128
|
+
}
|
|
129
|
+
/>
|
|
130
|
+
<CartAddressMultiLine {...shipping_addresses[0]} />
|
|
131
|
+
</Box>
|
|
132
|
+
)}
|
|
96
133
|
<Box>
|
|
97
134
|
<SectionContainer
|
|
98
135
|
variantLeft='h5'
|
|
99
|
-
labelLeft={<Trans id='
|
|
136
|
+
labelLeft={<Trans id='Billing address' />}
|
|
100
137
|
sx={{ '& .SectionHeader-root': { marginTop: 0, paddingBottom: '8px' } }}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
138
|
+
labelRight={
|
|
139
|
+
editable ? (
|
|
140
|
+
<PageLink href='/checkout/edit/billing-address' passHref>
|
|
141
|
+
<Link color='secondary' variant='body2' underline='hover'>
|
|
142
|
+
<Trans id='Edit' />
|
|
143
|
+
</Link>
|
|
144
|
+
</PageLink>
|
|
145
|
+
) : undefined
|
|
146
|
+
}
|
|
147
|
+
>
|
|
148
|
+
<CartAddressMultiLine {...billing_address} />
|
|
149
|
+
</SectionContainer>
|
|
106
150
|
</Box>
|
|
107
|
-
{shipping_addresses && (
|
|
108
|
-
<>
|
|
109
|
-
<Box>
|
|
110
|
-
<SectionContainer
|
|
111
|
-
variantLeft='h5'
|
|
112
|
-
labelLeft={<Trans id='Shipping address' />}
|
|
113
|
-
sx={{ '& .SectionHeader': { marginTop: 0, paddingBottom: '8px' } }}
|
|
114
|
-
labelRight={
|
|
115
|
-
editable ? (
|
|
116
|
-
<PageLink href={historyHref} passHref>
|
|
117
|
-
<Link
|
|
118
|
-
color='secondary'
|
|
119
|
-
variant='body2'
|
|
120
|
-
onClick={historyOnClick}
|
|
121
|
-
underline='hover'
|
|
122
|
-
>
|
|
123
|
-
<Trans id='Edit' />
|
|
124
|
-
</Link>
|
|
125
|
-
</PageLink>
|
|
126
|
-
) : undefined
|
|
127
|
-
}
|
|
128
|
-
/>
|
|
129
|
-
<CartAddressMultiLine {...shipping_addresses[0]} />
|
|
130
|
-
</Box>
|
|
131
|
-
<Box>
|
|
132
|
-
<SectionContainer
|
|
133
|
-
variantLeft='h5'
|
|
134
|
-
labelLeft={<Trans id='Billing address' />}
|
|
135
|
-
sx={{ '& .SectionHeader': { marginTop: 0, paddingBottom: '8px' } }}
|
|
136
|
-
labelRight={
|
|
137
|
-
editable ? (
|
|
138
|
-
<PageLink href='/checkout/edit/billing-address' passHref>
|
|
139
|
-
<Link color='secondary' variant='body2' underline='hover'>
|
|
140
|
-
<Trans id='Edit' />
|
|
141
|
-
</Link>
|
|
142
|
-
</PageLink>
|
|
143
|
-
) : undefined
|
|
144
|
-
}
|
|
145
|
-
>
|
|
146
|
-
<CartAddressMultiLine {...billing_address} />
|
|
147
|
-
</SectionContainer>
|
|
148
|
-
</Box>
|
|
149
|
-
</>
|
|
150
|
-
)}
|
|
151
151
|
</Box>
|
|
152
152
|
{children}
|
|
153
153
|
</Box>
|
package/components/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './ApolloCartError'
|
|
2
|
+
export * from './CartAdded'
|
|
2
3
|
export * from './CartAddressMultiLine/CartAddressMultiLine'
|
|
3
4
|
export * from './CartAddressSingleLine/CartAddressSingleLine'
|
|
4
5
|
export * from './CartAgreementsForm/CartAgreements.gql'
|
|
@@ -7,6 +8,7 @@ export * from './CartFab/CartFab'
|
|
|
7
8
|
export * from './CartItemSummary/CartItemSummary'
|
|
8
9
|
export * from './CartStartCheckout/CartStartCheckout'
|
|
9
10
|
export * from './CartSummary/CartSummary'
|
|
11
|
+
export * from './CartSummary/CartSummary.gql'
|
|
10
12
|
export * from './CartTotals/CartTotals'
|
|
11
13
|
export * from './EmptyCart/EmptyCart'
|
|
12
14
|
export * from './InlineAccount/InlineAccount'
|
|
@@ -12,7 +12,12 @@ type UseCurrentCartIdOptions<Q, V> = QueryHookOptions<
|
|
|
12
12
|
export function useCurrentCartId<Q, V>(options: UseCurrentCartIdOptions<Q, V> = {}) {
|
|
13
13
|
const { hydration = false, ...queryOptions } = options
|
|
14
14
|
const [hydrating, setHydrating] = useState(!hydration)
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
useIsomorphicLayoutEffect(() => {
|
|
17
|
+
if (!hydrating) return
|
|
18
|
+
startTransition(() => setHydrating(false))
|
|
19
|
+
}, [hydrating])
|
|
20
|
+
|
|
16
21
|
const skip = options.skip !== undefined ? options.skip : hydrating
|
|
17
22
|
|
|
18
23
|
const { data, ...queryResults } = useQuery(CurrentCartIdDocument, { ...queryOptions, skip })
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-cart",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "4.
|
|
5
|
+
"version": "4.9.1",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
"@playwright/test": "^1.21.1"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@graphcommerce/ecommerce-ui": "1.5.
|
|
22
|
-
"@graphcommerce/framer-utils": "3.2.
|
|
23
|
-
"@graphcommerce/framer-next-pages": "3.3.
|
|
24
|
-
"@graphcommerce/framer-scroller": "2.1.
|
|
25
|
-
"@graphcommerce/graphql": "3.
|
|
26
|
-
"@graphcommerce/image": "3.1.
|
|
27
|
-
"@graphcommerce/magento-customer": "4.
|
|
28
|
-
"@graphcommerce/magento-graphql": "3.1.
|
|
29
|
-
"@graphcommerce/magento-store": "4.3.
|
|
30
|
-
"@graphcommerce/next-ui": "4.
|
|
21
|
+
"@graphcommerce/ecommerce-ui": "1.5.5",
|
|
22
|
+
"@graphcommerce/framer-utils": "3.2.1",
|
|
23
|
+
"@graphcommerce/framer-next-pages": "3.3.2",
|
|
24
|
+
"@graphcommerce/framer-scroller": "2.1.42",
|
|
25
|
+
"@graphcommerce/graphql": "3.5.0",
|
|
26
|
+
"@graphcommerce/image": "3.1.10",
|
|
27
|
+
"@graphcommerce/magento-customer": "4.12.1",
|
|
28
|
+
"@graphcommerce/magento-graphql": "3.1.9",
|
|
29
|
+
"@graphcommerce/magento-store": "4.3.3",
|
|
30
|
+
"@graphcommerce/next-ui": "4.29.0",
|
|
31
31
|
"@graphcommerce/react-hook-form": "3.3.5"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|