@riosst100/pwa-marketplace 3.0.0 → 3.0.1
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 +1 -1
- package/i18n/id_ID.json +1 -1
- package/package.json +1 -1
- package/src/componentOverrideMapping.js +1 -0
- package/src/components/CheckoutHeader/checkoutHeader.js +162 -0
- package/src/components/CheckoutHeader/checkoutHeader.module.css +171 -0
- package/src/components/CheckoutHeader/index.js +1 -0
- package/src/components/FavoriteSeller/AddToListButton/addToListButton.module.css +2 -2
- package/src/components/FilterTop/FilterBlockList/filterTopItem.module.css +2 -0
- package/src/components/SellerCoupon/index.js +1 -0
- package/src/components/SellerCoupon/sellerCoupon.js +84 -0
- package/src/components/SellerCoupon/sellerCoupon.module.css +110 -0
- package/src/components/SellerCoupon/sellerCouponCheckout.js +147 -0
- package/src/components/SellerCoupon/sellerCouponCheckout.module.css +85 -0
- package/src/components/SellerDetail/sellerDetail.js +10 -2
- package/src/components/SellerProducts/sellerProducts.js +4 -2
- package/src/overwrites/peregrine/lib/talons/CartPage/PriceSummary/usePriceSummary.js +10 -1
- package/src/overwrites/peregrine/lib/talons/CheckoutPage/checkoutPage.extended.gql.js +17 -1
- package/src/overwrites/peregrine/lib/talons/Header/useCartTrigger.js +82 -0
- package/src/overwrites/peregrine/lib/talons/ProductFullDetail/useProductFullDetail.js +17 -1
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +11 -11
- package/src/overwrites/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.js +24 -6
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListing/productListing.js +6 -2
- package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/productListingBySeller.js +3 -1
- package/src/overwrites/venia-ui/lib/components/CartPage/cartPage.js +20 -4
- package/src/overwrites/venia-ui/lib/components/CheckoutPage/OrderSummary/orderSummary.js +1 -1
- package/src/overwrites/venia-ui/lib/components/CheckoutPage/PaymentInformation/paymentInformation.js +1 -1
- package/src/overwrites/venia-ui/lib/components/CheckoutPage/PaymentInformation/paymentMethods.js +1 -1
- package/src/overwrites/venia-ui/lib/components/CheckoutPage/PriceAdjustments/priceAdjustments.js +74 -6
- package/src/overwrites/venia-ui/lib/components/CheckoutPage/ShippingInformation/shippingInformation.js +3 -3
- package/src/overwrites/venia-ui/lib/components/CheckoutPage/checkoutPage.js +53 -2
- package/src/overwrites/venia-ui/lib/components/CheckoutPage/checkoutPage.module.css +1 -1
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadio.js +1 -2
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadioGroup.js +10 -27
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/subFilterItemRadioGroup.js +1 -1
- package/src/overwrites/venia-ui/lib/components/Footer/footer.js +14 -4
- package/src/overwrites/venia-ui/lib/components/Footer/footer.module.css +16 -4
- package/src/overwrites/venia-ui/lib/components/Gallery/item.js +9 -8
- package/src/overwrites/venia-ui/lib/components/Header/accountTrigger.js +3 -3
- package/src/overwrites/venia-ui/lib/components/Header/cartTrigger.js +9 -6
- package/src/overwrites/venia-ui/lib/components/Header/cartTrigger.module.css +1 -1
- package/src/overwrites/venia-ui/lib/components/Header/header.js +2 -0
- package/src/overwrites/venia-ui/lib/components/Header/wishlistTrigger.js +4 -4
- package/src/overwrites/venia-ui/lib/components/Main/main.js +9 -4
- package/src/overwrites/venia-ui/lib/components/Main/main.module.css +2 -2
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +100 -72
- package/src/overwrites/venia-ui/lib/components/ToastContainer/toast.module.css +3 -3
- package/src/talons/Header/useCartTrigger.js +82 -0
- package/src/talons/Seller/seller.gql.js +42 -1
- package/src/talons/Seller/useSeller.js +25 -2
package/i18n/en_US.json
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"checkoutPage.additionalText": "You will also receive an email with the details and we will let you know when your order has shipped.",
|
|
64
64
|
"checkoutPage.billingAddressSame": "Billing address same as shipping address",
|
|
65
65
|
"checkoutPage.checkout": "Checkout",
|
|
66
|
-
"checkoutPage.couponCode": "
|
|
66
|
+
"checkoutPage.couponCode": "Apply Coupon Code",
|
|
67
67
|
"checkoutPage.createAccount": "Create Account",
|
|
68
68
|
"checkoutPage.editPaymentInformation": "Edit Payment Information",
|
|
69
69
|
"checkoutPage.editShippingInfo": "Edit Shipping Information",
|
package/i18n/id_ID.json
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"checkoutPage.additionalText": "You will also receive an email with the details and we will let you know when your order has shipped.",
|
|
65
65
|
"checkoutPage.billingAddressSame": "Billing address same as shipping address",
|
|
66
66
|
"checkoutPage.checkout": "Checkout",
|
|
67
|
-
"checkoutPage.couponCode": "
|
|
67
|
+
"checkoutPage.couponCode": "Apply Coupon Code",
|
|
68
68
|
"checkoutPage.createAccount": "Create Account",
|
|
69
69
|
"checkoutPage.editPaymentInformation": "Edit Payment Information",
|
|
70
70
|
"checkoutPage.editShippingInfo": "Edit Shipping Information",
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
module.exports = componentOverrideMapping = {
|
|
2
|
+
['@magento/peregrine/lib/talons/Header/useCartTrigger.js']: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/Header/useCartTrigger.js',
|
|
2
3
|
[`@magento/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.js',
|
|
3
4
|
[`@magento/peregrine/lib/talons/CartPage/PriceSummary/priceSummaryFragments.gql.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/CartPage/PriceSummary/priceSummaryFragments.gql.js',
|
|
4
5
|
[`@magento/venia-ui/lib/components/Adapter/adapter.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Adapter/adapter.js',
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React, { Fragment, Suspense } from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import { Link, Route } from 'react-router-dom';
|
|
4
|
+
import Icon from '@magento/venia-ui/lib/components/Icon';
|
|
5
|
+
|
|
6
|
+
import AccountTrigger from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Header/accountTrigger';
|
|
7
|
+
|
|
8
|
+
import CartTrigger from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Header/cartTrigger';
|
|
9
|
+
import { Lock } from 'react-feather';
|
|
10
|
+
import WishlistTrigger from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Header/wishlistTrigger';
|
|
11
|
+
import NavTrigger from '@magento/venia-ui/lib/components/Header/navTrigger';
|
|
12
|
+
import SearchTrigger from '@magento/venia-ui/lib/components/Header/searchTrigger';
|
|
13
|
+
import OnlineIndicator from '@magento/venia-ui/lib/components/Header/onlineIndicator';
|
|
14
|
+
import { useHeader } from '@magento/peregrine/lib/talons/Header/useHeader';
|
|
15
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
16
|
+
|
|
17
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
18
|
+
import defaultClasses from './checkoutHeader.module.css';
|
|
19
|
+
import StoreSwitcher from '@magento/venia-ui/lib/components/Header/storeSwitcher';
|
|
20
|
+
import WebsiteSwitcher from '@riosst100/pwa-marketplace/src/components/WebsiteSwitcher/websiteSwitcher';
|
|
21
|
+
// import CurrencySwitcher from '@magento/venia-ui/lib/components/Header/currencySwitcher';
|
|
22
|
+
import CurrencySwitcher from '@riosst100/pwa-marketplace/src/components/CurrencySwitcher';
|
|
23
|
+
import BecomeSellerLink from '@riosst100/pwa-marketplace/src/components/BecomeSellerLink/becomeSellerLink';
|
|
24
|
+
import MegaMenu from '@magento/venia-ui/lib/components/MegaMenu';
|
|
25
|
+
import PageLoadingIndicator from '@magento/venia-ui/lib/components/PageLoadingIndicator';
|
|
26
|
+
import { useIntl } from 'react-intl';
|
|
27
|
+
import cn from 'classnames';
|
|
28
|
+
// const SearchBar = React.lazy(() => import('@magento/venia-ui/lib/components/SearchBar'));
|
|
29
|
+
const SearchBar = React.lazy(() => import('@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/SearchBar'));
|
|
30
|
+
import { SearchNormal } from 'iconsax-react';
|
|
31
|
+
|
|
32
|
+
import { useLogo } from '@riosst100/pwa-marketplace/src/talons/Header/useLogo';
|
|
33
|
+
import Image from '@magento/venia-ui/lib/components/Image';
|
|
34
|
+
|
|
35
|
+
const CheckoutHeader = props => {
|
|
36
|
+
const {
|
|
37
|
+
handleSearchTriggerClick,
|
|
38
|
+
hasBeenOffline,
|
|
39
|
+
isOnline,
|
|
40
|
+
isSearchOpen,
|
|
41
|
+
searchRef,
|
|
42
|
+
searchTriggerRef
|
|
43
|
+
} = useHeader();
|
|
44
|
+
|
|
45
|
+
const talonPropsLogo = useLogo();
|
|
46
|
+
const { data } = talonPropsLogo
|
|
47
|
+
const baseUrl = data?.storeConfig?.base_media_url;
|
|
48
|
+
const imageSource = data?.storeConfig?.header_logo_src;
|
|
49
|
+
const LogoImageSource = `${baseUrl}/logo/${imageSource}`;
|
|
50
|
+
const IMAGE_HEIGHT = data?.storeConfig?.logo_width || 28;
|
|
51
|
+
const IMAGE_WIDTH = data?.storeConfig?.logo_height || 190;
|
|
52
|
+
const IMAGE_ALT = data?.storeConfig?.logo_alt || 'TCG Collective';
|
|
53
|
+
|
|
54
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
55
|
+
const rootClass = isSearchOpen ? classes.open : classes.closed;
|
|
56
|
+
|
|
57
|
+
const searchBarFallback = (
|
|
58
|
+
<div className={classes.searchFallback} ref={searchRef}>
|
|
59
|
+
<div className={classes.input}>
|
|
60
|
+
<div className={classes.loader}>
|
|
61
|
+
<div className={classes.loaderBefore} />
|
|
62
|
+
<div className={classes.loaderAfter} />
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
// const searchBar = isSearchOpen ? (
|
|
68
|
+
// <Suspense fallback={searchBarFallback}>
|
|
69
|
+
// <Route>
|
|
70
|
+
// <SearchBar isOpen={true} ref={searchRef} />
|
|
71
|
+
// </Route>
|
|
72
|
+
// </Suspense>
|
|
73
|
+
// ) : null;
|
|
74
|
+
|
|
75
|
+
const { formatMessage } = useIntl();
|
|
76
|
+
const title = formatMessage({ id: 'logo.title', defaultMessage: 'Venia' });
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Fragment>
|
|
80
|
+
<PageLoadingIndicator absolute />
|
|
81
|
+
<header className={cn(rootClass, '!flex flex-col !px-0 border-gray-100 ')} data-cy="Header-root">
|
|
82
|
+
<div className={cn('middle-header border-b border-gray-100')}>
|
|
83
|
+
<div className={cn('w-full max-w-[1000px] px-[0px] py-[15px] mx-[auto] flex justify-between items-center')}>
|
|
84
|
+
<div className='flex items-center'>
|
|
85
|
+
<NavTrigger />
|
|
86
|
+
|
|
87
|
+
<Link
|
|
88
|
+
aria-label={title}
|
|
89
|
+
to={resourceUrl('/')}
|
|
90
|
+
className={''}
|
|
91
|
+
data-cy="Header-logoContainer"
|
|
92
|
+
>
|
|
93
|
+
{imageSource ? (
|
|
94
|
+
<Image
|
|
95
|
+
alt={IMAGE_ALT}
|
|
96
|
+
height={IMAGE_HEIGHT}
|
|
97
|
+
src={LogoImageSource}
|
|
98
|
+
width={IMAGE_WIDTH}
|
|
99
|
+
classes={{
|
|
100
|
+
container: 'logo-wrapper relative'
|
|
101
|
+
}}
|
|
102
|
+
/>
|
|
103
|
+
) : (
|
|
104
|
+
<>
|
|
105
|
+
<div className='text-[14px]'><b>TCG Collective</b></div>
|
|
106
|
+
<small>Bringing Collectors Together</small>
|
|
107
|
+
</>
|
|
108
|
+
)}
|
|
109
|
+
|
|
110
|
+
</Link>
|
|
111
|
+
</div>
|
|
112
|
+
<div className='flex flex-auto max-w-[700px]'>
|
|
113
|
+
<div className='flex w-full' style={{
|
|
114
|
+
"alignItems": "center",
|
|
115
|
+
"fontSize": "14px",
|
|
116
|
+
"fontWeight": "500",
|
|
117
|
+
"justifyContent": "center"
|
|
118
|
+
}}>
|
|
119
|
+
<Icon src={Lock} attrs={{ width: 16 }} /><span style={{
|
|
120
|
+
"paddingLeft": "5px"
|
|
121
|
+
}}>Secure Checkout</span>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
<div className={cn(classes.secondaryActions, 'lg_gap-x-5 pl-5')}>
|
|
125
|
+
{/* <SearchTrigger
|
|
126
|
+
onClick={handleSearchTriggerClick}
|
|
127
|
+
ref={searchTriggerRef}
|
|
128
|
+
/> */}
|
|
129
|
+
<CartTrigger />
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</header>
|
|
134
|
+
<OnlineIndicator
|
|
135
|
+
hasBeenOffline={hasBeenOffline}
|
|
136
|
+
isOnline={isOnline}
|
|
137
|
+
/>
|
|
138
|
+
<style jsx="true">
|
|
139
|
+
{`
|
|
140
|
+
.logo-wrapper>img:first-child {
|
|
141
|
+
height: ${IMAGE_HEIGHT}px;
|
|
142
|
+
}
|
|
143
|
+
`}
|
|
144
|
+
</style>
|
|
145
|
+
</Fragment>
|
|
146
|
+
);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
CheckoutHeader.propTypes = {
|
|
150
|
+
classes: shape({
|
|
151
|
+
closed: string,
|
|
152
|
+
logo: string,
|
|
153
|
+
open: string,
|
|
154
|
+
primaryActions: string,
|
|
155
|
+
secondaryActions: string,
|
|
156
|
+
toolbar: string,
|
|
157
|
+
switchers: string,
|
|
158
|
+
switchersContainer: string
|
|
159
|
+
})
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export default CheckoutHeader;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
composes: auto-cols-fr from global;
|
|
3
|
+
composes: bg-header from global;
|
|
4
|
+
composes: border-b from global;
|
|
5
|
+
composes: border-subtle from global;
|
|
6
|
+
composes: grid from global;
|
|
7
|
+
composes: h-auto from global;
|
|
8
|
+
composes: justify-center from global;
|
|
9
|
+
composes: px-4 from global;
|
|
10
|
+
composes: top-0 from global;
|
|
11
|
+
composes: sticky from global;
|
|
12
|
+
composes: w-full from global;
|
|
13
|
+
composes: z-header from global;
|
|
14
|
+
|
|
15
|
+
composes: lg_px-8 from global;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.switchers {
|
|
19
|
+
composes: auto-cols-max from global;
|
|
20
|
+
composes: grid from global;
|
|
21
|
+
composes: grid-flow-col from global;
|
|
22
|
+
composes: justify-end from global;
|
|
23
|
+
/* composes: max-w-site from global; */
|
|
24
|
+
composes: mx-auto from global;
|
|
25
|
+
composes: relative from global;
|
|
26
|
+
composes: w-full from global;
|
|
27
|
+
composes: z-menu from global;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.switchersContainer {
|
|
31
|
+
composes: bg-gray-100 from global;
|
|
32
|
+
composes: hidden from global;
|
|
33
|
+
composes: px-8 from global;
|
|
34
|
+
composes: w-full from global;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Large screen styles */
|
|
38
|
+
.switchersContainer {
|
|
39
|
+
composes: sm_block from global;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.open {
|
|
43
|
+
composes: root;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.closed {
|
|
47
|
+
composes: root;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.toolbar {
|
|
51
|
+
composes: border-0 from global;
|
|
52
|
+
composes: content-center from global;
|
|
53
|
+
composes: gap-x-4 from global;
|
|
54
|
+
composes: grid from global;
|
|
55
|
+
composes: grid-cols-3 from global;
|
|
56
|
+
composes: grid-rows-header from global;
|
|
57
|
+
composes: h-14 from global;
|
|
58
|
+
composes: items-center from global;
|
|
59
|
+
composes: justify-self-center from global;
|
|
60
|
+
composes: max-w-site from global;
|
|
61
|
+
composes: w-full from global;
|
|
62
|
+
composes: z-header from global;
|
|
63
|
+
|
|
64
|
+
composes: lg_h-20 from global;
|
|
65
|
+
composes: lg_gap-x-8 from global;
|
|
66
|
+
composes: lg_grid-cols-12 from global;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.logo {
|
|
70
|
+
height: var(--height);
|
|
71
|
+
width: var(--width);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.primaryActions {
|
|
75
|
+
composes: col-start-1 from global;
|
|
76
|
+
composes: grid from global;
|
|
77
|
+
composes: grid-flow-col from global;
|
|
78
|
+
composes: justify-self-start from global;
|
|
79
|
+
composes: row-start-1 from global;
|
|
80
|
+
composes: self-center from global;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.logoContainer {
|
|
84
|
+
composes: col-start-2 from global;
|
|
85
|
+
composes: justify-self-center from global;
|
|
86
|
+
|
|
87
|
+
composes: lg_col-end-3 from global;
|
|
88
|
+
composes: lg_col-start-1 from global;
|
|
89
|
+
composes: lg_justify-self-start from global;
|
|
90
|
+
composes: lg_mr-8 from global;
|
|
91
|
+
composes: lg_row-start-1 from global;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.secondaryActions {
|
|
95
|
+
composes: col-start-3 from global;
|
|
96
|
+
composes: grid from global;
|
|
97
|
+
composes: grid-flow-col from global;
|
|
98
|
+
composes: items-center from global;
|
|
99
|
+
composes: justify-items-end from global;
|
|
100
|
+
composes: justify-self-end from global;
|
|
101
|
+
composes: w-max from global;
|
|
102
|
+
|
|
103
|
+
composes: lg_col-end-13 from global;
|
|
104
|
+
composes: lg_col-start-10 from global;
|
|
105
|
+
composes: lg_gap-x-4 from global;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.searchFallback {
|
|
109
|
+
composes: flex from global;
|
|
110
|
+
composes: justify-center from global;
|
|
111
|
+
composes: mb-2 from global;
|
|
112
|
+
composes: px-4 from global;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.input {
|
|
116
|
+
@apply max-w-sm;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.loader,
|
|
120
|
+
.loaderBefore,
|
|
121
|
+
.loaderAfter {
|
|
122
|
+
--dot-size: 2em;
|
|
123
|
+
--dot-font-size: 6px;
|
|
124
|
+
--dot-shadow-offset: calc(-1 * var(--dot-size) + var(--dot-font-size));
|
|
125
|
+
|
|
126
|
+
composes: rounded-full from global;
|
|
127
|
+
width: var(--dot-size);
|
|
128
|
+
height: var(--dot-size);
|
|
129
|
+
animation: pulse 1.8s infinite ease-in-out;
|
|
130
|
+
animation-fill-mode: both;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.loader {
|
|
134
|
+
composes: mb-0 from global;
|
|
135
|
+
composes: mx-auto from global;
|
|
136
|
+
composes: relative from global;
|
|
137
|
+
composes: text-subtle from global;
|
|
138
|
+
font-size: var(--dot-font-size);
|
|
139
|
+
margin-top: var(--dot-shadow-offset);
|
|
140
|
+
transform: translateZ(0);
|
|
141
|
+
animation-delay: -0.16s;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.loaderBefore,
|
|
145
|
+
.loaderAfter {
|
|
146
|
+
composes: content-empty from global;
|
|
147
|
+
composes: absolute from global;
|
|
148
|
+
composes: top-0 from global;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.loaderBefore {
|
|
152
|
+
composes: left-[-3.5em] from global;
|
|
153
|
+
composes: text-gray-100 from global;
|
|
154
|
+
animation-delay: -0.32s;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.loaderAfter {
|
|
158
|
+
composes: left-[3.5em] from global;
|
|
159
|
+
composes: text-gray-600 from global;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@keyframes pulse {
|
|
163
|
+
0%,
|
|
164
|
+
80%,
|
|
165
|
+
100% {
|
|
166
|
+
box-shadow: 0 var(--dot-size) 0 -1.3em;
|
|
167
|
+
}
|
|
168
|
+
40% {
|
|
169
|
+
box-shadow: 0 var(--dot-size) 0 0;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './checkoutHeader';
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
.root:hover svg {
|
|
28
28
|
stroke: #fff !important;
|
|
29
|
-
fill: #fff !important;
|
|
29
|
+
/* fill: #fff !important; */
|
|
30
30
|
}
|
|
31
31
|
.root:hover span {
|
|
32
32
|
color: #fff !important;
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
.root_selected:hover svg {
|
|
39
39
|
stroke: #fff !important;
|
|
40
|
-
fill: #fff !important;
|
|
40
|
+
/* fill: #fff !important; */
|
|
41
41
|
}
|
|
42
42
|
.root_selected:hover span {
|
|
43
43
|
color: #fff !important;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './sellerCoupon';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import classes from './sellerCoupon.module.css';
|
|
3
|
+
|
|
4
|
+
const dayDiff = (toDate) => {
|
|
5
|
+
if (!toDate) return null;
|
|
6
|
+
const end = new Date(toDate);
|
|
7
|
+
if (Number.isNaN(end.getTime())) return null;
|
|
8
|
+
const now = new Date();
|
|
9
|
+
const diffMs = end.setHours(23, 59, 59, 999) - now.getTime();
|
|
10
|
+
const diffDays = Math.ceil(diffMs / (1000 * 60 * 60 * 24));
|
|
11
|
+
return diffDays;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const SellerCoupon = ({ couponData, couponError, couponLoading }) => {
|
|
15
|
+
if (couponLoading) {
|
|
16
|
+
return <div className={classes.container}><p className={classes.metaText}>Loading coupons...</p></div>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (couponError) {
|
|
20
|
+
return <div className={classes.container}><p className={classes.metaText}>Failed to load coupons.</p></div>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const items = couponData?.sellerCoupons?.items || [];
|
|
24
|
+
|
|
25
|
+
if (!items.length) {
|
|
26
|
+
return <div className={classes.container}><p className={classes.metaText}>No coupons available.</p></div>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const [copied, setCopied] = useState(null);
|
|
30
|
+
|
|
31
|
+
const handleClaim = async (code) => {
|
|
32
|
+
try {
|
|
33
|
+
if (navigator?.clipboard?.writeText) {
|
|
34
|
+
await navigator.clipboard.writeText(code);
|
|
35
|
+
}
|
|
36
|
+
} catch (_) {
|
|
37
|
+
// ignore clipboard issues
|
|
38
|
+
}
|
|
39
|
+
setCopied(code);
|
|
40
|
+
setTimeout(() => setCopied(null), 2000);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<section className={classes.container} aria-label="Seller coupons">
|
|
45
|
+
<div className={classes.scroller}>
|
|
46
|
+
{items.map(item => {
|
|
47
|
+
const key = item.couponcode_id || item.coupon_id || item.code;
|
|
48
|
+
const daysLeft = dayDiff(item.to_date);
|
|
49
|
+
const expiryLabel = daysLeft === null
|
|
50
|
+
? 'No expiry'
|
|
51
|
+
: daysLeft <= 0
|
|
52
|
+
? 'Ends today'
|
|
53
|
+
: `Ends in ${daysLeft} day${daysLeft > 1 ? 's' : ''}`;
|
|
54
|
+
|
|
55
|
+
const title = item.description || item.name || `Discount ${item.discount_amount || ''}`;
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div className={classes.card} key={key} role="group" aria-label={`Coupon ${item.code}`}>
|
|
59
|
+
<div className={classes.perf} aria-hidden="true" />
|
|
60
|
+
<div className={classes.content}>
|
|
61
|
+
<div className={classes.title}>{title}</div>
|
|
62
|
+
<div className={classes.subtext}>Code: <span className={classes.code}>{item.code}</span></div>
|
|
63
|
+
<div className={classes.expiry}>{expiryLabel}</div>
|
|
64
|
+
</div>
|
|
65
|
+
<div className={classes.divider} aria-hidden="true" />
|
|
66
|
+
<div className={classes.actions}>
|
|
67
|
+
<button
|
|
68
|
+
type="button"
|
|
69
|
+
className={classes.claimBtn}
|
|
70
|
+
onClick={() => handleClaim(item.code)}
|
|
71
|
+
aria-label={`Claim coupon ${item.code}`}
|
|
72
|
+
>
|
|
73
|
+
{copied === item.code ? 'Copied' : 'Claim'}
|
|
74
|
+
</button>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
})}
|
|
79
|
+
</div>
|
|
80
|
+
</section>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default SellerCoupon;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
.container{
|
|
2
|
+
margin:16px 0;
|
|
3
|
+
padding:0 8px;
|
|
4
|
+
}
|
|
5
|
+
.heading{
|
|
6
|
+
font-size:18px;
|
|
7
|
+
font-weight:600;
|
|
8
|
+
margin:0 0 8px;
|
|
9
|
+
color:#111
|
|
10
|
+
}
|
|
11
|
+
.metaText{
|
|
12
|
+
color:#666;
|
|
13
|
+
margin:0;
|
|
14
|
+
}
|
|
15
|
+
.scroller{
|
|
16
|
+
display:flex;
|
|
17
|
+
gap:16px;
|
|
18
|
+
overflow-x:auto;
|
|
19
|
+
padding:8px 4px 12px;
|
|
20
|
+
scroll-snap-type:x mandatory;
|
|
21
|
+
}
|
|
22
|
+
.card{
|
|
23
|
+
position:relative;
|
|
24
|
+
background:#fff8f1;
|
|
25
|
+
border:1px solid #ffb891;
|
|
26
|
+
border-left:none;
|
|
27
|
+
min-width:260px;
|
|
28
|
+
max-width:320px;
|
|
29
|
+
display:flex;
|
|
30
|
+
align-items:stretch;
|
|
31
|
+
padding:0 12px 0 24px;
|
|
32
|
+
scroll-snap-align:start;
|
|
33
|
+
overflow:hidden;
|
|
34
|
+
--border-color:#ffb891;
|
|
35
|
+
}
|
|
36
|
+
.perf{
|
|
37
|
+
position:absolute;
|
|
38
|
+
inset:0 auto 0 0;
|
|
39
|
+
width:4px;
|
|
40
|
+
background:#fff;
|
|
41
|
+
/* border-top-left-radius:8px;
|
|
42
|
+
border-bottom-left-radius:8px; */
|
|
43
|
+
pointer-events:none;
|
|
44
|
+
}
|
|
45
|
+
.card::before{
|
|
46
|
+
content:"";
|
|
47
|
+
position:absolute;
|
|
48
|
+
top:0;bottom:0;left:0px;
|
|
49
|
+
z-index:9;
|
|
50
|
+
width:1px;
|
|
51
|
+
background:repeating-linear-gradient(to bottom,#ffb891 0,#ffb891 0px,transparent 6px,transparent 10px);
|
|
52
|
+
}
|
|
53
|
+
.perf:before{
|
|
54
|
+
content:"";
|
|
55
|
+
position:absolute;
|
|
56
|
+
inset:0;
|
|
57
|
+
background:
|
|
58
|
+
radial-gradient(circle at 0 .375rem, transparent 0, transparent .1875rem, var(--border-color) .1875rem, var(--border-color) .25rem, transparent .25rem) repeat-y;
|
|
59
|
+
background-size:1rem 0.66rem;
|
|
60
|
+
background-position:0 0;
|
|
61
|
+
}
|
|
62
|
+
.content{
|
|
63
|
+
flex:1 1 auto;
|
|
64
|
+
padding:10px 12px 10px 0;
|
|
65
|
+
display:flex;
|
|
66
|
+
flex-direction:column;
|
|
67
|
+
justify-content:center;
|
|
68
|
+
}
|
|
69
|
+
.title{
|
|
70
|
+
color:#f76b1c;
|
|
71
|
+
font-weight:700;
|
|
72
|
+
margin-bottom:4px;
|
|
73
|
+
}
|
|
74
|
+
.subtext{
|
|
75
|
+
color:#444;
|
|
76
|
+
font-size:13px;
|
|
77
|
+
margin-bottom:4px;
|
|
78
|
+
}
|
|
79
|
+
.code{
|
|
80
|
+
font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
|
|
81
|
+
font-weight:600;
|
|
82
|
+
}
|
|
83
|
+
.expiry{
|
|
84
|
+
color:#a94442;
|
|
85
|
+
font-size:12px;
|
|
86
|
+
}
|
|
87
|
+
.actions{
|
|
88
|
+
display:flex;
|
|
89
|
+
align-items:center;
|
|
90
|
+
justify-content:center;
|
|
91
|
+
padding:10px 0;
|
|
92
|
+
}
|
|
93
|
+
.claimBtn{
|
|
94
|
+
background: #f76b1c;
|
|
95
|
+
color:#fff;
|
|
96
|
+
border:none;
|
|
97
|
+
border-radius:6px;
|
|
98
|
+
padding:8px 18px;
|
|
99
|
+
font-weight:600;
|
|
100
|
+
cursor:pointer;
|
|
101
|
+
}
|
|
102
|
+
.claimBtn:hover{
|
|
103
|
+
background:#f26313;
|
|
104
|
+
}
|
|
105
|
+
.divider{
|
|
106
|
+
width:1px;
|
|
107
|
+
background:repeating-linear-gradient(to bottom,#ffb891 0,#ffb891 5px,transparent 5px,transparent 10px);
|
|
108
|
+
align-self:stretch;
|
|
109
|
+
margin:0 12px 0 4px;
|
|
110
|
+
}
|