@riosst100/pwa-marketplace 1.7.7 → 1.7.9
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/package.json +1 -1
- package/src/components/ShopBy/shopBy.js +5 -9
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +16 -3
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +18 -3
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.js +1 -1
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +1 -1
- package/src/talons/CollectibleGameSets/useCollectibleGameSets.js +0 -1
- package/src/talons/ShopBy/useShopBy.js +26 -7
package/package.json
CHANGED
|
@@ -184,10 +184,6 @@ const ShopBy = props => {
|
|
|
184
184
|
|
|
185
185
|
const handleActive = (val) => {
|
|
186
186
|
setActive(val);
|
|
187
|
-
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
|
|
191
187
|
setSearchQuery('')
|
|
192
188
|
}
|
|
193
189
|
|
|
@@ -197,15 +193,15 @@ const ShopBy = props => {
|
|
|
197
193
|
'value': 'all'
|
|
198
194
|
}
|
|
199
195
|
];
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
|
|
197
|
+
const title = attributeData ? (attributeData.attribute_code == "sc_baseball_parallel" ? "Parallel Sets" : (attributeData.attribute_code == "sc_baseball_inserts" ? "Insert Sets" : attributeData.label)) : "Shop By"
|
|
202
198
|
|
|
203
199
|
return (
|
|
204
200
|
<Fragment>
|
|
205
|
-
<StoreTitle>{
|
|
206
|
-
<Breadcrumbs categoryId={categoryId} customPage={
|
|
201
|
+
<StoreTitle>{title}</StoreTitle>
|
|
202
|
+
<Breadcrumbs categoryId={categoryId} customPage={title} currentFilter={activeFilters} />
|
|
207
203
|
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
208
|
-
{
|
|
204
|
+
{title}
|
|
209
205
|
</h1>
|
|
210
206
|
<div className='border border-gray-100 px-6'>
|
|
211
207
|
{dataResult ? (
|
|
@@ -226,6 +226,8 @@ const CategoryContent = props => {
|
|
|
226
226
|
|
|
227
227
|
let isSingles = false;
|
|
228
228
|
|
|
229
|
+
// console.log(allActiveFilters)
|
|
230
|
+
|
|
229
231
|
if (allActiveFilters && allActiveFilters.size > 0) {
|
|
230
232
|
allActiveFilters.forEach((value, key) => {
|
|
231
233
|
value.forEach((value) => {
|
|
@@ -239,7 +241,9 @@ const CategoryContent = props => {
|
|
|
239
241
|
if (virtualCategoryFilters && virtualCategoryFilters.includes(key)) {
|
|
240
242
|
activeFilters.push(
|
|
241
243
|
{
|
|
242
|
-
'label': label
|
|
244
|
+
'label': label,
|
|
245
|
+
'code': key,
|
|
246
|
+
'option_id': optionId
|
|
243
247
|
}
|
|
244
248
|
)
|
|
245
249
|
}
|
|
@@ -249,10 +253,19 @@ const CategoryContent = props => {
|
|
|
249
253
|
|
|
250
254
|
const currentFilter = activeFilters && activeFilters.length ? activeFilters[activeFilters.length - 1].label : '';
|
|
251
255
|
|
|
256
|
+
// console.log(activeFilters.length)
|
|
257
|
+
// console.log(activeFilters.map(u => u.label).join(' - '))
|
|
258
|
+
|
|
259
|
+
const title = activeFilters && activeFilters.length ? (
|
|
260
|
+
activeFilters.length > 1 ?
|
|
261
|
+
activeFilters.map(u => u.label).join(': ')
|
|
262
|
+
: currentFilter
|
|
263
|
+
) : categoryName;
|
|
264
|
+
|
|
252
265
|
return (
|
|
253
266
|
<Fragment>
|
|
254
267
|
<Breadcrumbs categoryId={categoryId} currentFilter={activeFilters} />
|
|
255
|
-
<StoreTitle>{
|
|
268
|
+
<StoreTitle>{title}</StoreTitle>
|
|
256
269
|
<article className={classes.root} data-cy="CategoryContent-root">
|
|
257
270
|
<div className={classes.categoryHeader}>
|
|
258
271
|
<h1 aria-live="polite" className={classes.title}>
|
|
@@ -260,7 +273,7 @@ const CategoryContent = props => {
|
|
|
260
273
|
className={classes.categoryTitle}
|
|
261
274
|
data-cy="CategoryContent-categoryTitle"
|
|
262
275
|
>
|
|
263
|
-
{
|
|
276
|
+
{title}
|
|
264
277
|
</span>
|
|
265
278
|
</h1>
|
|
266
279
|
{categoryDescriptionElement}
|
|
@@ -73,8 +73,12 @@ const Breadcrumbs = props => {
|
|
|
73
73
|
// console.log(currentFilter)
|
|
74
74
|
|
|
75
75
|
const filterBreadcrumbsElement = [];
|
|
76
|
+
|
|
77
|
+
const lastIndex = currentFilter ? currentFilter.length - 1 : 0;
|
|
78
|
+
// const filterpath = ;
|
|
76
79
|
|
|
77
80
|
currentFilter && currentFilter.length && currentFilter.map((filter, index) => {
|
|
81
|
+
console.log(filter)
|
|
78
82
|
currentProduct ? (
|
|
79
83
|
filterBreadcrumbsElement.push(
|
|
80
84
|
<>
|
|
@@ -82,7 +86,7 @@ const Breadcrumbs = props => {
|
|
|
82
86
|
<Link
|
|
83
87
|
key={index}
|
|
84
88
|
className={classes.link}
|
|
85
|
-
to={
|
|
89
|
+
to={resourceUrl('/'+currentCategoryPath)}
|
|
86
90
|
onClick={handleClick}
|
|
87
91
|
>
|
|
88
92
|
{filter.label}
|
|
@@ -97,7 +101,7 @@ const Breadcrumbs = props => {
|
|
|
97
101
|
<Link
|
|
98
102
|
key={index}
|
|
99
103
|
className={classes.link}
|
|
100
|
-
to={resourceUrl(currentCategoryPath)}
|
|
104
|
+
to={resourceUrl('/'+currentCategoryPath)}
|
|
101
105
|
onClick={handleClick}
|
|
102
106
|
>
|
|
103
107
|
{filter.label}
|
|
@@ -105,10 +109,21 @@ const Breadcrumbs = props => {
|
|
|
105
109
|
</>
|
|
106
110
|
)
|
|
107
111
|
) : filterBreadcrumbsElement.push(
|
|
112
|
+
index == lastIndex ?
|
|
108
113
|
<span key={index}>
|
|
109
114
|
<span className={classes.divider}>{DELIMITER}</span>
|
|
110
115
|
<span className={cn(classes.currentCategory, 'text-blue-700 font-medium')}>{filter.label}</span>
|
|
111
|
-
</span>
|
|
116
|
+
</span> : <>
|
|
117
|
+
<span className={classes.divider}>{DELIMITER}</span>
|
|
118
|
+
<Link
|
|
119
|
+
key={index}
|
|
120
|
+
className={classes.link}
|
|
121
|
+
to={resourceUrl('/'+currentCategoryPath+'?' + filter.code + '[filter]=' + filter.label + ',' + filter.option_id)}
|
|
122
|
+
onClick={handleClick}
|
|
123
|
+
>
|
|
124
|
+
{filter.label}
|
|
125
|
+
</Link>
|
|
126
|
+
</>
|
|
112
127
|
)
|
|
113
128
|
);
|
|
114
129
|
});
|
|
@@ -20,7 +20,7 @@ const CurrentFilters = props => {
|
|
|
20
20
|
const { title, value } = item || {};
|
|
21
21
|
const key = `${group}::${title}_${value}`;
|
|
22
22
|
|
|
23
|
-
const customAttributeLandingPage = ['card_set', 'sc_baseball_release','auction','special_price','lof_preorder'];
|
|
23
|
+
const customAttributeLandingPage = ['card_set', 'sc_baseball_release','auction','special_price','lof_preorder','sc_baseball_inserts','sc_baseball_parallel','sc_set_type'];
|
|
24
24
|
|
|
25
25
|
if (!customAttributeLandingPage.includes(group)) {
|
|
26
26
|
elements.push(
|
|
@@ -91,7 +91,7 @@ const FilterSidebar = props => {
|
|
|
91
91
|
const groupName = filterNames.get(group);
|
|
92
92
|
const frontendInput = filterFrontendInput.get(group);
|
|
93
93
|
|
|
94
|
-
const hideFilters = ['lof_preorder','auction','special_price'];
|
|
94
|
+
const hideFilters = ['lof_preorder','auction','special_price','sc_baseball_inserts','sc_baseball_parallel','sale','sc_set_type','sc_brands'];
|
|
95
95
|
if (!hideFilters.includes(group)) {
|
|
96
96
|
// if (!allowedFilters && !allowedFiltersArr.length && group != "category_uid" || allowedFilters && allowedFiltersArr.length && allowedFiltersArr.includes(group)) {
|
|
97
97
|
|
|
@@ -103,7 +103,6 @@ export const useCollectibleGameSets = props => {
|
|
|
103
103
|
collectibleGameSets.map(({ release_type, sets }, index) => {
|
|
104
104
|
const newSets = sets.filter(function(set) {
|
|
105
105
|
return set.set_name.search(new RegExp(searchQuery, "i")) != -1 || set.set_abbreviation.search(new RegExp(searchQuery, "i")) != -1 || release_type.search(new RegExp(searchQuery, "i")) != -1;
|
|
106
|
-
// return set.set_name.includes(searchQuery);
|
|
107
106
|
});
|
|
108
107
|
|
|
109
108
|
if (newSets && newSets.length) {
|
|
@@ -149,7 +149,7 @@ export const useShopBy = props => {
|
|
|
149
149
|
const sortbyData = [];
|
|
150
150
|
|
|
151
151
|
return sortby != "all" ? sortbyData && sortbyData.length ? sortbyData.sort((a, b) => b.release_type.toLowerCase().localeCompare(a.release_type.toLowerCase())) : sortbyData : mappingData;
|
|
152
|
-
}, [queryResponse, sortby
|
|
152
|
+
}, [queryResponse, sortby]);
|
|
153
153
|
|
|
154
154
|
const dataResult = useMemo(() => {
|
|
155
155
|
if (!queryResponse) {
|
|
@@ -163,12 +163,31 @@ export const useShopBy = props => {
|
|
|
163
163
|
|
|
164
164
|
let options = rawData[0].options;
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
const filteredSets = [];
|
|
167
|
+
|
|
168
|
+
let filteredOptions = [];
|
|
169
|
+
|
|
170
|
+
// let mappingData = [];
|
|
171
|
+
|
|
172
|
+
// if (searchQuery) {
|
|
173
|
+
// setActive('all')
|
|
174
|
+
// mappingData = options.filter(function(option) {
|
|
175
|
+
// return option.label.search(new RegExp(searchQuery, "i")) != -1;
|
|
176
|
+
// }).reduce((acc, item) => {
|
|
177
|
+
// let firstLetter = item.label.charAt(0).toUpperCase();
|
|
178
|
+
// if (!alpha.includes(firstLetter)) {
|
|
179
|
+
// firstLetter = '#';
|
|
180
|
+
// }
|
|
181
|
+
// acc[firstLetter] = acc[firstLetter] || [];
|
|
182
|
+
// acc[firstLetter].push(item);
|
|
183
|
+
// return acc;
|
|
184
|
+
// }, {});
|
|
185
|
+
// } else {
|
|
186
|
+
|
|
187
|
+
// console.log(filteredOptions)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
// }
|
|
172
191
|
|
|
173
192
|
const mappingData = options.reduce((acc, item) => {
|
|
174
193
|
let firstLetter = item.label.charAt(0).toUpperCase();
|