@openfort/react 1.0.6 → 1.0.8
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/build/assets/icons.js +1 -1
- package/build/components/Common/WalletRecoveryIcon/index.d.ts +1 -0
- package/build/components/Common/WalletRecoveryIcon/index.js +6 -1
- package/build/components/Common/WalletRecoveryIcon/index.js.map +1 -1
- package/build/components/ConnectModal/ConnectWithInjector/index.js +4 -4
- package/build/components/ConnectModal/ConnectWithMobile.js +10 -8
- package/build/components/ConnectModal/ConnectWithMobile.js.map +1 -1
- package/build/components/ConnectModal/ConnectWithOAuth.js +5 -1
- package/build/components/ConnectModal/ConnectWithOAuth.js.map +1 -1
- package/build/components/ConnectModal/index.js +3 -3
- package/build/components/Openfort/OpenfortProvider.js +4 -0
- package/build/components/Openfort/OpenfortProvider.js.map +1 -1
- package/build/components/Pages/Connected/EthereumConnected.js +7 -4
- package/build/components/Pages/Connected/EthereumConnected.js.map +1 -1
- package/build/components/Pages/Connected/SolanaConnected.js +1 -1
- package/build/components/Pages/Connectors/index.js +1 -55
- package/build/components/Pages/Connectors/index.js.map +1 -1
- package/build/components/Pages/LinkedProvider/index.js +7 -2
- package/build/components/Pages/LinkedProvider/index.js.map +1 -1
- package/build/components/Pages/LoadWallets/index.js +35 -28
- package/build/components/Pages/LoadWallets/index.js.map +1 -1
- package/build/components/Pages/RemoveLinkedProvider/index.js +5 -1
- package/build/components/Pages/RemoveLinkedProvider/index.js.map +1 -1
- package/build/components/Pages/SelectWalletToRecover/index.js +41 -3
- package/build/components/Pages/SelectWalletToRecover/index.js.map +1 -1
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.js +5 -1
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.js.map +1 -1
- package/build/hooks/openfort/auth/useAuthCallback.d.ts +1 -1
- package/build/hooks/openfort/auth/useAuthCallback.js +24 -8
- package/build/hooks/openfort/auth/useAuthCallback.js.map +1 -1
- package/build/hooks/useResolvedIdentity.js +4 -1
- package/build/hooks/useResolvedIdentity.js.map +1 -1
- package/build/openfort/CoreOpenfortProvider.js +1 -0
- package/build/openfort/CoreOpenfortProvider.js.map +1 -1
- package/build/openfort/hooks/useActiveAddressSync.d.ts +7 -3
- package/build/openfort/hooks/useActiveAddressSync.js +37 -7
- package/build/openfort/hooks/useActiveAddressSync.js.map +1 -1
- package/build/solana/hooks/useSolanaEmbeddedWallet.js +1 -1
- package/build/utils/rpc.d.ts +0 -4
- package/build/utils/rpc.js +5 -1
- package/build/utils/rpc.js.map +1 -1
- package/build/utils/urlSecurity.d.ts +28 -0
- package/build/utils/urlSecurity.js +56 -0
- package/build/utils/urlSecurity.js.map +1 -0
- package/build/version.d.ts +1 -1
- package/build/version.js +1 -1
- package/build/wagmi/useConnectWithSiwe.js +35 -29
- package/build/wagmi/useConnectWithSiwe.js.map +1 -1
- package/build/wagmi/useEmbeddedWalletWagmiSync.js +21 -1
- package/build/wagmi/useEmbeddedWalletWagmiSync.js.map +1 -1
- package/build/wagmi/useWalletAuth.js +7 -0
- package/build/wagmi/useWalletAuth.js.map +1 -1
- package/package.json +2 -3
package/build/assets/icons.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
3
|
const SendIcon = ({ ...props }) => (jsxs("svg", { "aria-hidden": "true", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [jsx("path", { d: "M5 19L19 5", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M9 5H19V15", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
4
4
|
const ReceiveIcon = ({ ...props }) => (jsxs("svg", { "aria-hidden": "true", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [jsx("path", { d: "M19 5L5 19", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M15 19H5V9", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RecoveryMethod } from '@openfort/openfort-js';
|
|
2
|
+
export declare const RECOVERY_METHOD_LABEL: Record<RecoveryMethod, string>;
|
|
2
3
|
export declare const WalletRecoveryIcon: ({ recovery }: {
|
|
3
4
|
recovery: RecoveryMethod | undefined;
|
|
4
5
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -2,6 +2,11 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { RecoveryMethod } from '@openfort/openfort-js';
|
|
3
3
|
import { LockIcon, FingerPrintIcon, KeyIcon } from '../../../assets/icons.js';
|
|
4
4
|
|
|
5
|
+
const RECOVERY_METHOD_LABEL = {
|
|
6
|
+
[RecoveryMethod.AUTOMATIC]: 'Automatic',
|
|
7
|
+
[RecoveryMethod.PASSWORD]: 'Password',
|
|
8
|
+
[RecoveryMethod.PASSKEY]: 'Passkey',
|
|
9
|
+
};
|
|
5
10
|
const WalletRecoveryIcon = ({ recovery }) => {
|
|
6
11
|
switch (recovery) {
|
|
7
12
|
case RecoveryMethod.PASSWORD:
|
|
@@ -15,5 +20,5 @@ const WalletRecoveryIcon = ({ recovery }) => {
|
|
|
15
20
|
}
|
|
16
21
|
};
|
|
17
22
|
|
|
18
|
-
export { WalletRecoveryIcon };
|
|
23
|
+
export { RECOVERY_METHOD_LABEL, WalletRecoveryIcon };
|
|
19
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -118,7 +118,7 @@ const ConnectWithInjector = ({ forceState }) => {
|
|
|
118
118
|
connectorType: (_b = walletItem.connector) === null || _b === void 0 ? void 0 : _b.type,
|
|
119
119
|
walletClientType: (_c = walletItem.connector) === null || _c === void 0 ? void 0 : _c.id,
|
|
120
120
|
onError: (error, _errorType) => {
|
|
121
|
-
logger.error(error);
|
|
121
|
+
logger.error('[ConnectWithInjector] SIWE failed:', error);
|
|
122
122
|
disconnect();
|
|
123
123
|
setStatus(states.FAILED);
|
|
124
124
|
},
|
|
@@ -211,14 +211,14 @@ const ConnectWithInjector = ({ forceState }) => {
|
|
|
211
211
|
}
|
|
212
212
|
if (!wallet) {
|
|
213
213
|
setStatus(states.FAILED);
|
|
214
|
-
logger.error('No wallet found');
|
|
214
|
+
logger.error('[ConnectWithInjector] No wallet found after connect');
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
|
-
logger.log('Connect type is:', props.connectType);
|
|
217
|
+
logger.log('[ConnectWithInjector] Connect type is:', props.connectType);
|
|
218
218
|
await handleConnectSettled(wallet, connectResult);
|
|
219
219
|
}
|
|
220
220
|
catch (err) {
|
|
221
|
-
logger.error(err);
|
|
221
|
+
logger.error('[ConnectWithInjector] Connection error', err instanceof Error ? err.message : err);
|
|
222
222
|
handleConnectError(err && typeof err === 'object' && 'code' in err
|
|
223
223
|
? err
|
|
224
224
|
: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
|
+
import { embeddedWalletId } from '../../constants/openfort.js';
|
|
3
4
|
import { useEthereumBridge } from '../../ethereum/OpenfortEthereumBridgeContext.js';
|
|
4
5
|
import styled from '../../styles/styled/index.js';
|
|
5
6
|
import { isAndroid } from '../../utils/index.js';
|
|
@@ -25,7 +26,7 @@ const DownloadFooter = styled.div `
|
|
|
25
26
|
color: var(--ck-body-color-muted);
|
|
26
27
|
`;
|
|
27
28
|
const ConnectWithMobile = () => {
|
|
28
|
-
var _a, _b, _c, _d, _e;
|
|
29
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
29
30
|
const { connector, setRoute } = useOpenfort();
|
|
30
31
|
const walletId = Object.keys(walletConfigs).find(
|
|
31
32
|
// where id is comma separated list
|
|
@@ -35,8 +36,9 @@ const ConnectWithMobile = () => {
|
|
|
35
36
|
.indexOf(connector.id) !== -1);
|
|
36
37
|
const wallet = useExternalConnector(connector.id) || (walletId && walletConfigs[walletId]) || {};
|
|
37
38
|
const bridge = useEthereumBridge();
|
|
38
|
-
|
|
39
|
-
const
|
|
39
|
+
// Only consider external wallets as "connected" — ignore the embedded wallet connector
|
|
40
|
+
const isExternalConnected = (_d = (((_a = bridge === null || bridge === void 0 ? void 0 : bridge.account) === null || _a === void 0 ? void 0 : _a.isConnected) && ((_c = (_b = bridge === null || bridge === void 0 ? void 0 : bridge.account) === null || _b === void 0 ? void 0 : _b.connector) === null || _c === void 0 ? void 0 : _c.id) !== embeddedWalletId)) !== null && _d !== void 0 ? _d : false;
|
|
41
|
+
const [status, setStatus] = useState(isExternalConnected ? states.CONNECTING : states.INIT);
|
|
40
42
|
const [description, setDescription] = useState(undefined);
|
|
41
43
|
const [hasReturned, setHasReturned] = useState(false);
|
|
42
44
|
const { connectWithSiwe } = useConnectWithSiwe();
|
|
@@ -59,7 +61,7 @@ const ConnectWithMobile = () => {
|
|
|
59
61
|
useEffect(() => {
|
|
60
62
|
if (hasReturned) {
|
|
61
63
|
setHasReturned(false);
|
|
62
|
-
if (
|
|
64
|
+
if (isExternalConnected) {
|
|
63
65
|
setStatus(states.CONNECTING);
|
|
64
66
|
}
|
|
65
67
|
else {
|
|
@@ -67,7 +69,7 @@ const ConnectWithMobile = () => {
|
|
|
67
69
|
setDescription('Connection failed or cancelled');
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
|
-
}, [hasReturned,
|
|
72
|
+
}, [hasReturned, isExternalConnected]);
|
|
71
73
|
useEffect(() => {
|
|
72
74
|
switch (status) {
|
|
73
75
|
case states.INIT:
|
|
@@ -86,13 +88,13 @@ const ConnectWithMobile = () => {
|
|
|
86
88
|
}
|
|
87
89
|
}, [status]);
|
|
88
90
|
return (jsxs(PageContent, { children: [jsx(Loader, { header: `Connecting with ${connector.id.split(',')[0]}`, icon: wallet === null || wallet === void 0 ? void 0 : wallet.icon, isError: status === states.ERROR, description: description, onRetry: () => {
|
|
89
|
-
setStatus(
|
|
91
|
+
setStatus(isExternalConnected ? states.CONNECTING : states.INIT);
|
|
90
92
|
setDescription('');
|
|
91
|
-
} }),
|
|
93
|
+
} }), isExternalConnected ? (jsx(Button, { onClick: () => {
|
|
92
94
|
openApp();
|
|
93
95
|
}, children: "Sign in App" })) : (jsx(Button, { onClick: () => {
|
|
94
96
|
openApp();
|
|
95
|
-
}, children: "Sign in App" })), jsx(DownloadFooter, { children: jsxs(FitText, { children: ["Don't have ", (
|
|
97
|
+
}, children: "Sign in App" })), jsx(DownloadFooter, { children: jsxs(FitText, { children: ["Don't have ", (_e = wallet.name) !== null && _e !== void 0 ? _e : connector.id.split(',')[0], " installed?", ' ', jsx("a", { style: { marginLeft: 5 }, href: isAndroid() ? (_f = wallet === null || wallet === void 0 ? void 0 : wallet.downloadUrls) === null || _f === void 0 ? void 0 : _f.android : (_g = wallet === null || wallet === void 0 ? void 0 : wallet.downloadUrls) === null || _g === void 0 ? void 0 : _g.ios, target: "_blank", rel: "noreferrer", children: "GET" })] }) })] }));
|
|
96
98
|
};
|
|
97
99
|
|
|
98
100
|
export { ConnectWithMobile as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectWithMobile.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConnectWithMobile.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,6 +3,7 @@ import { useState, useEffect } from 'react';
|
|
|
3
3
|
import { providersLogos } from '../../assets/logos.js';
|
|
4
4
|
import { useOpenfortCore } from '../../openfort/useOpenfort.js';
|
|
5
5
|
import { logger } from '../../utils/logger.js';
|
|
6
|
+
import { parseCallbackUrl, suppressReferrer } from '../../utils/urlSecurity.js';
|
|
6
7
|
import Loader from '../Common/Loading/index.js';
|
|
7
8
|
import { routes } from '../Openfort/types.js';
|
|
8
9
|
import { useOpenfort } from '../Openfort/useOpenfort.js';
|
|
@@ -27,7 +28,7 @@ const ConnectWithOAuth = () => {
|
|
|
27
28
|
return;
|
|
28
29
|
if (connector.type !== 'oauth')
|
|
29
30
|
throw new Error('Invalid connector type');
|
|
30
|
-
const url =
|
|
31
|
+
const url = parseCallbackUrl(win.location.href);
|
|
31
32
|
const hasProvider = !!url.searchParams.get('openfortAuthProviderUI');
|
|
32
33
|
const provider = connector.id;
|
|
33
34
|
switch (status) {
|
|
@@ -38,6 +39,8 @@ const ConnectWithOAuth = () => {
|
|
|
38
39
|
setTimeout(() => setStatus(states.REDIRECT), 150); // UX: wait a bit before redirecting
|
|
39
40
|
break;
|
|
40
41
|
case states.CONNECTING: {
|
|
42
|
+
// Suppress Referer before any async work to prevent token leakage
|
|
43
|
+
const restoreReferrer = suppressReferrer();
|
|
41
44
|
const userId = url.searchParams.get('user_id');
|
|
42
45
|
const token = url.searchParams.get('access_token');
|
|
43
46
|
const error = url.searchParams.get('error');
|
|
@@ -45,6 +48,7 @@ const ConnectWithOAuth = () => {
|
|
|
45
48
|
url.searchParams.delete(key);
|
|
46
49
|
});
|
|
47
50
|
win.history.replaceState({}, doc.title, url.toString());
|
|
51
|
+
restoreReferrer();
|
|
48
52
|
if (!userId || !token || error) {
|
|
49
53
|
logger.error(`Missing user id or access token: userId=${userId}, accessToken=${token ? `${token.substring(0, 10)}...` : token}`);
|
|
50
54
|
setStatus(states.ERROR);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectWithOAuth.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConnectWithOAuth.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { ChainTypeEnum, OAuthProvider } from '@openfort/openfort-js';
|
|
3
|
-
import { useMemo, useRef, useEffect } from 'react';
|
|
3
|
+
import { lazy, Suspense, useMemo, useRef, useEffect } from 'react';
|
|
4
4
|
import { useConnectionStrategy } from '../../core/ConnectionStrategyContext.js';
|
|
5
5
|
import { useOpenfortCore } from '../../openfort/useOpenfort.js';
|
|
6
6
|
import { logger } from '../../utils/logger.js';
|
|
7
|
-
import SwitchNetworks from '../../wagmi/components/SwitchNetworks/index.js';
|
|
8
7
|
import Modal from '../Common/Modal/index.js';
|
|
9
8
|
import { ConnectKitThemeProvider } from '../ConnectKitThemeProvider/ConnectKitThemeProvider.js';
|
|
10
9
|
import { routes } from '../Openfort/types.js';
|
|
@@ -49,6 +48,7 @@ import SocialProviders from '../Pages/SocialProviders/index.js';
|
|
|
49
48
|
import ConnectUsing from './ConnectUsing.js';
|
|
50
49
|
import ConnectWithMobile from './ConnectWithMobile.js';
|
|
51
50
|
|
|
51
|
+
const LazySwitchNetworks = lazy(() => import('../../wagmi/components/SwitchNetworks/index.js'));
|
|
52
52
|
function buildSharedPages() {
|
|
53
53
|
return {
|
|
54
54
|
onboarding: jsx(Introduction, {}),
|
|
@@ -99,7 +99,7 @@ const CHAIN_PREFIXED_PAGES = {
|
|
|
99
99
|
'eth:connected': jsx(Connected, {}),
|
|
100
100
|
'eth:createWallet': jsx(CreateWallet, {}),
|
|
101
101
|
'eth:recoverWallet': jsx(RecoverPage, {}),
|
|
102
|
-
'eth:switchNetworks': jsx(
|
|
102
|
+
'eth:switchNetworks': (jsx(Suspense, { fallback: null, children: jsx(LazySwitchNetworks, {}) })),
|
|
103
103
|
'eth:send': jsx(Send, {}),
|
|
104
104
|
'eth:receive': jsx(Receive, {}),
|
|
105
105
|
'eth:buy': jsx(Buy, {}),
|
|
@@ -142,6 +142,10 @@ const OpenfortProvider = ({ children, uiConfig, onConnect, onDisconnect, debugMo
|
|
|
142
142
|
const setOpen = useCallback((value) => {
|
|
143
143
|
if (value) {
|
|
144
144
|
setRouteHistory([]);
|
|
145
|
+
// Reset route and connector to avoid stale state from a previous modal session
|
|
146
|
+
// (e.g. a failed SIWE attempt leaving route on CONNECT with a stale connector)
|
|
147
|
+
setRoute({ route: routes.LOADING });
|
|
148
|
+
setConnector(initialConnector);
|
|
145
149
|
}
|
|
146
150
|
setOpenWithoutHistory(value);
|
|
147
151
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenfortProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OpenfortProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
3
3
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
4
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { lazy, useEffect, useMemo, useState, Suspense } from 'react';
|
|
5
5
|
import { formatUnits } from 'viem';
|
|
6
6
|
import { UserRoundIcon, SendIcon, ReceiveIcon, BuyIcon } from '../../../assets/icons.js';
|
|
7
7
|
import { useEthereumEmbeddedWallet } from '../../../ethereum/hooks/useEthereumEmbeddedWallet.js';
|
|
8
8
|
import { useEthereumWalletAssets } from '../../../ethereum/hooks/useEthereumWalletAssets.js';
|
|
9
|
+
import { useEthereumBridge } from '../../../ethereum/OpenfortEthereumBridgeContext.js';
|
|
9
10
|
import useLocales from '../../../hooks/useLocales.js';
|
|
10
11
|
import { useResolvedIdentity } from '../../../hooks/useResolvedIdentity.js';
|
|
11
12
|
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
12
13
|
import { nFormatter } from '../../../utils/index.js';
|
|
13
14
|
import { logger } from '../../../utils/logger.js';
|
|
14
|
-
import ChainSelector from '../../../wagmi/components/ChainSelect/index.js';
|
|
15
15
|
import Avatar from '../../Common/Avatar/index.js';
|
|
16
16
|
import Button from '../../Common/Button/index.js';
|
|
17
17
|
import { TextLinkButton } from '../../Common/Button/styles.js';
|
|
18
|
+
import Chain from '../../Common/Chain/index.js';
|
|
18
19
|
import { CopyText } from '../../Common/CopyToClipboard/CopyText.js';
|
|
19
20
|
import { ModalBody } from '../../Common/Modal/styles.js';
|
|
20
21
|
import { useThemeContext } from '../../ConnectKitThemeProvider/ConnectKitThemeProvider.js';
|
|
@@ -26,6 +27,7 @@ import { ConnectedPageLayout } from './ConnectedPageLayout.js';
|
|
|
26
27
|
import { LinkedProvidersToggle, Balance, Unsupported, ChainSelectorContainer, ActionButton } from './styles.js';
|
|
27
28
|
import { truncateEthAddress } from '../../../utils/format.js';
|
|
28
29
|
|
|
30
|
+
const LazyChainSelector = lazy(() => import('../../../wagmi/components/ChainSelect/index.js'));
|
|
29
31
|
function getFirstBalanceAsset(assets) {
|
|
30
32
|
return assets === null || assets === void 0 ? void 0 : assets.find((a) => a.balance && a.balance > BigInt(0));
|
|
31
33
|
}
|
|
@@ -34,6 +36,7 @@ const EthereumConnected = () => {
|
|
|
34
36
|
const context = useOpenfort();
|
|
35
37
|
const { setHeaderLeftSlot, setRoute, chains } = context;
|
|
36
38
|
const themeContext = useThemeContext();
|
|
39
|
+
const bridge = useEthereumBridge();
|
|
37
40
|
const wallet = useEthereumEmbeddedWallet();
|
|
38
41
|
const { embeddedAccounts } = useOpenfortCore();
|
|
39
42
|
const hasEthereumWallets = ((_a = embeddedAccounts === null || embeddedAccounts === void 0 ? void 0 : embeddedAccounts.filter((a) => a.chainType === ChainTypeEnum.EVM)) !== null && _a !== void 0 ? _a : []).length > 0;
|
|
@@ -117,8 +120,8 @@ const EthereumConnected = () => {
|
|
|
117
120
|
}
|
|
118
121
|
setRoute(routes.ASSET_INVENTORY);
|
|
119
122
|
}, children: jsxs(Balance, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: ["$", nFormatter(totalBalanceUsd)] }, `chain-${chain === null || chain === void 0 ? void 0 : chain.id}`) })) : null;
|
|
120
|
-
const noWalletFallback = hasEthereumWallets ? (jsx(Button, { onClick: () => context.setRoute(routes.
|
|
121
|
-
return (jsx(PageContent, { onBack: null, header: locales.profileScreen_heading, children: jsx(ConnectedPageLayout, { address: address !== null && address !== void 0 ? address : '', displayName: jsx(CopyText, { value: address !== null && address !== void 0 ? address : '', children: ensName !== null && ensName !== void 0 ? ensName : truncateEthAddress(address !== null && address !== void 0 ? address : '', separator) }), avatar: address ? jsx(Avatar, { address: address }) : jsx("span", {}), beforeAvatar: jsx(ChainSelectorContainer, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.2 }, children: jsx(
|
|
123
|
+
const noWalletFallback = hasEthereumWallets ? (jsx(Button, { onClick: () => context.setRoute(routes.SELECT_WALLET_TO_RECOVER), children: "Manage wallets" })) : (jsx(Button, { onClick: () => context.setRoute({ route: routes.CONNECTORS, connectType: 'link' }), icon: jsx(Unsupported, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: jsxs("svg", { width: "130", height: "120", viewBox: "0 0 13 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("title", { children: "Unsupported wallet icon" }), jsx("path", { d: "M2.61317 11.2501H9.46246C10.6009 11.2501 11.3256 10.3506 11.3256 9.3549C11.3256 9.05145 11.255 8.73244 11.0881 8.43303L7.65903 2.14708C7.659 2.14702 7.65897 2.14696 7.65893 2.1469C7.65889 2.14682 7.65884 2.14673 7.65879 2.14664C7.31045 1.50746 6.6741 1.17871 6.04 1.17871C5.41478 1.17871 4.763 1.50043 4.41518 2.14968L0.993416 8.43476C0.828865 8.72426 0.75 9.04297 0.75 9.3549C0.75 10.3506 1.47471 11.2501 2.61317 11.2501Z", fill: "currentColor", stroke: "var(--ck-body-background, #fff)", strokeWidth: "1.5" }), jsx("path", { d: "M6.03258 7.43916C5.77502 7.43916 5.63096 7.29153 5.62223 7.02311L5.55675 4.96973C5.54802 4.69684 5.74446 4.5 6.02821 4.5C6.3076 4.5 6.51277 4.70131 6.50404 4.9742L6.43856 7.01864C6.42546 7.29153 6.2814 7.43916 6.03258 7.43916ZM6.03258 9.11676C5.7401 9.11676 5.5 8.9065 5.5 8.60677C5.5 8.30704 5.7401 8.09678 6.03258 8.09678C6.32506 8.09678 6.56515 8.30256 6.56515 8.60677C6.56515 8.91097 6.32069 9.11676 6.03258 9.11676Z", fill: "white" })] }) }), children: "Connect wallet" }));
|
|
124
|
+
return (jsx(PageContent, { onBack: null, header: locales.profileScreen_heading, children: jsx(ConnectedPageLayout, { address: address !== null && address !== void 0 ? address : '', displayName: jsx(CopyText, { value: address !== null && address !== void 0 ? address : '', children: ensName !== null && ensName !== void 0 ? ensName : truncateEthAddress(address !== null && address !== void 0 ? address : '', separator) }), avatar: address ? jsx(Avatar, { address: address }) : jsx("span", {}), beforeAvatar: jsx(ChainSelectorContainer, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.2 }, children: bridge ? (jsx(Suspense, { fallback: jsx(Chain, { id: chainId }), children: jsx(LazyChainSelector, {}) })) : (jsx(Chain, { id: chainId })) }, chainId !== null && chainId !== void 0 ? chainId : 'loading'), balance: balanceNode, actions: jsxs(Fragment, { children: [jsx(ActionButton, { icon: jsx(SendIcon, {}), onClick: () => {
|
|
122
125
|
const firstBalanceAsset = getFirstBalanceAsset(assets);
|
|
123
126
|
if (!firstBalanceAsset) {
|
|
124
127
|
setRoute(routes.NO_ASSETS_AVAILABLE);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumConnected.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumConnected.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -89,7 +89,7 @@ const SolanaConnected = () => {
|
|
|
89
89
|
: undefined;
|
|
90
90
|
const avatar = address ? CustomAvatar ? jsx(CustomAvatar, { address: address }) : jsx(Avatar, { address: address }) : jsx("span", {});
|
|
91
91
|
const balanceNode = balanceSol != null && !isBalanceLoading ? (jsxs(Balance, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: [nFormatter(Number(balanceSol)), " SOL"] }, "solana-balance")) : null;
|
|
92
|
-
return (jsx(PageContent, { onBack: null, header: locales.profileScreen_heading, children: jsx(ConnectedPageLayout, { address: address !== null && address !== void 0 ? address : '', displayName: jsx(CopyText, { value: address !== null && address !== void 0 ? address : '', children: truncateSolanaAddress(address !== null && address !== void 0 ? address : '', separator) }), avatar: avatar, balance: balanceNode, actions: jsx(ActionButton, { icon: jsx(ReceiveIcon, {}), onClick: () => context.setRoute(routes.SOL_RECEIVE), children: "Get" }), hideBalance: context === null || context === void 0 ? void 0 : context.uiConfig.hideBalance, isBalanceLoading: isBalanceLoading, isAddressLoading: isAddressLoading, noWalletFallback: hasSolanaWallets ? (jsx(Button, { onClick: () => setRoute(routes.
|
|
92
|
+
return (jsx(PageContent, { onBack: null, header: locales.profileScreen_heading, children: jsx(ConnectedPageLayout, { address: address !== null && address !== void 0 ? address : '', displayName: jsx(CopyText, { value: address !== null && address !== void 0 ? address : '', children: truncateSolanaAddress(address !== null && address !== void 0 ? address : '', separator) }), avatar: avatar, balance: balanceNode, actions: jsx(ActionButton, { icon: jsx(ReceiveIcon, {}), onClick: () => context.setRoute(routes.SOL_RECEIVE), children: "Get" }), hideBalance: context === null || context === void 0 ? void 0 : context.uiConfig.hideBalance, isBalanceLoading: isBalanceLoading, isAddressLoading: isAddressLoading, noWalletFallback: hasSolanaWallets ? (jsx(Button, { onClick: () => setRoute(routes.SELECT_WALLET_TO_RECOVER), children: "Manage wallets" })) : (jsx(Button, { onClick: () => setRoute(routes.SOL_CREATE_WALLET), children: "Create Solana Wallet" })) }) }));
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
export { SolanaConnected as default };
|
|
@@ -1,64 +1,10 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
3
|
-
import { useEthereumBridge } from '../../../ethereum/OpenfortEthereumBridgeContext.js';
|
|
4
|
-
import useIsMobile from '../../../hooks/useIsMobile.js';
|
|
5
|
-
import { useWalletConnectModal } from '../../../hooks/useWalletConnectModal.js';
|
|
6
2
|
import { logger } from '../../../utils/logger.js';
|
|
7
3
|
import ConnectorList from '../../Common/ConnectorList/index.js';
|
|
8
|
-
import Loader from '../../Common/Loading/index.js';
|
|
9
|
-
import { routes } from '../../Openfort/types.js';
|
|
10
|
-
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
11
4
|
import { PageContent } from '../../PageContent/index.js';
|
|
12
5
|
|
|
13
6
|
let hasWarnedConnectors = false;
|
|
14
|
-
const ConnectWithMobile = () => {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
const { open: openWalletConnectModal } = useWalletConnectModal();
|
|
17
|
-
const [error, setError] = useState(undefined);
|
|
18
|
-
const bridge = useEthereumBridge();
|
|
19
|
-
const connector = (_a = bridge === null || bridge === void 0 ? void 0 : bridge.account) === null || _a === void 0 ? void 0 : _a.connector;
|
|
20
|
-
const address = (_b = bridge === null || bridge === void 0 ? void 0 : bridge.account) === null || _b === void 0 ? void 0 : _b.address;
|
|
21
|
-
const { setRoute, setConnector } = useOpenfort();
|
|
22
|
-
const openWCModal = async () => {
|
|
23
|
-
setError(undefined);
|
|
24
|
-
const { error } = await openWalletConnectModal();
|
|
25
|
-
if (error) {
|
|
26
|
-
setError(error);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
openWCModal();
|
|
31
|
-
}, []);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (connector && address) {
|
|
34
|
-
const walletConnectDeeplinkChoice = localStorage.getItem('WALLETCONNECT_DEEPLINK_CHOICE');
|
|
35
|
-
if (walletConnectDeeplinkChoice) {
|
|
36
|
-
try {
|
|
37
|
-
const parsedChoice = JSON.parse(walletConnectDeeplinkChoice);
|
|
38
|
-
if (parsedChoice &&
|
|
39
|
-
typeof parsedChoice === 'object' &&
|
|
40
|
-
'name' in parsedChoice &&
|
|
41
|
-
typeof parsedChoice.name === 'string') {
|
|
42
|
-
setConnector({ id: parsedChoice.name });
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
setConnector({ id: connector.id });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
setConnector({ id: connector.id });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
setConnector({ id: connector.id });
|
|
54
|
-
}
|
|
55
|
-
setRoute(routes.CONNECT_WITH_MOBILE);
|
|
56
|
-
}
|
|
57
|
-
}, [address, connector]);
|
|
58
|
-
return (jsx(Loader, { header: error ? 'Error connecting wallet.' : `Connecting...`, isError: !!error, description: error, onRetry: () => openWCModal() }));
|
|
59
|
-
};
|
|
60
7
|
const Connectors = ({ logoutOnBack }) => {
|
|
61
|
-
const isMobile = useIsMobile();
|
|
62
8
|
// Runtime deprecation warning
|
|
63
9
|
if (process.env.NODE_ENV === 'development' && !hasWarnedConnectors) {
|
|
64
10
|
logger.warn('[@openfort/react] <Connectors /> is deprecated and will be moved to @openfort/react/wagmi in v3.0.\n' +
|
|
@@ -66,7 +12,7 @@ const Connectors = ({ logoutOnBack }) => {
|
|
|
66
12
|
'See: https://openfort.io/docs/migration/external-wallets');
|
|
67
13
|
hasWarnedConnectors = true;
|
|
68
14
|
}
|
|
69
|
-
return (jsx(PageContent, { logoutOnBack: logoutOnBack, width: 312, children:
|
|
15
|
+
return (jsx(PageContent, { logoutOnBack: logoutOnBack, width: 312, children: jsx(ConnectorList, {}) }));
|
|
70
16
|
};
|
|
71
17
|
|
|
72
18
|
export { Connectors as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useMemo } from 'react';
|
|
2
|
+
import { useRef, useMemo } from 'react';
|
|
3
3
|
import { useUser } from '../../../hooks/openfort/useUser.js';
|
|
4
4
|
import { useResolvedIdentity } from '../../../hooks/useResolvedIdentity.js';
|
|
5
5
|
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
@@ -65,11 +65,14 @@ const OAuthContent = ({ account }) => {
|
|
|
65
65
|
};
|
|
66
66
|
const LinkedProvider = () => {
|
|
67
67
|
const { route } = useOpenfort();
|
|
68
|
+
const lastAccountRef = useRef(null);
|
|
68
69
|
const account = useMemo(() => {
|
|
69
70
|
if (route.route === 'linkedProvider') {
|
|
71
|
+
lastAccountRef.current = route.account;
|
|
70
72
|
return route.account;
|
|
71
73
|
}
|
|
72
|
-
|
|
74
|
+
// During exit animations or route transitions, return the last known account
|
|
75
|
+
return lastAccountRef.current;
|
|
73
76
|
}, [route]);
|
|
74
77
|
const getProviderDetails = (account) => {
|
|
75
78
|
switch (account.provider) {
|
|
@@ -83,6 +86,8 @@ const LinkedProvider = () => {
|
|
|
83
86
|
return (jsxs("div", { style: { marginTop: '16px', display: 'flex', alignItems: 'center', gap: '8px', flexDirection: 'column' }, children: [jsxs("div", { children: ["Authentication method: ", jsx("b", { children: getProviderName(account.provider) })] }), jsx(FitText, { children: jsx(ProviderHeader, { account: account }) })] }));
|
|
84
87
|
}
|
|
85
88
|
};
|
|
89
|
+
if (!account)
|
|
90
|
+
return null;
|
|
86
91
|
return (jsxs(PageContent, { children: [jsx(ModalHeading, { children: getProviderName(account.provider) }), jsxs(ModalContent, { style: { paddingBottom: 0 }, children: [jsx(ProviderIconContainer, { children: jsx(ProviderIconWrapper, { children: jsx(ProviderIconInner, { children: jsx(ProviderIcon, { account: account }) }) }) }), jsx(ModalBody, { children: getProviderDetails(account) })] })] }));
|
|
87
92
|
};
|
|
88
93
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
2
|
+
import { ChainTypeEnum, RecoveryMethod } from '@openfort/openfort-js';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import { useEthereumEmbeddedWallet } from '../../../ethereum/hooks/useEthereumEmbeddedWallet.js';
|
|
5
5
|
import { toSolanaUserWallet } from '../../../hooks/openfort/walletTypes.js';
|
|
@@ -7,20 +7,24 @@ import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
|
7
7
|
import { useSolanaEmbeddedWallet } from '../../../solana/hooks/useSolanaEmbeddedWallet.js';
|
|
8
8
|
import { logger } from '../../../utils/logger.js';
|
|
9
9
|
import Loader from '../../Common/Loading/index.js';
|
|
10
|
-
import {
|
|
10
|
+
import { createRoute, recoverRoute } from '../../Openfort/routeHelpers.js';
|
|
11
11
|
import { routes } from '../../Openfort/types.js';
|
|
12
12
|
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
13
13
|
import { PageContent } from '../../PageContent/index.js';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
15
|
+
/** Pick the best wallet to auto-recover: automatic > passkey > first available */
|
|
16
|
+
function pickBestWallet(wallets) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
return ((_b = (_a = wallets.find((w) => w.recoveryMethod === RecoveryMethod.AUTOMATIC)) !== null && _a !== void 0 ? _a : wallets.find((w) => w.recoveryMethod === RecoveryMethod.PASSKEY)) !== null && _b !== void 0 ? _b : wallets[0]);
|
|
19
|
+
}
|
|
20
|
+
function routeToRecover(wallet, chainType, setRoute) {
|
|
21
|
+
if (chainType === ChainTypeEnum.SVM) {
|
|
22
|
+
setRoute(recoverRoute(chainType, toSolanaUserWallet(wallet)));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
setRoute(recoverRoute(chainType, wallet));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
24
28
|
const errorForChainRegistry = {
|
|
25
29
|
[ChainTypeEnum.SVM]: () => ({ isError: false, message: undefined }),
|
|
26
30
|
[ChainTypeEnum.EVM]: (errorWallets) => ({
|
|
@@ -29,11 +33,13 @@ const errorForChainRegistry = {
|
|
|
29
33
|
}),
|
|
30
34
|
};
|
|
31
35
|
const LoadWallets = () => {
|
|
36
|
+
var _a;
|
|
32
37
|
const { chainType, user, isLoadingAccounts } = useOpenfortCore();
|
|
33
38
|
const { triggerResize, setRoute, setConnector, walletConfig } = useOpenfort();
|
|
34
39
|
const ethereumWallet = useEthereumEmbeddedWallet();
|
|
35
40
|
const solanaWallet = useSolanaEmbeddedWallet();
|
|
36
41
|
const embeddedWallet = chainType === ChainTypeEnum.EVM ? ethereumWallet : solanaWallet;
|
|
42
|
+
const connectOnLogin = (_a = walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.connectOnLogin) !== null && _a !== void 0 ? _a : true;
|
|
37
43
|
const [loadingUX, setLoadingUX] = useState(true);
|
|
38
44
|
const wallets = embeddedWallet.wallets;
|
|
39
45
|
const isLoadingWallets = embeddedWallet.status === 'fetching-wallets' ||
|
|
@@ -63,31 +69,32 @@ const LoadWallets = () => {
|
|
|
63
69
|
return;
|
|
64
70
|
}
|
|
65
71
|
logger.log('User wallets loaded:', wallets.length);
|
|
72
|
+
// No wallets → create one
|
|
66
73
|
if (wallets.length === 0) {
|
|
67
|
-
// Always show the create wallet page when no wallets exist.
|
|
68
|
-
// connectOnLogin only controls whether creation starts automatically
|
|
69
|
-
// (handled inside CreateWalletAutomaticRecovery), not whether the
|
|
70
|
-
// page is shown — routing to CONNECTED with 0 wallets would show a
|
|
71
|
-
// broken "Connect wallet" button aimed at external wagmi wallets.
|
|
72
74
|
setRoute(createRoute(chainType));
|
|
73
75
|
return;
|
|
74
76
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (alreadyActive) {
|
|
77
|
+
// If a wallet is already active and connected, go to connected (triggers auto-close)
|
|
78
|
+
if (embeddedWallet.status === 'connected' && embeddedWallet.address) {
|
|
79
|
+
const activeAddr = embeddedWallet.address;
|
|
80
|
+
const isActiveInList = wallets.some((w) => chainType === ChainTypeEnum.SVM
|
|
81
|
+
? w.address === activeAddr
|
|
82
|
+
: w.address.toLowerCase() === activeAddr.toLowerCase());
|
|
83
|
+
if (isActiveInList) {
|
|
83
84
|
setRoute(chainType === ChainTypeEnum.SVM ? routes.SOL_CONNECTED : routes.ETH_CONNECTED);
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
|
-
handleSingleWalletRegistry[chainType](single, chainType, setRoute, setConnector);
|
|
87
|
-
return;
|
|
88
87
|
}
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
if (connectOnLogin) {
|
|
89
|
+
// Auto-connect: pick the best wallet (automatic > passkey > password) and recover it
|
|
90
|
+
const best = pickBestWallet(wallets);
|
|
91
|
+
routeToRecover(best, chainType, setRoute);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// Not auto-connecting: close modal (go to connected page which triggers auto-close)
|
|
95
|
+
setRoute(chainType === ChainTypeEnum.SVM ? routes.SOL_CONNECTED : routes.ETH_CONNECTED);
|
|
96
|
+
}
|
|
97
|
+
}, [loadingUX, isLoadingWallets, wallets, user, chainType, setRoute, setConnector, walletConfig, connectOnLogin]);
|
|
91
98
|
const { isError: isErrorFromChain, message: errorMessageFromChain } = errorForChainRegistry[chainType](errorWallets);
|
|
92
99
|
const isError = !user || isErrorFromChain;
|
|
93
100
|
const errorMessage = !user ? undefined : errorMessageFromChain;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -32,7 +32,7 @@ const RemoveLinkedProvider = () => {
|
|
|
32
32
|
if (route.route === 'removeLinkedProvider') {
|
|
33
33
|
return route.account;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
return null;
|
|
36
36
|
}, [route]);
|
|
37
37
|
useEffect(() => {
|
|
38
38
|
if (error)
|
|
@@ -60,6 +60,8 @@ const RemoveLinkedProvider = () => {
|
|
|
60
60
|
}, [isSuccess]);
|
|
61
61
|
const handleRemove = async () => {
|
|
62
62
|
var _a;
|
|
63
|
+
if (!provider)
|
|
64
|
+
return;
|
|
63
65
|
const errorMsg = 'Failed to remove linked provider. Please try again.';
|
|
64
66
|
if (provider.provider === 'siwe' || provider.provider === 'wallet') {
|
|
65
67
|
try {
|
|
@@ -97,6 +99,8 @@ const RemoveLinkedProvider = () => {
|
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
};
|
|
102
|
+
if (!provider)
|
|
103
|
+
return null;
|
|
100
104
|
return (jsxs(PageContent, { children: [jsxs(ModalHeading, { children: ["Remove ", getProviderName(provider.provider)] }), jsxs(ModalContent, { style: { paddingBottom: 0 }, children: [jsx(ProviderIconContainer, { style: { marginBottom: '16px' }, children: jsx(ProviderIconWrapper, { children: jsx(ProviderIconInner, { children: jsx(ProviderIcon, { account: provider }) }) }) }), isSuccess ? (jsxs(Fragment, { children: [jsx(ModalH1, { "$valid": true, children: "Success" }), jsxs(ModalBody, { children: ["Successfully removed", ' ', provider.provider === 'siwe' ? (jsxs("span", { children: [jsx("b", { children: jsx(WalletDisplay, { walletAddress: provider.accountId }) }), "."] })) : (jsxs(Fragment, { children: [jsx("b", { children: getProviderName(provider.provider) }), " as an authentication method."] }))] }), jsx(ButtonWrapper, { style: { marginTop: 0 }, children: jsx(Button, { onClick: () => onBack === null || onBack === void 0 ? void 0 : onBack(), children: "Back" }) })] })) : (jsxs(Fragment, { children: [jsxs("p", { children: ["Are you sure you want to remove", ' ', provider.provider === 'siwe' ? (jsxs(CopyText, { value: provider.accountId, children: [jsx("b", { children: jsx(WalletDisplay, { walletAddress: provider.accountId }) }), "?"] })) : (jsxs(Fragment, { children: [jsx("b", { children: getProviderName(provider.provider) }), "as an authentication method?"] }))] }), error && jsx(ErrorMessage, { children: error }), jsxs(ButtonWrapper, { style: { marginTop: 0 }, children: [jsx(Button, { onClick: () => onBack === null || onBack === void 0 ? void 0 : onBack(), children: "Cancel" }), jsx(Button, { onClick: handleRemove, children: "Remove" })] })] }))] })] }));
|
|
101
105
|
};
|
|
102
106
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|