@graphcommerce/magento-cart 4.3.1 → 4.3.2

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,5 +1,20 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1485](https://github.com/graphcommerce-org/graphcommerce/pull/1485) [`d6262de71`](https://github.com/graphcommerce-org/graphcommerce/commit/d6262de71d2254a2b0b492e1a60f9e141767470e) Thanks [@paales](https://github.com/paales)! - move to useCustomerSession instead of using the tokenquery directly and fix ssr issues
8
+
9
+ * [#1483](https://github.com/graphcommerce-org/graphcommerce/pull/1483) [`e3005fe63`](https://github.com/graphcommerce-org/graphcommerce/commit/e3005fe6306093d47b08c6756c21c8175649e30b) Thanks [@FrankHarland](https://github.com/FrankHarland)! - actually apply sx prop on cartsummary
10
+
11
+ * Updated dependencies [[`d6262de71`](https://github.com/graphcommerce-org/graphcommerce/commit/d6262de71d2254a2b0b492e1a60f9e141767470e), [`c8c246b8a`](https://github.com/graphcommerce-org/graphcommerce/commit/c8c246b8aaab0621b68a2fca2a1c529a56fad962)]:
12
+ - @graphcommerce/magento-customer@4.4.0
13
+ - @graphcommerce/next-ui@4.8.2
14
+ - @graphcommerce/ecommerce-ui@1.0.14
15
+ - @graphcommerce/framer-scroller@2.1.13
16
+ - @graphcommerce/magento-store@4.2.6
17
+
3
18
  ## 4.3.1
4
19
 
5
20
  ### Patch Changes
@@ -1,6 +1,5 @@
1
1
  import { useHistoryLink } from '@graphcommerce/framer-next-pages'
2
2
  import { SectionContainer, extendableComponent } from '@graphcommerce/next-ui'
3
- import { i18n } from '@lingui/core'
4
3
  import { Trans } from '@lingui/react'
5
4
  import { Box, Link, SxProps, Theme, Typography } from '@mui/material'
6
5
  import PageLink from 'next/link'
@@ -21,7 +20,7 @@ const parts = ['root', 'detailsContainer', 'sectionHeaderWrapper'] as const
21
20
  const { classes } = extendableComponent<OwnerState, typeof compName, typeof parts>(compName, parts)
22
21
 
23
22
  export function CartSummary(props: CartSummaryProps) {
24
- const { children, editable } = props
23
+ const { children, editable, sx = [] } = props
25
24
 
26
25
  const { data } = useCartQuery(GetCartSummaryDocument, { allowUrl: true })
27
26
  const { href: historyHref, onClick: historyOnClick } = useHistoryLink({
@@ -35,12 +34,15 @@ export function CartSummary(props: CartSummaryProps) {
35
34
  return (
36
35
  <Box
37
36
  className={classes.root}
38
- sx={(theme) => ({
39
- margin: `${theme.spacings.sm} 0`,
40
- '& div:last-of-type': {
41
- borderRadius: '0 0 4px 4px',
42
- },
43
- })}
37
+ sx={[
38
+ (theme) => ({
39
+ margin: `${theme.spacings.sm} 0`,
40
+ '& div:last-of-type': {
41
+ borderRadius: '0 0 4px 4px',
42
+ },
43
+ }),
44
+ ...(Array.isArray(sx) ? sx : [sx]),
45
+ ]}
44
46
  >
45
47
  <Box
46
48
  className={classes.detailsContainer}
@@ -1,8 +1,8 @@
1
1
  import { useQuery } from '@graphcommerce/graphql'
2
2
  import {
3
3
  SignUpFormInline,
4
- CustomerTokenDocument,
5
4
  IsEmailAvailableDocument,
5
+ useCustomerSession,
6
6
  } from '@graphcommerce/magento-customer'
7
7
  import { Button, FormRow, extendableComponent } from '@graphcommerce/next-ui'
8
8
  import { Trans } from '@lingui/react'
@@ -30,15 +30,12 @@ export function InlineAccount(props: InlineAccountProps) {
30
30
  const { loading, data } = useCartQuery(InlineAccountDocument)
31
31
  const cart = data?.cart
32
32
 
33
- const { data: customerTokenData } = useQuery(CustomerTokenDocument)
33
+ const { loggedIn } = useCustomerSession()
34
34
  const { data: isEmailAvailableData } = useQuery(IsEmailAvailableDocument, {
35
35
  variables: { email: cart?.email ?? '' },
36
36
  })
37
37
 
38
38
  const { firstname, lastname } = cart?.shipping_addresses?.[0] ?? {}
39
- const signedIn = Boolean(
40
- customerTokenData?.customerToken && customerTokenData?.customerToken.valid,
41
- )
42
39
  const canSignUp = isEmailAvailableData?.isEmailAvailable?.is_email_available === true
43
40
 
44
41
  if (!canSignUp) return null
@@ -56,7 +53,7 @@ export function InlineAccount(props: InlineAccountProps) {
56
53
  ...(Array.isArray(sx) ? sx : [sx]),
57
54
  ]}
58
55
  >
59
- {!signedIn && canSignUp && (
56
+ {!loggedIn && canSignUp && (
60
57
  <>
61
58
  <Box
62
59
  className={classes.innerContainer}
@@ -118,7 +115,7 @@ export function InlineAccount(props: InlineAccountProps) {
118
115
  </>
119
116
  )}
120
117
 
121
- {signedIn && (
118
+ {loggedIn && (
122
119
  <Box className={classes.innerContainer}>
123
120
  <div>
124
121
  <Typography variant='h4' className={classes.title}>
@@ -1,9 +1,5 @@
1
1
  import { useMutation, useQuery } from '@graphcommerce/graphql'
2
- import {
3
- CustomerTokenDocument,
4
- useCustomerSession,
5
- useExtractCustomerErrors,
6
- } from '@graphcommerce/magento-customer'
2
+ import { useCustomerSession, useExtractCustomerErrors } from '@graphcommerce/magento-customer'
7
3
  import { useEffect } from 'react'
8
4
  import { CustomerCartDocument } from './CustomerCart.gql'
9
5
  import { UseMergeCustomerCartDocument } from './UseMergeCustomerCart.gql'
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.3.1",
5
+ "version": "4.3.2",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -18,15 +18,15 @@
18
18
  "@playwright/test": "^1.21.1"
19
19
  },
20
20
  "dependencies": {
21
- "@graphcommerce/ecommerce-ui": "1.0.13",
21
+ "@graphcommerce/ecommerce-ui": "1.0.14",
22
22
  "@graphcommerce/framer-next-pages": "3.2.2",
23
- "@graphcommerce/framer-scroller": "2.1.12",
23
+ "@graphcommerce/framer-scroller": "2.1.13",
24
24
  "@graphcommerce/graphql": "3.1.3",
25
25
  "@graphcommerce/image": "3.1.6",
26
- "@graphcommerce/magento-customer": "4.3.2",
26
+ "@graphcommerce/magento-customer": "4.4.0",
27
27
  "@graphcommerce/magento-graphql": "3.0.12",
28
- "@graphcommerce/magento-store": "4.2.5",
29
- "@graphcommerce/next-ui": "4.8.1",
28
+ "@graphcommerce/magento-store": "4.2.6",
29
+ "@graphcommerce/next-ui": "4.8.2",
30
30
  "@graphcommerce/react-hook-form": "3.1.3"
31
31
  },
32
32
  "peerDependencies": {