@graphcommerce/magento-cart 3.6.4 → 3.7.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
@@ -3,6 +3,39 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.7.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart@3.7.0...@graphcommerce/magento-cart@3.7.1) (2021-11-12)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * disable CartFab animation for mobile ([ea04e67](https://github.com/ho-nl/m2-pwa/commit/ea04e678b7d5ab23e903a59a7f369053d17f9e79))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.7.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart@3.6.6...@graphcommerce/magento-cart@3.7.0) (2021-11-12)
18
+
19
+
20
+ ### Features
21
+
22
+ * added tons of translations ([9bb0ac7](https://github.com/ho-nl/m2-pwa/commit/9bb0ac709b58df6ea6141e92e4923a5ca9ae2963))
23
+
24
+
25
+
26
+
27
+
28
+ ## [3.6.5](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart@3.6.4...@graphcommerce/magento-cart@3.6.5) (2021-11-12)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * behaviour for CartFab animation including darkTheme support ([6152ef3](https://github.com/ho-nl/m2-pwa/commit/6152ef32d093e42c58ee79d4d713c5b8c2870746))
34
+
35
+
36
+
37
+
38
+
6
39
  ## [3.6.4](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart@3.6.3...@graphcommerce/magento-cart@3.6.4) (2021-11-12)
7
40
 
8
41
 
@@ -4,6 +4,7 @@ import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
4
4
  import { ApolloErrorAlert, ApolloErrorAlertProps, Button } from '@graphcommerce/next-ui'
5
5
  import Link from 'next/link'
6
6
  import React from 'react'
7
+ import { t } from '@lingui/macro'
7
8
  import { useClearCurrentCartId } from '../../hooks/useClearCurrentCartId'
8
9
 
9
10
  export type ApolloCartErrorAlertProps = ApolloErrorAlertProps
@@ -21,7 +22,7 @@ export default function ApolloCartErrorAlert(props: ApolloCartErrorAlertProps) {
21
22
  const [, authorizationError] = graphqlErrorByCategory({
22
23
  category: 'graphql-authorization',
23
24
  error,
24
- mask: token?.token ? 'Please reauthenticate and try again' : 'You must sign in to continue',
25
+ mask: token?.token ? t`Please reauthenticate and try again` : t`You must sign in to continue`,
25
26
  })
26
27
 
27
28
  action =
@@ -2,9 +2,7 @@ import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
2
2
  import {
3
3
  ApolloErrorFullPage,
4
4
  Button,
5
- SvgImage,
6
5
  ApolloErrorFullPageProps,
7
- iconLock,
8
6
  iconSadFace,
9
7
  SvgImageSimple,
10
8
  } from '@graphcommerce/next-ui'
@@ -7,6 +7,7 @@ import {
7
7
  UseFormComposeOptions,
8
8
  useFormPersist,
9
9
  } from '@graphcommerce/react-hook-form'
10
+ import { t } from '@lingui/macro'
10
11
  import {
11
12
  Checkbox,
12
13
  FormControl,
@@ -80,7 +81,7 @@ export default function CartAgreementsForm(props: CartAgreementsFormProps) {
80
81
  defaultValue={''}
81
82
  name={String(agreement.agreement_id)}
82
83
  control={control}
83
- rules={{ required: 'You have to agree in order to proceed' }}
84
+ rules={{ required: t`You have to agree in order to proceed` }}
84
85
  render={({
85
86
  field: { onChange, value, name, ref, onBlur },
86
87
  fieldState: { error },
@@ -7,7 +7,8 @@ import {
7
7
  useFixedFabAnimation,
8
8
  UseStyles,
9
9
  } from '@graphcommerce/next-ui'
10
- import { Fab, FabProps, makeStyles, NoSsr, Theme } from '@material-ui/core'
10
+ import { t } from '@lingui/macro'
11
+ import { Fab, FabProps, makeStyles, NoSsr, Theme, useMediaQuery, useTheme } from '@material-ui/core'
11
12
  import { m } from 'framer-motion'
12
13
  import PageLink from 'next/link'
13
14
  import React from 'react'
@@ -20,6 +21,7 @@ const useStyles = makeStyles(
20
21
  fab: {
21
22
  boxShadow: 'none',
22
23
  [theme.breakpoints.down('sm')]: {
24
+ background: theme.palette.background.paper,
23
25
  width: responsiveVal(42, 56),
24
26
  height: responsiveVal(42, 56),
25
27
  },
@@ -40,15 +42,24 @@ type CartFabContentProps = CartFabProps & CartTotalQuantityFragment
40
42
  function CartFabContent(props: CartFabContentProps) {
41
43
  const { total_quantity, icon, ...fabProps } = props
42
44
  const cartIcon = icon ?? <SvgImageSimple src={iconShoppingBag} loading='eager' size='large' />
43
- const { boxShadow } = useFixedFabAnimation()
45
+ const { boxShadow, backgroundColor } = useFixedFabAnimation()
46
+ const theme = useTheme()
47
+ const isMobile = useMediaQuery(theme.breakpoints.down('sm'))
44
48
  const classes = useStyles(props)
45
49
 
46
50
  return (
47
- <m.div style={{ boxShadow, width: 'inherit', borderRadius: 'inherit' }}>
51
+ <m.div
52
+ style={{
53
+ boxShadow: isMobile ? undefined : boxShadow,
54
+ backgroundColor: isMobile ? undefined : backgroundColor,
55
+ width: 'inherit',
56
+ borderRadius: 'inherit',
57
+ }}
58
+ >
48
59
  <PageLink href='/cart' passHref>
49
60
  <Fab
50
- aria-label='Cart'
51
- color='default'
61
+ aria-label={t`Cart`}
62
+ color='inherit'
52
63
  size='large'
53
64
  classes={{ root: classes.fab }}
54
65
  {...fabProps}
@@ -8,6 +8,7 @@ import {
8
8
  SvgImageSimple,
9
9
  UseStyles,
10
10
  } from '@graphcommerce/next-ui'
11
+ import { t } from '@lingui/macro'
11
12
  import { Divider, makeStyles, Theme } from '@material-ui/core'
12
13
  import clsx from 'clsx'
13
14
  import React from 'react'
@@ -84,7 +85,7 @@ export default function CartItemSummary(props: OrderSummaryProps) {
84
85
  classes={{
85
86
  sectionHeaderWrapper: classes.sectionHeaderWrapper,
86
87
  }}
87
- labelLeft='Order summary'
88
+ labelLeft={t`Order summary`}
88
89
  // labelRight={
89
90
  // <PageLink href='/download' passHref>
90
91
  // <Link color='secondary'>Download invoice</Link>
@@ -1,5 +1,6 @@
1
1
  import { Money } from '@graphcommerce/magento-store'
2
2
  import { Button, iconChevronRight, SvgImageSimple } from '@graphcommerce/next-ui'
3
+ import { Trans } from '@lingui/macro'
3
4
  import { makeStyles, Theme } from '@material-ui/core'
4
5
  import PageLink from 'next/link'
5
6
  import React, { PropsWithChildren } from 'react'
@@ -46,7 +47,9 @@ export default function CartStartCheckout(props: CartStartCheckoutProps) {
46
47
  endIcon={<SvgImageSimple src={iconChevronRight} inverted />}
47
48
  disabled={!hasTotals}
48
49
  >
49
- <span className={classes.checkoutButtonTotal}>Start Checkout</span>{' '}
50
+ <span className={classes.checkoutButtonTotal}>
51
+ <Trans>Start Checkout</Trans>
52
+ </span>{' '}
50
53
  {hasTotals && (
51
54
  <span className={classes.checkoutMoney}>
52
55
  <Money {...prices?.grand_total} />
@@ -1,5 +1,6 @@
1
1
  import { useHistoryLink } from '@graphcommerce/framer-next-pages'
2
2
  import { SectionContainer, UseStyles } from '@graphcommerce/next-ui'
3
+ import { t, Trans } from '@lingui/macro'
3
4
  import { Link, makeStyles, Theme, Typography } from '@material-ui/core'
4
5
  import PageLink from 'next/link'
5
6
  import React from 'react'
@@ -63,7 +64,7 @@ export default function CartSummary(props: CartSummaryProps) {
63
64
  <div>
64
65
  <SectionContainer
65
66
  variantLeft='h5'
66
- labelLeft='Confirmation + Track & trace'
67
+ labelLeft={t`Confirmation + Track & trace`}
67
68
  classes={{ sectionHeaderWrapper: classes.sectionHeaderWrapper }}
68
69
  />
69
70
  <Typography variant='body1'>{email || ''}</Typography>
@@ -71,7 +72,7 @@ export default function CartSummary(props: CartSummaryProps) {
71
72
  <div>
72
73
  <SectionContainer
73
74
  variantLeft='h5'
74
- labelLeft='Shipping method'
75
+ labelLeft={t`Shipping method`}
75
76
  classes={{ sectionHeaderWrapper: classes.sectionHeaderWrapper }}
76
77
  />
77
78
  <Typography variant='body1'>
@@ -84,13 +85,13 @@ export default function CartSummary(props: CartSummaryProps) {
84
85
  <div>
85
86
  <SectionContainer
86
87
  variantLeft='h5'
87
- labelLeft='Shipping address'
88
+ labelLeft={t`Shipping address`}
88
89
  classes={{ sectionHeaderWrapper: classes.sectionHeaderWrapper }}
89
90
  labelRight={
90
91
  editable ? (
91
92
  <PageLink href={historyHref} passHref>
92
93
  <Link color='secondary' variant='body2' onClick={historyOnClick}>
93
- Edit
94
+ <Trans>Edit</Trans>
94
95
  </Link>
95
96
  </PageLink>
96
97
  ) : undefined
@@ -101,13 +102,13 @@ export default function CartSummary(props: CartSummaryProps) {
101
102
  <div>
102
103
  <SectionContainer
103
104
  variantLeft='h5'
104
- labelLeft='Billing Address'
105
+ labelLeft={t`Billing Address`}
105
106
  classes={{ sectionHeaderWrapper: classes.sectionHeaderWrapper }}
106
107
  labelRight={
107
108
  editable ? (
108
109
  <PageLink href='/checkout/edit/billing-address' passHref>
109
110
  <Link color='secondary' variant='body2'>
110
- Edit
111
+ <Trans>Edit</Trans>
111
112
  </Link>
112
113
  </PageLink>
113
114
  ) : undefined
@@ -1,5 +1,6 @@
1
- import { Money, MoneyProps } from '@graphcommerce/magento-store'
1
+ import { Money } from '@graphcommerce/magento-store'
2
2
  import { AnimatedRow, UseStyles } from '@graphcommerce/next-ui'
3
+ import { Trans } from '@lingui/macro'
3
4
  import { Divider, makeStyles, Theme } from '@material-ui/core'
4
5
  import clsx from 'clsx'
5
6
  import { AnimatePresence } from 'framer-motion'
@@ -83,7 +84,9 @@ export default function CartTotals(props: CartTotalsProps) {
83
84
  <AnimatePresence initial={false}>
84
85
  {prices?.subtotal_including_tax && (
85
86
  <AnimatedRow className={classes.costsRow} key='subtotal'>
86
- <div>Products</div>
87
+ <div>
88
+ <Trans>Products</Trans>
89
+ </div>
87
90
  <div className={classes.money}>
88
91
  <Money
89
92
  {...(inclTax ? prices.subtotal_including_tax : prices.subtotal_excluding_tax)}
@@ -131,7 +134,9 @@ export default function CartTotals(props: CartTotalsProps) {
131
134
  {shippingMethod && (
132
135
  <AnimatedRow className={classes.costsRow} key='shippingMethod'>
133
136
  <div>
134
- Shipping ({shippingMethod.carrier_title} {shippingMethod.method_title})
137
+ <Trans>
138
+ Shipping ({shippingMethod.carrier_title} {shippingMethod.method_title})
139
+ </Trans>
135
140
  </div>
136
141
  <div className={classes.money}>
137
142
  <Money
@@ -162,7 +167,9 @@ export default function CartTotals(props: CartTotalsProps) {
162
167
  className={clsx(classes.costsRow, classes.costsGrandTotal)}
163
168
  key='grand_total'
164
169
  >
165
- <div>Grand total</div>
170
+ <div>
171
+ <Trans>Grand total</Trans>
172
+ </div>
166
173
  <div className={classes.money}>
167
174
  <Money {...prices.grand_total} />
168
175
  </div>
@@ -175,7 +182,9 @@ export default function CartTotals(props: CartTotalsProps) {
175
182
  className={clsx(classes.costsRow, classes.costsTax)}
176
183
  key={`incl${tax?.label}`}
177
184
  >
178
- <div>Including {tax?.label}</div>
185
+ <div>
186
+ <Trans>Including {tax?.label}</Trans>
187
+ </div>
179
188
  <div className={classes.money}>
180
189
  <Money {...tax?.amount} />
181
190
  </div>
@@ -20,7 +20,7 @@ export default function EmptyCart(props: EmptyCartProps) {
20
20
  </Link>
21
21
  }
22
22
  >
23
- {children ?? <Trans>Discover our collection and add items to your basket!</Trans>}
23
+ {children ?? <Trans>Discover our collection and add items to your cart!</Trans>}
24
24
  </FullPageMessage>
25
25
  )
26
26
  }
@@ -7,6 +7,7 @@ import {
7
7
  import Button from '@graphcommerce/next-ui/Button'
8
8
  import FormRow from '@graphcommerce/next-ui/Form/FormRow'
9
9
  import { UseStyles } from '@graphcommerce/next-ui/Styles'
10
+ import { Trans } from '@lingui/macro'
10
11
  import { makeStyles, TextField, Theme, Typography } from '@material-ui/core'
11
12
  import React, { useState } from 'react'
12
13
  import { useCartQuery } from '../../hooks/useCartQuery'
@@ -82,9 +83,9 @@ export default function InlineAccount(props: InlineAccountProps) {
82
83
  <div className={classes.innerContainer}>
83
84
  <div>
84
85
  <Typography variant='h4' className={classes.title}>
85
- {title ?? 'No account yet?'}
86
+ {title ?? <Trans>No account yet?</Trans>}
86
87
  </Typography>
87
- {description ?? 'You can track your order status and much more!'}
88
+ {description ?? <Trans>You can track your order status and much more!</Trans>}
88
89
  </div>
89
90
  <div>
90
91
  {!toggled && (
@@ -95,7 +96,7 @@ export default function InlineAccount(props: InlineAccountProps) {
95
96
  onClick={() => setToggled(!toggled)}
96
97
  className={classes.button}
97
98
  >
98
- Create an account
99
+ <Trans>Create an account</Trans>
99
100
  </Button>
100
101
  )}
101
102
  </div>
@@ -128,9 +129,9 @@ export default function InlineAccount(props: InlineAccountProps) {
128
129
  <div className={classes.innerContainer}>
129
130
  <div>
130
131
  <Typography variant='h4' className={classes.title}>
131
- {title ?? 'Have an account?'}
132
+ {title ?? <Trans>Have an account?</Trans>}
132
133
  </Typography>
133
- {description ?? 'You can find your order history in your account!'}
134
+ {description ?? <Trans>You can find your order history in your account!</Trans>}
134
135
  </div>
135
136
  <div>
136
137
  <Button
@@ -139,7 +140,7 @@ export default function InlineAccount(props: InlineAccountProps) {
139
140
  href={accountHref}
140
141
  className={classes.button}
141
142
  >
142
- My account
143
+ <Trans>Account</Trans>
143
144
  </Button>
144
145
  </div>
145
146
  </div>
@@ -1,4 +1,5 @@
1
1
  import { useMutation } from '@apollo/client'
2
+ import { t } from '@lingui/macro'
2
3
  import { CreateEmptyCartDocument } from './CreateEmptyCart.gql'
3
4
  import { useAssignCurrentCartId } from './useAssignCurrentCartId'
4
5
  import { useCurrentCartId } from './useCurrentCartId'
@@ -12,7 +13,7 @@ export function useCartIdCreate() {
12
13
  if (cartId) return cartId
13
14
 
14
15
  const { data } = await create()
15
- if (!data?.createEmptyCart) throw Error('Could not create an empty cart')
16
+ if (!data?.createEmptyCart) throw Error(t`Could not create an empty cart`)
16
17
 
17
18
  // We store the cartId that is returned as the currentCartId result
18
19
  assignCurrentCartId(data.createEmptyCart)
@@ -27,8 +27,10 @@ export function useCartQuery<Q, V extends { cartId: string; [index: string]: unk
27
27
 
28
28
  if (usingUrl && typeof queryOptions.fetchPolicy === 'undefined')
29
29
  queryOptions.fetchPolicy = 'cache-only'
30
+
30
31
  if (usingUrl && typeof queryOptions.returnPartialData === 'undefined')
31
32
  queryOptions.returnPartialData = true
33
+
32
34
  queryOptions.variables = { cartId, ...options?.variables } as V
33
35
  queryOptions.skip = queryOptions?.skip || !cartId
34
36
  queryOptions.ssr = false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphcommerce/magento-cart",
3
- "version": "3.6.4",
3
+ "version": "3.7.1",
4
4
  "sideEffects": false,
5
5
  "prettier": "@graphcommerce/prettier-config-pwa",
6
6
  "browserslist": [
@@ -14,22 +14,23 @@
14
14
  },
15
15
  "devDependencies": {
16
16
  "@graphcommerce/browserslist-config-pwa": "^3.0.2",
17
- "@graphcommerce/eslint-config-pwa": "^3.1.4",
17
+ "@graphcommerce/eslint-config-pwa": "^3.1.5",
18
18
  "@graphcommerce/prettier-config-pwa": "^3.0.4",
19
19
  "@graphcommerce/typescript-config-pwa": "^3.1.1",
20
20
  "@playwright/test": "^1.16.2"
21
21
  },
22
22
  "dependencies": {
23
23
  "@apollo/client": "^3.4.16",
24
- "@graphcommerce/framer-scroller": "^1.0.3",
25
- "@graphcommerce/graphql": "^2.105.4",
26
- "@graphcommerce/image": "^2.105.3",
27
- "@graphcommerce/magento-customer": "^3.5.4",
28
- "@graphcommerce/magento-graphql": "^2.104.4",
29
- "@graphcommerce/magento-store": "^3.2.19",
30
- "@graphcommerce/next-ui": "^3.15.2",
31
- "@graphcommerce/react-hook-form": "^2.103.1",
32
- "@graphql-typed-document-node/core": "^3.1.0",
24
+ "@graphcommerce/framer-next-pages": "^2.107.5",
25
+ "@graphcommerce/framer-scroller": "^1.0.4",
26
+ "@graphcommerce/graphql": "^2.105.5",
27
+ "@graphcommerce/image": "^2.105.4",
28
+ "@graphcommerce/magento-customer": "^3.6.1",
29
+ "@graphcommerce/magento-graphql": "^2.104.5",
30
+ "@graphcommerce/magento-store": "^3.3.1",
31
+ "@graphcommerce/next-ui": "^3.17.1",
32
+ "@graphcommerce/react-hook-form": "^2.104.0",
33
+ "@lingui/macro": "^3.12.1",
33
34
  "@material-ui/core": "^4.12.3",
34
35
  "@material-ui/lab": "^4.0.0-alpha.60",
35
36
  "clsx": "^1.1.1",
@@ -38,5 +39,5 @@
38
39
  "react": "^17.0.2",
39
40
  "react-dom": "^17.0.2"
40
41
  },
41
- "gitHead": "47e8be849eaecea00f8673696ae1ec3283ec5fd6"
42
+ "gitHead": "e8578cc336e58d896531179f5fcb6973e8a983ce"
42
43
  }