@graphcommerce/magento-cart-shipping-method 3.2.4 → 3.4.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,51 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1548](https://github.com/graphcommerce-org/graphcommerce/pull/1548) [`4b8c0a3ef`](https://github.com/graphcommerce-org/graphcommerce/commit/4b8c0a3efa163bc7e4e590f1c251a2a78e000a81) Thanks [@mikekeehnen](https://github.com/mikekeehnen)! - Fix for empty shipping methods in checkout
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`18054c441`](https://github.com/graphcommerce-org/graphcommerce/commit/18054c441962ba750bed3acc39ab46c8d3a341ce), [`c5c539c44`](https://github.com/graphcommerce-org/graphcommerce/commit/c5c539c44eeac524cd62ce649e132d2e00333794), [`6f69bc54c`](https://github.com/graphcommerce-org/graphcommerce/commit/6f69bc54c6e0224452817c532ae58d9c332b61ea), [`21886d6fa`](https://github.com/graphcommerce-org/graphcommerce/commit/21886d6fa64a48d9e932bfaf8d138c9b13c36e43), [`b4936e961`](https://github.com/graphcommerce-org/graphcommerce/commit/b4936e96175fe80717895822e245274db05638bd)]:
12
+ - @graphcommerce/graphql@3.4.1
13
+ - @graphcommerce/next-ui@4.13.1
14
+ - @graphcommerce/framer-scroller@2.1.23
15
+ - @graphcommerce/magento-cart@4.5.2
16
+ - @graphcommerce/magento-cart-shipping-address@3.2.7
17
+ - @graphcommerce/magento-store@4.2.17
18
+
19
+ ## 3.3.1
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [[`8d8fda262`](https://github.com/graphcommerce-org/graphcommerce/commit/8d8fda2623e561cb43441110c67ffa34b692668a), [`d41cff721`](https://github.com/graphcommerce-org/graphcommerce/commit/d41cff7211230561ceeb7786cf75790efd6377cd), [`cefa7b365`](https://github.com/graphcommerce-org/graphcommerce/commit/cefa7b3652b55108d2178927e3c5d98a111cf373), [`584b683a2`](https://github.com/graphcommerce-org/graphcommerce/commit/584b683a2aedcdf5067644c8dcc0e63a5b9e894c)]:
24
+ - @graphcommerce/next-ui@4.13.0
25
+ - @graphcommerce/magento-store@4.2.16
26
+ - @graphcommerce/framer-scroller@2.1.22
27
+ - @graphcommerce/magento-cart@4.5.1
28
+ - @graphcommerce/magento-cart-shipping-address@3.2.6
29
+
30
+ ## 3.3.0
31
+
32
+ ### Minor Changes
33
+
34
+ - [#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
35
+
36
+ * [#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.
37
+
38
+ ### Patch Changes
39
+
40
+ - 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)]:
41
+ - @graphcommerce/graphql@3.4.0
42
+ - @graphcommerce/magento-cart@4.5.0
43
+ - @graphcommerce/react-hook-form@3.3.0
44
+ - @graphcommerce/next-ui@4.12.0
45
+ - @graphcommerce/magento-cart-shipping-address@3.2.5
46
+ - @graphcommerce/magento-store@4.2.15
47
+ - @graphcommerce/framer-scroller@2.1.21
48
+
3
49
  ## 3.2.4
4
50
 
5
51
  ### 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 {
@@ -50,7 +50,7 @@ export function ShippingMethodForm(props: ShippingMethodFormProps) {
50
50
  ShippingMethodFormMutation,
51
51
  ShippingMethodFormMutationVariables & { carrierMethod?: string }
52
52
  >(ShippingMethodFormDocument, {
53
- defaultValues: { carrierMethod, carrier, method },
53
+ defaultValues: { carrier, method },
54
54
  onBeforeSubmit: (variables) => {
55
55
  const splitCarrierMethod = variables?.carrierMethod?.split('-')
56
56
  return {
@@ -70,10 +70,7 @@ export function ShippingMethodForm(props: ShippingMethodFormProps) {
70
70
  useEffect(() => {
71
71
  const availableMethods = sortedAvailableShippingMethods.filter((m) => m?.available)
72
72
  if (availableMethods.length === 1) {
73
- setValue(
74
- 'carrierMethod',
75
- `${availableMethods[0]?.carrier_code}-${availableMethods[0]?.method_code}`,
76
- )
73
+ setValue('carrierMethod', `${carrier}-${method}`)
77
74
  }
78
75
  }, [
79
76
  carrier,
@@ -102,7 +99,7 @@ export function ShippingMethodForm(props: ShippingMethodFormProps) {
102
99
  disabled: !sortedMethod?.available,
103
100
  value: `${sortedMethod?.carrier_code}-${sortedMethod?.method_code}`,
104
101
  }))}
105
- render={ShippingMethodActionCard as VFC<ActionCardItemRenderProps<ActionCardItemBase>>}
102
+ render={ShippingMethodActionCard as FC<ActionCardItemRenderProps<ActionCardItemBase>>}
106
103
  />
107
104
  <ApolloCartErrorAlert error={error} />
108
105
  </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.4",
5
+ "version": "3.4.0",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,21 +12,21 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^4.1.8",
15
+ "@graphcommerce/eslint-config-pwa": "^4.1.9",
16
16
  "@graphcommerce/prettier-config-pwa": "^4.0.6",
17
- "@graphcommerce/typescript-config-pwa": "^4.0.3",
17
+ "@graphcommerce/typescript-config-pwa": "^4.0.4",
18
18
  "@playwright/test": "^1.21.1",
19
19
  "type-fest": "^2.12.2"
20
20
  },
21
21
  "dependencies": {
22
- "@graphcommerce/framer-scroller": "2.1.20",
23
- "@graphcommerce/graphql": "3.3.0",
22
+ "@graphcommerce/framer-scroller": "2.1.23",
23
+ "@graphcommerce/graphql": "3.4.1",
24
24
  "@graphcommerce/image": "3.1.7",
25
- "@graphcommerce/magento-cart": "4.4.8",
26
- "@graphcommerce/magento-cart-shipping-address": "3.2.4",
27
- "@graphcommerce/magento-store": "4.2.14",
28
- "@graphcommerce/next-ui": "4.11.2",
29
- "@graphcommerce/react-hook-form": "3.2.2"
25
+ "@graphcommerce/magento-cart": "4.5.2",
26
+ "@graphcommerce/magento-cart-shipping-address": "3.2.7",
27
+ "@graphcommerce/magento-store": "4.2.17",
28
+ "@graphcommerce/next-ui": "4.13.1",
29
+ "@graphcommerce/react-hook-form": "3.3.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@lingui/react": "^3.13.2",