@weareconceptstudio/account 0.5.0 → 0.5.2
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/style.js +23 -4
- package/dist/components/TotalCheckout/BalanceComp/index.d.ts +1 -6
- package/dist/components/TotalCheckout/BalanceComp/index.js +15 -7
- package/dist/components/TotalCheckout/CommentComp/index.d.ts +1 -3
- package/dist/components/TotalCheckout/CommentComp/index.js +3 -1
- package/dist/components/TotalCheckout/FreeShippingComp/index.d.ts +1 -6
- package/dist/components/TotalCheckout/FreeShippingComp/index.js +6 -10
- package/dist/components/TotalCheckout/FreeShippingComp/style.js +0 -1
- package/dist/components/TotalCheckout/GiftComp/index.d.ts +3 -0
- package/dist/components/TotalCheckout/GiftComp/index.js +18 -0
- package/dist/components/TotalCheckout/GiftComp/style.d.ts +2 -0
- package/dist/components/TotalCheckout/GiftComp/style.js +100 -0
- package/dist/components/TotalCheckout/PromoCodeComp/index.d.ts +1 -5
- package/dist/components/TotalCheckout/PromoCodeComp/index.js +13 -7
- package/dist/components/TotalCheckout/index.js +9 -13
- package/dist/modules/cart/SimpleItems/Item/index.js +14 -24
- package/dist/modules/cart/SimpleItems/ItemMobile/index.js +12 -18
- package/dist/modules/cart/SimpleItems/index.js +2 -2
- package/dist/modules/cart/SimpleItems/style.js +95 -4
- package/dist/modules/cart/SimpleItems/util.d.ts +2 -0
- package/dist/modules/cart/SimpleItems/util.js +3 -0
- package/dist/modules/checkout/CheckoutProvider.js +13 -3
- package/dist/modules/checkout/CheckoutTemplate/index.js +1 -1
- package/dist/styles/variables.js +1 -1
- package/dist/translations/en.d.ts +5 -3
- package/dist/translations/en.js +5 -3
- package/dist/translations/hy.d.ts +5 -3
- package/dist/translations/hy.js +5 -3
- package/dist/translations/index.d.ts +16 -9
- package/dist/translations/ru.d.ts +6 -3
- package/dist/translations/ru.js +6 -3
- package/package.json +1 -1
|
@@ -5,19 +5,26 @@ const AccountCounterStyle = styled.div `
|
|
|
5
5
|
--account_counterHeight: var(--sp3x);
|
|
6
6
|
--account_counterIconSize: var(--sp1-5x);
|
|
7
7
|
|
|
8
|
+
--account_counterButtonSize: calc(var(--sp4x) - var(--sp0-5x) / 2);
|
|
9
|
+
--account_distanceItemCounter: var(--sp0-5x);
|
|
10
|
+
|
|
8
11
|
width: var(--account_counterWidth);
|
|
9
12
|
height: var(--account_counterHeight);
|
|
10
13
|
display: flex;
|
|
11
14
|
transition: opacity var(--account_trTime) ease-out;
|
|
12
15
|
|
|
13
16
|
.counter {
|
|
14
|
-
width:
|
|
17
|
+
width: fit-content;
|
|
15
18
|
display: flex;
|
|
16
19
|
align-items: center;
|
|
17
20
|
justify-content: space-between;
|
|
21
|
+
gap: var(--account_distanceItemCounter);
|
|
18
22
|
|
|
19
23
|
.count {
|
|
20
24
|
color: var(--backgroundColor);
|
|
25
|
+
text-align: center;
|
|
26
|
+
min-width: var(--account_counterButtonSize);
|
|
27
|
+
line-height: 1;
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
svg {
|
|
@@ -35,9 +42,8 @@ const AccountCounterStyle = styled.div `
|
|
|
35
42
|
display: flex;
|
|
36
43
|
align-items: center;
|
|
37
44
|
justify-content: center;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
height: var(--sp3x);
|
|
45
|
+
width: var(--account_counterButtonSize);
|
|
46
|
+
height: var(--account_counterButtonSize);
|
|
41
47
|
background-color: #f7f8f9;
|
|
42
48
|
border-radius: 50%;
|
|
43
49
|
|
|
@@ -50,30 +56,43 @@ const AccountCounterStyle = styled.div `
|
|
|
50
56
|
|
|
51
57
|
/* //! 1920 */
|
|
52
58
|
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeL}) {
|
|
59
|
+
--account_counterButtonSize: var(--sp3x);
|
|
60
|
+
--account_distanceItemCounter: var(--sp0-5x);
|
|
53
61
|
}
|
|
54
62
|
|
|
55
63
|
/* //! 1510 */
|
|
56
64
|
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeM}) {
|
|
65
|
+
--account_counterButtonSize: var(--sp3x);
|
|
66
|
+
--account_distanceItemCounter: var(--sp0-5x);
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
/* //! 1440 */
|
|
60
70
|
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeMMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeS}) {
|
|
71
|
+
--account_counterButtonSize: var(--sp3x);
|
|
72
|
+
--account_distanceItemCounter: var(--sp0-5x);
|
|
61
73
|
}
|
|
62
74
|
|
|
63
75
|
/* //! 1280 */
|
|
64
76
|
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXS}) {
|
|
77
|
+
--account_counterButtonSize: var(--sp3x);
|
|
78
|
+
--account_distanceItemCounter: var(--sp0-5x);
|
|
65
79
|
}
|
|
66
80
|
|
|
67
81
|
/* //! 1024 */
|
|
68
82
|
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSize}) {
|
|
83
|
+
--account_counterButtonSize: var(--sp3x);
|
|
69
84
|
}
|
|
70
85
|
|
|
71
86
|
/* //! 768 */
|
|
72
87
|
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeS}) {
|
|
88
|
+
--account_counterButtonSize: var(--sp3x);
|
|
89
|
+
--account_distanceItemCounter: calc(var(--sp0-5x) / 2);
|
|
73
90
|
}
|
|
74
91
|
|
|
75
92
|
/* //! Mobile */
|
|
76
93
|
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeSMin}) {
|
|
94
|
+
--account_counterButtonSize: var(--sp3x);
|
|
95
|
+
--account_distanceItemCounter: calc(var(--sp0-5x) / 2);
|
|
77
96
|
}
|
|
78
97
|
`;
|
|
79
98
|
export default AccountCounterStyle;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
export default BalanceComp;
|
|
2
|
-
declare function BalanceComp({ isBalance
|
|
2
|
+
declare function BalanceComp({ isBalance }: {
|
|
3
3
|
isBalance?: boolean;
|
|
4
|
-
currency: any;
|
|
5
|
-
balance: any;
|
|
6
|
-
useBalance: any;
|
|
7
|
-
balanceHandler: any;
|
|
8
|
-
getItemCount: any;
|
|
9
4
|
}): React.JSX.Element;
|
|
10
5
|
import React from 'react';
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Text, CollapseItem,
|
|
2
|
+
import { Text, CollapseItem, handlePriceCheckFunc, useTranslation } from '@weareconceptstudio/core';
|
|
3
3
|
import { FormBuilder } from '@weareconceptstudio/form';
|
|
4
|
+
import { useAccountContext } from '../../../AccountProvider';
|
|
5
|
+
import { useCheckoutContext } from '../../../modules';
|
|
4
6
|
import AccountButton from '../../AccountButton';
|
|
5
7
|
import { balanceFields } from './utils';
|
|
6
8
|
//* Style
|
|
7
9
|
import BalanceCompStyle from './style';
|
|
8
|
-
const BalanceComp = ({ isBalance = true
|
|
10
|
+
const BalanceComp = ({ isBalance = true }) => {
|
|
9
11
|
const { translate } = useTranslation();
|
|
10
|
-
|
|
12
|
+
const { useCart, useUser } = useAccountContext();
|
|
13
|
+
const { currency, itemsCount, useBalance } = useCart();
|
|
14
|
+
const { fillCart } = useCheckoutContext();
|
|
15
|
+
const { user } = useUser();
|
|
16
|
+
const balance = user?.balance || 0;
|
|
11
17
|
const [disable, setDisable] = useState(false);
|
|
12
|
-
|
|
18
|
+
const handleBalance = (amount) => {
|
|
19
|
+
fillCart('useBalance', amount);
|
|
20
|
+
};
|
|
13
21
|
const onFinish = (values) => {
|
|
14
22
|
setDisable(true);
|
|
15
|
-
|
|
23
|
+
handleBalance(values.balance);
|
|
16
24
|
};
|
|
17
|
-
return isBalance ? (React.createElement(BalanceCompStyle, { className: `collapse-distance ${
|
|
25
|
+
return isBalance ? (React.createElement(BalanceCompStyle, { className: `collapse-distance ${itemsCount && balance ? ' ' : 'disable'}` },
|
|
18
26
|
React.createElement(CollapseItem, { disable: useBalance || disable, title: React.createElement(React.Fragment, null,
|
|
19
27
|
React.createElement("div", { className: 'inner-wrapper-icon' },
|
|
20
28
|
React.createElement("svg", { width: '12', height: '12', fill: 'none', viewBox: '0 0 12 12', xmlns: 'http://www.w3.org/2000/svg' },
|
|
@@ -23,7 +31,7 @@ const BalanceComp = ({ isBalance = true, currency, balance, useBalance, balanceH
|
|
|
23
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` },
|
|
24
32
|
React.createElement(Text, { className: 'account-p account-p4 account-primary-color2 account-font-medium balance-success-text' }, handlePriceCheckFunc(useBalance, currency)),
|
|
25
33
|
React.createElement(Text, { text: 'account.general_actions.remove', className: 'account-p account-p4 account-primary-color2 account-font-medium balance-remove-text', onClick: () => {
|
|
26
|
-
|
|
34
|
+
handleBalance(null);
|
|
27
35
|
setDisable(false);
|
|
28
36
|
} }))) : (React.createElement(FormBuilder, { onSubmit: onFinish, fields: balanceFields, className: `balance-block`, formOptions: {
|
|
29
37
|
className: 'balance-container',
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CollapseContainer, CollapseItem, Text } from '@weareconceptstudio/core';
|
|
3
3
|
import { Input } from '@weareconceptstudio/form';
|
|
4
|
+
import { useCheckoutContext } from '../../../modules';
|
|
4
5
|
import CommentCompStyle from './style';
|
|
5
|
-
const CommentComp = (
|
|
6
|
+
const CommentComp = () => {
|
|
7
|
+
const { fillCheckoutData } = useCheckoutContext();
|
|
6
8
|
return (React.createElement(CommentCompStyle, { className: 'collapse-distance' },
|
|
7
9
|
React.createElement(CollapseContainer, null,
|
|
8
10
|
React.createElement(CollapseItem, { status: 'open', title: React.createElement(React.Fragment, null,
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
export default FreeShippingComp;
|
|
2
|
-
declare function FreeShippingComp(
|
|
3
|
-
shippingCostValue: any;
|
|
4
|
-
freeShippingRange: any;
|
|
5
|
-
shippingCost: any;
|
|
6
|
-
currency: any;
|
|
7
|
-
}): React.JSX.Element;
|
|
2
|
+
declare function FreeShippingComp(): React.JSX.Element;
|
|
8
3
|
import React from 'react';
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { handlePriceCheckFunc, useTranslation } from '@weareconceptstudio/core';
|
|
3
|
+
import { useAccountContext } from '../../../AccountProvider';
|
|
3
4
|
//* Style
|
|
4
5
|
import FreeShippingCompStyle from './style';
|
|
5
|
-
const FreeShippingComp = (
|
|
6
|
+
const FreeShippingComp = () => {
|
|
6
7
|
const { translate } = useTranslation();
|
|
8
|
+
const { useCart } = useAccountContext();
|
|
9
|
+
const { shippingCostValue, freeShippingRange, shippingCost, currency } = useCart();
|
|
7
10
|
return freeShippingRange ? (React.createElement(FreeShippingCompStyle, null,
|
|
8
11
|
React.createElement("svg", { fill: 'none', viewBox: '0 0 24 24', xmlns: 'http://www.w3.org/2000/svg', className: 'free-shipping-comp-icon' },
|
|
9
12
|
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' })),
|
|
10
|
-
React.createElement("span", { className: 'free-shipping-comp-attr' },
|
|
11
|
-
React.createElement("span", null, translate('account.notifications_messages.freeShippingText1')),
|
|
12
|
-
React.createElement("span", { className: 'range-value' }, handlePriceCheckFunc(freeShippingRange, currency)),
|
|
13
|
-
React.createElement("span", null, translate('account.notifications_messages.freeShippingText2'))))) : typeof shippingCost != 'number' ? (React.createElement(FreeShippingCompStyle, null,
|
|
13
|
+
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
14
|
React.createElement("svg", { fill: 'none', viewBox: '0 0 16 16', xmlns: 'http://www.w3.org/2000/svg', className: 'free-shipping-comp-icon' },
|
|
15
15
|
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' },
|
|
17
|
-
React.createElement("span", null, translate('account.notifications_messages.youHaveReachedFreeShipping')),
|
|
18
|
-
React.createElement("span", { className: 'range-value' },
|
|
19
|
-
handlePriceCheckFunc(shippingCostValue, currency),
|
|
20
|
-
"!")))) : null;
|
|
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;
|
|
21
17
|
};
|
|
22
18
|
export default FreeShippingComp;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { handlePriceCheckFunc, useTranslation } from '@weareconceptstudio/core';
|
|
3
|
+
import { useAccountContext } from '../../../AccountProvider';
|
|
4
|
+
//* Style
|
|
5
|
+
import GiftCompStyle from './style';
|
|
6
|
+
const GiftComp = () => {
|
|
7
|
+
const { translate } = useTranslation();
|
|
8
|
+
const { useCart } = useAccountContext();
|
|
9
|
+
const { hasFreeGift, giftThresholdRemaining, currency } = useCart();
|
|
10
|
+
return giftThresholdRemaining && !hasFreeGift ? (React.createElement(GiftCompStyle, null,
|
|
11
|
+
React.createElement("svg", { fill: 'none', viewBox: '0 0 24 23', className: 'gift-comp-icon', xmlns: 'http://www.w3.org/2000/svg' },
|
|
12
|
+
React.createElement("path", { d: 'M20.25 5.75003H16.9613C16.9978 5.71909 17.0353 5.68909 17.0709 5.65628C17.3557 5.40332 17.5851 5.09433 17.745 4.74864C17.9049 4.40295 17.9917 4.02799 18 3.64721C18.0123 3.23066 17.9394 2.81598 17.7856 2.42864C17.6319 2.0413 17.4006 1.68947 17.106 1.39474C16.8113 1.10002 16.4596 0.86863 16.0723 0.714771C15.685 0.560913 15.2703 0.487836 14.8538 0.500027C14.4728 0.508232 14.0977 0.594982 13.7518 0.754846C13.406 0.91471 13.0968 1.14425 12.8438 1.42909C12.4936 1.83493 12.2089 2.29294 12 2.78659C11.7911 2.29294 11.5064 1.83493 11.1562 1.42909C10.9032 1.14425 10.594 0.91471 10.2482 0.754846C9.90232 0.594982 9.52718 0.508232 9.14625 0.500027C8.72969 0.487836 8.31503 0.560913 7.92774 0.714771C7.54044 0.86863 7.18868 1.10002 6.89405 1.39474C6.59941 1.68947 6.36812 2.0413 6.21438 2.42864C6.06064 2.81598 5.98768 3.23066 6 3.64721C6.00833 4.02799 6.09514 4.40295 6.255 4.74864C6.41486 5.09433 6.64434 5.40332 6.92906 5.65628C6.96469 5.68721 7.00219 5.71721 7.03875 5.75003H3.75C3.35218 5.75003 2.97064 5.90806 2.68934 6.18937C2.40804 6.47067 2.25 6.8522 2.25 7.25003V10.25C2.25 10.6479 2.40804 11.0294 2.68934 11.3107C2.97064 11.592 3.35218 11.75 3.75 11.75V17.75C3.75 18.1479 3.90804 18.5294 4.18934 18.8107C4.47064 19.092 4.85218 19.25 5.25 19.25H10.875C10.9745 19.25 11.0698 19.2105 11.1402 19.1402C11.2105 19.0699 11.25 18.9745 11.25 18.875V10.25H3.75V7.25003H11.25V10.25H12.75V7.25003H20.25V10.25H12.75V18.875C12.75 18.9745 12.7895 19.0699 12.8598 19.1402C12.9302 19.2105 13.0255 19.25 13.125 19.25H18.75C19.1478 19.25 19.5294 19.092 19.8107 18.8107C20.092 18.5294 20.25 18.1479 20.25 17.75V11.75C20.6478 11.75 21.0294 11.592 21.3107 11.3107C21.592 11.0294 21.75 10.6479 21.75 10.25V7.25003C21.75 6.8522 21.592 6.47067 21.3107 6.18937C21.0294 5.90806 20.6478 5.75003 20.25 5.75003ZM7.92281 4.53128C7.79168 4.41253 7.68651 4.26795 7.61391 4.10661C7.54131 3.94528 7.50285 3.77068 7.50094 3.59378C7.4962 3.3865 7.53287 3.18036 7.60881 2.98743C7.68476 2.79451 7.79844 2.61868 7.9432 2.47025C8.08796 2.32182 8.26089 2.20378 8.45186 2.12304C8.64282 2.04229 8.84798 2.00047 9.05531 2.00003H9.10125C9.27815 2.00194 9.45275 2.0404 9.61409 2.113C9.77542 2.1856 9.92 2.29077 10.0388 2.4219C10.8253 3.31065 11.1028 4.7844 11.2003 5.69565C10.2853 5.59909 8.8125 5.32159 7.92281 4.53128ZM16.0791 4.53128C15.1894 5.31878 13.7128 5.59628 12.7978 5.69378C12.9094 4.70846 13.2188 3.26565 13.9688 2.42284C14.0875 2.2917 14.2321 2.18653 14.3934 2.11393C14.5547 2.04133 14.7293 2.00287 14.9062 2.00096H14.9522C15.1595 2.00226 15.3645 2.04493 15.5552 2.12647C15.7458 2.20801 15.9183 2.32678 16.0624 2.47582C16.2066 2.62487 16.3195 2.80118 16.3947 2.99444C16.4698 3.18769 16.5056 3.394 16.5 3.60128C16.4969 3.77698 16.4578 3.95019 16.3851 4.11016C16.3124 4.27013 16.2076 4.41347 16.0772 4.53128H16.0791Z' })),
|
|
13
|
+
React.createElement("span", { className: 'gift-comp-attr' }, translate('account.notifications_messages.giftNote', { price: React.createElement("span", { className: 'range-value' }, handlePriceCheckFunc(giftThresholdRemaining, currency)) })))) : hasFreeGift ? (React.createElement(GiftCompStyle, null,
|
|
14
|
+
React.createElement("svg", { fill: 'none', viewBox: '0 0 16 16', className: 'gift-comp-icon', xmlns: 'http://www.w3.org/2000/svg' },
|
|
15
|
+
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: 'gift-comp-attr' }, translate('account.notifications_messages.giftSuccessText')))) : null;
|
|
17
|
+
};
|
|
18
|
+
export default GiftComp;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export default GiftCompStyle;
|
|
2
|
+
declare const GiftCompStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
const GiftCompStyle = styled.div `
|
|
3
|
+
--account_giftBlockDistance: var(--sp5x);
|
|
4
|
+
--account_giftBlockPadTB: var(--sp2-5x);
|
|
5
|
+
--account_giftBlockPadLR: var(--sp2-5x);
|
|
6
|
+
--account_giftIconSize: var(--sp3x);
|
|
7
|
+
--account_giftAttrGap: var(--sp1-5x);
|
|
8
|
+
|
|
9
|
+
display: flex;
|
|
10
|
+
gap: var(--account_giftAttrGap);
|
|
11
|
+
|
|
12
|
+
margin: var(--account_giftBlockDistance) 0;
|
|
13
|
+
margin-bottom: 0;
|
|
14
|
+
background-color: var(--account_surfaceColor);
|
|
15
|
+
padding: var(--account_giftBlockPadTB) var(--account_giftBlockPadLR);
|
|
16
|
+
border-radius: var(--sp1x);
|
|
17
|
+
|
|
18
|
+
.gift-comp-icon {
|
|
19
|
+
max-width: var(--account_giftIconSize);
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: var(--account_giftIconSize);
|
|
22
|
+
fill: var(--account_primaryColor3);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.gift-comp-attr {
|
|
26
|
+
color: var(--account_primaryColor2);
|
|
27
|
+
font-family: var(--account_Font);
|
|
28
|
+
font-size: var(--account_p4);
|
|
29
|
+
line-height: var(--account_lineHeight);
|
|
30
|
+
font-weight: 400;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.range-value {
|
|
34
|
+
font-weight: 700;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* //! 1920 */
|
|
38
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeL}) {
|
|
39
|
+
--account_giftBlockDistance: var(--sp3-5x);
|
|
40
|
+
--account_giftBlockPadTB: var(--sp2x);
|
|
41
|
+
--account_giftBlockPadLR: var(--sp2x);
|
|
42
|
+
--account_giftIconSize: var(--sp3x);
|
|
43
|
+
--account_giftAttrGap: var(--sp1x);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* //! 1510 */
|
|
47
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeM}) {
|
|
48
|
+
--account_giftBlockDistance: var(--sp4x);
|
|
49
|
+
--account_giftBlockPadTB: var(--sp2x);
|
|
50
|
+
--account_giftBlockPadLR: var(--sp2x);
|
|
51
|
+
--account_giftIconSize: var(--sp2-5x);
|
|
52
|
+
--account_giftAttrGap: var(--sp1x);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* //! 1440 */
|
|
56
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeMMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeS}) {
|
|
57
|
+
--account_giftBlockDistance: var(--sp3x);
|
|
58
|
+
--account_giftBlockPadTB: var(--sp2x);
|
|
59
|
+
--account_giftBlockPadLR: var(--sp2x);
|
|
60
|
+
--account_giftIconSize: var(--sp2-5x);
|
|
61
|
+
--account_giftAttrGap: var(--sp1x);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* //! 1280 */
|
|
65
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXS}) {
|
|
66
|
+
--account_giftBlockDistance: var(--sp3x);
|
|
67
|
+
--account_giftBlockPadTB: var(--sp2x);
|
|
68
|
+
--account_giftBlockPadLR: var(--sp2x);
|
|
69
|
+
--account_giftIconSize: var(--sp2-5x);
|
|
70
|
+
--account_giftAttrGap: var(--sp1x);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* //! 1024 */
|
|
74
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSize}) {
|
|
75
|
+
--account_giftBlockDistance: var(--sp3x);
|
|
76
|
+
--account_giftBlockPadTB: var(--sp2x);
|
|
77
|
+
--account_giftBlockPadLR: var(--sp2x);
|
|
78
|
+
--account_giftIconSize: var(--sp2-5x);
|
|
79
|
+
--account_giftAttrGap: var(--sp1x);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* //! 768 */
|
|
83
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeS}) {
|
|
84
|
+
--account_giftBlockDistance: var(--sp3x);
|
|
85
|
+
--account_giftBlockPadTB: var(--sp2x);
|
|
86
|
+
--account_giftBlockPadLR: var(--sp2x);
|
|
87
|
+
--account_giftIconSize: var(--sp2-5x);
|
|
88
|
+
--account_giftAttrGap: var(--sp1x);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* //! Mobile */
|
|
92
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeSMin}) {
|
|
93
|
+
--account_giftBlockDistance: var(--sp3x);
|
|
94
|
+
--account_giftBlockPadTB: var(--sp2x);
|
|
95
|
+
--account_giftBlockPadLR: var(--sp2x);
|
|
96
|
+
--account_giftIconSize: var(--sp2-5x);
|
|
97
|
+
--account_giftAttrGap: var(--sp1x);
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
export default GiftCompStyle;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export default PromoCodeComp;
|
|
2
|
-
declare function PromoCodeComp({ isPromoCode
|
|
2
|
+
declare function PromoCodeComp({ isPromoCode }: {
|
|
3
3
|
isPromoCode?: boolean;
|
|
4
|
-
promotionHandler: any;
|
|
5
|
-
usePromotion: any;
|
|
6
|
-
getItemCount: any;
|
|
7
|
-
appliedPromotions: any;
|
|
8
4
|
}): React.JSX.Element;
|
|
9
5
|
import React from 'react';
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import { Text, CollapseItem } from '@weareconceptstudio/core';
|
|
3
3
|
import { FormBuilder } from '@weareconceptstudio/form';
|
|
4
|
+
import { useAccountContext } from '../../../AccountProvider';
|
|
5
|
+
import { useCheckoutContext } from '../../../modules';
|
|
4
6
|
import AccountButton from '../../AccountButton';
|
|
5
7
|
import AppliedPromotion from './AppliedPromotion';
|
|
6
8
|
import { promoCodeFields } from './utils';
|
|
7
9
|
//* Style
|
|
8
10
|
import PromoCodeCompStyle from './style';
|
|
9
|
-
const PromoCodeComp = ({ isPromoCode = true
|
|
10
|
-
|
|
11
|
+
const PromoCodeComp = ({ isPromoCode = true }) => {
|
|
12
|
+
const { useCart } = useAccountContext();
|
|
13
|
+
const { itemsCount, usePromotion, appliedPromotions } = useCart();
|
|
14
|
+
const { fillCart } = useCheckoutContext();
|
|
11
15
|
const [disable, setDisable] = useState(false);
|
|
12
|
-
|
|
16
|
+
const handlePromotion = (promotion) => {
|
|
17
|
+
fillCart('usePromotion', promotion);
|
|
18
|
+
};
|
|
13
19
|
const onFinish = (values) => {
|
|
14
20
|
setDisable(true);
|
|
15
|
-
|
|
21
|
+
handlePromotion(values.promo_code);
|
|
16
22
|
};
|
|
17
23
|
const promotions = useMemo(() => {
|
|
18
24
|
return appliedPromotions?.map((promotion) => React.createElement(AppliedPromotion, { ...promotion }));
|
|
19
25
|
}, [appliedPromotions]);
|
|
20
|
-
return isPromoCode ? (React.createElement(PromoCodeCompStyle, { className: `collapse-distance ${
|
|
21
|
-
React.createElement(CollapseItem, { status: appliedPromotions?.length ? 'open' : '
|
|
26
|
+
return isPromoCode ? (React.createElement(PromoCodeCompStyle, { className: `collapse-distance ${itemsCount ? '' : 'disable'}` },
|
|
27
|
+
React.createElement(CollapseItem, { status: appliedPromotions?.length ? 'open' : 'close', disable: disable, title: React.createElement(React.Fragment, null,
|
|
22
28
|
React.createElement("div", { className: 'inner-wrapper-icon' },
|
|
23
29
|
React.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '12', height: '12', viewBox: '0 0 12 12', fill: 'none' },
|
|
24
30
|
React.createElement("path", { d: 'M0 6H12', stroke: 'black', strokeWidth: '2' }),
|
|
@@ -26,7 +32,7 @@ const PromoCodeComp = ({ isPromoCode = true, promotionHandler, usePromotion, get
|
|
|
26
32
|
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,
|
|
27
33
|
promotions,
|
|
28
34
|
usePromotion ? (React.createElement(AppliedPromotion, { name: usePromotion, onClick: () => {
|
|
29
|
-
|
|
35
|
+
handlePromotion(null);
|
|
30
36
|
setDisable(false);
|
|
31
37
|
} })) : (React.createElement(FormBuilder, { onSubmit: onFinish, fields: promoCodeFields, className: `promo-code-block`, formOptions: {
|
|
32
38
|
className: 'promo-code-container',
|
|
@@ -7,22 +7,17 @@ import FreeShippingComp from './FreeShippingComp';
|
|
|
7
7
|
import PromoCodeComp from './PromoCodeComp';
|
|
8
8
|
import BalanceComp from './BalanceComp';
|
|
9
9
|
import CommentComp from './CommentComp';
|
|
10
|
+
import GiftComp from './GiftComp';
|
|
10
11
|
//* Style
|
|
11
12
|
import TotalCheckoutStyle from './style';
|
|
12
13
|
//* Skeleton
|
|
13
14
|
import SkeletonTotalCheckout from './Skeleton';
|
|
14
15
|
const TotalCheckout = memo(({ isShipping, children, confirmation, buttonProps }) => {
|
|
15
|
-
const {
|
|
16
|
-
const {
|
|
16
|
+
const { useCart, useUser } = useAccountContext();
|
|
17
|
+
const { checkoutBtnDisabled, isCheckoutPage } = useCheckoutContext();
|
|
17
18
|
const { addressLoading } = useAddressContext();
|
|
18
19
|
const { user } = useUser();
|
|
19
|
-
const { itemsCount, shippingCost,
|
|
20
|
-
const handleBalance = (amount) => {
|
|
21
|
-
fillCart('useBalance', amount);
|
|
22
|
-
};
|
|
23
|
-
const handlePromotion = (promotion) => {
|
|
24
|
-
fillCart('usePromotion', promotion);
|
|
25
|
-
};
|
|
20
|
+
const { itemsCount, shippingCost, total, subtotal, useBalance, loading, discount, currency } = useCart();
|
|
26
21
|
const innerCollapseRef = useRef(null);
|
|
27
22
|
//! disable keypress on input
|
|
28
23
|
useEffect(() => {
|
|
@@ -74,12 +69,13 @@ const TotalCheckout = memo(({ isShipping, children, confirmation, buttonProps })
|
|
|
74
69
|
React.createElement("div", { className: `od-item-wrap` },
|
|
75
70
|
React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1 sticky-wrap-total`, text: `account.order_balance.total` }),
|
|
76
71
|
React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1 sticky-wrap-currency2`, text: itemsCount ? handlePriceCheckFunc(total, currency) : `0 ${currency}` })),
|
|
77
|
-
|
|
72
|
+
React.createElement(GiftComp, null),
|
|
73
|
+
!isCheckoutPage ? React.createElement(FreeShippingComp, null) : null,
|
|
78
74
|
React.createElement(CollapseContainer, { className: 'collapse-container-wrapper' },
|
|
79
75
|
React.createElement("div", { ref: innerCollapseRef },
|
|
80
|
-
React.createElement(BalanceComp,
|
|
81
|
-
React.createElement(PromoCodeComp,
|
|
82
|
-
isCheckoutPage && typeof isShipping === 'boolean' && !isShipping ? React.createElement(CommentComp,
|
|
76
|
+
React.createElement(BalanceComp, null),
|
|
77
|
+
React.createElement(PromoCodeComp, null))),
|
|
78
|
+
isCheckoutPage && typeof isShipping === 'boolean' && !isShipping ? React.createElement(CommentComp, null) : null,
|
|
83
79
|
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))))));
|
|
84
80
|
});
|
|
85
81
|
export default TotalCheckout;
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
import React, { memo
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
2
|
import { handlePriceCheckFunc, Image, Text } from '@weareconceptstudio/core';
|
|
3
|
-
import {
|
|
4
|
-
import { AccountButton } from '../../../../components';
|
|
3
|
+
import { AccountButton, AccountCounter } from '../../../../components';
|
|
5
4
|
import { useAccountContext } from '../../../../AccountProvider';
|
|
6
|
-
|
|
5
|
+
import { defaultIconGift } from '../util';
|
|
6
|
+
const Item = memo(({ data, remove, select, isLast, actions, currency, isGift, giftIcon }) => {
|
|
7
7
|
const { handleProductClick } = useAccountContext();
|
|
8
|
-
|
|
9
|
-
if (select) {
|
|
10
|
-
const selectList = [];
|
|
11
|
-
for (let index = 1; index <= maxQty; index++) {
|
|
12
|
-
selectList.push({ id: index, name: index });
|
|
13
|
-
}
|
|
14
|
-
return selectList;
|
|
15
|
-
}
|
|
16
|
-
}, [data, select, maxQty]);
|
|
17
|
-
return (React.createElement("div", { className: `item-wrap` },
|
|
8
|
+
return (React.createElement("div", { className: `${isGift ? 'item-gift-wrap' : 'item-wrap'}` },
|
|
18
9
|
React.createElement("div", { className: 'line' }),
|
|
19
|
-
React.createElement("div", { className:
|
|
10
|
+
React.createElement("div", { className: `${isGift ? 'item-gift-inner-wrapper' : 'item-inner-wrapper'}` },
|
|
20
11
|
React.createElement("div", { className: `col-item tl-col-1 col-item-1` },
|
|
21
12
|
React.createElement("div", { className: `image-wrapper` },
|
|
13
|
+
isGift ? giftIcon || React.createElement("div", { className: 'wrapper-gift-icon' }, defaultIconGift) : null,
|
|
22
14
|
React.createElement(Image, { src: data.product.image.src, alt: data.product.image.alt })),
|
|
23
15
|
React.createElement("div", { className: `col-1-right-wrap` },
|
|
24
16
|
React.createElement(AccountButton, { text: data.product.name, btnType: `green-large-text`, className: `capitalize title-btn`, onClick: () => handleProductClick(data.product) }),
|
|
@@ -26,20 +18,18 @@ const Item = memo(({ data, remove, select, isLast, actions, maxQty, currency })
|
|
|
26
18
|
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1`, text: data.product.short_info_1 })),
|
|
27
19
|
React.createElement("div", { className: `right-second-item-wrap` },
|
|
28
20
|
React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1`, text: data.product.short_info_2 })))),
|
|
29
|
-
React.createElement("div", { className: `col-item tl-col-2` }, select ? (React.createElement("div", { className: `select-and-out-of-stock-wrap` }, !data.product?.out_of_stock ? (React.createElement(
|
|
30
|
-
|
|
31
|
-
productId: data.product.id,
|
|
32
|
-
}) })) : (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: data.qty })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: data.qty }))),
|
|
21
|
+
React.createElement("div", { className: `col-item tl-col-2` }, select && !isGift ? (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: data.qty })))) : isGift ? (React.createElement("div", { className: 'wrapper-gift-button' },
|
|
22
|
+
React.createElement(AccountButton, { text: 'account.general_actions.restore', className: `button-gift` }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: data.qty }))),
|
|
33
23
|
React.createElement("div", { className: `col-item tl-col-3 col-item-3 nowrap` }, data.product?.sale_price ? (React.createElement("div", null,
|
|
34
24
|
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) }),
|
|
35
|
-
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.product.price, currency) }))),
|
|
25
|
+
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(isGift ? 0 : data.product.price, currency) }))),
|
|
36
26
|
React.createElement("div", { className: `col-item tl-col-4 col-item-4 nowrap` },
|
|
37
27
|
React.createElement("div", { className: `col-item-inner-wrap` },
|
|
38
|
-
React.createElement("div", { className: `flex-end-wrap` }, data.product?.sale_price ? (React.createElement("div", null,
|
|
28
|
+
React.createElement("div", { className: `flex-end-wrap` }, data.product?.sale_price && !isGift ? (React.createElement("div", null,
|
|
39
29
|
React.createElement(Text, { className: `account-p account-p3 account-font-bold account-secondary-color2 align-right cart-sale-total`, text: `${data.sale_total} ${currency}` }),
|
|
40
|
-
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right cart-total1`, text: handlePriceCheckFunc(data.product.price * data.qty, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right cart-total2`, text: `${data.total} ${currency}` }))),
|
|
41
|
-
React.createElement("div", { className: `favorite-and-remove-wrap` }, remove && (React.createElement("div", { className: `remove-btn-wrap` },
|
|
42
|
-
React.createElement(AccountButton, {
|
|
30
|
+
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right cart-total1`, text: handlePriceCheckFunc(data.product.price * data.qty, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right cart-total2`, text: `${isGift ? 0 : data.total} ${currency}` }))),
|
|
31
|
+
React.createElement("div", { className: `favorite-and-remove-wrap` }, remove && !isGift && (React.createElement("div", { className: `remove-btn-wrap` },
|
|
32
|
+
React.createElement(AccountButton, { btnType: `green-small-text`, className: 'cart-remove-btn', text: 'account.general_actions.remove', onClick: () => actions.delete({ productId: data.product?.id }) }))))))),
|
|
43
33
|
isLast ? React.createElement("div", { className: 'line' }) : null));
|
|
44
34
|
});
|
|
45
35
|
export default Item;
|
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
import React, { memo
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
2
|
import { handlePriceCheckFunc, Image, Text, useTranslation } from '@weareconceptstudio/core';
|
|
3
|
-
import { Select } from '@weareconceptstudio/form';
|
|
4
3
|
import { AccountButton, AccountCounter } from '../../../../components';
|
|
5
4
|
import { useAccountContext } from '../../../../AccountProvider';
|
|
6
|
-
|
|
5
|
+
import { defaultIconGift } from '../util';
|
|
6
|
+
const ItemMobile = memo(({ data, select, currency, isGift, giftIcon }) => {
|
|
7
7
|
const { handleProductClick } = useAccountContext();
|
|
8
8
|
const { translate } = useTranslation();
|
|
9
|
-
// const selectionList = useMemo(() => {
|
|
10
|
-
// if (select) {
|
|
11
|
-
// const selectList = [];
|
|
12
|
-
// for (let index = 1; index <= maxQty; index++) {
|
|
13
|
-
// selectList.push({ id: index, name: index });
|
|
14
|
-
// }
|
|
15
|
-
// return selectList;
|
|
16
|
-
// }
|
|
17
|
-
// }, [data, select, maxQty]);
|
|
18
9
|
return (React.createElement(React.Fragment, null,
|
|
19
|
-
React.createElement("div", { className:
|
|
20
|
-
React.createElement("div", { className:
|
|
10
|
+
React.createElement("div", { className: `${isGift ? 'mobile-order-item-gift-wrap' : 'mobile-order-item-wrap'} user-select-none` },
|
|
11
|
+
React.createElement("div", { className: `${isGift ? 'mobile-order-item-gift-inner-wrap' : 'mobile-order-item-inner-wrap'}` },
|
|
21
12
|
React.createElement("div", { className: `mobile-image-wrap` },
|
|
13
|
+
isGift ? giftIcon || React.createElement("div", { className: 'wrapper-gift-icon' }, defaultIconGift) : null,
|
|
22
14
|
React.createElement(Image, { src: data.product.image.src, alt: data.product.image.alt })),
|
|
23
15
|
React.createElement("div", { className: `mobile-info-wrap` },
|
|
24
16
|
React.createElement(AccountButton, { text: data.product.name, btnType: `green-large-text`, className: `capitalize mobile-info-wrap-title`, onClick: () => handleProductClick(data.product) }),
|
|
25
17
|
React.createElement("div", { className: 'mobile-info-item' },
|
|
26
18
|
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 mobile-short-info1`, text: data.product.short_info_1 })),
|
|
27
19
|
React.createElement("div", { className: `mobile-total-price-wrap nowrap flex-box` },
|
|
28
|
-
data.product?.sale_price ? (React.createElement("div", { className: 'mobile-total-price-flex-block' },
|
|
20
|
+
data.product?.sale_price && !isGift ? (React.createElement("div", { className: 'mobile-total-price-flex-block' },
|
|
29
21
|
React.createElement(Text, { className: `account-p account-p3 account-font-bold account-secondary-color2 mobile-total-discounted-price`, text: `${data.sale_total} ${currency}` }),
|
|
30
|
-
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through mobile-total-price`, text: handlePriceCheckFunc(data.product.price * data.qty, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 mobile-total-price2`, text: `${data.total} ${currency}` })),
|
|
31
|
-
select ? (React.createElement("div", { className: `inner-container` }, !data.product?.out_of_stock ? (React.createElement(AccountCounter, { productId: data?.product.id })) : (React.createElement("div", { className: `in-block` },
|
|
22
|
+
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through mobile-total-price`, text: handlePriceCheckFunc(data.product.price * data.qty, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 mobile-total-price2`, text: `${isGift ? 0 : data.total} ${currency}` })),
|
|
23
|
+
select ? (React.createElement("div", { className: `inner-container` }, !data.product?.out_of_stock && !isGift ? (React.createElement(AccountCounter, { productId: data?.product.id })) : isGift ? null : (React.createElement("div", { className: `in-block` },
|
|
32
24
|
React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mobile-quantity-with-symbol` },
|
|
33
25
|
translate('account.order_balance.quantity'),
|
|
34
26
|
":"),
|
|
@@ -38,7 +30,9 @@ const ItemMobile = memo(({ data, remove, select, actions, maxQty, currency }) =>
|
|
|
38
30
|
translate('account.order_balance.quantity'),
|
|
39
31
|
":"),
|
|
40
32
|
"\u00A0",
|
|
41
|
-
React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mobile-quantity2`, text: data.qty })))
|
|
33
|
+
React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mobile-quantity2`, text: data.qty }))),
|
|
34
|
+
isGift ? (React.createElement("div", { className: 'wrapper-gift-button' },
|
|
35
|
+
React.createElement(AccountButton, { text: 'account.general_actions.restore', className: `capitalize button-gift` }))) : null)))),
|
|
42
36
|
React.createElement("div", { className: 'line' })));
|
|
43
37
|
});
|
|
44
38
|
export default ItemMobile;
|
|
@@ -24,11 +24,11 @@ const CartItems = memo(({ data, className, title, smallFontSize, additionalParam
|
|
|
24
24
|
React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 nowrap align-right`, text: `account.order_balance.total` }))),
|
|
25
25
|
React.createElement("div", { className: `items-wrap` }, data?.length > 0
|
|
26
26
|
? data.map((item, index) => {
|
|
27
|
-
return (React.createElement(Item, { key: index, data: item, maxQty: maxQty, actions: actions, currency: currency, isLast: data.length - 1 == index, select: additionalParameters.select, remove: additionalParameters.remove, edit: additionalParameters.edit.item }));
|
|
27
|
+
return (React.createElement(Item, { key: index, data: item, maxQty: maxQty, actions: actions, currency: currency, isGift: item.is_gift, isLast: data.length - 1 == index, select: additionalParameters.select, remove: additionalParameters.remove, edit: additionalParameters.edit.item }));
|
|
28
28
|
})
|
|
29
29
|
: null))) : (React.createElement("div", { className: `mobile-order-items-table-wrap` }, data?.length > 0
|
|
30
30
|
? data.map((item, index) => {
|
|
31
|
-
return (React.createElement(ItemMobile, { key: index, data: item, maxQty: maxQty, actions: actions, currency: currency, select: additionalParameters.select, remove: additionalParameters.remove, edit: additionalParameters.edit.item }));
|
|
31
|
+
return (React.createElement(ItemMobile, { key: index, data: item, maxQty: maxQty, actions: actions, currency: currency, isGift: item.is_gift, select: additionalParameters.select, remove: additionalParameters.remove, edit: additionalParameters.edit.item }));
|
|
32
32
|
})
|
|
33
33
|
: null));
|
|
34
34
|
}, [winWidth, data, additionalParameters, currency, actions, maxQty]);
|
|
@@ -42,6 +42,15 @@ const CartItemsStyle = styled.section `
|
|
|
42
42
|
|
|
43
43
|
--account_cartItemSelectFixedWidth: calc(var(--sp9x) + var(--sp0-5x));
|
|
44
44
|
|
|
45
|
+
--account_giftIconDistanceIconPTB: var(--sp0-5x);
|
|
46
|
+
--account_giftIconDistanceIconPLR: var(--sp0-5x);
|
|
47
|
+
--account_giftIconDistanceIconMTB: var(--sp0-5x);
|
|
48
|
+
--account_giftIconDistanceIconMLR: var(--sp0-5x);
|
|
49
|
+
--account_giftWrapperBorder: calc(var(--sp0-5x) + var(--sp0-5x) / 2);
|
|
50
|
+
--account_giftSizeIcon: var(--sp2x);
|
|
51
|
+
--account_giftButtonTB: calc(var(--sp2x) - var(--sp0-5x) / 2);
|
|
52
|
+
--account_giftButtonLR: var(--sp2x);
|
|
53
|
+
|
|
45
54
|
.mobile-info-wrap-title {
|
|
46
55
|
a,
|
|
47
56
|
button {
|
|
@@ -78,12 +87,14 @@ const CartItemsStyle = styled.section `
|
|
|
78
87
|
}
|
|
79
88
|
|
|
80
89
|
.items-wrap {
|
|
81
|
-
.item-wrap
|
|
90
|
+
.item-wrap,
|
|
91
|
+
.item-gift-wrap {
|
|
82
92
|
display: flex;
|
|
83
93
|
flex-direction: column;
|
|
84
94
|
|
|
85
95
|
.col-item {
|
|
86
96
|
.image-wrapper {
|
|
97
|
+
position: relative;
|
|
87
98
|
overflow: hidden;
|
|
88
99
|
max-width: var(--account_imageWidth);
|
|
89
100
|
width: 100%;
|
|
@@ -97,7 +108,8 @@ const CartItemsStyle = styled.section `
|
|
|
97
108
|
}
|
|
98
109
|
}
|
|
99
110
|
|
|
100
|
-
.item-inner-wrapper
|
|
111
|
+
.item-inner-wrapper,
|
|
112
|
+
.item-gift-inner-wrapper {
|
|
101
113
|
display: flex;
|
|
102
114
|
padding: var(--account_itemWrapPadTB) 0;
|
|
103
115
|
}
|
|
@@ -268,6 +280,42 @@ const CartItemsStyle = styled.section `
|
|
|
268
280
|
}
|
|
269
281
|
}
|
|
270
282
|
|
|
283
|
+
.wrapper-gift-icon {
|
|
284
|
+
padding: var(--account_giftIconDistanceIconPTB) var(--account_giftIconDistanceIconPLR);
|
|
285
|
+
margin: var(--account_giftIconDistanceIconMTB) var(--account_giftIconDistanceIconMLR);
|
|
286
|
+
position: absolute;
|
|
287
|
+
z-index: 1;
|
|
288
|
+
width: fit-content;
|
|
289
|
+
height: fit-content;
|
|
290
|
+
display: flex;
|
|
291
|
+
top: 0;
|
|
292
|
+
background-color: var(--account_secondaryColor9);
|
|
293
|
+
border-radius: var(--account_giftWrapperBorder);
|
|
294
|
+
|
|
295
|
+
svg {
|
|
296
|
+
width: var(--account_giftSizeIcon);
|
|
297
|
+
height: auto;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.button-gift {
|
|
302
|
+
--account_btnPadTB: var(--account_giftButtonTB);
|
|
303
|
+
--account_btnPadLR: var(--account_giftButtonLR);
|
|
304
|
+
|
|
305
|
+
button {
|
|
306
|
+
font-size: var(--account_p4);
|
|
307
|
+
font-weight: 500;
|
|
308
|
+
|
|
309
|
+
:first-letter {
|
|
310
|
+
text-transform: uppercase;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
&:hover {
|
|
314
|
+
border: unset;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
271
319
|
.flex-box {
|
|
272
320
|
display: flex;
|
|
273
321
|
flex-wrap: wrap;
|
|
@@ -339,6 +387,10 @@ const CartItemsStyle = styled.section `
|
|
|
339
387
|
|
|
340
388
|
--account_outOfStockMBot: var(--sp3x);
|
|
341
389
|
|
|
390
|
+
--account_giftWrapperBorder: var(--sp0-5x);
|
|
391
|
+
--account_giftButtonTB: var(--sp1x);
|
|
392
|
+
--account_giftButtonLR: var(--sp2x);
|
|
393
|
+
|
|
342
394
|
&.cart-st-wrap {
|
|
343
395
|
--account_spaceLineMTop: var(--sp2x);
|
|
344
396
|
--account_spaceLineMBot: var(--sp5x);
|
|
@@ -383,6 +435,10 @@ const CartItemsStyle = styled.section `
|
|
|
383
435
|
|
|
384
436
|
--account_outOfStockMBot: var(--sp3x);
|
|
385
437
|
|
|
438
|
+
--account_giftWrapperBorder: var(--sp0-5x);
|
|
439
|
+
--account_giftButtonTB: var(--sp1x);
|
|
440
|
+
--account_giftButtonLR: var(--sp2x);
|
|
441
|
+
|
|
386
442
|
&.cart-st-wrap {
|
|
387
443
|
--account_spaceLineMTop: var(--sp2x);
|
|
388
444
|
--account_spaceLineMBot: var(--sp4x);
|
|
@@ -427,6 +483,10 @@ const CartItemsStyle = styled.section `
|
|
|
427
483
|
|
|
428
484
|
--account_outOfStockMBot: var(--sp3x);
|
|
429
485
|
|
|
486
|
+
--account_giftWrapperBorder: var(--sp0-5x);
|
|
487
|
+
--account_giftButtonTB: var(--sp1x);
|
|
488
|
+
--account_giftButtonLR: var(--sp2x);
|
|
489
|
+
|
|
430
490
|
&.cart-st-wrap {
|
|
431
491
|
--account_spaceLineMTop: var(--sp2x);
|
|
432
492
|
--account_spaceLineMBot: var(--sp4x);
|
|
@@ -471,6 +531,13 @@ const CartItemsStyle = styled.section `
|
|
|
471
531
|
--account_titleEditWrapperMBot: var(--sp4x);
|
|
472
532
|
|
|
473
533
|
--account_outOfStockMBot: var(--sp3x);
|
|
534
|
+
--account_giftSizeIcon: calc(var(--sp2x) - var(--sp0-5x) / 2);
|
|
535
|
+
--account_giftIconDistanceIconPTB: calc(var(--sp0-5x) / 2);
|
|
536
|
+
--account_giftIconDistanceIconPLR: calc(var(--sp0-5x) / 2);
|
|
537
|
+
|
|
538
|
+
--account_giftWrapperBorder: var(--sp0-5x);
|
|
539
|
+
--account_giftButtonTB: var(--sp1x);
|
|
540
|
+
--account_giftButtonLR: var(--sp2x);
|
|
474
541
|
|
|
475
542
|
&.cart-st-wrap {
|
|
476
543
|
--account_spaceLineMTop: var(--sp2x);
|
|
@@ -518,6 +585,13 @@ const CartItemsStyle = styled.section `
|
|
|
518
585
|
|
|
519
586
|
--account_outOfStockMBot: var(--sp3x);
|
|
520
587
|
|
|
588
|
+
--account_giftSizeIcon: calc(var(--sp2x) - var(--sp0-5x) / 2);
|
|
589
|
+
--account_giftIconDistanceIconPTB: calc(var(--sp0-5x) / 2);
|
|
590
|
+
--account_giftIconDistanceIconPLR: calc(var(--sp0-5x) / 2);
|
|
591
|
+
--account_giftWrapperBorder: var(--sp0-5x);
|
|
592
|
+
--account_giftButtonTB: var(--sp1x);
|
|
593
|
+
--account_giftButtonLR: var(--sp2x);
|
|
594
|
+
|
|
521
595
|
&.cart-st-wrap {
|
|
522
596
|
--account_spaceLineMTop: var(--sp2x);
|
|
523
597
|
--account_spaceLineMBot: var(--sp3x);
|
|
@@ -563,6 +637,13 @@ const CartItemsStyle = styled.section `
|
|
|
563
637
|
|
|
564
638
|
--account_outOfStockMBot: var(--sp2-5x);
|
|
565
639
|
|
|
640
|
+
--account_giftSizeIcon: calc(var(--sp2x) - var(--sp0-5x) / 2);
|
|
641
|
+
--account_giftIconDistanceIconPTB: calc(var(--sp0-5x) / 2);
|
|
642
|
+
--account_giftIconDistanceIconPLR: calc(var(--sp0-5x) / 2);
|
|
643
|
+
--account_giftWrapperBorder: var(--sp0-5x);
|
|
644
|
+
--account_giftButtonTB: var(--sp1x);
|
|
645
|
+
--account_giftButtonLR: var(--sp2x);
|
|
646
|
+
|
|
566
647
|
&.cart-st-wrap {
|
|
567
648
|
--account_spaceLineMTop: var(--sp2x);
|
|
568
649
|
--account_spaceLineMBot: var(--sp3x);
|
|
@@ -579,18 +660,28 @@ const CartItemsStyle = styled.section `
|
|
|
579
660
|
|
|
580
661
|
--account_col1Distance: 0;
|
|
581
662
|
|
|
663
|
+
--account_giftSizeIcon: calc(var(--sp2x) - var(--sp0-5x) / 2);
|
|
664
|
+
--account_giftIconDistanceIconPTB: calc(var(--sp0-5x) / 2);
|
|
665
|
+
--account_giftIconDistanceIconPLR: calc(var(--sp0-5x) / 2);
|
|
666
|
+
--account_giftWrapperBorder: var(--sp0-5x);
|
|
667
|
+
--account_giftButtonTB: var(--sp1x);
|
|
668
|
+
--account_giftButtonLR: var(--sp2x);
|
|
669
|
+
|
|
582
670
|
.mobile-order-items-table-wrap {
|
|
583
|
-
.mobile-order-item-wrap
|
|
671
|
+
.mobile-order-item-wrap,
|
|
672
|
+
.mobile-order-item-gift-wrap {
|
|
584
673
|
padding: var(--sp3x) 0;
|
|
585
674
|
|
|
586
675
|
.out-of-stock-mt {
|
|
587
676
|
margin-bottom: var(--sp3x);
|
|
588
677
|
}
|
|
589
678
|
|
|
590
|
-
.mobile-order-item-inner-wrap
|
|
679
|
+
.mobile-order-item-inner-wrap,
|
|
680
|
+
.mobile-order-item-gift-inner-wrap {
|
|
591
681
|
display: flex;
|
|
592
682
|
|
|
593
683
|
.mobile-image-wrap {
|
|
684
|
+
position: relative;
|
|
594
685
|
overflow: hidden;
|
|
595
686
|
border-radius: var(--sp1x);
|
|
596
687
|
isolation: isolate;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const defaultIconGift = (React.createElement("svg", { width: '14', height: '14', fill: 'none', viewBox: '0 0 14 14', xmlns: 'http://www.w3.org/2000/svg' },
|
|
3
|
+
React.createElement("path", { d: 'M7.78672 13.4663H11.846C12.1064 13.2066 12.252 13.061 12.5117 12.8006V7.95381H7.78672V13.4663ZM1.48672 7.95381V12.8006C1.74642 13.061 1.89202 13.2066 2.15242 13.4663H6.21172V7.95381H1.48672ZM9.55842 1.71471C10.418 1.71471 11.0186 2.81441 10.033 3.68381H7.75452L8.61202 2.22571C8.79752 1.90931 9.13772 1.71471 9.50452 1.71471H9.55842ZM2.33932 2.16341C2.20492 2.71431 2.28612 3.24281 2.51012 3.68381H1.36492C1.10452 3.94351 0.958919 4.08911 0.699219 4.34881V6.16811C0.958919 6.42781 1.10452 6.57341 1.36492 6.83381H12.6335C12.8939 6.57341 13.0395 6.42781 13.2992 6.16811V4.34881C13.0395 4.08911 12.8939 3.94351 12.6335 3.68381H11.4883C11.7123 3.24281 11.7935 2.71431 11.6591 2.16341C11.4211 1.19041 10.5076 0.53381 9.50662 0.53381H9.50452C8.71912 0.53381 7.99112 0.94961 7.59212 1.62651L6.99922 2.63731L6.40632 1.62861C6.00732 0.950311 5.27932 0.53381 4.49182 0.53381C3.49082 0.53381 2.57732 1.19041 2.33932 2.16341ZM5.38712 2.22641L6.24392 3.68381H3.96542C2.97982 2.81441 3.58042 1.71471 4.44002 1.71471H4.49392C4.86072 1.71471 5.20302 1.90931 5.38712 2.22641Z' })));
|
|
@@ -9,19 +9,22 @@ export const useCheckoutContext = () => {
|
|
|
9
9
|
export const CheckoutProvider = ({ children }) => {
|
|
10
10
|
const { selectedLang } = useTranslation();
|
|
11
11
|
const { useCart, useUser } = useAccountContext();
|
|
12
|
-
const { getCart, itemsCount } = useCart();
|
|
13
|
-
const { user } = useUser();
|
|
12
|
+
const { getCart, setCart, itemsCount, mergeCart } = useCart();
|
|
13
|
+
const { user, isLoggedIn } = useUser();
|
|
14
14
|
const form = useRef();
|
|
15
15
|
const [checkoutData, setCheckoutData] = useState({
|
|
16
16
|
addressId: null,
|
|
17
17
|
useBalance: null,
|
|
18
18
|
note: '',
|
|
19
|
-
paymentType: user?.payment_method ||
|
|
19
|
+
paymentType: user?.payment_method || 'cash_on_delivery',
|
|
20
20
|
});
|
|
21
21
|
const [idramForm, setIdramForm] = useState();
|
|
22
22
|
const isCheckoutPage = useMemo(() => {
|
|
23
23
|
return window.location.href.includes('checkout');
|
|
24
24
|
}, [window.location.href]);
|
|
25
|
+
const isCartPage = useMemo(() => {
|
|
26
|
+
return window.location.href.includes('cart');
|
|
27
|
+
}, [window.location.href]);
|
|
25
28
|
const checkoutBtnDisabled = useMemo(() => {
|
|
26
29
|
let isDisabled = false;
|
|
27
30
|
if (isCheckoutPage && isNumeric(checkoutData.paymentType)) {
|
|
@@ -76,6 +79,13 @@ export const CheckoutProvider = ({ children }) => {
|
|
|
76
79
|
form.current.submit();
|
|
77
80
|
}
|
|
78
81
|
}, [idramForm, form]);
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
setCart((prev) => ({ ...prev, loading: true }));
|
|
84
|
+
getCart(checkoutData);
|
|
85
|
+
if (isLoggedIn) {
|
|
86
|
+
mergeCart();
|
|
87
|
+
}
|
|
88
|
+
}, [isCartPage, isCheckoutPage, selectedLang, isLoggedIn]);
|
|
79
89
|
return (React.createElement(CheckoutContext.Provider, { value: {
|
|
80
90
|
checkoutData,
|
|
81
91
|
setCheckoutData,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { Page
|
|
2
|
+
import { Page } from '@weareconceptstudio/core';
|
|
3
3
|
import { Sequence, TotalCheckout } from '../../../components';
|
|
4
4
|
import { useAddressContext } from '../../address';
|
|
5
5
|
import { useAccountContext } from '../../../AccountProvider';
|
package/dist/styles/variables.js
CHANGED
|
@@ -91,8 +91,8 @@ const AccountVariables = createGlobalStyle `${css `
|
|
|
91
91
|
--account_h4: 56px;
|
|
92
92
|
--account_h5: 48px;
|
|
93
93
|
--account_h6: 40px;
|
|
94
|
-
--account_p2: 24px;
|
|
95
94
|
--account_p1: 32px;
|
|
95
|
+
--account_p2: 24px;
|
|
96
96
|
--account_p3: 20px;
|
|
97
97
|
--account_p4: 18px;
|
|
98
98
|
--account_p5: 12px;
|
|
@@ -145,6 +145,7 @@ declare const _default: {
|
|
|
145
145
|
continueShopping: string;
|
|
146
146
|
color: string;
|
|
147
147
|
size: string;
|
|
148
|
+
restore: string;
|
|
148
149
|
};
|
|
149
150
|
user_status: {
|
|
150
151
|
tourist: string;
|
|
@@ -166,9 +167,10 @@ declare const _default: {
|
|
|
166
167
|
thankYou: string;
|
|
167
168
|
titleExpired: string;
|
|
168
169
|
descriptionExpired: string;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
freeShippingNote: string;
|
|
171
|
+
freeShippingSuccessText: string;
|
|
172
|
+
giftNote: string;
|
|
173
|
+
giftSuccessText: string;
|
|
172
174
|
};
|
|
173
175
|
account_deletion: {
|
|
174
176
|
deleteAccountTextPart1: string;
|
package/dist/translations/en.js
CHANGED
|
@@ -145,6 +145,7 @@ export default {
|
|
|
145
145
|
continueShopping: 'Continue shopping',
|
|
146
146
|
color: 'Color',
|
|
147
147
|
size: 'Size',
|
|
148
|
+
restore: 'Restore',
|
|
148
149
|
},
|
|
149
150
|
user_status: {
|
|
150
151
|
tourist: 'tourist',
|
|
@@ -166,9 +167,10 @@ export default {
|
|
|
166
167
|
thankYou: 'Thank you',
|
|
167
168
|
titleExpired: 'Link expired',
|
|
168
169
|
descriptionExpired: 'To reset your password, return to the login page and select “forgot your password” to send a new email.',
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
freeShippingNote: "You're just {price} away from free shipping in Yerevan!",
|
|
171
|
+
freeShippingSuccessText: 'Hooray, You’re saving {price}!',
|
|
172
|
+
giftNote: 'Add just {price} more to receive a gift!',
|
|
173
|
+
giftSuccessText: 'Your gift is ready.',
|
|
172
174
|
},
|
|
173
175
|
account_deletion: {
|
|
174
176
|
deleteAccountTextPart1: 'If your email address is incorrect,',
|
|
@@ -145,6 +145,7 @@ declare const _default: {
|
|
|
145
145
|
continueShopping: string;
|
|
146
146
|
color: string;
|
|
147
147
|
size: string;
|
|
148
|
+
restore: string;
|
|
148
149
|
};
|
|
149
150
|
user_status: {
|
|
150
151
|
tourist: string;
|
|
@@ -166,9 +167,10 @@ declare const _default: {
|
|
|
166
167
|
thankYou: string;
|
|
167
168
|
titleExpired: string;
|
|
168
169
|
descriptionExpired: string;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
freeShippingNote: string;
|
|
171
|
+
freeShippingSuccessText: string;
|
|
172
|
+
giftNote: string;
|
|
173
|
+
giftSuccessText: string;
|
|
172
174
|
};
|
|
173
175
|
account_deletion: {
|
|
174
176
|
deleteAccountTextPart1: string;
|
package/dist/translations/hy.js
CHANGED
|
@@ -145,6 +145,7 @@ export default {
|
|
|
145
145
|
continueShopping: 'Շարունակել գնումները',
|
|
146
146
|
color: 'Գույն',
|
|
147
147
|
size: 'Չափ',
|
|
148
|
+
restore: 'Վերականգնել',
|
|
148
149
|
},
|
|
149
150
|
user_status: {
|
|
150
151
|
tourist: 'տուրիստ',
|
|
@@ -166,9 +167,10 @@ export default {
|
|
|
166
167
|
thankYou: 'Շնորհակալություն',
|
|
167
168
|
titleExpired: 'Հղումը ժամկետանց է',
|
|
168
169
|
descriptionExpired: 'Գաղտնաբառը վերականգնելու համար վերադարձեք մուտքի էջ և ընտրեք «Մոռացել եք գաղտնաբառը»՝ նոր էլ. փոստ ուղարկելու համար։',
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
freeShippingNote: 'Ձեզ ընդամենը {price} է հարկավոր Երևանում անվճար առաքման համար:',
|
|
171
|
+
freeShippingSuccessText: 'Շնորհավոր, դուք խնայեցիք {price}!',
|
|
172
|
+
giftNote: 'Նվեր ստանալու համար ավելացրեք ընդամենը {price}:',
|
|
173
|
+
giftSuccessText: 'Ձեր նվերը պատրաստ է։',
|
|
172
174
|
},
|
|
173
175
|
account_deletion: {
|
|
174
176
|
deleteAccountTextPart1: 'Եթե ձեր էլ. փոստի հասցեն սխալ է,',
|
|
@@ -146,6 +146,7 @@ declare const _default: {
|
|
|
146
146
|
continueShopping: string;
|
|
147
147
|
color: string;
|
|
148
148
|
size: string;
|
|
149
|
+
restore: string;
|
|
149
150
|
};
|
|
150
151
|
user_status: {
|
|
151
152
|
tourist: string;
|
|
@@ -167,9 +168,10 @@ declare const _default: {
|
|
|
167
168
|
thankYou: string;
|
|
168
169
|
titleExpired: string;
|
|
169
170
|
descriptionExpired: string;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
freeShippingNote: string;
|
|
172
|
+
freeShippingSuccessText: string;
|
|
173
|
+
giftNote: string;
|
|
174
|
+
giftSuccessText: string;
|
|
173
175
|
};
|
|
174
176
|
account_deletion: {
|
|
175
177
|
deleteAccountTextPart1: string;
|
|
@@ -385,6 +387,7 @@ declare const _default: {
|
|
|
385
387
|
continueShopping: string;
|
|
386
388
|
color: string;
|
|
387
389
|
size: string;
|
|
390
|
+
restore: string;
|
|
388
391
|
};
|
|
389
392
|
user_status: {
|
|
390
393
|
tourist: string;
|
|
@@ -406,9 +409,10 @@ declare const _default: {
|
|
|
406
409
|
thankYou: string;
|
|
407
410
|
titleExpired: string;
|
|
408
411
|
descriptionExpired: string;
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
+
freeShippingNote: string;
|
|
413
|
+
freeShippingSuccessText: string;
|
|
414
|
+
giftNote: string;
|
|
415
|
+
giftSuccessText: string;
|
|
412
416
|
};
|
|
413
417
|
account_deletion: {
|
|
414
418
|
deleteAccountTextPart1: string;
|
|
@@ -493,6 +497,7 @@ declare const _default: {
|
|
|
493
497
|
continueWidth: string;
|
|
494
498
|
};
|
|
495
499
|
password_management: {
|
|
500
|
+
restore: string;
|
|
496
501
|
password: string;
|
|
497
502
|
passwordPlaceholder: string;
|
|
498
503
|
resetPassword: string;
|
|
@@ -624,6 +629,7 @@ declare const _default: {
|
|
|
624
629
|
continueShopping: string;
|
|
625
630
|
color: string;
|
|
626
631
|
size: string;
|
|
632
|
+
restore: string;
|
|
627
633
|
};
|
|
628
634
|
user_status: {
|
|
629
635
|
tourist: string;
|
|
@@ -645,9 +651,10 @@ declare const _default: {
|
|
|
645
651
|
thankYou: string;
|
|
646
652
|
titleExpired: string;
|
|
647
653
|
descriptionExpired: string;
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
654
|
+
freeShippingNote: string;
|
|
655
|
+
freeShippingSuccessText: string;
|
|
656
|
+
giftNote: string;
|
|
657
|
+
giftSuccessText: string;
|
|
651
658
|
};
|
|
652
659
|
account_deletion: {
|
|
653
660
|
deleteAccountTextPart1: string;
|
|
@@ -14,6 +14,7 @@ declare const _default: {
|
|
|
14
14
|
continueWidth: string;
|
|
15
15
|
};
|
|
16
16
|
password_management: {
|
|
17
|
+
restore: string;
|
|
17
18
|
password: string;
|
|
18
19
|
passwordPlaceholder: string;
|
|
19
20
|
resetPassword: string;
|
|
@@ -145,6 +146,7 @@ declare const _default: {
|
|
|
145
146
|
continueShopping: string;
|
|
146
147
|
color: string;
|
|
147
148
|
size: string;
|
|
149
|
+
restore: string;
|
|
148
150
|
};
|
|
149
151
|
user_status: {
|
|
150
152
|
tourist: string;
|
|
@@ -166,9 +168,10 @@ declare const _default: {
|
|
|
166
168
|
thankYou: string;
|
|
167
169
|
titleExpired: string;
|
|
168
170
|
descriptionExpired: string;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
freeShippingNote: string;
|
|
172
|
+
freeShippingSuccessText: string;
|
|
173
|
+
giftNote: string;
|
|
174
|
+
giftSuccessText: string;
|
|
172
175
|
};
|
|
173
176
|
account_deletion: {
|
|
174
177
|
deleteAccountTextPart1: string;
|
package/dist/translations/ru.js
CHANGED
|
@@ -14,6 +14,7 @@ export default {
|
|
|
14
14
|
continueWidth: 'или продолжить с',
|
|
15
15
|
},
|
|
16
16
|
password_management: {
|
|
17
|
+
restore: 'Восстановить',
|
|
17
18
|
password: 'Пароль',
|
|
18
19
|
passwordPlaceholder: 'Пароль',
|
|
19
20
|
resetPassword: 'Сбросить пароль',
|
|
@@ -145,6 +146,7 @@ export default {
|
|
|
145
146
|
continueShopping: 'Продолжить покупки',
|
|
146
147
|
color: 'Цвет',
|
|
147
148
|
size: 'Размер',
|
|
149
|
+
restore: 'Восстановить',
|
|
148
150
|
},
|
|
149
151
|
user_status: {
|
|
150
152
|
tourist: 'Турист',
|
|
@@ -166,9 +168,10 @@ export default {
|
|
|
166
168
|
thankYou: 'Спасибо',
|
|
167
169
|
titleExpired: 'Ссылка устарела',
|
|
168
170
|
descriptionExpired: 'Чтобы сбросить пароль, вернитесь на страницу входа и выберите "Забыли пароль?", чтобы отправить новое письмо.',
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
freeShippingNote: 'Всего {price} отделяют вас от бесплатной доставки в Ереване!',
|
|
172
|
+
freeShippingSuccessText: 'Ура, вы экономите {price}!',
|
|
173
|
+
giftNote: 'Добавьте всего {price} и получите подарок!',
|
|
174
|
+
giftSuccessText: 'Ваш подарок готов.',
|
|
172
175
|
},
|
|
173
176
|
account_deletion: {
|
|
174
177
|
deleteAccountTextPart1: 'Если ваш адрес электронной почты неверен,',
|