@weareconceptstudio/account 0.5.2 → 0.5.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/dist/components/AccountCounter/index.d.ts +3 -1
- package/dist/components/AccountCounter/index.js +6 -4
- package/dist/components/TotalCheckout/BalanceComp/index.d.ts +1 -3
- package/dist/components/TotalCheckout/BalanceComp/index.js +9 -13
- package/dist/components/TotalCheckout/CommentComp/index.d.ts +3 -1
- package/dist/components/TotalCheckout/CommentComp/index.js +4 -4
- package/dist/components/TotalCheckout/FreeShippingComp/index.js +4 -2
- package/dist/components/TotalCheckout/PromoCodeComp/index.d.ts +1 -3
- package/dist/components/TotalCheckout/PromoCodeComp/index.js +7 -12
- package/dist/components/TotalCheckout/index.js +29 -57
- package/dist/components/TotalCheckout/style.js +29 -11
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/ProgressBalance/index.js +5 -9
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/index.js +1 -6
- package/dist/modules/account/AccountBalanceTemplate/HistoryBalance/index.js +1 -1
- package/dist/modules/account/AccountBalanceTemplate/index.js +3 -3
- package/dist/modules/auth/ForgotPasswordTemplate/index.js +1 -3
- package/dist/modules/cart/CartItems/Item/index.js +38 -0
- package/dist/modules/cart/CartItems/ItemMobile/index.js +38 -0
- package/dist/modules/cart/{SimpleItems → CartItems}/index.js +6 -8
- package/dist/modules/cart/{SimpleItems → CartItems}/style.js +36 -68
- package/dist/modules/cart/CartTemplate/Skeleton/SkeletonItem/index.js +1 -2
- package/dist/modules/cart/CartTemplate/Skeleton/index.js +3 -6
- package/dist/modules/cart/CartTemplate/Skeleton/style.js +11 -10
- package/dist/modules/cart/CartTemplate/index.js +3 -3
- package/dist/modules/cart/index.d.ts +1 -1
- package/dist/modules/cart/index.js +1 -1
- package/dist/modules/checkout/CheckoutProvider.js +14 -1
- package/dist/modules/checkout/CheckoutTemplate/StepReview/index.js +2 -2
- package/dist/modules/order/OrderDetails/index.js +15 -6
- package/dist/modules/order/OrderedItems/Item/index.d.ts +3 -0
- package/dist/modules/order/OrderedItems/Item/index.js +37 -0
- package/dist/modules/order/OrderedItems/ItemMobile/index.d.ts +3 -0
- package/dist/modules/order/OrderedItems/ItemMobile/index.js +39 -0
- package/dist/modules/order/OrderedItems/index.d.ts +1 -2
- package/dist/modules/order/OrderedItems/index.js +7 -57
- package/dist/modules/order/OrderedItems/style.js +67 -8
- package/dist/modules/order/OrderedItems/util.d.ts +2 -0
- package/dist/modules/order/OrderedItems/util.js +3 -0
- package/dist/modules/order/OrdersList/{OrderItem → Item}/index.js +4 -2
- package/dist/modules/order/OrdersList/ItemMobile/index.d.ts +3 -0
- package/dist/modules/order/OrdersList/ItemMobile/index.js +39 -0
- package/dist/modules/order/OrdersList/index.js +10 -41
- package/dist/modules/payment/AddNewCard/style.js +1 -0
- package/dist/styles/theme.js +10 -10
- package/dist/styles/variables.js +2 -0
- package/dist/translations/en.d.ts +6 -8
- package/dist/translations/en.js +7 -9
- package/dist/translations/hy.d.ts +6 -8
- package/dist/translations/hy.js +11 -13
- package/dist/translations/index.d.ts +18 -24
- package/dist/translations/ru.d.ts +6 -8
- package/dist/translations/ru.js +7 -9
- package/package.json +1 -1
- package/dist/modules/cart/SimpleItems/Item/index.js +0 -35
- package/dist/modules/cart/SimpleItems/ItemMobile/index.js +0 -38
- /package/dist/modules/cart/{SimpleItems → CartItems}/Item/index.d.ts +0 -0
- /package/dist/modules/cart/{SimpleItems → CartItems}/ItemMobile/index.d.ts +0 -0
- /package/dist/modules/cart/{SimpleItems → CartItems}/index.d.ts +0 -0
- /package/dist/modules/cart/{SimpleItems → CartItems}/style.d.ts +0 -0
- /package/dist/modules/cart/{SimpleItems → CartItems}/util.d.ts +0 -0
- /package/dist/modules/cart/{SimpleItems → CartItems}/util.js +0 -0
- /package/dist/modules/order/OrdersList/{OrderItem → Item}/index.d.ts +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export default AccountCounter;
|
|
2
|
-
declare function AccountCounter({ productId, qty }: {
|
|
2
|
+
declare function AccountCounter({ productId, qty, isGift, maxQty }: {
|
|
3
3
|
productId: any;
|
|
4
4
|
qty?: number;
|
|
5
|
+
isGift: any;
|
|
6
|
+
maxQty: any;
|
|
5
7
|
}): React.JSX.Element;
|
|
6
8
|
import React from 'react';
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React, { useState, useCallback, useEffect } from 'react';
|
|
2
2
|
import { Text, debounce } from '@weareconceptstudio/core';
|
|
3
3
|
import { useAccountContext } from '../../AccountProvider';
|
|
4
|
+
import { useCheckoutContext } from '../../modules';
|
|
4
5
|
//* Style
|
|
5
6
|
import AccountCounterStyle from './style';
|
|
6
|
-
const AccountCounter = ({ productId, qty = 1 }) => {
|
|
7
|
+
const AccountCounter = ({ productId, qty = 1, isGift, maxQty }) => {
|
|
7
8
|
const { useCart } = useAccountContext();
|
|
8
9
|
const { toggleCartItem, items } = useCart();
|
|
10
|
+
const { setCheckGift } = useCheckoutContext();
|
|
9
11
|
//! State
|
|
10
12
|
const [count, setCount] = useState(qty);
|
|
11
13
|
useEffect(() => {
|
|
12
|
-
setCount(items.find((item) => item.product.id == productId)?.qty || qty);
|
|
14
|
+
setCount(items.find((item) => item.product.id == productId && !item.is_gift)?.qty || qty);
|
|
13
15
|
}, [items]);
|
|
14
16
|
const updateCartServer = useCallback((quantity) => {
|
|
15
17
|
toggleCartItem({
|
|
@@ -22,7 +24,7 @@ const AccountCounter = ({ productId, qty = 1 }) => {
|
|
|
22
24
|
e.stopPropagation();
|
|
23
25
|
const newCount = type == 'inc' ? count + 1 : count - 1;
|
|
24
26
|
setCount(newCount);
|
|
25
|
-
debouncedUpdateCartServer(newCount);
|
|
27
|
+
isGift ? (newCount == 0 ? setCheckGift() : null) : debouncedUpdateCartServer(newCount);
|
|
26
28
|
};
|
|
27
29
|
return (React.createElement(AccountCounterStyle, { onClick: (e) => e.stopPropagation(), className: `counter-block ${count == 0 ? 'opacity-zero pointer-none' : ''}` },
|
|
28
30
|
React.createElement("div", { className: 'counter' },
|
|
@@ -30,7 +32,7 @@ const AccountCounter = ({ productId, qty = 1 }) => {
|
|
|
30
32
|
React.createElement("svg", { fill: 'none', viewBox: '0 0 13 3', className: `minus`, xmlns: 'http://www.w3.org/2000/svg' },
|
|
31
33
|
React.createElement("path", { d: 'M0 1.5H12', strokeWidth: '2' }))),
|
|
32
34
|
React.createElement(Text, { className: `p p5 font-montserrat-arm-medium count` }, `${count}`),
|
|
33
|
-
React.createElement("div", { onClick: (e) => handleAddToCart(e, 'inc'), className: `c-icon-block ${count == 99 ? 'disable' : ''}` },
|
|
35
|
+
React.createElement("div", { onClick: (e) => handleAddToCart(e, 'inc'), className: `c-icon-block ${count >= maxQty || count == 99 ? 'disable' : ''}` },
|
|
34
36
|
React.createElement("svg", { fill: 'none', className: `plus`, viewBox: '0 0 12 12', xmlns: 'http://www.w3.org/2000/svg' },
|
|
35
37
|
React.createElement("path", { d: 'M0 6H12', strokeWidth: '2' }),
|
|
36
38
|
React.createElement("path", { d: 'M6 12L6 0', strokeWidth: '2' }))))));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Text, CollapseItem, handlePriceCheckFunc, useTranslation } from '@weareconceptstudio/core';
|
|
3
3
|
import { FormBuilder } from '@weareconceptstudio/form';
|
|
4
4
|
import { useAccountContext } from '../../../AccountProvider';
|
|
@@ -7,35 +7,31 @@ import AccountButton from '../../AccountButton';
|
|
|
7
7
|
import { balanceFields } from './utils';
|
|
8
8
|
//* Style
|
|
9
9
|
import BalanceCompStyle from './style';
|
|
10
|
-
const BalanceComp = (
|
|
10
|
+
const BalanceComp = () => {
|
|
11
11
|
const { translate } = useTranslation();
|
|
12
12
|
const { useCart, useUser } = useAccountContext();
|
|
13
13
|
const { currency, itemsCount, useBalance } = useCart();
|
|
14
14
|
const { fillCart } = useCheckoutContext();
|
|
15
15
|
const { user } = useUser();
|
|
16
|
-
const balance = user?.balance || 0;
|
|
17
|
-
const [disable, setDisable] = useState(false);
|
|
18
16
|
const handleBalance = (amount) => {
|
|
19
17
|
fillCart('useBalance', amount);
|
|
20
18
|
};
|
|
21
19
|
const onFinish = (values) => {
|
|
22
|
-
|
|
20
|
+
if (!user || !user?.balance)
|
|
21
|
+
return;
|
|
23
22
|
handleBalance(values.balance);
|
|
24
23
|
};
|
|
25
|
-
return
|
|
26
|
-
React.createElement(CollapseItem, {
|
|
24
|
+
return (React.createElement(BalanceCompStyle, { className: `collapse-distance ${itemsCount && user.balance ? '' : 'disable'}` },
|
|
25
|
+
React.createElement(CollapseItem, { title: React.createElement(React.Fragment, null,
|
|
27
26
|
React.createElement("div", { className: 'inner-wrapper-icon' },
|
|
28
27
|
React.createElement("svg", { width: '12', height: '12', fill: 'none', viewBox: '0 0 12 12', xmlns: 'http://www.w3.org/2000/svg' },
|
|
29
28
|
React.createElement("path", { d: 'M0 6H12', stroke: 'black', strokeWidth: '2' }),
|
|
30
29
|
React.createElement("path", { d: 'M6 12L6 0', stroke: 'black', strokeWidth: '2' }))),
|
|
31
|
-
React.createElement(Text, { className: 'account-p account-p4 account-primary-color1 account-font-medium balance-text' }, `${translate('account.balance_promotions.useYourMoney')} (${handlePriceCheckFunc(balance, currency)} ${translate('account.balance_promotions.balance')})`)), description: React.createElement(React.Fragment, null, useBalance ? (React.createElement("div", { className: `balance-success-block` },
|
|
30
|
+
React.createElement(Text, { className: 'account-p account-p4 account-primary-color1 account-font-medium balance-text' }, `${translate('account.balance_promotions.useYourMoney')} (${handlePriceCheckFunc(user.balance, currency)} ${translate('account.balance_promotions.balance')})`)), description: React.createElement(React.Fragment, null, useBalance ? (React.createElement("div", { className: `balance-success-block` },
|
|
32
31
|
React.createElement(Text, { className: 'account-p account-p4 account-primary-color2 account-font-medium balance-success-text' }, handlePriceCheckFunc(useBalance, currency)),
|
|
33
|
-
React.createElement(Text, { text: 'account.general_actions.remove', className: 'account-p account-p4 account-primary-color2 account-font-medium balance-remove-text', onClick: () => {
|
|
34
|
-
handleBalance(null);
|
|
35
|
-
setDisable(false);
|
|
36
|
-
} }))) : (React.createElement(FormBuilder, { onSubmit: onFinish, fields: balanceFields, className: `balance-block`, formOptions: {
|
|
32
|
+
React.createElement(Text, { text: 'account.general_actions.remove', className: 'account-p account-p4 account-primary-color2 account-font-medium balance-remove-text', onClick: () => handleBalance(null) }))) : (React.createElement(FormBuilder, { onSubmit: onFinish, fields: balanceFields, className: `balance-block`, formOptions: {
|
|
37
33
|
className: 'balance-container',
|
|
38
34
|
} },
|
|
39
|
-
React.createElement(AccountButton, {
|
|
35
|
+
React.createElement(AccountButton, { type: 'submit', disabled: !user.balance, btnType: `balance-version`, text: `account.general_actions.add` })))) })));
|
|
40
36
|
};
|
|
41
37
|
export default BalanceComp;
|
|
@@ -3,15 +3,15 @@ import { CollapseContainer, CollapseItem, Text } from '@weareconceptstudio/core'
|
|
|
3
3
|
import { Input } from '@weareconceptstudio/form';
|
|
4
4
|
import { useCheckoutContext } from '../../../modules';
|
|
5
5
|
import CommentCompStyle from './style';
|
|
6
|
-
const CommentComp = () => {
|
|
7
|
-
const { fillCheckoutData } = useCheckoutContext();
|
|
8
|
-
return (React.createElement(CommentCompStyle, { className: 'collapse-distance' },
|
|
6
|
+
const CommentComp = ({ isShipping }) => {
|
|
7
|
+
const { fillCheckoutData, isCheckoutPage } = useCheckoutContext();
|
|
8
|
+
return isCheckoutPage && typeof isShipping === 'boolean' && !isShipping ? (React.createElement(CommentCompStyle, { className: 'collapse-distance' },
|
|
9
9
|
React.createElement(CollapseContainer, null,
|
|
10
10
|
React.createElement(CollapseItem, { status: 'open', title: React.createElement(React.Fragment, null,
|
|
11
11
|
React.createElement("div", { className: 'inner-wrapper-icon' },
|
|
12
12
|
React.createElement("svg", { width: '12', height: '12', fill: 'none', viewBox: '0 0 12 12', xmlns: 'http://www.w3.org/2000/svg' },
|
|
13
13
|
React.createElement("path", { d: 'M0 6H12', stroke: 'black', strokeWidth: '2' }),
|
|
14
14
|
React.createElement("path", { d: 'M6 12L6 0', stroke: 'black', strokeWidth: '2' }))),
|
|
15
|
-
React.createElement(Text, { className: 'account-p account-p4 account-primary-color1 account-font-medium comment-text', text: 'account.order_balance.comment' })), description: React.createElement(Input.TextArea, { containerClassName: `comment-field`, placeholder: 'account.cart_checkout.checkoutCommentPlaceholder', onChange: (e) => fillCheckoutData('note', e.target.value), className: `account-p account-p3 account-font-regular account-primary-color1` }) }))));
|
|
15
|
+
React.createElement(Text, { className: 'account-p account-p4 account-primary-color1 account-font-medium comment-text', text: 'account.order_balance.comment' })), description: React.createElement(Input.TextArea, { containerClassName: `comment-field`, placeholder: 'account.cart_checkout.checkoutCommentPlaceholder', onChange: (e) => fillCheckoutData('note', e.target.value), className: `account-p account-p3 account-font-regular account-primary-color1` }) })))) : null;
|
|
16
16
|
};
|
|
17
17
|
export default CommentComp;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { handlePriceCheckFunc, useTranslation } from '@weareconceptstudio/core';
|
|
3
3
|
import { useAccountContext } from '../../../AccountProvider';
|
|
4
|
+
import { useCheckoutContext } from '../../../modules';
|
|
4
5
|
//* Style
|
|
5
6
|
import FreeShippingCompStyle from './style';
|
|
6
7
|
const FreeShippingComp = () => {
|
|
7
8
|
const { translate } = useTranslation();
|
|
8
9
|
const { useCart } = useAccountContext();
|
|
10
|
+
const { isCheckoutPage } = useCheckoutContext();
|
|
9
11
|
const { shippingCostValue, freeShippingRange, shippingCost, currency } = useCart();
|
|
10
|
-
return freeShippingRange ? (React.createElement(FreeShippingCompStyle, null,
|
|
12
|
+
return !isCheckoutPage ? (freeShippingRange ? (React.createElement(FreeShippingCompStyle, null,
|
|
11
13
|
React.createElement("svg", { fill: 'none', viewBox: '0 0 24 24', xmlns: 'http://www.w3.org/2000/svg', className: 'free-shipping-comp-icon' },
|
|
12
14
|
React.createElement("path", { d: 'M21.675 14.475V9.9L17.925 6.15H15.375V4.125H2.85C2.325 4.725 2.025 5.025 1.5 5.55V16.65H3.3C3.3 18.375 4.725 19.8 6.45 19.8C8.175 19.8 9.6 18.375 9.6 16.65H13.35C13.35 18.375 14.775 19.8 16.5 19.8C18.225 19.8 19.65 18.375 19.65 16.65H22.35V14.475H21.675ZM6.45 18.6C5.475 18.6 4.65 17.775 4.65 16.8C4.65 15.825 5.475 15 6.45 15C7.425 15 8.25 15.825 8.25 16.8C8.25 17.775 7.5 18.6 6.45 18.6ZM16.575 18.6C15.6 18.6 14.775 17.775 14.775 16.8C14.775 15.825 15.6 15 16.575 15C17.55 15 18.375 15.825 18.375 16.8C18.375 17.775 17.625 18.6 16.575 18.6ZM19.575 11.1H15.375V7.95H17.025L19.575 10.5V11.1Z' })),
|
|
13
15
|
React.createElement("span", { className: 'free-shipping-comp-attr' }, translate('account.notifications_messages.freeShippingNote', { price: React.createElement("span", { className: 'range-value' }, handlePriceCheckFunc(freeShippingRange, currency)) })))) : typeof shippingCost != 'number' ? (React.createElement(FreeShippingCompStyle, null,
|
|
14
16
|
React.createElement("svg", { fill: 'none', viewBox: '0 0 16 16', xmlns: 'http://www.w3.org/2000/svg', className: 'free-shipping-comp-icon' },
|
|
15
17
|
React.createElement("path", { d: 'M13.901 5.06321C13.835 5.1324 13.754 5.167 13.658 5.167C13.562 5.167 13.481 5.1324 13.415 5.06321L13.388 5.03491C13.2081 4.84621 12.9981 4.74871 12.7611 4.74242C12.5241 4.73613 12.3111 4.83363 12.1191 5.03491L8.90036 8.40947C8.83437 8.47866 8.75337 8.51326 8.65738 8.51326C8.56139 8.51326 8.48039 8.47866 8.4144 8.40947C8.3484 8.34028 8.3154 8.25537 8.3154 8.15473C8.3154 8.05409 8.3484 7.96917 8.4144 7.89998L11.5912 4.56945C11.8941 4.25181 12.2811 4.08827 12.7461 4.08512C13.2111 4.07883 13.595 4.23608 13.901 4.55687C13.967 4.62606 14 4.71097 14 4.81161C14 4.91225 13.967 4.99717 13.901 5.06636V5.06321ZM6.17655 3.19509C6.24255 3.1259 6.32354 3.09131 6.41954 3.09131C6.51553 3.09131 6.59652 3.1259 6.66252 3.19509L6.79151 3.33033C7.12449 3.67942 7.28648 4.11343 7.28348 4.63864C7.27748 5.16071 7.10949 5.59786 6.77651 5.94695L6.63552 6.09477C6.56953 6.16396 6.48853 6.19855 6.39254 6.19855C6.29655 6.19855 6.21555 6.16396 6.14956 6.09477C6.08356 6.02558 6.05056 5.94066 6.05056 5.84002C6.05056 5.73938 6.08356 5.65447 6.14956 5.58528L6.33554 5.39029C6.55453 5.16071 6.65652 4.89967 6.64152 4.60719C6.62652 4.31471 6.52453 4.06625 6.33554 3.86812L6.17955 3.70458C6.11356 3.63539 6.08056 3.55048 6.08056 3.44984C6.08056 3.3492 6.11356 3.26428 6.17955 3.19509H6.17655ZM8.58538 2.10378C8.65138 2.03459 8.73237 2 8.82837 2C8.92436 2 9.00535 2.03459 9.07135 2.10378L9.7253 2.78939C10.0193 3.10703 10.1723 3.50959 10.1813 3.99077C10.1903 4.4751 10.0433 4.87451 9.7403 5.19216L7.78744 7.23954C7.72145 7.30873 7.64045 7.34332 7.54446 7.34332C7.44846 7.34332 7.36747 7.30873 7.30147 7.23954C7.23548 7.17035 7.20248 7.08543 7.20248 6.9848C7.20248 6.88416 7.23548 6.79924 7.30147 6.73005L9.22434 4.71412C9.40433 4.52542 9.49132 4.28326 9.48832 3.99077C9.48232 3.69829 9.39233 3.45613 9.20934 3.26743L8.58238 2.61013C8.51639 2.54094 8.48339 2.45602 8.48339 2.35538C8.48339 2.25474 8.51639 2.16983 8.58238 2.10064L8.58538 2.10378ZM12.8601 9.64859C12.7941 9.71778 12.7131 9.75238 12.6171 9.75238C12.5211 9.75238 12.4401 9.71778 12.3741 9.64859L11.8761 9.12653C11.6572 8.89694 11.4292 8.78372 11.1922 8.78372C10.9552 8.78372 10.7272 8.89694 10.5082 9.12653L10.0373 9.62029C9.97129 9.68948 9.89029 9.72407 9.7943 9.72407C9.6983 9.72407 9.61731 9.68948 9.55131 9.62029C9.48532 9.5511 9.45232 9.46619 9.45232 9.36555C9.45232 9.26491 9.48532 9.17999 9.55131 9.1108L9.97728 8.66422C10.3103 8.31512 10.7092 8.13586 11.1742 8.12642C11.6392 8.11699 12.0381 8.28682 12.3711 8.63277L12.8541 9.13911C12.9201 9.2083 12.9531 9.29321 12.9531 9.39385C12.9531 9.49449 12.9201 9.5794 12.8541 9.64859H12.8601ZM2.36082 13.9855L9.01435 11.501C9.20034 11.4318 9.25434 11.1802 9.11335 11.0355L4.81765 6.6074C4.67666 6.46273 4.44268 6.51934 4.37668 6.71433L2.01585 13.6239C1.94085 13.8471 2.14484 14.0641 2.35783 13.9824L2.36082 13.9855Z' })),
|
|
16
|
-
React.createElement("span", { className: 'free-shipping-comp-attr' }, translate('account.notifications_messages.freeShippingSuccessText', { price: React.createElement("span", { className: 'range-value' }, handlePriceCheckFunc(shippingCostValue, currency)) })))) : null;
|
|
18
|
+
React.createElement("span", { className: 'free-shipping-comp-attr' }, translate('account.notifications_messages.freeShippingSuccessText', { price: React.createElement("span", { className: 'range-value' }, handlePriceCheckFunc(shippingCostValue, currency)) })))) : null) : null;
|
|
17
19
|
};
|
|
18
20
|
export default FreeShippingComp;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { Text, CollapseItem } from '@weareconceptstudio/core';
|
|
3
3
|
import { FormBuilder } from '@weareconceptstudio/form';
|
|
4
4
|
import { useAccountContext } from '../../../AccountProvider';
|
|
@@ -8,35 +8,30 @@ import AppliedPromotion from './AppliedPromotion';
|
|
|
8
8
|
import { promoCodeFields } from './utils';
|
|
9
9
|
//* Style
|
|
10
10
|
import PromoCodeCompStyle from './style';
|
|
11
|
-
const PromoCodeComp = (
|
|
11
|
+
const PromoCodeComp = () => {
|
|
12
12
|
const { useCart } = useAccountContext();
|
|
13
13
|
const { itemsCount, usePromotion, appliedPromotions } = useCart();
|
|
14
14
|
const { fillCart } = useCheckoutContext();
|
|
15
|
-
const [disable, setDisable] = useState(false);
|
|
16
15
|
const handlePromotion = (promotion) => {
|
|
17
16
|
fillCart('usePromotion', promotion);
|
|
18
17
|
};
|
|
19
18
|
const onFinish = (values) => {
|
|
20
|
-
setDisable(true);
|
|
21
19
|
handlePromotion(values.promo_code);
|
|
22
20
|
};
|
|
23
21
|
const promotions = useMemo(() => {
|
|
24
|
-
return appliedPromotions?.map((promotion) => React.createElement(AppliedPromotion, { ...promotion }));
|
|
22
|
+
return appliedPromotions?.map((promotion, index) => (React.createElement(AppliedPromotion, { key: index, ...promotion })));
|
|
25
23
|
}, [appliedPromotions]);
|
|
26
|
-
return
|
|
27
|
-
React.createElement(CollapseItem, { status: appliedPromotions?.length ? 'open' : 'close',
|
|
24
|
+
return (React.createElement(PromoCodeCompStyle, { className: `collapse-distance ${itemsCount ? '' : 'disable'}` },
|
|
25
|
+
React.createElement(CollapseItem, { status: appliedPromotions?.length ? 'open' : 'close', title: React.createElement(React.Fragment, null,
|
|
28
26
|
React.createElement("div", { className: 'inner-wrapper-icon' },
|
|
29
27
|
React.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '12', height: '12', viewBox: '0 0 12 12', fill: 'none' },
|
|
30
28
|
React.createElement("path", { d: 'M0 6H12', stroke: 'black', strokeWidth: '2' }),
|
|
31
29
|
React.createElement("path", { d: 'M6 12L6 0', stroke: 'black', strokeWidth: '2' }))),
|
|
32
30
|
React.createElement(Text, { className: 'account-p account-p4 account-primary-color1 account-font-medium promo-code-text', text: 'account.balance_promotions.gotPromotionCode' })), description: React.createElement(React.Fragment, null,
|
|
33
31
|
promotions,
|
|
34
|
-
usePromotion ? (React.createElement(AppliedPromotion, { name: usePromotion, onClick: () => {
|
|
35
|
-
handlePromotion(null);
|
|
36
|
-
setDisable(false);
|
|
37
|
-
} })) : (React.createElement(FormBuilder, { onSubmit: onFinish, fields: promoCodeFields, className: `promo-code-block`, formOptions: {
|
|
32
|
+
usePromotion ? (React.createElement(AppliedPromotion, { name: usePromotion, onClick: () => handlePromotion(null) })) : (React.createElement(FormBuilder, { onSubmit: onFinish, fields: promoCodeFields, className: `promo-code-block`, formOptions: {
|
|
38
33
|
className: 'promo-code-container',
|
|
39
34
|
} },
|
|
40
|
-
React.createElement(AccountButton, {
|
|
35
|
+
React.createElement(AccountButton, { type: 'submit', btnType: `promo-code-version`, text: `account.general_actions.add` })))) })));
|
|
41
36
|
};
|
|
42
37
|
export default PromoCodeComp;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { memo
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
2
|
import { Text, CollapseContainer, handlePriceCheckFunc, numToLocalString } from '@weareconceptstudio/core';
|
|
3
3
|
import { useAccountContext } from '../../AccountProvider';
|
|
4
4
|
import { useAddressContext, useCheckoutContext } from '../../modules';
|
|
@@ -14,68 +14,40 @@ import TotalCheckoutStyle from './style';
|
|
|
14
14
|
import SkeletonTotalCheckout from './Skeleton';
|
|
15
15
|
const TotalCheckout = memo(({ isShipping, children, confirmation, buttonProps }) => {
|
|
16
16
|
const { useCart, useUser } = useAccountContext();
|
|
17
|
-
const { checkoutBtnDisabled
|
|
17
|
+
const { checkoutBtnDisabled } = useCheckoutContext();
|
|
18
18
|
const { addressLoading } = useAddressContext();
|
|
19
19
|
const { user } = useUser();
|
|
20
20
|
const { itemsCount, shippingCost, total, subtotal, useBalance, loading, discount, currency } = useCart();
|
|
21
|
-
const innerCollapseRef = useRef(null);
|
|
22
|
-
//! disable keypress on input
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
const handleKeyDown = (event) => {
|
|
25
|
-
if (event.key === 'Enter') {
|
|
26
|
-
event.preventDefault();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
if ((!itemsCount || !user?.balance) && innerCollapseRef.current) {
|
|
30
|
-
let inputField = innerCollapseRef.current.querySelectorAll('.base-input');
|
|
31
|
-
if (inputField.length) {
|
|
32
|
-
[...inputField].forEach((item, i) => {
|
|
33
|
-
if (!user?.balance && itemsCount && i == 1) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
item.addEventListener('keydown', handleKeyDown);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return () => {
|
|
43
|
-
if ((!itemsCount || !user?.balance) && innerCollapseRef.current) {
|
|
44
|
-
const inputField = innerCollapseRef.current.querySelectorAll('.base-input');
|
|
45
|
-
[...inputField].map((item) => {
|
|
46
|
-
item.removeEventListener('keydown', handleKeyDown);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
21
|
return (React.createElement(TotalCheckoutStyle, null,
|
|
52
22
|
React.createElement("div", { className: `cart-main-wrap` },
|
|
53
23
|
React.createElement("div", { className: `left-panel-wrap panel` }, children),
|
|
54
24
|
React.createElement("div", { className: `right-panel-wrap panel ${confirmation ? 'display-none-wrap' : ''}` }, !confirmation && !addressLoading && !loading ? (React.createElement("div", { className: `max-width-wrapper sticky-wrap` },
|
|
55
|
-
React.createElement(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
React.createElement(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
25
|
+
React.createElement("div", { className: 'panel-block' },
|
|
26
|
+
React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1 sticky-wrap-title`, text: `account.cart_checkout.orderSummary` }),
|
|
27
|
+
React.createElement("div", { className: `od-line` }),
|
|
28
|
+
React.createElement("div", { className: 'scroll-block' },
|
|
29
|
+
React.createElement("div", { className: 'scroll-content' },
|
|
30
|
+
React.createElement("div", { className: `od-item-wrap` },
|
|
31
|
+
React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1 sticky-wrap-subtotal`, text: `account.cart_checkout.subtotal` }),
|
|
32
|
+
React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1 sticky-wrap-currency`, text: itemsCount ? handlePriceCheckFunc(subtotal, currency) : `0 ${currency}` })),
|
|
33
|
+
user && discount ? (React.createElement("div", { className: `od-item-wrap` },
|
|
34
|
+
React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1`, text: `account.order_balance.discount` }),
|
|
35
|
+
React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1 balance-text-block`, text: `-${handlePriceCheckFunc(discount, currency)}` }))) : null,
|
|
36
|
+
user && useBalance ? (React.createElement("div", { className: `od-item-wrap` },
|
|
37
|
+
React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1`, text: `account.balance_promotions.muramoney` }),
|
|
38
|
+
React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1 balance-text-block`, text: `-${handlePriceCheckFunc(useBalance, currency)}` }))) : null,
|
|
39
|
+
React.createElement("div", { className: `od-item-wrap` },
|
|
40
|
+
React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1 sticky-wrap-shipping`, text: `account.address_management.shipping` }),
|
|
41
|
+
React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1 sticky-wrap-shipping-cost`, text: `${String(shippingCost).toLowerCase() === 'free' ? `account.general_actions.${shippingCost}` : shippingCost === '-' ? shippingCost : `${numToLocalString(shippingCost)} ${currency}`}` })),
|
|
42
|
+
React.createElement("div", { className: `od-item-wrap` },
|
|
43
|
+
React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1 sticky-wrap-total`, text: `account.order_balance.total` }),
|
|
44
|
+
React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1 sticky-wrap-currency2`, text: itemsCount ? handlePriceCheckFunc(total, currency) : `0 ${currency}` })),
|
|
45
|
+
React.createElement(GiftComp, null),
|
|
46
|
+
React.createElement(FreeShippingComp, null),
|
|
47
|
+
user ? (React.createElement(CollapseContainer, { className: 'collapse-container-wrapper' },
|
|
48
|
+
React.createElement(BalanceComp, null),
|
|
49
|
+
React.createElement(PromoCodeComp, null))) : null,
|
|
50
|
+
React.createElement(CommentComp, { isShipping: isShipping }),
|
|
51
|
+
React.createElement(AccountButton, { url: buttonProps.url, btnType: `full-width`, text: buttonProps.text, type: buttonProps.type, disabled: checkoutBtnDisabled, loading: buttonProps.loadingButton, className: `sticky-wrap-btn text-center`, onClick: () => buttonProps.handleClick && buttonProps.handleClick() })))))) : (React.createElement(SkeletonTotalCheckout, null))))));
|
|
80
52
|
});
|
|
81
53
|
export default TotalCheckout;
|
|
@@ -6,7 +6,7 @@ const TotalCheckoutStyle = styled.section `
|
|
|
6
6
|
--account_cartMainWrapPadTop: var(--sp8x);
|
|
7
7
|
--account_leftPanelWrapWidth: calc(100% - var(--account_rightPanelWrapWidth));
|
|
8
8
|
|
|
9
|
-
/* //!
|
|
9
|
+
/* //! Size text var */
|
|
10
10
|
--account_textSize: var(--account_p4);
|
|
11
11
|
--account_lineHeightSize: var(--account_lineHeight);
|
|
12
12
|
|
|
@@ -176,9 +176,13 @@ const TotalCheckoutStyle = styled.section `
|
|
|
176
176
|
&.disable {
|
|
177
177
|
#collapse-description {
|
|
178
178
|
button {
|
|
179
|
-
pointer-events: none;
|
|
180
|
-
border-color: var(--account_primaryColor5);
|
|
181
|
-
color: var(--account_primaryColor5);
|
|
179
|
+
pointer-events: none !important;
|
|
180
|
+
border-color: var(--account_primaryColor5) !important;
|
|
181
|
+
color: var(--account_primaryColor5) !important;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.disabled {
|
|
185
|
+
opacity: 1 !important;
|
|
182
186
|
}
|
|
183
187
|
}
|
|
184
188
|
}
|
|
@@ -191,13 +195,27 @@ const TotalCheckoutStyle = styled.section `
|
|
|
191
195
|
margin-top: var(--account_commentMarginTop);
|
|
192
196
|
}
|
|
193
197
|
|
|
198
|
+
/* //! Scroll logic */
|
|
199
|
+
/* .scroll-block {
|
|
200
|
+
overflow-x: hidden;
|
|
201
|
+
overflow-y: auto;
|
|
202
|
+
max-height: calc(100vh - var(--sp27x));
|
|
203
|
+
|
|
204
|
+
scrollbar-width: none;
|
|
205
|
+
-ms-overflow-style: none;
|
|
206
|
+
|
|
207
|
+
&::-webkit-scrollbar {
|
|
208
|
+
display: none;
|
|
209
|
+
}
|
|
210
|
+
} */
|
|
211
|
+
|
|
194
212
|
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeL}) {
|
|
195
213
|
--account_distance: var(--sp8x);
|
|
196
214
|
/* --account_rightPanelWrapWidth: var(--sp66x); */
|
|
197
215
|
--account_rightPanelWrapWidth: 29.21%;
|
|
198
216
|
--account_cartMainWrapPadTop: var(--sp5x);
|
|
199
217
|
|
|
200
|
-
//! Right Layout Sizes
|
|
218
|
+
/* //! Right Layout Sizes */
|
|
201
219
|
--account_odLineMTop: var(--sp2x);
|
|
202
220
|
--account_odLineMBot: var(--sp4x);
|
|
203
221
|
--account_itemMTop: var(--sp2x);
|
|
@@ -216,7 +234,7 @@ const TotalCheckoutStyle = styled.section `
|
|
|
216
234
|
--account_rightPanelWrapWidth: 27.67%;
|
|
217
235
|
--account_cartMainWrapPadTop: var(--sp5x);
|
|
218
236
|
|
|
219
|
-
//! Right Layout Sizes
|
|
237
|
+
/* //! Right Layout Sizes */
|
|
220
238
|
--account_odLineMTop: var(--sp2x);
|
|
221
239
|
--account_odLineMBot: var(--sp4x);
|
|
222
240
|
--account_itemMTop: var(--sp2x);
|
|
@@ -235,7 +253,7 @@ const TotalCheckoutStyle = styled.section `
|
|
|
235
253
|
--account_rightPanelWrapWidth: 29.07%;
|
|
236
254
|
--account_cartMainWrapPadTop: var(--sp4x);
|
|
237
255
|
|
|
238
|
-
//! Right Layout Sizes
|
|
256
|
+
/* //! Right Layout Sizes */
|
|
239
257
|
--account_odLineMTop: var(--sp2x);
|
|
240
258
|
--account_odLineMBot: var(--sp3x);
|
|
241
259
|
--account_itemMTop: var(--sp2x);
|
|
@@ -254,7 +272,7 @@ const TotalCheckoutStyle = styled.section `
|
|
|
254
272
|
--account_rightPanelWrapWidth: 29.68%;
|
|
255
273
|
--account_cartMainWrapPadTop: var(--sp4x);
|
|
256
274
|
|
|
257
|
-
//! Right Layout Sizes
|
|
275
|
+
/* //! Right Layout Sizes */
|
|
258
276
|
--account_odLineMTop: var(--sp2x);
|
|
259
277
|
--account_odLineMBot: var(--sp3x);
|
|
260
278
|
--account_itemMTop: var(--sp2x);
|
|
@@ -273,7 +291,7 @@ const TotalCheckoutStyle = styled.section `
|
|
|
273
291
|
--account_rightPanelWrapWidth: 30.9%;
|
|
274
292
|
--account_cartMainWrapPadTop: var(--sp4x);
|
|
275
293
|
|
|
276
|
-
//! Right Layout Sizes
|
|
294
|
+
/* //! Right Layout Sizes */
|
|
277
295
|
--account_odLineMTop: var(--sp2x);
|
|
278
296
|
--account_odLineMBot: var(--sp3x);
|
|
279
297
|
--account_itemMTop: var(--sp1x);
|
|
@@ -292,7 +310,7 @@ const TotalCheckoutStyle = styled.section `
|
|
|
292
310
|
--account_leftPanelWrapWidth: 100%;
|
|
293
311
|
--account_cartMainWrapPadTop: var(--sp4x);
|
|
294
312
|
|
|
295
|
-
//! Right Layout Sizes
|
|
313
|
+
/* //! Right Layout Sizes */
|
|
296
314
|
--account_odLineMTop: var(--sp2x);
|
|
297
315
|
--account_odLineMBot: var(--sp3x);
|
|
298
316
|
--account_itemMTop: var(--sp1x);
|
|
@@ -317,7 +335,7 @@ const TotalCheckoutStyle = styled.section `
|
|
|
317
335
|
--account_leftPanelWrapWidth: 100%;
|
|
318
336
|
--account_cartMainWrapPadTop: var(--sp4x);
|
|
319
337
|
|
|
320
|
-
//! Right Layout Sizes
|
|
338
|
+
/* //! Right Layout Sizes */
|
|
321
339
|
--account_odLineMTop: var(--sp2x);
|
|
322
340
|
--account_odLineMBot: var(--sp3x);
|
|
323
341
|
--account_itemMTop: var(--sp1x);
|
|
@@ -13,15 +13,11 @@ const ProgressBalance = ({ progress, balance, nextStatusValue, nextStatusTitle,
|
|
|
13
13
|
React.createElement(Text, { className: 'account-primary-color1 account-p account-p4 first-letter balance-title', text: 'account.balance_promotions.balance' }),
|
|
14
14
|
React.createElement(Text, { className: 'account-primary-color1 account-h5 first-letter balance-value' }, typeof balance == 'number' ? handlePriceCheckFunc(balance, currency) : balance))) : null),
|
|
15
15
|
nextStatusValue ? (React.createElement("div", { className: 'wrapper-next-status' },
|
|
16
|
-
React.createElement(Text, { className: 'account-primary-color1 account-p account-p4 text-center next-status-text' },
|
|
17
|
-
|
|
18
|
-
"\u00A0",
|
|
19
|
-
React.createElement(Text, { className: 'account-font-medium next-status-value', tag: 'span' },
|
|
16
|
+
React.createElement(Text, { className: 'account-primary-color1 account-p account-p4 text-center next-status-text' }, translate('account.balance_promotions.balanceNextStatusDescription', {
|
|
17
|
+
nextStatusValue: (React.createElement("span", { className: 'account-font-medium next-status-value' },
|
|
20
18
|
typeof nextStatusValue == 'number' ? handlePriceCheckFunc(nextStatusValue, '').trim() : nextStatusValue,
|
|
21
|
-
iconValue || null),
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"\u00A0",
|
|
25
|
-
React.createElement(Text, { tag: 'span', className: 'account-secondary-color9 account-font-medium next-status-title', text: `account.user_status.${nextStatusTitle}` })))) : null));
|
|
19
|
+
iconValue || null)),
|
|
20
|
+
nextStatusTitle: React.createElement("span", { className: 'account-secondary-color9 account-font-medium next-status-title' }, translate(`account.user_status.${nextStatusTitle}`)),
|
|
21
|
+
})))) : null));
|
|
26
22
|
};
|
|
27
23
|
export default ProgressBalance;
|
|
@@ -14,12 +14,7 @@ const HeroBalance = ({ iconValue, balance, cashback, progress, totalSpent, nextS
|
|
|
14
14
|
React.createElement("div", { className: 'inner-wrapper-left-bar' },
|
|
15
15
|
React.createElement(Text, { className: 'account-primary-color1 account-font-medium account-p account-p3 first-letter status-title', text: 'account.balance_promotions.balanceStatus' }),
|
|
16
16
|
React.createElement(Text, { className: 'account-primary-color1 account-font-medium account-h5 first-letter text-title', text: `account.user_status.${title}` }),
|
|
17
|
-
description &&
|
|
18
|
-
translate(description.description1),
|
|
19
|
-
" ",
|
|
20
|
-
cashback + '%',
|
|
21
|
-
" ",
|
|
22
|
-
translate(description.description2))),
|
|
17
|
+
description && React.createElement(Text, { className: 'account-primary-color1 account-p account-p2 first-letter description-status' }, translate(description.description, { cashback: cashback })),
|
|
23
18
|
React.createElement("div", { className: 'wrapper-information-payment' }, dataInformation.map((item, i, arr) => {
|
|
24
19
|
return ((item || item == 0) && (React.createElement(Text, { key: i, className: 'account-primary-color1 account-p account-p3 first-letter account-font-medium info-text' },
|
|
25
20
|
translate(dataInformationTitle[i]),
|
|
@@ -25,7 +25,7 @@ const HistoryBalance = ({ linkEarnPage }) => {
|
|
|
25
25
|
useEffect(() => {
|
|
26
26
|
getHistory(currentPage);
|
|
27
27
|
}, [currentPage]);
|
|
28
|
-
return data
|
|
28
|
+
return data?.length > 0 ? (React.createElement(HistoryBalanceStyle, null,
|
|
29
29
|
React.createElement("div", { className: 'wrapper-title-section-history' },
|
|
30
30
|
React.createElement("div", { className: 'wrapper-history-link' },
|
|
31
31
|
React.createElement(Text, { className: 'account-primary-color1 account-font-medium account-p account-p1 first-letter title-section-history', text: 'account.balance_promotions.balanceRecentActivity' }),
|
|
@@ -18,10 +18,10 @@ const AccountBalanceTemplate = ({ iconValue, dataItem, linkEarnPage, className }
|
|
|
18
18
|
});
|
|
19
19
|
}, []);
|
|
20
20
|
return dataBalance ? (React.createElement(AccountBalanceTemplateStyle, { className: className || '' },
|
|
21
|
-
React.createElement(HeroBalance, { currency: currency, iconValue: iconValue, nextStatusTitle: 'resident', balance: dataBalance.balance,
|
|
21
|
+
React.createElement(HeroBalance, { currency: currency, iconValue: iconValue, nextStatusTitle: 'resident', balance: dataBalance.balance, cashback: dataBalance.cashback, progress: dataBalance.info.timeline, totalSpent: dataBalance.info.spent.current, title: dataBalance.info.status.toLowerCase(), nextStatusValue: dataBalance.info.spent.next, description: (() => {
|
|
22
22
|
if (dataItem) {
|
|
23
|
-
const {
|
|
24
|
-
return {
|
|
23
|
+
const { description } = dataItem.find((item) => item.name?.toLowerCase() === dataBalance.info.status?.toLowerCase()) || {};
|
|
24
|
+
return { description };
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
27
|
return false;
|
|
@@ -60,9 +60,7 @@ const ForgotPasswordTemplate = ({ signInUrl = '/sign-in' }) => {
|
|
|
60
60
|
translate('account.notifications_messages.thankYou'),
|
|
61
61
|
"!"),
|
|
62
62
|
React.createElement("div", { className: 'recovery-wrap' },
|
|
63
|
-
React.createElement(Text, { className: 'account-p account-p2 account-font-
|
|
64
|
-
"\u00A0",
|
|
65
|
-
React.createElement(Text, { className: 'account-p account-p2 account-font-bold account-primary-color1 recovery-email', text: forgotState.email })),
|
|
63
|
+
React.createElement(Text, { className: 'account-p account-p2 account-font-regular account-primary-color1 recovery-text text-center' }, translate('account.email_verification.recoveryText', { recoveryEmail: React.createElement("span", { className: 'account-p account-p2 account-font-medium account-primary-color1 recovery-email' }, forgotState.email) }))),
|
|
66
64
|
React.createElement("div", { className: 'try-again-wrap' },
|
|
67
65
|
React.createElement(Text, { onClick: handleTryAgain, text: `account.email_verification.resendNewLink`, className: `account-p account-p3 account-font-bold account-primary-color1 underline try-again-text ${forgotState.isBtnDisabled ? 'disabled' : ''}` }))),
|
|
68
66
|
React.createElement("div", { className: 'col-3 col-t-1 col-m-0' })))))));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { handlePriceCheckFunc, Image, Text } from '@weareconceptstudio/core';
|
|
3
|
+
import { AccountButton, AccountCounter } from '../../../../components';
|
|
4
|
+
import { useAccountContext } from '../../../../AccountProvider';
|
|
5
|
+
import { useCheckoutContext } from '../../../checkout';
|
|
6
|
+
import { defaultIconGift } from '../util';
|
|
7
|
+
const Item = memo(({ data, remove, select, isLast, actions }) => {
|
|
8
|
+
const { checkoutData, setCheckGift } = useCheckoutContext();
|
|
9
|
+
const { currency, handleProductClick } = useAccountContext();
|
|
10
|
+
return (React.createElement("div", { className: `item-wrap` },
|
|
11
|
+
React.createElement("div", { className: 'line' }),
|
|
12
|
+
React.createElement("div", { className: `item-inner-wrapper` },
|
|
13
|
+
React.createElement("div", { className: `col-item tl-col-1 col-item-1` },
|
|
14
|
+
React.createElement("div", { className: `image-wrapper` },
|
|
15
|
+
data.is_gift ? React.createElement("div", { className: 'wrapper-gift-icon' }, defaultIconGift) : null,
|
|
16
|
+
React.createElement(Image, { src: data.product.image.src, alt: data.product.image.alt })),
|
|
17
|
+
React.createElement("div", { className: `col-1-right-wrap` },
|
|
18
|
+
React.createElement(AccountButton, { text: data.product?.name, btnType: `green-large-text`, className: `capitalize title-btn`, onClick: () => handleProductClick(data.product) }),
|
|
19
|
+
data.product.short_info_1 ? (React.createElement("div", { className: `right-first-item-wrap` },
|
|
20
|
+
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1`, text: data.product.short_info_1 }))) : null,
|
|
21
|
+
data.product.short_info_2 ? (React.createElement("div", { className: `right-second-item-wrap` },
|
|
22
|
+
React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1`, text: data.product.short_info_2 }))) : null)),
|
|
23
|
+
React.createElement("div", { className: `col-item tl-col-2` }, select && !data.is_gift ? (React.createElement("div", { className: `select-and-out-of-stock-wrap` }, !data.product.out_of_stock ? (React.createElement(AccountCounter, { productId: data.product.id })) : (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: 'account.general_actions.outOfStock' })))) : data.is_gift ? (React.createElement("div", { className: 'wrapper-gift-button' }, checkoutData.checkGift ? (React.createElement(AccountCounter, { maxQty: 1, productId: -1, isGift: data.is_gift })) : (React.createElement(AccountButton, { className: `button-gift`, text: 'account.general_actions.restore', onClick: () => {
|
|
24
|
+
setCheckGift();
|
|
25
|
+
} })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: data.qty }))),
|
|
26
|
+
React.createElement("div", { className: `col-item tl-col-3 col-item-3 nowrap` }, data.product.sale_price && !data.is_gift ? (React.createElement("div", null,
|
|
27
|
+
React.createElement(Text, { className: `account-p account-p3 account-font-bold account-secondary-color2 align-right cart-sale-price`, text: handlePriceCheckFunc(data.product.sale_price, currency) }),
|
|
28
|
+
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right cart-price1`, text: handlePriceCheckFunc(data.product.price, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right cart-price2`, text: handlePriceCheckFunc(data.is_gift ? 0 : data.product.price, currency) }))),
|
|
29
|
+
React.createElement("div", { className: `col-item tl-col-4 col-item-4 nowrap` },
|
|
30
|
+
React.createElement("div", { className: `col-item-inner-wrap` },
|
|
31
|
+
React.createElement("div", { className: `flex-end-wrap` }, data.sale_total && !data.is_gift ? (React.createElement("div", null,
|
|
32
|
+
React.createElement(Text, { className: `account-p account-p3 account-font-bold account-secondary-color2 align-right cart-sale-total`, text: handlePriceCheckFunc(data.sale_total, currency) }),
|
|
33
|
+
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right cart-total1`, text: `${data.total} ${currency}` }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right cart-total2`, text: `${data.is_gift ? 0 : data.total} ${currency}` }))),
|
|
34
|
+
React.createElement("div", { className: `favorite-and-remove-wrap` }, remove && !data.is_gift && (React.createElement("div", { className: `remove-btn-wrap` },
|
|
35
|
+
React.createElement(AccountButton, { btnType: `green-small-text`, className: 'cart-remove-btn', text: 'account.general_actions.remove', onClick: () => actions.delete({ productId: data.product.id }) }))))))),
|
|
36
|
+
isLast ? React.createElement("div", { className: 'line' }) : null));
|
|
37
|
+
});
|
|
38
|
+
export default Item;
|