@riosst100/pwa-marketplace 2.2.3 → 2.2.5
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/FilterTop/CurrentTopFilters/currentTopFilter.js +1 -1
- package/src/components/FilterTop/CurrentTopFilters/currentTopFilters.js +1 -1
- package/src/components/FilterTop/CustomFilters/customFilter.js +1 -1
- package/src/components/FilterTop/FilterBlockList/filterTopItem.js +32 -2
- package/src/components/FilterTop/FilterBlockList/filterTopItemGroup.js +1 -1
- package/src/components/FilterTopBackup/CustomFilters/customFilter.js +1 -1
- package/src/components/SetsData/setsData.js +16 -9
- package/src/components/ShopByBrands/shopByBrands.js +0 -7
- package/src/components/ShopByCard/shopByCard.js +16 -23
- package/src/components/ShopBySets/shopBySets.js +8 -25
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +1 -1
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +6 -6
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.js +1 -1
- package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +1 -1
- package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.js +76 -8
- package/src/talons/ShopByCard/shopByCard.gql.js +17 -3
- package/src/talons/ShopByCard/useShopByCard.js +43 -2
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@ const CurrentTopFilter = props => {
|
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
return group && group != "character" && group != "product_series" && group != "scale" && group != "product_line" && group != "filterby" && group != "trains" && group != "franchise" && group != "brands" && group != "category" && group != "shopby" ? (
|
|
34
|
+
return group && group != "card_game" && group != "character" && group != "product_series" && group != "scale" && group != "product_line" && group != "filterby" && group != "trains" && group != "franchise" && group != "brands" && group != "category" && group != "shopby" ? (
|
|
35
35
|
<span className={classes.item} data-cy="CurrentTopFilter-root">
|
|
36
36
|
<Trigger
|
|
37
37
|
action={handleClick}
|
|
@@ -21,7 +21,7 @@ const CurrentTopFilters = props => {
|
|
|
21
21
|
const { title, value } = item || {};
|
|
22
22
|
const key = `${group}::${title}_${value}`;
|
|
23
23
|
|
|
24
|
-
const customAttributeLandingPage = ['card_set', 'sc_baseball_release'];
|
|
24
|
+
const customAttributeLandingPage = ['card_game','card_set', 'sc_baseball_release'];
|
|
25
25
|
|
|
26
26
|
if (group === currentGroup && !customAttributeLandingPage.includes(group)) {
|
|
27
27
|
elements.push(
|
|
@@ -43,7 +43,7 @@ const CustomFilter = props => {
|
|
|
43
43
|
|
|
44
44
|
const subCategory = [];
|
|
45
45
|
|
|
46
|
-
const customAttributeLandingPage = ['card_set', 'sc_baseball_release'];
|
|
46
|
+
const customAttributeLandingPage = ['card_game','card_set', 'sc_baseball_release'];
|
|
47
47
|
|
|
48
48
|
if (customAttributeLandingPage.includes(group)) {
|
|
49
49
|
normalizedData && normalizedData.map(({ label, path }, index) => {
|
|
@@ -44,6 +44,36 @@ const FilterTopItem = props => {
|
|
|
44
44
|
|
|
45
45
|
// const catId = null;
|
|
46
46
|
|
|
47
|
+
// const newSearch = (search) => {
|
|
48
|
+
// console.log(search)
|
|
49
|
+
|
|
50
|
+
// let filterSearchArr = search ? search.split('&') : [];
|
|
51
|
+
// filterSearchArr = filterSearchArr.filter(function(data) {
|
|
52
|
+
// return !data.includes('shopby');
|
|
53
|
+
// })
|
|
54
|
+
// let filterSearch = filterSearchArr.join('&')
|
|
55
|
+
|
|
56
|
+
// if (!filterSearch.includes('?')) {
|
|
57
|
+
// filterSearch = '?'+filterSearch;
|
|
58
|
+
// }
|
|
59
|
+
|
|
60
|
+
// return result;
|
|
61
|
+
// }
|
|
62
|
+
|
|
63
|
+
let newfilterSearchArr = search ? search.split('&') : [];
|
|
64
|
+
newfilterSearchArr = newfilterSearchArr.filter(function(data) {
|
|
65
|
+
return data.includes('card_game%5Bfilter%5D');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
let filterSearch = newfilterSearchArr.join('&')
|
|
69
|
+
|
|
70
|
+
if (!filterSearch.includes('?')) {
|
|
71
|
+
filterSearch = '?'+filterSearch;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// console.log('--filterSearch--')
|
|
75
|
+
// console.log(filterSearch)
|
|
76
|
+
|
|
47
77
|
const element = group == "filterby" ? (
|
|
48
78
|
filterBy == value ? (
|
|
49
79
|
<span className={classes.item}><b>{title}</b></span>
|
|
@@ -53,9 +83,9 @@ const FilterTopItem = props => {
|
|
|
53
83
|
) : group == "category" ? (
|
|
54
84
|
<Link className={classes.item} to={'/'+value}>{title}</Link>
|
|
55
85
|
) : value == "shopby_all" ? (
|
|
56
|
-
<Link className={classes.item} to={search ?
|
|
86
|
+
<Link className={classes.item} to={search ? filterSearch + '&shopby=' + group : '?shopby=' + group}>{title}</Link>
|
|
57
87
|
) : group == "shopby" || group == "shopby_with_all" ? (
|
|
58
|
-
<Link className={classes.item} to={search ?
|
|
88
|
+
<Link className={classes.item} to={search ? filterSearch + '&shopby=' + value : '?shopby=' + value}>{title}</Link>
|
|
59
89
|
) : group == "cat_id" ? (
|
|
60
90
|
value == "all" && !categoryIdFilters.length || categoryIdFilters.length && categoryIdFilters[0].includes('cat_id='+value) ? (
|
|
61
91
|
<span className={classes.item}><b>{title}</b></span>
|
|
@@ -87,7 +87,7 @@ const FilterTopItemGroup = props => {
|
|
|
87
87
|
<div className={classes.root}>
|
|
88
88
|
{radioItems}
|
|
89
89
|
{filterElements && filterElements.length > 10 ? <span className={classes.item}><b>More Item</b></span> : ''}
|
|
90
|
-
{filterElements && filterElements.length ? filterElements : group && group != "character" && group != "product_series" && group != "scale" && group != "product_line" && group != "trains" && group != "franchise" && group != "brands" && group != "category" && group != "filterby" && group != "shopby" && group != "cat_id" ? (<span className={classes.item}><b>All</b></span>) : ''}
|
|
90
|
+
{filterElements && filterElements.length ? filterElements : group && group != "character" && group != "product_series" && group != "scale" && group != "product_line" && group != "trains" && group != "franchise" && group != "brands" && group != "category" && group != "card_game" && group != "filterby" && group != "shopby" && group != "cat_id" ? (<span className={classes.item}><b>All</b></span>) : ''}
|
|
91
91
|
</div>
|
|
92
92
|
);
|
|
93
93
|
};
|
|
@@ -43,7 +43,7 @@ const CustomFilter = props => {
|
|
|
43
43
|
|
|
44
44
|
const subCategory = [];
|
|
45
45
|
|
|
46
|
-
const customAttributeLandingPage = ['card_set', 'sc_baseball_release'];
|
|
46
|
+
const customAttributeLandingPage = ['card_game','card_set', 'sc_baseball_release'];
|
|
47
47
|
|
|
48
48
|
if (customAttributeLandingPage.includes(group)) {
|
|
49
49
|
normalizedData && normalizedData.map(({ label, path }, index) => {
|
|
@@ -13,12 +13,15 @@ import CustomSortBy from '@riosst100/pwa-marketplace/src/components/CustomSortBy
|
|
|
13
13
|
import ArraySearchInput from '@riosst100/pwa-marketplace/src/components/ArraySearchInput';
|
|
14
14
|
import { useCustomSort } from '@riosst100/pwa-marketplace/src/hooks/useCustomSort';
|
|
15
15
|
import Breadcrumbs from '@magento/venia-ui/lib/components/Breadcrumbs';
|
|
16
|
+
import { useLocation } from 'react-router-dom';
|
|
16
17
|
|
|
17
18
|
const SetsData = props => {
|
|
18
19
|
const { categoryId } = props
|
|
19
20
|
|
|
20
21
|
const { location } = globalThis;
|
|
21
22
|
|
|
23
|
+
const { search } = useLocation();
|
|
24
|
+
|
|
22
25
|
const query = new URLSearchParams(location.search);
|
|
23
26
|
|
|
24
27
|
const [active, setActive] = useState('all');
|
|
@@ -40,13 +43,6 @@ const SetsData = props => {
|
|
|
40
43
|
value: 'date'
|
|
41
44
|
};
|
|
42
45
|
}
|
|
43
|
-
|
|
44
|
-
// if (productType == "expansion_sets") {
|
|
45
|
-
// defaultSort = {
|
|
46
|
-
// sortText: 'All (Expansion Sets)',
|
|
47
|
-
// value: 'all'
|
|
48
|
-
// };
|
|
49
|
-
// }
|
|
50
46
|
|
|
51
47
|
// Sorting
|
|
52
48
|
const sortProps = useCustomSort({ sortFromSearch: false, defaultSort: defaultSort});
|
|
@@ -112,6 +108,17 @@ const SetsData = props => {
|
|
|
112
108
|
// byYearTitle = "By Year";
|
|
113
109
|
// }
|
|
114
110
|
|
|
111
|
+
let newfilterSearchArr = search ? search.split('&') : [];
|
|
112
|
+
newfilterSearchArr = newfilterSearchArr.filter(function(data) {
|
|
113
|
+
return !data.includes(attributeCode + '%5Bfilter%5D') && !data.includes('shopby');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
let filterSearch = newfilterSearchArr.join('&')
|
|
117
|
+
|
|
118
|
+
if (!filterSearch.includes('?')) {
|
|
119
|
+
filterSearch = '?'+filterSearch;
|
|
120
|
+
}
|
|
121
|
+
|
|
115
122
|
const setRelases = newSetsData && newSetsData.length && newSetsData.map((setRelease, index) => {
|
|
116
123
|
const { group, sets } = setRelease;
|
|
117
124
|
|
|
@@ -122,7 +129,7 @@ const SetsData = props => {
|
|
|
122
129
|
const { set_name, option_id, release_year } = set;
|
|
123
130
|
|
|
124
131
|
const categoryUrl = resourceUrl(
|
|
125
|
-
`/${category?.url_path}${categoryUrlSuffix || ''}
|
|
132
|
+
`/${category?.url_path}${categoryUrlSuffix || ''}${filterSearch || ''}&${attributeCode}[filter]=${set_name},${option_id}`
|
|
126
133
|
);
|
|
127
134
|
|
|
128
135
|
setsResult.push(<li className='list-none'>
|
|
@@ -179,7 +186,7 @@ const SetsData = props => {
|
|
|
179
186
|
|
|
180
187
|
let alpha = ['#', 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
|
|
181
188
|
|
|
182
|
-
let title = pageInfo ? pageInfo.title : 'All
|
|
189
|
+
let title = pageInfo ? pageInfo.title : 'All S2ets';
|
|
183
190
|
if (activeTab == "year") {
|
|
184
191
|
title = "Sets | By Year";
|
|
185
192
|
}
|
|
@@ -40,13 +40,6 @@ const ShopByBrands = props => {
|
|
|
40
40
|
value: 'date'
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
// if (productType == "expansion_sets") {
|
|
45
|
-
// defaultSort = {
|
|
46
|
-
// sortText: 'All (Expansion Sets)',
|
|
47
|
-
// value: 'all'
|
|
48
|
-
// };
|
|
49
|
-
// }
|
|
50
43
|
|
|
51
44
|
// Sorting
|
|
52
45
|
const sortProps = useCustomSort({ sortFromSearch: false, defaultSort: defaultSort});
|
|
@@ -13,10 +13,14 @@ import CustomSortBy from '@riosst100/pwa-marketplace/src/components/CustomSortBy
|
|
|
13
13
|
import ArraySearchInput from '@riosst100/pwa-marketplace/src/components/ArraySearchInput';
|
|
14
14
|
import { useCustomSort } from '@riosst100/pwa-marketplace/src/hooks/useCustomSort';
|
|
15
15
|
import Breadcrumbs from '@magento/venia-ui/lib/components/Breadcrumbs';
|
|
16
|
+
import { useLocation } from 'react-router-dom';
|
|
16
17
|
|
|
17
18
|
const ShopByCard = props => {
|
|
18
19
|
const { categoryId } = props
|
|
19
20
|
|
|
21
|
+
const { search } = useLocation();
|
|
22
|
+
|
|
23
|
+
|
|
20
24
|
const [active, setActive] = useState('all');
|
|
21
25
|
|
|
22
26
|
const [searchQuery, setSearchQuery] = useState('');
|
|
@@ -37,13 +41,6 @@ const ShopByCard = props => {
|
|
|
37
41
|
value: 'date'
|
|
38
42
|
};
|
|
39
43
|
}
|
|
40
|
-
|
|
41
|
-
// if (productType == "expansion_sets") {
|
|
42
|
-
// defaultSort = {
|
|
43
|
-
// sortText: 'All (Expansion Sets)',
|
|
44
|
-
// value: 'all'
|
|
45
|
-
// };
|
|
46
|
-
// }
|
|
47
44
|
|
|
48
45
|
const sortProps = useCustomSort({ sortFromSearch: false, defaultSort: defaultSort});
|
|
49
46
|
|
|
@@ -90,6 +87,17 @@ const ShopByCard = props => {
|
|
|
90
87
|
return result;
|
|
91
88
|
}
|
|
92
89
|
|
|
90
|
+
let newfilterSearchArr = search ? search.split('&') : [];
|
|
91
|
+
newfilterSearchArr = newfilterSearchArr.filter(function(data) {
|
|
92
|
+
return !data.includes('card_name%5Bfilter%5D') && !data.includes('shopby');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
let filterSearch = newfilterSearchArr.join('&')
|
|
96
|
+
|
|
97
|
+
if (!filterSearch.includes('?')) {
|
|
98
|
+
filterSearch = '?'+filterSearch;
|
|
99
|
+
}
|
|
100
|
+
|
|
93
101
|
const setRelases = newShopByCard.length && newShopByCard.map((setRelease, index) => {
|
|
94
102
|
const { release_type, sets } = setRelease;
|
|
95
103
|
|
|
@@ -100,7 +108,7 @@ const ShopByCard = props => {
|
|
|
100
108
|
const { set_name, option_id, set_abbreviation, release_year } = set;
|
|
101
109
|
|
|
102
110
|
const categoryUrl = resourceUrl(
|
|
103
|
-
`/games
|
|
111
|
+
`/games/${categoryUrlKey}${categoryUrlSuffix || ''}${filterSearch || ''}&card_name[filter]=${set_name},${option_id}`
|
|
104
112
|
);
|
|
105
113
|
|
|
106
114
|
setsResult.push(<li className='list-none'>
|
|
@@ -174,21 +182,6 @@ const ShopByCard = props => {
|
|
|
174
182
|
// alpha = availableGroups;
|
|
175
183
|
}
|
|
176
184
|
|
|
177
|
-
if (productType == "expansion_sets") {
|
|
178
|
-
// availableSortBy = [
|
|
179
|
-
// {
|
|
180
|
-
// 'label': 'All (Expansion Sets)',
|
|
181
|
-
// 'value': 'all'
|
|
182
|
-
// },
|
|
183
|
-
// {
|
|
184
|
-
// 'label': 'Latest Sets',
|
|
185
|
-
// 'value': 'newest'
|
|
186
|
-
// }
|
|
187
|
-
// ];
|
|
188
|
-
|
|
189
|
-
// alpha = availableGroups
|
|
190
|
-
}
|
|
191
|
-
|
|
192
185
|
let title = "By Card Name";
|
|
193
186
|
|
|
194
187
|
return (
|
|
@@ -37,13 +37,6 @@ const ShopBySets = props => {
|
|
|
37
37
|
value: 'date'
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
// if (productType == "expansion_sets") {
|
|
42
|
-
// defaultSort = {
|
|
43
|
-
// sortText: 'All (Expansion Sets)',
|
|
44
|
-
// value: 'all'
|
|
45
|
-
// };
|
|
46
|
-
// }
|
|
47
40
|
|
|
48
41
|
const sortProps = useCustomSort({ sortFromSearch: false, defaultSort: defaultSort});
|
|
49
42
|
|
|
@@ -175,24 +168,14 @@ const ShopBySets = props => {
|
|
|
175
168
|
// alpha = availableGroups;
|
|
176
169
|
}
|
|
177
170
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
// {
|
|
181
|
-
// 'label': 'All (Expansion Sets)',
|
|
182
|
-
// 'value': 'all'
|
|
183
|
-
// },
|
|
184
|
-
// {
|
|
185
|
-
// 'label': 'Latest Sets',
|
|
186
|
-
// 'value': 'newest'
|
|
187
|
-
// }
|
|
188
|
-
// ];
|
|
189
|
-
|
|
190
|
-
// alpha = availableGroups
|
|
191
|
-
}
|
|
171
|
+
console.log('==productType')
|
|
172
|
+
console.log(productType)
|
|
192
173
|
|
|
193
|
-
let title = "
|
|
174
|
+
let title = "A2ll Sets";
|
|
194
175
|
if (productType == "expansion_sets") {
|
|
195
176
|
title = "Expansion Sets";
|
|
177
|
+
} else if (productType == "secret_lair") {
|
|
178
|
+
title = "Secret Lair";
|
|
196
179
|
} else if (productType == "artist") {
|
|
197
180
|
title = "By Artist";
|
|
198
181
|
} else if (shopby == "release_year") {
|
|
@@ -203,11 +186,11 @@ const ShopBySets = props => {
|
|
|
203
186
|
return (
|
|
204
187
|
<Fragment>
|
|
205
188
|
<StoreTitle>{title}</StoreTitle>
|
|
206
|
-
<Breadcrumbs categoryId={categoryId} customPage={shopby == "expansion_sets" ? "Expansion Sets" : (shopby == "release_year" ? "By Year" : "All
|
|
207
|
-
{shopby != "release_year" && productType != "expansion_sets" && <h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
189
|
+
<Breadcrumbs categoryId={categoryId} customPage={shopby == "secret_lair" ? "Secret Lair" : (shopby == "expansion_sets" ? "Expansion Sets" : (shopby == "release_year" ? "By Year" : "All Set3s"))} />
|
|
190
|
+
{shopby != "release_year" && productType != "secret_lair" && productType != "expansion_sets" && <h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
208
191
|
{title}
|
|
209
192
|
</h1>}
|
|
210
|
-
{shopby == "release_year" || productType == "expansion_sets" ? <ul className={classes.nav}>
|
|
193
|
+
{shopby == "release_year" || productType == "secret_lair" || productType == "expansion_sets" ? <ul className={classes.nav}>
|
|
211
194
|
{availableGroups.map((group, index) => (
|
|
212
195
|
<li key={index} className={classes.nav_item}>
|
|
213
196
|
<button
|
|
@@ -94,7 +94,7 @@ const Category = props => {
|
|
|
94
94
|
allowedShopby.includes(shopby) ? <ShopBy
|
|
95
95
|
categoryId={uid}
|
|
96
96
|
shopby={shopby}
|
|
97
|
-
isLoading={loading} /> : shopby == "release_year" || shopby == "expansion_sets" || shopby == "sets" ? <SetsData
|
|
97
|
+
isLoading={loading} /> : shopby == "release_year" || shopby == "secret_lair" || shopby == "expansion_sets" || shopby == "sets" ? <SetsData
|
|
98
98
|
categoryId={uid}
|
|
99
99
|
shopby={shopby}
|
|
100
100
|
isLoading={loading} /> : shopby == "singles" || shopby == "lego_set_name" && parentCategoryUrlKey == "lego" ? <LegoSets
|
|
@@ -82,19 +82,19 @@ const CategoryContent = props => {
|
|
|
82
82
|
if (category) {
|
|
83
83
|
const urlKey = category.url_key;
|
|
84
84
|
if (urlKey == "collectible-game") {
|
|
85
|
-
history.replace('/games/collectible-game/magic-the-gathering.html')
|
|
85
|
+
// history.replace('/games/collectible-game/magic-the-gathering.html')
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
if (urlKey == "sport-cards") {
|
|
89
|
-
history.replace('/cards/sport-cards/baseball.html')
|
|
89
|
+
// history.replace('/cards/sport-cards/baseball.html')
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
if (urlKey == "non-sports-cards") {
|
|
93
|
-
history.replace('/cards/non-sports-cards/comics.html')
|
|
93
|
+
// history.replace('/cards/non-sports-cards/comics.html')
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
if (urlKey == "lego") {
|
|
97
|
-
history.replace('/lego/lego-sets.html')
|
|
97
|
+
// history.replace('/lego/lego-sets.html')
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}, [category]);
|
|
@@ -263,7 +263,7 @@ const CategoryContent = props => {
|
|
|
263
263
|
if (label == "Singles") {
|
|
264
264
|
isSingles = true;
|
|
265
265
|
}
|
|
266
|
-
if (key == "product_line" && urlKey == "brands" || key == "product_line" && urlKey == "franchise" || key == "franchise" && urlKey == "brands" || key == "franchise" && urlKey == "franchise" || key == "brands" && urlKey == "franchise" || key == "brands" && urlKey == "brands" || virtualCategoryFilters && virtualCategoryFilters.includes(key)) {
|
|
266
|
+
if (key == "card_game" || key == "product_line" && urlKey == "brands" || key == "product_line" && urlKey == "franchise" || key == "franchise" && urlKey == "brands" || key == "franchise" && urlKey == "franchise" || key == "brands" && urlKey == "franchise" || key == "brands" && urlKey == "brands" || virtualCategoryFilters && virtualCategoryFilters.includes(key)) {
|
|
267
267
|
activeFilters.push(
|
|
268
268
|
{
|
|
269
269
|
'label': label,
|
|
@@ -308,7 +308,7 @@ const CategoryContent = props => {
|
|
|
308
308
|
<>
|
|
309
309
|
{currentFilter && <AlphaFilter isSingles={isSingles} items={items} handleActiveLetter={handleActiveLetter} activeLetter={activeLetter} />}
|
|
310
310
|
{!currentFilter && <CustomSubCategory categoryName={category ? category.name : null} customSubCategory={category ? category.custom_subcategory : null} />}
|
|
311
|
-
{shopby != "gauge" ? <SubCategory parent={parent} children={children} /> : ''}
|
|
311
|
+
{shopby != "gauge" && category?.name != "Collectible Card Games" ? <SubCategory parent={parent} children={children} /> : ''}
|
|
312
312
|
|
|
313
313
|
</>
|
|
314
314
|
{/* ) : ( */}
|
|
@@ -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','sc_baseball_inserts','sc_baseball_parallel','sc_set_type'];
|
|
23
|
+
const customAttributeLandingPage = ['card_game','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(
|
|
@@ -37,8 +37,10 @@ const SubmenuColumn = props => {
|
|
|
37
37
|
// return ;
|
|
38
38
|
// };
|
|
39
39
|
|
|
40
|
+
let childrenItems = '';
|
|
41
|
+
|
|
40
42
|
if (category.children.length) {
|
|
41
|
-
|
|
43
|
+
childrenItems = category.children.map((subCategory, index) => {
|
|
42
44
|
const { url_path, isActive, name } = subCategory;
|
|
43
45
|
const categoryUrl = resourceUrl(
|
|
44
46
|
`/${url_path}${categoryUrlSuffix || ''}`
|
|
@@ -73,10 +75,22 @@ const SubmenuColumn = props => {
|
|
|
73
75
|
/>
|
|
74
76
|
) : '';
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
// if (customMenuItems.length) {
|
|
79
|
+
// console.log(customMenuItems)
|
|
80
|
+
// }
|
|
81
|
+
|
|
82
|
+
// var childLi = '';
|
|
83
|
+
let result = [];
|
|
84
|
+
|
|
85
|
+
if (customMenuItems.length) {
|
|
86
|
+
// console.log('customMenuItems length')
|
|
87
|
+
// console.log(customMenuItems)
|
|
88
|
+
|
|
89
|
+
customMenuItems.map((submenu, index) => {
|
|
90
|
+
const {name, path} = submenu;
|
|
91
|
+
|
|
92
|
+
result.push(
|
|
93
|
+
<li key={index} className={cn(classes.submenuChildItem, 'mt-0')}>
|
|
80
94
|
<Link
|
|
81
95
|
{...keyboardProps}
|
|
82
96
|
className={isActive ? classes.linkActive : classes.link}
|
|
@@ -89,8 +103,14 @@ const SubmenuColumn = props => {
|
|
|
89
103
|
>
|
|
90
104
|
{name}
|
|
91
105
|
</Link>
|
|
92
|
-
|
|
93
|
-
)
|
|
106
|
+
</li>
|
|
107
|
+
)
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
// console.log(childrenItems)
|
|
111
|
+
} else {
|
|
112
|
+
result.push(
|
|
113
|
+
<li key={index} className={cn(classes.submenuChildItem, 'mt-0')}>
|
|
94
114
|
<Link
|
|
95
115
|
{...keyboardProps}
|
|
96
116
|
className={isActive ? classes.linkActive : classes.link}
|
|
@@ -103,11 +123,59 @@ const SubmenuColumn = props => {
|
|
|
103
123
|
>
|
|
104
124
|
{name}
|
|
105
125
|
</Link>
|
|
106
|
-
|
|
126
|
+
</li>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// return '';
|
|
131
|
+
|
|
132
|
+
// return childLi;
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
return result;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (category.custom_submenu && category.custom_submenu.length)
|
|
142
|
+
{
|
|
143
|
+
childrenItems = category.custom_submenu.map((subCategory, index) => {
|
|
144
|
+
const { path, isActive, name } = subCategory;
|
|
145
|
+
const categoryUrl = resourceUrl(
|
|
146
|
+
`/${path}`
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
// setting keyboardProps if it is last child of that category
|
|
150
|
+
const keyboardProps =
|
|
151
|
+
index === category.children.length - 1
|
|
152
|
+
? props.keyboardProps
|
|
153
|
+
: {};
|
|
154
|
+
|
|
155
|
+
let result = [];
|
|
156
|
+
|
|
157
|
+
result.push(
|
|
158
|
+
<li key={index} className={cn(classes.submenuChildItem, 'mt-0')}>
|
|
159
|
+
<Link
|
|
160
|
+
{...keyboardProps}
|
|
161
|
+
className={isActive ? classes.linkActive : classes.link}
|
|
162
|
+
data-cy="MegaMenu-SubmenuColumn-link"
|
|
163
|
+
to={categoryUrl}
|
|
164
|
+
onClick={() => {
|
|
165
|
+
handleCloseSubMenu();
|
|
166
|
+
onNavigate();
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
{name}
|
|
170
|
+
</Link>
|
|
107
171
|
</li>
|
|
108
172
|
);
|
|
173
|
+
|
|
174
|
+
return result;
|
|
109
175
|
});
|
|
176
|
+
}
|
|
110
177
|
|
|
178
|
+
if (childrenItems) {
|
|
111
179
|
children = <ul className={classes.submenuChild}>{childrenItems}</ul>;
|
|
112
180
|
}
|
|
113
181
|
|
|
@@ -12,8 +12,8 @@ export const GET_STORE_CONFIG_DATA = gql`
|
|
|
12
12
|
`;
|
|
13
13
|
|
|
14
14
|
export const GET_COLLECTIBLE_GAME_QUERY = gql`
|
|
15
|
-
query getShopByCard($categoryUrlKey: String!, $productType: String) {
|
|
16
|
-
shopByCard(categoryUrlKey: $categoryUrlKey, productType: $productType) {
|
|
15
|
+
query getShopByCard($categoryUrlKey: String!, $productType: String, $filters: ProductAttributeFilterInput!) {
|
|
16
|
+
shopByCard(categoryUrlKey: $categoryUrlKey, productType: $productType, filters: $filters) {
|
|
17
17
|
release_type
|
|
18
18
|
sets {
|
|
19
19
|
set_name
|
|
@@ -40,8 +40,22 @@ export const GET_SPORT_CARDS_SETS_QUERY = gql`
|
|
|
40
40
|
}
|
|
41
41
|
`;
|
|
42
42
|
|
|
43
|
+
export const GET_FILTER_INPUTS = gql`
|
|
44
|
+
query GetFilterInputsForCategory {
|
|
45
|
+
__type(name: "ProductAttributeFilterInput") {
|
|
46
|
+
inputFields {
|
|
47
|
+
name
|
|
48
|
+
type {
|
|
49
|
+
name
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
|
|
43
56
|
export default {
|
|
44
57
|
getStoreConfigData: GET_STORE_CONFIG_DATA,
|
|
45
58
|
getCollectibleGameQuery: GET_COLLECTIBLE_GAME_QUERY,
|
|
46
|
-
getSportCardsSetsQuery: GET_SPORT_CARDS_SETS_QUERY
|
|
59
|
+
getSportCardsSetsQuery: GET_SPORT_CARDS_SETS_QUERY,
|
|
60
|
+
getFilterInputsQuery: GET_FILTER_INPUTS
|
|
47
61
|
};
|
|
@@ -5,6 +5,7 @@ import { useAppContext } from '@magento/peregrine/lib/context/app';
|
|
|
5
5
|
|
|
6
6
|
import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
|
|
7
7
|
import DEFAULT_OPERATIONS from './shopByCard.gql';
|
|
8
|
+
import { getFilterInput, getFiltersFromSearch } from '@magento/peregrine/lib/talons/FilterModal/helpers';
|
|
8
9
|
|
|
9
10
|
export const useShopByCard = props => {
|
|
10
11
|
|
|
@@ -13,8 +14,9 @@ export const useShopByCard = props => {
|
|
|
13
14
|
const { value: sortby } = currentSort
|
|
14
15
|
|
|
15
16
|
const operations = mergeOperations(DEFAULT_OPERATIONS, null);
|
|
16
|
-
const { getStoreConfigData, getCollectibleGameQuery } = operations;
|
|
17
|
-
const { pathname } = useLocation();
|
|
17
|
+
const { getStoreConfigData, getFilterInputsQuery, getCollectibleGameQuery } = operations;
|
|
18
|
+
const { pathname, search } = useLocation();
|
|
19
|
+
|
|
18
20
|
const [
|
|
19
21
|
,
|
|
20
22
|
{
|
|
@@ -34,11 +36,50 @@ export const useShopByCard = props => {
|
|
|
34
36
|
|
|
35
37
|
const categoryUrlSuffix = storeConfigData?.storeConfig?.category_url_suffix;
|
|
36
38
|
|
|
39
|
+
const {
|
|
40
|
+
called: introspectionCalled,
|
|
41
|
+
data: introspectionData,
|
|
42
|
+
loading: introspectionLoading
|
|
43
|
+
} = useQuery(getFilterInputsQuery);
|
|
44
|
+
|
|
45
|
+
const filterTypeMap = useMemo(() => {
|
|
46
|
+
const typeMap = new Map();
|
|
47
|
+
if (introspectionData) {
|
|
48
|
+
introspectionData.__type.inputFields.forEach(({ name, type }) => {
|
|
49
|
+
typeMap.set(name, type.name);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return typeMap;
|
|
53
|
+
}, [introspectionData]);
|
|
54
|
+
|
|
55
|
+
const filters = getFiltersFromSearch(search);
|
|
56
|
+
|
|
57
|
+
const newFilters = {};
|
|
58
|
+
filters.forEach((values, key) => {
|
|
59
|
+
newFilters[key] = getFilterInput(values, filterTypeMap.get(key));
|
|
60
|
+
if (key == "sc_baseball_release") {
|
|
61
|
+
for(let item of values) {
|
|
62
|
+
if(item) {
|
|
63
|
+
// console.log(item.split(',')[0])
|
|
64
|
+
const data = search.split('&');
|
|
65
|
+
data.pop();
|
|
66
|
+
activeFilters.push(
|
|
67
|
+
{
|
|
68
|
+
'label': item.split(',')[0],
|
|
69
|
+
'path': data
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
37
77
|
const { error, loading, data } = useQuery(getCollectibleGameQuery, {
|
|
38
78
|
fetchPolicy: 'cache-and-network',
|
|
39
79
|
nextFetchPolicy: 'cache-first',
|
|
40
80
|
skip: !storeConfigData,
|
|
41
81
|
variables: {
|
|
82
|
+
filters: newFilters,
|
|
42
83
|
categoryUrlKey: categoryUrlKey,
|
|
43
84
|
productType: productType
|
|
44
85
|
}
|