@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,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CpslButton, CpslText } from '@getpara/react-components';
|
|
3
|
+
import { Heading, StepContainer, InnerStepContainer, HeroIcon } from '../common.js';
|
|
4
|
+
import { useThemeStore } from '../../stores/index.js';
|
|
5
|
+
export const TwoFactorDoneStep = ({ onClose }) => {
|
|
6
|
+
const hideWallets = useThemeStore(state => state.hideWallets);
|
|
7
|
+
return (_jsxs(StepContainer, { children: [_jsx(HeroIcon, { icon: "checkCircleFilled" }), _jsxs(InnerStepContainer, { children: [_jsx(Heading, { variant: "headingXS", weight: "semiBold", children: "Success" }), _jsxs(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: ["Your ", hideWallets ? 'account' : 'wallet', " is now protected by 2FA"] })] }), _jsx(CpslButton, { fullWidth: true, onClick: onClose, children: "Done" })] }));
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VerificationCodeStep: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,130 @@
|
|
|
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 { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
import { CpslCodeInput, CpslSpinner, CpslText } from '@getpara/react-components';
|
|
12
|
+
import { useEffect, useRef, useState } from 'react';
|
|
13
|
+
import { styled } from 'styled-components';
|
|
14
|
+
import { ModalStep } from '../../utils/steps.js';
|
|
15
|
+
import { useParaStore, useModalStore, useThemeStore, useUserInfoStore } from '../../stores/index.js';
|
|
16
|
+
import { Heading, InnerStepContainer, StepContainer } from '../common.js';
|
|
17
|
+
import { AuthMethod } from '@getpara/core-sdk';
|
|
18
|
+
export const VerificationCodeStep = () => {
|
|
19
|
+
const theme = useThemeStore(state => state.theme);
|
|
20
|
+
const authInfo = useUserInfoStore(state => state.getAuthInfo());
|
|
21
|
+
const setStep = useModalStore(state => state.setStep);
|
|
22
|
+
const setWebAuthURLForCreate = useModalStore(state => state.setWebAuthURLForCreate);
|
|
23
|
+
const setIFrameUrl = useModalStore(state => state.setIFrameUrl);
|
|
24
|
+
const setIsIFrameReady = useModalStore(state => state.setIsIFrameReady);
|
|
25
|
+
const isIFrameReady = useModalStore(state => state.isIFrameReady);
|
|
26
|
+
const para = useParaStore(state => state.para);
|
|
27
|
+
const inputRef = useRef(null);
|
|
28
|
+
const [code, setCode] = useState('');
|
|
29
|
+
const [codeError, setCodeError] = useState('');
|
|
30
|
+
const [resendStatus, setResendStatus] = useState('Resend.');
|
|
31
|
+
const [resendDisabled, setResendDisabled] = useState(false);
|
|
32
|
+
const [isVerifying, setIsVerifying] = useState(false);
|
|
33
|
+
const [shouldRouteToStep, setShouldRouteToStep] = useState();
|
|
34
|
+
const isEmail = (authInfo === null || authInfo === void 0 ? void 0 : authInfo.authType) === 'email';
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
// Using a small timeout here to ensure the input is mounted before attempting focus
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
(_b = (_a = inputRef.current.shadowRoot.querySelectorAll('input')) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
40
|
+
}, 10);
|
|
41
|
+
}, []);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!!shouldRouteToStep && isIFrameReady) {
|
|
44
|
+
// Using a small timeout here to fully ensure the iframe is loaded before triggering any animation
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
setStep(shouldRouteToStep);
|
|
47
|
+
setIsVerifying(false);
|
|
48
|
+
}, 200);
|
|
49
|
+
}
|
|
50
|
+
}, [shouldRouteToStep, isIFrameReady]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (code.length === 6) {
|
|
53
|
+
handleSubmitCode();
|
|
54
|
+
}
|
|
55
|
+
}, [code]);
|
|
56
|
+
const handleResendClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
+
if (!resendDisabled) {
|
|
58
|
+
setResendStatus('Resent!');
|
|
59
|
+
setResendDisabled(true);
|
|
60
|
+
isEmail ? yield para.resendVerificationCode() : yield para.resendVerificationCodeByPhone();
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
setResendStatus('Resend.');
|
|
63
|
+
setResendDisabled(false);
|
|
64
|
+
}, 3000);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const handleCodeInput = (e) => {
|
|
68
|
+
if (codeError) {
|
|
69
|
+
setCodeError('');
|
|
70
|
+
}
|
|
71
|
+
setCode(e.detail.value.trim());
|
|
72
|
+
};
|
|
73
|
+
const handleSubmitCode = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
+
setIsVerifying(true);
|
|
75
|
+
if (code.length === 6 && /^\d+$/.test(code)) {
|
|
76
|
+
try {
|
|
77
|
+
const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
|
|
78
|
+
if (supportedCreateAuthMethods.has(AuthMethod.PASSWORD) && supportedCreateAuthMethods.has(AuthMethod.PASSKEY)) {
|
|
79
|
+
setIsIFrameReady(false);
|
|
80
|
+
const webAuthUrl = isEmail ? yield para.verifyEmail(code) : yield para.verifyPhone(code);
|
|
81
|
+
const passwordAuthUrl = yield para.getSetupPasswordURL({ authType: authInfo === null || authInfo === void 0 ? void 0 : authInfo.authType, theme });
|
|
82
|
+
setWebAuthURLForCreate(yield para.shortenLoginLink(webAuthUrl));
|
|
83
|
+
setIFrameUrl(yield para.shortenLoginLink(passwordAuthUrl));
|
|
84
|
+
setShouldRouteToStep(ModalStep.BIOMETRIC_CREATION);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
else if ((yield para.getSupportedCreateAuthMethods()).has(AuthMethod.PASSWORD)) {
|
|
88
|
+
setIsIFrameReady(false);
|
|
89
|
+
isEmail ? yield para.verifyEmail(code) : yield para.verifyPhone(code);
|
|
90
|
+
const url = yield para.getSetupPasswordURL({ authType: authInfo === null || authInfo === void 0 ? void 0 : authInfo.authType, theme });
|
|
91
|
+
setIFrameUrl(yield para.shortenLoginLink(url));
|
|
92
|
+
setShouldRouteToStep(ModalStep.PASSWORD_CREATION);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const url = isEmail ? yield para.verifyEmail(code) : yield para.verifyPhone(code);
|
|
97
|
+
setWebAuthURLForCreate(yield para.shortenLoginLink(url));
|
|
98
|
+
setStep(ModalStep.BIOMETRIC_CREATION);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
if (e.message.includes('429')) {
|
|
103
|
+
setCodeError('Too many incorrect attempts. Please try again in 10 minutes.');
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
setCodeError('Incorrect code.');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
setCodeError('Incorrect code.');
|
|
112
|
+
}
|
|
113
|
+
setIsVerifying(false);
|
|
114
|
+
});
|
|
115
|
+
return (_jsxs(StepContainer, { "$wide": true, children: [_jsxs(InnerStepContainer, { children: [_jsxs(Heading, { variant: "headingS", weight: "bold", children: ["Verify ", isEmail ? 'Email' : 'Phone Number'] }), _jsxs(InlineText, { variant: "bodyS", color: "secondary", children: ["Please enter the code we sent to ", _jsx(InlineText, { variant: "bodyS", children: authInfo.identifier })] })] }), _jsx(InnerStepContainer, { children: isVerifying ? (_jsx(CpslSpinner, {})) : (_jsxs(_Fragment, { children: [_jsx("form", { onSubmit: (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
yield handleSubmitCode();
|
|
118
|
+
}), children: _jsx(StyledCodeInput, { ref: inputRef, length: 6, type: "number", code: code, onCpslInput: handleCodeInput, errorText: codeError, onKeyDown: (e) => __awaiter(void 0, void 0, void 0, function* () { return e.key === 'Enter' && (yield handleSubmitCode()); }) }) }), _jsxs(InlineText, { variant: "bodyS", color: "secondary", children: ["Didn\u2019t receive a code?", ' ', _jsx(ClickableText, { variant: "bodyS", style: { cursor: resendDisabled ? 'default' : 'pointer' }, onClick: handleResendClick, children: resendStatus })] })] })) })] }));
|
|
119
|
+
};
|
|
120
|
+
const StyledCodeInput = styled(CpslCodeInput) `
|
|
121
|
+
align-self: center;
|
|
122
|
+
`;
|
|
123
|
+
const InlineText = styled(CpslText) `
|
|
124
|
+
text-align: center;
|
|
125
|
+
display: inline-block;
|
|
126
|
+
`;
|
|
127
|
+
const ClickableText = styled(InlineText) `
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
display: inline-block;
|
|
130
|
+
`;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CpslSpinner, CpslText } from '@getpara/react-components';
|
|
3
|
+
import { Heading, SpinnerContainer, StepContainer, InnerStepContainer } from '../common.js';
|
|
4
|
+
export const Waiting = ({ heading, subheading }) => {
|
|
5
|
+
return (_jsxs(StepContainer, { "$wide": true, children: [_jsx(SpinnerContainer, { children: _jsx(CpslSpinner, { size: 100 }) }), _jsxs(InnerStepContainer, { children: [_jsx(Heading, { variant: "headingS", weight: "bold", children: heading }), _jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: subheading })] })] }));
|
|
6
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { CpslIcon, CpslText } from '@getpara/react-components';
|
|
4
|
+
export const PartnerIcon = ({ partner }) => {
|
|
5
|
+
const { logoUrl, displayName, backgroundColor, foregroundColor } = partner;
|
|
6
|
+
if (logoUrl) {
|
|
7
|
+
return _jsx(Icon, { src: logoUrl });
|
|
8
|
+
}
|
|
9
|
+
return (_jsx(Container, { "$backgroundColor": backgroundColor, children: _jsx(Text, { variant: "bodyXS", "$color": foregroundColor, children: displayName[0] }) }));
|
|
10
|
+
};
|
|
11
|
+
const Container = styled.div `
|
|
12
|
+
width: 14px;
|
|
13
|
+
height: 14px;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
background-color: ${({ $backgroundColor }) => `${$backgroundColor !== null && $backgroundColor !== void 0 ? $backgroundColor : 'var(--cpsl-color-contrast)'}`};
|
|
18
|
+
border-radius: 100%;
|
|
19
|
+
`;
|
|
20
|
+
const Text = styled(CpslText) `
|
|
21
|
+
&::part(text-element) {
|
|
22
|
+
line-height: 100%;
|
|
23
|
+
color: ${({ $color }) => `${$color !== null && $color !== void 0 ? $color : 'var(--cpsl-color-foreground-0)'}`};
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const Icon = styled(CpslIcon) `
|
|
27
|
+
--height: 14px;
|
|
28
|
+
--width: 14px;
|
|
29
|
+
`;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WalletType } from '@getpara/web-sdk';
|
|
2
|
+
export declare const ExternalWalletCard: ({ address, showAddFunds }: Pick<SharedWalletCardProps, "address" | "showAddFunds">) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
interface WalletCardProps {
|
|
4
|
+
id: string;
|
|
5
|
+
type: WalletType;
|
|
6
|
+
showAddFunds?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const WalletCard: ({ id, type, showAddFunds }: WalletCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
interface SharedWalletCardProps {
|
|
10
|
+
address: string;
|
|
11
|
+
id?: string;
|
|
12
|
+
type?: WalletType;
|
|
13
|
+
name?: string;
|
|
14
|
+
identiconHash: string;
|
|
15
|
+
showAddFunds?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const WalletCards: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { useParaStore, useModalStore, useThemeStore } from '../../stores/index.js';
|
|
4
|
+
import { CpslButton, CpslIdenticon, CpslText } from '@getpara/react-components';
|
|
5
|
+
import { truncateAddress } from '@getpara/web-sdk';
|
|
6
|
+
import { ModalStep } from '../../utils/steps.js';
|
|
7
|
+
export const ExternalWalletCard = ({ address, showAddFunds }) => {
|
|
8
|
+
const para = useParaStore(state => state.para);
|
|
9
|
+
const wallet = para.externalWallets[address];
|
|
10
|
+
if (!wallet) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return (_jsx(SharedWalletCard, { address: truncateAddress(wallet.address, wallet.type), identiconHash: para.getIdenticonHash(wallet.id, wallet.type), showAddFunds: showAddFunds }));
|
|
14
|
+
};
|
|
15
|
+
export const WalletCard = ({ id, type, showAddFunds }) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const para = useParaStore(state => state.para);
|
|
18
|
+
const appName = useThemeStore(state => state.appName);
|
|
19
|
+
const wallet = para.findWallet(id, type);
|
|
20
|
+
if (!wallet) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const address = para.getDisplayAddress(wallet.id, { addressType: type });
|
|
24
|
+
return (_jsx(SharedWalletCard, { id: wallet.id, type: wallet.type, address: truncateAddress(address, type, { prefix: para.cosmosPrefix }), name: (_a = wallet.name) !== null && _a !== void 0 ? _a : `${appName ? `${appName} ` : ''}Wallet`, identiconHash: para.getIdenticonHash(wallet.id, type), showAddFunds: showAddFunds }));
|
|
25
|
+
};
|
|
26
|
+
const SharedWalletCard = ({ address, name, identiconHash, showAddFunds, id, type }) => {
|
|
27
|
+
const onRampConfig = useModalStore(state => state.onRampConfig);
|
|
28
|
+
const setActiveWallet = useModalStore(state => state.setActiveWallet);
|
|
29
|
+
const setStep = useModalStore(state => state.setStep);
|
|
30
|
+
const isAddFundsEnabled = onRampConfig.isBuyEnabled || onRampConfig.isReceiveEnabled;
|
|
31
|
+
const handleAddFundsClick = () => {
|
|
32
|
+
if (id && type) {
|
|
33
|
+
setActiveWallet([id, type]);
|
|
34
|
+
isAddFundsEnabled && setStep(onRampConfig.isBuyEnabled ? ModalStep.ADD_FUNDS_BUY : ModalStep.ADD_FUNDS_RECEIVE);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return (_jsxs(Container, { children: [_jsxs(InnerContainer, { children: [_jsx(CpslIdenticon, { size: "48px", hash: identiconHash }), _jsxs(WalletNameContainer, { children: [!!name && (_jsx(Name, { color: "contrast", variant: "bodyL", weight: "semiBold", children: name })), _jsx(Name, { color: "secondary", variant: "bodyS", weight: "medium", children: address })] })] }), showAddFunds && isAddFundsEnabled && (_jsx(AddFundsButton, { onClick: handleAddFundsClick, children: _jsx(CpslText, { variant: "bodyXS", color: "contrast", weight: "medium", children: "Add Funds" }) }))] }));
|
|
38
|
+
};
|
|
39
|
+
export const WalletCards = styled.div `
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
gap: 8px;
|
|
43
|
+
width: 100%;
|
|
44
|
+
`;
|
|
45
|
+
const Container = styled.div `
|
|
46
|
+
width: 100%;
|
|
47
|
+
padding: 24px;
|
|
48
|
+
display: flex;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: 16px;
|
|
52
|
+
background-color: var(--cpsl-color-background-8);
|
|
53
|
+
border-radius: 16px;
|
|
54
|
+
`;
|
|
55
|
+
const InnerContainer = styled.div `
|
|
56
|
+
display: flex;
|
|
57
|
+
justify-content: flex-start;
|
|
58
|
+
gap: 4px;
|
|
59
|
+
align-items: center;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
`;
|
|
62
|
+
const WalletNameContainer = styled.div `
|
|
63
|
+
flex: 1;
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
gap: 4px;
|
|
67
|
+
align-items: flex-start;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
`;
|
|
71
|
+
const Name = styled(CpslText) `
|
|
72
|
+
width: 100%;
|
|
73
|
+
&::part(text-element) {
|
|
74
|
+
line-height: 100%;
|
|
75
|
+
text-overflow: ellipsis;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
white-space: nowrap;
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
const AddFundsButton = styled(CpslButton) `
|
|
81
|
+
--button-primary-background-color: var(--cpsl-color-card-surface);
|
|
82
|
+
--button-primary-hover-background-color: var(--cpsl-color-background-4);
|
|
83
|
+
--button-primary-color: var(--cpsl-color-text-contrast);
|
|
84
|
+
--button-primary-hover-color: var(--cpsl-color-text-contrast);
|
|
85
|
+
--button-primary-active-color: var(--cpsl-color-text-contrast);
|
|
86
|
+
--button-padding-start: 8px;
|
|
87
|
+
--button-padding-end: 8px;
|
|
88
|
+
--button-padding-top: 8px;
|
|
89
|
+
--button-padding-bottom: 8px;
|
|
90
|
+
--button-border-radius: 8px;
|
|
91
|
+
`;
|
|
@@ -0,0 +1,49 @@
|
|
|
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { CpslButton, CpslText } from '@getpara/react-components';
|
|
12
|
+
import { StepContainer, InnerStepContainer, HeroIcon } from '../common.js';
|
|
13
|
+
import { useParaStore, useModalStore, useThemeStore } from '../../stores/index.js';
|
|
14
|
+
import { ModalStep } from '../../utils/steps.js';
|
|
15
|
+
import { WalletCard, WalletCards } from '../WalletCard/WalletCard.js';
|
|
16
|
+
import styled from 'styled-components';
|
|
17
|
+
export const WalletCreationDoneStep = ({ twoFactorAuthEnabled, onClose }) => {
|
|
18
|
+
const hideWallets = useThemeStore(state => state.hideWallets);
|
|
19
|
+
const setStep = useModalStore(state => state.setStep);
|
|
20
|
+
const isLogin = useModalStore(state => state.isLogin());
|
|
21
|
+
const onRampConfig = useModalStore(state => state.onRampConfig);
|
|
22
|
+
const para = useParaStore(state => state.para);
|
|
23
|
+
const isOnRampConfigured = (onRampConfig === null || onRampConfig === void 0 ? void 0 : onRampConfig.isBuyEnabled) || (onRampConfig === null || onRampConfig === void 0 ? void 0 : onRampConfig.isReceiveEnabled) || (onRampConfig === null || onRampConfig === void 0 ? void 0 : onRampConfig.isWithdrawEnabled);
|
|
24
|
+
const handleNext = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
if (isLogin) {
|
|
26
|
+
if (!twoFactorAuthEnabled) {
|
|
27
|
+
setStep(ModalStep.LOGIN_DONE);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const is2FAComplete = yield para.check2FAStatus();
|
|
31
|
+
setStep(is2FAComplete ? ModalStep.LOGIN_DONE : ModalStep.SETUP_2FA);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
if (twoFactorAuthEnabled) {
|
|
35
|
+
setStep(ModalStep.SETUP_2FA);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
onClose();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return (_jsxs(StepContainer, { "$wide": true, children: [_jsx(CardContainer, { children: hideWallets ? (_jsxs(_Fragment, { children: [_jsx(HeroIcon, { icon: "checkCircleFilled" }), _jsx(CpslText, { variant: "bodyM", color: "secondary", weight: "medium", style: { marginTop: '16px' }, children: "Your account has been created." })] })) : (_jsx(WalletCards, { children: para.currentWalletIdsArray.map(([id, type]) => {
|
|
43
|
+
return _jsx(WalletCard, { id: id, type: type, showAddFunds: isOnRampConfigured }, id);
|
|
44
|
+
}) })) }), _jsx(InnerStepContainer, { children: _jsx(CpslButton, { fullWidth: true, onClick: handleNext, children: twoFactorAuthEnabled ? 'Continue' : 'Done' }) })] }));
|
|
45
|
+
};
|
|
46
|
+
const CardContainer = styled(InnerStepContainer) `
|
|
47
|
+
min-height: 196px;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
|
|
2
|
+
export declare const SpinnerContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const QRContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
+
export declare const InfoBoxContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
|
+
export declare const InfoBoxHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
+
export declare const FilledDisabledInput: typeof CpslInput;
|
|
7
|
+
export declare const FullWidthFilledDisabledInput: typeof CpslInput;
|
|
8
|
+
export declare const CenteredText: typeof CpslText;
|
|
9
|
+
export declare const InnerStepContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
10
|
+
export declare const StepContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, "ref"> & {
|
|
11
|
+
ref?: import("react").Ref<HTMLDivElement>;
|
|
12
|
+
}, {
|
|
13
|
+
$wide?: boolean;
|
|
14
|
+
}>> & string;
|
|
15
|
+
export declare const Heading: typeof CpslText;
|
|
16
|
+
export declare const StyledCpslTileButton: typeof CpslTileButton;
|
|
17
|
+
export declare const HeroIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("@getpara/core-components").JSX.CpslIcon & Omit<import("react").HTMLAttributes<HTMLCpslIconElement>, "style"> & import("@getpara/react-components/dist/types/components/stencil-generated/react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLCpslIconElement>, "ref"> & {
|
|
18
|
+
ref?: import("react").Ref<HTMLCpslIconElement>;
|
|
19
|
+
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("@getpara/core-components").JSX.CpslIcon & Omit<import("react").HTMLAttributes<HTMLCpslIconElement>, "style"> & import("@getpara/react-components/dist/types/components/stencil-generated/react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLCpslIconElement>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CpslIcon, CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
|
|
2
|
+
import { styled } from 'styled-components';
|
|
3
|
+
export const SpinnerContainer = styled.div `
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
`;
|
|
8
|
+
export const QRContainer = styled.div `
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
width: 286px;
|
|
13
|
+
height: 286px;
|
|
14
|
+
`;
|
|
15
|
+
export const InfoBoxContent = styled.div `
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
gap: 8px;
|
|
19
|
+
`;
|
|
20
|
+
export const InfoBoxHeader = styled.div `
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: 4px;
|
|
24
|
+
|
|
25
|
+
cpsl-icon {
|
|
26
|
+
--height: 20px;
|
|
27
|
+
--width: 20px;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
export const FilledDisabledInput = styled(CpslInput) `
|
|
31
|
+
--container-border-color: var(--cpsl-color-input-border-placeholder);
|
|
32
|
+
--container-background-color: var(--cpsl-color-background-0);
|
|
33
|
+
--input-background-color: transparent;
|
|
34
|
+
--input-font-weight: 500;
|
|
35
|
+
--input-color: var(--cpsl-color-text-secondary);
|
|
36
|
+
`;
|
|
37
|
+
export const FullWidthFilledDisabledInput = styled(FilledDisabledInput) `
|
|
38
|
+
width: 100%;
|
|
39
|
+
`;
|
|
40
|
+
export const CenteredText = styled(CpslText) `
|
|
41
|
+
width: 100%;
|
|
42
|
+
text-align: center;
|
|
43
|
+
`;
|
|
44
|
+
export const InnerStepContainer = styled.div `
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
align-self: center;
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: 8px;
|
|
52
|
+
`;
|
|
53
|
+
export const StepContainer = styled(InnerStepContainer) `
|
|
54
|
+
gap: ${({ $wide }) => ($wide ? '32px' : '24px')};
|
|
55
|
+
`;
|
|
56
|
+
export const Heading = styled(CenteredText) ``;
|
|
57
|
+
export const StyledCpslTileButton = styled(CpslTileButton) `
|
|
58
|
+
--button-width: 100%;
|
|
59
|
+
--button-height: 87px;
|
|
60
|
+
--button-icon-height: 32px;
|
|
61
|
+
--button-icon-width: 32px;
|
|
62
|
+
`;
|
|
63
|
+
export const HeroIcon = styled(CpslIcon) `
|
|
64
|
+
--height: 80px;
|
|
65
|
+
--width: 80px;
|
|
66
|
+
--icon-color: var(--cpsl-color-text-primary);
|
|
67
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ModalContent/ModalContent.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ModalContent/ModalContent.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Network, OnRampAsset, OnRampMethod, OnRampProvider } from '@getpara/core-sdk';
|
|
2
|
+
import { IconType } from '@getpara/react-components';
|
|
3
|
+
import { Transition, Variants } from 'framer-motion';
|
|
4
|
+
export declare const PARA_CONNECT = "https://connect.getpara.com/";
|
|
5
|
+
export declare const PARA_TERMS_AND_CONDITIONS = "https://capsule-org.notion.site/Terms-and-Conditions-d4a23d32c6a64acba9cec29a11cc09e9";
|
|
6
|
+
export interface OnRampProviderConfig {
|
|
7
|
+
name: string;
|
|
8
|
+
feeLower: number;
|
|
9
|
+
feeUpper?: number;
|
|
10
|
+
methods: OnRampMethod[];
|
|
11
|
+
icon: IconType;
|
|
12
|
+
backgroundColors: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare const ON_RAMP_PROVIDERS: Record<OnRampProvider, OnRampProviderConfig>;
|
|
15
|
+
export declare const NETWORKS: Record<Network, {
|
|
16
|
+
name: string;
|
|
17
|
+
icon: IconType;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const ON_RAMP_ASSETS: Record<OnRampAsset, {
|
|
20
|
+
name: string;
|
|
21
|
+
code: string;
|
|
22
|
+
icon: IconType;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function getNetworkName(str: Network | string): string;
|
|
25
|
+
export declare function getNetworkIcon(str: Network | string): IconType;
|
|
26
|
+
export declare function getAssetName(str: OnRampAsset | string): string;
|
|
27
|
+
export declare function getAssetIcon(str: OnRampAsset | string): "code" | "menu" | "image" | "polygon" | "key" | "search" | "download" | "x" | "send" | "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowNarrow" | "arrow" | "asterisk" | "backupKit" | "bank" | "baseBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "close" | "clubhouseBrand" | "clubhouse" | "copy07" | "copy" | "cosmos" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "discord" | "dot" | "dots" | "downloadCloud" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "farcaster" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "googleBrand" | "google" | "gridDots" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "infoCircle" | "instagramBrand" | "instagram" | "laptop" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "optimismBrand" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "para" | "passcode" | "phone" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "puzzlePiece" | "qrCode02" | "qrCode" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solana" | "spacingHeight" | "star04Filled" | "stars01Filled" | "stars" | "stopSquare" | "stripeBrand" | "telegramBrand" | "telegram" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "userCircle" | "user" | "wallet" | "youtubeBrand" | "youtube" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BQ2" | "BQ3" | "BR" | "BS" | "BT" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CD2" | "CF" | "CH" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DS" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB2" | "GB" | "GD" | "GE" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GQ" | "GR" | "GT" | "GU" | "GW" | "GY" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "US" | "UY" | "UZ" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WS" | "YE" | "ZA" | "ZM" | "ZW";
|
|
28
|
+
export declare const MOBILE_SIZE = 480;
|
|
29
|
+
export declare const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
30
|
+
export declare const EMAIL_REGEX: RegExp;
|
|
31
|
+
export declare const BODY_MOTION_VARIANTS: Variants;
|
|
32
|
+
export declare const BODY_TRANSITION: Transition;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Network, OnRampAsset, OnRampMethod, OnRampProvider } from '@getpara/core-sdk';
|
|
2
|
+
export const PARA_CONNECT = 'https://connect.getpara.com/';
|
|
3
|
+
export const PARA_TERMS_AND_CONDITIONS = 'https://capsule-org.notion.site/Terms-and-Conditions-d4a23d32c6a64acba9cec29a11cc09e9';
|
|
4
|
+
export const ON_RAMP_PROVIDERS = {
|
|
5
|
+
[OnRampProvider.STRIPE]: {
|
|
6
|
+
name: 'Stripe',
|
|
7
|
+
feeLower: 0.99,
|
|
8
|
+
feeUpper: 4.49,
|
|
9
|
+
methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
|
|
10
|
+
icon: 'stripeBrand',
|
|
11
|
+
backgroundColors: ['#6772E5', '#808AF4'],
|
|
12
|
+
},
|
|
13
|
+
[OnRampProvider.RAMP]: {
|
|
14
|
+
name: 'Ramp',
|
|
15
|
+
feeLower: 0.99,
|
|
16
|
+
feeUpper: 4.49,
|
|
17
|
+
methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
|
|
18
|
+
icon: 'rampNetworkBrand',
|
|
19
|
+
backgroundColors: ['#21BF73', '#3AE492'],
|
|
20
|
+
},
|
|
21
|
+
[OnRampProvider.MOONPAY]: {
|
|
22
|
+
name: 'MoonPay',
|
|
23
|
+
feeLower: 1.0,
|
|
24
|
+
feeUpper: 4.5,
|
|
25
|
+
methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
|
|
26
|
+
icon: 'moonpayBrand',
|
|
27
|
+
backgroundColors: ['#7715F5', '#9647fd'],
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export const NETWORKS = {
|
|
31
|
+
[Network.ETHEREUM]: { name: 'Ethereum', icon: 'ethereum' },
|
|
32
|
+
[Network.SEPOLIA]: { name: 'Sepolia', icon: 'ethereum' },
|
|
33
|
+
[Network.ARBITRUM]: { name: 'Arbitrum', icon: 'arbitrumBrand' },
|
|
34
|
+
[Network.BASE]: { name: 'Base', icon: 'baseBrand' },
|
|
35
|
+
[Network.OPTIMISM]: { name: 'Optimism', icon: 'optimismBrand' },
|
|
36
|
+
[Network.POLYGON]: { name: 'Polygon', icon: 'polygonBrand' },
|
|
37
|
+
[Network.SOLANA]: { name: 'Solana', icon: 'solana' },
|
|
38
|
+
[Network.COSMOS]: { name: 'Cosmos', icon: 'cosmos' },
|
|
39
|
+
[Network.CELO]: { name: 'Celo', icon: 'celoBrand' },
|
|
40
|
+
[Network.NOBLE]: { name: 'Noble', icon: 'nobleBrand' },
|
|
41
|
+
};
|
|
42
|
+
export const ON_RAMP_ASSETS = {
|
|
43
|
+
[OnRampAsset.ETHEREUM]: { name: 'Ethereum', code: 'ETH', icon: 'ethereum' },
|
|
44
|
+
[OnRampAsset.USDC]: { name: 'USDC', code: 'USDC', icon: 'usdcBrand' },
|
|
45
|
+
[OnRampAsset.POLYGON]: { name: 'Polygon', code: 'MATIC', icon: 'polygonBrand' },
|
|
46
|
+
[OnRampAsset.SOLANA]: { name: 'Solana', code: 'SOL', icon: 'solana' },
|
|
47
|
+
[OnRampAsset.ATOM]: { name: 'Atom', code: 'ATOM', icon: 'cosmos' },
|
|
48
|
+
[OnRampAsset.CELO]: { name: 'Celo', code: 'CELO', icon: 'celoBrand' },
|
|
49
|
+
[OnRampAsset.TETHER]: { name: 'Tether', code: 'USDT', icon: 'tetherBrand' },
|
|
50
|
+
[OnRampAsset.CUSD]: { name: 'Celo Dollar', code: 'CUSD', icon: 'celoBrand' },
|
|
51
|
+
[OnRampAsset.CEUR]: { name: 'Celo Euro', code: 'CEUR', icon: 'celoBrand' },
|
|
52
|
+
[OnRampAsset.CREAL]: { name: 'Celo Real', code: 'CREAL', icon: 'celoBrand' },
|
|
53
|
+
};
|
|
54
|
+
export function getNetworkName(str) {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
return (_b = (_a = NETWORKS[str]) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : `${str[0]}${str.slice(1).toLowerCase()}`;
|
|
57
|
+
}
|
|
58
|
+
export function getNetworkIcon(str) {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
return (_b = (_a = NETWORKS[str]) === null || _a === void 0 ? void 0 : _a.icon) !== null && _b !== void 0 ? _b : 'globe';
|
|
61
|
+
}
|
|
62
|
+
export function getAssetName(str) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
return (_b = (_a = ON_RAMP_ASSETS[str]) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : str;
|
|
65
|
+
}
|
|
66
|
+
export function getAssetIcon(str) {
|
|
67
|
+
var _a, _b;
|
|
68
|
+
return (_b = (_a = ON_RAMP_ASSETS[str]) === null || _a === void 0 ? void 0 : _a.icon) !== null && _b !== void 0 ? _b : 'emptyCircle';
|
|
69
|
+
}
|
|
70
|
+
export const MOBILE_SIZE = 480;
|
|
71
|
+
export const NETWORK_NOT_SUPPORTED_ERROR = 'network not supported';
|
|
72
|
+
export const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
73
|
+
export const BODY_MOTION_VARIANTS = {
|
|
74
|
+
enter: (direction) => {
|
|
75
|
+
return {
|
|
76
|
+
scale: direction > 0 ? 0.9 : 1.1,
|
|
77
|
+
opacity: 0,
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
center: {
|
|
81
|
+
scale: 1,
|
|
82
|
+
opacity: 1,
|
|
83
|
+
},
|
|
84
|
+
exit: (direction) => {
|
|
85
|
+
return {
|
|
86
|
+
scale: direction < 0 ? 0.9 : 1.1,
|
|
87
|
+
opacity: 0,
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
export const BODY_TRANSITION = {
|
|
92
|
+
duration: 0.2,
|
|
93
|
+
};
|