@riosst100/pwa-marketplace 1.2.2 → 1.2.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/Seller/index.js +1 -0
- package/src/{modules/seller/sellerPage.js → components/Seller/seller.js} +66 -27
- package/src/components/SellerInformation/index.js +1 -0
- package/src/{modules/seller/components/storeInformation.js → components/SellerInformation/sellerInformation.js} +9 -32
- package/src/components/SellerLocation/index.js +1 -0
- package/src/components/SellerLocation/sellerLocation.js +20 -0
- package/src/{modules/seller/components/storeItem/index.js → components/SellerLocation/sellerLocationItem.js} +2 -2
- package/src/components/SellerPage/core.js +10 -0
- package/src/components/SellerPage/index.js +1 -0
- package/src/components/SellerPage/sellerPage.js +10 -0
- package/src/components/SellerProducts/index.js +1 -0
- package/src/{modules/seller/components/allProduct.js → components/SellerProducts/sellerProducts.js} +3 -3
- package/src/components/SellerReview/index.js +1 -0
- package/src/{modules/seller/components/reviews.js → components/SellerReview/sellerReview.js} +11 -11
- package/src/components/SellerReviewItem/index.js +1 -0
- package/src/components/{ReviewItem/index.js → SellerReviewItem/sellerReviewItem.js} +2 -2
- package/src/components/commons/Slider/index.js +2 -2
- package/src/intercept.js +3 -3
- package/src/talons/Seller/seller.gql.js +139 -0
- package/src/talons/Seller/useSeller.js +66 -0
- package/src/util/mapSeller.js +7 -0
- package/src/modules/seller/core.js +0 -10
- package/src/modules/seller/index.js +0 -1
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './seller';
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import { useSeller } from '@riosst100/pwa-marketplace/src/talons/Seller/useSeller';
|
|
4
|
+
import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
|
|
5
|
+
import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
|
|
6
|
+
import mapSeller from '@riosst100/pwa-marketplace/src/util/mapSeller';
|
|
2
7
|
import Slider from '@riosst100/pwa-marketplace/src/components/commons/Slider';
|
|
3
8
|
import Tabs from '@riosst100/pwa-marketplace/src/components/commons/Tabs';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import Reviews from '
|
|
9
|
+
import SellerProducts from '../SellerProducts';
|
|
10
|
+
import SellerInformation from '../SellerInformation';
|
|
11
|
+
import Reviews from '../SellerReview';
|
|
7
12
|
import {
|
|
8
13
|
Verify,
|
|
9
14
|
Sms,
|
|
@@ -14,36 +19,70 @@ import {
|
|
|
14
19
|
Star1,
|
|
15
20
|
} from 'iconsax-react';
|
|
16
21
|
|
|
17
|
-
const
|
|
22
|
+
const Seller = props => {
|
|
23
|
+
const talonProps = useSeller({
|
|
24
|
+
mapSeller
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const { error, loading, seller } = talonProps;
|
|
28
|
+
|
|
29
|
+
if (loading && !seller)
|
|
30
|
+
return '';
|
|
31
|
+
// return <SellerShimmer />;
|
|
32
|
+
if (error && !seller) return <ErrorView />;
|
|
33
|
+
if (!seller) {
|
|
34
|
+
return (
|
|
35
|
+
<h1>
|
|
36
|
+
<FormattedMessage
|
|
37
|
+
id={'seller.notFound'}
|
|
38
|
+
defaultMessage={
|
|
39
|
+
'Seller Not Found.'
|
|
40
|
+
}
|
|
41
|
+
/>
|
|
42
|
+
</h1>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Fragment>
|
|
48
|
+
<StoreTitle>{seller.name}</StoreTitle>
|
|
49
|
+
<Meta name="description" content={seller.description} />
|
|
50
|
+
<SellerDetail seller={seller} />
|
|
51
|
+
</Fragment>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const SellerDetail = ({ seller }) => {
|
|
18
56
|
const dataTabs =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
[
|
|
58
|
+
{
|
|
59
|
+
id: 'product-tab',
|
|
60
|
+
title: 'All Products',
|
|
61
|
+
content: <SellerProducts />
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 'store-information',
|
|
65
|
+
title: 'Store Information',
|
|
66
|
+
content: <SellerInformation seller={seller} />
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'reviews',
|
|
70
|
+
title: 'Reviews',
|
|
71
|
+
content: <Reviews />
|
|
72
|
+
}
|
|
73
|
+
];
|
|
74
|
+
|
|
36
75
|
return (
|
|
37
|
-
<div className='
|
|
38
|
-
<Slider rootClassname='mb-[30px]' />
|
|
76
|
+
<div className='py-8'>
|
|
77
|
+
<Slider seller={seller} rootClassname='mb-[30px]' />
|
|
39
78
|
<div className='flex items-center justify-between mb-[30px] p-[20px] rounded-[6px] border border-solid border-[#e6e9ea] shadow-[0px_0px_5px_3px_#d9d9d933]'>
|
|
40
79
|
<div className='inline-flex items-center gap-[15px] relative flex-[0_0_auto]'>
|
|
41
|
-
<img className="relative w-[100px] h-[100px] object-cover" alt="Rectangle" src=
|
|
80
|
+
<img className="relative w-[100px] h-[100px] object-cover" alt="Rectangle" src={seller ? seller.thumbnail : ''} />
|
|
42
81
|
<div className='inline-flex flex-col h-[100px] items-start justify-between relative flex-[0_0_auto]'>
|
|
43
82
|
<div className='inline-flex flex-col items-start gap-[6px] relative flex-[0_0_auto]'>
|
|
44
83
|
<div className="items-center gap-[10px] inline-flex relative flex-[0_0_auto]">
|
|
45
84
|
<div className="relative w-fit mt-[-1.00px] font-semibold text-[#1b1b1b] text-[20px] tracking-[0] leading-[24px] whitespace-nowrap">
|
|
46
|
-
|
|
85
|
+
{seller ? seller.name : ''}
|
|
47
86
|
</div>
|
|
48
87
|
<div className="inline-flex items-center gap-[5px] relative flex-[0_0_auto]">
|
|
49
88
|
<Verify variant='Bold' color='#4E31DB' size={20} />
|
|
@@ -117,4 +156,4 @@ const sellerPage = () => {
|
|
|
117
156
|
)
|
|
118
157
|
}
|
|
119
158
|
|
|
120
|
-
export default
|
|
159
|
+
export default Seller;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './sellerInformation';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import SellerLocation from '../SellerLocation';
|
|
3
3
|
import { Location, ShopAdd } from 'iconsax-react';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const SellerInformation = ({ seller }) => {
|
|
6
|
+
console.log(seller.operating_hours)
|
|
6
7
|
return (
|
|
7
8
|
<>
|
|
8
9
|
<div class="flex flex-col items-start gap-[30px] px-[10px]">
|
|
@@ -12,9 +13,10 @@ const storeInformation = () => {
|
|
|
12
13
|
<div class="relative w-fit mt-[-1.00px] [font-family:'Frederik-DemiBold',Helvetica] font-bold text-[#1b1b1b] text-[16px] tracking-[0] leading-[normal] whitespace-nowrap">Description</div>
|
|
13
14
|
<div class="inline-flex items-center justify-center gap-[10px] relative flex-[0_0_auto]">
|
|
14
15
|
<p class="relative w-[300px] mt-[-1.00px] [font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0] leading-[16px]">
|
|
15
|
-
|
|
16
|
+
{seller ? seller.description : ''}
|
|
16
17
|
<br />
|
|
17
|
-
|
|
18
|
+
<br />
|
|
19
|
+
{seller ? seller.contact_number : ''}
|
|
18
20
|
</p>
|
|
19
21
|
</div>
|
|
20
22
|
<div class="inline-flex items-center gap-[10px] relative flex-[0_0_auto]">
|
|
@@ -78,40 +80,15 @@ const storeInformation = () => {
|
|
|
78
80
|
<div class="relative w-fit mt-[-1.00px] [font-family:'Frederik-DemiBold',Helvetica] font-bold text-[#1b1b1b] text-[16px] tracking-[0] leading-[normal] whitespace-nowrap">Terms & Condition</div>
|
|
79
81
|
<div class="inline-flex items-center justify-center gap-[10px] relative flex-[0_0_auto]">
|
|
80
82
|
<div class="flex flex-col w-[500px] items-start gap-[2px]">
|
|
81
|
-
|
|
82
|
-
<span class="[font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0]">- Delivery is made on the same day the order is received<br /></span>
|
|
83
|
-
</p>
|
|
84
|
-
<p class="relative self-stretch [font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0] leading-[normal]">
|
|
85
|
-
<span class="[font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0]"><br /></span>
|
|
86
|
-
</p>
|
|
87
|
-
<p class="relative self-stretch [font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0] leading-[normal]">
|
|
88
|
-
<span class="[font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0]">- Maximum until 5 PM<br /></span>
|
|
89
|
-
</p>
|
|
90
|
-
<p class="relative self-stretch [font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0] leading-[normal]">
|
|
91
|
-
<span class="[font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0]"><br /></span>
|
|
92
|
-
</p>
|
|
93
|
-
<p class="relative self-stretch [font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0] leading-[normal]">
|
|
94
|
-
<span class="[font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0]">- Orders received after 17.00 WIB will be delivered the next day<br /></span>
|
|
95
|
-
</p>
|
|
96
|
-
<p class="relative self-stretch [font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0] leading-[normal]">
|
|
97
|
-
<span class="[font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0]"></span>
|
|
98
|
-
</p>
|
|
83
|
+
{seller ? seller.term_and_conditions : ''}
|
|
99
84
|
</div>
|
|
100
85
|
</div>
|
|
101
86
|
</div>
|
|
102
87
|
</div>
|
|
103
|
-
<
|
|
104
|
-
<div class="relative w-fit font-semibold text-[20px] tracking-[0] leading-[normal]">Our Store</div>
|
|
105
|
-
<div class="w-full grid grid-cols-3 gap-4">
|
|
106
|
-
<StoreItem />
|
|
107
|
-
<StoreItem />
|
|
108
|
-
<StoreItem />
|
|
109
|
-
<StoreItem />
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
88
|
+
<SellerLocation />
|
|
112
89
|
</div>
|
|
113
90
|
</>
|
|
114
91
|
)
|
|
115
92
|
}
|
|
116
93
|
|
|
117
|
-
export default
|
|
94
|
+
export default SellerInformation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './sellerLocation';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SellerLocationItem from './sellerLocationItem';
|
|
3
|
+
|
|
4
|
+
const SellerLocation = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<div class="w-full flex flex-col items-start gap-[25px]">
|
|
8
|
+
<div class="relative w-fit font-semibold text-[20px] tracking-[0] leading-[normal]">Our Store</div>
|
|
9
|
+
<div class="w-full grid grid-cols-3 gap-4">
|
|
10
|
+
<SellerLocationItem />
|
|
11
|
+
<SellerLocationItem />
|
|
12
|
+
<SellerLocationItem />
|
|
13
|
+
<SellerLocationItem />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default SellerLocation;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Location, Clock } from 'iconsax-react';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const SellerLocationItem = () => {
|
|
5
5
|
return (
|
|
6
6
|
<>
|
|
7
7
|
<div class="flex flex-col w-full items-start gap-[15px] p-[20px] relative rounded-[8px] border border-solid border-[#e6e9ea]">
|
|
@@ -25,4 +25,4 @@ const storeItem = () => {
|
|
|
25
25
|
)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export default
|
|
28
|
+
export default SellerLocationItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './sellerPage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './sellerProducts';
|
package/src/{modules/seller/components/allProduct.js → components/SellerProducts/sellerProducts.js}
RENAMED
|
@@ -3,9 +3,9 @@ import ProductItem from '@riosst100/pwa-marketplace/src/components/ProductItem';
|
|
|
3
3
|
import Filter from '@riosst100/pwa-marketplace/src/components/Filter';
|
|
4
4
|
import Search from '@riosst100/pwa-marketplace/src/components/Search';
|
|
5
5
|
import SortBy from '@riosst100/pwa-marketplace/src/components/SortBy';
|
|
6
|
-
import Pagination from '
|
|
6
|
+
import Pagination from '..//Pagination';
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const SellerProducts = () => {
|
|
9
9
|
return (
|
|
10
10
|
<>
|
|
11
11
|
<div className='w-full mb-[30px]'>
|
|
@@ -43,4 +43,4 @@ const allProduct = () => {
|
|
|
43
43
|
)
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export default
|
|
46
|
+
export default SellerProducts;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './sellerReview';
|
package/src/{modules/seller/components/reviews.js → components/SellerReview/sellerReview.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import Pagination from '
|
|
2
|
+
import SellerReviewItem from '../SellerReviewItem';
|
|
3
|
+
import Pagination from '../Pagination';
|
|
4
4
|
import { Star1 } from 'iconsax-react';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const SellerReview = () => {
|
|
7
7
|
return (
|
|
8
8
|
<>
|
|
9
9
|
<div className='w-full flex items-start gap-[30px] '>
|
|
@@ -124,13 +124,13 @@ const reviews = () => {
|
|
|
124
124
|
</div>
|
|
125
125
|
<div className='flex flex-col w-full'>
|
|
126
126
|
<div className='flex flex-col w-full items-start gap-[20px] relative mb-[30px]'>
|
|
127
|
-
<
|
|
128
|
-
<
|
|
129
|
-
<
|
|
130
|
-
<
|
|
131
|
-
<
|
|
132
|
-
<
|
|
133
|
-
<
|
|
127
|
+
<SellerReviewItem />
|
|
128
|
+
<SellerReviewItem />
|
|
129
|
+
<SellerReviewItem />
|
|
130
|
+
<SellerReviewItem />
|
|
131
|
+
<SellerReviewItem />
|
|
132
|
+
<SellerReviewItem />
|
|
133
|
+
<SellerReviewItem />
|
|
134
134
|
</div>
|
|
135
135
|
<div className='pagination-container w-full flex justify-center'>
|
|
136
136
|
<Pagination />
|
|
@@ -141,4 +141,4 @@ const reviews = () => {
|
|
|
141
141
|
)
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
export default
|
|
144
|
+
export default SellerReview;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './sellerReviewItem';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Star1 } from 'iconsax-react';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const SellerReviewItem = () => {
|
|
5
5
|
return (
|
|
6
6
|
<>
|
|
7
7
|
<div class="flex flex-col items-start gap-[10px] p-[25px] relative self-stretch w-full flex-[0_0_auto] bg-white rounded-[6px] border border-solid border-[#e6e9ea]">
|
|
@@ -58,4 +58,4 @@ const ReviewItem = () => {
|
|
|
58
58
|
)
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export default
|
|
61
|
+
export default SellerReviewItem;
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
|
|
4
4
|
const Slider = (props) => {
|
|
5
|
-
const { rootClassname = '' } = props
|
|
5
|
+
const { rootClassname = '', seller } = props
|
|
6
6
|
const rootClass = cx('slider-container', rootClassname)
|
|
7
7
|
return (
|
|
8
8
|
<div className={rootClass}>
|
|
9
|
-
<img src=
|
|
9
|
+
<img src={seller ? seller.image : ''} />
|
|
10
10
|
</div>
|
|
11
11
|
)
|
|
12
12
|
}
|
package/src/intercept.js
CHANGED
|
@@ -91,9 +91,9 @@ module.exports = targets => {
|
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
exact: true,
|
|
94
|
-
name: "
|
|
95
|
-
pattern: "/
|
|
96
|
-
path: require.resolve("./
|
|
94
|
+
name: "SellerPage",
|
|
95
|
+
pattern: "/seller/:urlKey",
|
|
96
|
+
path: require.resolve("./components/SellerPage/index.js"),
|
|
97
97
|
authed: false,
|
|
98
98
|
},
|
|
99
99
|
];
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_STORE_CONFIG_DATA = gql`
|
|
4
|
+
query getStoreConfigData {
|
|
5
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
6
|
+
storeConfig {
|
|
7
|
+
store_code
|
|
8
|
+
product_url_suffix
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export const GET_SELLER_DETAIL_QUERY = gql`
|
|
14
|
+
query getSellerDetailForSellerPage($urlKey: String!) {
|
|
15
|
+
sellerByUrl(seller_url: $urlKey) {
|
|
16
|
+
seller_id
|
|
17
|
+
contact_number
|
|
18
|
+
shop_title
|
|
19
|
+
company
|
|
20
|
+
term_and_conditions
|
|
21
|
+
website_url
|
|
22
|
+
ship_to
|
|
23
|
+
ship_to_country
|
|
24
|
+
operating_hours {
|
|
25
|
+
day
|
|
26
|
+
time {
|
|
27
|
+
opening_time
|
|
28
|
+
closing_time
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
description
|
|
32
|
+
address
|
|
33
|
+
country
|
|
34
|
+
image
|
|
35
|
+
thumbnail
|
|
36
|
+
city
|
|
37
|
+
region
|
|
38
|
+
group
|
|
39
|
+
group_id
|
|
40
|
+
url
|
|
41
|
+
customer_id
|
|
42
|
+
email
|
|
43
|
+
name
|
|
44
|
+
sale
|
|
45
|
+
commission_id
|
|
46
|
+
page_layout
|
|
47
|
+
status
|
|
48
|
+
position
|
|
49
|
+
twitter_id
|
|
50
|
+
facebook_id
|
|
51
|
+
gplus_id
|
|
52
|
+
youtube_id
|
|
53
|
+
vimeo_id
|
|
54
|
+
instagram_id
|
|
55
|
+
pinterest_id
|
|
56
|
+
linkedin_id
|
|
57
|
+
tw_active
|
|
58
|
+
fb_active
|
|
59
|
+
gplus_active
|
|
60
|
+
vimeo_active
|
|
61
|
+
instagram_active
|
|
62
|
+
pinterest_active
|
|
63
|
+
linkedin_active
|
|
64
|
+
banner_pic
|
|
65
|
+
shop_url
|
|
66
|
+
url_key
|
|
67
|
+
logo_pic
|
|
68
|
+
verify_status
|
|
69
|
+
product_count
|
|
70
|
+
telephone
|
|
71
|
+
creation_time
|
|
72
|
+
update_time
|
|
73
|
+
country_id
|
|
74
|
+
total_sold
|
|
75
|
+
operating_time
|
|
76
|
+
order_processing_time
|
|
77
|
+
shipping_partners
|
|
78
|
+
offers
|
|
79
|
+
benefits
|
|
80
|
+
product_shipping_info
|
|
81
|
+
prepare_time
|
|
82
|
+
response_ratio
|
|
83
|
+
response_time
|
|
84
|
+
store_id
|
|
85
|
+
seller_rates {
|
|
86
|
+
total_count
|
|
87
|
+
page_info {
|
|
88
|
+
page_size
|
|
89
|
+
current_page
|
|
90
|
+
}
|
|
91
|
+
items {
|
|
92
|
+
rating_id
|
|
93
|
+
seller_id
|
|
94
|
+
customer_id
|
|
95
|
+
rate1
|
|
96
|
+
rate2
|
|
97
|
+
rate3
|
|
98
|
+
rate4
|
|
99
|
+
rate5
|
|
100
|
+
rating
|
|
101
|
+
email
|
|
102
|
+
title
|
|
103
|
+
status
|
|
104
|
+
detail
|
|
105
|
+
nickname
|
|
106
|
+
created_at
|
|
107
|
+
verified_buyer
|
|
108
|
+
is_recommended
|
|
109
|
+
is_hidden
|
|
110
|
+
answer
|
|
111
|
+
admin_note
|
|
112
|
+
like_about
|
|
113
|
+
not_like_about
|
|
114
|
+
guest_email
|
|
115
|
+
plus_review
|
|
116
|
+
minus_review
|
|
117
|
+
report_abuse
|
|
118
|
+
country
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
products {
|
|
122
|
+
total_count
|
|
123
|
+
page_info {
|
|
124
|
+
page_size
|
|
125
|
+
current_page
|
|
126
|
+
}
|
|
127
|
+
items {
|
|
128
|
+
id
|
|
129
|
+
name
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
`;
|
|
135
|
+
|
|
136
|
+
export default {
|
|
137
|
+
getStoreConfigData: GET_STORE_CONFIG_DATA,
|
|
138
|
+
getSellerDetailQuery: GET_SELLER_DETAIL_QUERY
|
|
139
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useQuery } from '@apollo/client';
|
|
2
|
+
import { useEffect, useMemo } from 'react';
|
|
3
|
+
import { useLocation } from 'react-router-dom';
|
|
4
|
+
import { useAppContext } from '@magento/peregrine/lib/context/app';
|
|
5
|
+
|
|
6
|
+
import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
|
|
7
|
+
import DEFAULT_OPERATIONS from './seller.gql';
|
|
8
|
+
|
|
9
|
+
export const useSeller = props => {
|
|
10
|
+
const { mapSeller } = props;
|
|
11
|
+
|
|
12
|
+
const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
|
|
13
|
+
const { getStoreConfigData, getSellerDetailQuery } = operations;
|
|
14
|
+
const { pathname } = useLocation();
|
|
15
|
+
const [
|
|
16
|
+
,
|
|
17
|
+
{
|
|
18
|
+
actions: { setPageLoading }
|
|
19
|
+
}
|
|
20
|
+
] = useAppContext();
|
|
21
|
+
|
|
22
|
+
const { data: storeConfigData } = useQuery(getStoreConfigData, {
|
|
23
|
+
fetchPolicy: 'cache-and-network',
|
|
24
|
+
nextFetchPolicy: 'cache-first'
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const slug = pathname.split('/').pop();
|
|
28
|
+
const productUrlSuffix = storeConfigData?.storeConfig?.product_url_suffix;
|
|
29
|
+
const urlKey = productUrlSuffix ? slug.replace(productUrlSuffix, '') : slug;
|
|
30
|
+
|
|
31
|
+
const { error, loading, data } = useQuery(getSellerDetailQuery, {
|
|
32
|
+
fetchPolicy: 'cache-and-network',
|
|
33
|
+
nextFetchPolicy: 'cache-first',
|
|
34
|
+
skip: !storeConfigData,
|
|
35
|
+
variables: {
|
|
36
|
+
urlKey
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const isBackgroundLoading = !!data && loading;
|
|
41
|
+
|
|
42
|
+
const seller = useMemo(() => {
|
|
43
|
+
if (!data) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const seller = data.sellerByUrl;
|
|
48
|
+
|
|
49
|
+
if (!seller) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return mapSeller(seller);
|
|
54
|
+
}, [data, mapSeller, urlKey]);
|
|
55
|
+
|
|
56
|
+
// Update the page indicator if the GraphQL query is in flight.
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
setPageLoading(isBackgroundLoading);
|
|
59
|
+
}, [isBackgroundLoading, setPageLoading]);
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
error,
|
|
63
|
+
loading,
|
|
64
|
+
seller
|
|
65
|
+
};
|
|
66
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@riosst100/pwa-marketplace/src/modules/seller/core';
|