@arthur2079/internal-profile 0.1.2-next.3 → 0.1.2-next.5

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 (157) hide show
  1. package/package.json +3 -3
  2. package/dist/api/errors.d.ts +0 -3
  3. package/dist/api/errors.js +0 -9
  4. package/dist/api/mod.d.ts +0 -4
  5. package/dist/api/mod.js +0 -2
  6. package/dist/api/request.d.ts +0 -19
  7. package/dist/api/request.js +0 -96
  8. package/dist/api/types.d.ts +0 -193
  9. package/dist/api/types.js +0 -1
  10. package/dist/components/ConnectWalletModal/ConnectWalletFooter.d.ts +0 -5
  11. package/dist/components/ConnectWalletModal/ConnectWalletFooter.js +0 -9
  12. package/dist/components/ConnectWalletModal/ConnectWalletModal.constants.d.ts +0 -5
  13. package/dist/components/ConnectWalletModal/ConnectWalletModal.constants.js +0 -8
  14. package/dist/components/ConnectWalletModal/ConnectWalletModal.d.ts +0 -3
  15. package/dist/components/ConnectWalletModal/ConnectWalletModal.helpers.d.ts +0 -2
  16. package/dist/components/ConnectWalletModal/ConnectWalletModal.helpers.js +0 -9
  17. package/dist/components/ConnectWalletModal/ConnectWalletModal.js +0 -194
  18. package/dist/components/ConnectWalletModal/ConnectWalletModal.styles.d.ts +0 -19
  19. package/dist/components/ConnectWalletModal/ConnectWalletModal.styles.js +0 -101
  20. package/dist/components/ConnectWalletModal/ConnectWalletModal.types.d.ts +0 -44
  21. package/dist/components/ConnectWalletModal/ConnectWalletModal.types.js +0 -1
  22. package/dist/components/ConnectWalletModal/EmptyWalletList.d.ts +0 -2
  23. package/dist/components/ConnectWalletModal/EmptyWalletList.js +0 -9
  24. package/dist/components/ConnectWalletModal/StatefulConnectContainer.d.ts +0 -3
  25. package/dist/components/ConnectWalletModal/StatefulConnectContainer.js +0 -37
  26. package/dist/components/ConnectWalletModal/StatefulConnectContainer.styles.d.ts +0 -1
  27. package/dist/components/ConnectWalletModal/StatefulConnectContainer.styles.js +0 -51
  28. package/dist/components/ConnectWalletModal/StatefulConnectContainer.types.d.ts +0 -12
  29. package/dist/components/ConnectWalletModal/StatefulConnectContainer.types.js +0 -1
  30. package/dist/components/ConnectWalletModal/WalletsChainSelect.d.ts +0 -3
  31. package/dist/components/ConnectWalletModal/WalletsChainSelect.js +0 -87
  32. package/dist/components/ConnectWalletModal/WalletsChainSelect.styles.d.ts +0 -21
  33. package/dist/components/ConnectWalletModal/WalletsChainSelect.styles.js +0 -83
  34. package/dist/components/ConnectWalletModal/WalletsChainSelect.types.d.ts +0 -12
  35. package/dist/components/ConnectWalletModal/WalletsChainSelect.types.js +0 -1
  36. package/dist/components/ConnectWalletModal/index.d.ts +0 -3
  37. package/dist/components/ConnectWalletModal/index.js +0 -2
  38. package/dist/components/ProfileWallet/ProfileWallet.d.ts +0 -3
  39. package/dist/components/ProfileWallet/ProfileWallet.js +0 -54
  40. package/dist/components/ProfileWallet/ProfileWallet.styles.d.ts +0 -6
  41. package/dist/components/ProfileWallet/ProfileWallet.styles.js +0 -54
  42. package/dist/components/ProfileWallet/ProfileWallet.types.d.ts +0 -11
  43. package/dist/components/ProfileWallet/ProfileWallet.types.js +0 -1
  44. package/dist/components/ProfileWallet/index.d.ts +0 -1
  45. package/dist/components/ProfileWallet/index.js +0 -1
  46. package/dist/components/ProfileWallets/ConnectedWallets.d.ts +0 -2
  47. package/dist/components/ProfileWallets/ConnectedWallets.js +0 -25
  48. package/dist/components/ProfileWallets/ConnectedWallets.styles.d.ts +0 -4
  49. package/dist/components/ProfileWallets/ConnectedWallets.styles.js +0 -30
  50. package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.d.ts +0 -5
  51. package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.js +0 -9
  52. package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.styles.d.ts +0 -1
  53. package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.styles.js +0 -8
  54. package/dist/components/ProfileWallets/ProfileWallets.d.ts +0 -4
  55. package/dist/components/ProfileWallets/ProfileWallets.js +0 -37
  56. package/dist/components/ProfileWallets/ProfileWallets.styles.d.ts +0 -5
  57. package/dist/components/ProfileWallets/ProfileWallets.styles.js +0 -17
  58. package/dist/components/ProfileWallets/ProfileWallets.types.d.ts +0 -14
  59. package/dist/components/ProfileWallets/ProfileWallets.types.js +0 -1
  60. package/dist/components/ProfileWallets/index.d.ts +0 -1
  61. package/dist/components/ProfileWallets/index.js +0 -1
  62. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.constants.d.ts +0 -3
  63. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.constants.js +0 -2
  64. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.d.ts +0 -3
  65. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.js +0 -23
  66. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.styles.d.ts +0 -4
  67. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.styles.js +0 -23
  68. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.types.d.ts +0 -23
  69. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.types.js +0 -1
  70. package/dist/components/ProfileWalletsModal/index.d.ts +0 -2
  71. package/dist/components/ProfileWalletsModal/index.js +0 -1
  72. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.d.ts +0 -2
  73. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.js +0 -21
  74. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.styles.d.ts +0 -4
  75. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.styles.js +0 -49
  76. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.types.d.ts +0 -7
  77. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.types.js +0 -1
  78. package/dist/components/SocialWalletIntroModal/index.d.ts +0 -1
  79. package/dist/components/SocialWalletIntroModal/index.js +0 -1
  80. package/dist/components/StackModal/ModalContainer.d.ts +0 -4
  81. package/dist/components/StackModal/ModalContainer.js +0 -33
  82. package/dist/components/StackModal/ModalContainer.types.d.ts +0 -6
  83. package/dist/components/StackModal/ModalContainer.types.js +0 -1
  84. package/dist/components/StackModal/StackModal.d.ts +0 -3
  85. package/dist/components/StackModal/StackModal.js +0 -90
  86. package/dist/components/StackModal/StackModal.styles.d.ts +0 -2
  87. package/dist/components/StackModal/StackModal.styles.js +0 -77
  88. package/dist/components/StackModal/StackModal.types.d.ts +0 -3
  89. package/dist/components/StackModal/StackModal.types.js +0 -1
  90. package/dist/components/StackModal/index.d.ts +0 -1
  91. package/dist/components/StackModal/index.js +0 -1
  92. package/dist/components/WalletItem/WalletItem.d.ts +0 -3
  93. package/dist/components/WalletItem/WalletItem.js +0 -60
  94. package/dist/components/WalletItem/WalletItem.styles.d.ts +0 -9
  95. package/dist/components/WalletItem/WalletItem.styles.js +0 -71
  96. package/dist/components/WalletItem/WalletItem.types.d.ts +0 -8
  97. package/dist/components/WalletItem/WalletItem.types.js +0 -1
  98. package/dist/components/WalletItem/index.d.ts +0 -1
  99. package/dist/components/WalletItem/index.js +0 -1
  100. package/dist/components/mod.d.ts +0 -5
  101. package/dist/components/mod.js +0 -3
  102. package/dist/constants/errors.d.ts +0 -1
  103. package/dist/constants/errors.js +0 -1
  104. package/dist/constants/events.d.ts +0 -3
  105. package/dist/constants/events.js +0 -3
  106. package/dist/constants/links.d.ts +0 -2
  107. package/dist/constants/links.js +0 -2
  108. package/dist/constants/mod.d.ts +0 -3
  109. package/dist/constants/mod.js +0 -3
  110. package/dist/constants/modals.d.ts +0 -3
  111. package/dist/constants/modals.js +0 -3
  112. package/dist/fetcher.d.ts +0 -3
  113. package/dist/fetcher.js +0 -10
  114. package/dist/hooks/mod.d.ts +0 -4
  115. package/dist/hooks/mod.js +0 -3
  116. package/dist/hooks/useLocalStorage/index.d.ts +0 -1
  117. package/dist/hooks/useLocalStorage/index.js +0 -1
  118. package/dist/hooks/useLocalStorage/useLocalStorage.d.ts +0 -1
  119. package/dist/hooks/useLocalStorage/useLocalStorage.js +0 -24
  120. package/dist/hooks/useProfile/index.d.ts +0 -1
  121. package/dist/hooks/useProfile/index.js +0 -1
  122. package/dist/hooks/useProfile/useProfile.constants.d.ts +0 -2
  123. package/dist/hooks/useProfile/useProfile.constants.js +0 -8
  124. package/dist/hooks/useProfile/useProfile.d.ts +0 -2
  125. package/dist/hooks/useProfile/useProfile.helpers.d.ts +0 -4
  126. package/dist/hooks/useProfile/useProfile.helpers.js +0 -3
  127. package/dist/hooks/useProfile/useProfile.js +0 -20
  128. package/dist/hooks/useProfile/useProfile.types.d.ts +0 -11
  129. package/dist/hooks/useProfile/useProfile.types.js +0 -1
  130. package/dist/hooks/useStackModal.d.ts +0 -38
  131. package/dist/hooks/useStackModal.js +0 -61
  132. package/dist/hooks/useStatefulConnect.d.ts +0 -7
  133. package/dist/hooks/useStatefulConnect.js +0 -15
  134. package/dist/mod.d.ts +0 -1
  135. package/dist/mod.js +0 -1
  136. package/dist/store/helpers.d.ts +0 -9
  137. package/dist/store/helpers.js +0 -69
  138. package/dist/store/middlewares.d.ts +0 -6
  139. package/dist/store/middlewares.js +0 -40
  140. package/dist/store/mod.d.ts +0 -4
  141. package/dist/store/mod.js +0 -3
  142. package/dist/store/selectors.d.ts +0 -47
  143. package/dist/store/selectors.js +0 -21
  144. package/dist/store/slice.d.ts +0 -134
  145. package/dist/store/slice.js +0 -230
  146. package/dist/store/thunks.d.ts +0 -153
  147. package/dist/store/thunks.js +0 -223
  148. package/dist/store/types.d.ts +0 -67
  149. package/dist/store/types.js +0 -1
  150. package/dist/store/utils.d.ts +0 -1
  151. package/dist/store/utils.js +0 -11
  152. package/dist/types.d.ts +0 -3
  153. package/dist/types.js +0 -1
  154. package/dist/utils/mod.d.ts +0 -1
  155. package/dist/utils/mod.js +0 -1
  156. package/dist/utils/wallets.d.ts +0 -16
  157. package/dist/utils/wallets.js +0 -34
@@ -1,101 +0,0 @@
1
- import { darkTheme, styled } from '@rango-dev/ui';
2
- export const TextLink = styled('a', {
3
- color: '$info',
4
- marginRight: '$5',
5
- marginLeft: '$5',
6
- });
7
- export const ModalContent = styled('div', {
8
- display: 'flex',
9
- flexDirection: 'column',
10
- padding: '$20',
11
- height: '100%',
12
- overflow: 'clip',
13
- '@md': {
14
- padding: '$24',
15
- },
16
- '& .social-wallet-description': {
17
- paddingTop: '$20',
18
- textAlign: 'left',
19
- [`.${darkTheme} &`]: {
20
- color: '$neutral900',
21
- },
22
- },
23
- '& .social-wallet-banner-separator': {
24
- display: 'flex',
25
- justifyContent: 'center',
26
- alignItems: 'center',
27
- padding: '$8 0',
28
- '@sm': {
29
- padding: '$16 0 $24 0',
30
- },
31
- '& .separator': {
32
- flex: 1,
33
- borderBottom: '0.5px solid $neutral500',
34
- [`.${darkTheme} &`]: {
35
- borderBottomColor: '$neutral600',
36
- },
37
- },
38
- },
39
- });
40
- export const SocialWalletBanner = styled('img', {
41
- width: '100%',
42
- cursor: 'pointer',
43
- });
44
- export const WalletListContainer = styled('div', {
45
- flex: 1,
46
- overflow: 'auto',
47
- });
48
- export const WalletListContent = styled('div', {
49
- width: '100%',
50
- display: 'grid',
51
- gap: '$8',
52
- gridTemplateColumns: 'repeat(3, minmax(0, 1fr))',
53
- gridTemplateRows: 'repeat(3, 1fr)',
54
- alignItems: 'stretch',
55
- variants: {
56
- isEmpty: {
57
- true: {
58
- height: '100%',
59
- },
60
- },
61
- },
62
- });
63
- export const SearchWalletContainer = styled('div', {
64
- backgroundColor: '$neutral100',
65
- [`.${darkTheme} &`]: {
66
- backgroundColor: '$neutral300',
67
- },
68
- borderRadius: '$md',
69
- flex: 1,
70
- });
71
- export const searchWalletTextFieldStyles = {
72
- height: '100%',
73
- '& input': {
74
- width: '100%',
75
- },
76
- };
77
- export const NoWalletFoundContainer = styled('div', {
78
- display: 'flex',
79
- height: '100%',
80
- flexDirection: 'column',
81
- alignItems: 'center',
82
- justifyContent: 'center',
83
- });
84
- export const NoResultImage = styled('img', {
85
- width: '135px',
86
- '@md': {
87
- width: '190px',
88
- },
89
- });
90
- export const ConnectWalletFooterTypographyStyles = {
91
- padding: '0 7px',
92
- };
93
- export const FiltersContainer = styled('div', {
94
- display: 'flex',
95
- gap: '10px',
96
- });
97
- export const SearchIconContainer = styled('div', {
98
- height: '24px',
99
- width: '24px',
100
- padding: '4px',
101
- });
@@ -1,44 +0,0 @@
1
- import type { ModalPropTypes } from '@rango-dev/ui';
2
- import type { BlockchainMeta } from 'rango-types';
3
- import type { PropsWithChildren, ReactNode } from 'react';
4
- import { type WalletInfo } from '@rango-dev/widget-embedded';
5
- export type WalletMessage = {
6
- open: boolean;
7
- message: string;
8
- };
9
- type HeaderProps = {
10
- showBackButton: boolean;
11
- handleClose: () => void;
12
- title?: string;
13
- walletName?: string;
14
- };
15
- type NotificationProps = {
16
- message: WalletMessage;
17
- setOpen: () => void;
18
- autoHideDuration: number;
19
- };
20
- export type WalletCategory = Pick<WalletInfo, 'supportedChains'>;
21
- export type ConnectWalletModalProps = {
22
- indexInStack?: number;
23
- detachedConfirmText?: string;
24
- forceConnectToNamespaces?: string[];
25
- afterConnect?: () => void;
26
- onDetachedConfirm?: () => void;
27
- shouldExcludeWallet?: (wallet: WalletInfo | WalletCategory) => boolean;
28
- renderHeader: (props: HeaderProps) => ReactNode;
29
- renderNotification: (props: NotificationProps) => ReactNode;
30
- renderModal: (props: PropsWithChildren<ModalPropTypes>) => ReactNode;
31
- allBlockchains: BlockchainMeta[];
32
- isMobile: boolean;
33
- isDarkMode: boolean;
34
- options?: {
35
- hideSocialWalletPromotionBanner?: boolean;
36
- skipSocialWalletIntroModal?: boolean;
37
- };
38
- };
39
- export type SocialNetwork = 'google' | 'twitter';
40
- export type SocialUser = {
41
- google?: unknown;
42
- twitter?: unknown;
43
- } | null;
44
- export {};
@@ -1,2 +0,0 @@
1
- declare const EmptyWalletList: () => import("react/jsx-runtime").JSX.Element;
2
- export default EmptyWalletList;
@@ -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 { NoResultImage, NoWalletFoundContainer } from './ConnectWalletModal.styles';
5
- const EmptyWalletList = () => {
6
- const { t } = useTranslation();
7
- return (_jsxs(NoWalletFoundContainer, { children: [_jsx(NoResultImage, { src: "/imgs/general/no-result-found.svg", width: "190px", alt: "No Wallet Found" }), _jsx(Divider, { size: "10" }), _jsx(Typography, { variant: "title", size: "medium", color: "info500", children: t('No Wallet Found') }), _jsx(Divider, { size: "10" }), _jsx(Typography, { variant: "body", size: "medium", style: { maxWidth: '350px' }, children: t('There is no wallet found based on selected chain or search text, please try another chain or search query.') })] }));
8
- };
9
- export default EmptyWalletList;
@@ -1,3 +0,0 @@
1
- import type { StatefulConnectContainerProps } from './StatefulConnectContainer.types';
2
- declare const StatefulConnectContainer: ({ selectedWallet, catchErrorsWhileConnect, indexInStack, onClose, onDetachedConfirm, detachedConfirmText, renderHeader, forceConnectToNamespaces, }: StatefulConnectContainerProps) => import("react/jsx-runtime").JSX.Element;
3
- export default StatefulConnectContainer;
@@ -1,37 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Divider } from '@rango-dev/ui';
3
- import { StatefulConnect } from '@rango-dev/widget-embedded';
4
- import { useTranslation } from 'react-i18next';
5
- import { useStatefulConnect } from '../../hooks/useStatefulConnect';
6
- import { Container } from './StatefulConnectContainer.styles';
7
- const { DerivationPath, isOnDerivationPath, isOnNamespace, Namespaces, Detached, isOnDetached } = StatefulConnect;
8
- const StatefulConnectContainer = ({ selectedWallet, catchErrorsWhileConnect, indexInStack, onClose, onDetachedConfirm, detachedConfirmText, renderHeader, forceConnectToNamespaces, }) => {
9
- const { t } = useTranslation();
10
- const { getState, handleDisconnect, handleNamespace, handleDerivationPath } = useStatefulConnect();
11
- const handleConfirmNamespaces = (selectedNamespaces) => {
12
- if (selectedWallet) {
13
- handleNamespace(selectedWallet, selectedNamespaces).catch(catchErrorsWhileConnect);
14
- }
15
- };
16
- const handleConfirmDerivationPath = (derivationPath) => {
17
- if (!derivationPath) {
18
- throw new Error("Derivation path is empty. Please make sure you've filled the field correctly.");
19
- }
20
- handleDerivationPath(selectedWallet, derivationPath, {
21
- forceConnectToNamespaces,
22
- }).catch(catchErrorsWhileConnect);
23
- };
24
- const handleNavigateToDerivationPath = (selectedNamespace) => {
25
- if (!selectedWallet) {
26
- return;
27
- }
28
- void handleNamespace(selectedWallet, [selectedNamespace]).catch(catchErrorsWhileConnect);
29
- };
30
- return (_jsxs(Container, { children: [renderHeader({
31
- handleClose: onClose,
32
- showBackButton: indexInStack > 0,
33
- title: t('Connect {{walletName}}', { walletName: selectedWallet.title }),
34
- walletName: selectedWallet.title, // TODO: This prop is added here as a workaround for resolve the problem related to texts from this package not being translated. Should remove this prop when the problem is resolved.
35
- }), _jsx(Divider, { size: "8" }), isOnNamespace(getState) && (_jsx(Namespaces, { onConfirm: handleConfirmNamespaces, value: getState().namespace })), isOnDerivationPath(getState) && (_jsx(DerivationPath, { onConfirm: handleConfirmDerivationPath, value: getState().derivationPath })), isOnDetached(getState) && (_jsx(Detached, { value: getState().namespace, selectedNamespaces: getState().selectedNamespaces, navigateToDerivationPath: handleNavigateToDerivationPath, onConfirm: onDetachedConfirm, onDisconnectWallet: () => void handleDisconnect(getState().namespace.targetWallet), confirmText: detachedConfirmText }))] }));
36
- };
37
- export default StatefulConnectContainer;
@@ -1 +0,0 @@
1
- export declare const Container: any;
@@ -1,51 +0,0 @@
1
- import { styled } from '@rango-dev/ui';
2
- export const Container = styled('div', {
3
- display: 'flex',
4
- flexDirection: 'column',
5
- gap: '$8',
6
- height: '100%',
7
- textAlign: 'left',
8
- padding: '$20',
9
- '@md': {
10
- padding: '$24',
11
- },
12
- '& ._message_box_description': {
13
- textAlign: 'left',
14
- },
15
- '& ._message_box_title': {
16
- display: 'none',
17
- },
18
- '& ul': {
19
- flexGrow: 1,
20
- },
21
- '& ._derivation_path_inputs_container': {
22
- flexGrow: 1,
23
- },
24
- '& ._message_box_icon_container': {
25
- display: 'none',
26
- },
27
- '& ._initial_namespace_list_header_alert_top_divider': {
28
- display: 'none',
29
- },
30
- '& ._initial_namespace_list_header_alert_bottom_divider': {
31
- height: 0,
32
- },
33
- '& ._initial_namespace_list_header_button_top_divider': {
34
- height: 0,
35
- },
36
- '& ._initial_namespace_list_header_button_bottom_divider': {
37
- height: 0,
38
- },
39
- '& ._detached_namespace_list_header_alert_top_divider': {
40
- display: 'none',
41
- },
42
- '& ._detached_namespace_list_header_alert_bottom_divider': {
43
- height: 0,
44
- },
45
- '& ._detached_namespace_list_header_button_top_divider': {
46
- height: 0,
47
- },
48
- '& ._detached_namespace_list_header_button_bottom_divider': {
49
- height: 0,
50
- },
51
- });
@@ -1,12 +0,0 @@
1
- import type { ConnectWalletModalProps } from './ConnectWalletModal.types';
2
- import type { WalletInfoWithExtra } from '@rango-dev/widget-embedded';
3
- export type StatefulConnectContainerProps = {
4
- selectedWallet: WalletInfoWithExtra;
5
- catchErrorsWhileConnect: (error: Error, wallet?: WalletInfoWithExtra) => void;
6
- indexInStack: number;
7
- onClose: () => void;
8
- onDetachedConfirm: () => void;
9
- detachedConfirmText?: string;
10
- forceConnectToNamespaces?: string[];
11
- renderHeader: ConnectWalletModalProps['renderHeader'];
12
- };
@@ -1,3 +0,0 @@
1
- import type { WalletsChainSelectProps } from './WalletsChainSelect.types';
2
- export declare const FILTERABLE_CHAIN_NAMES: string[];
3
- export declare function WalletsChainSelect(props: WalletsChainSelectProps): import("react/jsx-runtime").JSX.Element;
@@ -1,87 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ChevronDownIcon, ChevronUpIcon, Image, Radio, SearchIcon, TextField, Typography, } from '@rango-dev/ui';
3
- import { useEffect, useMemo, useState } from 'react';
4
- import { useTranslation } from 'react-i18next';
5
- import { SearchIconContainer } from './ConnectWalletModal.styles';
6
- import { ChainSelectRadioButton, chainSelectSearchInputStyles, ChainsListContainer, ChainsListHeader, ChainsRadioRoot, chainsSelectModalStyles, WalletChainSelectContainer, WalletChainSelectInput, WalletChainSelectInputIconContainer, WalletChainSelectInputTextContainer, } from './WalletsChainSelect.styles';
7
- export const FILTERABLE_CHAIN_NAMES = [
8
- 'ETH',
9
- 'COSMOS',
10
- 'TRON',
11
- 'STARKNET',
12
- 'SOLANA',
13
- 'BTC',
14
- 'LTC',
15
- 'DOGE',
16
- 'BCH',
17
- 'TON',
18
- 'SUI',
19
- 'XRPL',
20
- ];
21
- export function WalletsChainSelect(props) {
22
- const { t } = useTranslation();
23
- const [searchValue, setSearchValue] = useState('');
24
- const { isOpen, setIsOpen, selectedChain, handleSelectedChainChange, shouldExcludeWallet, allBlockchains, isMobile, renderHeader, renderModal, } = props;
25
- // List of blockchain items displayed in the chain select
26
- const filterableChains = useMemo(() => {
27
- return allBlockchains.filter((blockchain) => {
28
- // Drop blockchain if its name does not contain the search value
29
- if (!blockchain.name.toLowerCase().includes(searchValue.toLowerCase())) {
30
- return false;
31
- }
32
- // Drop blockchain if it is not in the FILTERABLE_CHAIN_NAMES
33
- if (!FILTERABLE_CHAIN_NAMES.includes(blockchain.name)) {
34
- return false;
35
- }
36
- // Drop blockchain if its related wallets are excluded
37
- if (!!shouldExcludeWallet && shouldExcludeWallet({ supportedChains: [blockchain] })) {
38
- return false;
39
- }
40
- return true;
41
- });
42
- }, [allBlockchains, searchValue]);
43
- const clickEventHandler = (event) => {
44
- const clickedElement = event.target;
45
- const isInsideProtectedArea = clickedElement.closest('.chains_list_container') ||
46
- clickedElement.closest('.chains_select_container') ||
47
- clickedElement.closest('.chains_search_input_container');
48
- if (!isInsideProtectedArea) {
49
- handleClose();
50
- }
51
- };
52
- useEffect(() => {
53
- document.addEventListener('mousedown', clickEventHandler);
54
- return () => {
55
- document.removeEventListener('mousedown', clickEventHandler);
56
- };
57
- }, []);
58
- function toggleOpen() {
59
- setIsOpen(!isOpen);
60
- }
61
- function handleClose() {
62
- setSearchValue('');
63
- setIsOpen(false);
64
- }
65
- const selectedBlockchainItem = useMemo(() => !!selectedChain
66
- ? filterableChains.find((blockchain) => blockchain.name === selectedChain)
67
- : null, [selectedChain]);
68
- const handleChainSelect = (blockchainName) => {
69
- handleSelectedChainChange(blockchainName);
70
- setIsOpen(false);
71
- };
72
- const renderChainsListContent = () => {
73
- return (_jsxs(ChainsListContainer, { className: "chains_list_container", children: [_jsx(ChainsListHeader, { children: _jsx(Typography, { variant: "label", size: "medium", children: t('Filter by blockchain') }) }), _jsx("div", { className: "chains_search_input_container", children: _jsx(TextField, { id: "app-connect-wallet-modal-search-chain-input", variant: "ghost", value: searchValue, onChange: (e) => setSearchValue(e.target.value), placeholder: t('Search Wallet'), prefix: _jsx(SearchIconContainer, { children: _jsx(SearchIcon, { color: "black", size: 16 }) }), style: chainSelectSearchInputStyles }) }), _jsxs(ChainsRadioRoot, { value: selectedChain || 'all', children: [_jsx(ChainSelectRadioButton, { id: 'all', title: t('All'), onClick: () => handleChainSelect(null), end: _jsx(Radio, { value: 'all' }) }), filterableChains.map((blockchain) => (_jsx(ChainSelectRadioButton, { id: blockchain.name, title: blockchain.name, onClick: () => handleChainSelect(blockchain.name), start: _jsx(Image, { src: blockchain.logo, size: 22 }), end: _jsx(Radio, { value: blockchain.name }) }, blockchain.name)))] })] }));
74
- };
75
- return (_jsxs(WalletChainSelectContainer, { children: [_jsxs(WalletChainSelectInput, { onClick: toggleOpen, className: "chains_select_container", children: [_jsxs(WalletChainSelectInputTextContainer, { children: [!!selectedBlockchainItem && _jsx(Image, { src: selectedBlockchainItem.logo, size: 20 }), _jsx(Typography, { variant: "label", size: "medium", children: !!selectedBlockchainItem ? selectedBlockchainItem.displayName : t('All Chains') })] }), _jsx(WalletChainSelectInputIconContainer, { children: isOpen ? (_jsx(ChevronUpIcon, { color: "black", size: 10 })) : (_jsx(ChevronDownIcon, { color: "black", size: 10 })) })] }), isOpen && !isMobile && renderChainsListContent(), renderModal({
76
- open: isOpen && isMobile,
77
- onClose: handleClose,
78
- anchor: 'bottom',
79
- styles: chainsSelectModalStyles,
80
- header: renderHeader({
81
- showBackButton: true,
82
- title: t('Filter by blockchain'),
83
- handleClose,
84
- }),
85
- children: renderChainsListContent(),
86
- })] }));
87
- }
@@ -1,21 +0,0 @@
1
- export declare const WalletChainSelectContainer: any;
2
- export declare const WalletChainSelectInput: any;
3
- export declare const WalletChainSelectInputTextContainer: any;
4
- export declare const WalletChainSelectInputIconContainer: any;
5
- export declare const ChainsListContainer: any;
6
- export declare const ChainsListHeader: any;
7
- export declare const ChainsRadioRoot: any;
8
- export declare const ChainSelectRadioButton: any;
9
- export declare const chainsSelectModalStyles: {
10
- container: {
11
- height: string;
12
- padding: string;
13
- };
14
- content: {
15
- padding: number;
16
- paddingTop: string;
17
- };
18
- };
19
- export declare const chainSelectSearchInputStyles: {
20
- padding: number;
21
- };
@@ -1,83 +0,0 @@
1
- import { darkTheme, ListItemButton, RadioRoot, styled } from '@rango-dev/ui';
2
- export const WalletChainSelectContainer = styled('div', {
3
- cursor: 'pointer',
4
- userSelect: 'none',
5
- flex: 1,
6
- position: 'relative',
7
- });
8
- export const WalletChainSelectInput = styled('div', {
9
- display: 'flex',
10
- justifyContent: 'space-between',
11
- padding: '$10',
12
- backgroundColor: '$neutral100',
13
- [`.${darkTheme} &`]: {
14
- backgroundColor: '$neutral300',
15
- },
16
- borderRadius: '$md',
17
- });
18
- export const WalletChainSelectInputTextContainer = styled('div', {
19
- display: 'flex',
20
- alignItems: 'center',
21
- gap: '$8',
22
- });
23
- export const WalletChainSelectInputIconContainer = styled('div', {
24
- height: '16px',
25
- width: '16px',
26
- padding: '4px',
27
- });
28
- export const ChainsListContainer = styled('div', {
29
- display: 'flex',
30
- flexDirection: 'column',
31
- gap: '$10',
32
- backgroundColor: '$background',
33
- textAlign: 'start',
34
- width: '100%',
35
- height: '100%',
36
- overflowY: 'clip',
37
- '@md': {
38
- padding: '$15',
39
- zIndex: 1,
40
- position: 'absolute',
41
- width: '240px',
42
- height: 'max-content',
43
- top: '$50',
44
- right: '0',
45
- borderRadius: '$sm',
46
- boxShadow: '0px 5px 20px 0px #82828233',
47
- [`.${darkTheme} &`]: {
48
- boxShadow: '0px 5px 20px 0px #161C38',
49
- },
50
- },
51
- });
52
- export const ChainsListHeader = styled('div', {
53
- display: 'none',
54
- '@md': {
55
- display: 'inline',
56
- },
57
- });
58
- export const ChainsRadioRoot = styled(RadioRoot, {
59
- overflowY: 'auto',
60
- '@md': {
61
- maxHeight: '370px',
62
- },
63
- });
64
- export const ChainSelectRadioButton = styled(ListItemButton, {
65
- height: '60px',
66
- borderWidth: '5px',
67
- border: 'none',
68
- borderBottom: '0.5px solid $neutral300',
69
- borderRadius: 0,
70
- lineHeight: '26px',
71
- fontSize: '18px',
72
- '@md': {
73
- height: '40px',
74
- border: 'none',
75
- lineHeight: '20px',
76
- fontSize: '14px',
77
- },
78
- });
79
- export const chainsSelectModalStyles = {
80
- container: { height: '100%', padding: '20px' },
81
- content: { padding: 0, paddingTop: '40px' },
82
- };
83
- export const chainSelectSearchInputStyles = { padding: 0 };
@@ -1,12 +0,0 @@
1
- import type { ConnectWalletModalProps } from './ConnectWalletModal.types';
2
- export type WalletsChainSelectProps = {
3
- isOpen: boolean;
4
- setIsOpen: (isOpen: boolean) => void;
5
- selectedChain: string | null;
6
- handleSelectedChainChange: (value: string | null) => void;
7
- shouldExcludeWallet?: ConnectWalletModalProps['shouldExcludeWallet'];
8
- allBlockchains: ConnectWalletModalProps['allBlockchains'];
9
- isMobile: ConnectWalletModalProps['isMobile'];
10
- renderHeader: ConnectWalletModalProps['renderHeader'];
11
- renderModal: ConnectWalletModalProps['renderModal'];
12
- };
@@ -1,3 +0,0 @@
1
- import ConnectWalletModal from './ConnectWalletModal';
2
- export { ConnectWalletModal };
3
- export type { ConnectWalletModalProps } from './ConnectWalletModal.types';
@@ -1,2 +0,0 @@
1
- import ConnectWalletModal from './ConnectWalletModal';
2
- export { ConnectWalletModal };
@@ -1,3 +0,0 @@
1
- import type { PropTypes } from './ProfileWallet.types';
2
- import type { ReactElement } from 'react';
3
- export declare function ProfileWallet(props: PropTypes): ReactElement;
@@ -1,54 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CompleteIcon, Divider, Image, Typography, WalletIcon } from '@rango-dev/ui';
3
- import { useWallets } from '@rango-dev/widget-embedded';
4
- import { useEffect, useRef } from 'react';
5
- import { useTranslation } from 'react-i18next';
6
- import { useDispatch } from 'react-redux';
7
- import { createSignMessage } from '../../store/thunks';
8
- import { getConciseAddress } from '../../utils/mod';
9
- import { supportedBlockchainsDisplayName } from '../ProfileWalletsModal/ProfileWalletsModal.constants';
10
- import { BlockchainDisplayName, Container, IconHighlight, StyledButton, TitleContainer, UnknownWallet, } from './ProfileWallet.styles';
11
- const ADDRESS_MAX_CHARS = 8;
12
- const signMessage = createSignMessage();
13
- export function ProfileWallet(props) {
14
- const { account: { address, blockchain, walletType }, data: { isUserLoggedIn, selectedAccount }, onLogin, onMerge, onError, } = props;
15
- const dispatch = useDispatch();
16
- const { getWalletInfo, getSigners } = useWallets();
17
- const signMessagePromise = useRef(null);
18
- let image = null;
19
- let name = null;
20
- const { t } = useTranslation();
21
- if (walletType) {
22
- const walletInfo = getWalletInfo(walletType);
23
- image = walletInfo.img;
24
- name = walletInfo.name;
25
- }
26
- const conciseAddress = getConciseAddress(props.account.address, ADDRESS_MAX_CHARS);
27
- const blockchainDisplayName = supportedBlockchainsDisplayName[props.account.blockchain];
28
- const loading = selectedAccount?.address === address &&
29
- selectedAccount?.blockchain === blockchain &&
30
- selectedAccount?.walletType === walletType;
31
- const disabled = !!selectedAccount && !loading;
32
- const signMessageCallback = (profileSummary, meta) => {
33
- if (meta.actionType === 'login') {
34
- onLogin?.(profileSummary);
35
- }
36
- else {
37
- onMerge?.(profileSummary);
38
- }
39
- };
40
- useEffect(() => {
41
- return () => signMessagePromise.current?.abort();
42
- }, []);
43
- return (_jsx(Container, { hasDivider: true, title: _jsxs(TitleContainer, { children: [name && (_jsxs(_Fragment, { children: [_jsx(Typography, { variant: "title", size: "xmedium", color: "foreground", children: name }), _jsx(Divider, { direction: "horizontal", size: "4" })] })), _jsx(BlockchainDisplayName, { variant: "body", size: "xsmall", color: "neutral600", children: blockchainDisplayName ?? props.account.blockchain })] }), description: conciseAddress ?? props.account.address, start: image ? (_jsx(Image, { src: image, size: 28, type: "circular" })) : (_jsx(UnknownWallet, { children: _jsx(WalletIcon, { size: 16, color: "gray" }) })), end: !walletType ? (_jsx(IconHighlight, { children: _jsx(CompleteIcon, { color: "success", size: 13 }) })) : (_jsx(StyledButton, { id: `profile-page-wallet-${isUserLoggedIn ? 'add-to-profile' : 'login'}-btn`, variant: "contained", size: "xxsmall", type: "primary", disabled: disabled, loading: loading, onClick: () => {
44
- if (walletType) {
45
- // @ts-expect-error-next-line signMessage is Cancelable, but to be typed correctly we need to access store, which we don't have here.
46
- signMessagePromise.current = dispatch(signMessage({
47
- account: { address, blockchain, walletType },
48
- getSigners,
49
- callback: signMessageCallback,
50
- errorCallback: onError,
51
- }));
52
- }
53
- }, children: isUserLoggedIn ? t('Add To Profile') : t('Login') })) }));
54
- }
@@ -1,6 +0,0 @@
1
- export declare const Container: any;
2
- export declare const TitleContainer: any;
3
- export declare const BlockchainDisplayName: any;
4
- export declare const StyledButton: any;
5
- export declare const IconHighlight: any;
6
- export declare const UnknownWallet: any;
@@ -1,54 +0,0 @@
1
- import { Button, darkTheme, ListItem, rangoDarkColors, styled, Typography } from '@rango-dev/ui';
2
- export const Container = styled(ListItem, {
3
- height: '54px',
4
- '& ._description': {
5
- color: '$neutral700 !important',
6
- [`.${darkTheme} &`]: {
7
- color: '$neutral900 !important',
8
- },
9
- },
10
- });
11
- export const TitleContainer = styled('div', {
12
- display: 'flex',
13
- justifyContent: 'center',
14
- alignItems: 'center',
15
- });
16
- export const BlockchainDisplayName = styled(Typography, {
17
- [`.${darkTheme} &`]: {
18
- color: '$neutral800 !important',
19
- },
20
- });
21
- export const StyledButton = styled(Button, {
22
- height: '28px',
23
- paddingRight: '$32 !important',
24
- paddingLeft: '$32 !important',
25
- fontWeight: '$medium',
26
- });
27
- export const IconHighlight = styled('div', {
28
- width: '$20',
29
- height: '$20',
30
- borderRadius: '$lg',
31
- position: 'relative',
32
- backgroundColor: '$success300',
33
- '& svg': {
34
- position: 'absolute',
35
- left: '50%',
36
- top: '50%',
37
- transform: 'translate(-50%,-50%)',
38
- },
39
- });
40
- export const UnknownWallet = styled('div', {
41
- width: '$28',
42
- height: '$28',
43
- borderRadius: '100%',
44
- display: 'flex',
45
- justifyContent: 'center',
46
- alignItems: 'center',
47
- backgroundColor: '$neutral100',
48
- [`.${darkTheme} &`]: {
49
- backgroundColor: rangoDarkColors.neutral100,
50
- '& svg': {
51
- color: '$neutral800 !important',
52
- },
53
- },
54
- });
@@ -1,11 +0,0 @@
1
- import type { ProfileAccount } from '../../api/mod';
2
- import type { ProfileWalletsModalProps } from '../ProfileWalletsModal';
3
- export type PropTypes = {
4
- account: Omit<ProfileAccount, 'walletType'> & {
5
- walletType: string | null;
6
- };
7
- data: ProfileWalletsModalProps['data'];
8
- onLogin: ProfileWalletsModalProps['onLogin'];
9
- onMerge: ProfileWalletsModalProps['onMerge'];
10
- onError?: ProfileWalletsModalProps['onError'];
11
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { ProfileWallet } from './ProfileWallet';
@@ -1 +0,0 @@
1
- export { ProfileWallet } from './ProfileWallet';
@@ -1,2 +0,0 @@
1
- import type { PropTypes } from './ProfileWallets.types';
2
- export declare function ConnectedWallets(props: PropTypes): import("react/jsx-runtime").JSX.Element;