@graphcommerce/magento-cart-shipping-method 9.0.0-canary.115 → 9.0.0-canary.116
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 +2 -0
- package/components/ShippingMethodForm/ShippingMethodActionCard.tsx +1 -1
- package/components/ShippingMethodForm/ShippingMethodForm.tsx +1 -0
- package/package.json +13 -13
- package/AvailableShippingMethod/AvailableShippingMethod.tsx +0 -117
- /package/{AvailableShippingMethod → components/ShippingMethodForm}/AvailableShippingMethod.graphql +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,7 @@ import { Money } from '@graphcommerce/magento-store'
|
|
|
4
4
|
import { ActionCard } from '@graphcommerce/next-ui'
|
|
5
5
|
import { Trans } from '@lingui/react'
|
|
6
6
|
import { Button, Chip } from '@mui/material'
|
|
7
|
-
import type { AvailableShippingMethodFragment } from '
|
|
7
|
+
import type { AvailableShippingMethodFragment } from './AvailableShippingMethod.gql'
|
|
8
8
|
|
|
9
9
|
export type ShippingMethodActionCardProps = ActionCardItemRenderProps<
|
|
10
10
|
AvailableShippingMethodFragment | null | undefined
|
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": "9.0.0-canary.
|
|
5
|
+
"version": "9.0.0-canary.116",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,18 +12,18 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/ecommerce-ui": "^9.0.0-canary.
|
|
16
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.
|
|
17
|
-
"@graphcommerce/framer-scroller": "^9.0.0-canary.
|
|
18
|
-
"@graphcommerce/graphql": "^9.0.0-canary.
|
|
19
|
-
"@graphcommerce/image": "^9.0.0-canary.
|
|
20
|
-
"@graphcommerce/magento-cart": "^9.0.0-canary.
|
|
21
|
-
"@graphcommerce/magento-cart-shipping-address": "^9.0.0-canary.
|
|
22
|
-
"@graphcommerce/magento-store": "^9.0.0-canary.
|
|
23
|
-
"@graphcommerce/next-ui": "^9.0.0-canary.
|
|
24
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.
|
|
25
|
-
"@graphcommerce/react-hook-form": "^9.0.0-canary.
|
|
26
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.
|
|
15
|
+
"@graphcommerce/ecommerce-ui": "^9.0.0-canary.116",
|
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.116",
|
|
17
|
+
"@graphcommerce/framer-scroller": "^9.0.0-canary.116",
|
|
18
|
+
"@graphcommerce/graphql": "^9.0.0-canary.116",
|
|
19
|
+
"@graphcommerce/image": "^9.0.0-canary.116",
|
|
20
|
+
"@graphcommerce/magento-cart": "^9.0.0-canary.116",
|
|
21
|
+
"@graphcommerce/magento-cart-shipping-address": "^9.0.0-canary.116",
|
|
22
|
+
"@graphcommerce/magento-store": "^9.0.0-canary.116",
|
|
23
|
+
"@graphcommerce/next-ui": "^9.0.0-canary.116",
|
|
24
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.116",
|
|
25
|
+
"@graphcommerce/react-hook-form": "^9.0.0-canary.116",
|
|
26
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.116",
|
|
27
27
|
"@lingui/core": "^4.2.1",
|
|
28
28
|
"@lingui/macro": "^4.2.1",
|
|
29
29
|
"@lingui/react": "^4.2.1",
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { useDisplayInclTax } from '@graphcommerce/magento-cart'
|
|
2
|
-
import { Money } from '@graphcommerce/magento-store'
|
|
3
|
-
import type { ToggleButtonProps } from '@graphcommerce/next-ui'
|
|
4
|
-
import { ToggleButton, extendableComponent } from '@graphcommerce/next-ui'
|
|
5
|
-
import { Trans } from '@lingui/react'
|
|
6
|
-
import { Box, FormHelperText } from '@mui/material'
|
|
7
|
-
import React from 'react'
|
|
8
|
-
import type { SetOptional } from 'type-fest'
|
|
9
|
-
import type { AvailableShippingMethodFragment } from './AvailableShippingMethod.gql'
|
|
10
|
-
|
|
11
|
-
export type AvailableShippingMethodProps = SetOptional<AvailableShippingMethodFragment, 'amount'> &
|
|
12
|
-
Omit<ToggleButtonProps, 'size'>
|
|
13
|
-
|
|
14
|
-
type OwnerProps = {
|
|
15
|
-
free?: boolean
|
|
16
|
-
error?: boolean
|
|
17
|
-
}
|
|
18
|
-
const name = 'AvailableShippingMethod'
|
|
19
|
-
const parts = ['root', 'title', 'additional', 'error', 'amount'] as const
|
|
20
|
-
const { withState } = extendableComponent<OwnerProps, typeof name, typeof parts>(name, parts)
|
|
21
|
-
|
|
22
|
-
export const AvailableShippingMethod = React.forwardRef(
|
|
23
|
-
(props: AvailableShippingMethodProps, ref) => {
|
|
24
|
-
const {
|
|
25
|
-
price_excl_tax,
|
|
26
|
-
price_incl_tax,
|
|
27
|
-
available,
|
|
28
|
-
disabled,
|
|
29
|
-
carrier_code,
|
|
30
|
-
carrier_title,
|
|
31
|
-
error_message,
|
|
32
|
-
method_code,
|
|
33
|
-
method_title,
|
|
34
|
-
children,
|
|
35
|
-
sx = [],
|
|
36
|
-
...toggleProps
|
|
37
|
-
} = props
|
|
38
|
-
|
|
39
|
-
const amount = useDisplayInclTax() ? price_incl_tax : price_excl_tax
|
|
40
|
-
|
|
41
|
-
const classes = withState({
|
|
42
|
-
free: amount?.value === 0,
|
|
43
|
-
error: !!error_message,
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<ToggleButton
|
|
48
|
-
{...toggleProps}
|
|
49
|
-
className={classes.root}
|
|
50
|
-
ref={ref}
|
|
51
|
-
disabled={!available}
|
|
52
|
-
size='large'
|
|
53
|
-
color='secondary'
|
|
54
|
-
sx={[
|
|
55
|
-
(theme) => ({
|
|
56
|
-
typography: 'body2',
|
|
57
|
-
textAlign: 'left',
|
|
58
|
-
justifyContent: 'space-between',
|
|
59
|
-
alignItems: 'normal',
|
|
60
|
-
display: 'grid',
|
|
61
|
-
gridTemplate: `
|
|
62
|
-
"title amount"
|
|
63
|
-
"additional additional"
|
|
64
|
-
"error error"
|
|
65
|
-
`,
|
|
66
|
-
gridTemplateColumns: 'auto min-content',
|
|
67
|
-
columnGap: theme.spacings.xxs,
|
|
68
|
-
}),
|
|
69
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
70
|
-
]}
|
|
71
|
-
>
|
|
72
|
-
<Box
|
|
73
|
-
className={classes.title}
|
|
74
|
-
sx={{
|
|
75
|
-
typography: 'subtitle1',
|
|
76
|
-
gridArea: 'title',
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
{carrier_title} {method_title}
|
|
80
|
-
</Box>
|
|
81
|
-
|
|
82
|
-
<Box
|
|
83
|
-
className={classes.amount}
|
|
84
|
-
sx={{
|
|
85
|
-
gridArea: 'amount',
|
|
86
|
-
typography: 'subtitle2',
|
|
87
|
-
'&.free': {
|
|
88
|
-
color: 'success.main',
|
|
89
|
-
},
|
|
90
|
-
}}
|
|
91
|
-
>
|
|
92
|
-
{amount?.value === 0 ? <Trans id='Free' /> : <Money {...amount} />}
|
|
93
|
-
</Box>
|
|
94
|
-
|
|
95
|
-
{error_message ? (
|
|
96
|
-
<FormHelperText
|
|
97
|
-
className={classes.error}
|
|
98
|
-
disabled={!available}
|
|
99
|
-
variant='standard'
|
|
100
|
-
sx={{ gridArea: 'error' }}
|
|
101
|
-
>
|
|
102
|
-
{error_message}
|
|
103
|
-
</FormHelperText>
|
|
104
|
-
) : (
|
|
105
|
-
children && (
|
|
106
|
-
<Box
|
|
107
|
-
className={classes.additional}
|
|
108
|
-
sx={{ typography: 'body2', gridArea: 'additional' }}
|
|
109
|
-
>
|
|
110
|
-
{children}
|
|
111
|
-
</Box>
|
|
112
|
-
)
|
|
113
|
-
)}
|
|
114
|
-
</ToggleButton>
|
|
115
|
-
)
|
|
116
|
-
},
|
|
117
|
-
)
|
/package/{AvailableShippingMethod → components/ShippingMethodForm}/AvailableShippingMethod.graphql
RENAMED
|
File without changes
|