@arthur2079/internal-profile 4.1.2-next.5 → 5.1.2-next.6

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.
Files changed (159) hide show
  1. package/dist/api/errors.d.ts +3 -0
  2. package/dist/api/errors.js +9 -0
  3. package/dist/api/mod.d.ts +4 -0
  4. package/dist/api/mod.js +2 -0
  5. package/dist/api/request.d.ts +19 -0
  6. package/dist/api/request.js +96 -0
  7. package/dist/api/types.d.ts +190 -0
  8. package/dist/api/types.js +1 -0
  9. package/dist/components/ConnectWalletModal/ConnectWalletFooter.d.ts +5 -0
  10. package/dist/components/ConnectWalletModal/ConnectWalletFooter.js +9 -0
  11. package/dist/components/ConnectWalletModal/ConnectWalletModal.constants.d.ts +5 -0
  12. package/dist/components/ConnectWalletModal/ConnectWalletModal.constants.js +8 -0
  13. package/dist/components/ConnectWalletModal/ConnectWalletModal.d.ts +3 -0
  14. package/dist/components/ConnectWalletModal/ConnectWalletModal.helpers.d.ts +2 -0
  15. package/dist/components/ConnectWalletModal/ConnectWalletModal.helpers.js +9 -0
  16. package/dist/components/ConnectWalletModal/ConnectWalletModal.js +194 -0
  17. package/dist/components/ConnectWalletModal/ConnectWalletModal.styles.d.ts +19 -0
  18. package/dist/components/ConnectWalletModal/ConnectWalletModal.styles.js +101 -0
  19. package/dist/components/ConnectWalletModal/ConnectWalletModal.types.d.ts +44 -0
  20. package/dist/components/ConnectWalletModal/ConnectWalletModal.types.js +1 -0
  21. package/dist/components/ConnectWalletModal/EmptyWalletList.d.ts +2 -0
  22. package/dist/components/ConnectWalletModal/EmptyWalletList.js +9 -0
  23. package/dist/components/ConnectWalletModal/StatefulConnectContainer.d.ts +3 -0
  24. package/dist/components/ConnectWalletModal/StatefulConnectContainer.js +37 -0
  25. package/dist/components/ConnectWalletModal/StatefulConnectContainer.styles.d.ts +1 -0
  26. package/dist/components/ConnectWalletModal/StatefulConnectContainer.styles.js +51 -0
  27. package/dist/components/ConnectWalletModal/StatefulConnectContainer.types.d.ts +12 -0
  28. package/dist/components/ConnectWalletModal/StatefulConnectContainer.types.js +1 -0
  29. package/dist/components/ConnectWalletModal/WalletsChainSelect.d.ts +3 -0
  30. package/dist/components/ConnectWalletModal/WalletsChainSelect.js +86 -0
  31. package/dist/components/ConnectWalletModal/WalletsChainSelect.styles.d.ts +21 -0
  32. package/dist/components/ConnectWalletModal/WalletsChainSelect.styles.js +83 -0
  33. package/dist/components/ConnectWalletModal/WalletsChainSelect.types.d.ts +12 -0
  34. package/dist/components/ConnectWalletModal/WalletsChainSelect.types.js +1 -0
  35. package/dist/components/ConnectWalletModal/index.d.ts +3 -0
  36. package/dist/components/ConnectWalletModal/index.js +2 -0
  37. package/dist/components/ProfileWallet/ProfileWallet.d.ts +3 -0
  38. package/dist/components/ProfileWallet/ProfileWallet.js +54 -0
  39. package/dist/components/ProfileWallet/ProfileWallet.styles.d.ts +6 -0
  40. package/dist/components/ProfileWallet/ProfileWallet.styles.js +54 -0
  41. package/dist/components/ProfileWallet/ProfileWallet.types.d.ts +11 -0
  42. package/dist/components/ProfileWallet/ProfileWallet.types.js +1 -0
  43. package/dist/components/ProfileWallet/index.d.ts +1 -0
  44. package/dist/components/ProfileWallet/index.js +1 -0
  45. package/dist/components/ProfileWallets/ConnectedWallets.d.ts +2 -0
  46. package/dist/components/ProfileWallets/ConnectedWallets.js +25 -0
  47. package/dist/components/ProfileWallets/ConnectedWallets.styles.d.ts +4 -0
  48. package/dist/components/ProfileWallets/ConnectedWallets.styles.js +30 -0
  49. package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.d.ts +5 -0
  50. package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.js +9 -0
  51. package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.styles.d.ts +1 -0
  52. package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.styles.js +8 -0
  53. package/dist/components/ProfileWallets/ProfileWallets.d.ts +4 -0
  54. package/dist/components/ProfileWallets/ProfileWallets.js +37 -0
  55. package/dist/components/ProfileWallets/ProfileWallets.styles.d.ts +5 -0
  56. package/dist/components/ProfileWallets/ProfileWallets.styles.js +17 -0
  57. package/dist/components/ProfileWallets/ProfileWallets.types.d.ts +14 -0
  58. package/dist/components/ProfileWallets/ProfileWallets.types.js +1 -0
  59. package/dist/components/ProfileWallets/index.d.ts +1 -0
  60. package/dist/components/ProfileWallets/index.js +1 -0
  61. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.constants.d.ts +3 -0
  62. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.constants.js +2 -0
  63. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.d.ts +3 -0
  64. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.js +23 -0
  65. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.styles.d.ts +4 -0
  66. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.styles.js +23 -0
  67. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.types.d.ts +23 -0
  68. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.types.js +1 -0
  69. package/dist/components/ProfileWalletsModal/index.d.ts +2 -0
  70. package/dist/components/ProfileWalletsModal/index.js +1 -0
  71. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.d.ts +2 -0
  72. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.js +21 -0
  73. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.styles.d.ts +4 -0
  74. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.styles.js +49 -0
  75. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.types.d.ts +7 -0
  76. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.types.js +1 -0
  77. package/dist/components/SocialWalletIntroModal/index.d.ts +1 -0
  78. package/dist/components/SocialWalletIntroModal/index.js +1 -0
  79. package/dist/components/StackModal/ModalContainer.d.ts +4 -0
  80. package/dist/components/StackModal/ModalContainer.js +33 -0
  81. package/dist/components/StackModal/ModalContainer.types.d.ts +6 -0
  82. package/dist/components/StackModal/ModalContainer.types.js +1 -0
  83. package/dist/components/StackModal/StackModal.d.ts +3 -0
  84. package/dist/components/StackModal/StackModal.js +90 -0
  85. package/dist/components/StackModal/StackModal.styles.d.ts +2 -0
  86. package/dist/components/StackModal/StackModal.styles.js +77 -0
  87. package/dist/components/StackModal/StackModal.types.d.ts +3 -0
  88. package/dist/components/StackModal/StackModal.types.js +1 -0
  89. package/dist/components/StackModal/index.d.ts +1 -0
  90. package/dist/components/StackModal/index.js +1 -0
  91. package/dist/components/WalletItem/WalletItem.d.ts +3 -0
  92. package/dist/components/WalletItem/WalletItem.js +60 -0
  93. package/dist/components/WalletItem/WalletItem.styles.d.ts +9 -0
  94. package/dist/components/WalletItem/WalletItem.styles.js +71 -0
  95. package/dist/components/WalletItem/WalletItem.types.d.ts +8 -0
  96. package/dist/components/WalletItem/WalletItem.types.js +1 -0
  97. package/dist/components/WalletItem/index.d.ts +1 -0
  98. package/dist/components/WalletItem/index.js +1 -0
  99. package/dist/components/mod.d.ts +5 -0
  100. package/dist/components/mod.js +3 -0
  101. package/dist/constants/errors.d.ts +1 -0
  102. package/dist/constants/errors.js +1 -0
  103. package/dist/constants/events.d.ts +3 -0
  104. package/dist/constants/events.js +3 -0
  105. package/dist/constants/links.d.ts +2 -0
  106. package/dist/constants/links.js +2 -0
  107. package/dist/constants/mod.d.ts +3 -0
  108. package/dist/constants/mod.js +3 -0
  109. package/dist/constants/modals.d.ts +3 -0
  110. package/dist/constants/modals.js +3 -0
  111. package/dist/fetcher.d.ts +3 -0
  112. package/dist/fetcher.js +10 -0
  113. package/dist/hooks/mod.d.ts +4 -0
  114. package/dist/hooks/mod.js +3 -0
  115. package/dist/hooks/useLocalStorage/index.d.ts +1 -0
  116. package/dist/hooks/useLocalStorage/index.js +1 -0
  117. package/dist/hooks/useLocalStorage/useLocalStorage.d.ts +1 -0
  118. package/dist/hooks/useLocalStorage/useLocalStorage.js +24 -0
  119. package/dist/hooks/useProfile/index.d.ts +1 -0
  120. package/dist/hooks/useProfile/index.js +1 -0
  121. package/dist/hooks/useProfile/useProfile.constants.d.ts +2 -0
  122. package/dist/hooks/useProfile/useProfile.constants.js +3 -0
  123. package/dist/hooks/useProfile/useProfile.d.ts +2 -0
  124. package/dist/hooks/useProfile/useProfile.helpers.d.ts +4 -0
  125. package/dist/hooks/useProfile/useProfile.helpers.js +3 -0
  126. package/dist/hooks/useProfile/useProfile.js +20 -0
  127. package/dist/hooks/useProfile/useProfile.types.d.ts +11 -0
  128. package/dist/hooks/useProfile/useProfile.types.js +1 -0
  129. package/dist/hooks/useStackModal.d.ts +38 -0
  130. package/dist/hooks/useStackModal.js +61 -0
  131. package/dist/hooks/useStatefulConnect.d.ts +7 -0
  132. package/dist/hooks/useStatefulConnect.js +15 -0
  133. package/dist/mod.d.ts +1 -0
  134. package/dist/mod.js +1 -0
  135. package/dist/store/helpers.d.ts +5 -0
  136. package/dist/store/helpers.js +42 -0
  137. package/dist/store/middlewares.d.ts +6 -0
  138. package/dist/store/middlewares.js +40 -0
  139. package/dist/store/mod.d.ts +4 -0
  140. package/dist/store/mod.js +3 -0
  141. package/dist/store/selectors.d.ts +47 -0
  142. package/dist/store/selectors.js +21 -0
  143. package/dist/store/slice.d.ts +134 -0
  144. package/dist/store/slice.js +230 -0
  145. package/dist/store/thunks.d.ts +153 -0
  146. package/dist/store/thunks.js +219 -0
  147. package/dist/store/types.d.ts +67 -0
  148. package/dist/store/types.js +1 -0
  149. package/dist/store/utils.d.ts +1 -0
  150. package/dist/store/utils.js +11 -0
  151. package/dist/types.d.ts +3 -0
  152. package/dist/types.js +1 -0
  153. package/dist/utils/mod.d.ts +1 -0
  154. package/dist/utils/mod.js +1 -0
  155. package/dist/utils/wallets.d.ts +16 -0
  156. package/dist/utils/wallets.js +34 -0
  157. package/package.json +8 -5
  158. package/CHANGELOG.md +0 -32
  159. package/tsconfig.json +0 -21
@@ -0,0 +1,25 @@
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
+ }
@@ -0,0 +1,4 @@
1
+ export declare const WalletList: any;
2
+ export declare const EmptyStateContainer: any;
3
+ export declare const StyledButton: any;
4
+ export declare const StyledTypography: any;
@@ -0,0 +1,30 @@
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
+ });
@@ -0,0 +1,5 @@
1
+ interface PropTypes {
2
+ isDarkMode: boolean;
3
+ }
4
+ export declare function ConnectedWalletsEmptyState(props: PropTypes): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1 @@
1
+ export declare const Container: any;
@@ -0,0 +1,8 @@
1
+ import { styled } from '@rango-dev/ui';
2
+ export const Container = styled('div', {
3
+ padding: '43px 0 38px 0',
4
+ display: 'flex',
5
+ flexDirection: 'column',
6
+ justifyContent: 'center',
7
+ alignItems: 'center',
8
+ });
@@ -0,0 +1,4 @@
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 {};
@@ -0,0 +1,37 @@
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
+ }
@@ -0,0 +1,5 @@
1
+ import { CSS } from '@rango-dev/ui';
2
+ export declare const profileWalletsStyles: CSS;
3
+ export declare const tabsStyles: any;
4
+ export declare const AddedWallets: any;
5
+ export declare const StyledTabs: any;
@@ -0,0 +1,17 @@
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
+ });
@@ -0,0 +1,14 @@
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
+ };
@@ -0,0 +1 @@
1
+ export { ProfileWallets } from './ProfileWallets';
@@ -0,0 +1 @@
1
+ export { ProfileWallets } from './ProfileWallets';
@@ -0,0 +1,3 @@
1
+ export declare const supportedBlockchainsDisplayName: {
2
+ [key: string]: string;
3
+ };
@@ -0,0 +1,2 @@
1
+ import { Networks } from '@rango-dev/wallets-shared';
2
+ export const supportedBlockchainsDisplayName = { [Networks.ETHEREUM]: 'EVM' };
@@ -0,0 +1,3 @@
1
+ import type { PropTypes } from './ProfileWalletsModal.types';
2
+ import type { ReactElement } from 'react';
3
+ export declare function ProfileWalletsModal(props: PropTypes): ReactElement;
@@ -0,0 +1,23 @@
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
+ }
@@ -0,0 +1,4 @@
1
+ export declare const Container: any;
2
+ export declare const ModalContent: any;
3
+ export declare const WalletList: any;
4
+ export declare const Description: any;
@@ -0,0 +1,23 @@
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
+ });
@@ -0,0 +1,23 @@
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 {};
@@ -0,0 +1,2 @@
1
+ export { ProfileWalletsModal } from './ProfileWalletsModal';
2
+ export type { PropTypes as ProfileWalletsModalProps } from './ProfileWalletsModal.types';
@@ -0,0 +1 @@
1
+ export { ProfileWalletsModal } from './ProfileWalletsModal';
@@ -0,0 +1,2 @@
1
+ import type { PropTypes } from './SocialWalletIntroModal.types';
2
+ export declare function SocialWalletIntroModal(props: PropTypes): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
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
+ }
@@ -0,0 +1,4 @@
1
+ import type { ModalPropTypes } from '@rango-dev/ui';
2
+ export declare const modalStyles: ModalPropTypes['styles'];
3
+ export declare const ModalHeader: any;
4
+ export declare const ModalContent: any;
@@ -0,0 +1,49 @@
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
+ });
@@ -0,0 +1,7 @@
1
+ export type PropTypes = {
2
+ isDarkMode: boolean;
3
+ isMobile: boolean;
4
+ open: boolean;
5
+ onClose: () => void;
6
+ onConfirm: () => void;
7
+ };
@@ -0,0 +1 @@
1
+ export { SocialWalletIntroModal } from './SocialWalletIntroModal';
@@ -0,0 +1 @@
1
+ export { SocialWalletIntroModal } from './SocialWalletIntroModal';
@@ -0,0 +1,4 @@
1
+ import type { PropTypes } from './ModalContainer.types';
2
+ import React from 'react';
3
+ declare const ModalContainer: React.NamedExoticComponent<PropTypes>;
4
+ export default ModalContainer;
@@ -0,0 +1,33 @@
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;
@@ -0,0 +1,6 @@
1
+ export type PropTypes = {
2
+ children: React.ReactNode;
3
+ topDownIndex: number;
4
+ isRemoved: boolean;
5
+ onExit: () => void;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { PropTypes } from './StackModal.types';
2
+ import React from 'react';
3
+ export declare const StackModal: React.NamedExoticComponent<PropTypes>;
@@ -0,0 +1,90 @@
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
+ });
@@ -0,0 +1,2 @@
1
+ export declare const BackDrop: any;
2
+ export declare const Container: any;
@@ -0,0 +1,77 @@
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
+ });
@@ -0,0 +1,3 @@
1
+ export interface PropTypes {
2
+ getContainer: () => HTMLElement;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export { StackModal } from './StackModal';