@graphcommerce/magento-cart-shipping-method 3.2.2 → 3.3.0

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,48 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1544](https://github.com/graphcommerce-org/graphcommerce/pull/1544) [`5f927ebdc`](https://github.com/graphcommerce-org/graphcommerce/commit/5f927ebdc6f0331833e02b96e4f169bfe475ac6b) Thanks [@mikekeehnen](https://github.com/mikekeehnen)! - Fixed hydration errors on account, cart and wishlist
8
+
9
+ * [#1534](https://github.com/graphcommerce-org/graphcommerce/pull/1534) [`c756f42e5`](https://github.com/graphcommerce-org/graphcommerce/commit/c756f42e503761a497e4a5a7a02d02141df231c3) Thanks [@mikekeehnen](https://github.com/mikekeehnen)! - Added the method title to the action card title for shipping methods.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [[`5f927ebdc`](https://github.com/graphcommerce-org/graphcommerce/commit/5f927ebdc6f0331833e02b96e4f169bfe475ac6b), [`c87a28e7d`](https://github.com/graphcommerce-org/graphcommerce/commit/c87a28e7dad87bffd0bd125ad5fdca65aaa389cc), [`c756f42e5`](https://github.com/graphcommerce-org/graphcommerce/commit/c756f42e503761a497e4a5a7a02d02141df231c3)]:
14
+ - @graphcommerce/graphql@3.4.0
15
+ - @graphcommerce/magento-cart@4.5.0
16
+ - @graphcommerce/react-hook-form@3.3.0
17
+ - @graphcommerce/next-ui@4.12.0
18
+ - @graphcommerce/magento-cart-shipping-address@3.2.5
19
+ - @graphcommerce/magento-store@4.2.15
20
+ - @graphcommerce/framer-scroller@2.1.21
21
+
22
+ ## 3.2.4
23
+
24
+ ### Patch Changes
25
+
26
+ - [#1538](https://github.com/graphcommerce-org/graphcommerce/pull/1538) [`fe4baa42d`](https://github.com/graphcommerce-org/graphcommerce/commit/fe4baa42db0081ed960d62aef688bd36a7ac974f) Thanks [@paales](https://github.com/paales)! - add missing translations
27
+
28
+ - Updated dependencies [[`fe4baa42d`](https://github.com/graphcommerce-org/graphcommerce/commit/fe4baa42db0081ed960d62aef688bd36a7ac974f)]:
29
+ - @graphcommerce/magento-cart@4.4.8
30
+ - @graphcommerce/magento-cart-shipping-address@3.2.4
31
+ - @graphcommerce/next-ui@4.11.2
32
+ - @graphcommerce/framer-scroller@2.1.20
33
+ - @graphcommerce/magento-store@4.2.14
34
+
35
+ ## 3.2.3
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [[`11bca2d2f`](https://github.com/graphcommerce-org/graphcommerce/commit/11bca2d2f7dbb7c5e2827c04eb0db43d4099f2fd)]:
40
+ - @graphcommerce/next-ui@4.11.1
41
+ - @graphcommerce/framer-scroller@2.1.19
42
+ - @graphcommerce/magento-cart@4.4.7
43
+ - @graphcommerce/magento-cart-shipping-address@3.2.3
44
+ - @graphcommerce/magento-store@4.2.13
45
+
3
46
  ## 3.2.2
4
47
 
5
48
  ### Patch Changes
@@ -10,19 +10,30 @@ type ShippingMethodActionCardProps = ActionCardItemRenderProps<
10
10
  >
11
11
 
12
12
  export function ShippingMethodActionCard(props: ShippingMethodActionCardProps) {
13
- const { available, amount, error_message, carrier_title, carrier_code, onReset, ...cardProps } =
14
- props
13
+ const {
14
+ available,
15
+ amount,
16
+ error_message,
17
+ carrier_title,
18
+ carrier_code,
19
+ method_title,
20
+ onReset,
21
+ ...cardProps
22
+ } = props
15
23
  let { hidden = false } = props
16
24
 
17
25
  const isFree = amount && amount.value === 0
18
26
 
19
27
  if (carrier_code !== 'freeshipping') hidden = !available ? true : hidden
20
28
 
29
+ const title =
30
+ carrier_title === 'Free Shipping' ? carrier_title : `${carrier_title} ${method_title}`
31
+
21
32
  return (
22
33
  <ActionCard
23
34
  {...cardProps}
24
35
  hidden={hidden}
25
- title={carrier_title}
36
+ title={title}
26
37
  details={error_message}
27
38
  action={
28
39
  <Button
@@ -34,9 +45,17 @@ export function ShippingMethodActionCard(props: ShippingMethodActionCardProps) {
34
45
  <Trans id='Select' />
35
46
  </Button>
36
47
  }
37
- price={!isFree ? <Money {...amount} /> : <Box sx={{ color: '#05C642' }}>Free</Box>}
48
+ price={
49
+ !isFree ? (
50
+ <Money {...amount} />
51
+ ) : (
52
+ <Box sx={{ color: '#05C642' }}>
53
+ <Trans id='Free' />
54
+ </Box>
55
+ )
56
+ }
38
57
  reset={
39
- <Button variant='inline' color='secondary' onClick={onReset} disableRipple size='small'>
58
+ <Button variant='inline' color='secondary' onClick={onReset} disableRipple>
40
59
  <Trans id='Change' />
41
60
  </Button>
42
61
  }
@@ -16,7 +16,7 @@ import {
16
16
  } from '@graphcommerce/react-hook-form'
17
17
  import { i18n } from '@lingui/core'
18
18
  import { Trans } from '@lingui/react'
19
- import { useEffect, useMemo, VFC } from 'react'
19
+ import { FC, useEffect, useMemo } from 'react'
20
20
  import { GetShippingMethodsDocument } from './GetShippingMethods.gql'
21
21
  import { ShippingMethodActionCard } from './ShippingMethodActionCard'
22
22
  import {
@@ -46,6 +46,15 @@ export function ShippingMethodForm(props: ShippingMethodFormProps) {
46
46
  [currentAddress?.available_shipping_methods],
47
47
  )
48
48
 
49
+ console.log(
50
+ 'sortedAvailableShippingMethods',
51
+ sortedAvailableShippingMethods.filter(Boolean).map((sortedMethod) => ({
52
+ ...sortedMethod,
53
+ disabled: !sortedMethod?.available,
54
+ value: `${sortedMethod?.carrier_code}-${sortedMethod?.method_code}`,
55
+ })),
56
+ )
57
+
49
58
  const form = useFormGqlMutationCart<
50
59
  ShippingMethodFormMutation,
51
60
  ShippingMethodFormMutationVariables & { carrierMethod?: string }
@@ -96,13 +105,13 @@ export function ShippingMethodForm(props: ShippingMethodFormProps) {
96
105
  <ActionCardListForm
97
106
  control={control}
98
107
  name='carrierMethod'
99
- errorMessage={i18n._(/* i18n */ `Please select a shipping method`)}
108
+ errorMessage={i18n._(/* i18n */ 'Please select a shipping method')}
100
109
  items={sortedAvailableShippingMethods.filter(Boolean).map((sortedMethod) => ({
101
110
  ...sortedMethod,
102
111
  disabled: !sortedMethod?.available,
103
112
  value: `${sortedMethod?.carrier_code}-${sortedMethod?.method_code}`,
104
113
  }))}
105
- render={ShippingMethodActionCard as VFC<ActionCardItemRenderProps<ActionCardItemBase>>}
114
+ render={ShippingMethodActionCard as FC<ActionCardItemRenderProps<ActionCardItemBase>>}
106
115
  />
107
116
  <ApolloCartErrorAlert error={error} />
108
117
  </Form>
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": "3.2.2",
5
+ "version": "3.3.0",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -19,14 +19,14 @@
19
19
  "type-fest": "^2.12.2"
20
20
  },
21
21
  "dependencies": {
22
- "@graphcommerce/framer-scroller": "2.1.18",
23
- "@graphcommerce/graphql": "3.3.0",
22
+ "@graphcommerce/framer-scroller": "2.1.21",
23
+ "@graphcommerce/graphql": "3.4.0",
24
24
  "@graphcommerce/image": "3.1.7",
25
- "@graphcommerce/magento-cart": "4.4.6",
26
- "@graphcommerce/magento-cart-shipping-address": "3.2.2",
27
- "@graphcommerce/magento-store": "4.2.12",
28
- "@graphcommerce/next-ui": "4.11.0",
29
- "@graphcommerce/react-hook-form": "3.2.2"
25
+ "@graphcommerce/magento-cart": "4.5.0",
26
+ "@graphcommerce/magento-cart-shipping-address": "3.2.5",
27
+ "@graphcommerce/magento-store": "4.2.15",
28
+ "@graphcommerce/next-ui": "4.12.0",
29
+ "@graphcommerce/react-hook-form": "3.3.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@lingui/react": "^3.13.2",