@riosst100/pwa-marketplace 2.3.2 → 2.3.4
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/ProductContent/index.js +1 -0
- package/src/components/ProductContent/productContent.js +234 -0
- package/src/components/SellerDetail/sellerDetail.js +1 -1
- package/src/components/SellerProducts/productContent.js +238 -0
- package/src/components/SellerProducts/sellerProducts.js +109 -46
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategory.js +4 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +2 -0
- package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.js +4 -52
- package/src/talons/ProductContent/index.js +1 -0
- package/src/talons/ProductContent/productContent.gql.js +98 -0
- package/src/talons/ProductContent/useProductContent.js +192 -0
- package/src/talons/SellerProducts/categoryFragments.gql.js +103 -0
- package/src/talons/SellerProducts/index.js +2 -0
- package/src/talons/SellerProducts/productContent.gql.js +98 -0
- package/src/talons/SellerProducts/sellerProducts.gql.js +63 -0
- package/src/talons/SellerProducts/useProductContent.js +194 -0
- package/src/talons/SellerProducts/useSellerProducts.js +264 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Link } from 'react-router-dom';
|
|
3
3
|
|
|
4
4
|
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
@@ -6,9 +6,6 @@ import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
|
6
6
|
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
7
|
import defaultClasses from './submenuColumn.module.css';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
-
import { ArrowDown2 } from 'iconsax-react';
|
|
10
|
-
import { textPrimary } from '@riosst100/pwa-marketplace/src/theme/vars';
|
|
11
|
-
import CustomSubmenuColumn from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/MegaMenu/customSubmenuColumn';
|
|
12
9
|
import cn from 'classnames';
|
|
13
10
|
|
|
14
11
|
/**
|
|
@@ -31,12 +28,8 @@ const SubmenuColumn = props => {
|
|
|
31
28
|
const categoryUrl = resourceUrl(
|
|
32
29
|
`/${category.url_path}${categoryUrlSuffix || ''}`
|
|
33
30
|
);
|
|
34
|
-
let children = null;
|
|
35
|
-
|
|
36
|
-
// let maybeDownArrowIcon = () => {
|
|
37
|
-
// return ;
|
|
38
|
-
// };
|
|
39
31
|
|
|
32
|
+
let children = null;
|
|
40
33
|
let childrenItems = '';
|
|
41
34
|
|
|
42
35
|
if (category.children.length) {
|
|
@@ -54,41 +47,10 @@ const SubmenuColumn = props => {
|
|
|
54
47
|
|
|
55
48
|
const customMenuItems = subCategory.custom_submenu;
|
|
56
49
|
|
|
57
|
-
const [showCustomMenu, setShowCustomMenu] = useState(false);
|
|
58
|
-
|
|
59
|
-
const toggleCustomMenu = () => {
|
|
60
|
-
if (!showCustomMenu) {
|
|
61
|
-
setShowCustomMenu(true);
|
|
62
|
-
} else {
|
|
63
|
-
setShowCustomMenu(false);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const customSubMenus = customMenuItems.length ? (
|
|
68
|
-
<CustomSubmenuColumn
|
|
69
|
-
categoryUrlSuffix={categoryUrlSuffix}
|
|
70
|
-
onNavigate={onNavigate}
|
|
71
|
-
handleCloseSubMenu={handleCloseSubMenu}
|
|
72
|
-
category={subCategory}
|
|
73
|
-
customMenuItems={customMenuItems}
|
|
74
|
-
toggleCustomMenu={toggleCustomMenu}
|
|
75
|
-
/>
|
|
76
|
-
) : '';
|
|
77
|
-
|
|
78
|
-
// if (customMenuItems.length) {
|
|
79
|
-
// console.log(customMenuItems)
|
|
80
|
-
// }
|
|
81
|
-
|
|
82
|
-
// var childLi = '';
|
|
83
50
|
let result = [];
|
|
84
|
-
|
|
85
51
|
if (customMenuItems.length) {
|
|
86
|
-
// console.log('customMenuItems length')
|
|
87
|
-
// console.log(customMenuItems)
|
|
88
|
-
|
|
89
52
|
customMenuItems.map((submenu, index) => {
|
|
90
|
-
const {name
|
|
91
|
-
|
|
53
|
+
const {name} = submenu;
|
|
92
54
|
result.push(
|
|
93
55
|
<li key={index} className={cn(classes.submenuChildItem, 'mt-0')}>
|
|
94
56
|
<Link
|
|
@@ -106,8 +68,6 @@ const SubmenuColumn = props => {
|
|
|
106
68
|
</li>
|
|
107
69
|
)
|
|
108
70
|
})
|
|
109
|
-
|
|
110
|
-
// console.log(childrenItems)
|
|
111
71
|
} else {
|
|
112
72
|
result.push(
|
|
113
73
|
<li key={index} className={cn(classes.submenuChildItem, 'mt-0')}>
|
|
@@ -127,19 +87,11 @@ const SubmenuColumn = props => {
|
|
|
127
87
|
);
|
|
128
88
|
}
|
|
129
89
|
|
|
130
|
-
// return '';
|
|
131
|
-
|
|
132
|
-
// return childLi;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
90
|
return result;
|
|
138
91
|
});
|
|
139
92
|
}
|
|
140
93
|
|
|
141
|
-
if (category.custom_submenu && category.custom_submenu.length)
|
|
142
|
-
{
|
|
94
|
+
if (category.custom_submenu && category.custom_submenu.length) {
|
|
143
95
|
childrenItems = category.custom_submenu.map((subCategory, index) => {
|
|
144
96
|
const { path, isActive, name } = subCategory;
|
|
145
97
|
const categoryUrl = resourceUrl(
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useProductContent } from './useProductContent';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_PRODUCT_FILTERS_BY_CATEGORY = gql`
|
|
4
|
+
query getProductFiltersByCategory(
|
|
5
|
+
$categoryIdFilter: FilterEqualTypeInput!
|
|
6
|
+
) {
|
|
7
|
+
products(filter: { category_uid: $categoryIdFilter }) {
|
|
8
|
+
aggregations {
|
|
9
|
+
label
|
|
10
|
+
count
|
|
11
|
+
attribute_code
|
|
12
|
+
options {
|
|
13
|
+
label
|
|
14
|
+
value
|
|
15
|
+
}
|
|
16
|
+
position
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
export const GET_CATEGORY_CONTENT = gql`
|
|
23
|
+
query getCategoryData($id: String!) {
|
|
24
|
+
categories(filters: { category_uid: { in: [$id] } }) {
|
|
25
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
26
|
+
items {
|
|
27
|
+
uid
|
|
28
|
+
name
|
|
29
|
+
description
|
|
30
|
+
url_key
|
|
31
|
+
url_path
|
|
32
|
+
hide_filters
|
|
33
|
+
allowed_filters {
|
|
34
|
+
code
|
|
35
|
+
}
|
|
36
|
+
custom_subcategory {
|
|
37
|
+
name
|
|
38
|
+
path
|
|
39
|
+
}
|
|
40
|
+
attributes_block {
|
|
41
|
+
label
|
|
42
|
+
code
|
|
43
|
+
items {
|
|
44
|
+
label
|
|
45
|
+
value
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
parent {
|
|
49
|
+
uid
|
|
50
|
+
name
|
|
51
|
+
position
|
|
52
|
+
url_path
|
|
53
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
54
|
+
}
|
|
55
|
+
children {
|
|
56
|
+
uid
|
|
57
|
+
name
|
|
58
|
+
position
|
|
59
|
+
url_path
|
|
60
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
export const GET_CATEGORY_AVAILABLE_SORT_METHODS = gql`
|
|
68
|
+
query getCategoryAvailableSortMethods(
|
|
69
|
+
$categoryIdFilter: FilterEqualTypeInput!
|
|
70
|
+
) {
|
|
71
|
+
products(filter: { category_uid: $categoryIdFilter }) {
|
|
72
|
+
sort_fields {
|
|
73
|
+
options {
|
|
74
|
+
label
|
|
75
|
+
value
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
export const GET_STORE_CONFIG_DATA = gql`
|
|
83
|
+
query GetStoreConfigForBreadcrumbs {
|
|
84
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
85
|
+
storeConfig {
|
|
86
|
+
store_code
|
|
87
|
+
custommarketplace_plp_filters_virtualcategory
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
export default {
|
|
94
|
+
getCategoryContentQuery: GET_CATEGORY_CONTENT,
|
|
95
|
+
getProductFiltersByCategoryQuery: GET_PRODUCT_FILTERS_BY_CATEGORY,
|
|
96
|
+
getCategoryAvailableSortMethodsQuery: GET_CATEGORY_AVAILABLE_SORT_METHODS,
|
|
97
|
+
getStoreConfigQuery: GET_STORE_CONFIG_DATA
|
|
98
|
+
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { useEffect, useMemo } from 'react';
|
|
2
|
+
import { useLazyQuery, useQuery } from '@apollo/client';
|
|
3
|
+
|
|
4
|
+
import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
|
|
5
|
+
import { useEventingContext } from '@magento/peregrine/lib/context/eventing';
|
|
6
|
+
|
|
7
|
+
import DEFAULT_OPERATIONS from './productContent.gql';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Returns props necessary to render the categoryContent component.
|
|
11
|
+
*
|
|
12
|
+
* @param {object} props.data - The results of a getCategory GraphQL query.
|
|
13
|
+
*
|
|
14
|
+
* @returns {object} result
|
|
15
|
+
* @returns {string} result.categoryDescription - This category's description.
|
|
16
|
+
* @returns {string} result.categoryName - This category's name.
|
|
17
|
+
* @returns {object} result.filters - The filters object.
|
|
18
|
+
* @returns {object} result.items - The items in this category.
|
|
19
|
+
* @returns {number} result.totalPagesFromData - The total amount of pages for the query.
|
|
20
|
+
*/
|
|
21
|
+
export const useProductContent = props => {
|
|
22
|
+
const { categoryId, data, pageSize = 6 } = props;
|
|
23
|
+
|
|
24
|
+
const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
getCategoryContentQuery,
|
|
28
|
+
getProductFiltersByCategoryQuery,
|
|
29
|
+
getCategoryAvailableSortMethodsQuery,
|
|
30
|
+
getStoreConfigQuery
|
|
31
|
+
} = operations;
|
|
32
|
+
|
|
33
|
+
const placeholderItems = Array.from({ length: pageSize }).fill(null);
|
|
34
|
+
|
|
35
|
+
const { data: storeConfigData } = useQuery(getStoreConfigQuery, {
|
|
36
|
+
fetchPolicy: 'cache-and-network'
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const virtualCategoryFilters = useMemo(() => {
|
|
40
|
+
if (storeConfigData) {
|
|
41
|
+
const data = storeConfigData.storeConfig.custommarketplace_plp_filters_virtualcategory;
|
|
42
|
+
return data ? data.split(',') : [];
|
|
43
|
+
}
|
|
44
|
+
}, [storeConfigData]);
|
|
45
|
+
|
|
46
|
+
const [getFilters, { data: filterData }] = useLazyQuery(
|
|
47
|
+
getProductFiltersByCategoryQuery,
|
|
48
|
+
{
|
|
49
|
+
fetchPolicy: 'cache-and-network',
|
|
50
|
+
nextFetchPolicy: 'cache-first'
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const [getSortMethods, { data: sortData }] = useLazyQuery(
|
|
55
|
+
getCategoryAvailableSortMethodsQuery,
|
|
56
|
+
{
|
|
57
|
+
fetchPolicy: 'cache-and-network',
|
|
58
|
+
nextFetchPolicy: 'cache-first'
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const { data: categoryData, loading: categoryLoading } = useQuery(
|
|
63
|
+
getCategoryContentQuery,
|
|
64
|
+
{
|
|
65
|
+
fetchPolicy: 'cache-and-network',
|
|
66
|
+
nextFetchPolicy: 'cache-first',
|
|
67
|
+
skip: !categoryId,
|
|
68
|
+
variables: {
|
|
69
|
+
id: categoryId
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const [, { dispatch }] = useEventingContext();
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (categoryId) {
|
|
78
|
+
getFilters({
|
|
79
|
+
variables: {
|
|
80
|
+
categoryIdFilter: {
|
|
81
|
+
eq: categoryId
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, [categoryId, getFilters]);
|
|
87
|
+
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (categoryId) {
|
|
90
|
+
getSortMethods({
|
|
91
|
+
variables: {
|
|
92
|
+
categoryIdFilter: {
|
|
93
|
+
in: categoryId
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}, [categoryId, getSortMethods]);
|
|
99
|
+
|
|
100
|
+
const rawFilters = filterData ? filterData.products.aggregations : null;
|
|
101
|
+
const items = data ? data.products.items : placeholderItems;
|
|
102
|
+
const category =
|
|
103
|
+
categoryData && categoryData.categories.items.length
|
|
104
|
+
? categoryData.categories.items[0]
|
|
105
|
+
: null;
|
|
106
|
+
const children =
|
|
107
|
+
categoryData && categoryData.categories.items.length
|
|
108
|
+
? categoryData.categories.items[0].children
|
|
109
|
+
: null;
|
|
110
|
+
|
|
111
|
+
const filters = [];
|
|
112
|
+
|
|
113
|
+
rawFilters && rawFilters.map((filter, index) => {
|
|
114
|
+
|
|
115
|
+
const filterOptions = [];
|
|
116
|
+
let label = filter.label;
|
|
117
|
+
if (filter.attribute_code == "category_uid") {
|
|
118
|
+
children && children.map((category, index) => {
|
|
119
|
+
filterOptions.push({
|
|
120
|
+
'label': category.name,
|
|
121
|
+
'value': category.uid,
|
|
122
|
+
'path': category.url_path
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
label = category ? category.name : label;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const newFilter = {
|
|
130
|
+
attribute_code: filter.attribute_code,
|
|
131
|
+
count: filter.count,
|
|
132
|
+
label: label,
|
|
133
|
+
position: filter.position,
|
|
134
|
+
options: filterOptions.length ? filterOptions : filter.options
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
filters.push(newFilter);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const attributesBlock = categoryData && categoryData.categories.items.length
|
|
141
|
+
? categoryData.categories.items[0].attributes_block
|
|
142
|
+
: null;
|
|
143
|
+
const parent =
|
|
144
|
+
categoryData && categoryData.categories.items.length
|
|
145
|
+
? categoryData.categories.items[0].parent
|
|
146
|
+
: null;
|
|
147
|
+
const totalPagesFromData = data
|
|
148
|
+
? data.products.page_info.total_pages
|
|
149
|
+
: null;
|
|
150
|
+
const totalCount = data ? data.products.total_count : null;
|
|
151
|
+
|
|
152
|
+
const categoryName =
|
|
153
|
+
categoryData && categoryData.categories.items.length
|
|
154
|
+
? categoryData.categories.items[0].name
|
|
155
|
+
: null;
|
|
156
|
+
const categoryDescription =
|
|
157
|
+
categoryData && categoryData.categories.items.length
|
|
158
|
+
? categoryData.categories.items[0].description
|
|
159
|
+
: null;
|
|
160
|
+
const availableSortMethods = sortData
|
|
161
|
+
? sortData.products.sort_fields.options
|
|
162
|
+
: null;
|
|
163
|
+
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
if (!categoryLoading && categoryData.categories.items.length > 0) {
|
|
166
|
+
dispatch({
|
|
167
|
+
type: 'CATEGORY_PAGE_VIEW',
|
|
168
|
+
payload: {
|
|
169
|
+
id: categoryData.categories.items[0].uid,
|
|
170
|
+
name: categoryData.categories.items[0].name,
|
|
171
|
+
url_key: categoryData.categories.items[0].url_key,
|
|
172
|
+
url_path: categoryData.categories.items[0].url_path
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}, [categoryData, dispatch, categoryLoading]);
|
|
177
|
+
|
|
178
|
+
return {
|
|
179
|
+
availableSortMethods,
|
|
180
|
+
categoryName,
|
|
181
|
+
categoryDescription,
|
|
182
|
+
filters,
|
|
183
|
+
items,
|
|
184
|
+
totalCount,
|
|
185
|
+
totalPagesFromData,
|
|
186
|
+
children,
|
|
187
|
+
parent,
|
|
188
|
+
attributesBlock,
|
|
189
|
+
category,
|
|
190
|
+
virtualCategoryFilters
|
|
191
|
+
};
|
|
192
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const CategoryFragment = gql`
|
|
4
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
5
|
+
fragment CategoryFragment on CategoryTree {
|
|
6
|
+
uid
|
|
7
|
+
meta_title
|
|
8
|
+
meta_keywords
|
|
9
|
+
meta_description
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export const ProductsFragment = gql`
|
|
14
|
+
fragment ProductsFragment on Products {
|
|
15
|
+
items {
|
|
16
|
+
id
|
|
17
|
+
uid
|
|
18
|
+
name
|
|
19
|
+
preorder {
|
|
20
|
+
is_preorder
|
|
21
|
+
preorder_notes
|
|
22
|
+
preorder_availability
|
|
23
|
+
}
|
|
24
|
+
auction_data {
|
|
25
|
+
is_auction
|
|
26
|
+
}
|
|
27
|
+
seller {
|
|
28
|
+
name
|
|
29
|
+
}
|
|
30
|
+
custom_attributes {
|
|
31
|
+
selected_attribute_options {
|
|
32
|
+
attribute_option {
|
|
33
|
+
uid
|
|
34
|
+
label
|
|
35
|
+
is_default
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
entered_attribute_value {
|
|
39
|
+
value
|
|
40
|
+
}
|
|
41
|
+
attribute_metadata {
|
|
42
|
+
uid
|
|
43
|
+
code
|
|
44
|
+
label
|
|
45
|
+
attribute_labels {
|
|
46
|
+
store_code
|
|
47
|
+
label
|
|
48
|
+
}
|
|
49
|
+
data_type
|
|
50
|
+
is_system
|
|
51
|
+
entity_type
|
|
52
|
+
ui_input {
|
|
53
|
+
ui_input_type
|
|
54
|
+
is_html_allowed
|
|
55
|
+
}
|
|
56
|
+
... on ProductAttributeMetadata {
|
|
57
|
+
used_in_components
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
price_range {
|
|
62
|
+
maximum_price {
|
|
63
|
+
final_price {
|
|
64
|
+
currency
|
|
65
|
+
value
|
|
66
|
+
}
|
|
67
|
+
regular_price {
|
|
68
|
+
currency
|
|
69
|
+
value
|
|
70
|
+
}
|
|
71
|
+
discount {
|
|
72
|
+
amount_off
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
minimum_price {
|
|
76
|
+
final_price {
|
|
77
|
+
currency
|
|
78
|
+
value
|
|
79
|
+
}
|
|
80
|
+
regular_price {
|
|
81
|
+
currency
|
|
82
|
+
value
|
|
83
|
+
}
|
|
84
|
+
discount {
|
|
85
|
+
amount_off
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
sku
|
|
90
|
+
small_image {
|
|
91
|
+
url
|
|
92
|
+
}
|
|
93
|
+
stock_status
|
|
94
|
+
rating_summary
|
|
95
|
+
__typename
|
|
96
|
+
url_key
|
|
97
|
+
}
|
|
98
|
+
page_info {
|
|
99
|
+
total_pages
|
|
100
|
+
}
|
|
101
|
+
total_count
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_PRODUCT_FILTERS_BY_CATEGORY = gql`
|
|
4
|
+
query getProductFiltersByCategory(
|
|
5
|
+
$categoryIdFilter: FilterEqualTypeInput!
|
|
6
|
+
) {
|
|
7
|
+
products(filter: { category_uid: $categoryIdFilter }) {
|
|
8
|
+
aggregations {
|
|
9
|
+
label
|
|
10
|
+
count
|
|
11
|
+
attribute_code
|
|
12
|
+
options {
|
|
13
|
+
label
|
|
14
|
+
value
|
|
15
|
+
}
|
|
16
|
+
position
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
export const GET_CATEGORY_CONTENT = gql`
|
|
23
|
+
query getCategoryData($id: String!) {
|
|
24
|
+
categories(filters: { category_uid: { in: [$id] } }) {
|
|
25
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
26
|
+
items {
|
|
27
|
+
uid
|
|
28
|
+
name
|
|
29
|
+
description
|
|
30
|
+
url_key
|
|
31
|
+
url_path
|
|
32
|
+
hide_filters
|
|
33
|
+
allowed_filters {
|
|
34
|
+
code
|
|
35
|
+
}
|
|
36
|
+
custom_subcategory {
|
|
37
|
+
name
|
|
38
|
+
path
|
|
39
|
+
}
|
|
40
|
+
attributes_block {
|
|
41
|
+
label
|
|
42
|
+
code
|
|
43
|
+
items {
|
|
44
|
+
label
|
|
45
|
+
value
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
parent {
|
|
49
|
+
uid
|
|
50
|
+
name
|
|
51
|
+
position
|
|
52
|
+
url_path
|
|
53
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
54
|
+
}
|
|
55
|
+
children {
|
|
56
|
+
uid
|
|
57
|
+
name
|
|
58
|
+
position
|
|
59
|
+
url_path
|
|
60
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
export const GET_CATEGORY_AVAILABLE_SORT_METHODS = gql`
|
|
68
|
+
query getCategoryAvailableSortMethods(
|
|
69
|
+
$categoryIdFilter: FilterEqualTypeInput!
|
|
70
|
+
) {
|
|
71
|
+
products(filter: { category_uid: $categoryIdFilter }) {
|
|
72
|
+
sort_fields {
|
|
73
|
+
options {
|
|
74
|
+
label
|
|
75
|
+
value
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
export const GET_STORE_CONFIG_DATA = gql`
|
|
83
|
+
query GetStoreConfigForBreadcrumbs {
|
|
84
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
85
|
+
storeConfig {
|
|
86
|
+
store_code
|
|
87
|
+
custommarketplace_plp_filters_virtualcategory
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
export default {
|
|
94
|
+
getCategoryContentQuery: GET_CATEGORY_CONTENT,
|
|
95
|
+
getProductFiltersByCategoryQuery: GET_PRODUCT_FILTERS_BY_CATEGORY,
|
|
96
|
+
getCategoryAvailableSortMethodsQuery: GET_CATEGORY_AVAILABLE_SORT_METHODS,
|
|
97
|
+
getStoreConfigQuery: GET_STORE_CONFIG_DATA
|
|
98
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
import { CategoryFragment, ProductsFragment } from './categoryFragments.gql';
|
|
4
|
+
|
|
5
|
+
export const GET_PRODUCTS = gql`
|
|
6
|
+
query GetProductsBySellerId(
|
|
7
|
+
$sellerId: Int!,
|
|
8
|
+
$filter: ProductAttributeFilterInput,
|
|
9
|
+
$pageSize: Int,
|
|
10
|
+
$currentPage: Int,
|
|
11
|
+
$sort: ProductAttributeSortInput
|
|
12
|
+
) {
|
|
13
|
+
productsBySellerId(
|
|
14
|
+
seller_id: $sellerId,
|
|
15
|
+
pageSize: $pageSize,
|
|
16
|
+
currentPage: $currentPage,
|
|
17
|
+
filter: $filter,
|
|
18
|
+
sort: $sort
|
|
19
|
+
) {
|
|
20
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
21
|
+
...ProductsFragment
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
${ProductsFragment}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export const GET_FILTER_INPUTS = gql`
|
|
28
|
+
query GetFilterInputsForCategory {
|
|
29
|
+
__type(name: "ProductAttributeFilterInput") {
|
|
30
|
+
inputFields {
|
|
31
|
+
name
|
|
32
|
+
type {
|
|
33
|
+
name
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
export const GET_CATEGORIES_DATA = gql`
|
|
41
|
+
query GetCategories (
|
|
42
|
+
$filters: CategoryFilterInput,
|
|
43
|
+
$pageSize: Int,
|
|
44
|
+
$currentPage: Int
|
|
45
|
+
) {
|
|
46
|
+
categories(
|
|
47
|
+
filters: $filters,
|
|
48
|
+
pageSize: $pageSize,
|
|
49
|
+
currentPage: $currentPage
|
|
50
|
+
) {
|
|
51
|
+
total_count
|
|
52
|
+
items {
|
|
53
|
+
uid
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
export default {
|
|
60
|
+
getProductsQuery: GET_PRODUCTS,
|
|
61
|
+
getFilterInputsQuery: GET_FILTER_INPUTS,
|
|
62
|
+
getCategoryDataQuery: GET_CATEGORIES_DATA
|
|
63
|
+
};
|