@getpara/react-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/modal/ParaModal.d.ts +2 -0
- package/dist/modal/ParaModal.js +250 -0
- package/dist/modal/components/Account/Account.d.ts +5 -0
- package/dist/modal/components/Account/Account.js +59 -0
- package/dist/modal/components/AddFunds/AddFunds.d.ts +3 -0
- package/dist/modal/components/AddFunds/AddFunds.js +146 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +64 -0
- package/dist/modal/components/AddFunds/AddFundsDone.d.ts +6 -0
- package/dist/modal/components/AddFunds/AddFundsDone.js +26 -0
- package/dist/modal/components/AddFunds/MoonPayEmbed.d.ts +2 -0
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +2 -0
- package/dist/modal/components/AddFunds/index.d.ts +3 -0
- package/dist/modal/components/AddFunds/index.js +3 -0
- package/dist/modal/components/AuthInput/AuthInput.d.ts +6 -0
- package/dist/modal/components/AuthInput/AuthInput.js +214 -0
- package/dist/modal/components/AuthInput/countryCodes.d.ts +8 -0
- package/dist/modal/components/AuthInput/countryCodes.js +40 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +7 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +23 -0
- package/dist/modal/components/AuthInput/phoneMasks.d.ts +247 -0
- package/dist/modal/components/AuthInput/phoneMasks.js +247 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +8 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +21 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +8 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +89 -0
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +8 -0
- package/dist/modal/components/AuthOptions/AuthOptions.js +28 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.d.ts +1 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +7 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.d.ts +1 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +5 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.d.ts +1 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +7 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +1 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +18 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +4 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +17 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +127 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +6 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +26 -0
- package/dist/modal/components/Body/Body.d.ts +12 -0
- package/dist/modal/components/Body/Body.js +232 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +77 -0
- package/dist/modal/components/ChainSwitch/config.d.ts +7 -0
- package/dist/modal/components/ChainSwitch/config.js +11 -0
- package/dist/modal/components/Controls/Controls.d.ts +5 -0
- package/dist/modal/components/Controls/Controls.js +54 -0
- package/dist/modal/components/Controls/Selects.d.ts +2 -0
- package/dist/modal/components/Controls/Selects.js +157 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +116 -0
- package/dist/modal/components/ExternalWalletStep/config.d.ts +7 -0
- package/dist/modal/components/ExternalWalletStep/config.js +11 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +1 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +142 -0
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +7 -0
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +118 -0
- package/dist/modal/components/Footer/Footer.d.ts +1 -0
- package/dist/modal/components/Footer/Footer.js +71 -0
- package/dist/modal/components/Header/Header.d.ts +1 -0
- package/dist/modal/components/Header/Header.js +24 -0
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +3 -0
- package/dist/modal/components/Header/hooks/useStepTitle.js +42 -0
- package/dist/modal/components/Hero/Hero.d.ts +1 -0
- package/dist/modal/components/Hero/Hero.js +118 -0
- package/dist/modal/components/IFrameStep/IFrameStep.d.ts +1 -0
- package/dist/modal/components/IFrameStep/IFrameStep.js +41 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +1 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +18 -0
- package/dist/modal/components/ModalContent/ModalContent.d.ts +10 -0
- package/dist/modal/components/ModalContent/ModalContent.js +276 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +2 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +81 -0
- package/dist/modal/components/OAuth/OAuth.d.ts +6 -0
- package/dist/modal/components/OAuth/OAuth.js +124 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +1 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +132 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.d.ts +1 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.js +10 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.d.ts +9 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +72 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.d.ts +6 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +67 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.d.ts +5 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +104 -0
- package/dist/modal/components/StripeComponents/StripeComponents.d.ts +16 -0
- package/dist/modal/components/StripeComponents/StripeComponents.js +78 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +5 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +8 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +1 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +130 -0
- package/dist/modal/components/Waiting/Waiting.d.ts +6 -0
- package/dist/modal/components/Waiting/Waiting.js +6 -0
- package/dist/modal/components/WalletCard/PartnerIcon.d.ts +6 -0
- package/dist/modal/components/WalletCard/PartnerIcon.js +29 -0
- package/dist/modal/components/WalletCard/WalletCard.d.ts +18 -0
- package/dist/modal/components/WalletCard/WalletCard.js +91 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.d.ts +6 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +49 -0
- package/dist/modal/components/common.d.ts +19 -0
- package/dist/modal/components/common.js +67 -0
- package/dist/modal/components/index.d.ts +1 -0
- package/dist/modal/components/index.js +1 -0
- package/dist/modal/constants/constants.d.ts +32 -0
- package/dist/modal/constants/constants.js +93 -0
- package/dist/modal/constants/defaults.d.ts +5 -0
- package/dist/modal/constants/defaults.js +5 -0
- package/dist/modal/constants/oAuthLogos.d.ts +8 -0
- package/dist/modal/constants/oAuthLogos.js +18 -0
- package/dist/modal/css/modal.css +13 -0
- package/dist/modal/hooks/useActiveWallet.d.ts +1 -0
- package/dist/modal/hooks/useActiveWallet.js +9 -0
- package/dist/modal/hooks/useEmbeddedExternalConnection.d.ts +1 -0
- package/dist/modal/hooks/useEmbeddedExternalConnection.js +46 -0
- package/dist/modal/hooks/useGoBack.d.ts +1 -0
- package/dist/modal/hooks/useGoBack.js +34 -0
- package/dist/modal/index.d.ts +10 -0
- package/dist/modal/index.js +9 -0
- package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +29 -0
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +18 -0
- package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +33 -0
- package/dist/modal/providers/EvmExternalWalletContextStub.js +22 -0
- package/dist/modal/providers/ExternalWalletContext.d.ts +75 -0
- package/dist/modal/providers/ExternalWalletContext.js +252 -0
- package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +21 -0
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +12 -0
- package/dist/modal/public/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/dist/modal/stores/externalWalletProvider/actions.d.ts +3 -0
- package/dist/modal/stores/externalWalletProvider/actions.js +5 -0
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +20 -0
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +13 -0
- package/dist/modal/stores/index.d.ts +4 -0
- package/dist/modal/stores/index.js +4 -0
- package/dist/modal/stores/modal/actions.d.ts +3 -0
- package/dist/modal/stores/modal/actions.js +65 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +82 -0
- package/dist/modal/stores/modal/useModalStore.js +41 -0
- package/dist/modal/stores/para/actions.d.ts +3 -0
- package/dist/modal/stores/para/actions.js +5 -0
- package/dist/modal/stores/para/useParaStore.d.ts +10 -0
- package/dist/modal/stores/para/useParaStore.js +3 -0
- package/dist/modal/stores/theme/actions.d.ts +3 -0
- package/dist/modal/stores/theme/actions.js +24 -0
- package/dist/modal/stores/theme/useThemeStore.d.ts +20 -0
- package/dist/modal/stores/theme/useThemeStore.js +14 -0
- package/dist/modal/stores/userInfo/actions.d.ts +3 -0
- package/dist/modal/stores/userInfo/actions.js +28 -0
- package/dist/modal/stores/userInfo/useUserInfoStore.d.ts +19 -0
- package/dist/modal/stores/userInfo/useUserInfoStore.js +9 -0
- package/dist/modal/types/commonTypes.d.ts +48 -0
- package/dist/modal/types/commonTypes.js +1 -0
- package/dist/modal/types/externalWallets.d.ts +31 -0
- package/dist/modal/types/externalWallets.js +21 -0
- package/dist/modal/types/modalProps.d.ts +138 -0
- package/dist/modal/types/modalProps.js +7 -0
- package/dist/modal/utils/authLayoutHelpers.d.ts +3 -0
- package/dist/modal/utils/authLayoutHelpers.js +2 -0
- package/dist/modal/utils/getMailtoLink.d.ts +1 -0
- package/dist/modal/utils/getMailtoLink.js +5 -0
- package/dist/modal/utils/getTileButtonFlex.d.ts +1 -0
- package/dist/modal/utils/getTileButtonFlex.js +15 -0
- package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
- package/dist/modal/utils/isPasskeySupported.js +10 -0
- package/dist/modal/utils/openPopup.d.ts +1 -0
- package/dist/modal/utils/openPopup.js +55 -0
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +1 -0
- package/dist/modal/utils/routeMobileExternalWallet.js +35 -0
- package/dist/modal/utils/steps.d.ts +112 -0
- package/dist/modal/utils/steps.js +215 -0
- package/dist/modal/utils/stringFormatters.d.ts +4 -0
- package/dist/modal/utils/stringFormatters.js +12 -0
- package/dist/modal/utils/validateOnRampConfig.d.ts +5 -0
- package/dist/modal/utils/validateOnRampConfig.js +26 -0
- package/package.json +51 -0
- package/styles.css/package.json +3 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from '@getpara/react-components';
|
|
12
|
+
import { CenteredText, InnerStepContainer, QRContainer, StepContainer } from '../common.js';
|
|
13
|
+
import { useEffect, useMemo } from 'react';
|
|
14
|
+
import { useModalStore } from '../../stores/index.js';
|
|
15
|
+
import styled from 'styled-components';
|
|
16
|
+
import { useExternalWallets } from '../../providers/ExternalWalletContext.js';
|
|
17
|
+
import { useCopyToClipboard } from '@getpara/react-common';
|
|
18
|
+
import { ModalStep } from '../../utils/steps.js';
|
|
19
|
+
import { isMobile, isTablet, WalletType } from '@getpara/web-sdk';
|
|
20
|
+
import { routeMobileExternalWallet } from '../../utils/routeMobileExternalWallet.js';
|
|
21
|
+
export const ExternalWalletStep = () => {
|
|
22
|
+
const [isCopied, copy] = useCopyToClipboard();
|
|
23
|
+
const externalWalletError = useModalStore(state => state.externalWalletError);
|
|
24
|
+
const setStep = useModalStore(state => state.setStep);
|
|
25
|
+
const { connectExternalWallet, wallet, qrUri, walletDisplayHelpers } = useExternalWallets();
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
routeMobileExternalWallet(qrUri);
|
|
28
|
+
}, [qrUri]);
|
|
29
|
+
const handleTryAgainClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
yield connectExternalWallet(wallet);
|
|
31
|
+
});
|
|
32
|
+
const handleCopy = () => {
|
|
33
|
+
copy(qrUri);
|
|
34
|
+
};
|
|
35
|
+
const Content = useMemo(() => {
|
|
36
|
+
var _a, _b, _c;
|
|
37
|
+
if (!wallet) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const isWalletConnect = wallet.id === 'walletConnect';
|
|
41
|
+
const isMobileWalletConnect = isMobile() && isWalletConnect;
|
|
42
|
+
if (isMobileWalletConnect) {
|
|
43
|
+
_jsx(InnerStepContainer, { children: _jsx(Text, { weight: "semiBold", children: "Continue in the WalletConnect modal." }) });
|
|
44
|
+
}
|
|
45
|
+
const { showExtension, showMobile, isSolanaMobileIOS } = walletDisplayHelpers;
|
|
46
|
+
// Fallback to not supported text
|
|
47
|
+
if ((!showMobile && !showExtension) || (isSolanaMobileIOS && !wallet.installed)) {
|
|
48
|
+
const text = isSolanaMobileIOS
|
|
49
|
+
? "Solana wallets aren't available on mobile IOS browsers.\n\nPlease continue in the wallet app."
|
|
50
|
+
: `${wallet.name} isn't supported on mobile devices.\n\nPlease choose another wallet or continue on desktop.`;
|
|
51
|
+
return (_jsx(InnerStepContainer, { children: _jsx(Text, { weight: "semiBold", children: text }) }));
|
|
52
|
+
}
|
|
53
|
+
if (showExtension) {
|
|
54
|
+
const isInstalled = wallet.installed;
|
|
55
|
+
return (_jsxs(InnerStepContainer, { children: [isInstalled && !(externalWalletError === null || externalWalletError === void 0 ? void 0 : externalWalletError.length) ? (_jsx(CenteredText, { color: "contrast", weight: "semiBold", children: `Confirm connection request in the ${wallet.name} browser extension.` })) : (_jsxs(ErrorContainer, { children: [_jsx(ErrorIcon, { icon: "alertCircle" }), _jsx(CpslText, { weight: "semiBold", color: "error", children: isInstalled ? externalWalletError === null || externalWalletError === void 0 ? void 0 : externalWalletError[0] : `${wallet.name} not detected` })] })), _jsxs(CpslButton, { as: isInstalled ? 'button' : 'a', href: (_a = wallet.downloadUrl) !== null && _a !== void 0 ? _a : '', target: "_blank", variant: "secondary", onClick: handleTryAgainClick, children: [_jsx(CpslIcon, { slot: "start", icon: isInstalled ? 'refresh' : 'linkExternal' }), isInstalled ? 'Try Again' : `Get ${wallet.name}`] })] }));
|
|
56
|
+
}
|
|
57
|
+
if (showMobile) {
|
|
58
|
+
// If Solana wallet or if on a mobile and NOT on a table, show the connection screen. Else show the QR code.
|
|
59
|
+
if (wallet.type === WalletType.SOLANA || (isMobile() && !isTablet())) {
|
|
60
|
+
// Checking if the wallet is installed only for Solana wallets since Solana MWA doesn't work on IOS Safari
|
|
61
|
+
// https://docs.solanamobile.com/web/developing-for-web#ios-web
|
|
62
|
+
const isInstalled = wallet.type !== WalletType.SOLANA || wallet.installed;
|
|
63
|
+
return (_jsxs(_Fragment, { children: [_jsx(InnerStepContainer, { children: !isInstalled && (_jsx(CpslText, { weight: "semiBold", color: "error", children: `${wallet.name} not detected` })) }), wallet.id !== 'walletConnect' && (_jsxs(InnerStepContainer, { children: [_jsx(CpslButton, { onClick: () => routeMobileExternalWallet(qrUri), fullWidth: true, children: "Connect Wallet" }), _jsx(Link, { href: (_b = wallet.downloadUrl) !== null && _b !== void 0 ? _b : '', target: "_blank", children: _jsxs(ExternalButton, { variant: "secondary", children: [`Get ${wallet.name}`, _jsx(ExternalIcon, { icon: "linkExternal" })] }) })] }))] }));
|
|
64
|
+
}
|
|
65
|
+
const openWCModal = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
yield connectExternalWallet(wallet, true, true);
|
|
67
|
+
});
|
|
68
|
+
const GetWalletButton = (_jsxs(ExternalButton, { variant: "secondary", onClick: isWalletConnect ? openWCModal : undefined, children: [`${isWalletConnect ? 'Open' : 'Get'} ${wallet.name}`, _jsx(ExternalIcon, { icon: "linkExternal" })] }));
|
|
69
|
+
return (_jsxs(_Fragment, { children: [_jsxs(InnerStepContainer, { children: [_jsx(CpslText, { weight: "semiBold", children: "Scan with your mobile device" }), _jsx(QRContainer, { children: !qrUri ? _jsx(CpslSpinner, { size: 100 }) : _jsx(CpslQrCode, { url: qrUri, imageSrc: wallet.iconUrl }) }), _jsxs(CpslButton, { size: "small", variant: "ghost", onClick: handleCopy, children: [_jsx(CpslIcon, { slot: "start", icon: isCopied ? 'check' : 'copy' }), isCopied ? 'Copied' : 'Copy Link'] })] }), _jsx(InnerStepContainer, { children: isWalletConnect ? (_jsx(_Fragment, { children: GetWalletButton })) : (_jsx(Link, { href: (_c = wallet.downloadUrl) !== null && _c !== void 0 ? _c : '', target: "_blank", children: GetWalletButton })) })] }));
|
|
70
|
+
}
|
|
71
|
+
}, [wallet, walletDisplayHelpers, externalWalletError, qrUri]);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!wallet) {
|
|
74
|
+
setStep(ModalStep.AUTH_MAIN);
|
|
75
|
+
}
|
|
76
|
+
}, [wallet]);
|
|
77
|
+
if (!wallet) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
return _jsx(Container, { children: Content });
|
|
81
|
+
};
|
|
82
|
+
const Container = styled(StepContainer) `
|
|
83
|
+
flex: 1;
|
|
84
|
+
justify-content: space-between;
|
|
85
|
+
`;
|
|
86
|
+
const ErrorContainer = styled.div `
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
gap: 4px;
|
|
91
|
+
`;
|
|
92
|
+
const ErrorIcon = styled(CpslIcon) `
|
|
93
|
+
--height: 16px;
|
|
94
|
+
--width: 16px;
|
|
95
|
+
--icon-color: var(--cpsl-color-text-error);
|
|
96
|
+
`;
|
|
97
|
+
const Text = styled(CenteredText) `
|
|
98
|
+
white-space: pre-line;
|
|
99
|
+
`;
|
|
100
|
+
const ExternalButton = styled(CpslButton) `
|
|
101
|
+
display: flex;
|
|
102
|
+
gap: 8px;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
width: 100%;
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
margin-top: 8px;
|
|
108
|
+
text-decoration: none;
|
|
109
|
+
`;
|
|
110
|
+
const ExternalIcon = styled(CpslIcon) `
|
|
111
|
+
--height: 20px;
|
|
112
|
+
--width: 20px;
|
|
113
|
+
`;
|
|
114
|
+
const Link = styled.a `
|
|
115
|
+
text-decoration: none;
|
|
116
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var TabValue;
|
|
2
|
+
(function (TabValue) {
|
|
3
|
+
TabValue["extension"] = "extension";
|
|
4
|
+
TabValue["mobile"] = "mobile";
|
|
5
|
+
TabValue["web"] = "web";
|
|
6
|
+
})(TabValue || (TabValue = {}));
|
|
7
|
+
export const TABS = {
|
|
8
|
+
extension: { label: 'Extension', value: TabValue.extension, icon: 'puzzlePiece' },
|
|
9
|
+
mobile: { label: 'Mobile', value: TabValue.mobile, icon: 'phone' },
|
|
10
|
+
web: { label: 'Web', value: TabValue.web, icon: 'globe' },
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ExternalWallets: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
import styled from 'styled-components';
|
|
12
|
+
import { useExternalWallets } from '../../providers/ExternalWalletContext.js';
|
|
13
|
+
import { StyledCpslTileButton } from '../common.js';
|
|
14
|
+
import { CpslButton, CpslIcon, CpslInput, CpslText } from '@getpara/react-components';
|
|
15
|
+
import { useModalStore, useThemeStore } from '../../stores/index.js';
|
|
16
|
+
import { ModalStep } from '../../utils/steps.js';
|
|
17
|
+
import { useState } from 'react';
|
|
18
|
+
import { hasEmbeddedAuth } from '../../utils/authLayoutHelpers.js';
|
|
19
|
+
const HAS_MORE_LENGTH = 3;
|
|
20
|
+
export const ExternalWallets = () => {
|
|
21
|
+
const { wallets, connectExternalWallet } = useExternalWallets();
|
|
22
|
+
const setSelectedExternalWalletId = useModalStore(state => state.setSelectedExternalWalletId);
|
|
23
|
+
const setStep = useModalStore(state => state.setStep);
|
|
24
|
+
const showAll = useModalStore(state => state.step === ModalStep.EX_WALLET_MORE);
|
|
25
|
+
const authLayout = useThemeStore(state => state.authLayout);
|
|
26
|
+
const [search, setSearch] = useState('');
|
|
27
|
+
const hasMore = wallets.length > HAS_MORE_LENGTH;
|
|
28
|
+
const walletsToShow = showAll || !hasMore
|
|
29
|
+
? search
|
|
30
|
+
? wallets.filter(w => w.name.toLowerCase().includes(search.toLowerCase()))
|
|
31
|
+
: wallets
|
|
32
|
+
: wallets.slice(0, HAS_MORE_LENGTH);
|
|
33
|
+
const showMoreButton = !showAll && hasMore;
|
|
34
|
+
const handleShowAll = () => {
|
|
35
|
+
setStep(ModalStep.EX_WALLET_MORE);
|
|
36
|
+
};
|
|
37
|
+
const handleParaClick = () => {
|
|
38
|
+
setStep(ModalStep.AUTH_MORE);
|
|
39
|
+
};
|
|
40
|
+
const handleWalletClick = (wallet) => () => {
|
|
41
|
+
setSelectedExternalWalletId(wallet.id);
|
|
42
|
+
setStep(ModalStep.EX_WALLET_SELECTED);
|
|
43
|
+
if (wallet.installed) {
|
|
44
|
+
connectExternalWallet(wallet);
|
|
45
|
+
}
|
|
46
|
+
else if (wallet.isMobile) {
|
|
47
|
+
connectExternalWallet(wallet, true);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
return (_jsxs(Container, { "$maxHeight": showAll, children: [showAll && (_jsxs(_Fragment, { children: [_jsx(SearchInputWrapper, { children: _jsx(SearchInput, { placeholder: "Search for your wallet", onCpslInput: (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
setSearch(e.target.value);
|
|
52
|
+
}), value: search, style: { width: '100%' }, children: _jsx(SearchIcon, { slot: "start", icon: "search" }) }) }), hasEmbeddedAuth(authLayout) && (_jsx(CpslButton, { fullWidth: true, variant: "tertiary", onClick: handleParaClick, children: _jsxs(WalletButtonOuterContainer, { children: [_jsxs(WalletButtonInnerContainer, { children: [_jsx(CpslIcon, { slot: "start", icon: "paraIcon" }), _jsx(CpslText, { weight: "medium", children: "Para" })] }), _jsx(Badge, { "$show": true, "$variant": "installed", children: _jsx(CpslText, { variant: "body2XS", weight: "medium", children: "Available" }) })] }) }))] })), walletsToShow.map(wallet => showAll ? (_jsx(CpslButton, { fullWidth: true, variant: "tertiary", onClick: handleWalletClick(wallet), children: _jsxs(WalletButtonOuterContainer, { children: [_jsxs(WalletButtonInnerContainer, { children: [_jsx(CpslIcon, { slot: "start", src: wallet.iconUrl }), _jsx(CpslText, { weight: "medium", children: wallet.name })] }), _jsx(Badge, { "$show": wallet.isMobile || wallet.installed, "$variant": wallet.installed ? 'installed' : 'mobile', children: _jsx(CpslText, { variant: "body2XS", weight: "medium", children: wallet.installed ? 'Installed' : 'Mobile' }) })] }) }, wallet.id)) : (_jsx(WalletTileButton, { src: wallet.iconUrl, onClick: handleWalletClick(wallet), children: _jsxs(TileButtonInnerContainer, { children: [wallet.installed && _jsx(InstalledIndicator, {}), _jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: wallet.name })] }) }, wallet.id))), showMoreButton && (_jsxs(CpslButton, { variant: "tertiary", fullWidth: true, onClick: handleShowAll, children: [_jsx(CpslIcon, { slot: "start", icon: "wallet" }), "More Wallets"] })), showAll && _jsx(BlurContainer, {})] }));
|
|
53
|
+
};
|
|
54
|
+
const Container = styled.div `
|
|
55
|
+
position: relative;
|
|
56
|
+
display: flex;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
gap: 8px;
|
|
59
|
+
flex-wrap: wrap;
|
|
60
|
+
|
|
61
|
+
max-height: ${({ $maxHeight }) => ($maxHeight ? '348px' : 'none')};
|
|
62
|
+
overflow-y: auto;
|
|
63
|
+
|
|
64
|
+
&::-webkit-scrollbar {
|
|
65
|
+
display: none;
|
|
66
|
+
}
|
|
67
|
+
-ms-overflow-style: none;
|
|
68
|
+
scrollbar-width: none;
|
|
69
|
+
`;
|
|
70
|
+
const WalletTileButton = styled(StyledCpslTileButton) `
|
|
71
|
+
flex: 1;
|
|
72
|
+
`;
|
|
73
|
+
const WalletButtonOuterContainer = styled.div `
|
|
74
|
+
width: 100%;
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
gap: 8px;
|
|
78
|
+
justify-content: space-between;
|
|
79
|
+
`;
|
|
80
|
+
const WalletButtonInnerContainer = styled.div `
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
gap: 8px;
|
|
84
|
+
|
|
85
|
+
cpsl-icon {
|
|
86
|
+
--icon-color: var(--cpsl-color-contrast);
|
|
87
|
+
}
|
|
88
|
+
cpsl-text {
|
|
89
|
+
&::part(text-element) {
|
|
90
|
+
color: var(--cpsl-color-contrast);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
94
|
+
const Badge = styled.div `
|
|
95
|
+
visibility: ${({ $show }) => ($show ? 'visible' : 'hidden')};
|
|
96
|
+
padding: 2px 4px;
|
|
97
|
+
border-radius: 4px;
|
|
98
|
+
border: 1px solid;
|
|
99
|
+
border-color: ${({ $variant }) => $variant === 'installed' ? 'var(--cpsl-color-utility-green)' : 'var(--cpsl-color-text-primary)'};
|
|
100
|
+
cpsl-text {
|
|
101
|
+
&::part(text-element) {
|
|
102
|
+
color: ${({ $variant }) => $variant === 'installed' ? 'var(--cpsl-color-utility-green)' : 'var(--cpsl-color-text-primary)'};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
const InstalledIndicator = styled.span `
|
|
107
|
+
width: 8px;
|
|
108
|
+
height: 8px;
|
|
109
|
+
border-radius: 100%;
|
|
110
|
+
background-color: var(--cpsl-color-utility-green);
|
|
111
|
+
`;
|
|
112
|
+
const TileButtonInnerContainer = styled.div `
|
|
113
|
+
display: flex;
|
|
114
|
+
gap: 4px;
|
|
115
|
+
align-items: center;
|
|
116
|
+
`;
|
|
117
|
+
const SearchIcon = styled(CpslIcon) `
|
|
118
|
+
--icon-color: var(--cpsl-color-contrast);
|
|
119
|
+
`;
|
|
120
|
+
const SearchInputWrapper = styled.div `
|
|
121
|
+
width: 100%;
|
|
122
|
+
background-color: var(--cpsl-color-background-0);
|
|
123
|
+
|
|
124
|
+
position: sticky;
|
|
125
|
+
top: 0;
|
|
126
|
+
padding-bottom: 4px;
|
|
127
|
+
margin-bottom: -4px;
|
|
128
|
+
`;
|
|
129
|
+
const SearchInput = styled(CpslInput) `
|
|
130
|
+
width: 100%;
|
|
131
|
+
--container-background-color: var(--cpsl-color-background-8);
|
|
132
|
+
--input-background-color: var(--cpsl-color-background-8);
|
|
133
|
+
`;
|
|
134
|
+
const BlurContainer = styled.div `
|
|
135
|
+
position: sticky;
|
|
136
|
+
height: 56px;
|
|
137
|
+
width: 100%;
|
|
138
|
+
bottom: 0;
|
|
139
|
+
|
|
140
|
+
background: linear-gradient(0deg, var(--cpsl-color-background-0) 0%, rgba(234, 239, 211, 0) 100%);
|
|
141
|
+
pointer-events: none;
|
|
142
|
+
`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { TExternalWallet } from '../../types/externalWallets.js';
|
|
3
|
+
interface ExternalWalletsWrapperProps extends PropsWithChildren {
|
|
4
|
+
wallets?: TExternalWallet[];
|
|
5
|
+
}
|
|
6
|
+
export declare const ExternalWalletsWrapper: ({ children, wallets }: ExternalWalletsWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { useEffect, useState } from 'react';
|
|
12
|
+
import { ExternalWalletProvider } from '../../providers/ExternalWalletContext.js';
|
|
13
|
+
import { EvmExternalWalletContext, EvmExternalWalletProvider, } from '../../providers/EvmExternalWalletContextStub.js';
|
|
14
|
+
import { CosmosWallet, EvmWallet, SolanaWallet } from '../../types/externalWallets.js';
|
|
15
|
+
import { SolanaExternalWalletContext, SolanaExternalWalletProvider, } from '../../providers/SolanaExternalWalletContextStub.js';
|
|
16
|
+
import { CosmosExternalWalletContext, CosmosExternalWalletProvider, } from '../../providers/CosmosExternalWalletContextStub.js';
|
|
17
|
+
import { useParaStore, useModalStore, useUserInfoStore } from '../../stores/index.js';
|
|
18
|
+
import { useExternalWalletProviderStore } from '../../stores/externalWalletProvider/useExternalWalletProviderStore.js';
|
|
19
|
+
export const ExternalWalletsWrapper = ({ children, wallets }) => {
|
|
20
|
+
const para = useParaStore(state => state.para);
|
|
21
|
+
const resetModalState = useModalStore(state => state.resetState);
|
|
22
|
+
const resetUserInfoState = useUserInfoStore(state => state.resetState);
|
|
23
|
+
const StoredEvmProvider = useExternalWalletProviderStore(state => state.EvmProvider);
|
|
24
|
+
const storedEvmContext = useExternalWalletProviderStore(state => state.evmContext);
|
|
25
|
+
const StoredSolanaProvider = useExternalWalletProviderStore(state => state.SolanaProvider);
|
|
26
|
+
const storedSolanaContext = useExternalWalletProviderStore(state => state.solanaContext);
|
|
27
|
+
const StoredCosmosProvider = useExternalWalletProviderStore(state => state.CosmosProvider);
|
|
28
|
+
const storedCosmosContext = useExternalWalletProviderStore(state => state.cosmosContext);
|
|
29
|
+
// EVM
|
|
30
|
+
const [EvmProvider, setEvmProvider] = useState(null);
|
|
31
|
+
const [evmContext, setEvmContext] = useState(null);
|
|
32
|
+
// Solana
|
|
33
|
+
const [SolanaProvider, setSolanaProvider] = useState(null);
|
|
34
|
+
const [solanaContext, setSolanaContext] = useState(null);
|
|
35
|
+
// Cosmos
|
|
36
|
+
const [CosmosProvider, setCosmosProvider] = useState(null);
|
|
37
|
+
const [cosmosContext, setCosmosContext] = useState(null);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const loadProviders = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
let newEvmContext = EvmExternalWalletContext;
|
|
41
|
+
let newEvmProvider = EvmExternalWalletProvider;
|
|
42
|
+
let newSolanaContext = SolanaExternalWalletContext;
|
|
43
|
+
let newSolanaProvider = SolanaExternalWalletProvider;
|
|
44
|
+
let newCosmosContext = CosmosExternalWalletContext;
|
|
45
|
+
let newCosmosProvider = CosmosExternalWalletProvider;
|
|
46
|
+
if (!(wallets === null || wallets === void 0 ? void 0 : wallets.length)) {
|
|
47
|
+
newEvmContext = EvmExternalWalletContext;
|
|
48
|
+
newEvmProvider = EvmExternalWalletProvider;
|
|
49
|
+
newSolanaContext = SolanaExternalWalletContext;
|
|
50
|
+
newSolanaProvider = SolanaExternalWalletProvider;
|
|
51
|
+
newCosmosContext = CosmosExternalWalletContext;
|
|
52
|
+
newCosmosProvider = CosmosExternalWalletProvider;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
for (let i = 0; i < wallets.length; i++) {
|
|
56
|
+
const wallet = wallets[i];
|
|
57
|
+
// Handle EVM Wallets
|
|
58
|
+
if (wallet in EvmWallet) {
|
|
59
|
+
if (!StoredEvmProvider || !storedEvmContext) {
|
|
60
|
+
throw new Error('@getpara/evm-wallet-connectors is required to use an external EVM wallet.');
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
newEvmContext = storedEvmContext;
|
|
64
|
+
newEvmProvider = StoredEvmProvider;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Handle Solana Wallets
|
|
68
|
+
if (wallet in SolanaWallet) {
|
|
69
|
+
if (!StoredSolanaProvider || !storedSolanaContext) {
|
|
70
|
+
throw new Error('@getpara/solana-wallet-connectors is required to use an external Solana wallet.');
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
newSolanaContext = storedSolanaContext;
|
|
74
|
+
newSolanaProvider = StoredSolanaProvider;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Handle Cosmos Wallets
|
|
78
|
+
if (wallet in CosmosWallet) {
|
|
79
|
+
if (!StoredCosmosProvider || !storedCosmosContext) {
|
|
80
|
+
throw new Error('@getpara/cosmos-wallet-connectors is required to use an external Cosmos wallet.');
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
newCosmosContext = storedCosmosContext;
|
|
84
|
+
newCosmosProvider = StoredCosmosProvider;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
setEvmContext(newEvmContext);
|
|
90
|
+
setEvmProvider(() => newEvmProvider);
|
|
91
|
+
setSolanaContext(newSolanaContext);
|
|
92
|
+
setSolanaProvider(() => newSolanaProvider);
|
|
93
|
+
setCosmosContext(newCosmosContext);
|
|
94
|
+
setCosmosProvider(() => newCosmosProvider);
|
|
95
|
+
});
|
|
96
|
+
loadProviders();
|
|
97
|
+
}, [
|
|
98
|
+
wallets,
|
|
99
|
+
storedEvmContext,
|
|
100
|
+
StoredEvmProvider,
|
|
101
|
+
storedSolanaContext,
|
|
102
|
+
StoredSolanaProvider,
|
|
103
|
+
storedCosmosContext,
|
|
104
|
+
StoredCosmosProvider,
|
|
105
|
+
]);
|
|
106
|
+
const handleSwitchWallet = ({ address, error }) => {
|
|
107
|
+
// If we error on switch wallets we logged out the Para instance so we need to reset the modal state
|
|
108
|
+
// Or if we don't return an address on switch wallets we logged out the Para instance so we need to reset the modal state
|
|
109
|
+
if (error || !address) {
|
|
110
|
+
resetModalState();
|
|
111
|
+
resetUserInfoState();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
if (!para || !EvmProvider || !SolanaProvider || !CosmosProvider) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
return (_jsx(EvmProvider, { para: para, onSwitchWallet: handleSwitchWallet, children: _jsx(SolanaProvider, { para: para, onSwitchWallet: handleSwitchWallet, children: _jsx(CosmosProvider, { para: para, onSwitchWallet: handleSwitchWallet, children: _jsx(ExternalWalletProvider, { evmContext: evmContext, solanaContext: solanaContext, cosmosContext: cosmosContext, walletSort: wallets, children: children }) }) }) }));
|
|
118
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Footer: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { styled } from 'styled-components';
|
|
3
|
+
import { CpslButton, CpslIcon, CpslText } from '@getpara/react-components';
|
|
4
|
+
import { useModalStore } from '../../stores/index.js';
|
|
5
|
+
import { PARA_CONNECT, PARA_TERMS_AND_CONDITIONS } from '../../constants/constants.js';
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
import { getStepHasFooter } from '../../utils/steps.js';
|
|
8
|
+
export const Footer = () => {
|
|
9
|
+
const isAccount = useModalStore(state => state.isAccount());
|
|
10
|
+
const currentStep = useModalStore(state => state.step);
|
|
11
|
+
const showFooter = isAccount || getStepHasFooter(currentStep);
|
|
12
|
+
const Content = useMemo(() => {
|
|
13
|
+
if (isAccount) {
|
|
14
|
+
return (_jsxs(ConnectContainer, { children: [_jsxs(ConnectText, { variant: "bodyS", color: "secondary", weight: "medium", children: ["Access all your wallet\u2019s features at", ' ', _jsx("a", { href: PARA_CONNECT, target: "blank", children: _jsx(ClickableText, { variant: "bodyS", weight: "medium", children: "Para Connect" }) })] }), _jsx(CpslButton, { as: "a", href: PARA_CONNECT, target: "blank", variant: "ghost", children: _jsx(RightChevron, { icon: "chevronUp" }) })] }));
|
|
15
|
+
}
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsxs(InlineText, { variant: "body2XS", color: "secondary", weight: "medium", children: ["By logging in you agree to our", ' ', _jsx("a", { href: PARA_TERMS_AND_CONDITIONS, target: "blank", children: _jsx(ClickableText, { variant: "body2XS", weight: "medium", children: "Terms & Conditions" }) })] }), _jsxs(PoweredByContainer, { children: [_jsx(InlineText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Powered by" }), _jsx(ParaLogo, { icon: "para" })] })] }));
|
|
17
|
+
}, [isAccount]);
|
|
18
|
+
if (!showFooter) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return (_jsx(FooterContainer, { slot: "footer", children: _jsx(FooterContentContainer, { children: Content }) }));
|
|
22
|
+
};
|
|
23
|
+
const FooterContainer = styled.div `
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: 16px;
|
|
28
|
+
padding: 8px 0px;
|
|
29
|
+
`;
|
|
30
|
+
const FooterContentContainer = styled.div `
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: 8px;
|
|
35
|
+
`;
|
|
36
|
+
const PoweredByContainer = styled.div `
|
|
37
|
+
display: flex;
|
|
38
|
+
gap: 5px;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
`;
|
|
42
|
+
const ConnectContainer = styled.div `
|
|
43
|
+
display: flex;
|
|
44
|
+
gap: 8px;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
`;
|
|
48
|
+
const RightChevron = styled(CpslIcon) `
|
|
49
|
+
transform: rotate(90deg);
|
|
50
|
+
|
|
51
|
+
/* --icon-color: var(--cpsl-color-text-tertiary); */
|
|
52
|
+
--height: 24px;
|
|
53
|
+
--width: 24px;
|
|
54
|
+
`;
|
|
55
|
+
const InlineText = styled(CpslText) `
|
|
56
|
+
text-align: center;
|
|
57
|
+
display: inline-block;
|
|
58
|
+
`;
|
|
59
|
+
const ConnectText = styled(InlineText) `
|
|
60
|
+
line-height: 20px;
|
|
61
|
+
`;
|
|
62
|
+
const ClickableText = styled(InlineText) `
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
display: inline-block;
|
|
65
|
+
`;
|
|
66
|
+
const ParaLogo = styled(CpslIcon) `
|
|
67
|
+
display: inline-block;
|
|
68
|
+
--icon-color: var(--cpsl-color-text-secondary);
|
|
69
|
+
--width: 49px;
|
|
70
|
+
--height: auto;
|
|
71
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Header: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { styled } from 'styled-components';
|
|
3
|
+
import { useStepTitle } from './hooks/useStepTitle.js';
|
|
4
|
+
import { CenteredText } from '../common.js';
|
|
5
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
6
|
+
import { useModalStore } from '../../stores/index.js';
|
|
7
|
+
import { BODY_MOTION_VARIANTS, BODY_TRANSITION } from '../../constants/constants.js';
|
|
8
|
+
export const Header = () => {
|
|
9
|
+
const { title } = useStepTitle();
|
|
10
|
+
const stepDirection = useModalStore(state => state.stepDirection);
|
|
11
|
+
const currentStep = useModalStore(state => state.step);
|
|
12
|
+
return (_jsx(AnimatePresence, { mode: "popLayout", initial: false, custom: stepDirection, children: _jsx(Container, { custom: stepDirection, variants: BODY_MOTION_VARIANTS, initial: "enter", animate: "center", exit: "exit", transition: BODY_TRANSITION, slot: "header", id: "header", children: _jsx(CenteredText, { weight: "semiBold", color: "secondary", children: title }) }, ['ADD_FUNDS_BUY', 'ADD_FUNDS_RECEIVE', 'ADD_FUNDS_WITHDRAW'].includes(currentStep) ? 'ADD_FUNDS' : currentStep) }));
|
|
13
|
+
};
|
|
14
|
+
const Container = styled(motion.div) `
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 16px;
|
|
17
|
+
width: 100%;
|
|
18
|
+
z-index: 2;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
gap: 8px;
|
|
23
|
+
flex-wrap: wrap;
|
|
24
|
+
`;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useModalStore } from '../../../stores/modal/useModalStore.js';
|
|
3
|
+
import { ModalStep } from '../../../utils/steps.js';
|
|
4
|
+
import { useExternalWallets } from '../../../providers/ExternalWalletContext.js';
|
|
5
|
+
import { useThemeStore } from '../../../stores/index.js';
|
|
6
|
+
export const useStepTitle = () => {
|
|
7
|
+
const hideWallets = useThemeStore(state => state.hideWallets);
|
|
8
|
+
const isLogin = useModalStore(state => state.isLogin());
|
|
9
|
+
const currentStep = useModalStore(state => state.step);
|
|
10
|
+
const { chainId } = useExternalWallets();
|
|
11
|
+
const titles = useMemo(() => ({
|
|
12
|
+
[ModalStep.AUTH_MAIN]: '',
|
|
13
|
+
[ModalStep.AUTH_MORE]: 'Sign Up or Log In',
|
|
14
|
+
[ModalStep.EX_WALLET_MORE]: 'Connect Wallet',
|
|
15
|
+
[ModalStep.VERIFICATIONS]: 'Sign Up',
|
|
16
|
+
[ModalStep.AWAITING_OAUTH]: isLogin ? 'Login' : 'Sign Up',
|
|
17
|
+
[ModalStep.FARCASTER_OAUTH]: isLogin ? 'Login' : 'Sign Up',
|
|
18
|
+
[ModalStep.BIOMETRIC_CREATION]: 'Sign Up',
|
|
19
|
+
[ModalStep.PASSWORD_CREATION]: 'Sign Up',
|
|
20
|
+
[ModalStep.AWAITING_BIOMETRIC_CREATION]: 'Sign Up',
|
|
21
|
+
[ModalStep.AWAITING_WALLET_CREATION]: isLogin ? 'Login' : 'Sign Up',
|
|
22
|
+
[ModalStep.AWAITING_PASSWORD_CREATION]: 'Sign Up',
|
|
23
|
+
[ModalStep.WALLET_CREATION_DONE]: hideWallets ? 'Account Created' : 'Wallet Created',
|
|
24
|
+
[ModalStep.SECRET]: isLogin ? 'Login' : 'Sign Up',
|
|
25
|
+
[ModalStep.BIOMETRIC_LOGIN]: 'Login',
|
|
26
|
+
[ModalStep.AWAITING_PASSWORD_LOGIN]: 'Login',
|
|
27
|
+
[ModalStep.AWAITING_BIOMETRIC_LOGIN]: 'Login',
|
|
28
|
+
[ModalStep.LOGIN_DONE]: '',
|
|
29
|
+
[ModalStep.SETUP_2FA]: '2FA',
|
|
30
|
+
[ModalStep.VERIFY_2FA]: '2FA',
|
|
31
|
+
[ModalStep.TWO_FACTOR_DONE]: '2FA',
|
|
32
|
+
[ModalStep.ADD_FUNDS_BUY]: '',
|
|
33
|
+
[ModalStep.ADD_FUNDS_RECEIVE]: '',
|
|
34
|
+
[ModalStep.ADD_FUNDS_WITHDRAW]: '',
|
|
35
|
+
[ModalStep.ADD_FUNDS_AWAITING]: '',
|
|
36
|
+
[ModalStep.ADD_FUNDS_SUCCESS]: '',
|
|
37
|
+
[ModalStep.ADD_FUNDS_FAILURE]: '',
|
|
38
|
+
[ModalStep.ACCOUNT_MAIN]: '',
|
|
39
|
+
[ModalStep.CHAIN_SWITCH]: '',
|
|
40
|
+
}), [isLogin, chainId, hideWallets]);
|
|
41
|
+
return { title: titles[currentStep] };
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Hero: () => import("react/jsx-runtime").JSX.Element;
|