@riosst100/pwa-marketplace 2.8.5 → 2.8.6
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/i18n/en_US.json +3 -9
- package/i18n/id_ID.json +3 -9
- package/package.json +1 -1
- package/src/componentOverrideMapping.js +1 -0
- package/src/components/AccountLayout/index.js +21 -20
- package/src/components/FavoriteSeller/AddToListButton/addToListButton.js +20 -3
- package/src/components/FavoriteSeller/AddToListButton/addToListButton.module.css +24 -2
- package/src/components/FavoriteSeller/favoriteSeller.js +10 -1
- package/src/components/FavoriteSeller/favoriteSeller.module.css +4 -0
- package/src/components/FavoriteSeller/item.js +1 -1
- package/src/components/FavoriteSellerPage/favoriteSeller.js +64 -24
- package/src/components/FavoriteSellerPage/favoriteSeller.module.css +4 -0
- package/src/components/FavoriteSellerPage/item.js +22 -16
- package/src/components/RFQPage/quoteList.js +1 -1
- package/src/components/RMAPage/RMAList.js +1 -1
- package/src/components/SellerDetail/sellerDetail.js +10 -6
- package/src/overwrites/peregrine/lib/talons/AccountMenu/useAccountMenuItems.js +28 -12
- package/src/overwrites/peregrine/lib/talons/SignIn/useSignIn.js +15 -10
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +1 -1
- package/src/overwrites/venia-ui/lib/components/Header/accountTrigger.js +8 -2
- package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderHistoryPage.js +1 -1
- package/src/overwrites/venia-ui/lib/components/SignIn/signIn.js +7 -5
- package/src/overwrites/venia-ui/lib/components/ToastContainer/toastContainer.module.css +1 -1
- package/src/talons/FavoriteSeller/AddToListButton/useAddToFavoriteListButton.js +31 -14
- package/src/talons/FavoriteSeller/FavoriteSellerList/useFavoriteSellerList.js +28 -2
- package/src/talons/SellerProducts/useSellerProducts.js +1 -1
package/i18n/en_US.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"accountMenu.accountInfoLink": "Account Information",
|
|
10
10
|
"accountMenu.addressBookLink": "Address Book",
|
|
11
11
|
"accountMenu.communicationsLink": "Communications",
|
|
12
|
-
"accountMenu.favoritesListsLink": "
|
|
13
|
-
"accountMenu.orderHistoryLink": "
|
|
12
|
+
"accountMenu.favoritesListsLink": "Wishlist",
|
|
13
|
+
"accountMenu.orderHistoryLink": "My Orders",
|
|
14
14
|
"accountMenu.savedPaymentsLink": "Saved Payments",
|
|
15
15
|
"accountMenu.signOutButtonText": "Sign Out",
|
|
16
16
|
"accountMenu.storeCreditLink": "Store Credit & Gift Cards",
|
|
@@ -310,7 +310,7 @@
|
|
|
310
310
|
"orderHistoryPage.invalidOrderNumber": "Order \"{number}\" was not found.",
|
|
311
311
|
"orderHistoryPage.loadMore": "Load More",
|
|
312
312
|
"orderHistoryPage.pageInfo": "Showing {current} of {total}",
|
|
313
|
-
"orderHistoryPage.pageTitleText": "
|
|
313
|
+
"orderHistoryPage.pageTitleText": "My Orders",
|
|
314
314
|
"orderHistoryPage.ordersCount": "You have {count} orders in your history",
|
|
315
315
|
"orderHistoryPage.search": "Search by Order Number",
|
|
316
316
|
"orderItems.itemsHeading": "Items",
|
|
@@ -368,12 +368,6 @@
|
|
|
368
368
|
"productFullDetail.outOfStockProduct": "This item is currently out of stock",
|
|
369
369
|
"productFullDetail.addToCartSuccess": "Product successfully added to cart!",
|
|
370
370
|
"productFullDetail.addToCartError": "Failed to add product to cart.",
|
|
371
|
-
"favoriteSeller.toastRemoveSuccess": "Successfully removed favorite seller.",
|
|
372
|
-
"favoriteSeller.toastRemoveError": "Failed to remove favorite seller.",
|
|
373
|
-
"favoriteSeller.removing": "Removing...",
|
|
374
|
-
"favoriteSeller.toastUnfollowSuccess": "Successfully unfollowed seller.",
|
|
375
|
-
"favoriteSeller.toastUnfollowError": "Failed to unfollow seller.",
|
|
376
|
-
"favoriteSeller.unfollowing": "Unfollowing...",
|
|
377
371
|
"productImageCarousel.previousButtonAriaLabel": "Previous Image",
|
|
378
372
|
"productImageCarousel.nextButtonAriaLabel": "Next Image",
|
|
379
373
|
"productList.each": " ea.",
|
package/i18n/id_ID.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"accountMenu.accountInfoLink": "Account Information",
|
|
10
10
|
"accountMenu.addressBookLink": "Address Book",
|
|
11
11
|
"accountMenu.communicationsLink": "Communications",
|
|
12
|
-
"accountMenu.favoritesListsLink": "
|
|
13
|
-
"accountMenu.orderHistoryLink": "
|
|
12
|
+
"accountMenu.favoritesListsLink": "Wishlist",
|
|
13
|
+
"accountMenu.orderHistoryLink": "My Orders",
|
|
14
14
|
"accountMenu.savedPaymentsLink": "Saved Payments",
|
|
15
15
|
"accountMenu.signOutButtonText": "Sign Out",
|
|
16
16
|
"accountMenu.storeCreditLink": "Store Credit & Gift Cards",
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
"orderHistoryPage.invalidOrderNumber": "Order \"{number}\" was not found.",
|
|
312
312
|
"orderHistoryPage.loadMore": "Load More",
|
|
313
313
|
"orderHistoryPage.pageInfo": "Showing {current} of {total}",
|
|
314
|
-
"orderHistoryPage.pageTitleText": "
|
|
314
|
+
"orderHistoryPage.pageTitleText": "My Orders",
|
|
315
315
|
"orderHistoryPage.ordersCount": "You have {count} orders in your history",
|
|
316
316
|
"orderHistoryPage.search": "Search by Order Number",
|
|
317
317
|
"orderItems.itemsHeading": "Items",
|
|
@@ -369,12 +369,6 @@
|
|
|
369
369
|
"productFullDetail.outOfStockProduct": "This item is currently out of stock",
|
|
370
370
|
"productFullDetail.addToCartSuccess": "Produk berhasil ditambahkan ke keranjang!",
|
|
371
371
|
"productFullDetail.addToCartError": "Gagal menambahkan produk ke keranjang.",
|
|
372
|
-
"favoriteSeller.toastRemoveSuccess": "Berhasil menghapus penjual favorit.",
|
|
373
|
-
"favoriteSeller.toastRemoveError": "Gagal menghapus penjual favorit.",
|
|
374
|
-
"favoriteSeller.removing": "Menghapus...",
|
|
375
|
-
"favoriteSeller.toastUnfollowSuccess": "Berhasil berhenti mengikuti penjual.",
|
|
376
|
-
"favoriteSeller.toastUnfollowError": "Gagal berhenti mengikuti penjual.",
|
|
377
|
-
"favoriteSeller.unfollowing": "Sedang berhenti mengikuti...",
|
|
378
372
|
"productImageCarousel.previousButtonAriaLabel": "Previous Image",
|
|
379
373
|
"productImageCarousel.nextButtonAriaLabel": "Next Image",
|
|
380
374
|
"productList.each": " ea.",
|
package/package.json
CHANGED
|
@@ -63,6 +63,7 @@ module.exports = componentOverrideMapping = {
|
|
|
63
63
|
[`@magento/pagebuilder/lib/ContentTypes/Slider/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/pagebuilder/lib/ContentTypes/Slider/index.js',
|
|
64
64
|
[`@magento/venia-ui/lib/components/App/app.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/App/app.js',
|
|
65
65
|
[`@magento/venia-ui/lib/components/SignIn/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/SignIn/index.js',
|
|
66
|
+
[`@magento/venia-ui/lib/components/SignIn/signIn.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/SignIn/signIn.js',
|
|
66
67
|
[`@magento/venia-ui/lib/components/SignInPage/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/SignInPage/index.js',
|
|
67
68
|
[`@magento/venia-ui/lib/components/Password/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Password/index.js',
|
|
68
69
|
[`@magento/venia-ui/lib/components/Password/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Password/index.js',
|
|
@@ -60,6 +60,21 @@ const AccountLayout = (props) => {
|
|
|
60
60
|
'flex flex-col border border-gray-100 rounded-lg px-2.5 py-5 gap-y-2'
|
|
61
61
|
)}
|
|
62
62
|
>
|
|
63
|
+
<li className="list-none">
|
|
64
|
+
<Link
|
|
65
|
+
to="/account-information"
|
|
66
|
+
className={cn(
|
|
67
|
+
"text-[14px] font-medium p-2.5 block w-full hover_bg-gray-150 rounded-md",
|
|
68
|
+
activeMenu === '/account-information' ? 'bg-gray-150' : ''
|
|
69
|
+
)}
|
|
70
|
+
>
|
|
71
|
+
<FormattedMessage
|
|
72
|
+
id={'myaccount.accountInformation'}
|
|
73
|
+
defaultMessage={'Account Information'}
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
</Link>
|
|
77
|
+
</li>
|
|
63
78
|
<li className="list-none">
|
|
64
79
|
<Link
|
|
65
80
|
to="/order-history"
|
|
@@ -70,7 +85,7 @@ const AccountLayout = (props) => {
|
|
|
70
85
|
>
|
|
71
86
|
<FormattedMessage
|
|
72
87
|
id={'myaccount.orderHistory'}
|
|
73
|
-
defaultMessage={'
|
|
88
|
+
defaultMessage={'My Orders'}
|
|
74
89
|
/>
|
|
75
90
|
|
|
76
91
|
</Link>
|
|
@@ -85,7 +100,7 @@ const AccountLayout = (props) => {
|
|
|
85
100
|
>
|
|
86
101
|
<FormattedMessage
|
|
87
102
|
id={'myaccount.Quotes'}
|
|
88
|
-
defaultMessage={'
|
|
103
|
+
defaultMessage={'My Offers'}
|
|
89
104
|
/>
|
|
90
105
|
|
|
91
106
|
</Link>
|
|
@@ -130,7 +145,7 @@ const AccountLayout = (props) => {
|
|
|
130
145
|
>
|
|
131
146
|
<FormattedMessage
|
|
132
147
|
id={'myaccount.favoriteSeller'}
|
|
133
|
-
defaultMessage={'
|
|
148
|
+
defaultMessage={'Followed Stores'}
|
|
134
149
|
/>
|
|
135
150
|
|
|
136
151
|
</Link>
|
|
@@ -150,7 +165,7 @@ const AccountLayout = (props) => {
|
|
|
150
165
|
|
|
151
166
|
</Link>
|
|
152
167
|
</li>
|
|
153
|
-
<li className="list-none">
|
|
168
|
+
{/* <li className="list-none">
|
|
154
169
|
<Link
|
|
155
170
|
to="/saved-payments"
|
|
156
171
|
className={cn(
|
|
@@ -164,7 +179,7 @@ const AccountLayout = (props) => {
|
|
|
164
179
|
/>
|
|
165
180
|
|
|
166
181
|
</Link>
|
|
167
|
-
</li>
|
|
182
|
+
</li> */}
|
|
168
183
|
<li className="list-none">
|
|
169
184
|
<Link
|
|
170
185
|
to="/communications"
|
|
@@ -180,21 +195,7 @@ const AccountLayout = (props) => {
|
|
|
180
195
|
|
|
181
196
|
</Link>
|
|
182
197
|
</li>
|
|
183
|
-
|
|
184
|
-
<Link
|
|
185
|
-
to="/account-information"
|
|
186
|
-
className={cn(
|
|
187
|
-
"text-[14px] font-medium p-2.5 block w-full hover_bg-gray-150 rounded-md",
|
|
188
|
-
activeMenu === '/account-information' ? 'bg-gray-150' : ''
|
|
189
|
-
)}
|
|
190
|
-
>
|
|
191
|
-
<FormattedMessage
|
|
192
|
-
id={'myaccount.accountInformation'}
|
|
193
|
-
defaultMessage={'Account Information'}
|
|
194
|
-
/>
|
|
195
|
-
|
|
196
|
-
</Link>
|
|
197
|
-
</li>
|
|
198
|
+
|
|
198
199
|
|
|
199
200
|
</div>
|
|
200
201
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import { element, func, shape, string, bool } from 'prop-types';
|
|
3
|
-
import { Heart } from 'react-feather';
|
|
3
|
+
import { Heart,Check } from 'react-feather';
|
|
4
|
+
|
|
4
5
|
import { useAddToFavoriteListButton } from '@riosst100/pwa-marketplace/src/talons/FavoriteSeller/AddToListButton/useAddToFavoriteListButton';
|
|
5
6
|
import { useButton } from 'react-aria';
|
|
6
7
|
|
|
@@ -9,7 +10,16 @@ import Icon from '@magento/venia-ui/lib/components/Icon';
|
|
|
9
10
|
import defaultClasses from './addToListButton.module.css';
|
|
10
11
|
import { useCommonToasts } from '@magento/venia-ui/lib/components/Wishlist/AddToListButton/useCommonToasts';
|
|
11
12
|
|
|
13
|
+
const Spinner = () => (
|
|
14
|
+
<svg className="animate-spin mr-0" width="16" height="16" viewBox="0 0 50 50">
|
|
15
|
+
<circle className="path" cx="25" cy="25" r="20" fill="none" stroke="#f76b1c" strokeWidth="5" strokeLinecap="round" strokeDasharray="31.415, 31.415" transform="rotate(0 25 25)">
|
|
16
|
+
<animateTransform attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="1s" repeatCount="indefinite" />
|
|
17
|
+
</circle>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
|
|
12
21
|
const HeartIcon = <Heart color='#f76b1c' size={14} variant="Outline" className='stroke-[#f76b1c]' />;
|
|
22
|
+
const CheckIcon = <Check color='#f76b1c' size={14} variant="Outline" className='stroke-[#f76b1c]' />;
|
|
13
23
|
|
|
14
24
|
|
|
15
25
|
const AddToFavoriteListButton = props => {
|
|
@@ -27,8 +37,9 @@ const AddToFavoriteListButton = props => {
|
|
|
27
37
|
} = talonProps;
|
|
28
38
|
|
|
29
39
|
useCommonToasts({ errorToastProps, loginToastProps, successToastProps });
|
|
40
|
+
|
|
30
41
|
const { buttonProps: ariaButtonProps } = useButton(buttonProps, buttonRef);
|
|
31
|
-
|
|
42
|
+
|
|
32
43
|
const classes = useStyle(defaultClasses, props.classes);
|
|
33
44
|
const buttonClass = isSelected ? classes.root_selected : classes.root;
|
|
34
45
|
|
|
@@ -37,9 +48,15 @@ const AddToFavoriteListButton = props => {
|
|
|
37
48
|
? 'text-[#f76b1c] text-[14px] font-medium whitespace-nowrap'
|
|
38
49
|
: `text-[#f76b1c] text-[14px] font-medium whitespace-nowrap ${props.hideTextOnMobile ? 'md_block xs_hidden' : ''}`;
|
|
39
50
|
|
|
51
|
+
const icon = isSelected ? CheckIcon : HeartIcon;
|
|
52
|
+
|
|
40
53
|
return (
|
|
41
54
|
<button ref={buttonRef} className={buttonClass} {...ariaButtonProps} disabled={isLoading}>
|
|
42
|
-
{
|
|
55
|
+
{isLoading ? (
|
|
56
|
+
<Spinner />
|
|
57
|
+
) : (
|
|
58
|
+
icon
|
|
59
|
+
)}
|
|
43
60
|
{buttonText && <span className={textClass}>{buttonText}</span>}
|
|
44
61
|
</button>
|
|
45
62
|
);
|
|
@@ -13,10 +13,32 @@
|
|
|
13
13
|
padding: 8px 14px;
|
|
14
14
|
font-weight: 500;
|
|
15
15
|
font-size: 14px;
|
|
16
|
-
|
|
16
|
+
cursor: pointer;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
18
|
.root_selected {
|
|
20
19
|
composes: root;
|
|
21
20
|
composes: no-underline from global;
|
|
22
21
|
}
|
|
22
|
+
|
|
23
|
+
.root:hover {
|
|
24
|
+
background: #f76b1c !important;
|
|
25
|
+
color: #fff !important;
|
|
26
|
+
}
|
|
27
|
+
.root:hover svg {
|
|
28
|
+
stroke: #fff !important;
|
|
29
|
+
fill: #fff !important;
|
|
30
|
+
}
|
|
31
|
+
.root:hover span {
|
|
32
|
+
color: #fff !important;
|
|
33
|
+
}
|
|
34
|
+
.root_selected:hover {
|
|
35
|
+
background: #f76b1c !important;
|
|
36
|
+
color: #fff !important;
|
|
37
|
+
}
|
|
38
|
+
.root_selected:hover svg {
|
|
39
|
+
stroke: #fff !important;
|
|
40
|
+
fill: #fff !important;
|
|
41
|
+
}
|
|
42
|
+
.root_selected:hover span {
|
|
43
|
+
color: #fff !important;
|
|
44
|
+
}
|
|
@@ -2,15 +2,23 @@ import React from 'react';
|
|
|
2
2
|
import { StoreTitle } from '@magento/venia-ui/lib/components/Head';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
4
|
import Item from './item';
|
|
5
|
+
import defaultClasses from './favoriteSeller.module.css';
|
|
6
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
|
+
import Pagination from '../../components/Pagination';
|
|
5
8
|
|
|
6
9
|
const favoriteSeller = () => {
|
|
10
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
7
11
|
|
|
8
12
|
const { formatMessage } = useIntl();
|
|
9
13
|
const PAGE_TITLE = formatMessage({
|
|
10
14
|
id: 'favoriteSellerPage.pageTitleText',
|
|
11
|
-
defaultMessage: '
|
|
15
|
+
defaultMessage: 'Followed Stores'
|
|
12
16
|
});
|
|
13
17
|
|
|
18
|
+
const pagination = totalPagesFromData ? (
|
|
19
|
+
<Pagination pageControl={pageControl} />
|
|
20
|
+
) : null;
|
|
21
|
+
|
|
14
22
|
return (
|
|
15
23
|
<div className='relative'>
|
|
16
24
|
<StoreTitle>{PAGE_TITLE}</StoreTitle>
|
|
@@ -25,6 +33,7 @@ const favoriteSeller = () => {
|
|
|
25
33
|
))
|
|
26
34
|
}
|
|
27
35
|
</div>
|
|
36
|
+
<div className={classes.pagination}>{pagination}</div>
|
|
28
37
|
</div>
|
|
29
38
|
)
|
|
30
39
|
}
|
|
@@ -1,40 +1,80 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { StoreTitle } from '@magento/venia-ui/lib/components/Head';
|
|
3
2
|
import { useIntl } from 'react-intl';
|
|
4
3
|
import Item from './item';
|
|
5
4
|
import useFavoriteSellerList from '@riosst100/pwa-marketplace/src/talons/FavoriteSeller/FavoriteSellerList/useFavoriteSellerList';
|
|
5
|
+
// import defaultClasses from './favoriteSeller.module.css';
|
|
6
|
+
import defaultClasses from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/RootComponents/Category/category.module.css';
|
|
7
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
8
|
+
import Pagination from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Pagination';
|
|
9
|
+
// import Pagination from 'riosst100/pwa-marketplace/src/components/CustomPagination';
|
|
10
|
+
import React, { Fragment, Suspense, useMemo, useRef } from 'react';
|
|
6
11
|
|
|
7
|
-
const FavoriteSeller = () => {
|
|
12
|
+
const FavoriteSeller = (props) => {
|
|
8
13
|
const { formatMessage } = useIntl();
|
|
9
14
|
const PAGE_TITLE = formatMessage({
|
|
10
15
|
id: 'favoriteSellerPage.pageTitleText',
|
|
11
|
-
defaultMessage: '
|
|
16
|
+
defaultMessage: 'Followed Stores'
|
|
12
17
|
});
|
|
13
|
-
|
|
18
|
+
|
|
19
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
20
|
+
|
|
14
21
|
// Fetch favorite seller list
|
|
15
|
-
const { data, loading, error, refetch } = useFavoriteSellerList();
|
|
22
|
+
const { data, loading, error, refetch, totalPagesFromData, pageControl } = useFavoriteSellerList();
|
|
23
|
+
|
|
24
|
+
const pagination = totalPagesFromData ? (
|
|
25
|
+
<Pagination pageControl={pageControl} />
|
|
26
|
+
) : null;
|
|
27
|
+
|
|
28
|
+
const content = useMemo(() => {
|
|
29
|
+
const pagination = totalPagesFromData ? (
|
|
30
|
+
<Pagination pageControl={pageControl} />
|
|
31
|
+
) : null;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Fragment>
|
|
35
|
+
<section className={classes.gallery}>
|
|
36
|
+
{loading ? (
|
|
37
|
+
<div>Loading...</div>
|
|
38
|
+
) : (
|
|
39
|
+
<>
|
|
40
|
+
<div className='flex flex-col gap-5'>
|
|
41
|
+
{error && <div>Error loading favorite sellers.</div>}
|
|
42
|
+
{data && data.items && data.items.length > 0 ? (
|
|
43
|
+
data.items.map(sellerItem => (
|
|
44
|
+
<Item key={sellerItem.id} sellerItem={sellerItem} refetchFavoriteSellerList={refetch} />
|
|
45
|
+
))
|
|
46
|
+
) : !error ? (
|
|
47
|
+
<div>No favorite sellers found.</div>
|
|
48
|
+
) : null}
|
|
49
|
+
{data?.items?.length > 0 && <div className={classes.pagination}>{pagination}</div>}
|
|
50
|
+
</div>
|
|
51
|
+
</>
|
|
52
|
+
)}
|
|
53
|
+
</section>
|
|
54
|
+
</Fragment>
|
|
55
|
+
);
|
|
56
|
+
}, [
|
|
57
|
+
classes.gallery,
|
|
58
|
+
classes.pagination,
|
|
59
|
+
pageControl,
|
|
60
|
+
loading,
|
|
61
|
+
data,
|
|
62
|
+
error,
|
|
63
|
+
totalPagesFromData
|
|
64
|
+
]);
|
|
16
65
|
|
|
17
66
|
return (
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{loading ? (
|
|
24
|
-
<div>Loading...</div>
|
|
25
|
-
) : (
|
|
26
|
-
<div className='flex flex-col gap-5'>
|
|
27
|
-
{error && <div>Error loading favorite sellers.</div>}
|
|
28
|
-
{data && data.items && data.items.length > 0 ? (
|
|
29
|
-
data.items.map(sellerItem => (
|
|
30
|
-
<Item key={sellerItem.id} sellerItem={sellerItem} refetchFavoriteSellerList={refetch} />
|
|
31
|
-
))
|
|
32
|
-
) : !error ? (
|
|
33
|
-
<div>No favorite sellers found.</div>
|
|
34
|
-
) : null}
|
|
67
|
+
<Fragment>
|
|
68
|
+
<div className='relative'>
|
|
69
|
+
<StoreTitle>{PAGE_TITLE}</StoreTitle>
|
|
70
|
+
<div aria-live="polite" className="text-xl font-medium text-left mb-[20px]">
|
|
71
|
+
{PAGE_TITLE}
|
|
35
72
|
</div>
|
|
36
|
-
|
|
37
|
-
|
|
73
|
+
<p>This list shows all the stores you're currently following. Sellers may send you newsletters or updates — you can unfollow a seller anytime to stop following and unsubscribe from their newsletters.</p>
|
|
74
|
+
<br />
|
|
75
|
+
{content}
|
|
76
|
+
</div>
|
|
77
|
+
</Fragment>
|
|
38
78
|
);
|
|
39
79
|
};
|
|
40
80
|
|
|
@@ -15,6 +15,7 @@ import { FormattedMessage, useIntl } from 'react-intl';
|
|
|
15
15
|
import useRemoveFavoriteSeller from '@riosst100/pwa-marketplace/src/talons/FavoriteSeller/FavoriteSellerList/useRemoveFavoriteSeller';
|
|
16
16
|
import { useState } from 'react';
|
|
17
17
|
import { useToasts } from '@magento/peregrine';
|
|
18
|
+
import { Link } from "react-router-dom";
|
|
18
19
|
|
|
19
20
|
const Item = ({ sellerItem, refetchFavoriteSellerList }) => {
|
|
20
21
|
const [open, setOpen] = useState(false);
|
|
@@ -22,6 +23,8 @@ const Item = ({ sellerItem, refetchFavoriteSellerList }) => {
|
|
|
22
23
|
const [, { addToast }] = useToasts();
|
|
23
24
|
const { formatMessage } = useIntl();
|
|
24
25
|
|
|
26
|
+
console.log(sellerItem.seller)
|
|
27
|
+
|
|
25
28
|
const handleRemoveFromFavorite = async () => {
|
|
26
29
|
try {
|
|
27
30
|
await remove([sellerItem.seller.seller_id]);
|
|
@@ -29,7 +32,7 @@ const Item = ({ sellerItem, refetchFavoriteSellerList }) => {
|
|
|
29
32
|
type: 'success',
|
|
30
33
|
message: formatMessage({
|
|
31
34
|
id: 'favoriteSeller.toastUnfollowSuccess',
|
|
32
|
-
defaultMessage: '
|
|
35
|
+
defaultMessage: "You've unfollowed this store. You won't receive any more updates or newsletters from them."
|
|
33
36
|
}),
|
|
34
37
|
timeout: 3000
|
|
35
38
|
});
|
|
@@ -41,11 +44,10 @@ const Item = ({ sellerItem, refetchFavoriteSellerList }) => {
|
|
|
41
44
|
type: 'error',
|
|
42
45
|
message: formatMessage({
|
|
43
46
|
id: 'favoriteSeller.toastUnfollowError',
|
|
44
|
-
defaultMessage: 'Failed to unfollow
|
|
47
|
+
defaultMessage: 'Failed to unfollow this store. Please try again later.'
|
|
45
48
|
}),
|
|
46
49
|
timeout: 3000
|
|
47
50
|
});
|
|
48
|
-
console.error('Failed to unfollow seller:', e);
|
|
49
51
|
}
|
|
50
52
|
};
|
|
51
53
|
|
|
@@ -85,19 +87,23 @@ const Item = ({ sellerItem, refetchFavoriteSellerList }) => {
|
|
|
85
87
|
</div>
|
|
86
88
|
</div>
|
|
87
89
|
<div className='flex gap-4'>
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
<Link to={"/seller/"+sellerItem?.seller?.url}>
|
|
91
|
+
<Button
|
|
92
|
+
classes={{
|
|
93
|
+
content: 'gap-1.5 grid-flow-col inline-grid items-center justify-center justify-items-center capitalize font-medium text-[14px]',
|
|
94
|
+
rootClass: 'btn-orange-outline py-[0px] h-9 border-orange-500 text-[#f76b1c]'
|
|
95
|
+
}}
|
|
96
|
+
// onClick={handleGoToSellerPage}
|
|
97
|
+
variant="outlined"
|
|
98
|
+
>
|
|
99
|
+
|
|
100
|
+
<FormattedMessage
|
|
101
|
+
id={'favoriteSeller.visitStore'}
|
|
102
|
+
defaultMessage={'View Store'}
|
|
103
|
+
/>
|
|
104
|
+
|
|
105
|
+
</Button>
|
|
106
|
+
</Link>
|
|
101
107
|
<Button
|
|
102
108
|
classes={{
|
|
103
109
|
content: 'gap-1.5 grid-flow-col inline-grid items-center justify-center justify-items-center capitalize font-medium text-[14px]',
|
|
@@ -52,7 +52,7 @@ const QuoteList = props => {
|
|
|
52
52
|
const { formatMessage } = useIntl();
|
|
53
53
|
const PAGE_TITLE = formatMessage({
|
|
54
54
|
id: 'Quotes.pageTitleText',
|
|
55
|
-
defaultMessage: '
|
|
55
|
+
defaultMessage: 'My Offers'
|
|
56
56
|
});
|
|
57
57
|
const SEARCH_PLACE_HOLDER = formatMessage({
|
|
58
58
|
id: 'Quotes.search',
|
|
@@ -50,7 +50,7 @@ const RMAList = props => {
|
|
|
50
50
|
const { formatMessage } = useIntl();
|
|
51
51
|
const PAGE_TITLE = formatMessage({
|
|
52
52
|
id: 'RMA.pageTitleText',
|
|
53
|
-
defaultMessage: '
|
|
53
|
+
defaultMessage: 'My Return Request'
|
|
54
54
|
});
|
|
55
55
|
const SEARCH_PLACE_HOLDER = formatMessage({
|
|
56
56
|
id: 'RMA.search',
|
|
@@ -18,6 +18,9 @@ import {
|
|
|
18
18
|
Star1,
|
|
19
19
|
Shop,
|
|
20
20
|
} from 'iconsax-react';
|
|
21
|
+
|
|
22
|
+
import { Share2 } from 'react-feather';
|
|
23
|
+
|
|
21
24
|
import Image from '@magento/venia-ui/lib/components/Image';
|
|
22
25
|
import Button from '@magento/venia-ui/lib/components/Button';
|
|
23
26
|
import cn from 'classnames';
|
|
@@ -123,9 +126,13 @@ const SellerDetail = props => {
|
|
|
123
126
|
.share-btn:hover { background: #f76b1c !important; }
|
|
124
127
|
.share-btn:hover .stroke { stroke: #ffffff !important; }
|
|
125
128
|
.share-btn:hover span { color: #ffffff !important; }
|
|
129
|
+
.favorite-btn:focus-visible { outline: none !important; }
|
|
126
130
|
.favorite-btn:hover { background: #f76b1c !important; color: #ffffff !important; }
|
|
127
131
|
.favorite-btn:hover span { color: #ffffff !important; }
|
|
128
132
|
.favorite-btn:hover svg { stroke: #ffffff !important; fill: #ffffff !important; }
|
|
133
|
+
.favorite-btn.root_selected:hover { background: #f76b1c !important; color: #ffffff !important; }
|
|
134
|
+
.favorite-btn.root_selected:hover span { color: #ffffff !important; }
|
|
135
|
+
.favorite-btn.root_selected:hover svg { stroke: #ffffff !important; fill: #ffffff !important; }
|
|
129
136
|
`}</style>
|
|
130
137
|
<Slider seller={seller} rootClassname='mb-[30px]' />
|
|
131
138
|
<div className='flex xs_flex-col lg_flex-row justify-between mb-[30px] p-[20px] rounded-[6px] border border-solid border-gray-100 shadow-[0px_0px_5px_3px_#d9d9d933]'>
|
|
@@ -167,7 +174,7 @@ const SellerDetail = props => {
|
|
|
167
174
|
|
|
168
175
|
{/* Right: action buttons */}
|
|
169
176
|
<div className='flex xs_flex-wrap items-center xs_justify-center lg_justify-end gap-[10px] xs_mt-4 lg_mt-0 xs_pt-2 lg_pt-0 relative'>
|
|
170
|
-
|
|
177
|
+
<button className='send-message-btn flex items-center justify-center gap-[8px] px-[14px] py-[8px] bg-white rounded-[30px] border border-solid border-[#f76b1c] min-w-[44px]'>
|
|
171
178
|
<Sms color="#f76b1c" size={16} variant='Outline' className='stroke' />
|
|
172
179
|
<span className='text-[#f76b1c] text-[14px] font-medium whitespace-nowrap md_block xs_hidden'>Send Message</span>
|
|
173
180
|
</button>
|
|
@@ -177,15 +184,12 @@ const SellerDetail = props => {
|
|
|
177
184
|
root: 'favorite-btn flex items-center justify-center gap-[8px] px-[14px] py-[8px] bg-white rounded-[30px] border border-solid border-[#f76b1c] min-w-[44px]'
|
|
178
185
|
}}
|
|
179
186
|
{...favoriteSellerButtonProps}
|
|
180
|
-
buttonText={'Follow
|
|
187
|
+
buttonText={'Follow Store'}
|
|
181
188
|
hideTextOnMobile={true}
|
|
182
|
-
afterAdd={isSelected => {
|
|
183
|
-
if (!isSelected) history.push('/favorite-seller');
|
|
184
|
-
}}
|
|
185
189
|
/>
|
|
186
190
|
</Suspense>
|
|
187
191
|
<button className='share-btn flex items-center justify-center gap-[8px] px-[14px] py-[8px] bg-white rounded-[30px] border border-solid border-[#f76b1c] min-w-[44px]'>
|
|
188
|
-
<
|
|
192
|
+
<Share2 color='#f76b1c' size={16} variant='Outline' className='stroke' />
|
|
189
193
|
<span className='text-[#f76b1c] text-[14px] font-medium whitespace-nowrap md_block xs_hidden'>Share</span>
|
|
190
194
|
</button>
|
|
191
195
|
</div>
|
|
@@ -19,10 +19,20 @@ export const useAccountMenuItems = props => {
|
|
|
19
19
|
|
|
20
20
|
let MENU_ITEMS = [
|
|
21
21
|
{
|
|
22
|
-
name: '
|
|
22
|
+
name: 'Account Information',
|
|
23
|
+
id: 'accountMenu.accountInfoLink',
|
|
24
|
+
url: '/account-information'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'My Orders',
|
|
23
28
|
id: 'accountMenu.orderHistoryLink',
|
|
24
29
|
url: '/order-history'
|
|
25
30
|
},
|
|
31
|
+
{
|
|
32
|
+
name: 'My Offers',
|
|
33
|
+
id: 'accountMenu.offersLink',
|
|
34
|
+
url: '/quotes'
|
|
35
|
+
},
|
|
26
36
|
// Hide links until features are completed
|
|
27
37
|
// {
|
|
28
38
|
// name: 'Store Credit & Gift Cards',
|
|
@@ -34,26 +44,32 @@ export const useAccountMenuItems = props => {
|
|
|
34
44
|
id: 'accountMenu.favoritesListsLink',
|
|
35
45
|
url: '/wishlist'
|
|
36
46
|
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Return Request',
|
|
49
|
+
id: 'accountMenu.returnRequestLink',
|
|
50
|
+
url: '/return'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Followed Stores',
|
|
54
|
+
id: 'accountMenu.followedStoresLink',
|
|
55
|
+
url: '/favorite-seller'
|
|
56
|
+
},
|
|
37
57
|
{
|
|
38
58
|
name: 'Address Book',
|
|
39
59
|
id: 'accountMenu.addressBookLink',
|
|
40
60
|
url: '/address-book'
|
|
41
61
|
},
|
|
62
|
+
// {
|
|
63
|
+
// name: 'Saved Payments',
|
|
64
|
+
// id: 'accountMenu.savedPaymentsLink',
|
|
65
|
+
// url: '/saved-payments'
|
|
66
|
+
// },
|
|
42
67
|
{
|
|
43
|
-
name: '
|
|
44
|
-
id: 'accountMenu.savedPaymentsLink',
|
|
45
|
-
url: '/saved-payments'
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'Communications',
|
|
68
|
+
name: 'Newsletter',
|
|
49
69
|
id: 'accountMenu.communicationsLinak',
|
|
50
70
|
url: '/communications'
|
|
51
71
|
},
|
|
52
|
-
|
|
53
|
-
name: 'Account Information',
|
|
54
|
-
id: 'accountMenu.accountInfoLink',
|
|
55
|
-
url: '/account-information'
|
|
56
|
-
}
|
|
72
|
+
|
|
57
73
|
];
|
|
58
74
|
|
|
59
75
|
// if (storage && storage.getItem('is_seller')) {
|
|
@@ -50,14 +50,17 @@ export const useSignIn = props => {
|
|
|
50
50
|
fetchPolicy: 'no-cache'
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
const {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} = useGoogleReCaptcha({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
53
|
+
// const {
|
|
54
|
+
// generateReCaptchaData,
|
|
55
|
+
// recaptchaLoading,
|
|
56
|
+
// recaptchaWidgetProps
|
|
57
|
+
// } = useGoogleReCaptcha({
|
|
58
|
+
// currentForm: 'CUSTOMER_LOGIN',
|
|
59
|
+
// formAction: 'signIn'
|
|
60
|
+
// });
|
|
61
|
+
|
|
62
|
+
const recaptchaWidgetProps = null;
|
|
63
|
+
const generateReCaptchaData = null;
|
|
61
64
|
|
|
62
65
|
const [fetchCartId] = useMutation(createCartMutation);
|
|
63
66
|
const [mergeCarts] = useMutation(mergeCartsMutation);
|
|
@@ -76,7 +79,8 @@ export const useSignIn = props => {
|
|
|
76
79
|
const sourceCartId = cartId;
|
|
77
80
|
|
|
78
81
|
// Get recaptchaV3 data for login
|
|
79
|
-
const recaptchaData = await generateReCaptchaData();
|
|
82
|
+
// const recaptchaData = await generateReCaptchaData();
|
|
83
|
+
const recaptchaData = null;
|
|
80
84
|
|
|
81
85
|
// Sign in and set the token.
|
|
82
86
|
const signInResponse = await signIn({
|
|
@@ -219,7 +223,8 @@ export const useSignIn = props => {
|
|
|
219
223
|
handleForgotPassword,
|
|
220
224
|
forgotPasswordHandleEnterKeyPress,
|
|
221
225
|
handleSubmit,
|
|
222
|
-
isBusy: isGettingDetails || isSigningIn || recaptchaLoading,
|
|
226
|
+
// isBusy: isGettingDetails || isSigningIn || recaptchaLoading,
|
|
227
|
+
isBusy: isGettingDetails || isSigningIn,
|
|
223
228
|
setFormApi,
|
|
224
229
|
recaptchaWidgetProps
|
|
225
230
|
};
|
|
@@ -13,7 +13,7 @@ import FilterModalOpenButton, {
|
|
|
13
13
|
import { FilterSidebarShimmer } from '@magento/venia-ui/lib/components/FilterSidebar';
|
|
14
14
|
import Gallery, { GalleryShimmer } from '@magento/venia-ui/lib/components/Gallery';
|
|
15
15
|
import { StoreTitle } from '@magento/venia-ui/lib/components/Head';
|
|
16
|
-
import Pagination from '
|
|
16
|
+
import Pagination from '@magento/venia-ui/lib/components/Pagination';
|
|
17
17
|
import ProductSort, { ProductSortShimmer } from '../../components/ProductSort';
|
|
18
18
|
import RichContent from '@magento/venia-ui/lib/components/RichContent';
|
|
19
19
|
import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
|
|
@@ -45,6 +45,7 @@ const AccountTrigger = props => {
|
|
|
45
45
|
id: 'accountTrigger.ariaLabelSignIn',
|
|
46
46
|
defaultMessage: 'Sign In'
|
|
47
47
|
});
|
|
48
|
+
|
|
48
49
|
const ariaLabel = isUserSignedIn ? ariaLabelMyMenu : ariaLabelSignIn;
|
|
49
50
|
return (
|
|
50
51
|
<Fragment>
|
|
@@ -67,12 +68,17 @@ const AccountTrigger = props => {
|
|
|
67
68
|
shouldIndicateLoading={true}
|
|
68
69
|
/> */}
|
|
69
70
|
<User size="20" color={darkBlue} className={cn('stroke-0')} variant="Outline" />
|
|
70
|
-
<span className='text-base font-medium'>
|
|
71
|
+
{isUserSignedIn ? <span className='text-base font-medium'>
|
|
72
|
+
{formatMessage({
|
|
73
|
+
id: 'accountTrigger.myAccount',
|
|
74
|
+
defaultMessage: 'My Account'
|
|
75
|
+
})}
|
|
76
|
+
</span> : <span className='text-base font-medium'>
|
|
71
77
|
{formatMessage({
|
|
72
78
|
id: 'accountTrigger.buttonFallback',
|
|
73
79
|
defaultMessage: 'Sign In'
|
|
74
80
|
})}
|
|
75
|
-
</span>
|
|
81
|
+
</span>}
|
|
76
82
|
</button>
|
|
77
83
|
</div>
|
|
78
84
|
<Suspense fallback={null}>
|
|
@@ -52,7 +52,7 @@ const OrderHistoryPage = props => {
|
|
|
52
52
|
const { formatMessage } = useIntl();
|
|
53
53
|
const PAGE_TITLE = formatMessage({
|
|
54
54
|
id: 'orderHistoryPage.pageTitleText',
|
|
55
|
-
defaultMessage: '
|
|
55
|
+
defaultMessage: 'My Orders'
|
|
56
56
|
});
|
|
57
57
|
const SEARCH_PLACE_HOLDER = formatMessage({
|
|
58
58
|
id: 'orderHistoryPage.search',
|
|
@@ -148,10 +148,13 @@ const SignIn = props => {
|
|
|
148
148
|
content: 'capitalize font-medium text-[16px]'
|
|
149
149
|
}}
|
|
150
150
|
>
|
|
151
|
-
<FormattedMessage
|
|
151
|
+
{isBusy ? <FormattedMessage
|
|
152
|
+
id={'signIn.waitingConfig'}
|
|
153
|
+
defaultMessage={'Please wait...'}
|
|
154
|
+
/> : <FormattedMessage
|
|
152
155
|
id={'signIn.signInText'}
|
|
153
156
|
defaultMessage={'Sign In'}
|
|
154
|
-
/>
|
|
157
|
+
/>}
|
|
155
158
|
</Button>
|
|
156
159
|
<div className='block text-center'>
|
|
157
160
|
<span className='text-xs font-normal'>
|
|
@@ -171,7 +174,7 @@ const SignIn = props => {
|
|
|
171
174
|
/>
|
|
172
175
|
</Link>
|
|
173
176
|
</div>
|
|
174
|
-
{showSocialLogin ? (
|
|
177
|
+
{/* {showSocialLogin ? (
|
|
175
178
|
<>
|
|
176
179
|
<div className='max-w-[390px] w-full mx-auto'>
|
|
177
180
|
<label
|
|
@@ -192,8 +195,7 @@ const SignIn = props => {
|
|
|
192
195
|
</div>
|
|
193
196
|
<SocialLogin />
|
|
194
197
|
</>
|
|
195
|
-
) : null}
|
|
196
|
-
|
|
198
|
+
) : null} */}
|
|
197
199
|
</div>
|
|
198
200
|
</Form>
|
|
199
201
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { useCallback, useMemo, useState, useRef } from 'react';
|
|
2
|
+
import { useCallback, useMemo, useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
4
|
import { useMutation, useQuery } from '@apollo/client';
|
|
5
5
|
import { useUserContext } from '@magento/peregrine/lib/context/user';
|
|
@@ -45,6 +45,7 @@ export const useAddToFavoriteListButton = props => {
|
|
|
45
45
|
|
|
46
46
|
const [showLoginToast, setShowLoginToast] = useState(0);
|
|
47
47
|
const [showUnfollowToast, setShowUnfollowToast] = useState(0);
|
|
48
|
+
const [showFollowToast, setShowFollowToast] = useState(false);
|
|
48
49
|
|
|
49
50
|
const { formatMessage } = useIntl();
|
|
50
51
|
const [{ isSignedIn }] = useUserContext();
|
|
@@ -95,9 +96,9 @@ export const useAddToFavoriteListButton = props => {
|
|
|
95
96
|
message: formatMessage({
|
|
96
97
|
id: 'favoriteSeller.galleryButton.loginMessage',
|
|
97
98
|
defaultMessage:
|
|
98
|
-
'Please sign
|
|
99
|
+
'Please sign in to your account to follow this store.'
|
|
99
100
|
}),
|
|
100
|
-
timeout:
|
|
101
|
+
timeout: 3000
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
|
|
@@ -105,15 +106,15 @@ export const useAddToFavoriteListButton = props => {
|
|
|
105
106
|
}, [formatMessage, showLoginToast]);
|
|
106
107
|
|
|
107
108
|
const successToastProps = useMemo(() => {
|
|
108
|
-
if (
|
|
109
|
+
if (showFollowToast) {
|
|
109
110
|
return {
|
|
110
111
|
type: 'success',
|
|
111
112
|
message: formatMessage({
|
|
112
113
|
id: 'favoriteSeller.galleryButton.successMessageGeneral',
|
|
113
114
|
defaultMessage:
|
|
114
|
-
'
|
|
115
|
+
"You're now following this store."
|
|
115
116
|
}),
|
|
116
|
-
timeout:
|
|
117
|
+
timeout: 3000
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
120
|
if (showUnfollowToast) {
|
|
@@ -121,13 +122,29 @@ export const useAddToFavoriteListButton = props => {
|
|
|
121
122
|
type: 'success',
|
|
122
123
|
message: formatMessage({
|
|
123
124
|
id: 'favoriteSeller.galleryButton.unfollowSuccessMessage',
|
|
124
|
-
defaultMessage: '
|
|
125
|
+
defaultMessage: "You've unfollowed this store."
|
|
125
126
|
}),
|
|
126
|
-
timeout:
|
|
127
|
+
timeout: 3000
|
|
127
128
|
};
|
|
128
129
|
}
|
|
129
130
|
return null;
|
|
130
|
-
}, [
|
|
131
|
+
}, [formatMessage, showFollowToast, showUnfollowToast]);
|
|
132
|
+
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
let timeout;
|
|
135
|
+
if (addSellerData && isSelected) {
|
|
136
|
+
setShowFollowToast(true);
|
|
137
|
+
timeout = setTimeout(() => {
|
|
138
|
+
setShowFollowToast(false);
|
|
139
|
+
}, 3100);
|
|
140
|
+
}
|
|
141
|
+
if (showUnfollowToast) {
|
|
142
|
+
timeout = setTimeout(() => {
|
|
143
|
+
setShowUnfollowToast(0);
|
|
144
|
+
}, 3100);
|
|
145
|
+
}
|
|
146
|
+
return () => clearTimeout(timeout);
|
|
147
|
+
}, [addSellerData, showUnfollowToast, isSelected]);
|
|
131
148
|
|
|
132
149
|
const errorToastProps = useMemo(() => {
|
|
133
150
|
if (errorAddingProduct) {
|
|
@@ -136,9 +153,9 @@ export const useAddToFavoriteListButton = props => {
|
|
|
136
153
|
message: formatMessage({
|
|
137
154
|
id: 'favoriteSeller.galleryButton.addError',
|
|
138
155
|
defaultMessage:
|
|
139
|
-
'Something went wrong
|
|
156
|
+
'Something went wrong. Please try again.'
|
|
140
157
|
}),
|
|
141
|
-
timeout:
|
|
158
|
+
timeout: 3000
|
|
142
159
|
};
|
|
143
160
|
}
|
|
144
161
|
|
|
@@ -150,11 +167,11 @@ export const useAddToFavoriteListButton = props => {
|
|
|
150
167
|
'aria-label': isSelected
|
|
151
168
|
? formatMessage({
|
|
152
169
|
id: 'favoriteSellerButton.unfollowText',
|
|
153
|
-
defaultMessage: '
|
|
170
|
+
defaultMessage: 'Following'
|
|
154
171
|
})
|
|
155
172
|
: formatMessage({
|
|
156
173
|
id: 'favoriteSellerButton.addText',
|
|
157
|
-
defaultMessage: 'Follow
|
|
174
|
+
defaultMessage: 'Follow Store'
|
|
158
175
|
}),
|
|
159
176
|
isDisabled: isAddingToList || isRemoving,
|
|
160
177
|
onPress: handleClick,
|
|
@@ -168,7 +185,7 @@ export const useAddToFavoriteListButton = props => {
|
|
|
168
185
|
buttonText:
|
|
169
186
|
typeof props.buttonText === 'function'
|
|
170
187
|
? props.buttonText(isSelected)
|
|
171
|
-
: (isSelected ? '
|
|
188
|
+
: (isSelected ? 'Following' : 'Follow Store'),
|
|
172
189
|
errorToastProps,
|
|
173
190
|
handleClick,
|
|
174
191
|
isSelected,
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { useQuery } from '@apollo/client';
|
|
2
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
2
3
|
import gqls from './favoriteSellerList.gql';
|
|
4
|
+
import { usePagination } from '@magento/peregrine/lib/hooks/usePagination';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Custom hook untuk mengambil daftar seller yang di-follow user
|
|
6
8
|
* @param {Object} options - Opsi query Apollo (filter, pageSize, currentPage)
|
|
7
9
|
*/
|
|
8
10
|
const useFavoriteSellerList = (options = {}) => {
|
|
9
|
-
const { filter = {}, pageSize =
|
|
11
|
+
const { filter = {}, pageSize = 4 } = options;
|
|
12
|
+
|
|
13
|
+
const [paginationValues, paginationApi] = usePagination();
|
|
14
|
+
const { currentPage = 1, totalPages } = paginationValues;
|
|
15
|
+
const { setCurrentPage, setTotalPages } = paginationApi;
|
|
16
|
+
|
|
10
17
|
const { data, loading, error, refetch } = useQuery(
|
|
11
18
|
gqls.getFavoriteSellerListQuery,
|
|
12
19
|
{
|
|
@@ -19,11 +26,30 @@ const useFavoriteSellerList = (options = {}) => {
|
|
|
19
26
|
}
|
|
20
27
|
);
|
|
21
28
|
|
|
29
|
+
const totalPagesFromData = data
|
|
30
|
+
? data.favoritelist?.page_info?.total_pages
|
|
31
|
+
: null;
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
setTotalPages(totalPagesFromData);
|
|
35
|
+
return () => {
|
|
36
|
+
setTotalPages(null);
|
|
37
|
+
};
|
|
38
|
+
}, [setTotalPages, totalPagesFromData]);
|
|
39
|
+
|
|
40
|
+
const pageControl = {
|
|
41
|
+
currentPage,
|
|
42
|
+
setPage: setCurrentPage,
|
|
43
|
+
totalPages
|
|
44
|
+
};
|
|
45
|
+
|
|
22
46
|
return {
|
|
23
47
|
data: data?.favoritelist,
|
|
24
48
|
loading,
|
|
25
49
|
error,
|
|
26
|
-
refetch
|
|
50
|
+
refetch,
|
|
51
|
+
totalPagesFromData,
|
|
52
|
+
pageControl
|
|
27
53
|
};
|
|
28
54
|
};
|
|
29
55
|
|