@riosst100/pwa-marketplace 2.4.6 → 2.4.7
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/SellerProducts/productContent.js +13 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +0 -5
- package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +6 -9
- package/src/talons/SellerProducts/useProductContent.js +25 -20
- package/src/talons/SellerProducts/useSellerProducts.js +1 -1
package/package.json
CHANGED
|
@@ -30,10 +30,15 @@ const FilterSidebar = React.lazy(() =>
|
|
|
30
30
|
|
|
31
31
|
const FilterModal = React.lazy(() => import('@magento/venia-ui/lib/components/FilterModal'));
|
|
32
32
|
|
|
33
|
+
const FilterTop = React.lazy(() =>
|
|
34
|
+
import('@riosst100/pwa-marketplace/src/components/FilterTop')
|
|
35
|
+
);
|
|
36
|
+
|
|
33
37
|
const ProductContent = props => {
|
|
34
38
|
const {
|
|
35
39
|
categoryId,
|
|
36
40
|
data,
|
|
41
|
+
shopby,
|
|
37
42
|
pageControl,
|
|
38
43
|
sortProps,
|
|
39
44
|
isLoading,
|
|
@@ -63,6 +68,8 @@ const ProductContent = props => {
|
|
|
63
68
|
availableSortMethods,
|
|
64
69
|
filters,
|
|
65
70
|
items,
|
|
71
|
+
category,
|
|
72
|
+
children,
|
|
66
73
|
totalPagesFromData
|
|
67
74
|
} = talonProps;
|
|
68
75
|
|
|
@@ -107,6 +114,9 @@ const ProductContent = props => {
|
|
|
107
114
|
<SortedByContainerShimmer />
|
|
108
115
|
) : null;
|
|
109
116
|
|
|
117
|
+
console.log('filters')
|
|
118
|
+
console.log(filters)
|
|
119
|
+
|
|
110
120
|
const filtersModal = shouldShowFilterButtons ? (
|
|
111
121
|
<FilterModal filters={filters} />
|
|
112
122
|
) : null;
|
|
@@ -202,6 +212,9 @@ const ProductContent = props => {
|
|
|
202
212
|
</Link>
|
|
203
213
|
</div>
|
|
204
214
|
</div>
|
|
215
|
+
<div className='w-full mb-[0px]'>
|
|
216
|
+
<FilterTop shopby={shopby} filters={filters} category={category} children={children} allowedFilters={category ? category.allowed_filters : []} />
|
|
217
|
+
</div>
|
|
205
218
|
<div className='w-full flex items-start gap-x-[30px]'>
|
|
206
219
|
<div className={classes.contentWrapper}>
|
|
207
220
|
<div ref={sidebarRef} className={classes.sidebar}>
|
|
@@ -324,12 +324,7 @@ const CategoryContent = props => {
|
|
|
324
324
|
</>
|
|
325
325
|
{/* ) : ( */}
|
|
326
326
|
<>
|
|
327
|
-
{/* <SubCategory filters={filters} children={children} /> */}
|
|
328
327
|
<FilterTop shopby={shopby} filters={filters} category={category} children={children} allowedFilters={category ? category.allowed_filters : []} />
|
|
329
|
-
{/* <AttributesBlock category={category} attributesBlock={attributesBlock} /> */}
|
|
330
|
-
{/* <section className='category_brand-slider my-5'>
|
|
331
|
-
<BrandSlider />
|
|
332
|
-
</section> */}
|
|
333
328
|
<div className={classes.contentWrapper}>
|
|
334
329
|
<div ref={sidebarRef} className={classes.sidebar}>
|
|
335
330
|
<Suspense fallback={<FilterSidebarShimmer />}>
|
|
@@ -37,6 +37,7 @@ const Adapter = props => {
|
|
|
37
37
|
websiteCodes.sort((a, b) => b.length - a.length);
|
|
38
38
|
|
|
39
39
|
const { location } = globalThis;
|
|
40
|
+
const pathname = location.pathname;
|
|
40
41
|
const match = location && location.pathname.split("/")[1];
|
|
41
42
|
let websiteCodeInUrl = websiteCodes.find((str) => str === match);
|
|
42
43
|
|
|
@@ -47,16 +48,12 @@ const Adapter = props => {
|
|
|
47
48
|
|
|
48
49
|
// Check split cart
|
|
49
50
|
useEffect(() => {
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
routerProps.basename = websiteCodeInUrl != process.env.WEBSITE_CODE ? '/'+websiteCodeInUrl : '/';
|
|
56
|
-
|
|
57
|
-
setNewRouterProps(routerProps);
|
|
51
|
+
if (pathname && pathname.includes('cart')) {
|
|
52
|
+
console.log('INI CART PAGE')
|
|
53
|
+
} else {
|
|
54
|
+
console.log('INI BUKAN CART PAGE')
|
|
58
55
|
}
|
|
59
|
-
}, [
|
|
56
|
+
}, [pathname]);
|
|
60
57
|
|
|
61
58
|
useEffect(() => {
|
|
62
59
|
if (websiteCodeInUrl) {
|
|
@@ -9,6 +9,8 @@ import DEFAULT_OPERATIONS from './productContent.gql';
|
|
|
9
9
|
export const useProductContent = props => {
|
|
10
10
|
const { sellerId, data, pageSize = 6 } = props;
|
|
11
11
|
|
|
12
|
+
const categoryUid = 'MTI=';
|
|
13
|
+
|
|
12
14
|
const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
|
|
13
15
|
|
|
14
16
|
const {
|
|
@@ -56,9 +58,9 @@ export const useProductContent = props => {
|
|
|
56
58
|
{
|
|
57
59
|
fetchPolicy: 'cache-and-network',
|
|
58
60
|
nextFetchPolicy: 'cache-first',
|
|
59
|
-
skip: !
|
|
61
|
+
skip: !categoryUid,
|
|
60
62
|
variables: {
|
|
61
|
-
id:
|
|
63
|
+
id: categoryUid
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
);
|
|
@@ -66,47 +68,50 @@ export const useProductContent = props => {
|
|
|
66
68
|
const [, { dispatch }] = useEventingContext();
|
|
67
69
|
|
|
68
70
|
useEffect(() => {
|
|
69
|
-
if (
|
|
71
|
+
if (categoryUid) {
|
|
70
72
|
getFilters({
|
|
71
73
|
variables: {
|
|
72
74
|
categoryIdFilter: {
|
|
73
|
-
eq:
|
|
75
|
+
eq: categoryUid
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
});
|
|
77
79
|
}
|
|
78
|
-
}, [
|
|
80
|
+
}, [categoryUid, getFilters]);
|
|
79
81
|
|
|
80
82
|
useEffect(() => {
|
|
81
|
-
if (
|
|
83
|
+
if (categoryUid) {
|
|
82
84
|
getSortMethods({
|
|
83
85
|
variables: {
|
|
84
86
|
categoryIdFilter: {
|
|
85
|
-
in:
|
|
87
|
+
in: categoryUid
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
});
|
|
89
91
|
}
|
|
90
|
-
}, [
|
|
92
|
+
}, [categoryUid, getSortMethods]);
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
console.log('filterData')
|
|
95
|
+
console.log(filterData)
|
|
94
96
|
|
|
95
97
|
const rawFilters = filterData ? filterData.products.aggregations : null;
|
|
96
98
|
const items = data ? data.items : placeholderItems;
|
|
97
|
-
const category = null;
|
|
98
|
-
const children = null;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
// const category = null;
|
|
100
|
+
// const children = null;
|
|
101
|
+
const category =
|
|
102
|
+
categoryData && categoryData.categories.items.length
|
|
103
|
+
? categoryData.categories.items[0]
|
|
104
|
+
: null;
|
|
105
|
+
const children =
|
|
106
|
+
categoryData && categoryData.categories.items.length
|
|
107
|
+
? categoryData.categories.items[0].children
|
|
108
|
+
: null;
|
|
107
109
|
|
|
108
110
|
const filters = [];
|
|
109
111
|
|
|
112
|
+
console.log('rawFilters')
|
|
113
|
+
console.log(rawFilters)
|
|
114
|
+
|
|
110
115
|
rawFilters && rawFilters.map((filter, index) => {
|
|
111
116
|
|
|
112
117
|
const filterOptions = [];
|
|
@@ -132,7 +132,7 @@ export const useSellerProducts = props => {
|
|
|
132
132
|
const categoryId = useMemo(() => {
|
|
133
133
|
let uid = null;
|
|
134
134
|
if (categoryData) {
|
|
135
|
-
uid = categoryData
|
|
135
|
+
uid = categoryData?.categories?.items[0].id;
|
|
136
136
|
}
|
|
137
137
|
return uid;
|
|
138
138
|
}, [categoryData]);
|