@graphcommerce/magento-product-grouped 8.1.0-canary.8 → 9.0.0-canary.100
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,189 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.0.0-canary.100
|
|
4
|
+
|
|
5
|
+
## 9.0.0-canary.99
|
|
6
|
+
|
|
7
|
+
## 9.0.0-canary.98
|
|
8
|
+
|
|
9
|
+
## 9.0.0-canary.97
|
|
10
|
+
|
|
11
|
+
## 9.0.0-canary.96
|
|
12
|
+
|
|
13
|
+
## 9.0.0-canary.95
|
|
14
|
+
|
|
15
|
+
## 9.0.0-canary.94
|
|
16
|
+
|
|
17
|
+
## 9.0.0-canary.93
|
|
18
|
+
|
|
19
|
+
## 9.0.0-canary.92
|
|
20
|
+
|
|
21
|
+
## 9.0.0-canary.91
|
|
22
|
+
|
|
23
|
+
## 9.0.0-canary.90
|
|
24
|
+
|
|
25
|
+
## 9.0.0-canary.89
|
|
26
|
+
|
|
27
|
+
## 9.0.0-canary.88
|
|
28
|
+
|
|
29
|
+
## 9.0.0-canary.87
|
|
30
|
+
|
|
31
|
+
## 9.0.0-canary.86
|
|
32
|
+
|
|
33
|
+
## 9.0.0-canary.85
|
|
34
|
+
|
|
35
|
+
## 9.0.0-canary.84
|
|
36
|
+
|
|
37
|
+
## 9.0.0-canary.83
|
|
38
|
+
|
|
39
|
+
## 9.0.0-canary.82
|
|
40
|
+
|
|
41
|
+
## 9.0.0-canary.81
|
|
42
|
+
|
|
43
|
+
## 9.0.0-canary.80
|
|
44
|
+
|
|
45
|
+
## 9.0.0-canary.79
|
|
46
|
+
|
|
47
|
+
## 9.0.0-canary.78
|
|
48
|
+
|
|
49
|
+
## 9.0.0-canary.77
|
|
50
|
+
|
|
51
|
+
## 9.0.0-canary.76
|
|
52
|
+
|
|
53
|
+
## 9.0.0-canary.75
|
|
54
|
+
|
|
55
|
+
## 9.0.0-canary.74
|
|
56
|
+
|
|
57
|
+
## 9.0.0-canary.73
|
|
58
|
+
|
|
59
|
+
## 9.0.0-canary.72
|
|
60
|
+
|
|
61
|
+
## 9.0.0-canary.71
|
|
62
|
+
|
|
63
|
+
## 9.0.0-canary.70
|
|
64
|
+
|
|
65
|
+
## 9.0.0-canary.69
|
|
66
|
+
|
|
67
|
+
## 9.0.0-canary.68
|
|
68
|
+
|
|
69
|
+
## 9.0.0-canary.67
|
|
70
|
+
|
|
71
|
+
## 9.0.0-canary.66
|
|
72
|
+
|
|
73
|
+
## 9.0.0-canary.65
|
|
74
|
+
|
|
75
|
+
## 9.0.0-canary.64
|
|
76
|
+
|
|
77
|
+
## 9.0.0-canary.63
|
|
78
|
+
|
|
79
|
+
## 9.0.0-canary.62
|
|
80
|
+
|
|
81
|
+
## 9.0.0-canary.61
|
|
82
|
+
|
|
83
|
+
## 9.0.0-canary.60
|
|
84
|
+
|
|
85
|
+
## 9.0.0-canary.59
|
|
86
|
+
|
|
87
|
+
## 9.0.0-canary.58
|
|
88
|
+
|
|
89
|
+
## 9.0.0-canary.57
|
|
90
|
+
|
|
91
|
+
## 9.0.0-canary.56
|
|
92
|
+
|
|
93
|
+
## 9.0.0-canary.55
|
|
94
|
+
|
|
95
|
+
## 9.0.0-canary.54
|
|
96
|
+
|
|
97
|
+
## 8.1.0-canary.53
|
|
98
|
+
|
|
99
|
+
## 8.1.0-canary.52
|
|
100
|
+
|
|
101
|
+
## 8.1.0-canary.51
|
|
102
|
+
|
|
103
|
+
## 8.1.0-canary.50
|
|
104
|
+
|
|
105
|
+
## 8.1.0-canary.49
|
|
106
|
+
|
|
107
|
+
## 8.1.0-canary.48
|
|
108
|
+
|
|
109
|
+
## 8.1.0-canary.47
|
|
110
|
+
|
|
111
|
+
## 8.1.0-canary.46
|
|
112
|
+
|
|
113
|
+
## 8.1.0-canary.45
|
|
114
|
+
|
|
115
|
+
## 8.1.0-canary.44
|
|
116
|
+
|
|
117
|
+
## 8.1.0-canary.43
|
|
118
|
+
|
|
119
|
+
## 8.1.0-canary.42
|
|
120
|
+
|
|
121
|
+
## 8.1.0-canary.41
|
|
122
|
+
|
|
123
|
+
## 8.1.0-canary.40
|
|
124
|
+
|
|
125
|
+
## 8.1.0-canary.39
|
|
126
|
+
|
|
127
|
+
## 8.1.0-canary.38
|
|
128
|
+
|
|
129
|
+
## 8.1.0-canary.37
|
|
130
|
+
|
|
131
|
+
## 8.1.0-canary.36
|
|
132
|
+
|
|
133
|
+
## 8.1.0-canary.35
|
|
134
|
+
|
|
135
|
+
## 8.1.0-canary.34
|
|
136
|
+
|
|
137
|
+
## 8.1.0-canary.33
|
|
138
|
+
|
|
139
|
+
## 8.1.0-canary.32
|
|
140
|
+
|
|
141
|
+
## 8.1.0-canary.31
|
|
142
|
+
|
|
143
|
+
## 8.1.0-canary.30
|
|
144
|
+
|
|
145
|
+
## 8.1.0-canary.29
|
|
146
|
+
|
|
147
|
+
## 8.1.0-canary.28
|
|
148
|
+
|
|
149
|
+
## 8.1.0-canary.27
|
|
150
|
+
|
|
151
|
+
## 8.1.0-canary.26
|
|
152
|
+
|
|
153
|
+
## 8.1.0-canary.25
|
|
154
|
+
|
|
155
|
+
## 8.1.0-canary.24
|
|
156
|
+
|
|
157
|
+
## 8.1.0-canary.23
|
|
158
|
+
|
|
159
|
+
## 8.1.0-canary.22
|
|
160
|
+
|
|
161
|
+
## 8.1.0-canary.21
|
|
162
|
+
|
|
163
|
+
## 8.1.0-canary.20
|
|
164
|
+
|
|
165
|
+
## 8.1.0-canary.19
|
|
166
|
+
|
|
167
|
+
## 8.1.0-canary.18
|
|
168
|
+
|
|
169
|
+
## 8.1.0-canary.17
|
|
170
|
+
|
|
171
|
+
## 8.1.0-canary.16
|
|
172
|
+
|
|
173
|
+
## 8.1.0-canary.15
|
|
174
|
+
|
|
175
|
+
## 8.1.0-canary.14
|
|
176
|
+
|
|
177
|
+
## 8.1.0-canary.13
|
|
178
|
+
|
|
179
|
+
## 8.1.0-canary.12
|
|
180
|
+
|
|
181
|
+
## 8.1.0-canary.11
|
|
182
|
+
|
|
183
|
+
## 8.1.0-canary.10
|
|
184
|
+
|
|
185
|
+
## 8.1.0-canary.9
|
|
186
|
+
|
|
3
187
|
## 8.1.0-canary.8
|
|
4
188
|
|
|
5
189
|
## 8.1.0-canary.7
|
|
@@ -1336,31 +1520,31 @@
|
|
|
1336
1520
|
All occurences of `<Trans>` and `t` need to be replaced:
|
|
1337
1521
|
|
|
1338
1522
|
```tsx
|
|
1339
|
-
import { Trans, t } from
|
|
1523
|
+
import { Trans, t } from '@lingui/macro'
|
|
1340
1524
|
|
|
1341
1525
|
function MyComponent() {
|
|
1342
|
-
const foo =
|
|
1526
|
+
const foo = 'bar'
|
|
1343
1527
|
return (
|
|
1344
1528
|
<div aria-label={t`Account ${foo}`}>
|
|
1345
1529
|
<Trans>My Translation {foo}</Trans>
|
|
1346
1530
|
</div>
|
|
1347
|
-
)
|
|
1531
|
+
)
|
|
1348
1532
|
}
|
|
1349
1533
|
```
|
|
1350
1534
|
|
|
1351
1535
|
Needs to be replaced with:
|
|
1352
1536
|
|
|
1353
1537
|
```tsx
|
|
1354
|
-
import { Trans } from
|
|
1355
|
-
import { i18n } from
|
|
1538
|
+
import { Trans } from '@lingui/react'
|
|
1539
|
+
import { i18n } from '@lingui/core'
|
|
1356
1540
|
|
|
1357
1541
|
function MyComponent() {
|
|
1358
|
-
const foo =
|
|
1542
|
+
const foo = 'bar'
|
|
1359
1543
|
return (
|
|
1360
1544
|
<div aria-label={i18n._(/* i18n */ `Account {foo}`, { foo })}>
|
|
1361
|
-
<Trans key=
|
|
1545
|
+
<Trans key='My Translation {foo}' values={{ foo }}></Trans>
|
|
1362
1546
|
</div>
|
|
1363
|
-
)
|
|
1547
|
+
)
|
|
1364
1548
|
}
|
|
1365
1549
|
```
|
|
1366
1550
|
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { NumberFieldElement } from '@graphcommerce/ecommerce-ui'
|
|
2
|
+
import { Image } from '@graphcommerce/image'
|
|
3
|
+
import { ProductPageItemFragment } from '@graphcommerce/magento-product/Api/ProductPageItem.gql'
|
|
4
|
+
import {
|
|
5
|
+
AddToCartItemSelector,
|
|
6
|
+
useFormAddProductsToCart,
|
|
7
|
+
} from '@graphcommerce/magento-product/components'
|
|
8
|
+
import { Money } from '@graphcommerce/magento-store'
|
|
9
|
+
import {
|
|
10
|
+
ActionCard,
|
|
11
|
+
ActionCardProps,
|
|
12
|
+
actionCardImageSizes,
|
|
13
|
+
responsiveVal,
|
|
14
|
+
} from '@graphcommerce/next-ui'
|
|
15
|
+
import { Box, Link } from '@mui/material'
|
|
16
|
+
|
|
17
|
+
export type GroupedProductActionCardProps = ProductPageItemFragment &
|
|
18
|
+
Omit<ActionCardProps, 'value' | 'image' | 'price' | 'title' | 'action'> &
|
|
19
|
+
AddToCartItemSelector
|
|
20
|
+
|
|
21
|
+
const typographySizes = {
|
|
22
|
+
small: 'body2',
|
|
23
|
+
medium: 'body1',
|
|
24
|
+
large: 'subtitle1',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function GroupedProductActionCard(props: GroupedProductActionCardProps) {
|
|
28
|
+
const {
|
|
29
|
+
uid,
|
|
30
|
+
name,
|
|
31
|
+
small_image,
|
|
32
|
+
price_range,
|
|
33
|
+
url_key,
|
|
34
|
+
sx = [],
|
|
35
|
+
size = 'large',
|
|
36
|
+
index = 0,
|
|
37
|
+
sku,
|
|
38
|
+
url_rewrites,
|
|
39
|
+
...rest
|
|
40
|
+
} = props
|
|
41
|
+
|
|
42
|
+
const { control, register } = useFormAddProductsToCart()
|
|
43
|
+
if (!sku) return null
|
|
44
|
+
const hasUrl = (url_rewrites ?? []).length > 0
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
<input type='hidden' {...register(`cartItems.${index}.sku`)} value={sku} />
|
|
48
|
+
<ActionCard
|
|
49
|
+
variant='default'
|
|
50
|
+
value={uid}
|
|
51
|
+
sx={[
|
|
52
|
+
(theme) => ({
|
|
53
|
+
'&.ActionCard-root': {
|
|
54
|
+
px: 0,
|
|
55
|
+
py: theme.spacings.xs,
|
|
56
|
+
},
|
|
57
|
+
'& .ActionCard-title': {
|
|
58
|
+
width: '100%',
|
|
59
|
+
},
|
|
60
|
+
'& .ActionCard-rootInner': {
|
|
61
|
+
justifyContent: 'space-between',
|
|
62
|
+
alignItems: 'stretch',
|
|
63
|
+
},
|
|
64
|
+
'&.sizeSmall': {
|
|
65
|
+
px: 0,
|
|
66
|
+
},
|
|
67
|
+
'& .ActionCard-end': {
|
|
68
|
+
justifyContent: 'space-between',
|
|
69
|
+
},
|
|
70
|
+
'& .ActionCard-action': {
|
|
71
|
+
pr: theme.spacings.xs,
|
|
72
|
+
},
|
|
73
|
+
'& .ActionCard-image': {
|
|
74
|
+
alignSelf: 'flex-start',
|
|
75
|
+
},
|
|
76
|
+
'& .ActionCard-secondaryAction': {
|
|
77
|
+
typography: typographySizes[size],
|
|
78
|
+
display: 'flex',
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
color: 'text.secondary',
|
|
81
|
+
gap: '10px',
|
|
82
|
+
justifyContent: 'start',
|
|
83
|
+
},
|
|
84
|
+
'& .ActionCard-price': {
|
|
85
|
+
typography: typographySizes[size],
|
|
86
|
+
pr: theme.spacings.xs,
|
|
87
|
+
mb: { xs: 0.5, sm: 0 },
|
|
88
|
+
},
|
|
89
|
+
}),
|
|
90
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
91
|
+
]}
|
|
92
|
+
image={
|
|
93
|
+
small_image?.url && (
|
|
94
|
+
<Image
|
|
95
|
+
layout='fill'
|
|
96
|
+
src={small_image?.url}
|
|
97
|
+
sx={{
|
|
98
|
+
width: actionCardImageSizes[size],
|
|
99
|
+
height: actionCardImageSizes[size],
|
|
100
|
+
display: 'block',
|
|
101
|
+
borderRadius: 1,
|
|
102
|
+
objectFit: 'contain',
|
|
103
|
+
}}
|
|
104
|
+
sizes={actionCardImageSizes[size]}
|
|
105
|
+
/>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
title={
|
|
109
|
+
url_key && hasUrl ? (
|
|
110
|
+
<Link
|
|
111
|
+
href={url_key}
|
|
112
|
+
underline='hover'
|
|
113
|
+
sx={{
|
|
114
|
+
color: 'inherit',
|
|
115
|
+
flexWrap: 'nowrap',
|
|
116
|
+
maxWidth: 'max-content',
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
{name}
|
|
120
|
+
</Link>
|
|
121
|
+
) : (
|
|
122
|
+
name
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
secondaryAction={
|
|
126
|
+
<NumberFieldElement
|
|
127
|
+
size='small'
|
|
128
|
+
inputProps={{ min: 0 }}
|
|
129
|
+
defaultValue={1}
|
|
130
|
+
control={control}
|
|
131
|
+
sx={{
|
|
132
|
+
width: responsiveVal(80, 120),
|
|
133
|
+
mt: 2,
|
|
134
|
+
'& .MuiFormHelperText-root': {
|
|
135
|
+
margin: 1,
|
|
136
|
+
width: '100%',
|
|
137
|
+
},
|
|
138
|
+
}}
|
|
139
|
+
name={`cartItems.${index}.quantity`}
|
|
140
|
+
onMouseDown={(e) => e.stopPropagation()}
|
|
141
|
+
/>
|
|
142
|
+
}
|
|
143
|
+
price={
|
|
144
|
+
<Box>
|
|
145
|
+
<Box>
|
|
146
|
+
<Money {...price_range.minimum_price.final_price} />
|
|
147
|
+
</Box>
|
|
148
|
+
{price_range.minimum_price.final_price.value !==
|
|
149
|
+
price_range.minimum_price.regular_price.value && (
|
|
150
|
+
<Box
|
|
151
|
+
component='span'
|
|
152
|
+
sx={{
|
|
153
|
+
textDecoration: 'line-through',
|
|
154
|
+
color: 'text.disabled',
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
<Money {...price_range.minimum_price.regular_price} />
|
|
158
|
+
</Box>
|
|
159
|
+
)}
|
|
160
|
+
</Box>
|
|
161
|
+
}
|
|
162
|
+
{...rest}
|
|
163
|
+
/>
|
|
164
|
+
</>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ActionCardLayout, filterNonNullableKeys } from '@graphcommerce/next-ui'
|
|
2
|
+
import { useMemo } from 'react'
|
|
3
|
+
import { ProductPageGroupedQueryFragment } from '../ProductPageGroupedQueryFragment.gql'
|
|
4
|
+
import { GroupedProductActionCard } from './GroupedProductActionCard'
|
|
5
|
+
|
|
6
|
+
type GroupedProductsProps = {
|
|
7
|
+
product: NonNullable<NonNullable<ProductPageGroupedQueryFragment['typeProducts']>['items']>[0]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function GroupedProducts(props: GroupedProductsProps) {
|
|
11
|
+
const { product } = props
|
|
12
|
+
const productItems = useMemo(() => {
|
|
13
|
+
if (product?.__typename !== 'GroupedProduct') return null
|
|
14
|
+
const { items } = product
|
|
15
|
+
return filterNonNullableKeys(items, ['product']).map((item, i) => ({
|
|
16
|
+
...item.product,
|
|
17
|
+
value: item.product.sku ?? '',
|
|
18
|
+
index: i,
|
|
19
|
+
}))
|
|
20
|
+
}, [product])
|
|
21
|
+
if (!productItems) return null
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<ActionCardLayout>
|
|
25
|
+
{productItems.map((item) => (
|
|
26
|
+
<GroupedProductActionCard {...item} key={item.value ?? ''} size='medium' />
|
|
27
|
+
))}
|
|
28
|
+
</ActionCardLayout>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
@@ -3,19 +3,7 @@ fragment ProductPageGroupedQueryFragment on Query {
|
|
|
3
3
|
items {
|
|
4
4
|
__typename
|
|
5
5
|
uid
|
|
6
|
-
...
|
|
7
|
-
items {
|
|
8
|
-
position
|
|
9
|
-
qty
|
|
10
|
-
product {
|
|
11
|
-
uid
|
|
12
|
-
__typename
|
|
13
|
-
...ProductListItem
|
|
14
|
-
...ProductListItemSimple
|
|
15
|
-
...ProductListItemVirtual
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
6
|
+
...GroupedProduct
|
|
19
7
|
}
|
|
20
8
|
}
|
|
21
9
|
}
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-product-grouped",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "9.0.0-canary.100",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,17 +12,22 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/
|
|
16
|
-
"@graphcommerce/
|
|
17
|
-
"@graphcommerce/
|
|
18
|
-
"@graphcommerce/
|
|
19
|
-
"@graphcommerce/magento-
|
|
20
|
-
"@graphcommerce/magento-product
|
|
21
|
-
"@graphcommerce/
|
|
22
|
-
"@graphcommerce/
|
|
15
|
+
"@graphcommerce/ecommerce-ui": "^9.0.0-canary.100",
|
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.100",
|
|
17
|
+
"@graphcommerce/graphql": "^9.0.0-canary.100",
|
|
18
|
+
"@graphcommerce/image": "^9.0.0-canary.100",
|
|
19
|
+
"@graphcommerce/magento-cart": "^9.0.0-canary.100",
|
|
20
|
+
"@graphcommerce/magento-product": "^9.0.0-canary.100",
|
|
21
|
+
"@graphcommerce/magento-product-simple": "^9.0.0-canary.100",
|
|
22
|
+
"@graphcommerce/magento-product-virtual": "^9.0.0-canary.100",
|
|
23
|
+
"@graphcommerce/magento-store": "^9.0.0-canary.100",
|
|
24
|
+
"@graphcommerce/next-ui": "^9.0.0-canary.100",
|
|
25
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.100",
|
|
26
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.100",
|
|
23
27
|
"@lingui/core": "^4.2.1",
|
|
24
28
|
"@lingui/macro": "^4.2.1",
|
|
25
29
|
"@lingui/react": "^4.2.1",
|
|
30
|
+
"@mui/material": "^5.10.16",
|
|
26
31
|
"next": "*",
|
|
27
32
|
"react": "^18.2.0",
|
|
28
33
|
"react-dom": "^18.2.0"
|