@graphcommerce/magento-cart-shipping-method 9.0.0-canary.115 → 9.0.0-canary.117

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,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.0.0-canary.117
4
+
5
+ ## 9.0.0-canary.116
6
+
3
7
  ## 9.0.0-canary.115
4
8
 
5
9
  ## 9.0.0-canary.114
@@ -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 '../../AvailableShippingMethod/AvailableShippingMethod.gql'
7
+ import type { AvailableShippingMethodFragment } from './AvailableShippingMethod.gql'
8
8
 
9
9
  export type ShippingMethodActionCardProps = ActionCardItemRenderProps<
10
10
  AvailableShippingMethodFragment | null | undefined
@@ -146,6 +146,7 @@ export function ShippingMethodForm(props: ShippingMethodFormProps) {
146
146
  )
147
147
  }
148
148
 
149
+ /** @public */
149
150
  export function useShippingMethod() {
150
151
  return useWatch<{ carrierMethod?: string }>({ name: 'carrierMethod' })
151
152
  }
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.115",
5
+ "version": "9.0.0-canary.117",
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.115",
16
- "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.115",
17
- "@graphcommerce/framer-scroller": "^9.0.0-canary.115",
18
- "@graphcommerce/graphql": "^9.0.0-canary.115",
19
- "@graphcommerce/image": "^9.0.0-canary.115",
20
- "@graphcommerce/magento-cart": "^9.0.0-canary.115",
21
- "@graphcommerce/magento-cart-shipping-address": "^9.0.0-canary.115",
22
- "@graphcommerce/magento-store": "^9.0.0-canary.115",
23
- "@graphcommerce/next-ui": "^9.0.0-canary.115",
24
- "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.115",
25
- "@graphcommerce/react-hook-form": "^9.0.0-canary.115",
26
- "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.115",
15
+ "@graphcommerce/ecommerce-ui": "^9.0.0-canary.117",
16
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.117",
17
+ "@graphcommerce/framer-scroller": "^9.0.0-canary.117",
18
+ "@graphcommerce/graphql": "^9.0.0-canary.117",
19
+ "@graphcommerce/image": "^9.0.0-canary.117",
20
+ "@graphcommerce/magento-cart": "^9.0.0-canary.117",
21
+ "@graphcommerce/magento-cart-shipping-address": "^9.0.0-canary.117",
22
+ "@graphcommerce/magento-store": "^9.0.0-canary.117",
23
+ "@graphcommerce/next-ui": "^9.0.0-canary.117",
24
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.117",
25
+ "@graphcommerce/react-hook-form": "^9.0.0-canary.117",
26
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.117",
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
- )