@weareconceptstudio/account 0.3.8 → 0.4.0
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/modules/account/AccountBalanceTemplate/HistoryBalance/ItemHistory/index.js +1 -6
- package/dist/modules/account/AccountSettingsTemplate/AccountInfo/index.js +1 -1
- package/dist/modules/account/AccountSettingsTemplate/AccountPassword/index.js +1 -1
- package/dist/modules/address/AddressForm/index.js +9 -4
- package/dist/modules/checkout/CheckoutTemplate/index.js +17 -18
- package/dist/modules/payment/PaymentMethodItem/index.js +1 -1
- package/dist/modules/payment/PaymentMethodsTemplate/index.js +1 -2
- package/dist/modules/payment/SelectedPayment/index.js +1 -1
- package/dist/translations/en.d.ts +1 -0
- package/dist/translations/en.js +1 -0
- package/dist/translations/hy.d.ts +1 -0
- package/dist/translations/hy.js +1 -0
- package/dist/translations/index.d.ts +3 -0
- package/dist/translations/ru.d.ts +1 -0
- package/dist/translations/ru.js +1 -0
- package/package.json +1 -1
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { Text, useTranslation } from '@weareconceptstudio/core';
|
|
3
|
-
import { useAccountContext } from '../../../../../AccountProvider';
|
|
4
3
|
//* Styles
|
|
5
4
|
import ItemHistoryStyle from './style';
|
|
6
5
|
const ItemHistory = ({ date, activity, value, action_type }) => {
|
|
7
6
|
const { translate } = useTranslation();
|
|
8
|
-
const { useCart } = useAccountContext();
|
|
9
|
-
const { currency } = useCart();
|
|
10
7
|
//! Refs
|
|
11
8
|
const titleWrapperRef = useRef();
|
|
12
9
|
const getSizeItem = useRef();
|
|
@@ -39,9 +36,7 @@ const ItemHistory = ({ date, activity, value, action_type }) => {
|
|
|
39
36
|
React.createElement(Text, { className: `account-primary-color1 account-font-medium account-p account-p1 amount-info-text ${action_type}` },
|
|
40
37
|
React.createElement(Text, { className: 'account-primary-color1 account-font-medium account-p1 mobile-amount-info-text first-letter', tag: 'span' }, translate('balanceCategoryAmount')),
|
|
41
38
|
' ',
|
|
42
|
-
value,
|
|
43
|
-
" ",
|
|
44
|
-
currency)),
|
|
39
|
+
value)),
|
|
45
40
|
React.createElement("div", { className: 'line-info' })));
|
|
46
41
|
};
|
|
47
42
|
export default ItemHistory;
|
|
@@ -35,6 +35,6 @@ const AccountInfo = ({ user, onAccountUpdate, displayFields = defaultDisplayFiel
|
|
|
35
35
|
} },
|
|
36
36
|
React.createElement("div", { className: `cancel-and-save-and-apply-wrap` },
|
|
37
37
|
React.createElement(AccountButton, { text: `cancel`, btnType: `green-large-text`, onClick: () => setEdit(false) }),
|
|
38
|
-
React.createElement(AccountButton, { type: 'submit', text: `
|
|
38
|
+
React.createElement(AccountButton, { type: 'submit', text: `saveChanges`, btnType: `full-width` }))))))));
|
|
39
39
|
};
|
|
40
40
|
export default AccountInfo;
|
|
@@ -34,6 +34,6 @@ const AccountPassword = ({ formFields = defaultFormFields, onPasswordUpdate }) =
|
|
|
34
34
|
}, className: 'form-items-wrap', onSubmit: onFinish, fields: formFields },
|
|
35
35
|
React.createElement("div", { className: `cancel-and-save-and-apply-wrap` },
|
|
36
36
|
React.createElement(AccountButton, { text: `cancel`, btnType: `green-large-text`, onClick: () => setEdit(false) }),
|
|
37
|
-
React.createElement(AccountButton, { type: 'submit', text: `
|
|
37
|
+
React.createElement(AccountButton, { type: 'submit', text: `saveChanges`, btnType: `full-width` }))))));
|
|
38
38
|
};
|
|
39
39
|
export default AccountPassword;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { memo as Memo, useState, useCallback } from 'react';
|
|
1
|
+
import React, { memo as Memo, useState, useCallback, useMemo } from 'react';
|
|
2
2
|
import { useUi, Text } from '@weareconceptstudio/core';
|
|
3
3
|
import { FormBuilder } from '@weareconceptstudio/form';
|
|
4
4
|
import { useAddressContext } from '../AddressProvider';
|
|
5
|
+
import { useCheckoutContext } from '../../checkout';
|
|
5
6
|
import AccountButton from '../../../components/AccountButton';
|
|
6
7
|
//* Icons
|
|
7
8
|
import { CheckboxIcon, CheckboxCheckedIcon } from '../../../utils/icons';
|
|
@@ -9,10 +10,14 @@ import { CheckboxIcon, CheckboxCheckedIcon } from '../../../utils/icons';
|
|
|
9
10
|
import AddressFormStyle from './style';
|
|
10
11
|
const AddressForm = Memo(({ title, data, type }) => {
|
|
11
12
|
const { formFields, createAddress, updateAddress } = useAddressContext();
|
|
13
|
+
const { isCheckoutPage } = useCheckoutContext();
|
|
12
14
|
const { closePopup } = useUi();
|
|
13
15
|
//! States
|
|
14
16
|
const [isChecked, setIsChecked] = useState(data?.is_default || false);
|
|
15
17
|
const [isDisabled, setIsDisabled] = useState(false);
|
|
18
|
+
const isEdit = useMemo(() => {
|
|
19
|
+
return !!data?.id;
|
|
20
|
+
}, [data]);
|
|
16
21
|
//! On Finish
|
|
17
22
|
const onFinish = useCallback((values) => {
|
|
18
23
|
const newData = {
|
|
@@ -22,10 +27,10 @@ const AddressForm = Memo(({ title, data, type }) => {
|
|
|
22
27
|
};
|
|
23
28
|
setIsDisabled(true);
|
|
24
29
|
return (!isDisabled &&
|
|
25
|
-
eval(
|
|
30
|
+
eval(isEdit ? `updateAddress({data: newData, addressId: data.id, type})` : `createAddress({data: newData, type})`).then(() => {
|
|
26
31
|
closePopup();
|
|
27
32
|
}));
|
|
28
|
-
}, [data, isChecked, createAddress, updateAddress, isDisabled]);
|
|
33
|
+
}, [data, isChecked, createAddress, updateAddress, isDisabled, isEdit]);
|
|
29
34
|
return (React.createElement(AddressFormStyle, { className: 'address-form-block' },
|
|
30
35
|
React.createElement(Text, { tag: `h6`, text: title, className: `account-h6 account-font-bold account-primary-color1 address-form-block-title` }),
|
|
31
36
|
React.createElement(FormBuilder, { formOptions: {
|
|
@@ -38,6 +43,6 @@ const AddressForm = Memo(({ title, data, type }) => {
|
|
|
38
43
|
React.createElement(Text, { className: `account-p account-p2 account-font-medium account-primary-color1 address-form-is-default-checkbox`, text: `${type === 'shipping' ? 'makeYourDefaultShippingAddress' : type == 'billing' ? 'makeYourDefaultBillingAddress' : 'makeYourDefaultAddress'}` }))) : (React.createElement(Text, { className: `account-p account-p2 account-font-medium account-primary-color1 address-form-is-default`, text: `${type === 'shipping' ? 'thisYourDefaultShippingAddress' : type == 'billing' ? 'thisYourDefaultBillingAddress' : 'thisYourDefaultAddress'}` }))),
|
|
39
44
|
React.createElement("div", { className: `cancel-and-save-wrap` },
|
|
40
45
|
React.createElement(AccountButton, { text: `cancel`, onClick: closePopup, btnType: `green-large-text`, className: `address-form-cancel-btn` }),
|
|
41
|
-
React.createElement(AccountButton, { type: 'submit', text:
|
|
46
|
+
React.createElement(AccountButton, { type: 'submit', text: `${isCheckoutPage ? 'saveAndApply' : isEdit ? 'saveChanges' : 'save'}`, btnType: `full-width`, className: `address-form-cancel-submit`, disabled: isDisabled })))));
|
|
42
47
|
});
|
|
43
48
|
export default AddressForm;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useCallback, useRef, useState } from 'react';
|
|
2
|
-
import { Page } from '@weareconceptstudio/core';
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Page, useEvent } from '@weareconceptstudio/core';
|
|
3
3
|
import { Sequence, TotalCheckout } from '../../../components';
|
|
4
4
|
import { useAddressContext } from '../../address';
|
|
5
5
|
import { useAccountContext } from '../../../AccountProvider';
|
|
@@ -18,7 +18,7 @@ const CheckoutTemplate = () => {
|
|
|
18
18
|
const { hasCheckoutAddress, addressLoading } = useAddressContext();
|
|
19
19
|
const { handleCheckout } = useCheckoutContext();
|
|
20
20
|
const { useCart } = useAccountContext();
|
|
21
|
-
const { items } = useCart();
|
|
21
|
+
const { items, itemsCount } = useCart();
|
|
22
22
|
const checkStep = {
|
|
23
23
|
isShipping: !hasCheckoutAddress,
|
|
24
24
|
isReview: hasCheckoutAddress,
|
|
@@ -40,20 +40,19 @@ const CheckoutTemplate = () => {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
}, [checkStep]);
|
|
43
|
-
return (React.createElement(Page, { className: 'checkout use-account' },
|
|
44
|
-
React.createElement(
|
|
45
|
-
React.createElement(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
React.createElement(SkeletonCartTemplate, null))))))));
|
|
43
|
+
return (React.createElement(Page, { className: 'checkout use-account' }, itemsCount ? (React.createElement(AccountContainer, { className: `second-version` },
|
|
44
|
+
React.createElement(CheckoutTemplateStyle, null,
|
|
45
|
+
React.createElement(TotalCheckout, { isShipping: checkStep.isShipping, buttonProps: {
|
|
46
|
+
url: false,
|
|
47
|
+
handleClick: handleCheckoutBtn,
|
|
48
|
+
type: checkStep.isShipping ? 'submit' : 'button',
|
|
49
|
+
text: checkStep.isShipping ? 'proceedToCheckout' : 'proceedToPayment',
|
|
50
|
+
loadingButton: loadingProcessToPayment,
|
|
51
|
+
} }, !addressLoading ? (React.createElement(React.Fragment, null,
|
|
52
|
+
React.createElement(Sequence, { step: checkStep.isShipping ? 'shipping' : 'review' }),
|
|
53
|
+
checkStep.isShipping ? React.createElement(StepShipping, { firstStepFormRef: firstStepFormRef }) : React.createElement(StepReview, { items: items }))) : (React.createElement(React.Fragment, null,
|
|
54
|
+
React.createElement(SequenceSkeleton, { className: 'sequence-checkout-template' }),
|
|
55
|
+
React.createElement(SkeletonAddressSelect, { className: 'address-checkout-template' }),
|
|
56
|
+
React.createElement(SkeletonCartTemplate, null))))))) : null));
|
|
58
57
|
};
|
|
59
58
|
export default CheckoutTemplate;
|
|
@@ -16,7 +16,7 @@ const PaymentMethodItem = ({ item, selectedPayment, setSelectedPayment, singlePa
|
|
|
16
16
|
return (React.createElement(PaymentMethodItemStyle, { className: `${isCardType && singlePayment && item?.card?.is_expired ? 'expired' : ''} ${singlePayment ? 'single-payment' : ''} custom-payment-options` },
|
|
17
17
|
React.createElement("div", { className: 'payment-option-top' },
|
|
18
18
|
React.createElement("div", { className: 'payment-item-left' },
|
|
19
|
-
icons[item.value],
|
|
19
|
+
icons?.[item.value],
|
|
20
20
|
React.createElement(Text, { className: 'payment-label account-p account-p3 account-font-regular account-primary-color1' }, item.label)),
|
|
21
21
|
React.createElement("div", { key: item.value, className: `circle-selected-wrap cursor-pointer ${selectedPayment === item.value || (item.value == 'card' && isNumeric(selectedPayment)) || singlePayment ? 'active' : ''}`, onClick: () => !singlePayment && setSelectedPayment(item.value) },
|
|
22
22
|
React.createElement("svg", { version: '1.1', viewBox: '0 0 32 32', xmlns: 'http://www.w3.org/2000/svg', className: `checkbox-icon ${selectedPayment === item.value || (item.value == 'card' && isNumeric(selectedPayment)) || singlePayment ? 'selected' : 'note-selected'}` },
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import React, { useState, useCallback } from 'react';
|
|
3
2
|
import { api, Text, useUi } from '@weareconceptstudio/core';
|
|
4
3
|
import { useAccountContext } from '../../../AccountProvider';
|
|
@@ -32,6 +31,6 @@ const PaymentMethodsTemplate = () => {
|
|
|
32
31
|
React.createElement(Text, { tag: `h6`, className: `account-font-medium account-primary-color1 title`, text: `myCards` }),
|
|
33
32
|
React.createElement(PaymentWrap, { selectedPayment: selectedPayment, setSelectedPayment: setSelectedPayment }),
|
|
34
33
|
React.createElement("div", { className: 'account-payment-btn-wrapper' },
|
|
35
|
-
React.createElement(AccountButton, { btnType: `full-width`, text: `
|
|
34
|
+
React.createElement(AccountButton, { btnType: `full-width`, text: `save`, onClick: handlePaymentMethodChangeSubmit })))));
|
|
36
35
|
};
|
|
37
36
|
export default PaymentMethodsTemplate;
|
|
@@ -23,6 +23,6 @@ const SelectedPayment = () => {
|
|
|
23
23
|
return paymentOptions.find((item) => item.value == checkoutData.paymentType);
|
|
24
24
|
}
|
|
25
25
|
}, [isCardType, checkoutData.paymentType]);
|
|
26
|
-
return (React.createElement(PaymentMethodItem, { singlePayment: true, isCardType: isCardType, item: selectedItem }));
|
|
26
|
+
return selectedItem ? (React.createElement(PaymentMethodItem, { singlePayment: true, isCardType: isCardType, item: selectedItem })) : null;
|
|
27
27
|
};
|
|
28
28
|
export default SelectedPayment;
|
package/dist/translations/en.js
CHANGED
package/dist/translations/hy.js
CHANGED
|
@@ -80,6 +80,7 @@ declare const _default: {
|
|
|
80
80
|
change: string;
|
|
81
81
|
edit: string;
|
|
82
82
|
submit: string;
|
|
83
|
+
save: string;
|
|
83
84
|
orderItems: string;
|
|
84
85
|
orderDate: string;
|
|
85
86
|
totalItems: string;
|
|
@@ -294,6 +295,7 @@ declare const _default: {
|
|
|
294
295
|
change: string;
|
|
295
296
|
edit: string;
|
|
296
297
|
submit: string;
|
|
298
|
+
save: string;
|
|
297
299
|
orderItems: string;
|
|
298
300
|
orderDate: string;
|
|
299
301
|
totalItems: string;
|
|
@@ -508,6 +510,7 @@ declare const _default: {
|
|
|
508
510
|
change: string;
|
|
509
511
|
edit: string;
|
|
510
512
|
submit: string;
|
|
513
|
+
save: string;
|
|
511
514
|
orderItems: string;
|
|
512
515
|
orderDate: string;
|
|
513
516
|
totalItems: string;
|
package/dist/translations/ru.js
CHANGED