@arthur2079/internal-profile 0.1.2-next.3 → 0.1.2-next.4
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/package.json +3 -3
- package/dist/api/errors.d.ts +0 -3
- package/dist/api/errors.js +0 -9
- package/dist/api/mod.d.ts +0 -4
- package/dist/api/mod.js +0 -2
- package/dist/api/request.d.ts +0 -19
- package/dist/api/request.js +0 -96
- package/dist/api/types.d.ts +0 -193
- package/dist/api/types.js +0 -1
- package/dist/components/ConnectWalletModal/ConnectWalletFooter.d.ts +0 -5
- package/dist/components/ConnectWalletModal/ConnectWalletFooter.js +0 -9
- package/dist/components/ConnectWalletModal/ConnectWalletModal.constants.d.ts +0 -5
- package/dist/components/ConnectWalletModal/ConnectWalletModal.constants.js +0 -8
- package/dist/components/ConnectWalletModal/ConnectWalletModal.d.ts +0 -3
- package/dist/components/ConnectWalletModal/ConnectWalletModal.helpers.d.ts +0 -2
- package/dist/components/ConnectWalletModal/ConnectWalletModal.helpers.js +0 -9
- package/dist/components/ConnectWalletModal/ConnectWalletModal.js +0 -194
- package/dist/components/ConnectWalletModal/ConnectWalletModal.styles.d.ts +0 -19
- package/dist/components/ConnectWalletModal/ConnectWalletModal.styles.js +0 -101
- package/dist/components/ConnectWalletModal/ConnectWalletModal.types.d.ts +0 -44
- package/dist/components/ConnectWalletModal/ConnectWalletModal.types.js +0 -1
- package/dist/components/ConnectWalletModal/EmptyWalletList.d.ts +0 -2
- package/dist/components/ConnectWalletModal/EmptyWalletList.js +0 -9
- package/dist/components/ConnectWalletModal/StatefulConnectContainer.d.ts +0 -3
- package/dist/components/ConnectWalletModal/StatefulConnectContainer.js +0 -37
- package/dist/components/ConnectWalletModal/StatefulConnectContainer.styles.d.ts +0 -1
- package/dist/components/ConnectWalletModal/StatefulConnectContainer.styles.js +0 -51
- package/dist/components/ConnectWalletModal/StatefulConnectContainer.types.d.ts +0 -12
- package/dist/components/ConnectWalletModal/StatefulConnectContainer.types.js +0 -1
- package/dist/components/ConnectWalletModal/WalletsChainSelect.d.ts +0 -3
- package/dist/components/ConnectWalletModal/WalletsChainSelect.js +0 -87
- package/dist/components/ConnectWalletModal/WalletsChainSelect.styles.d.ts +0 -21
- package/dist/components/ConnectWalletModal/WalletsChainSelect.styles.js +0 -83
- package/dist/components/ConnectWalletModal/WalletsChainSelect.types.d.ts +0 -12
- package/dist/components/ConnectWalletModal/WalletsChainSelect.types.js +0 -1
- package/dist/components/ConnectWalletModal/index.d.ts +0 -3
- package/dist/components/ConnectWalletModal/index.js +0 -2
- package/dist/components/ProfileWallet/ProfileWallet.d.ts +0 -3
- package/dist/components/ProfileWallet/ProfileWallet.js +0 -54
- package/dist/components/ProfileWallet/ProfileWallet.styles.d.ts +0 -6
- package/dist/components/ProfileWallet/ProfileWallet.styles.js +0 -54
- package/dist/components/ProfileWallet/ProfileWallet.types.d.ts +0 -11
- package/dist/components/ProfileWallet/ProfileWallet.types.js +0 -1
- package/dist/components/ProfileWallet/index.d.ts +0 -1
- package/dist/components/ProfileWallet/index.js +0 -1
- package/dist/components/ProfileWallets/ConnectedWallets.d.ts +0 -2
- package/dist/components/ProfileWallets/ConnectedWallets.js +0 -25
- package/dist/components/ProfileWallets/ConnectedWallets.styles.d.ts +0 -4
- package/dist/components/ProfileWallets/ConnectedWallets.styles.js +0 -30
- package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.d.ts +0 -5
- package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.js +0 -9
- package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.styles.d.ts +0 -1
- package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.styles.js +0 -8
- package/dist/components/ProfileWallets/ProfileWallets.d.ts +0 -4
- package/dist/components/ProfileWallets/ProfileWallets.js +0 -37
- package/dist/components/ProfileWallets/ProfileWallets.styles.d.ts +0 -5
- package/dist/components/ProfileWallets/ProfileWallets.styles.js +0 -17
- package/dist/components/ProfileWallets/ProfileWallets.types.d.ts +0 -14
- package/dist/components/ProfileWallets/ProfileWallets.types.js +0 -1
- package/dist/components/ProfileWallets/index.d.ts +0 -1
- package/dist/components/ProfileWallets/index.js +0 -1
- package/dist/components/ProfileWalletsModal/ProfileWalletsModal.constants.d.ts +0 -3
- package/dist/components/ProfileWalletsModal/ProfileWalletsModal.constants.js +0 -2
- package/dist/components/ProfileWalletsModal/ProfileWalletsModal.d.ts +0 -3
- package/dist/components/ProfileWalletsModal/ProfileWalletsModal.js +0 -23
- package/dist/components/ProfileWalletsModal/ProfileWalletsModal.styles.d.ts +0 -4
- package/dist/components/ProfileWalletsModal/ProfileWalletsModal.styles.js +0 -23
- package/dist/components/ProfileWalletsModal/ProfileWalletsModal.types.d.ts +0 -23
- package/dist/components/ProfileWalletsModal/ProfileWalletsModal.types.js +0 -1
- package/dist/components/ProfileWalletsModal/index.d.ts +0 -2
- package/dist/components/ProfileWalletsModal/index.js +0 -1
- package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.d.ts +0 -2
- package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.js +0 -21
- package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.styles.d.ts +0 -4
- package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.styles.js +0 -49
- package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.types.d.ts +0 -7
- package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.types.js +0 -1
- package/dist/components/SocialWalletIntroModal/index.d.ts +0 -1
- package/dist/components/SocialWalletIntroModal/index.js +0 -1
- package/dist/components/StackModal/ModalContainer.d.ts +0 -4
- package/dist/components/StackModal/ModalContainer.js +0 -33
- package/dist/components/StackModal/ModalContainer.types.d.ts +0 -6
- package/dist/components/StackModal/ModalContainer.types.js +0 -1
- package/dist/components/StackModal/StackModal.d.ts +0 -3
- package/dist/components/StackModal/StackModal.js +0 -90
- package/dist/components/StackModal/StackModal.styles.d.ts +0 -2
- package/dist/components/StackModal/StackModal.styles.js +0 -77
- package/dist/components/StackModal/StackModal.types.d.ts +0 -3
- package/dist/components/StackModal/StackModal.types.js +0 -1
- package/dist/components/StackModal/index.d.ts +0 -1
- package/dist/components/StackModal/index.js +0 -1
- package/dist/components/WalletItem/WalletItem.d.ts +0 -3
- package/dist/components/WalletItem/WalletItem.js +0 -60
- package/dist/components/WalletItem/WalletItem.styles.d.ts +0 -9
- package/dist/components/WalletItem/WalletItem.styles.js +0 -71
- package/dist/components/WalletItem/WalletItem.types.d.ts +0 -8
- package/dist/components/WalletItem/WalletItem.types.js +0 -1
- package/dist/components/WalletItem/index.d.ts +0 -1
- package/dist/components/WalletItem/index.js +0 -1
- package/dist/components/mod.d.ts +0 -5
- package/dist/components/mod.js +0 -3
- package/dist/constants/errors.d.ts +0 -1
- package/dist/constants/errors.js +0 -1
- package/dist/constants/events.d.ts +0 -3
- package/dist/constants/events.js +0 -3
- package/dist/constants/links.d.ts +0 -2
- package/dist/constants/links.js +0 -2
- package/dist/constants/mod.d.ts +0 -3
- package/dist/constants/mod.js +0 -3
- package/dist/constants/modals.d.ts +0 -3
- package/dist/constants/modals.js +0 -3
- package/dist/fetcher.d.ts +0 -3
- package/dist/fetcher.js +0 -10
- package/dist/hooks/mod.d.ts +0 -4
- package/dist/hooks/mod.js +0 -3
- package/dist/hooks/useLocalStorage/index.d.ts +0 -1
- package/dist/hooks/useLocalStorage/index.js +0 -1
- package/dist/hooks/useLocalStorage/useLocalStorage.d.ts +0 -1
- package/dist/hooks/useLocalStorage/useLocalStorage.js +0 -24
- package/dist/hooks/useProfile/index.d.ts +0 -1
- package/dist/hooks/useProfile/index.js +0 -1
- package/dist/hooks/useProfile/useProfile.constants.d.ts +0 -2
- package/dist/hooks/useProfile/useProfile.constants.js +0 -8
- package/dist/hooks/useProfile/useProfile.d.ts +0 -2
- package/dist/hooks/useProfile/useProfile.helpers.d.ts +0 -4
- package/dist/hooks/useProfile/useProfile.helpers.js +0 -3
- package/dist/hooks/useProfile/useProfile.js +0 -20
- package/dist/hooks/useProfile/useProfile.types.d.ts +0 -11
- package/dist/hooks/useProfile/useProfile.types.js +0 -1
- package/dist/hooks/useStackModal.d.ts +0 -38
- package/dist/hooks/useStackModal.js +0 -61
- package/dist/hooks/useStatefulConnect.d.ts +0 -7
- package/dist/hooks/useStatefulConnect.js +0 -15
- package/dist/mod.d.ts +0 -1
- package/dist/mod.js +0 -1
- package/dist/store/helpers.d.ts +0 -9
- package/dist/store/helpers.js +0 -69
- package/dist/store/middlewares.d.ts +0 -6
- package/dist/store/middlewares.js +0 -40
- package/dist/store/mod.d.ts +0 -4
- package/dist/store/mod.js +0 -3
- package/dist/store/selectors.d.ts +0 -47
- package/dist/store/selectors.js +0 -21
- package/dist/store/slice.d.ts +0 -134
- package/dist/store/slice.js +0 -230
- package/dist/store/thunks.d.ts +0 -153
- package/dist/store/thunks.js +0 -223
- package/dist/store/types.d.ts +0 -67
- package/dist/store/types.js +0 -1
- package/dist/store/utils.d.ts +0 -1
- package/dist/store/utils.js +0 -11
- package/dist/types.d.ts +0 -3
- package/dist/types.js +0 -1
- package/dist/utils/mod.d.ts +0 -1
- package/dist/utils/mod.js +0 -1
- package/dist/utils/wallets.d.ts +0 -16
- package/dist/utils/wallets.js +0 -34
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useStackModal } from '@arthur2079/internal-profile/hooks';
|
|
3
|
-
import { Button } from '@rango-dev/ui';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { CONNECT_WALLETS_MODAL_ID, STATEFUL_CONNECT_MODAL_ID } from '../../constants/mod';
|
|
6
|
-
import { ProfileWallet } from '../ProfileWallet';
|
|
7
|
-
import { EmptyStateContainer, WalletList } from './ConnectedWallets.styles';
|
|
8
|
-
import { ConnectedWalletsEmptyState } from './ConnectedWalletsEmptyState';
|
|
9
|
-
export function ConnectedWallets(props) {
|
|
10
|
-
const { accounts, styles, setShouldOpenConnectWalletsModal, data, onLogin, onMerge, onError } = props;
|
|
11
|
-
const { pop, stack } = useStackModal();
|
|
12
|
-
const { t } = useTranslation();
|
|
13
|
-
const connectedAccounts = accounts.filter((account) => account.walletType !== null);
|
|
14
|
-
const handleOpenConnectWalletsModal = () => {
|
|
15
|
-
setShouldOpenConnectWalletsModal?.(!stack.some((item) => item.id === CONNECT_WALLETS_MODAL_ID));
|
|
16
|
-
pop(stack.some((item) => item.id === STATEFUL_CONNECT_MODAL_ID) ? 2 : 1);
|
|
17
|
-
};
|
|
18
|
-
return (_jsxs(_Fragment, { children: [connectedAccounts.length ? (_jsx(WalletList, { css: styles, children: accounts.map((account) => {
|
|
19
|
-
const { walletType } = account;
|
|
20
|
-
if (!walletType) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
return (_jsx(ProfileWallet, { account: account, data: data, onLogin: onLogin, onMerge: onMerge, onError: onError }, account.address + account.blockchain + account.walletType));
|
|
24
|
-
}) })) : (_jsx(EmptyStateContainer, { children: _jsx(ConnectedWalletsEmptyState, { isDarkMode: props.isDarkMode }) })), _jsx(Button, { id: "connect-wallets-button", onClick: handleOpenConnectWalletsModal, variant: "outlined", type: "primary", fullWidth: true, size: "large", children: t('Connect more wallets') })] }));
|
|
25
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Button, darkTheme, styled, Typography } from '@rango-dev/ui';
|
|
2
|
-
export const WalletList = styled('ul', {
|
|
3
|
-
flex: 1,
|
|
4
|
-
});
|
|
5
|
-
export const EmptyStateContainer = styled('div', {
|
|
6
|
-
display: 'flex',
|
|
7
|
-
justifyContent: 'center',
|
|
8
|
-
alignItems: 'center',
|
|
9
|
-
flex: 1,
|
|
10
|
-
});
|
|
11
|
-
export const StyledButton = styled(Button, {
|
|
12
|
-
variants: {
|
|
13
|
-
isMobile: {
|
|
14
|
-
false: {
|
|
15
|
-
height: '$26',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
fontWeight: '$medium',
|
|
20
|
-
'@sm': {
|
|
21
|
-
[`.${darkTheme} &`]: {
|
|
22
|
-
'&:not(:hover):not(:focus)': {
|
|
23
|
-
color: '$neutral900',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
export const StyledTypography = styled(Typography, {
|
|
29
|
-
color: 'inherit !important',
|
|
30
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Divider, Typography } from '@rango-dev/ui';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { Container } from './ConnectedWalletsEmptyState.styles';
|
|
5
|
-
export function ConnectedWalletsEmptyState(props) {
|
|
6
|
-
const { t } = useTranslation();
|
|
7
|
-
const { isDarkMode } = props;
|
|
8
|
-
return (_jsxs(Container, { children: [_jsx("img", { src: isDarkMode ? '/imgs/profile/no-wallet-dark.svg' : '/imgs/profile/no-wallet-light.svg', alt: "No campaign found.", width: 112, height: 94 }), _jsx(Divider, { size: 10, direction: "vertical" }), _jsx(Typography, { variant: "body", size: "medium", color: isDarkMode ? 'neutral900' : 'neutral700', children: t('All connected wallets are already linked to your profile.') })] }));
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Container: any;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ProfileWalletsModalProps } from '../ProfileWalletsModal';
|
|
2
|
-
type PropTypes = Pick<ProfileWalletsModalProps, 'data' | 'isDarkMode' | 'onLogin' | 'onMerge' | 'onError' | 'setShouldOpenConnectWalletsModal'>;
|
|
3
|
-
export declare function ProfileWallets(props: PropTypes): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { useProfile } from '../../hooks/useProfile';
|
|
5
|
-
import { getAddedAccountsToProfile } from '../../utils/mod';
|
|
6
|
-
import { ProfileWallet } from '../ProfileWallet/ProfileWallet';
|
|
7
|
-
import { ConnectedWallets } from './ConnectedWallets';
|
|
8
|
-
import { AddedWallets, profileWalletsStyles, StyledTabs, tabsStyles, } from './ProfileWallets.styles';
|
|
9
|
-
export function ProfileWallets(props) {
|
|
10
|
-
const { setShouldOpenConnectWalletsModal, data, onLogin, onMerge, onError } = props;
|
|
11
|
-
const { isUserLoggedIn, profileSummary } = props.data;
|
|
12
|
-
const { t } = useTranslation();
|
|
13
|
-
const addedAccountsToProfile = profileSummary ? getAddedAccountsToProfile(profileSummary) : [];
|
|
14
|
-
const { compatibleAccounts } = useProfile({
|
|
15
|
-
addedAccounts: addedAccountsToProfile,
|
|
16
|
-
});
|
|
17
|
-
const tabs = {
|
|
18
|
-
addedWallets: { id: 'added-wallets', title: t('Linked Wallets') },
|
|
19
|
-
connectedWallets: { id: 'connected-wallets', title: t('Unlinked Wallets') },
|
|
20
|
-
};
|
|
21
|
-
const [selectedTab, setSelectedTab] = useState(tabs.addedWallets.id);
|
|
22
|
-
const showConnectedWallets = !isUserLoggedIn || selectedTab === tabs.connectedWallets.id;
|
|
23
|
-
const addedWallets = (_jsx(_Fragment, { children: _jsx(AddedWallets, { css: { ...profileWalletsStyles }, children: [...compatibleAccounts, ...addedAccountsToProfile].map((account) => {
|
|
24
|
-
const { walletType } = account;
|
|
25
|
-
if (walletType) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
return (_jsx(ProfileWallet, { account: account, data: data, onLogin: onLogin, onMerge: onMerge, onError: onError }, account.address + account.blockchain + account.walletType));
|
|
29
|
-
}) }) }));
|
|
30
|
-
return (_jsxs(_Fragment, { children: [_jsx(StyledTabs, { type: "bordered", items: Object.values(tabs), value: selectedTab, className: tabsStyles(),
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
-
onChange: (item) => {
|
|
33
|
-
if (typeof item.id === 'string') {
|
|
34
|
-
setSelectedTab(item.id);
|
|
35
|
-
}
|
|
36
|
-
} }), showConnectedWallets ? (_jsx(_Fragment, { children: _jsx(ConnectedWallets, { styles: { ...profileWalletsStyles }, accounts: [...compatibleAccounts, ...addedAccountsToProfile], setShouldOpenConnectWalletsModal: setShouldOpenConnectWalletsModal, data: props.data, isDarkMode: props.isDarkMode, onLogin: props.onLogin, onMerge: props.onMerge, onError: props.onError }) })) : (_jsx(_Fragment, { children: addedWallets }))] }));
|
|
37
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { css, styled, Tabs, theme } from '@rango-dev/ui';
|
|
2
|
-
export const profileWalletsStyles = {
|
|
3
|
-
paddingTop: '$25',
|
|
4
|
-
};
|
|
5
|
-
export const tabsStyles = css({
|
|
6
|
-
height: 'auto',
|
|
7
|
-
});
|
|
8
|
-
export const AddedWallets = styled('ul', {
|
|
9
|
-
overflowY: 'auto',
|
|
10
|
-
});
|
|
11
|
-
export const StyledTabs = styled(Tabs, {
|
|
12
|
-
'& ._tab': {
|
|
13
|
-
'&[data-active="false"]': {
|
|
14
|
-
color: theme.colors.neutral600,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ProfileWallet } from '../ProfileWallet/ProfileWallet';
|
|
2
|
-
import type { ProfileWalletsModalProps } from '../ProfileWalletsModal';
|
|
3
|
-
import type { CSS } from '@rango-dev/ui';
|
|
4
|
-
import type { ComponentProps } from 'react';
|
|
5
|
-
export type PropTypes = {
|
|
6
|
-
accounts: ComponentProps<typeof ProfileWallet>['account'][];
|
|
7
|
-
styles?: CSS;
|
|
8
|
-
setShouldOpenConnectWalletsModal?: (shouldOpenConnectWalletsModal?: boolean) => void;
|
|
9
|
-
data: ProfileWalletsModalProps['data'];
|
|
10
|
-
onLogin: ProfileWalletsModalProps['onLogin'];
|
|
11
|
-
onMerge: ProfileWalletsModalProps['onMerge'];
|
|
12
|
-
onError?: ProfileWalletsModalProps['onError'];
|
|
13
|
-
isDarkMode: boolean;
|
|
14
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ProfileWallets } from './ProfileWallets';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ProfileWallets } from './ProfileWallets';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useStackModal } from '@arthur2079/internal-profile/hooks';
|
|
3
|
-
import { Divider } from '@rango-dev/ui';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { useProfile } from '../../hooks/useProfile';
|
|
6
|
-
import { ProfileWallets } from '../ProfileWallets';
|
|
7
|
-
import { ConnectedWallets } from '../ProfileWallets/ConnectedWallets';
|
|
8
|
-
import { Description, ModalContent } from './ProfileWalletsModal.styles';
|
|
9
|
-
export function ProfileWalletsModal(props) {
|
|
10
|
-
const { indexInStack = 0, setShouldOpenConnectWalletsModal, onLogin, onMerge, onError } = props;
|
|
11
|
-
const { isMobile, isDarkMode, data, renderHeader } = props;
|
|
12
|
-
const { t } = useTranslation();
|
|
13
|
-
const { compatibleAccounts } = useProfile();
|
|
14
|
-
const { pop } = useStackModal();
|
|
15
|
-
return (_jsxs(ModalContent, { children: [renderHeader({
|
|
16
|
-
showBackButton: indexInStack > 0,
|
|
17
|
-
handleClose: () => {
|
|
18
|
-
pop();
|
|
19
|
-
},
|
|
20
|
-
}), _jsx(Divider, { size: isMobile ? '40' : '24' }), _jsx(Description, { variant: "body", size: "medium", children: data.isUserLoggedIn
|
|
21
|
-
? t('Link your wallets to your profile to increase your score.')
|
|
22
|
-
: t('Use your wallet to login into your profile.') }), _jsx(Divider, { size: "8" }), data.isUserLoggedIn ? (_jsx(ProfileWallets, { data: data, isDarkMode: isDarkMode, onLogin: onLogin, onMerge: onMerge, onError: onError, setShouldOpenConnectWalletsModal: setShouldOpenConnectWalletsModal })) : (_jsx(ConnectedWallets, { accounts: compatibleAccounts, setShouldOpenConnectWalletsModal: setShouldOpenConnectWalletsModal, isDarkMode: isDarkMode, data: data, onLogin: onLogin, onMerge: onMerge, onError: onError }))] }));
|
|
23
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { darkTheme, styled, Typography } from '@rango-dev/ui';
|
|
2
|
-
export const Container = styled('div', {});
|
|
3
|
-
export const ModalContent = styled('div', {
|
|
4
|
-
display: 'flex',
|
|
5
|
-
flexDirection: 'column',
|
|
6
|
-
padding: '$20',
|
|
7
|
-
height: '100%',
|
|
8
|
-
overflow: 'clip',
|
|
9
|
-
'@md': {
|
|
10
|
-
padding: '$24',
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
export const WalletList = styled('ul', {
|
|
14
|
-
overflowY: 'auto',
|
|
15
|
-
});
|
|
16
|
-
export const Description = styled(Typography, {
|
|
17
|
-
padding: '0 $10',
|
|
18
|
-
textAlign: 'start',
|
|
19
|
-
color: '$neutral700 !important',
|
|
20
|
-
[`.${darkTheme} &`]: {
|
|
21
|
-
color: '$neutral900 !important',
|
|
22
|
-
},
|
|
23
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ProfileAccount, ProfileSummary } from '../../api/mod';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
type HeaderProps = {
|
|
4
|
-
showBackButton: boolean;
|
|
5
|
-
handleClose: () => void;
|
|
6
|
-
};
|
|
7
|
-
export type PropTypes = {
|
|
8
|
-
indexInStack?: number;
|
|
9
|
-
showAddedAccounts?: boolean;
|
|
10
|
-
setShouldOpenConnectWalletsModal?: (shouldOpenConnectWalletsModal?: boolean) => void;
|
|
11
|
-
renderHeader: (props: HeaderProps) => ReactNode;
|
|
12
|
-
isMobile: boolean;
|
|
13
|
-
isDarkMode: boolean;
|
|
14
|
-
onLogin?: (profileSummary: ProfileSummary) => void;
|
|
15
|
-
onMerge?: (profileSummary: ProfileSummary) => void;
|
|
16
|
-
onError?: (error: unknown) => void;
|
|
17
|
-
data: {
|
|
18
|
-
isUserLoggedIn: boolean;
|
|
19
|
-
profileSummary: ProfileSummary | null;
|
|
20
|
-
selectedAccount: ProfileAccount | null;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ProfileWalletsModal } from './ProfileWalletsModal';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, CloseIcon, Divider, IconButton, Modal, Typography } from '@rango-dev/ui';
|
|
3
|
-
import { useRef } from 'react';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { ModalContent, ModalHeader, modalStyles } from './SocialWalletIntroModal.styles';
|
|
6
|
-
export function SocialWalletIntroModal(props) {
|
|
7
|
-
const { isDarkMode, isMobile, open, onClose, onConfirm } = props;
|
|
8
|
-
const { t } = useTranslation();
|
|
9
|
-
const confirmedRef = useRef(false);
|
|
10
|
-
const handleConfirm = () => {
|
|
11
|
-
confirmedRef.current = true;
|
|
12
|
-
onClose();
|
|
13
|
-
};
|
|
14
|
-
const handleExit = () => {
|
|
15
|
-
if (confirmedRef.current) {
|
|
16
|
-
confirmedRef.current = false;
|
|
17
|
-
onConfirm();
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
return (_jsx(Modal, { open: open, onClose: onClose, onExit: handleExit, dismissible: true, hasWatermark: false, header: _jsxs(ModalHeader, { children: [_jsx(Typography, { variant: "body", size: "medium", children: t('Connect via Social account') }), _jsx(IconButton, { className: "close-button", id: "social-wallet-intro-modal-close-btn", variant: "ghost", onClick: onClose, children: _jsx(CloseIcon, { size: 12, color: "black" }) })] }), anchor: isMobile ? 'bottom' : 'center', styles: modalStyles, container: document.getElementById('rango-container'), footer: _jsx(Button, { id: "social-wallet-intro-modal-continue-btn", variant: "contained", type: "primary", size: "large", fullWidth: true, onClick: handleConfirm, children: t('Continue') }), children: _jsxs(ModalContent, { children: [_jsx("img", { src: `/imgs/wallets/social-wallet-intro-banner-${isDarkMode ? 'dark' : 'light'}.svg`, width: 250, height: 250 }), _jsx(Divider, { size: "20" }), _jsxs("div", { className: "info", children: [_jsxs("div", { className: "title", children: [_jsx("img", { src: "/imgs/wallets/zap.svg", width: "20", height: "20" }), _jsx(Typography, { variant: "title", size: "xmedium", children: t('Effortless & Instant') })] }), _jsx(Typography, { variant: "body", size: "medium", color: "neutral700", className: "description", children: t('Access your wallet in seconds. No apps, no browser extensions, no signing transactions. Just log in and go.') })] }), _jsx(Divider, { size: 16 }), _jsxs("div", { className: "info", children: [_jsxs("div", { className: "title", children: [_jsx("img", { src: "/imgs/wallets/secure-key.svg", width: "20", height: "20" }), _jsx(Typography, { variant: "title", size: "xmedium", children: t('Secure & Non-Custodial') })] }), _jsx(Typography, { variant: "body", size: "medium", color: "neutral700", className: "description", children: t('Only you can access your wallet via your social account or exported private key. Rango never stores your keys or controls your funds.') })] })] }) }));
|
|
21
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { darkTheme, styled } from '@rango-dev/ui';
|
|
2
|
-
export const modalStyles = {
|
|
3
|
-
container: {
|
|
4
|
-
'@sm': {
|
|
5
|
-
maxWidth: '360px',
|
|
6
|
-
},
|
|
7
|
-
},
|
|
8
|
-
footer: { paddingTop: '22px', paddingBottom: '$20' },
|
|
9
|
-
};
|
|
10
|
-
export const ModalHeader = styled('div', {
|
|
11
|
-
textAlign: 'center',
|
|
12
|
-
paddingBottom: '22px',
|
|
13
|
-
paddingTop: '18px',
|
|
14
|
-
position: 'relative',
|
|
15
|
-
'& .close-button': {
|
|
16
|
-
position: 'absolute',
|
|
17
|
-
right: '$16',
|
|
18
|
-
top: '$16',
|
|
19
|
-
'& svg': {
|
|
20
|
-
[`.${darkTheme} &`]: {
|
|
21
|
-
color: '$foreground',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
export const ModalContent = styled('div', {
|
|
27
|
-
display: 'flex',
|
|
28
|
-
flexDirection: 'column',
|
|
29
|
-
justifyContent: 'center',
|
|
30
|
-
alignItems: 'center',
|
|
31
|
-
textAlign: 'left',
|
|
32
|
-
'& .info': {
|
|
33
|
-
display: 'flex',
|
|
34
|
-
flexDirection: 'column',
|
|
35
|
-
alignItems: 'start',
|
|
36
|
-
},
|
|
37
|
-
'& .title': {
|
|
38
|
-
display: 'flex',
|
|
39
|
-
justifyContent: 'center',
|
|
40
|
-
alignItems: 'center',
|
|
41
|
-
gap: '$8',
|
|
42
|
-
paddingBottom: '$8',
|
|
43
|
-
},
|
|
44
|
-
'& .description': {
|
|
45
|
-
[`.${darkTheme} &`]: {
|
|
46
|
-
color: '$neutral900',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SocialWalletIntroModal } from './SocialWalletIntroModal';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SocialWalletIntroModal } from './SocialWalletIntroModal';
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { Container } from './StackModal.styles';
|
|
4
|
-
const ModalContainer = memo(function ModalContainer(props) {
|
|
5
|
-
const { isRemoved, onExit } = props;
|
|
6
|
-
const containerRef = useRef(null);
|
|
7
|
-
const [active, setActive] = useState(false);
|
|
8
|
-
// This ref is added to prevent the onExit function from being called twice in result of useEffect being called twice in dev mode because of strict mode
|
|
9
|
-
const hasRunOnExit = useRef(false);
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
// ensure DOM is ready
|
|
12
|
-
requestAnimationFrame(() => {
|
|
13
|
-
setActive(true);
|
|
14
|
-
});
|
|
15
|
-
}, []);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const callback = () => {
|
|
18
|
-
if (isRemoved && !hasRunOnExit.current) {
|
|
19
|
-
onExit();
|
|
20
|
-
hasRunOnExit.current = true;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
containerRef.current?.addEventListener('transitionend', callback);
|
|
24
|
-
if (isRemoved) {
|
|
25
|
-
setActive(false);
|
|
26
|
-
}
|
|
27
|
-
return () => {
|
|
28
|
-
containerRef.current?.removeEventListener('transitionend', callback);
|
|
29
|
-
};
|
|
30
|
-
}, [isRemoved]);
|
|
31
|
-
return (_jsx(Container, { ref: containerRef, active: active, topDownIndex: props.topDownIndex.toString(), children: props.children }));
|
|
32
|
-
});
|
|
33
|
-
export default ModalContainer;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useStackModal } from '@arthur2079/internal-profile/hooks';
|
|
3
|
-
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { createPortal } from 'react-dom';
|
|
5
|
-
import ModalContainer from './ModalContainer';
|
|
6
|
-
import { BackDrop } from './StackModal.styles';
|
|
7
|
-
const BACKDROP_ANIMATION_DURATION = 350;
|
|
8
|
-
/*
|
|
9
|
-
* This component operates based on the value of stack from `useStackModal`.
|
|
10
|
-
* When the length of the stack gets bigger than zero, `open` turns true.
|
|
11
|
-
* When open turns true, status changes to mounted and it gets rendered in dom.
|
|
12
|
-
* When rendered in dom, animations should get activated so status changes to activated.
|
|
13
|
-
* When the length of stack decrease to zero, if it is active, it gets deactivated.
|
|
14
|
-
* After getting deactivated when transition ends, it gets unmounted.
|
|
15
|
-
*/
|
|
16
|
-
export const StackModal = memo(function StackModal(props) {
|
|
17
|
-
const { stack, clear } = useStackModal();
|
|
18
|
-
const [visibleStack, setVisibleStack] = useState([]);
|
|
19
|
-
const [status, setStatus] = useState('unmounted');
|
|
20
|
-
const backDropRef = useRef(null);
|
|
21
|
-
const open = visibleStack.length > 0;
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (status === 'mounted') {
|
|
24
|
-
document.body.style.overflow = 'hidden';
|
|
25
|
-
backDropRef.current?.focus();
|
|
26
|
-
setStatus('activated');
|
|
27
|
-
}
|
|
28
|
-
}, [status]);
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
const callback = () => {
|
|
31
|
-
if ((status === 'deactivated' || status === 'activated') && visibleStack.length === 0) {
|
|
32
|
-
setStatus('unmounted');
|
|
33
|
-
document.body.style.removeProperty('overflow');
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const element = backDropRef.current;
|
|
37
|
-
element?.addEventListener('transitionend', callback);
|
|
38
|
-
// Fallback timeout for animation
|
|
39
|
-
const timeoutId = setTimeout(callback, BACKDROP_ANIMATION_DURATION);
|
|
40
|
-
if (open) {
|
|
41
|
-
setStatus('mounted');
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
if (status === 'activated') {
|
|
45
|
-
setStatus('deactivated');
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
setStatus('unmounted');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return () => {
|
|
52
|
-
element?.removeEventListener('transitionend', callback);
|
|
53
|
-
clearTimeout(timeoutId);
|
|
54
|
-
};
|
|
55
|
-
}, [open]);
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
// Ensure that visibleStack is always up to date with stack
|
|
58
|
-
if (!stack.every((stackItem) => visibleStack.some((visibleItem) => visibleItem.id === stackItem.id))) {
|
|
59
|
-
setVisibleStack(stack);
|
|
60
|
-
}
|
|
61
|
-
}, [stack, visibleStack]);
|
|
62
|
-
const handleBackDropClick = (event) => {
|
|
63
|
-
event.stopPropagation();
|
|
64
|
-
if (event.target === event.currentTarget) {
|
|
65
|
-
clear();
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
const handleKeyDown = (event) => {
|
|
69
|
-
if (event.key === 'Escape') {
|
|
70
|
-
clear();
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
const renderModalContent = useCallback((item, index) => {
|
|
74
|
-
try {
|
|
75
|
-
return item.renderContent(index);
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
console.error(`Error rendering modal content for ${item.id}:`, error);
|
|
79
|
-
return _jsx("div", { children: "Error loading modal content" });
|
|
80
|
-
}
|
|
81
|
-
}, []);
|
|
82
|
-
const onModalContainerExit = useCallback((item) => {
|
|
83
|
-
setVisibleStack((stack) => stack.filter((stackItem) => stackItem.id !== item.id));
|
|
84
|
-
item.onExit?.();
|
|
85
|
-
}, [setVisibleStack]);
|
|
86
|
-
if (status === 'unmounted') {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
return createPortal(_jsx(BackDrop, { active: status === 'activated', onClick: handleBackDropClick, ref: backDropRef, onKeyDown: handleKeyDown, tabIndex: open ? 0 : -1, children: visibleStack.map((item, index, array) => (_jsx(ModalContainer, { topDownIndex: array.length - index - 1, isRemoved: !stack.some((stackItem) => stackItem.id === item.id), onExit: () => onModalContainerExit(item), children: renderModalContent(item, index) }, item.id))) }), props.getContainer());
|
|
90
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { MAX_STACK_SIZE } from '@arthur2079/internal-profile/hooks';
|
|
2
|
-
import { styled } from '@rango-dev/ui';
|
|
3
|
-
export const BackDrop = styled('div', {
|
|
4
|
-
position: 'fixed',
|
|
5
|
-
top: '0',
|
|
6
|
-
left: '0',
|
|
7
|
-
right: '0',
|
|
8
|
-
bottom: '0',
|
|
9
|
-
width: '100%',
|
|
10
|
-
height: '100%',
|
|
11
|
-
backgroundColor: 'transparent',
|
|
12
|
-
zIndex: 10,
|
|
13
|
-
overflow: 'hidden',
|
|
14
|
-
transition: 'background 0.35s',
|
|
15
|
-
variants: {
|
|
16
|
-
active: {
|
|
17
|
-
true: {
|
|
18
|
-
backgroundColor: 'color-mix(in srgb, $neutral500 70%, transparent)',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
const CONTAINER_OFFSET = 10;
|
|
24
|
-
const CONTAINER_HEIGHT_REDUCTION = 20;
|
|
25
|
-
const generateTopDownVariants = (maxIndex) => {
|
|
26
|
-
const variants = {};
|
|
27
|
-
for (let i = 0; i <= maxIndex; i++) {
|
|
28
|
-
variants[i.toString()] = {};
|
|
29
|
-
}
|
|
30
|
-
return variants;
|
|
31
|
-
};
|
|
32
|
-
const generateCompoundVariants = (maxIndex) => {
|
|
33
|
-
const compoundVariants = [];
|
|
34
|
-
for (let i = 0; i <= maxIndex; i++) {
|
|
35
|
-
compoundVariants.push({
|
|
36
|
-
active: true,
|
|
37
|
-
topDownIndex: i.toString(),
|
|
38
|
-
css: {
|
|
39
|
-
'@md': {
|
|
40
|
-
transform: `translate(calc(-100% - ${i * CONTAINER_OFFSET}px), -50%)`,
|
|
41
|
-
height: `calc(100% - ${i * CONTAINER_HEIGHT_REDUCTION}px)`,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return compoundVariants;
|
|
47
|
-
};
|
|
48
|
-
export const Container = styled('div', {
|
|
49
|
-
backgroundColor: '$background',
|
|
50
|
-
position: 'absolute',
|
|
51
|
-
transition: 'transform .35s ease-in-out, height .35s ease-in-out',
|
|
52
|
-
boxShadow: '-10px 10px 30px 0px rgba(0, 0, 0, 0.05)',
|
|
53
|
-
top: '100%',
|
|
54
|
-
height: '100%',
|
|
55
|
-
width: '100%',
|
|
56
|
-
'@md': {
|
|
57
|
-
top: '50%',
|
|
58
|
-
left: '100%',
|
|
59
|
-
width: '450px',
|
|
60
|
-
height: 'calc(100% - 20px)',
|
|
61
|
-
borderRadius: '20px',
|
|
62
|
-
transform: 'translate(0, -50%)',
|
|
63
|
-
},
|
|
64
|
-
variants: {
|
|
65
|
-
active: {
|
|
66
|
-
true: {
|
|
67
|
-
transform: 'translate(0, -100%)',
|
|
68
|
-
'@md': {
|
|
69
|
-
transform: 'translate(-100%, -50%)',
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
false: {},
|
|
73
|
-
},
|
|
74
|
-
topDownIndex: generateTopDownVariants(MAX_STACK_SIZE),
|
|
75
|
-
},
|
|
76
|
-
compoundVariants: generateCompoundVariants(MAX_STACK_SIZE),
|
|
77
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { StackModal } from './StackModal';
|