@graphcommerce/magento-product 7.0.0-canary.21 → 7.0.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 +235 -1
- package/Config.graphqls +12 -2
- package/components/AddProductsToCart/AddProductsToCart.graphql +1 -0
- package/components/AddProductsToCart/AddProductsToCartError.tsx +2 -3
- package/components/AddProductsToCart/AddProductsToCartForm.tsx +1 -2
- package/components/AddProductsToCart/AddProductsToCartQuantity.tsx +3 -2
- package/components/AddProductsToCart/useAddProductsToCartAction.ts +2 -3
- package/components/AddProductsToCart/useFormAddProductsToCart.ts +3 -1
- package/components/JsonLdProduct/JsonLdProduct.graphql +1 -1
- package/components/JsonLdProduct/ProductPageJsonLd.tsx +12 -0
- package/components/JsonLdProduct/index.ts +2 -0
- package/components/ProductCustomizable/ProductCustomizable.tsx +4 -5
- package/components/ProductFiltersPro/PriceSlider.tsx +7 -2
- package/components/ProductFiltersPro/ProductFilterEqualChip.tsx +1 -1
- package/components/ProductFiltersPro/ProductFilterEqualSection.tsx +36 -37
- package/components/ProductFiltersPro/ProductFilterRangeChip.tsx +1 -1
- package/components/ProductFiltersPro/ProductFilterRangeSection.tsx +19 -23
- package/components/ProductFiltersPro/ProductFiltersPro.tsx +35 -18
- package/components/ProductFiltersPro/ProductFiltersProAggregations.tsx +5 -6
- package/components/ProductFiltersPro/ProductFiltersProAllFiltersChip.tsx +20 -43
- package/components/ProductFiltersPro/ProductFiltersProAllFiltersSidebar.tsx +32 -0
- package/components/ProductFiltersPro/ProductFiltersProClearAll.tsx +48 -0
- package/components/ProductFiltersPro/ProductFiltersProLayoutSidebar.tsx +100 -0
- package/components/ProductFiltersPro/ProductFiltersProLimitChip.tsx +2 -2
- package/components/ProductFiltersPro/ProductFiltersProLimitSection.tsx +35 -32
- package/components/ProductFiltersPro/ProductFiltersProSortChip.tsx +3 -2
- package/components/ProductFiltersPro/ProductFiltersProSortSection.tsx +31 -31
- package/components/ProductFiltersPro/index.ts +3 -0
- package/components/ProductFiltersPro/useClearAllFiltersHandler.ts +31 -0
- package/components/ProductListCount/ProductListCount.tsx +12 -6
- package/components/ProductListFilters/FilterEqualType.tsx +1 -0
- package/components/ProductListFilters/FilterRangeType.tsx +1 -0
- package/components/ProductListItems/ProductListItemsBase.tsx +58 -38
- package/components/ProductListItems/filterTypes.tsx +4 -5
- package/components/ProductListLink/ProductListLink.tsx +1 -0
- package/components/ProductListPagination/ProductListPagination.tsx +14 -7
- package/components/ProductListPrice/ProductListPrice.tsx +1 -1
- package/components/ProductListPrice/index.ts +2 -0
- package/components/ProductPage/ProductPageAddToCartRow.tsx +3 -2
- package/components/ProductPageBreadcrumb/ProductPageBreadcrumb.tsx +2 -2
- package/components/ProductPageDescription/ProductPageDescription.graphql +1 -0
- package/components/ProductPageDescription/ProductPageDescription.tsx +6 -4
- package/components/ProductPageGallery/ProductPageGallery.graphql +1 -0
- package/components/ProductPageGallery/ProductPageGallery.tsx +6 -8
- package/components/ProductPageMeta/ProductPageMeta.graphql +5 -3
- package/components/ProductPageMeta/ProductPageMeta.tsx +18 -21
- package/components/ProductPageName/ProductPageName.graphql +4 -0
- package/components/ProductPageName/ProductPageName.tsx +10 -0
- package/components/ProductPageName/index.ts +1 -0
- package/components/ProductPagePrice/ProductPagePrice.graphql +1 -0
- package/components/ProductPagePrice/ProductPagePrice.tsx +2 -2
- package/components/ProductShortDescription/ProductShortDescription.graphql +1 -0
- package/components/ProductShortDescription/ProductShortDescription.tsx +6 -2
- package/components/ProductSpecs/ProductSpecs.tsx +7 -2
- package/components/index.ts +5 -2
- package/hooks/useProductListLink.ts +2 -2
- package/hooks/useProductListLinkReplace.ts +2 -2
- package/index.ts +1 -0
- package/package.json +16 -15
- package/components/AddProductsToCart/AddProductsToCartIndex.tsx +0 -3
- package/components/ProductFiltersPro/useFilterActions.ts +0 -61
- package/components/ProductListItems/ProductListItems.tsx +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,240 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## 7.0.0
|
|
3
|
+
## 7.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`e55d8c390`](https://github.com/graphcommerce-org/graphcommerce/commit/e55d8c390d90b4bb7bab11c6a99027ac72bd7e3e) - Created a new sidebar layout system, can be configured with productFiltersLayout in the graphcommerce.config.js ([@paales](https://github.com/paales))
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- [#1978](https://github.com/graphcommerce-org/graphcommerce/pull/1978) [`0c91ac1f7`](https://github.com/graphcommerce-org/graphcommerce/commit/0c91ac1f70f58dec418e945fc4a6a8c6732cc21e) - When a user selects a variant, it will switch the values on the configurable page with the values of the configured variant. Enabling options here will allow switching of those variants. ([@carlocarels90](https://github.com/carlocarels90))
|
|
12
|
+
|
|
13
|
+
- [#1961](https://github.com/graphcommerce-org/graphcommerce/pull/1961) [`4a759c662`](https://github.com/graphcommerce-org/graphcommerce/commit/4a759c66215eaa69edc342b898e05e8f92c3ba9a) - Add Open Graph meta tags to all pages ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
|
|
14
|
+
|
|
15
|
+
- [#1956](https://github.com/graphcommerce-org/graphcommerce/pull/1956) [`9e87443a1`](https://github.com/graphcommerce-org/graphcommerce/commit/9e87443a1139a87f2ead3227fee3f4a76dd65841) - Allow children to be passed into ProductSpecs ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#1914](https://github.com/graphcommerce-org/graphcommerce/pull/1914) [`c237f2f2c`](https://github.com/graphcommerce-org/graphcommerce/commit/c237f2f2c87d9e3c8aefc536a13b5b9203556f27) - Category pages now have the ability to select the displayed pageSize of a page if the backend provides multiple options. A non-default pageSize and a non-default sort option will now receive noindex meta tags when viewed. ([@paales](https://github.com/paales))
|
|
20
|
+
|
|
21
|
+
- [#1911](https://github.com/graphcommerce-org/graphcommerce/pull/1911) [`c10d6d5be`](https://github.com/graphcommerce-org/graphcommerce/commit/c10d6d5beb0d1560d33e3e301d88fa9201515133) - Translations were missing for the ProductSidebarDelivery ([@rustmaestro](https://github.com/rustmaestro))
|
|
22
|
+
|
|
23
|
+
- [#1948](https://github.com/graphcommerce-org/graphcommerce/pull/1948) [`17390af4f`](https://github.com/graphcommerce-org/graphcommerce/commit/17390af4f9d4a73c11c857b92eeb05ae185da9da) - Allow the redirect prop of AddProductsToCartForm to be false, so redirects can be disabled ([@bramvanderholst](https://github.com/bramvanderholst))
|
|
24
|
+
|
|
25
|
+
- [#2001](https://github.com/graphcommerce-org/graphcommerce/pull/2001) [`9cc5f8495`](https://github.com/graphcommerce-org/graphcommerce/commit/9cc5f8495d0970d457ac15eda4bb4e7cd3f8120a) - Migrate to productListLink, away from the ProductListLink component ([@paales](https://github.com/paales))
|
|
26
|
+
|
|
27
|
+
- [#1973](https://github.com/graphcommerce-org/graphcommerce/pull/1973) [`257a66e38`](https://github.com/graphcommerce-org/graphcommerce/commit/257a66e388933a333941d9459e6e6a266d05cda4) - Limit would not be applied correctly for the product listing ([@JoshuaS98](https://github.com/JoshuaS98))
|
|
28
|
+
|
|
29
|
+
- [#1919](https://github.com/graphcommerce-org/graphcommerce/pull/1919) [`201e75401`](https://github.com/graphcommerce-org/graphcommerce/commit/201e75401c99b7e7aeee06c7e5db737c19749298) - Fixed incorrect className for topRight ProductListItem location ([@bramvanderholst](https://github.com/bramvanderholst))
|
|
30
|
+
|
|
31
|
+
- [#2003](https://github.com/graphcommerce-org/graphcommerce/pull/2003) [`c4b102577`](https://github.com/graphcommerce-org/graphcommerce/commit/c4b1025774aad87c5e51f05c5b988d364f4bf20e) - ProductPageAddToCartRow wasn't aligned in the middle causing the price to be misaligned ([@Jessevdpoel](https://github.com/Jessevdpoel))
|
|
32
|
+
|
|
33
|
+
- [#1992](https://github.com/graphcommerce-org/graphcommerce/pull/1992) [`bffdff6f0`](https://github.com/graphcommerce-org/graphcommerce/commit/bffdff6f09d92e0d56ba904422b939ffeed12fae) - Export props from ProductPagePrice and ProductListPrice ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
|
|
34
|
+
|
|
35
|
+
- [#1914](https://github.com/graphcommerce-org/graphcommerce/pull/1914) [`b1abccb67`](https://github.com/graphcommerce-org/graphcommerce/commit/b1abccb677b83b090882ed1e0cf5336c52b175a4) - Category limit url param wasn't parsed correctly, causing a 404. ([@paales](https://github.com/paales))
|
|
36
|
+
|
|
37
|
+
- [#1959](https://github.com/graphcommerce-org/graphcommerce/pull/1959) [`d0809b132`](https://github.com/graphcommerce-org/graphcommerce/commit/d0809b132a0e4cbdfeb86164f6c16a89ebecd987) - Added support for default values in the Config.graphqls files for the documentation ([@JoshuaS98](https://github.com/JoshuaS98))
|
|
38
|
+
|
|
39
|
+
## 6.2.0-canary.98
|
|
40
|
+
|
|
41
|
+
## 6.2.0-canary.97
|
|
42
|
+
|
|
43
|
+
## 6.2.0-canary.96
|
|
44
|
+
|
|
45
|
+
## 6.2.0-canary.95
|
|
46
|
+
|
|
47
|
+
## 6.2.0-canary.94
|
|
48
|
+
|
|
49
|
+
## 6.2.0-canary.93
|
|
50
|
+
|
|
51
|
+
## 6.2.0-canary.92
|
|
52
|
+
|
|
53
|
+
## 6.2.0-canary.91
|
|
54
|
+
|
|
55
|
+
## 6.2.0-canary.90
|
|
56
|
+
|
|
57
|
+
## 6.2.0-canary.89
|
|
58
|
+
|
|
59
|
+
## 6.2.0-canary.88
|
|
60
|
+
|
|
61
|
+
## 6.2.0-canary.87
|
|
62
|
+
|
|
63
|
+
## 6.2.0-canary.86
|
|
64
|
+
|
|
65
|
+
## 6.2.0-canary.85
|
|
66
|
+
|
|
67
|
+
## 6.2.0-canary.84
|
|
68
|
+
|
|
69
|
+
## 6.2.0-canary.83
|
|
70
|
+
|
|
71
|
+
## 6.2.0-canary.82
|
|
72
|
+
|
|
73
|
+
## 6.2.0-canary.81
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- [#2003](https://github.com/graphcommerce-org/graphcommerce/pull/2003) [`c4b102577`](https://github.com/graphcommerce-org/graphcommerce/commit/c4b1025774aad87c5e51f05c5b988d364f4bf20e) - ProductPageAddToCartRow wasn't aligned in the middle causing the price to be misaligned ([@Jessevdpoel](https://github.com/Jessevdpoel))
|
|
78
|
+
|
|
79
|
+
## 6.2.0-canary.80
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- [#2001](https://github.com/graphcommerce-org/graphcommerce/pull/2001) [`9cc5f8495`](https://github.com/graphcommerce-org/graphcommerce/commit/9cc5f8495d0970d457ac15eda4bb4e7cd3f8120a) - Migrate to productListLink, away from the ProductListLink component ([@paales](https://github.com/paales))
|
|
84
|
+
|
|
85
|
+
## 6.2.0-canary.79
|
|
86
|
+
|
|
87
|
+
## 6.2.0-canary.78
|
|
88
|
+
|
|
89
|
+
## 6.2.0-canary.77
|
|
90
|
+
|
|
91
|
+
## 6.2.0-canary.76
|
|
92
|
+
|
|
93
|
+
## 6.2.0-canary.75
|
|
94
|
+
|
|
95
|
+
## 6.2.0-canary.74
|
|
96
|
+
|
|
97
|
+
## 6.2.0-canary.73
|
|
98
|
+
|
|
99
|
+
### Minor Changes
|
|
100
|
+
|
|
101
|
+
- [#1978](https://github.com/graphcommerce-org/graphcommerce/pull/1978) [`0c91ac1f7`](https://github.com/graphcommerce-org/graphcommerce/commit/0c91ac1f70f58dec418e945fc4a6a8c6732cc21e) - When a user selects a variant, it will switch the values on the configurable page with the values of the configured variant. Enabling options here will allow switching of those variants. ([@carlocarels90](https://github.com/carlocarels90))
|
|
102
|
+
|
|
103
|
+
## 6.2.0-canary.72
|
|
104
|
+
|
|
105
|
+
## 6.2.0-canary.71
|
|
106
|
+
|
|
107
|
+
## 6.2.0-canary.70
|
|
108
|
+
|
|
109
|
+
## 6.2.0-canary.69
|
|
110
|
+
|
|
111
|
+
## 6.2.0-canary.68
|
|
112
|
+
|
|
113
|
+
## 6.2.0-canary.67
|
|
114
|
+
|
|
115
|
+
## 6.2.0-canary.66
|
|
116
|
+
|
|
117
|
+
## 6.2.0-canary.65
|
|
118
|
+
|
|
119
|
+
## 6.2.0-canary.64
|
|
120
|
+
|
|
121
|
+
## 6.2.0-canary.63
|
|
122
|
+
|
|
123
|
+
## 6.2.0-canary.62
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- [#1992](https://github.com/graphcommerce-org/graphcommerce/pull/1992) [`bffdff6f0`](https://github.com/graphcommerce-org/graphcommerce/commit/bffdff6f09d92e0d56ba904422b939ffeed12fae) - Export props from ProductPagePrice and ProductListPrice ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
|
|
128
|
+
|
|
129
|
+
## 6.2.0-canary.61
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- [#1975](https://github.com/graphcommerce-org/graphcommerce/pull/1975) [`93efa6eea`](https://github.com/graphcommerce-org/graphcommerce/commit/93efa6eea16894a56e2964050e4ce84bf96e652f) - collapse limitsection filters ([@JoshuaS98](https://github.com/JoshuaS98))
|
|
134
|
+
|
|
135
|
+
## 6.2.0-canary.60
|
|
136
|
+
|
|
137
|
+
## 6.2.0-canary.59
|
|
138
|
+
|
|
139
|
+
## 6.2.0-canary.58
|
|
140
|
+
|
|
141
|
+
## 6.2.0-canary.57
|
|
142
|
+
|
|
143
|
+
## 6.2.0-canary.56
|
|
144
|
+
|
|
145
|
+
## 6.2.0-canary.55
|
|
146
|
+
|
|
147
|
+
## 6.2.0-canary.54
|
|
148
|
+
|
|
149
|
+
## 6.2.0-canary.53
|
|
150
|
+
|
|
151
|
+
### Patch Changes
|
|
152
|
+
|
|
153
|
+
- [#1973](https://github.com/graphcommerce-org/graphcommerce/pull/1973) [`257a66e38`](https://github.com/graphcommerce-org/graphcommerce/commit/257a66e388933a333941d9459e6e6a266d05cda4) - Fix limit filters ([@JoshuaS98](https://github.com/JoshuaS98))
|
|
154
|
+
|
|
155
|
+
## 6.2.0-canary.52
|
|
156
|
+
|
|
157
|
+
## 6.2.0-canary.51
|
|
158
|
+
|
|
159
|
+
## 6.2.0-canary.50
|
|
160
|
+
|
|
161
|
+
### Minor Changes
|
|
162
|
+
|
|
163
|
+
- [`e55d8c390`](https://github.com/graphcommerce-org/graphcommerce/commit/e55d8c390d90b4bb7bab11c6a99027ac72bd7e3e) - Created a new sidebar layout system, can be configured with productFiltersLayout in the graphcommerce.config.js ([@paales](https://github.com/paales))
|
|
164
|
+
|
|
165
|
+
## 6.2.0-canary.49
|
|
166
|
+
|
|
167
|
+
### Patch Changes
|
|
168
|
+
|
|
169
|
+
- [#1959](https://github.com/graphcommerce-org/graphcommerce/pull/1959) [`d0809b132`](https://github.com/graphcommerce-org/graphcommerce/commit/d0809b132a0e4cbdfeb86164f6c16a89ebecd987) - Added support for default values in the Config.graphqls files for the documentation ([@JoshuaS98](https://github.com/JoshuaS98))
|
|
170
|
+
|
|
171
|
+
## 6.2.0-canary.48
|
|
172
|
+
|
|
173
|
+
### Minor Changes
|
|
174
|
+
|
|
175
|
+
- [#1961](https://github.com/graphcommerce-org/graphcommerce/pull/1961) [`4a759c662`](https://github.com/graphcommerce-org/graphcommerce/commit/4a759c66215eaa69edc342b898e05e8f92c3ba9a) - Add Open Graph meta tags to all pages ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
|
|
176
|
+
|
|
177
|
+
## 6.2.0-canary.47
|
|
178
|
+
|
|
179
|
+
## 6.2.0-canary.46
|
|
180
|
+
|
|
181
|
+
## 6.2.0-canary.45
|
|
182
|
+
|
|
183
|
+
## 6.2.0-canary.44
|
|
184
|
+
|
|
185
|
+
## 6.2.0-canary.43
|
|
186
|
+
|
|
187
|
+
## 6.2.0-canary.42
|
|
188
|
+
|
|
189
|
+
## 6.2.0-canary.41
|
|
190
|
+
|
|
191
|
+
## 6.2.0-canary.40
|
|
192
|
+
|
|
193
|
+
### Minor Changes
|
|
194
|
+
|
|
195
|
+
- [#1956](https://github.com/graphcommerce-org/graphcommerce/pull/1956) [`9e87443a1`](https://github.com/graphcommerce-org/graphcommerce/commit/9e87443a1139a87f2ead3227fee3f4a76dd65841) - Allow children to be passed into ProductSpecs ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
|
|
196
|
+
|
|
197
|
+
## 6.2.0-canary.39
|
|
198
|
+
|
|
199
|
+
## 6.2.0-canary.38
|
|
200
|
+
|
|
201
|
+
## 6.2.0-canary.37
|
|
202
|
+
|
|
203
|
+
## 6.2.0-canary.36
|
|
204
|
+
|
|
205
|
+
## 6.2.0-canary.35
|
|
206
|
+
|
|
207
|
+
## 6.2.0-canary.34
|
|
208
|
+
|
|
209
|
+
## 6.2.0-canary.33
|
|
210
|
+
|
|
211
|
+
## 6.2.0-canary.32
|
|
212
|
+
|
|
213
|
+
## 6.2.0-canary.31
|
|
214
|
+
|
|
215
|
+
## 6.2.0-canary.30
|
|
216
|
+
|
|
217
|
+
## 6.2.0-canary.29
|
|
218
|
+
|
|
219
|
+
## 6.2.0-canary.28
|
|
220
|
+
|
|
221
|
+
### Patch Changes
|
|
222
|
+
|
|
223
|
+
- [#1948](https://github.com/graphcommerce-org/graphcommerce/pull/1948) [`17390af4f`](https://github.com/graphcommerce-org/graphcommerce/commit/17390af4f9d4a73c11c857b92eeb05ae185da9da) - Allow the redirect prop of AddProductsToCartForm to be false, so redirects can be disabled ([@bramvanderholst](https://github.com/bramvanderholst))
|
|
224
|
+
|
|
225
|
+
## 6.2.0-canary.27
|
|
226
|
+
|
|
227
|
+
## 6.2.0-canary.26
|
|
228
|
+
|
|
229
|
+
## 6.2.0-canary.25
|
|
230
|
+
|
|
231
|
+
## 6.2.0-canary.24
|
|
232
|
+
|
|
233
|
+
## 6.2.0-canary.23
|
|
234
|
+
|
|
235
|
+
## 6.2.0-canary.22
|
|
236
|
+
|
|
237
|
+
## 6.2.0-canary.21
|
|
4
238
|
|
|
5
239
|
## 6.2.0-canary.20
|
|
6
240
|
|
package/Config.graphqls
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
enum ProductFiltersLayout {
|
|
2
|
+
DEFAULT
|
|
3
|
+
SIDEBAR
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
extend input GraphCommerceConfig {
|
|
2
7
|
"""
|
|
3
8
|
On older versions of GraphCommerce products would use a product type specific route.
|
|
@@ -9,11 +14,16 @@ extend input GraphCommerceConfig {
|
|
|
9
14
|
legacyProductRoute: Boolean
|
|
10
15
|
"""
|
|
11
16
|
Product filters with better UI for mobile and desktop.
|
|
12
|
-
|
|
13
|
-
@experimental This is an experimental feature and may change in the future.
|
|
14
17
|
"""
|
|
15
18
|
productFiltersPro: Boolean
|
|
16
19
|
|
|
20
|
+
"""
|
|
21
|
+
Layout how the filters are rendered.
|
|
22
|
+
DEFAULT: Will be rendered as horzontal chips on desktop and mobile
|
|
23
|
+
SIDEBAR: Will be rendered as a sidebar on desktop and horizontal chips on mobile
|
|
24
|
+
"""
|
|
25
|
+
productFiltersLayout: ProductFiltersLayout = DEFAULT
|
|
26
|
+
|
|
17
27
|
"""
|
|
18
28
|
By default we route products to /p/[url] but you can change this to /product/[url] if you wish.
|
|
19
29
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useFormState } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { FormHelperText } from '@mui/material'
|
|
3
|
-
import { useFormAddProductsToCart } from './useFormAddProductsToCart'
|
|
3
|
+
import { AddToCartItemSelector, useFormAddProductsToCart } from './useFormAddProductsToCart'
|
|
4
4
|
|
|
5
5
|
type AddProductsToCartErrorProps = {
|
|
6
6
|
children?: React.ReactNode
|
|
7
|
-
|
|
8
|
-
}
|
|
7
|
+
} & AddToCartItemSelector
|
|
9
8
|
|
|
10
9
|
export function AddProductsToCartError(props: AddProductsToCartErrorProps) {
|
|
11
10
|
const { children, index = 0 } = props
|
|
@@ -88,8 +88,7 @@ export function AddProductsToCartForm(props: AddProductsToCartFormProps) {
|
|
|
88
88
|
})),
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
const
|
|
92
|
-
const { sku } = lastItem
|
|
91
|
+
const sku = requestData.cartItems[requestData.cartItems.length - 1]?.sku
|
|
93
92
|
|
|
94
93
|
if (sku && redirect === 'added') {
|
|
95
94
|
// Preload crosssells
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { NumberFieldElement, NumberFieldElementProps } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { AddProductsToCartMutationVariables } from './AddProductsToCart.gql'
|
|
3
|
-
import { useFormAddProductsToCart } from './useFormAddProductsToCart'
|
|
3
|
+
import { AddToCartItemSelector, useFormAddProductsToCart } from './useFormAddProductsToCart'
|
|
4
4
|
|
|
5
5
|
type AddToCartQuantityProps = Omit<
|
|
6
6
|
NumberFieldElementProps<AddProductsToCartMutationVariables>,
|
|
7
7
|
'error' | 'required' | 'inputProps' | 'helperText' | 'name' | 'control' | 'name'
|
|
8
|
-
> &
|
|
8
|
+
> &
|
|
9
|
+
AddToCartItemSelector
|
|
9
10
|
|
|
10
11
|
export function AddProductsToCartQuantity(props: AddToCartQuantityProps) {
|
|
11
12
|
const { index = 0 } = props
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useFormState } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { useEventCallback } from '@mui/material'
|
|
3
3
|
import { UseAddProductsToCartActionFragment } from './UseAddProductsToCartAction.gql'
|
|
4
|
-
import { useFormAddProductsToCart } from './useFormAddProductsToCart'
|
|
4
|
+
import { AddToCartItemSelector, useFormAddProductsToCart } from './useFormAddProductsToCart'
|
|
5
5
|
|
|
6
|
-
export type UseAddProductsToCartActionProps = {
|
|
7
|
-
index?: number
|
|
6
|
+
export type UseAddProductsToCartActionProps = AddToCartItemSelector & {
|
|
8
7
|
disabled?: boolean
|
|
9
8
|
loading?: boolean
|
|
10
9
|
onClick?: React.MouseEventHandler<HTMLButtonElement>
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
AddProductsToCartMutationVariables,
|
|
7
7
|
} from './AddProductsToCart.gql'
|
|
8
8
|
|
|
9
|
-
export type RedirectType = LiteralUnion<'added' | undefined, `/${string}`>
|
|
9
|
+
export type RedirectType = LiteralUnion<'added' | undefined | false, `/${string}`>
|
|
10
10
|
|
|
11
11
|
/** https://react-hook-form.com/api/useform/watch/ */
|
|
12
12
|
export type AddProductsToCartContextType = { redirect: RedirectType } & Omit<
|
|
@@ -14,6 +14,8 @@ export type AddProductsToCartContextType = { redirect: RedirectType } & Omit<
|
|
|
14
14
|
'formState' | 'watch'
|
|
15
15
|
>
|
|
16
16
|
|
|
17
|
+
export type AddToCartItemSelector = { index?: number }
|
|
18
|
+
|
|
17
19
|
export const AddProductsToCartContext = createContext(
|
|
18
20
|
undefined as AddProductsToCartContextType | undefined,
|
|
19
21
|
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JsonLd } from '@graphcommerce/next-ui'
|
|
2
|
+
import { JsonLdProductFragment } from './JsonLdProduct.gql'
|
|
3
|
+
|
|
4
|
+
type ProductPageJsonLdProps<T extends { '@type': string }> = {
|
|
5
|
+
product: JsonLdProductFragment
|
|
6
|
+
render: (product: JsonLdProductFragment) => T & { '@context': 'https://schema.org' }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function ProductPageJsonLd<T extends { '@type': string }>(props: ProductPageJsonLdProps<T>) {
|
|
10
|
+
const { product, render } = props
|
|
11
|
+
return <JsonLd<T> item={render(product)} />
|
|
12
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SelectElement, TextFieldElement } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { filterNonNullableKeys, RenderType, TypeRenderer } from '@graphcommerce/next-ui'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import { useFormAddProductsToCart } from '../AddProductsToCart'
|
|
4
|
+
import { AddToCartItemSelector, useFormAddProductsToCart } from '../AddProductsToCart'
|
|
5
5
|
import { ProductCustomizableFragment } from './ProductCustomizable.gql'
|
|
6
6
|
|
|
7
7
|
export type OptionTypeRenderer = TypeRenderer<
|
|
@@ -91,12 +91,11 @@ type OptionTypeRendererProp = Simplify<
|
|
|
91
91
|
: MissingOptionTypeRenderer & DefinedOptionTypeRenderer
|
|
92
92
|
>
|
|
93
93
|
|
|
94
|
-
type ProductCustomizableProps = {
|
|
94
|
+
type ProductCustomizableProps = AddToCartItemSelector & {
|
|
95
95
|
product: ProductCustomizableFragment
|
|
96
|
-
index?: number
|
|
97
96
|
} & (keyof MissingOptionTypeRenderer extends never
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
? { renderer?: OptionTypeRendererProp }
|
|
98
|
+
: { renderer: OptionTypeRendererProp })
|
|
100
99
|
|
|
101
100
|
export function ProductCustomizable(props: ProductCustomizableProps) {
|
|
102
101
|
const { product, renderer, index = 0 } = props
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FilterRangeTypeInput } from '@graphcommerce/graphql-mesh'
|
|
2
2
|
import { Money } from '@graphcommerce/magento-store'
|
|
3
3
|
import { extendableComponent, filterNonNullableKeys } from '@graphcommerce/next-ui'
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
4
5
|
import { Box, Slider, SxProps, Theme, useEventCallback } from '@mui/material'
|
|
5
6
|
import { useCallback } from 'react'
|
|
6
7
|
import { FilterProps } from './ProductFiltersProAggregations'
|
|
@@ -21,7 +22,7 @@ export function getMinMaxFromOptions(options: PriceSliderProps['options']) {
|
|
|
21
22
|
const min = totalRange[0][0]
|
|
22
23
|
const max = totalRange[totalRange.length - 1][1]
|
|
23
24
|
|
|
24
|
-
return [min, max]
|
|
25
|
+
return [Math.floor(min), Math.ceil(max)] as [number, number]
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export function PriceSlider(props: PriceSliderProps) {
|
|
@@ -37,7 +38,11 @@ export function PriceSlider(props: PriceSliderProps) {
|
|
|
37
38
|
return (
|
|
38
39
|
<Box
|
|
39
40
|
sx={[
|
|
40
|
-
(theme) => ({
|
|
41
|
+
(theme) => ({
|
|
42
|
+
pt: theme.spacings.md,
|
|
43
|
+
pb: theme.spacings.xs,
|
|
44
|
+
px: theme.spacings.xxs,
|
|
45
|
+
}),
|
|
41
46
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
42
47
|
]}
|
|
43
48
|
className={classes.container}
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
filterNonNullableKeys,
|
|
7
7
|
IconSvg,
|
|
8
8
|
iconCirle,
|
|
9
|
-
|
|
9
|
+
ActionCardAccordion,
|
|
10
10
|
Button,
|
|
11
11
|
} from '@graphcommerce/next-ui'
|
|
12
12
|
import { Trans } from '@lingui/react'
|
|
13
|
-
import { Box
|
|
13
|
+
import { Box } from '@mui/material'
|
|
14
14
|
import { useMemo } from 'react'
|
|
15
15
|
import { isFilterTypeEqual } from '../ProductListItems/filterTypes'
|
|
16
16
|
import { useProductFiltersPro } from './ProductFiltersPro'
|
|
@@ -19,7 +19,8 @@ import { FilterProps } from './ProductFiltersProAggregations'
|
|
|
19
19
|
export function ProductFilterEqualSection(props: FilterProps) {
|
|
20
20
|
const { aggregation } = props
|
|
21
21
|
const { attribute_code, label, options } = aggregation
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
const { form, params } = useProductFiltersPro()
|
|
23
24
|
const { control } = form
|
|
24
25
|
const attrCode = attribute_code as keyof ProductAttributeFilterInput
|
|
25
26
|
|
|
@@ -36,11 +37,9 @@ export function ProductFilterEqualSection(props: FilterProps) {
|
|
|
36
37
|
...option,
|
|
37
38
|
title: (
|
|
38
39
|
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
|
39
|
-
<
|
|
40
|
+
<Box sx={{ marginRight: 1 }}>{option.label}</Box>
|
|
40
41
|
{option.count !== null && (
|
|
41
|
-
<
|
|
42
|
-
({option.count})
|
|
43
|
-
</Typography>
|
|
42
|
+
<Box sx={{ typography: 'caption', color: 'text.disabled' }}>({option.count})</Box>
|
|
44
43
|
)}
|
|
45
44
|
</Box>
|
|
46
45
|
),
|
|
@@ -56,35 +55,35 @@ export function ProductFilterEqualSection(props: FilterProps) {
|
|
|
56
55
|
)
|
|
57
56
|
|
|
58
57
|
return (
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
58
|
+
<ActionCardAccordion
|
|
59
|
+
summary={label}
|
|
60
|
+
details={
|
|
61
|
+
<ActionCardListForm
|
|
62
|
+
sx={{ mb: 2 }}
|
|
63
|
+
render={ActionCard}
|
|
64
|
+
name={name}
|
|
65
|
+
control={control}
|
|
66
|
+
multiple
|
|
67
|
+
layout='list'
|
|
68
|
+
variant='default'
|
|
69
|
+
size='medium'
|
|
70
|
+
items={items}
|
|
71
|
+
showMoreAfter={4}
|
|
72
|
+
/>
|
|
73
|
+
}
|
|
74
|
+
right={
|
|
75
|
+
currentFilter && currentFilter.length > 0 ? (
|
|
76
|
+
<Button
|
|
77
|
+
color='primary'
|
|
78
|
+
onClick={(e) => {
|
|
79
|
+
e.stopPropagation()
|
|
80
|
+
form.setValue(name, null)
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<Trans id='Clear' />
|
|
84
|
+
</Button>
|
|
85
|
+
) : undefined
|
|
86
|
+
}
|
|
87
|
+
/>
|
|
89
88
|
)
|
|
90
89
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Controller } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import type { ProductAttributeFilterInput } from '@graphcommerce/graphql-mesh'
|
|
3
|
-
import {
|
|
3
|
+
import { ActionCardAccordion, Button } from '@graphcommerce/next-ui'
|
|
4
4
|
import { Trans } from '@lingui/react'
|
|
5
|
-
import { Box, Button } from '@mui/material'
|
|
6
5
|
import { isFilterTypeRange } from '../ProductListItems/filterTypes'
|
|
7
|
-
import {
|
|
6
|
+
import { PriceSlider, getMinMaxFromOptions } from './PriceSlider'
|
|
8
7
|
import { useProductFiltersPro } from './ProductFiltersPro'
|
|
9
8
|
import { FilterProps } from './ProductFiltersProAggregations'
|
|
10
9
|
|
|
@@ -35,26 +34,23 @@ export function ProductFilterRangeSection(props: FilterProps) {
|
|
|
35
34
|
const to = value?.to ? Number(value?.to) : max
|
|
36
35
|
|
|
37
36
|
return (
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/>
|
|
56
|
-
<PriceSlider options={options} value={value} onChange={onChange} />
|
|
57
|
-
</Box>
|
|
37
|
+
<ActionCardAccordion
|
|
38
|
+
summary={label}
|
|
39
|
+
details={<PriceSlider options={options} value={value} onChange={onChange} />}
|
|
40
|
+
right={
|
|
41
|
+
from !== min || to !== max ? (
|
|
42
|
+
<Button
|
|
43
|
+
color='primary'
|
|
44
|
+
onClick={(e) => {
|
|
45
|
+
e.stopPropagation()
|
|
46
|
+
form.setValue(name, null)
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<Trans id='Clear' />
|
|
50
|
+
</Button>
|
|
51
|
+
) : undefined
|
|
52
|
+
}
|
|
53
|
+
/>
|
|
58
54
|
)
|
|
59
55
|
}}
|
|
60
56
|
/>
|