@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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "2.4.6",
4
+ "version": "2.4.7",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -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 (websiteCodeInUrl) {
51
- setVerifyUserIp(false);
52
-
53
- storage.removeItem('access_base_website');
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
- }, [websiteCodeInUrl])
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: !sellerId,
61
+ skip: !categoryUid,
60
62
  variables: {
61
- id: sellerId
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 (sellerId) {
71
+ if (categoryUid) {
70
72
  getFilters({
71
73
  variables: {
72
74
  categoryIdFilter: {
73
- eq: sellerId
75
+ eq: categoryUid
74
76
  }
75
77
  }
76
78
  });
77
79
  }
78
- }, [sellerId, getFilters]);
80
+ }, [categoryUid, getFilters]);
79
81
 
80
82
  useEffect(() => {
81
- if (sellerId) {
83
+ if (categoryUid) {
82
84
  getSortMethods({
83
85
  variables: {
84
86
  categoryIdFilter: {
85
- in: sellerId
87
+ in: categoryUid
86
88
  }
87
89
  }
88
90
  });
89
91
  }
90
- }, [sellerId, getSortMethods]);
92
+ }, [categoryUid, getSortMethods]);
91
93
 
92
- // console.log('data')
93
- // console.log(data)
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
- // const category =
100
- // categoryData && categoryData.categories.items.length
101
- // ? categoryData.categories.items[0]
102
- // : null;
103
- // const children =
104
- // categoryData && categoryData.categories.items.length
105
- // ? categoryData.categories.items[0].children
106
- // : null;
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.categories.items[0].id;
135
+ uid = categoryData?.categories?.items[0].id;
136
136
  }
137
137
  return uid;
138
138
  }, [categoryData]);