@homefile/components-v2 2.7.23 → 2.7.25
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/myProfile/MyProfileContent.d.ts +1 -1
- package/dist/components/myProfile/MyProfileContent.js +7 -8
- package/dist/components/myProfile/ProfilePaymentTab.d.ts +1 -1
- package/dist/components/myProfile/ProfilePaymentTab.js +3 -21
- package/dist/interfaces/myProfile/ProfilePaymentTab.interface.d.ts +1 -4
- package/package.json +1 -1
- package/src/components/myProfile/MyProfileContent.tsx +23 -28
- package/src/components/myProfile/ProfilePaymentTab.tsx +16 -56
- package/src/interfaces/myProfile/ProfilePaymentTab.interface.ts +1 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { MyProfileContentI } from '../../interfaces';
|
|
2
|
-
export declare const MyProfileContent: ({ user, payment, plans, onSubmit, handleClose, isLoading }: MyProfileContentI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const MyProfileContent: ({ user, payment, plans, onSubmit, handleClose, isLoading, }: MyProfileContentI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { t } from 'i18next';
|
|
3
|
-
import { DrawerBody, DrawerContent, DrawerFooter, DrawerHeader, } from '@chakra-ui/react';
|
|
3
|
+
import { DrawerBody, DrawerContent, DrawerFooter, DrawerHeader, Center, } from '@chakra-ui/react';
|
|
4
4
|
import { Profile } from '../../assets/images';
|
|
5
5
|
import { PanelHeader, TabsHeader, ProfileDetailsTab, ProfileAccountTab, ProfilePaymentTab, FooterDrawer, FooterButtons, } from '..';
|
|
6
6
|
import { useMyProfileContent } from '../../hooks';
|
|
7
|
-
import BeatLoader from
|
|
8
|
-
|
|
9
|
-
export const MyProfileContent = ({ user, payment, plans, onSubmit, handleClose, isLoading }) => {
|
|
7
|
+
import BeatLoader from 'react-spinners/BeatLoader';
|
|
8
|
+
export const MyProfileContent = ({ user, payment, plans, onSubmit, handleClose, isLoading, }) => {
|
|
10
9
|
const { handlePlanChange, handleSubmit } = useMyProfileContent({
|
|
11
10
|
user,
|
|
12
11
|
plans,
|
|
@@ -19,17 +18,17 @@ export const MyProfileContent = ({ user, payment, plans, onSubmit, handleClose,
|
|
|
19
18
|
},
|
|
20
19
|
{
|
|
21
20
|
label: t('myProfile.tabs.tab3'),
|
|
22
|
-
component: _jsx(ProfilePaymentTab, Object.assign({}, payment
|
|
21
|
+
component: _jsx(ProfilePaymentTab, Object.assign({}, payment)),
|
|
23
22
|
},
|
|
24
23
|
{
|
|
25
24
|
label: t('myProfile.tabs.tab2'),
|
|
26
25
|
component: _jsx(ProfileAccountTab, Object.assign({}, plans, { onChange: handlePlanChange })),
|
|
27
|
-
}
|
|
26
|
+
},
|
|
28
27
|
];
|
|
29
|
-
return (_jsxs(DrawerContent, { bg: "lightBlue.1", p: "0", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: handleClose, icon: Profile, title: t('myProfile.title') }) }), _jsx(DrawerBody, { p: "0", mb: "104px", children: isLoading ? (_jsx(Center, { h: "4rem", bg: "neutral.white", children: _jsx(BeatLoader, { color: "gray", size: 8 }) })) : (_jsx(TabsHeader, { tabList: tabs })) }), _jsx(DrawerFooter, { p: "0", zIndex: "dropdown", children: _jsx(FooterDrawer, { children: _jsx(FooterButtons, { button1: {
|
|
28
|
+
return (_jsxs(DrawerContent, { bg: "lightBlue.1", p: "0", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: handleClose, icon: Profile, title: t('myProfile.title') }) }), _jsx(DrawerBody, { p: "0", mb: "104px", children: isLoading ? (_jsx(Center, { h: "4rem", bg: "neutral.white", children: _jsx(BeatLoader, { color: "gray", size: 8 }) })) : (_jsx(TabsHeader, { tabList: tabs })) }), _jsx(DrawerFooter, { p: "0", zIndex: "dropdown", children: _jsx(FooterDrawer, { isOpen: true, children: _jsx(FooterButtons, { button1: {
|
|
30
29
|
buttonStyle: 'primaryFooter',
|
|
31
30
|
isDisabled: false,
|
|
32
31
|
label: 'save',
|
|
33
32
|
onClick: handleSubmit,
|
|
34
|
-
} })
|
|
33
|
+
} }) }) })] }));
|
|
35
34
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ProfilePaymentTabI } from '../../interfaces';
|
|
2
|
-
export declare const ProfilePaymentTab: ({ paymentMethod, receipts, handleDelete,
|
|
2
|
+
export declare const ProfilePaymentTab: ({ paymentMethod, receipts, handleDelete, handleNewCard, }: ProfilePaymentTabI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { usePaymentMethod } from '../../hooks';
|
|
5
|
-
import { Button, Flex } from '@chakra-ui/react';
|
|
6
|
-
export const ProfilePaymentTab = ({ paymentMethod, receipts, handleDelete, isStandAlone, handleAddCard, handleNewCard, buttonLabel, }) => {
|
|
7
|
-
const [hasSavedCreditCard, updateSavedCard] = useState(false);
|
|
8
|
-
const { handleSubmit } = usePaymentMethod(handleAddCard);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (paymentMethod.number) {
|
|
11
|
-
updateSavedCard(true);
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
updateSavedCard(false);
|
|
15
|
-
}
|
|
16
|
-
}, [paymentMethod]);
|
|
2
|
+
import { MyProfileReceipts, CreditCardContainer } from '..';
|
|
3
|
+
export const ProfilePaymentTab = ({ paymentMethod, receipts, handleDelete, handleNewCard, }) => {
|
|
17
4
|
const hasReceipts = receipts.length > 0;
|
|
18
|
-
|
|
19
|
-
brand: '',
|
|
20
|
-
number: '',
|
|
21
|
-
isPaymentMethodValid: false,
|
|
22
|
-
};
|
|
23
|
-
return hasSavedCreditCard ? (_jsxs(_Fragment, { children: [_jsx(CreditCardContainer, { brand: brand, cardNumber: number, hasError: !isPaymentMethodValid, onAddCard: handleNewCard, onDeleteCard: handleDelete, onSubmit: () => null, cardHolder: '', cvv: '', expirationMonth: '', expirationYear: '' }), hasReceipts && _jsx(MyProfileReceipts, { receipts })] })) : (_jsxs(Flex, { flexDir: 'column', w: "100%", alignItems: 'center', children: [_jsx(AddCreditCard, {}), isStandAlone && (_jsx(Flex, { justifyContent: 'center', alignItems: "center", mt: '1rem', children: _jsx(Button, { variant: 'primaryFooter', onClick: handleSubmit, w: 'fit-content', children: buttonLabel }) }))] }));
|
|
5
|
+
return (_jsxs(_Fragment, { children: [paymentMethod && (_jsx(CreditCardContainer, { brand: paymentMethod.brand, cardNumber: paymentMethod.number, hasError: !paymentMethod.isPaymentMethodValid, onAddCard: handleNewCard, onDeleteCard: handleDelete, onSubmit: () => null, cardHolder: '', cvv: '', expirationMonth: '', expirationYear: '' })), hasReceipts && _jsx(MyProfileReceipts, { receipts })] }));
|
|
24
6
|
};
|
|
@@ -8,11 +8,8 @@ export interface MyProfileReceiptsI {
|
|
|
8
8
|
id: string;
|
|
9
9
|
}
|
|
10
10
|
export interface ProfilePaymentTabI {
|
|
11
|
-
paymentMethod
|
|
11
|
+
paymentMethod?: PaymentMethodI;
|
|
12
12
|
receipts: MyProfileReceiptsI[];
|
|
13
13
|
handleDelete: () => void;
|
|
14
|
-
isStandAlone: boolean;
|
|
15
|
-
handleAddCard: (form: any) => void;
|
|
16
14
|
handleNewCard: () => void;
|
|
17
|
-
buttonLabel: string;
|
|
18
15
|
}
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
DrawerContent,
|
|
5
5
|
DrawerFooter,
|
|
6
6
|
DrawerHeader,
|
|
7
|
+
Center,
|
|
7
8
|
} from '@chakra-ui/react'
|
|
8
9
|
import { Profile } from '@/assets/images'
|
|
9
10
|
import {
|
|
@@ -17,8 +18,7 @@ import {
|
|
|
17
18
|
} from '@/components'
|
|
18
19
|
import { MyProfileContentI } from '@/interfaces'
|
|
19
20
|
import { useMyProfileContent } from '@/hooks'
|
|
20
|
-
import BeatLoader from
|
|
21
|
-
import { Center } from "@chakra-ui/react";
|
|
21
|
+
import BeatLoader from 'react-spinners/BeatLoader'
|
|
22
22
|
|
|
23
23
|
export const MyProfileContent = ({
|
|
24
24
|
user,
|
|
@@ -26,9 +26,9 @@ export const MyProfileContent = ({
|
|
|
26
26
|
plans,
|
|
27
27
|
onSubmit,
|
|
28
28
|
handleClose,
|
|
29
|
-
isLoading
|
|
29
|
+
isLoading,
|
|
30
30
|
}: MyProfileContentI) => {
|
|
31
|
-
const { handlePlanChange,handleSubmit } = useMyProfileContent({
|
|
31
|
+
const { handlePlanChange, handleSubmit } = useMyProfileContent({
|
|
32
32
|
user,
|
|
33
33
|
plans,
|
|
34
34
|
onSubmit,
|
|
@@ -41,12 +41,12 @@ export const MyProfileContent = ({
|
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
label: t('myProfile.tabs.tab3'),
|
|
44
|
-
component: <ProfilePaymentTab {...payment}
|
|
44
|
+
component: <ProfilePaymentTab {...payment} />,
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
label: t('myProfile.tabs.tab2'),
|
|
48
48
|
component: <ProfileAccountTab {...plans} onChange={handlePlanChange} />,
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
50
|
]
|
|
51
51
|
|
|
52
52
|
return (
|
|
@@ -59,30 +59,25 @@ export const MyProfileContent = ({
|
|
|
59
59
|
/>
|
|
60
60
|
</DrawerHeader>
|
|
61
61
|
<DrawerBody p="0" mb="104px">
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
)
|
|
70
|
-
}
|
|
62
|
+
{isLoading ? (
|
|
63
|
+
<Center h="4rem" bg="neutral.white">
|
|
64
|
+
<BeatLoader color="gray" size={8} />
|
|
65
|
+
</Center>
|
|
66
|
+
) : (
|
|
67
|
+
<TabsHeader tabList={tabs} />
|
|
68
|
+
)}
|
|
71
69
|
</DrawerBody>
|
|
72
70
|
<DrawerFooter p="0" zIndex="dropdown">
|
|
73
|
-
<FooterDrawer
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
isOpen
|
|
85
|
-
/>
|
|
71
|
+
<FooterDrawer isOpen>
|
|
72
|
+
<FooterButtons
|
|
73
|
+
button1={{
|
|
74
|
+
buttonStyle: 'primaryFooter',
|
|
75
|
+
isDisabled: false,
|
|
76
|
+
label: 'save',
|
|
77
|
+
onClick: handleSubmit,
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
</FooterDrawer>
|
|
86
81
|
</DrawerFooter>
|
|
87
82
|
</DrawerContent>
|
|
88
83
|
)
|
|
@@ -1,71 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
AddCreditCard,
|
|
4
|
-
MyProfileReceipts,
|
|
5
|
-
CreditCardContainer,
|
|
6
|
-
} from '@/components'
|
|
1
|
+
import { MyProfileReceipts, CreditCardContainer } from '@/components'
|
|
7
2
|
import { ProfilePaymentTabI } from '@/interfaces'
|
|
8
|
-
import { usePaymentMethod } from '@/hooks'
|
|
9
|
-
import { Button, Flex } from '@chakra-ui/react'
|
|
10
3
|
|
|
11
4
|
export const ProfilePaymentTab = ({
|
|
12
5
|
paymentMethod,
|
|
13
6
|
receipts,
|
|
14
7
|
handleDelete,
|
|
15
|
-
isStandAlone,
|
|
16
|
-
handleAddCard,
|
|
17
8
|
handleNewCard,
|
|
18
|
-
buttonLabel,
|
|
19
9
|
}: ProfilePaymentTabI) => {
|
|
20
|
-
const [hasSavedCreditCard, updateSavedCard] = useState(false)
|
|
21
|
-
|
|
22
|
-
const { handleSubmit } = usePaymentMethod(handleAddCard)
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (paymentMethod.number) {
|
|
26
|
-
updateSavedCard(true)
|
|
27
|
-
} else {
|
|
28
|
-
updateSavedCard(false)
|
|
29
|
-
}
|
|
30
|
-
}, [paymentMethod])
|
|
31
|
-
|
|
32
10
|
const hasReceipts = receipts.length > 0
|
|
33
|
-
const { brand, number, isPaymentMethodValid } = paymentMethod || {
|
|
34
|
-
brand: '',
|
|
35
|
-
number: '',
|
|
36
|
-
isPaymentMethodValid: false,
|
|
37
|
-
}
|
|
38
11
|
|
|
39
|
-
return
|
|
12
|
+
return (
|
|
40
13
|
<>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
14
|
+
{paymentMethod && (
|
|
15
|
+
<CreditCardContainer
|
|
16
|
+
brand={paymentMethod.brand}
|
|
17
|
+
cardNumber={paymentMethod.number}
|
|
18
|
+
hasError={!paymentMethod.isPaymentMethodValid}
|
|
19
|
+
onAddCard={handleNewCard}
|
|
20
|
+
onDeleteCard={handleDelete}
|
|
21
|
+
onSubmit={() => null}
|
|
22
|
+
cardHolder={''}
|
|
23
|
+
cvv={''}
|
|
24
|
+
expirationMonth={''}
|
|
25
|
+
expirationYear={''}
|
|
26
|
+
/>
|
|
27
|
+
)}
|
|
53
28
|
{hasReceipts && <MyProfileReceipts {...{ receipts }} />}
|
|
54
29
|
</>
|
|
55
|
-
) : (
|
|
56
|
-
<Flex flexDir={'column'} w="100%" alignItems={'center'}>
|
|
57
|
-
<AddCreditCard />
|
|
58
|
-
{isStandAlone && (
|
|
59
|
-
<Flex justifyContent={'center'} alignItems="center" mt={'1rem'}>
|
|
60
|
-
<Button
|
|
61
|
-
variant={'primaryFooter'}
|
|
62
|
-
onClick={handleSubmit}
|
|
63
|
-
w={'fit-content'}
|
|
64
|
-
>
|
|
65
|
-
{buttonLabel}
|
|
66
|
-
</Button>
|
|
67
|
-
</Flex>
|
|
68
|
-
)}
|
|
69
|
-
</Flex>
|
|
70
30
|
)
|
|
71
31
|
}
|
|
@@ -10,11 +10,8 @@ export interface MyProfileReceiptsI {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface ProfilePaymentTabI {
|
|
13
|
-
paymentMethod
|
|
13
|
+
paymentMethod?: PaymentMethodI
|
|
14
14
|
receipts: MyProfileReceiptsI[]
|
|
15
15
|
handleDelete: () => void
|
|
16
|
-
isStandAlone: boolean
|
|
17
|
-
handleAddCard: (form: any) => void
|
|
18
16
|
handleNewCard: () => void
|
|
19
|
-
buttonLabel: string
|
|
20
17
|
}
|