@riosst100/pwa-marketplace 1.3.0 → 1.3.2

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.
Files changed (39) hide show
  1. package/package.json +1 -1
  2. package/src/componentOverrideMapping.js +6 -0
  3. package/src/components/OperatingHours/operatingHours.js +7 -9
  4. package/src/components/Pagination/index.js +27 -29
  5. package/src/components/SellerDetail/sellerDetail.js +2 -13
  6. package/src/components/SellerInformation/sellerInformation.js +2 -1
  7. package/src/components/SellerLocation/sellerLocation.js +1 -1
  8. package/src/components/SellerReview/sellerReview.js +18 -10
  9. package/src/components/SellerReviewItem/sellerReviewItem.js +105 -20
  10. package/src/components/ShopByCategory/index.js +2 -0
  11. package/src/components/ShopByCategory/shopByCategory.js +69 -0
  12. package/src/components/ShopByCategory/shopByCategory.module.css +58 -0
  13. package/src/components/ShopByCategory/shopByCategory.shimmer.js +24 -0
  14. package/src/components/SubCategory/subCategory.js +31 -0
  15. package/src/overwrites/peregrine/lib/talons/Breadcrumbs/useBreadcrumbs.js +100 -0
  16. package/src/overwrites/peregrine/lib/talons/MegaMenu/megaMenu.gql.js +70 -0
  17. package/src/overwrites/peregrine/lib/talons/MegaMenu/useMegaMenu.js +199 -0
  18. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js +70 -0
  19. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +141 -0
  20. package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +222 -0
  21. package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +5 -2
  22. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterDefault.js +84 -0
  23. package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +157 -0
  24. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenu.js +2 -1
  25. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +1 -0
  26. package/src/overwrites/venia-ui/lib/components/MegaMenu/shopByColumn.js +75 -0
  27. package/src/overwrites/venia-ui/lib/components/MegaMenu/shopByColumn.module.css +28 -0
  28. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.js +31 -0
  29. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.js +1 -0
  30. package/src/overwrites/venia-ui/lib/components/SearchBar/searchField.js +1 -1
  31. package/src/talons/MegaMenu/megaMenu.gql.js +70 -0
  32. package/src/talons/Seller/seller.gql.js +0 -36
  33. package/src/talons/SellerReview/sellerReview.gql.js +53 -0
  34. package/src/talons/SellerReview/useSellerReview.js +49 -0
  35. package/src/talons/ShopByCategory/index.js +1 -0
  36. package/src/talons/ShopByCategory/shopByCategory.gql.js +38 -0
  37. package/src/talons/ShopByCategory/useShopByCategory.js +69 -0
  38. package/src/talons/SubCategory/subCategory.gql.js +15 -0
  39. package/src/talons/SubCategory/useSubCategory.js +52 -0
@@ -0,0 +1,70 @@
1
+ import { gql } from '@apollo/client';
2
+ export const GET_STORE_CONFIG_DATA = gql`
3
+ query GetStoreConfigForMegaMenu {
4
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
5
+ storeConfig {
6
+ store_code
7
+ category_url_suffix
8
+ }
9
+ }
10
+ `;
11
+
12
+ export const GET_MEGA_MENU = gql`
13
+ query getMegaMenu {
14
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
15
+ categoryList {
16
+ uid
17
+ name
18
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
19
+ children {
20
+ uid
21
+ include_in_menu
22
+ name
23
+ position
24
+ url_path
25
+ shop_by {
26
+ name
27
+ items {
28
+ name
29
+ url_path
30
+ }
31
+ }
32
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
33
+ children {
34
+ uid
35
+ include_in_menu
36
+ name
37
+ position
38
+ url_path
39
+ shop_by {
40
+ name
41
+ items {
42
+ name
43
+ url_path
44
+ }
45
+ }
46
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
47
+ children {
48
+ uid
49
+ include_in_menu
50
+ name
51
+ position
52
+ url_path
53
+ shop_by {
54
+ name
55
+ items {
56
+ name
57
+ url_path
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
65
+ `;
66
+
67
+ export default {
68
+ getMegaMenuQuery: GET_MEGA_MENU,
69
+ getStoreConfigQuery: GET_STORE_CONFIG_DATA
70
+ };
@@ -147,42 +147,6 @@ export const GET_SELLER_DETAIL_QUERY = gql`
147
147
  response_ratio
148
148
  response_time
149
149
  store_id
150
- seller_rates {
151
- total_count
152
- page_info {
153
- page_size
154
- current_page
155
- }
156
- items {
157
- rating_id
158
- seller_id
159
- customer_id
160
- rate1
161
- rate2
162
- rate3
163
- rate4
164
- rate5
165
- rating
166
- email
167
- title
168
- status
169
- detail
170
- nickname
171
- created_at
172
- verified_buyer
173
- is_recommended
174
- is_hidden
175
- answer
176
- admin_note
177
- like_about
178
- not_like_about
179
- guest_email
180
- plus_review
181
- minus_review
182
- report_abuse
183
- country
184
- }
185
- }
186
150
  products {
187
151
  total_count
188
152
  page_info {
@@ -0,0 +1,53 @@
1
+ import { gql } from '@apollo/client';
2
+
3
+ export const GET_SELLER_REVIEW_DATA = gql`
4
+ query getSellerReviewData($sellerUrl: String!, $filter: SellerRatingFilterInput, $pageSize: Int, $currentPage: Int, $sort: SellerRatingSortInput) {
5
+ sellerRatings(
6
+ seller_url: $sellerUrl
7
+ filter: $filter
8
+ pageSize: $pageSize
9
+ currentPage: $currentPage
10
+ sort: $sort
11
+ ) {
12
+ total_count
13
+ page_info {
14
+ total_pages
15
+ page_size
16
+ current_page
17
+ }
18
+ items {
19
+ rating_id
20
+ seller_id
21
+ customer_id
22
+ rate1
23
+ rate2
24
+ rate3
25
+ rate4
26
+ rate5
27
+ rating
28
+ email
29
+ title
30
+ status
31
+ detail
32
+ nickname
33
+ created_at
34
+ verified_buyer
35
+ is_recommended
36
+ is_hidden
37
+ answer
38
+ admin_note
39
+ like_about
40
+ not_like_about
41
+ guest_email
42
+ plus_review
43
+ minus_review
44
+ report_abuse
45
+ country
46
+ }
47
+ }
48
+ }
49
+ `;
50
+
51
+ export default {
52
+ getSellerReviewQuery: GET_SELLER_REVIEW_DATA
53
+ };
@@ -0,0 +1,49 @@
1
+ import { useQuery } from '@apollo/client';
2
+ import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
3
+ import DEFAULT_OPERATIONS from './sellerReview.gql';
4
+ import { useMemo } from 'react';
5
+
6
+ export const useSellerReview = props => {
7
+ const {
8
+ sellerUrl
9
+ } = props;
10
+
11
+ const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
12
+ const { getSellerReviewQuery } = operations;
13
+
14
+ const filter = [];
15
+ const pageSize = 10;
16
+
17
+ const currentPage = 1;
18
+
19
+ const sort = {rating_id: 'DESC'}
20
+
21
+ const { data, error, loading } = useQuery(getSellerReviewQuery, {
22
+ variables: {
23
+ sellerUrl,
24
+ filter,
25
+ pageSize,
26
+ currentPage,
27
+ sort
28
+ }
29
+ });
30
+
31
+ const reviews = useMemo(() => {
32
+ if (!data) {
33
+ return null;
34
+ }
35
+
36
+ const reviews = data.sellerRatings;
37
+
38
+ if (!reviews) {
39
+ return null;
40
+ }
41
+
42
+ return reviews;
43
+ }, [data]);
44
+
45
+ return {
46
+ reviews,
47
+ loading
48
+ };
49
+ };
@@ -0,0 +1 @@
1
+ export { useShopByCategory } from './useShopByCategory';
@@ -0,0 +1,38 @@
1
+ import { gql } from '@apollo/client';
2
+
3
+ export const GET_STORE_CONFIG_DATA = gql`
4
+ query GetStoreConfigForBreadcrumbs {
5
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
6
+ storeConfig {
7
+ store_code
8
+ category_url_suffix
9
+ }
10
+ }
11
+ `;
12
+
13
+ export const GET_CATEGORY_LIST = gql`
14
+ query getCategoryData($id: String!) {
15
+ categories(filters: { category_uid: { eq: $id } }) {
16
+ items {
17
+ uid
18
+ name
19
+ url_path
20
+ parent {
21
+ uid
22
+ name
23
+ url_path
24
+ }
25
+ children {
26
+ uid
27
+ name
28
+ url_path
29
+ }
30
+ }
31
+ }
32
+ }
33
+ `;
34
+
35
+ export default {
36
+ getStoreConfigQuery: GET_STORE_CONFIG_DATA,
37
+ getCategoryQuery: GET_CATEGORY_LIST
38
+ };
@@ -0,0 +1,69 @@
1
+ import { useMemo } from 'react';
2
+ import { useQuery } from '@apollo/client';
3
+
4
+ import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
5
+
6
+ import DEFAULT_OPERATIONS from './shopByCategory.gql';
7
+
8
+ const getPath = (path, suffix) => {
9
+ if (path) {
10
+ return `/${path}${suffix || ''}`;
11
+ }
12
+
13
+ // If there is no path this is just a dead link.
14
+ return '#';
15
+ };
16
+
17
+ export const useShopByCategory = props => {
18
+ const { children, parent } = props;
19
+
20
+ const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
21
+ const { getStoreConfigQuery } = operations;
22
+
23
+ const { data: storeConfigData } = useQuery(getStoreConfigQuery, {
24
+ fetchPolicy: 'cache-and-network'
25
+ });
26
+
27
+ const categoryUrlSuffix = useMemo(() => {
28
+ if (storeConfigData) {
29
+ return storeConfigData.storeConfig.category_url_suffix;
30
+ }
31
+ }, [storeConfigData]);
32
+
33
+ const childrenNormalizedData = useMemo(() => {
34
+ if (children) {
35
+ return (
36
+ children.length &&
37
+ children
38
+ .map(category => ({
39
+ text: category.name,
40
+ path: getPath(
41
+ category.url_path,
42
+ categoryUrlSuffix
43
+ )
44
+ }))
45
+ );
46
+ }
47
+ }, [categoryUrlSuffix, children]);
48
+
49
+ const parentNormalizedData = useMemo(() => {
50
+ if (parent) {
51
+ return (
52
+ parent.length &&
53
+ parent
54
+ .map(category => ({
55
+ text: category.name,
56
+ path: getPath(
57
+ category.url_path,
58
+ categoryUrlSuffix
59
+ )
60
+ }))
61
+ );
62
+ }
63
+ }, [categoryUrlSuffix, parent]);
64
+
65
+ return {
66
+ childrenNormalizedData: childrenNormalizedData || [],
67
+ parentNormalizedData: parentNormalizedData || []
68
+ };
69
+ };
@@ -0,0 +1,15 @@
1
+ import { gql } from '@apollo/client';
2
+
3
+ export const GET_STORE_CONFIG_DATA = gql`
4
+ query GetStoreConfigForBreadcrumbs {
5
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
6
+ storeConfig {
7
+ store_code
8
+ category_url_suffix
9
+ }
10
+ }
11
+ `;
12
+
13
+ export default {
14
+ getStoreConfigQuery: GET_STORE_CONFIG_DATA
15
+ };
@@ -0,0 +1,52 @@
1
+ import { useMemo } from 'react';
2
+ import { useQuery } from '@apollo/client';
3
+
4
+ import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
5
+
6
+ import DEFAULT_OPERATIONS from './subCategory.gql';
7
+
8
+ const getPath = (path, suffix) => {
9
+ if (path) {
10
+ return `/${path}${suffix || ''}`;
11
+ }
12
+
13
+ // If there is no path this is just a dead link.
14
+ return '#';
15
+ };
16
+
17
+ export const useSubCategory = props => {
18
+ const { children } = props;
19
+
20
+ const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
21
+ const { getStoreConfigQuery } = operations;
22
+
23
+ const { data: storeConfigData } = useQuery(getStoreConfigQuery, {
24
+ fetchPolicy: 'cache-and-network'
25
+ });
26
+
27
+ const categoryUrlSuffix = useMemo(() => {
28
+ if (storeConfigData) {
29
+ return storeConfigData.storeConfig.category_url_suffix;
30
+ }
31
+ }, [storeConfigData]);
32
+
33
+ const normalizedData = useMemo(() => {
34
+ if (children) {
35
+ return (
36
+ children.length &&
37
+ children
38
+ .map(category => ({
39
+ text: category.name,
40
+ path: getPath(
41
+ category.url_path,
42
+ categoryUrlSuffix
43
+ )
44
+ }))
45
+ );
46
+ }
47
+ }, [categoryUrlSuffix, children]);
48
+
49
+ return {
50
+ normalizedData: normalizedData || []
51
+ };
52
+ };