@weareconceptstudio/account 0.3.8 → 0.3.9
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 +7 -5
- package/dist/modules/payment/PaymentMethodItem/index.js +1 -1
- package/dist/modules/payment/PaymentMethodsTemplate/index.js +1 -2
- 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';
|
|
@@ -7,6 +7,7 @@ import { useCheckoutContext } from '../CheckoutProvider';
|
|
|
7
7
|
import StepReview from './StepReview';
|
|
8
8
|
import StepShipping from './StepShipping';
|
|
9
9
|
import AccountContainer from '../../../components/AccountContainer';
|
|
10
|
+
import Loader from '../../../components/Loader';
|
|
10
11
|
//* Styles
|
|
11
12
|
import CheckoutTemplateStyle from './style';
|
|
12
13
|
//* Skeleton
|
|
@@ -18,7 +19,7 @@ const CheckoutTemplate = () => {
|
|
|
18
19
|
const { hasCheckoutAddress, addressLoading } = useAddressContext();
|
|
19
20
|
const { handleCheckout } = useCheckoutContext();
|
|
20
21
|
const { useCart } = useAccountContext();
|
|
21
|
-
const { items } = useCart();
|
|
22
|
+
const { items, itemsCount } = useCart();
|
|
22
23
|
const checkStep = {
|
|
23
24
|
isShipping: !hasCheckoutAddress,
|
|
24
25
|
isReview: hasCheckoutAddress,
|
|
@@ -41,7 +42,8 @@ const CheckoutTemplate = () => {
|
|
|
41
42
|
}
|
|
42
43
|
}, [checkStep]);
|
|
43
44
|
return (React.createElement(Page, { className: 'checkout use-account' },
|
|
44
|
-
React.createElement(
|
|
45
|
+
React.createElement(Loader, { className: 'checkout', pathname: window.location.pathname }),
|
|
46
|
+
itemsCount ? (React.createElement(AccountContainer, { className: `second-version` },
|
|
45
47
|
React.createElement(CheckoutTemplateStyle, null,
|
|
46
48
|
React.createElement(TotalCheckout, { isShipping: checkStep.isShipping, buttonProps: {
|
|
47
49
|
url: false,
|
|
@@ -54,6 +56,6 @@ const CheckoutTemplate = () => {
|
|
|
54
56
|
checkStep.isShipping ? React.createElement(StepShipping, { firstStepFormRef: firstStepFormRef }) : React.createElement(StepReview, { items: items }))) : (React.createElement(React.Fragment, null,
|
|
55
57
|
React.createElement(SequenceSkeleton, { className: 'sequence-checkout-template' }),
|
|
56
58
|
React.createElement(SkeletonAddressSelect, { className: 'address-checkout-template' }),
|
|
57
|
-
React.createElement(SkeletonCartTemplate, null))))))));
|
|
59
|
+
React.createElement(SkeletonCartTemplate, null))))))) : null));
|
|
58
60
|
};
|
|
59
61
|
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;
|
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