@riosst100/pwa-marketplace 3.1.2 → 3.1.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/BrandLandingPage/brandLanding.js +0 -5
- package/src/components/CheckoutHeader/accountTrigger.js +104 -0
- package/src/components/CheckoutHeader/cartTrigger.js +110 -0
- package/src/components/CheckoutHeader/cartTrigger.module.css +47 -0
- package/src/components/CheckoutHeader/storeSwitcher.js +119 -0
- package/src/components/CheckoutHeader/storeSwitcher.module.css +107 -0
- package/src/components/CheckoutHeader/switcherItem.js +47 -0
- package/src/components/CheckoutHeader/wishlistTrigger.js +23 -0
- package/src/components/FilterListContent/filterListPage.js +0 -25
- package/src/components/FilterTop/filterTop.js +1 -1
- package/src/components/HelpCenter/helpCenter.js +151 -0
- package/src/components/HelpCenter/helpcenter.module.css +225 -0
- package/src/components/HelpCenter/index.js +1 -0
- package/src/components/HelpCenter/questionDetail.js +89 -0
- package/src/components/ProductContent/productContent.js +1 -1
- package/src/components/RMAPage/components/productItem.css +15 -0
- package/src/components/RMAPage/components/productItem.module.css +15 -0
- package/src/components/RelatedProducts/index.js +1 -0
- package/src/components/RelatedProducts/relatedProducts.js +44 -0
- package/src/components/SellerMegaMenu/__tests__/MegaMenu.spec.js +91 -0
- package/src/components/SellerMegaMenu/__tests__/MegaMenuItem.spec.js +123 -0
- package/src/components/SellerMegaMenu/__tests__/Submenu.spec.js +61 -0
- package/src/components/SellerMegaMenu/__tests__/SubmenuColumn.spec.js +50 -0
- package/src/components/SellerMegaMenu/__tests__/__snapshots__/MegaMenu.spec.js.snap +114 -0
- package/src/components/SellerMegaMenu/__tests__/__snapshots__/MegaMenuItem.spec.js.snap +71 -0
- package/src/components/SellerMegaMenu/__tests__/__snapshots__/Submenu.spec.js.snap +59 -0
- package/src/components/SellerMegaMenu/__tests__/__snapshots__/SubmenuColumn.spec.js.snap +34 -0
- package/src/components/SellerMegaMenu/customSubmenuColumn.js +75 -0
- package/src/components/SellerMegaMenu/customSubmenuColumn.module.css +29 -0
- package/src/components/SellerMegaMenu/shopByColumn.js +121 -0
- package/src/components/SellerProducts/productContent.js +2 -4
- package/src/components/SetsData/setsData.js +0 -25
- package/src/components/ShopBy/shopBy.js +3 -78
- package/src/components/ShopBySets/shopBySets.js +2 -2
- package/src/components/ShowMore/showMore.js +3 -49
- package/src/overwrites/peregrine/lib/talons/OrderHistoryPage/orderHistoryPage.gql.js +1 -15
- package/src/overwrites/peregrine/lib/talons/OrderHistoryPage/orderRow.gql.js +0 -11
- package/src/overwrites/peregrine/lib/talons/RelatedProducts/productReview.gql.js +89 -0
- package/src/overwrites/peregrine/lib/talons/RelatedProducts/useRelatedProducts.js +833 -0
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js +0 -16
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +1 -5
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +118 -62
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +3 -50
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +1 -7
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/EditModal/editModal.js +41 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/EditModal/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/EditModal/productDetail.js +80 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/EditModal/productDetail.module.css +33 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/EditModal/productForm.js +153 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/EditModal/productForm.module.css +52 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/errorMessage.js +31 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/errorMessage.module.css +13 -0
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/quantity.js +40 -0
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +21 -92
- package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +6 -2
- package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.js +0 -21
- package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/Reviews/reviewModal.js +8 -0
- package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderHistoryPage.js +3 -3
- package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderRow.js +4 -85
- package/src/talons/HelpCenter/helpCenter.gql.js +93 -0
- package/src/talons/HelpCenter/useHelpCenter.js +59 -0
- package/src/talons/ProductContent/productContent.gql.js +0 -16
- package/src/talons/ProductContent/useProductContent.js +0 -4
- package/src/talons/RelatedProducts/relatedProducts.gql.js +209 -0
- package/src/talons/RelatedProducts/useRelatedProducts.js +112 -0
- package/src/talons/SellerProducts/productContent.gql.js +1 -17
- package/src/talons/SellerProducts/useProductContent.js +1 -36
- package/src/components/AttributesBlock/attributesBlock.js +0 -54
- package/src/components/AttributesBlock/attributesBlock.module.css +0 -28
- package/src/components/ShopBy/shopBy copy.js +0 -172
- package/src/components/SubCategory/customSubCategory.js +0 -45
- package/src/components/SubCategory/customSubCategory.module.css +0 -22
- package/src/talons/AttributesBlock/attributesBlock.gql.js +0 -15
- package/src/talons/AttributesBlock/useAttributesBlock.js +0 -38
- package/src/talons/SubCategory/useCustomSubCategory.js +0 -50
|
@@ -9,9 +9,6 @@ import DEFAULT_OPERATIONS from './productContent.gql';
|
|
|
9
9
|
export const useProductContent = props => {
|
|
10
10
|
const { sellerId, categoryId, data, pageSize = 6 } = props;
|
|
11
11
|
|
|
12
|
-
// const categoryId = 'MTI=';
|
|
13
|
-
// alert(categoryId)
|
|
14
|
-
|
|
15
12
|
const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
|
|
16
13
|
|
|
17
14
|
const {
|
|
@@ -22,16 +19,12 @@ export const useProductContent = props => {
|
|
|
22
19
|
} = operations;
|
|
23
20
|
|
|
24
21
|
const placeholderItems = Array.from({ length: pageSize }).fill(null);
|
|
25
|
-
|
|
26
|
-
// console.log(getStoreConfigQuery)
|
|
27
22
|
|
|
28
23
|
const { data: storeConfigData } = useQuery(getStoreConfigQuery, {
|
|
29
24
|
fetchPolicy: 'cache-and-network',
|
|
30
25
|
nextFetchPolicy: 'cache-first'
|
|
31
26
|
});
|
|
32
27
|
|
|
33
|
-
// return '';
|
|
34
|
-
|
|
35
28
|
const virtualCategoryFilters = useMemo(() => {
|
|
36
29
|
if (storeConfigData) {
|
|
37
30
|
const data = storeConfigData.storeConfig.custommarketplace_plp_filters_virtualcategory;
|
|
@@ -135,18 +128,9 @@ export const useProductContent = props => {
|
|
|
135
128
|
filters.push(newFilter);
|
|
136
129
|
});
|
|
137
130
|
|
|
138
|
-
const attributesBlock = null;
|
|
139
131
|
const parent = null;
|
|
140
|
-
// const categoryName = null;
|
|
141
132
|
const categoryDescription = null;
|
|
142
|
-
|
|
143
|
-
// const attributesBlock = categoryData && categoryData.categories.items.length
|
|
144
|
-
// ? categoryData.categories.items[0].attributes_block
|
|
145
|
-
// : null;
|
|
146
|
-
// const parent =
|
|
147
|
-
// categoryData && categoryData.categories.items.length
|
|
148
|
-
// ? categoryData.categories.items[0].parent
|
|
149
|
-
// : null;
|
|
133
|
+
|
|
150
134
|
const totalPagesFromData = data
|
|
151
135
|
? data.page_info.total_pages
|
|
152
136
|
: null;
|
|
@@ -156,28 +140,10 @@ export const useProductContent = props => {
|
|
|
156
140
|
categoryData && categoryData.categories.items.length
|
|
157
141
|
? categoryData.categories.items[0].name
|
|
158
142
|
: null;
|
|
159
|
-
// const categoryDescription =
|
|
160
|
-
// categoryData && categoryData.categories.items.length
|
|
161
|
-
// ? categoryData.categories.items[0].description
|
|
162
|
-
// : null;
|
|
163
143
|
const availableSortMethods = sortData
|
|
164
144
|
? sortData.products.sort_fields.options
|
|
165
145
|
: null;
|
|
166
146
|
|
|
167
|
-
// useEffect(() => {
|
|
168
|
-
// if (!categoryLoading && categoryData.categories.items.length > 0) {
|
|
169
|
-
// dispatch({
|
|
170
|
-
// type: 'CATEGORY_PAGE_VIEW',
|
|
171
|
-
// payload: {
|
|
172
|
-
// id: categoryData.categories.items[0].uid,
|
|
173
|
-
// name: categoryData.categories.items[0].name,
|
|
174
|
-
// url_key: categoryData.categories.items[0].url_key,
|
|
175
|
-
// url_path: categoryData.categories.items[0].url_path
|
|
176
|
-
// }
|
|
177
|
-
// });
|
|
178
|
-
// }
|
|
179
|
-
// }, [categoryData, dispatch, categoryLoading]);
|
|
180
|
-
|
|
181
147
|
return {
|
|
182
148
|
availableSortMethods,
|
|
183
149
|
categoryName,
|
|
@@ -188,7 +154,6 @@ export const useProductContent = props => {
|
|
|
188
154
|
totalPagesFromData,
|
|
189
155
|
children,
|
|
190
156
|
parent,
|
|
191
|
-
attributesBlock,
|
|
192
157
|
category,
|
|
193
158
|
virtualCategoryFilters
|
|
194
159
|
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { useAttributesBlock } from '@riosst100/pwa-marketplace/src/talons/AttributesBlock/useAttributesBlock';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Link } from 'react-router-dom';
|
|
4
|
-
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
5
|
-
import defaultClasses from './attributesBlock.module.css';
|
|
6
|
-
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
|
-
|
|
8
|
-
const AttributesBlock = props => {
|
|
9
|
-
const { attributesBlock, category } = props;
|
|
10
|
-
|
|
11
|
-
const talonProps = useAttributesBlock({ attributesBlock });
|
|
12
|
-
|
|
13
|
-
const classes = useStyle(defaultClasses, props.classes);
|
|
14
|
-
|
|
15
|
-
const {
|
|
16
|
-
categoryUrlSuffix,
|
|
17
|
-
getPath
|
|
18
|
-
} = talonProps;
|
|
19
|
-
|
|
20
|
-
const result = [];
|
|
21
|
-
|
|
22
|
-
attributesBlock && attributesBlock.map(({ label, code, items }, index) => {
|
|
23
|
-
|
|
24
|
-
const itemsResult = [];
|
|
25
|
-
|
|
26
|
-
items && items.map(({ label, value }, index) => {
|
|
27
|
-
const path = resourceUrl(
|
|
28
|
-
`/${category.url_path}${categoryUrlSuffix || ''}?${code}[filter]=${label},${value}`
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
itemsResult.push(
|
|
32
|
-
<>
|
|
33
|
-
<Link
|
|
34
|
-
key={index}
|
|
35
|
-
to={path}
|
|
36
|
-
>
|
|
37
|
-
<li className={classes.item}>{label}</li>
|
|
38
|
-
</Link>
|
|
39
|
-
</>
|
|
40
|
-
)
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
result.push(
|
|
44
|
-
<span key={index}>
|
|
45
|
-
<div className={classes.title}>{label}</div>
|
|
46
|
-
<ul className={classes.root}>{itemsResult}</ul>
|
|
47
|
-
</span>
|
|
48
|
-
)
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
return result;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default AttributesBlock;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
.root {
|
|
2
|
-
composes: flex from global;
|
|
3
|
-
composes: flex-wrap from global;
|
|
4
|
-
composes: mt-3 from global;
|
|
5
|
-
composes: gap-[15px] from global;
|
|
6
|
-
margin-bottom: 30px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.item {
|
|
10
|
-
composes: px-4 from global;
|
|
11
|
-
composes: py-2 from global;
|
|
12
|
-
composes: transition-colors from global;
|
|
13
|
-
composes: duration-150 from global;
|
|
14
|
-
composes: border from global;
|
|
15
|
-
composes: border-solid from global;
|
|
16
|
-
composes: leading-normal from global;
|
|
17
|
-
composes: text-base from global;
|
|
18
|
-
composes: text-colorDefault from global;
|
|
19
|
-
composes: bg-white from global;
|
|
20
|
-
composes: border-gray-100 from global;
|
|
21
|
-
border-radius: 5px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.title {
|
|
25
|
-
composes: pb-3 from global;
|
|
26
|
-
composes: font-bold from global;
|
|
27
|
-
composes: text-[14px] from global;
|
|
28
|
-
}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import React, { Fragment, useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
|
|
3
|
-
import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
|
|
4
|
-
import { Link } from 'react-router-dom';
|
|
5
|
-
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
6
|
-
import defaultClasses from './shopBy.module.css';
|
|
7
|
-
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
8
|
-
import cn from 'classnames';
|
|
9
|
-
import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
|
|
10
|
-
import { ShopByShimmer } from '@riosst100/pwa-marketplace/src/components/ShopBy';
|
|
11
|
-
import CustomSortBy from '@riosst100/pwa-marketplace/src/components/CustomSortBy';
|
|
12
|
-
import ArraySearchInput from '@riosst100/pwa-marketplace/src/components/ArraySearchInput';
|
|
13
|
-
import { useCustomSort } from '@riosst100/pwa-marketplace/src/hooks/useCustomSort';
|
|
14
|
-
import { useShopBy } from '@riosst100/pwa-marketplace/src/talons/ShopBy/useShopBy';
|
|
15
|
-
|
|
16
|
-
const ShopBy = props => {
|
|
17
|
-
const [active, setActive] = useState('all');
|
|
18
|
-
|
|
19
|
-
const [searchQuery, setSearchQuery] = useState('');
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const sortProps = useCustomSort({ sortFromSearch: false, defaultSort: {
|
|
23
|
-
sortText: 'All (A-Z)',
|
|
24
|
-
value: 'all'
|
|
25
|
-
}});
|
|
26
|
-
|
|
27
|
-
const [currentSort] = sortProps;
|
|
28
|
-
|
|
29
|
-
// const [sortBy, setSortBy] = useState({
|
|
30
|
-
// sortText: 'All (A-Z)',
|
|
31
|
-
// value: 'all'
|
|
32
|
-
// });
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const classes = useStyle(defaultClasses);
|
|
36
|
-
|
|
37
|
-
const talonProps = useShopBy({ searchQuery, setActive, currentSort });
|
|
38
|
-
|
|
39
|
-
const { error, loading, dataResult, categoryUrlSuffix, categoryUrlKey, productType, filteredCollectibleGameSets, availableGroups, attributeData, alpha, category } = talonProps;
|
|
40
|
-
|
|
41
|
-
if (loading && !dataResult)
|
|
42
|
-
return <ShopByShimmer />;
|
|
43
|
-
if (error && !dataResult) return <ErrorView />;
|
|
44
|
-
|
|
45
|
-
if (!dataResult && !loading && !error) {
|
|
46
|
-
return <ShopByShimmer />;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const newData = searchQuery ? filteredCollectibleGameSets : dataResult;
|
|
50
|
-
|
|
51
|
-
const setRelases = availableGroups.map((group, index) => {
|
|
52
|
-
const optionsResult = [];
|
|
53
|
-
|
|
54
|
-
if (active === 'all' || active === group) {
|
|
55
|
-
dataResult[group].map((option, index) => {
|
|
56
|
-
const { label, value } = option;
|
|
57
|
-
|
|
58
|
-
const categoryUrl = resourceUrl(
|
|
59
|
-
`/${categoryUrlKey}${categoryUrlSuffix || ''}?${attributeData.attribute_code}[filter]=${label},${value}`
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
optionsResult.push(<li className='list-none'>
|
|
63
|
-
<Link to={categoryUrl} className="hover_bg-darkblue-900 hover_text-white w-full block text-[14px] py-[2px] px-2">
|
|
64
|
-
{label}
|
|
65
|
-
</Link>
|
|
66
|
-
</li>)
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<>
|
|
71
|
-
{optionsResult ?
|
|
72
|
-
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
73
|
-
<div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2' >
|
|
74
|
-
{group}
|
|
75
|
-
</div>
|
|
76
|
-
<div className={cn('singles_item-list flex flex-col')}>{optionsResult}</div>
|
|
77
|
-
</div> : ''}
|
|
78
|
-
</>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return null;
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const handleActive = (val) => {
|
|
86
|
-
setActive(val);
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
setSearchQuery('')
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
let availableSortBy = [
|
|
95
|
-
{
|
|
96
|
-
'label': 'All (A-Z)',
|
|
97
|
-
'value': 'all'
|
|
98
|
-
}
|
|
99
|
-
];
|
|
100
|
-
|
|
101
|
-
let title = "All Sets";
|
|
102
|
-
if (productType == "expansion-sets") {
|
|
103
|
-
title = "Expansion Sets";
|
|
104
|
-
} else if (productType == "artist") {
|
|
105
|
-
title = "Artist";
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<Fragment>
|
|
110
|
-
<StoreTitle>{title}</StoreTitle>
|
|
111
|
-
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
112
|
-
{attributeData ? 'By ' + attributeData.label : 'Shop By'}
|
|
113
|
-
</h1>
|
|
114
|
-
<div className='border border-gray-100 px-6'>
|
|
115
|
-
{dataResult ? (
|
|
116
|
-
<div
|
|
117
|
-
className={classes.toolbar}
|
|
118
|
-
>
|
|
119
|
-
<div style={{"width":"35%"}}><ArraySearchInput active={active} searchQuery={searchQuery} placeholder="Search sets..." isOpen={true} setSearchQuery={setSearchQuery} /></div>
|
|
120
|
-
<CustomSortBy sortProps={sortProps} availableSortMethods={availableSortBy} />
|
|
121
|
-
</div>
|
|
122
|
-
) : ''}
|
|
123
|
-
{productType != "expansion-sets" ? (
|
|
124
|
-
<>
|
|
125
|
-
<section className='single_list-indexing-container relative m-auto py-10'>
|
|
126
|
-
<ul className='flex gap-2 justify-center flex-wrap'>
|
|
127
|
-
<li>
|
|
128
|
-
<button
|
|
129
|
-
className={cn(
|
|
130
|
-
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
131
|
-
'leading-4 font-medium text-base hover_bg-gray-50'
|
|
132
|
-
)}
|
|
133
|
-
onClick={() => {
|
|
134
|
-
handleActive('all')
|
|
135
|
-
}}
|
|
136
|
-
>
|
|
137
|
-
{active == 'all' ? <b>All</b> : 'All'}
|
|
138
|
-
</button>
|
|
139
|
-
</li>
|
|
140
|
-
{alpha.map((letter, index) => (
|
|
141
|
-
<li key={index}>
|
|
142
|
-
<button
|
|
143
|
-
className={cn(
|
|
144
|
-
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
145
|
-
'leading-4 font-medium text-base ',
|
|
146
|
-
availableGroups.includes(letter) > 0 ? 'hover_bg-gray-50' : 'bg-gray-100 text-gray-400',
|
|
147
|
-
)}
|
|
148
|
-
onClick={() => {
|
|
149
|
-
handleActive(letter)
|
|
150
|
-
}}
|
|
151
|
-
disabled={availableGroups.includes(letter) > 0 ? false : true}
|
|
152
|
-
>
|
|
153
|
-
{active == letter ? <b>{letter}</b> : letter}
|
|
154
|
-
</button>
|
|
155
|
-
</li>
|
|
156
|
-
))}
|
|
157
|
-
</ul>
|
|
158
|
-
</section>
|
|
159
|
-
</>
|
|
160
|
-
) : ''}
|
|
161
|
-
<Divider className="mb-5 px-4 mt-5" />
|
|
162
|
-
<section className='singles-container'>
|
|
163
|
-
<div className={cn('singles-wrapper block -mx-4', classes.singlesWrapper)}>
|
|
164
|
-
{Object.keys(dataResult).length != 0 ? setRelases : (searchQuery ? <div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>No data found for <b>{searchQuery}</b> search query.</div> : <div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>No data found.</div>)}
|
|
165
|
-
</div>
|
|
166
|
-
</section>
|
|
167
|
-
</div>
|
|
168
|
-
</Fragment>
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export default ShopBy;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useCustomSubCategory } from '@riosst100/pwa-marketplace/src/talons/SubCategory/useCustomSubCategory';
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import { Link } from 'react-router-dom';
|
|
4
|
-
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
5
|
-
import defaultClasses from './customSubCategory.module.css';
|
|
6
|
-
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
|
-
|
|
8
|
-
const CustomSubCategory = props => {
|
|
9
|
-
const { customSubCategory, categoryName } = props;
|
|
10
|
-
|
|
11
|
-
const talonProps = useCustomSubCategory({ customSubCategory });
|
|
12
|
-
|
|
13
|
-
const classes = useStyle(defaultClasses, props.classes);
|
|
14
|
-
|
|
15
|
-
const {
|
|
16
|
-
normalizedData
|
|
17
|
-
} = talonProps;
|
|
18
|
-
|
|
19
|
-
const subCategory = [];
|
|
20
|
-
|
|
21
|
-
normalizedData && normalizedData.map(({ text, path }, index) => {
|
|
22
|
-
if (text == categoryName) {
|
|
23
|
-
subCategory.push(
|
|
24
|
-
<span>
|
|
25
|
-
<b>
|
|
26
|
-
<li className={classes.item}>{text}</li>
|
|
27
|
-
</b>
|
|
28
|
-
</span>
|
|
29
|
-
)
|
|
30
|
-
} else {
|
|
31
|
-
subCategory.push(
|
|
32
|
-
<Link
|
|
33
|
-
key={index}
|
|
34
|
-
to={resourceUrl(path)}
|
|
35
|
-
>
|
|
36
|
-
<li className={classes.item}>{text}</li>
|
|
37
|
-
</Link>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
return subCategory.length ? <ul className={classes.root}>{subCategory}</ul> : '';
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export default CustomSubCategory;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.root {
|
|
2
|
-
composes: flex from global;
|
|
3
|
-
composes: flex-wrap from global;
|
|
4
|
-
composes: mt-3 from global;
|
|
5
|
-
composes: gap-[15px] from global;
|
|
6
|
-
margin-bottom: 10px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.item {
|
|
10
|
-
composes: px-4 from global;
|
|
11
|
-
composes: py-2 from global;
|
|
12
|
-
composes: transition-colors from global;
|
|
13
|
-
composes: duration-150 from global;
|
|
14
|
-
composes: border from global;
|
|
15
|
-
composes: border-solid from global;
|
|
16
|
-
composes: leading-normal from global;
|
|
17
|
-
composes: text-base from global;
|
|
18
|
-
composes: text-colorDefault from global;
|
|
19
|
-
composes: bg-white from global;
|
|
20
|
-
composes: border-gray-100 from global;
|
|
21
|
-
border-radius: 5px;
|
|
22
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
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 './attributesBlock.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 useAttributesBlock = props => {
|
|
18
|
-
const { attributesBlock } = 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
|
-
nextFetchPolicy: 'cache-first'
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const categoryUrlSuffix = useMemo(() => {
|
|
29
|
-
if (storeConfigData) {
|
|
30
|
-
return storeConfigData.storeConfig.category_url_suffix;
|
|
31
|
-
}
|
|
32
|
-
}, [storeConfigData]);
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
categoryUrlSuffix,
|
|
36
|
-
getPath
|
|
37
|
-
};
|
|
38
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
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 useCustomSubCategory = props => {
|
|
18
|
-
const { customSubCategory } = 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
|
-
nextFetchPolicy: 'cache-first'
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const categoryUrlSuffix = useMemo(() => {
|
|
29
|
-
if (storeConfigData) {
|
|
30
|
-
return storeConfigData.storeConfig.category_url_suffix;
|
|
31
|
-
}
|
|
32
|
-
}, [storeConfigData]);
|
|
33
|
-
|
|
34
|
-
const normalizedData = useMemo(() => {
|
|
35
|
-
if (customSubCategory) {
|
|
36
|
-
return (
|
|
37
|
-
customSubCategory.length &&
|
|
38
|
-
customSubCategory
|
|
39
|
-
.map(category => ({
|
|
40
|
-
text: category.name,
|
|
41
|
-
path: `/${category.path}`
|
|
42
|
-
}))
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
}, [categoryUrlSuffix, customSubCategory]);
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
normalizedData: normalizedData || []
|
|
49
|
-
};
|
|
50
|
-
};
|