@weareconceptstudio/account 0.3.1 → 0.3.3
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/AccountProvider.js +8 -6
- package/dist/components/Loader/index.d.ts +2 -0
- package/dist/components/Loader/index.js +7 -0
- package/dist/components/Loader/style.d.ts +2 -0
- package/dist/components/Loader/style.js +3 -0
- package/dist/components/TotalCheckout/CommentComp/index.js +1 -1
- package/dist/components/TotalCheckout/MuramoneyComp/index.d.ts +2 -1
- package/dist/components/TotalCheckout/MuramoneyComp/index.js +7 -4
- package/dist/components/TotalCheckout/MuramoneyComp/utils.d.ts +1 -0
- package/dist/components/TotalCheckout/MuramoneyComp/utils.js +1 -0
- package/dist/components/TotalCheckout/PromoCodeComp/index.d.ts +2 -1
- package/dist/components/TotalCheckout/PromoCodeComp/index.js +4 -3
- package/dist/components/TotalCheckout/index.js +44 -16
- package/dist/components/TotalCheckout/style.js +50 -0
- package/dist/modules/account/AccountBalanceTemplate/HistoryBalance/ItemHistory/index.js +6 -1
- package/dist/modules/address/AddressForm/style.js +5 -0
- package/dist/modules/address/AddressItem/index.js +4 -8
- package/dist/modules/address/AddressItem/style.js +10 -0
- package/dist/modules/address/AddressProvider.d.ts +1 -2
- package/dist/modules/address/AddressProvider.js +7 -7
- package/dist/modules/address/SelectAddress/index.js +2 -3
- package/dist/modules/address/SelectAddressPopup/index.js +3 -19
- package/dist/modules/address/ShippingBillingForm/style.js +5 -0
- package/dist/modules/address/ShippingBillingInfo/index.js +1 -4
- package/dist/modules/cart/CartTemplate/index.d.ts +2 -1
- package/dist/modules/cart/CartTemplate/index.js +3 -2
- package/dist/modules/cart/EmptyCart/icons.js +1 -1
- package/dist/modules/checkout/CheckoutProvider.d.ts +5 -0
- package/dist/modules/checkout/CheckoutProvider.js +66 -0
- package/dist/modules/checkout/CheckoutTemplate/StepReview/index.js +7 -19
- package/dist/modules/checkout/CheckoutTemplate/index.js +6 -26
- package/dist/modules/checkout/ThankYouTemplate/icons.js +1 -1
- package/dist/modules/checkout/index.d.ts +1 -0
- package/dist/modules/checkout/index.js +1 -0
- package/dist/modules/order/OrderDetails/index.js +7 -2
- package/dist/{components/TotalCheckout → modules/payment}/AddNewCard/index.d.ts +1 -2
- package/dist/modules/payment/AddNewCard/index.js +19 -0
- package/dist/{components/TotalCheckout → modules/payment}/AddNewCard/style.js +13 -6
- package/dist/{components/TotalCheckout → modules/payment}/CardComp/index.d.ts +3 -3
- package/dist/modules/payment/CardComp/index.js +36 -0
- package/dist/{components/TotalCheckout → modules/payment}/CardComp/style.js +28 -14
- package/dist/modules/payment/PaymentComp/index.d.ts +7 -0
- package/dist/{components/TotalCheckout → modules/payment}/PaymentComp/index.js +6 -3
- package/dist/modules/payment/PaymentMethodsComp/icons.d.ts +10 -0
- package/dist/modules/payment/PaymentMethodsComp/icons.js +56 -0
- package/dist/modules/payment/PaymentMethodsComp/index.d.ts +8 -0
- package/dist/{components/TotalCheckout → modules/payment}/PaymentMethodsComp/index.js +29 -25
- package/dist/{components/TotalCheckout → modules/payment}/PaymentMethodsComp/style.js +7 -7
- package/dist/modules/payment/PaymentMethodsTemplate/index.d.ts +1 -1
- package/dist/modules/payment/PaymentMethodsTemplate/index.js +21 -34
- package/dist/modules/payment/PaymentMethodsTemplate/style.js +43 -11
- package/dist/modules/payment/PaymentWrap/index.d.ts +6 -0
- package/dist/modules/payment/PaymentWrap/index.js +26 -0
- package/dist/modules/payment/PaymentWrap/style.d.ts +2 -0
- package/dist/{components/TotalCheckout/SelectPaymentMethodPopup → modules/payment/PaymentWrap}/style.js +29 -79
- package/dist/modules/payment/SelectPaymentMethodPopup/index.d.ts +3 -0
- package/dist/modules/payment/SelectPaymentMethodPopup/index.js +25 -0
- package/dist/modules/payment/SelectPaymentMethodPopup/style.js +81 -0
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +4 -0
- package/dist/translations/hy.d.ts +3 -0
- package/dist/translations/hy.js +4 -0
- package/dist/translations/index.d.ts +9 -0
- package/dist/translations/ru.d.ts +3 -0
- package/dist/translations/ru.js +4 -0
- package/package.json +1 -1
- package/dist/components/TotalCheckout/AddNewCard/index.js +0 -11
- package/dist/components/TotalCheckout/CardComp/index.js +0 -36
- package/dist/components/TotalCheckout/PaymentComp/index.d.ts +0 -9
- package/dist/components/TotalCheckout/PaymentMethodsComp/index.d.ts +0 -8
- package/dist/components/TotalCheckout/SelectPaymentMethodPopup/index.d.ts +0 -3
- package/dist/components/TotalCheckout/SelectPaymentMethodPopup/index.js +0 -65
- /package/dist/{components/TotalCheckout → modules/payment}/AddNewCard/style.d.ts +0 -0
- /package/dist/{components/TotalCheckout → modules/payment}/CardComp/style.d.ts +0 -0
- /package/dist/{components/TotalCheckout → modules/payment}/PaymentComp/style.d.ts +0 -0
- /package/dist/{components/TotalCheckout → modules/payment}/PaymentComp/style.js +0 -0
- /package/dist/{components/TotalCheckout → modules/payment}/PaymentMethodsComp/style.d.ts +0 -0
- /package/dist/{components/TotalCheckout → modules/payment}/SelectPaymentMethodPopup/style.d.ts +0 -0
package/dist/AccountProvider.js
CHANGED
|
@@ -2,6 +2,7 @@ import React, { createContext, useCallback, useContext, useEffect } from 'react'
|
|
|
2
2
|
import { useTranslation, useUi } from '@weareconceptstudio/core';
|
|
3
3
|
import { ThemeProvider } from 'styled-components';
|
|
4
4
|
import { AddressProvider } from './modules/address/AddressProvider';
|
|
5
|
+
import { CheckoutProvider } from './modules/checkout/CheckoutProvider';
|
|
5
6
|
//* Translations
|
|
6
7
|
import translations from './translations';
|
|
7
8
|
//* Styles
|
|
@@ -29,10 +30,11 @@ export const AccountProvider = ({ fontFamily = 'core_Font', shopUrl = '/', child
|
|
|
29
30
|
}
|
|
30
31
|
}, [productUrlPrefix, productPopup]);
|
|
31
32
|
return (React.createElement(AccountContext.Provider, { value: { currency, maxQty, shopUrl, useUser, useCart, handleProductClick } },
|
|
32
|
-
React.createElement(
|
|
33
|
-
React.createElement(
|
|
34
|
-
React.createElement(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
React.createElement(CheckoutProvider, null,
|
|
34
|
+
React.createElement(AddressProvider, { useUser: useUser, useCart: useCart, addressType: addressType, addressFormFields: addressFormFields },
|
|
35
|
+
React.createElement(ThemeProvider, { theme: theme },
|
|
36
|
+
React.createElement(AccountVariables, { fontFamily: fontFamily }),
|
|
37
|
+
React.createElement(AccountHelperClass, null),
|
|
38
|
+
React.createElement(AccountTypography, null),
|
|
39
|
+
children)))));
|
|
38
40
|
};
|
|
@@ -6,7 +6,7 @@ const CommentComp = () => {
|
|
|
6
6
|
return (React.createElement(CommentCompStyle, { className: 'collapse-distance' },
|
|
7
7
|
React.createElement(CollapseContainer, null,
|
|
8
8
|
React.createElement(CollapseItem, { status: 'open', title: React.createElement(React.Fragment, null,
|
|
9
|
-
React.createElement("div",
|
|
9
|
+
React.createElement("div", { className: 'inner-wrapper-icon' },
|
|
10
10
|
React.createElement("svg", { width: '12', height: '12', fill: 'none', viewBox: '0 0 12 12', xmlns: 'http://www.w3.org/2000/svg' },
|
|
11
11
|
React.createElement("path", { d: 'M0 6H12', stroke: 'black', strokeWidth: '2' }),
|
|
12
12
|
React.createElement("path", { d: 'M6 12L6 0', stroke: 'black', strokeWidth: '2' }))),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export default MuramoneyComp;
|
|
2
|
-
declare function MuramoneyComp({ isMuramoney, currency, balance, useBalance, balanceHandler }: {
|
|
2
|
+
declare function MuramoneyComp({ isMuramoney, currency, balance, useBalance, balanceHandler, getItemCount }: {
|
|
3
3
|
isMuramoney?: boolean;
|
|
4
4
|
currency: any;
|
|
5
5
|
balance: any;
|
|
6
6
|
useBalance: any;
|
|
7
7
|
balanceHandler: any;
|
|
8
|
+
getItemCount: any;
|
|
8
9
|
}): React.JSX.Element;
|
|
9
10
|
import React from 'react';
|
|
@@ -5,7 +5,7 @@ import AccountButton from '../../AccountButton';
|
|
|
5
5
|
import { balanceFields } from './utils';
|
|
6
6
|
//* Style
|
|
7
7
|
import MuramoneyCompStyle from './style';
|
|
8
|
-
const MuramoneyComp = ({ isMuramoney = true, currency, balance, useBalance, balanceHandler }) => {
|
|
8
|
+
const MuramoneyComp = ({ isMuramoney = true, currency, balance, useBalance, balanceHandler, getItemCount }) => {
|
|
9
9
|
const { translate } = useTranslation();
|
|
10
10
|
//! States
|
|
11
11
|
const [disable, setDisable] = useState(false);
|
|
@@ -14,9 +14,11 @@ const MuramoneyComp = ({ isMuramoney = true, currency, balance, useBalance, bala
|
|
|
14
14
|
setDisable(true);
|
|
15
15
|
balanceHandler(values.balance);
|
|
16
16
|
};
|
|
17
|
-
return isMuramoney ? (React.createElement(MuramoneyCompStyle, { className:
|
|
18
|
-
React.createElement(CollapseItem, { disable: disable,
|
|
19
|
-
|
|
17
|
+
return isMuramoney ? (React.createElement(MuramoneyCompStyle, { className: `collapse-distance ${getItemCount && balance ? ' ' : 'disable'}` },
|
|
18
|
+
React.createElement(CollapseItem, { disable: disable,
|
|
19
|
+
// status={'open'}
|
|
20
|
+
title: React.createElement(React.Fragment, null,
|
|
21
|
+
React.createElement("div", { className: 'inner-wrapper-icon' },
|
|
20
22
|
React.createElement("svg", { width: '12', height: '12', fill: 'none', viewBox: '0 0 12 12', xmlns: 'http://www.w3.org/2000/svg' },
|
|
21
23
|
React.createElement("path", { d: 'M0 6H12', stroke: 'black', strokeWidth: '2' }),
|
|
22
24
|
React.createElement("path", { d: 'M6 12L6 0', stroke: 'black', strokeWidth: '2' }))),
|
|
@@ -24,6 +26,7 @@ const MuramoneyComp = ({ isMuramoney = true, currency, balance, useBalance, bala
|
|
|
24
26
|
React.createElement(Text, { className: 'account-p account-p4 account-primary-color2 account-font-medium muramoney-success-text' }, handlePriceCheckFunc(useBalance, currency)),
|
|
25
27
|
React.createElement(Text, { text: 'remove', className: 'account-p account-p4 account-primary-color2 account-font-medium muramoney-remove-text', onClick: () => {
|
|
26
28
|
balanceHandler(null);
|
|
29
|
+
setDisable(false);
|
|
27
30
|
} }))) : (React.createElement(FormBuilder, { onSubmit: onFinish, fields: balanceFields, className: `muramoney-block`, formOptions: {
|
|
28
31
|
className: 'muramoney-container',
|
|
29
32
|
} },
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export default PromoCodeComp;
|
|
2
|
-
declare function PromoCodeComp({ isPromoCode, promo_code }: {
|
|
2
|
+
declare function PromoCodeComp({ isPromoCode, promo_code, getItemCount }: {
|
|
3
3
|
isPromoCode?: boolean;
|
|
4
4
|
promo_code: any;
|
|
5
|
+
getItemCount: any;
|
|
5
6
|
}): React.JSX.Element;
|
|
6
7
|
import React from 'react';
|
|
@@ -5,7 +5,7 @@ import AccountButton from '../../AccountButton';
|
|
|
5
5
|
import { promoCodeFields } from './utils';
|
|
6
6
|
//* Style
|
|
7
7
|
import PromoCodeCompStyle from './style';
|
|
8
|
-
const PromoCodeComp = ({ isPromoCode = true, promo_code }) => {
|
|
8
|
+
const PromoCodeComp = ({ isPromoCode = true, promo_code, getItemCount }) => {
|
|
9
9
|
//! States
|
|
10
10
|
const [couponCode, setCouponCode] = useState(false);
|
|
11
11
|
const [disable, setDisable] = useState(false);
|
|
@@ -14,9 +14,9 @@ const PromoCodeComp = ({ isPromoCode = true, promo_code }) => {
|
|
|
14
14
|
setCouponCode(true);
|
|
15
15
|
setDisable(true);
|
|
16
16
|
};
|
|
17
|
-
return isPromoCode ? (React.createElement(PromoCodeCompStyle, { className:
|
|
17
|
+
return isPromoCode ? (React.createElement(PromoCodeCompStyle, { className: `collapse-distance ${getItemCount ? ' ' : ' disable'}` },
|
|
18
18
|
React.createElement(CollapseItem, { disable: disable, title: React.createElement(React.Fragment, null,
|
|
19
|
-
React.createElement("div",
|
|
19
|
+
React.createElement("div", { className: 'inner-wrapper-icon' },
|
|
20
20
|
React.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '12', height: '12', viewBox: '0 0 12 12', fill: 'none' },
|
|
21
21
|
React.createElement("path", { d: 'M0 6H12', stroke: 'black', strokeWidth: '2' }),
|
|
22
22
|
React.createElement("path", { d: 'M6 12L6 0', stroke: 'black', strokeWidth: '2' }))),
|
|
@@ -24,6 +24,7 @@ const PromoCodeComp = ({ isPromoCode = true, promo_code }) => {
|
|
|
24
24
|
React.createElement(Text, { className: 'account-p account-p4 account-primary-color2 account-font-medium promo-code-success-text' }, promo_code),
|
|
25
25
|
React.createElement(Text, { text: 'remove', className: 'account-p account-p4 account-primary-color2 account-font-medium promo-code-remove-text', onClick: () => {
|
|
26
26
|
setCouponCode(false);
|
|
27
|
+
setDisable(false);
|
|
27
28
|
} }))) : (React.createElement(FormBuilder, { onSubmit: onFinish, fields: promoCodeFields, className: `promo-code-block`, formOptions: {
|
|
28
29
|
className: 'promo-code-container',
|
|
29
30
|
} },
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React, { memo } from 'react';
|
|
1
|
+
import React, { memo, useEffect, useRef } from 'react';
|
|
2
2
|
import { Text, CollapseContainer, handlePriceCheckFunc, numToLocalString } from '@weareconceptstudio/core';
|
|
3
3
|
import { useAccountContext } from '../../AccountProvider';
|
|
4
|
+
import { useAddressContext, useCheckoutContext } from '../../modules';
|
|
4
5
|
import AccountButton from '../AccountButton';
|
|
5
6
|
import FreeShippingComp from './FreeShippingComp';
|
|
6
7
|
import PromoCodeComp from './PromoCodeComp';
|
|
@@ -10,25 +11,51 @@ import CommentComp from './CommentComp';
|
|
|
10
11
|
import TotalCheckoutStyle from './style';
|
|
11
12
|
//* Skeleton
|
|
12
13
|
import SkeletonTotalCheckout from './Skeleton';
|
|
13
|
-
|
|
14
|
-
// TODO: Muramoney & Promo code
|
|
14
|
+
// TODO: Promo code
|
|
15
15
|
const promo_code = '10% of first order';
|
|
16
|
-
const TotalCheckout = memo(({ isShipping, children, confirmation, buttonProps,
|
|
16
|
+
const TotalCheckout = memo(({ isShipping, children, confirmation, buttonProps, isCheckout = false }) => {
|
|
17
17
|
const { currency, useCart, useUser } = useAccountContext();
|
|
18
|
-
const {
|
|
18
|
+
const { fillCheckoutData, fillCart } = useCheckoutContext();
|
|
19
|
+
const { addressLoading } = useAddressContext();
|
|
19
20
|
const { user } = useUser();
|
|
20
|
-
const { itemsCount, shippingCost, freeShippingRange, shippingCostValue, total, subtotal, useBalance,
|
|
21
|
+
const { itemsCount, shippingCost, freeShippingRange, shippingCostValue, total, subtotal, useBalance, loading } = useCart();
|
|
21
22
|
const handleBalance = (amount) => {
|
|
22
|
-
|
|
23
|
-
if (amount) {
|
|
24
|
-
params['useBalance'] = amount;
|
|
25
|
-
}
|
|
26
|
-
getCart(params);
|
|
23
|
+
fillCart('useBalance', amount);
|
|
27
24
|
};
|
|
25
|
+
const innerCollapseRef = useRef(null);
|
|
26
|
+
//! disable keypress on input
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const handleKeyDown = (event) => {
|
|
29
|
+
if (event.key === 'Enter') {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
if ((!itemsCount || !user.balance) && innerCollapseRef.current) {
|
|
34
|
+
let inputField = innerCollapseRef.current.querySelectorAll('.base-input');
|
|
35
|
+
if (inputField.length) {
|
|
36
|
+
[...inputField].forEach((item, i) => {
|
|
37
|
+
if (!user.balance && itemsCount && i == 1) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
item.addEventListener('keydown', handleKeyDown);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return () => {
|
|
47
|
+
if ((!itemsCount || !user.balance) && innerCollapseRef.current) {
|
|
48
|
+
const inputField = innerCollapseRef.current.querySelectorAll('.base-input');
|
|
49
|
+
[...inputField].map((item) => {
|
|
50
|
+
item.removeEventListener('keydown', handleKeyDown);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
});
|
|
28
55
|
return (React.createElement(TotalCheckoutStyle, null,
|
|
29
56
|
React.createElement("div", { className: `cart-main-wrap` },
|
|
30
57
|
React.createElement("div", { className: `left-panel-wrap panel` }, children),
|
|
31
|
-
React.createElement("div", { className: `right-panel-wrap panel ${confirmation ? 'display-none-wrap' : ''}` }, !confirmation && !loading ? (React.createElement("div", { className: `max-width-wrapper sticky-wrap` },
|
|
58
|
+
React.createElement("div", { className: `right-panel-wrap panel ${confirmation ? 'display-none-wrap' : ''}` }, !confirmation && !addressLoading && !loading ? (React.createElement("div", { className: `max-width-wrapper sticky-wrap` },
|
|
32
59
|
React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1 sticky-wrap-title`, text: `orderSummary` }),
|
|
33
60
|
React.createElement("div", { className: `od-line` }),
|
|
34
61
|
React.createElement("div", { className: `od-item-wrap` },
|
|
@@ -37,16 +64,17 @@ const TotalCheckout = memo(({ isShipping, children, confirmation, buttonProps, f
|
|
|
37
64
|
React.createElement("div", { className: `od-item-wrap` },
|
|
38
65
|
React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1 sticky-wrap-shipping`, text: `shipping` }),
|
|
39
66
|
React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1 sticky-wrap-shipping-cost`, text: `${String(shippingCost).toLowerCase() === 'free' || shippingCost === '-' ? shippingCost : `${numToLocalString(shippingCost)} ${currency}`}` })),
|
|
40
|
-
useBalance ? (React.createElement("div", { className: `od-item-wrap` },
|
|
67
|
+
user && useBalance ? (React.createElement("div", { className: `od-item-wrap` },
|
|
41
68
|
React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1`, text: `muramoney` }),
|
|
42
69
|
React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1 balance-text-block`, text: `-${handlePriceCheckFunc(useBalance, currency)}` }))) : null,
|
|
43
70
|
React.createElement("div", { className: `od-item-wrap` },
|
|
44
71
|
React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1 sticky-wrap-total`, text: `total` }),
|
|
45
72
|
React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1 sticky-wrap-currency2`, text: itemsCount ? handlePriceCheckFunc(total, currency) : `0 ${currency}` })),
|
|
46
73
|
!isCheckout ? (React.createElement(FreeShippingComp, { currency: currency, shippingCost: shippingCost, shippingCostValue: shippingCostValue, freeShippingRange: freeShippingRange })) : null,
|
|
47
|
-
React.createElement(CollapseContainer, { className: 'collapse-container-wrapper' },
|
|
48
|
-
React.createElement(
|
|
49
|
-
|
|
74
|
+
user ? (React.createElement(CollapseContainer, { className: 'collapse-container-wrapper' },
|
|
75
|
+
React.createElement("div", { ref: innerCollapseRef },
|
|
76
|
+
React.createElement(MuramoneyComp, { getItemCount: itemsCount, balance: user.balance, currency: currency, balanceHandler: handleBalance, useBalance: useBalance }),
|
|
77
|
+
React.createElement(PromoCodeComp, { getItemCount: itemsCount, promo_code: promo_code })))) : null,
|
|
50
78
|
isCheckout && typeof isShipping === 'boolean' && !isShipping ? React.createElement(CommentComp, { fillCheckoutData: fillCheckoutData }) : null,
|
|
51
79
|
React.createElement(AccountButton, { url: buttonProps.url, btnType: `full-width`, text: buttonProps.text, type: buttonProps.type, className: `sticky-wrap-btn`, disabled: buttonProps.disabled, onClick: () => buttonProps.handleClick && buttonProps.handleClick() }))) : (React.createElement(SkeletonTotalCheckout, null))))));
|
|
52
80
|
});
|
|
@@ -6,6 +6,10 @@ const TotalCheckoutStyle = styled.section `
|
|
|
6
6
|
--account_cartMainWrapPadTop: var(--sp8x);
|
|
7
7
|
--account_leftPanelWrapWidth: calc(100% - var(--account_rightPanelWrapWidth));
|
|
8
8
|
|
|
9
|
+
/* //! size text var */
|
|
10
|
+
--account_textSize: var(--account_p4);
|
|
11
|
+
--account_lineHeightSize: var(--account_lineHeight);
|
|
12
|
+
|
|
9
13
|
/* //! Right Layout Sizes */
|
|
10
14
|
--account_odLineMTop: var(--sp2x);
|
|
11
15
|
--account_odLineMBot: var(--sp6x);
|
|
@@ -67,6 +71,13 @@ const TotalCheckoutStyle = styled.section `
|
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
|
|
74
|
+
.promo-code-text,
|
|
75
|
+
.muramoney-text,
|
|
76
|
+
.comment-text {
|
|
77
|
+
font-size: var(--account_textSize) !important;
|
|
78
|
+
line-height: var(--account_lineHeight) !important;
|
|
79
|
+
}
|
|
80
|
+
|
|
70
81
|
.display-none-wrap {
|
|
71
82
|
display: none !important;
|
|
72
83
|
}
|
|
@@ -84,6 +95,8 @@ const TotalCheckoutStyle = styled.section `
|
|
|
84
95
|
|
|
85
96
|
#collapse-item {
|
|
86
97
|
svg {
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
|
|
87
100
|
path {
|
|
88
101
|
transition: all var(--account_trTime) ease-out;
|
|
89
102
|
|
|
@@ -101,11 +114,38 @@ const TotalCheckoutStyle = styled.section `
|
|
|
101
114
|
}
|
|
102
115
|
}
|
|
103
116
|
}
|
|
117
|
+
|
|
118
|
+
&.after-disable {
|
|
119
|
+
#collapse-title {
|
|
120
|
+
pointer-events: none;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&.disable {
|
|
125
|
+
#collapse-title {
|
|
126
|
+
p {
|
|
127
|
+
color: var(--neutral300);
|
|
128
|
+
}
|
|
129
|
+
svg {
|
|
130
|
+
path {
|
|
131
|
+
stroke: var(--neutral300);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
104
136
|
}
|
|
105
137
|
|
|
106
138
|
#collapse-title {
|
|
107
139
|
display: flex;
|
|
140
|
+
align-items: flex-start;
|
|
108
141
|
gap: var(--sp1x);
|
|
142
|
+
width: fit-content;
|
|
143
|
+
|
|
144
|
+
.inner-wrapper-icon {
|
|
145
|
+
height: calc(var(--account_textSize) * var(--account_lineHeight));
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
}
|
|
109
149
|
|
|
110
150
|
/* //! Mouse Detect */
|
|
111
151
|
@media (pointer: fine) {
|
|
@@ -132,6 +172,16 @@ const TotalCheckoutStyle = styled.section `
|
|
|
132
172
|
.collapse-distance {
|
|
133
173
|
margin-top: var(--account_collapseSmallDistance);
|
|
134
174
|
padding-top: var(--account_collapseSmallDistance);
|
|
175
|
+
|
|
176
|
+
&.disable {
|
|
177
|
+
#collapse-description {
|
|
178
|
+
button {
|
|
179
|
+
pointer-events: none;
|
|
180
|
+
border-color: var(--account_primaryColor5);
|
|
181
|
+
color: var(--account_primaryColor5);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
135
185
|
}
|
|
136
186
|
|
|
137
187
|
.muramoney-container,
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { Text, useTranslation } from '@weareconceptstudio/core';
|
|
3
|
+
import { useAccountContext } from '../../../../../AccountProvider';
|
|
3
4
|
//* Styles
|
|
4
5
|
import ItemHistoryStyle from './style';
|
|
5
6
|
const ItemHistory = ({ date, activity, value, action_type }) => {
|
|
6
7
|
const { translate } = useTranslation();
|
|
8
|
+
const { useCart } = useAccountContext();
|
|
9
|
+
const { currency } = useCart();
|
|
7
10
|
//! Refs
|
|
8
11
|
const titleWrapperRef = useRef();
|
|
9
12
|
const getSizeItem = useRef();
|
|
@@ -36,7 +39,9 @@ const ItemHistory = ({ date, activity, value, action_type }) => {
|
|
|
36
39
|
React.createElement(Text, { className: `account-primary-color1 account-font-medium account-p account-p1 amount-info-text ${action_type}` },
|
|
37
40
|
React.createElement(Text, { className: 'account-primary-color1 account-font-medium account-p1 mobile-amount-info-text first-letter', tag: 'span' }, translate('balanceCategoryAmount')),
|
|
38
41
|
' ',
|
|
39
|
-
value
|
|
42
|
+
value,
|
|
43
|
+
" ",
|
|
44
|
+
currency)),
|
|
40
45
|
React.createElement("div", { className: 'line-info' })));
|
|
41
46
|
};
|
|
42
47
|
export default ItemHistory;
|
|
@@ -22,25 +22,21 @@ const AddressItem = ({ type, title, data, checkout_review, select_address, onCli
|
|
|
22
22
|
accountIcon: true,
|
|
23
23
|
});
|
|
24
24
|
}, [data]);
|
|
25
|
-
return
|
|
25
|
+
return data ? (React.createElement(AddressItemStyle, { className: `item-container ${className || ''}` },
|
|
26
26
|
checkout_review && (React.createElement("div", { className: `change-address-wrap` },
|
|
27
27
|
React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1`, text: title }),
|
|
28
28
|
React.createElement(AccountButton, { text: `change`, btnType: `green-small-text`, onClick: onClick }))),
|
|
29
29
|
React.createElement("div", { className: `item-internal-wrap` },
|
|
30
30
|
React.createElement("div", { className: `relative-wrapper` },
|
|
31
|
-
React.createElement("div", { className: `personal-data-wrap` },
|
|
32
|
-
React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1`, text: `${data.first_name} ${data.last_name}` }),
|
|
33
|
-
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 col-wrap`, text: `${data.address_1}, ${data.address_2 ? data.address_2 + ',' : ''}` }),
|
|
34
|
-
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1`, text: `${data.city}` }),
|
|
35
|
-
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 phone col-wrap`, text: `${data.phone}` })),
|
|
31
|
+
React.createElement("div", { className: `personal-data-wrap` }, data.displayLines.map((line, index) => (React.createElement(Text, { key: index, className: `account-p account-p3 ${index == 0 ? 'account-font-bold' : 'account-font-regular'} ${index % 2 != 0 ? 'col-wrap' : ''} account-primary-color1`, text: line })))),
|
|
36
32
|
data.is_default ? (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 margin-style is-default`, text: `${type === 'shipping' ? 'defaultShippingAddress' : type == 'billing' ? 'defaultBillingAddress' : 'defaultAddress'}` })) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 margin-style opacity-zero`, text: `empty` })),
|
|
37
33
|
select_address && (React.createElement("div", { className: `circle-selected-wrap cursor-pointer ${checkedId == data.id ? 'active' : ''}`, onClick: () => setCheckedId(data.id) },
|
|
38
34
|
React.createElement("svg", { version: '1.1', viewBox: '0 0 32 32', xmlns: 'http://www.w3.org/2000/svg', className: `checkbox-icon ${selectedAddresses?.id === data.id ? 'selected' : 'note-selected'}` },
|
|
39
35
|
React.createElement("path", { d: 'M13.345 30.462c-1.062 0-1.859-0.531-2.39-1.328l-9.56-16.996c-0.797-1.328-0.266-2.921 1.062-3.718 1.328-0.531 2.921 0 3.718 1.328l7.436 13.012 12.481-20.183c0.797-1.328 2.39-1.593 3.718-0.797s1.593 2.39 0.797 3.718l-14.871 23.635c-0.531 0.797-1.328 1.328-2.39 1.328z' }))))),
|
|
40
36
|
!checkout_review && (React.createElement("div", { className: `edit-remove-wrapper` },
|
|
41
|
-
|
|
37
|
+
React.createElement(AccountButton, { text: `edit`, btnType: `green-small-text`, onClick: handleEditAddressPopup, className: `btn-one-address-version ${!select_address || (select_address && checkedId == data.id) ? 'show' : ''}` }),
|
|
42
38
|
!select_address && !data.is_default && (React.createElement(React.Fragment, null,
|
|
43
39
|
React.createElement("div", { className: `vertical-line` }),
|
|
44
|
-
React.createElement(AccountButton, { text: `remove`, onClick: handleDeletePopup, btnType: `green-small-text`, className:
|
|
40
|
+
React.createElement(AccountButton, { text: `remove`, onClick: handleDeletePopup, btnType: `green-small-text`, className: `btn-more-address-version` })))))))) : null;
|
|
45
41
|
};
|
|
46
42
|
export default AddressItem;
|
|
@@ -111,6 +111,16 @@ const AddressItemStyle = styled.section `
|
|
|
111
111
|
margin-bottom: var(--account_changeAddressWrapMBot);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
.btn-one-address-version {
|
|
115
|
+
opacity: 0;
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
|
|
118
|
+
&.show {
|
|
119
|
+
pointer-events: all;
|
|
120
|
+
opacity: 1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
114
124
|
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeL}) {
|
|
115
125
|
--account_itemInternalWrapPad: var(--sp3x);
|
|
116
126
|
--account_verticalLineHeight: var(--sp1-5x);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export function useAddressContext(): any;
|
|
2
|
-
export function AddressProvider({ addressType, addressFormFields, useUser,
|
|
2
|
+
export function AddressProvider({ addressType, addressFormFields, useUser, children }: {
|
|
3
3
|
addressType: any;
|
|
4
4
|
addressFormFields?: any[];
|
|
5
5
|
useUser: any;
|
|
6
|
-
useCart: any;
|
|
7
6
|
children: any;
|
|
8
7
|
}): React.JSX.Element;
|
|
9
8
|
import React from 'react';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { api } from '@weareconceptstudio/core';
|
|
3
|
+
import { useCheckoutContext } from '../checkout';
|
|
3
4
|
const AddressContext = createContext(null);
|
|
4
5
|
export const useAddressContext = () => {
|
|
5
6
|
const context = useContext(AddressContext);
|
|
6
7
|
return context;
|
|
7
8
|
};
|
|
8
|
-
export const AddressProvider = ({ addressType, addressFormFields = [], useUser,
|
|
9
|
+
export const AddressProvider = ({ addressType, addressFormFields = [], useUser, children }) => {
|
|
9
10
|
const { isLoggedIn } = useUser();
|
|
10
|
-
const {
|
|
11
|
-
const [addressLoading, setAddressLoading] = useState(
|
|
11
|
+
const { fillCheckoutData, fillCart } = useCheckoutContext();
|
|
12
|
+
const [addressLoading, setAddressLoading] = useState(false);
|
|
12
13
|
const [addresses, setAddresses] = useState(addressType ? { billing: [], shipping: [] } : []);
|
|
13
14
|
const [selectedAddresses, setSelectedAddresses] = useState(addressType ? { billing: {}, shipping: {} } : {});
|
|
14
|
-
const [checkoutAddressId, setCheckoutAddressId] = useState(null);
|
|
15
15
|
const hasAddressType = useMemo(() => {
|
|
16
16
|
return !!addressType;
|
|
17
17
|
}, [addressType]);
|
|
@@ -23,6 +23,7 @@ export const AddressProvider = ({ addressType, addressFormFields = [], useUser,
|
|
|
23
23
|
}, [hasAddressType, addresses]);
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (isLoggedIn) {
|
|
26
|
+
setAddressLoading(true);
|
|
26
27
|
api.get({ url: 'addresses' }).then((res) => {
|
|
27
28
|
if (addressType) {
|
|
28
29
|
}
|
|
@@ -74,8 +75,8 @@ export const AddressProvider = ({ addressType, addressFormFields = [], useUser,
|
|
|
74
75
|
const selectAddress = ({ checkedId, type }) => {
|
|
75
76
|
const checkedAddress = (type ? addresses[type] : addresses).find((item) => item.id === checkedId);
|
|
76
77
|
setSelectedAddresses(checkedAddress);
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
fillCheckoutData('addressId', checkedId);
|
|
79
|
+
fillCart('addressId', checkedId);
|
|
79
80
|
};
|
|
80
81
|
return (React.createElement(AddressContext.Provider, { value: {
|
|
81
82
|
addressLoading,
|
|
@@ -89,6 +90,5 @@ export const AddressProvider = ({ addressType, addressFormFields = [], useUser,
|
|
|
89
90
|
setSelectedAddresses,
|
|
90
91
|
hasCheckoutAddress,
|
|
91
92
|
selectAddress,
|
|
92
|
-
checkoutAddressId,
|
|
93
93
|
} }, children));
|
|
94
94
|
};
|
|
@@ -5,8 +5,7 @@ import SelectAddressPopup from '../SelectAddressPopup';
|
|
|
5
5
|
import AddressItem from '../AddressItem';
|
|
6
6
|
const SelectAddress = () => {
|
|
7
7
|
const { openPopup } = useUi();
|
|
8
|
-
const
|
|
9
|
-
const { selectedAddresses, setSelectedAddresses, hasAddressType } = addressContext;
|
|
8
|
+
const { selectedAddresses, hasAddressType } = useAddressContext();
|
|
10
9
|
const handleSelectPopup = useCallback(({ title, type }) => {
|
|
11
10
|
openPopup(React.createElement(SelectAddressPopup, { title: title, type: type }), { accountIcon: true });
|
|
12
11
|
}, []);
|
|
@@ -14,7 +13,7 @@ const SelectAddress = () => {
|
|
|
14
13
|
React.createElement(AddressItem, { checkout_review: true, type: 'shipping', select_address: false, title: 'shippingAddress', data: selectedAddresses.shipping, onClick: () => handleSelectPopup({
|
|
15
14
|
title: 'selectShippingAddress',
|
|
16
15
|
type: 'shipping',
|
|
17
|
-
})
|
|
16
|
+
}) }),
|
|
18
17
|
React.createElement(AddressItem, { checkout_review: true, type: 'billing', select_address: false, title: 'billingAddress', data: selectedAddresses.billing, onClick: () => handleSelectPopup({
|
|
19
18
|
title: 'selectBillingAddress',
|
|
20
19
|
type: 'billing',
|
|
@@ -33,26 +33,10 @@ const SelectAddressPopup = Memo(({ title, type }) => {
|
|
|
33
33
|
if (addresses.length > 2 && flexWrapperRef.current) {
|
|
34
34
|
const container = flexWrapperRef.current;
|
|
35
35
|
const items = Array.from(container.children);
|
|
36
|
-
const maxHeight = Math.max(...items.
|
|
37
|
-
|
|
38
|
-
console.log(maxHeight, minHeight);
|
|
39
|
-
console.log(maxHeight, minHeight);
|
|
40
|
-
if (winWidth < 768) {
|
|
41
|
-
const first = Math.max(...items.slice(0, 1).map((item) => item.clientHeight));
|
|
42
|
-
const second = Math.min(...items.slice(1, 2).map((item) => item.clientHeight));
|
|
43
|
-
console.log(items.slice(0, 1), items.slice(1, 2));
|
|
44
|
-
styleRef.current.style.setProperty('--item-max-height', `${first + second}px`);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
styleRef.current.style.setProperty('--item-max-height', `${maxHeight + minHeight}px`);
|
|
48
|
-
}
|
|
36
|
+
const maxHeight = Math.max(...items.map((item) => item.clientHeight));
|
|
37
|
+
styleRef.current.style.setProperty('--item-max-height', `${maxHeight * 2}px`);
|
|
49
38
|
}
|
|
50
|
-
}, [
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (styleRef.current) {
|
|
53
|
-
styleRef.current.style.height = styleRef.current.clientHeight + 'px';
|
|
54
|
-
}
|
|
55
|
-
}, []);
|
|
39
|
+
}, [addresses, flexWrapperRef.current, resize, winWidth]);
|
|
56
40
|
return (React.createElement(SelectAddressPopupStyle, { ref: styleRef },
|
|
57
41
|
React.createElement("div", { className: `select-address-wrap` },
|
|
58
42
|
React.createElement(Text, { tag: `h6`, className: hasAddressType ? `account-h6 account-font-bold account-primary-color1` : 'account-p account-p2 account-font-bold account-primary-color1', text: title }),
|
|
@@ -24,6 +24,11 @@ const ShippingBillingFormStyle = styled.div `
|
|
|
24
24
|
--account_antFormItemWidth: 100%;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
.empty-form-item {
|
|
29
|
+
width: var(--account_antFormItemWidth);
|
|
30
|
+
padding: 0 calc(var(--account_formItemDistance) / 2);
|
|
31
|
+
}
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeL}) {
|
|
@@ -11,9 +11,6 @@ const ShippingBillingInfo = memo(({ className, shipping_address, billing_address
|
|
|
11
11
|
React.createElement("div", { className: `info-space-line` }),
|
|
12
12
|
React.createElement("div", { className: `info-wrap shipped` },
|
|
13
13
|
React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 value`, text: `shippedTo` }),
|
|
14
|
-
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 nowrap`, text:
|
|
15
|
-
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 nowrap`, text: `${shipping_address.address_1}, ${shipping_address.address_2 ? shipping_address.address_2 + ',' : ''}` }),
|
|
16
|
-
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 nowrap`, text: `${shipping_address.city}` }),
|
|
17
|
-
React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 phone`, text: `${shipping_address.phone}` }))));
|
|
14
|
+
shipping_address.map((item) => (React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 nowrap`, text: item }))))));
|
|
18
15
|
});
|
|
19
16
|
export default ShippingBillingInfo;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export default CartTemplate;
|
|
2
|
-
declare function CartTemplate({ children, actions, btnDisabled, checkoutUrl }: {
|
|
2
|
+
declare function CartTemplate({ children, actions, btnDisabled, checkoutUrl, moreMenu }: {
|
|
3
3
|
children: any;
|
|
4
4
|
actions: any;
|
|
5
5
|
btnDisabled: any;
|
|
6
6
|
checkoutUrl?: string;
|
|
7
|
+
moreMenu: any;
|
|
7
8
|
}): React.JSX.Element;
|
|
8
9
|
import React from 'react';
|
|
@@ -12,7 +12,7 @@ const leftArrow = (React.createElement("svg", { fill: 'none', viewBox: '0 0 16 1
|
|
|
12
12
|
import CartTemplateStyle from './style';
|
|
13
13
|
//* Skeleton
|
|
14
14
|
import SkeletonCartTemplate from './Skeleton';
|
|
15
|
-
const CartTemplate = ({ children, actions, btnDisabled, checkoutUrl = '/checkout/' }) => {
|
|
15
|
+
const CartTemplate = ({ children, actions, btnDisabled, checkoutUrl = '/checkout/', moreMenu }) => {
|
|
16
16
|
const { shopUrl, useCart } = useAccountContext();
|
|
17
17
|
const { translate } = useTranslation();
|
|
18
18
|
const { items, itemsCount, shippingCost, loading, subtotal, total, freeShippingRange, shippingCostValue } = useCart();
|
|
@@ -33,7 +33,8 @@ const CartTemplate = ({ children, actions, btnDisabled, checkoutUrl = '/checkout
|
|
|
33
33
|
horizontalLine: true,
|
|
34
34
|
edit: { list: false },
|
|
35
35
|
} }),
|
|
36
|
-
shopUrl ? (React.createElement(AccountButton, { url: shopUrl, btnType: `purple-text`, text: `continueShopping`, className: `continue-shop-text` })) : null
|
|
36
|
+
shopUrl ? (React.createElement(AccountButton, { url: shopUrl, btnType: `purple-text`, text: `continueShopping`, className: `continue-shop-text` })) : null,
|
|
37
|
+
moreMenu ? moreMenu : null)) : (React.createElement(EmptyCart, { data: items, shoppingUrl: shopUrl }))) : (React.createElement(SkeletonCartTemplate, { shopUrl: shopUrl }))),
|
|
37
38
|
children))));
|
|
38
39
|
};
|
|
39
40
|
export default CartTemplate;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export const emptyCartIcon = (React.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '129', height: '181', viewBox: '0 0 129 181' },
|
|
3
|
-
React.createElement("g", {
|
|
3
|
+
React.createElement("g", { clipPath: 'url(#clip0_2872_19370)' },
|
|
4
4
|
React.createElement("path", { d: 'M107.4 170.413C98.7374 169.552 91.9468 162.232 91.9468 153.353C91.9468 144.474 98.4753 137.445 106.897 136.355L106.743 126.038L97.9344 83.301H14.4453L23.4912 125.548C23.512 125.656 23.5245 125.764 23.5245 125.872V180.963H107.554L107.396 170.421L107.4 170.413Z' }),
|
|
5
5
|
React.createElement("path", { d: 'M0 126.292V180.959H20.4385V126.03L10.3482 78.9113L0 126.292Z' }),
|
|
6
6
|
React.createElement("path", { d: 'M97.2981 80.2124L95.8418 73.1456H12.2695L13.7841 80.2124H97.2981Z' }),
|