@riosst100/pwa-marketplace 1.7.8 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "1.7.8",
4
+ "version": "1.7.9",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -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
- console.log(activeFilters)
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>{attributeData ? 'By ' + attributeData.label : 'Shop By'}</StoreTitle>
206
- <Breadcrumbs categoryId={categoryId} customPage={'By ' + attributeData.label} currentFilter={activeFilters} />
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
- {attributeData ? 'By ' + attributeData.label : 'Shop By'}
204
+ {title}
209
205
  </h1>
210
206
  <div className='border border-gray-100 px-6'>
211
207
  {dataResult ? (
@@ -226,7 +226,7 @@ const CategoryContent = props => {
226
226
 
227
227
  let isSingles = false;
228
228
 
229
- console.log(allActiveFilters)
229
+ // console.log(allActiveFilters)
230
230
 
231
231
  if (allActiveFilters && allActiveFilters.size > 0) {
232
232
  allActiveFilters.forEach((value, key) => {
@@ -256,9 +256,9 @@ const CategoryContent = props => {
256
256
  // console.log(activeFilters.length)
257
257
  // console.log(activeFilters.map(u => u.label).join(' - '))
258
258
 
259
- const title = activeFilters ? (
259
+ const title = activeFilters && activeFilters.length ? (
260
260
  activeFilters.length > 1 ?
261
- activeFilters.map(u => u.label).join(' - ')
261
+ activeFilters.map(u => u.label).join(': ')
262
262
  : currentFilter
263
263
  ) : categoryName;
264
264
 
@@ -74,7 +74,7 @@ const Breadcrumbs = props => {
74
74
 
75
75
  const filterBreadcrumbsElement = [];
76
76
 
77
- const lastIndex = currentFilter.length - 1;
77
+ const lastIndex = currentFilter ? currentFilter.length - 1 : 0;
78
78
  // const filterpath = ;
79
79
 
80
80
  currentFilter && currentFilter.length && currentFilter.map((filter, index) => {
@@ -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'];
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, searchQuery]);
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
- if (searchQuery) {
167
- setActive('all')
168
- options = options.filter(function(option) {
169
- return option.label.search(new RegExp(searchQuery, "i")) != -1;
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();