@getpara/react-sdk 1.2.0 → 1.3.1-dev.1
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/cli/cli.mjs +43 -0
- package/dist/index.js +6428 -5
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/modal/components/AuthInput/AuthInput.d.ts +1 -1
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +4 -4
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -1
- package/dist/modal/components/Controls/Selects.d.ts +1 -1
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +1 -1
- package/dist/modal/components/Footer/Footer.d.ts +1 -1
- package/dist/modal/components/WalletCard/WalletCard.d.ts +2 -2
- package/dist/modal/components/common.d.ts +2 -2
- package/dist/modal/index.d.ts +0 -1
- package/dist/modal/stores/index.d.ts +0 -1
- package/dist/modal/stores/modal/useModalStore.d.ts +6 -3
- package/dist/modal/types/modalProps.d.ts +1 -27
- package/dist/modal/utils/authLayoutHelpers.d.ts +2 -2
- package/dist/modal/utils/getTileButtonFlex.d.ts +1 -1
- package/dist/modal/utils/openPopup.d.ts +1 -1
- package/dist/provider/ParaProvider.d.ts +3 -1
- package/dist/provider/actions/checkIfUserExists.d.ts +2 -7
- package/dist/provider/actions/createUser.d.ts +2 -10
- package/dist/provider/actions/getAccount.d.ts +9 -6
- package/dist/provider/actions/getWallet.d.ts +1 -1
- package/dist/provider/actions/logout.d.ts +4 -1
- package/dist/provider/actions/waitForLoginAndSetup.d.ts +1 -1
- package/dist/provider/components/CosmosWalletWrapper.d.ts +12 -0
- package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
- package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
- package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
- package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
- package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
- package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +10 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +3 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +6 -0
- package/dist/provider/hooks/mutations/useLogout.d.ts +3 -2
- package/dist/provider/hooks/queries/useAccount.d.ts +4 -3
- package/dist/provider/hooks/queries/useWallet.d.ts +1 -1
- package/dist/provider/hooks/utils/useClient.d.ts +1 -1
- package/dist/provider/hooks/utils/useWalletState.d.ts +2 -2
- package/dist/provider/index.d.ts +1 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
- package/dist/{modal/providers/ExternalWalletContext.d.ts → provider/providers/ExternalWalletProvider.d.ts} +20 -29
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
- package/dist/provider/stores/getters.d.ts +3 -3
- package/dist/provider/stores/setters.d.ts +1 -0
- package/dist/provider/stores/slices/config.d.ts +3 -0
- package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
- package/dist/provider/stores/slices/index.d.ts +1 -0
- package/dist/provider/stores/types.d.ts +43 -1
- package/dist/provider/types/externalWalletProviders.d.ts +12 -0
- package/dist/provider/types/provider.d.ts +115 -16
- package/dist/provider/types/utils.d.ts +1 -0
- package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
- package/package.json +33 -9
- package/dist/modal/ParaModal.js +0 -281
- package/dist/modal/components/Account/Account.js +0 -60
- package/dist/modal/components/AddFunds/AddFunds.js +0 -147
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -65
- package/dist/modal/components/AddFunds/AddFundsDone.js +0 -26
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +0 -2
- package/dist/modal/components/AddFunds/index.js +0 -3
- package/dist/modal/components/AuthInput/AuthInput.js +0 -221
- package/dist/modal/components/AuthInput/countryCodes.js +0 -40
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -23
- package/dist/modal/components/AuthInput/phoneMasks.js +0 -247
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -21
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -89
- package/dist/modal/components/AuthOptions/AuthOptions.js +0 -28
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -7
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -5
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -7
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -18
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -17
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -131
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -26
- package/dist/modal/components/Body/Body.js +0 -232
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -77
- package/dist/modal/components/ChainSwitch/config.js +0 -11
- package/dist/modal/components/Controls/Controls.js +0 -54
- package/dist/modal/components/Controls/Selects.js +0 -159
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -116
- package/dist/modal/components/ExternalWalletStep/config.js +0 -11
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -142
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +0 -7
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -119
- package/dist/modal/components/Footer/Footer.js +0 -71
- package/dist/modal/components/Header/Header.js +0 -24
- package/dist/modal/components/Header/hooks/useStepTitle.js +0 -42
- package/dist/modal/components/Hero/Hero.js +0 -119
- package/dist/modal/components/IFrameStep/IFrameStep.js +0 -41
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -19
- package/dist/modal/components/ModalContent/ModalContent.js +0 -282
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -81
- package/dist/modal/components/OAuth/OAuth.js +0 -125
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -133
- package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -10
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -72
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -67
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -105
- package/dist/modal/components/StripeComponents/StripeComponents.js +0 -78
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -8
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -135
- package/dist/modal/components/Waiting/Waiting.js +0 -6
- package/dist/modal/components/WalletCard/PartnerIcon.js +0 -29
- package/dist/modal/components/WalletCard/WalletCard.js +0 -93
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -50
- package/dist/modal/components/common.js +0 -67
- package/dist/modal/components/index.js +0 -1
- package/dist/modal/constants/constants.js +0 -93
- package/dist/modal/constants/defaults.js +0 -5
- package/dist/modal/constants/oAuthLogos.js +0 -18
- package/dist/modal/hooks/useActiveWallet.d.ts +0 -1
- package/dist/modal/hooks/useActiveWallet.js +0 -11
- package/dist/modal/hooks/useEmbeddedExternalConnection.d.ts +0 -1
- package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -46
- package/dist/modal/hooks/useGoBack.js +0 -34
- package/dist/modal/index.js +0 -9
- package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +0 -29
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -18
- package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +0 -33
- package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -22
- package/dist/modal/providers/ExternalWalletContext.js +0 -253
- package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +0 -21
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -12
- package/dist/modal/stores/externalWalletProvider/actions.d.ts +0 -3
- package/dist/modal/stores/externalWalletProvider/actions.js +0 -5
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +0 -20
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -13
- package/dist/modal/stores/index.js +0 -3
- package/dist/modal/stores/modal/actions.js +0 -64
- package/dist/modal/stores/modal/useModalStore.js +0 -41
- package/dist/modal/stores/para/actions.d.ts +0 -3
- package/dist/modal/stores/para/actions.js +0 -5
- package/dist/modal/stores/para/useParaStore.d.ts +0 -10
- package/dist/modal/stores/para/useParaStore.js +0 -3
- package/dist/modal/stores/theme/actions.d.ts +0 -3
- package/dist/modal/stores/theme/actions.js +0 -24
- package/dist/modal/stores/theme/useThemeStore.d.ts +0 -20
- package/dist/modal/stores/theme/useThemeStore.js +0 -14
- package/dist/modal/stores/userInfo/actions.js +0 -34
- package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -9
- package/dist/modal/types/commonTypes.js +0 -1
- package/dist/modal/types/externalWallets.js +0 -21
- package/dist/modal/types/modalProps.js +0 -7
- package/dist/modal/utils/authLayoutHelpers.js +0 -2
- package/dist/modal/utils/getMailtoLink.js +0 -5
- package/dist/modal/utils/getTileButtonFlex.js +0 -15
- package/dist/modal/utils/isPasskeySupported.js +0 -10
- package/dist/modal/utils/openPopup.js +0 -55
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -35
- package/dist/modal/utils/steps.js +0 -215
- package/dist/modal/utils/stringFormatters.js +0 -12
- package/dist/modal/utils/validateOnRampConfig.js +0 -26
- package/dist/provider/ParaProvider.js +0 -17
- package/dist/provider/actions/checkIfUserExists.js +0 -26
- package/dist/provider/actions/createUser.js +0 -30
- package/dist/provider/actions/getAccount.js +0 -24
- package/dist/provider/actions/getWallet.js +0 -16
- package/dist/provider/actions/initiateLogin.js +0 -23
- package/dist/provider/actions/keepSessionAlive.js +0 -23
- package/dist/provider/actions/logout.js +0 -20
- package/dist/provider/actions/signMessage.js +0 -23
- package/dist/provider/actions/signTransaction.js +0 -23
- package/dist/provider/actions/waitForAccountCreation.js +0 -24
- package/dist/provider/actions/waitForLoginAndSetup.js +0 -27
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -24
- package/dist/provider/hooks/index.js +0 -3
- package/dist/provider/hooks/mutations/index.js +0 -10
- package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
- package/dist/provider/hooks/mutations/useCreateUser.js +0 -23
- package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -23
- package/dist/provider/hooks/mutations/useLogout.js +0 -33
- package/dist/provider/hooks/mutations/useSignMessage.js +0 -33
- package/dist/provider/hooks/mutations/useSignTransaction.js +0 -33
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
- package/dist/provider/hooks/queries/index.js +0 -2
- package/dist/provider/hooks/queries/useAccount.js +0 -23
- package/dist/provider/hooks/queries/useWallet.js +0 -24
- package/dist/provider/hooks/utils/index.js +0 -3
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -79
- package/dist/provider/hooks/utils/useClient.js +0 -8
- package/dist/provider/hooks/utils/useEventListeners.js +0 -87
- package/dist/provider/hooks/utils/useInternalClient.js +0 -9
- package/dist/provider/hooks/utils/useModal.js +0 -15
- package/dist/provider/hooks/utils/useWalletState.js +0 -33
- package/dist/provider/index.js +0 -3
- package/dist/provider/stores/getters.js +0 -5
- package/dist/provider/stores/slices/client.js +0 -4
- package/dist/provider/stores/slices/index.js +0 -3
- package/dist/provider/stores/slices/modal.js +0 -4
- package/dist/provider/stores/slices/wallet.js +0 -6
- package/dist/provider/stores/types.js +0 -1
- package/dist/provider/stores/useStore.js +0 -14
- package/dist/provider/types/provider.js +0 -1
- package/dist/provider/types/query.js +0 -1
- package/dist/provider/types/utils.js +0 -1
- package/dist/provider/utils/renameMutations.js +0 -19
- /package/dist/{modal/css → css}/modal.css +0 -0
- /package/dist/{modal/public → public}/Inter-VariableFont_slnt,wght.ttf +0 -0
|
@@ -1,72 +0,0 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
11
|
-
import { useState } from 'react';
|
|
12
|
-
import { ON_RAMP_PROVIDERS } from '../../constants/constants.js';
|
|
13
|
-
import styled from 'styled-components';
|
|
14
|
-
import { CpslButton, CpslIcon, CpslSpinner, CpslText } from '@getpara/react-components';
|
|
15
|
-
import { motion } from 'framer-motion';
|
|
16
|
-
export const OnRampProviderButton = ({ config, index, onClick: _onClick }) => {
|
|
17
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
18
|
-
const provider = config.providers[index];
|
|
19
|
-
const { feeLower, feeUpper, name, icon, backgroundColors } = ON_RAMP_PROVIDERS[provider];
|
|
20
|
-
const feeString = `Fee ${feeLower}% - ${feeUpper}%`;
|
|
21
|
-
const onClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
setIsLoading(true);
|
|
23
|
-
yield _onClick();
|
|
24
|
-
setIsLoading(false);
|
|
25
|
-
});
|
|
26
|
-
return (_jsx(StyledButton, { "$gradientColors": backgroundColors, fullWidth: true, onClick: onClick, children: _jsxs(Container, { "$backgroundColor": backgroundColors[1], children: [_jsx(IconContainer, { children: _jsx(CpslIcon, { icon: icon }) }), _jsxs(ProviderInfoContainer, { children: [_jsx(Text, { variant: "bodyL", weight: "medium", children: name }), _jsx(ProviderInfoInnerContainer, { children: _jsx(Text, { variant: "bodyXS", weight: "medium", children: feeString }) })] }), isLoading ? _jsx(CpslSpinner, { size: 16 }) : _jsx(Chevron, { icon: "chevronUp" })] }) }));
|
|
27
|
-
};
|
|
28
|
-
const StyledButton = styled(CpslButton) `
|
|
29
|
-
width: 100%;
|
|
30
|
-
--button-primary-background-color: ${({ $gradientColors }) => `linear-gradient(90deg, ${$gradientColors[0]} 0%, ${$gradientColors[1]} 100%)`};
|
|
31
|
-
--button-primary-hover-background-color: ${({ $gradientColors }) => `linear-gradient(90deg, ${$gradientColors[0]} 0%, ${$gradientColors[0]} 100%)`};
|
|
32
|
-
--button-primary-active-background-color: ${({ $gradientColors }) => `linear-gradient(90deg, ${$gradientColors[0]} 0%, ${$gradientColors[0]} 100%)`};
|
|
33
|
-
`;
|
|
34
|
-
const Container = styled(motion.div) `
|
|
35
|
-
display: flex;
|
|
36
|
-
gap: 8px;
|
|
37
|
-
flex: 1;
|
|
38
|
-
align-items: center;
|
|
39
|
-
|
|
40
|
-
& cpsl-spinner {
|
|
41
|
-
--background-color: ${({ $backgroundColor }) => `${$backgroundColor}`};
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
44
|
-
const ProviderInfoContainer = styled.div `
|
|
45
|
-
flex: 1;
|
|
46
|
-
display: flex;
|
|
47
|
-
flex-direction: column;
|
|
48
|
-
align-items: start;
|
|
49
|
-
gap: 2px;
|
|
50
|
-
`;
|
|
51
|
-
const ProviderInfoInnerContainer = styled.div `
|
|
52
|
-
display: flex;
|
|
53
|
-
gap: 16px;
|
|
54
|
-
`;
|
|
55
|
-
const IconContainer = styled.span `
|
|
56
|
-
display: flex;
|
|
57
|
-
align-items: center;
|
|
58
|
-
justify-content: center;
|
|
59
|
-
background-color: #fff;
|
|
60
|
-
border-radius: 100%;
|
|
61
|
-
height: 48px;
|
|
62
|
-
width: 48px;
|
|
63
|
-
`;
|
|
64
|
-
const Text = styled(CpslText) `
|
|
65
|
-
&::part(text-element) {
|
|
66
|
-
color: #fff;
|
|
67
|
-
}
|
|
68
|
-
`;
|
|
69
|
-
const Chevron = styled(CpslIcon) `
|
|
70
|
-
transform: rotate(90deg);
|
|
71
|
-
--icon-color: #fff;
|
|
72
|
-
`;
|
|
@@ -1,67 +0,0 @@
|
|
|
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, CpslText } from '@getpara/react-components';
|
|
12
|
-
import { useModalStore, useThemeStore, useUserInfoStore } from '../../stores/index.js';
|
|
13
|
-
import { ModalStep } from '../../utils/steps.js';
|
|
14
|
-
import { Heading, InnerStepContainer, StepContainer, StyledCpslTileButton } from '../common.js';
|
|
15
|
-
import { styled } from 'styled-components';
|
|
16
|
-
import { useCopyToClipboard } from '@getpara/react-common';
|
|
17
|
-
import { getMailtoLink } from '../../utils/getMailtoLink.js';
|
|
18
|
-
import { useState } from 'react';
|
|
19
|
-
export const SaveRecoverySecret = ({ email, value, onComplete, }) => {
|
|
20
|
-
const [isSecretSaved, setIsSecretSaved] = useState(false);
|
|
21
|
-
const [isCopied, copy] = useCopyToClipboard();
|
|
22
|
-
const onCopy = () => {
|
|
23
|
-
copy(value);
|
|
24
|
-
setIsSecretSaved(true);
|
|
25
|
-
};
|
|
26
|
-
const onDownload = () => {
|
|
27
|
-
const element = document.createElement('a');
|
|
28
|
-
const file = new Blob([value], { type: 'text/plain' });
|
|
29
|
-
element.href = URL.createObjectURL(file);
|
|
30
|
-
element.download = 'recovery.txt';
|
|
31
|
-
document.body.appendChild(element); // Required for this to work in FireFox
|
|
32
|
-
element.click();
|
|
33
|
-
setIsSecretSaved(true);
|
|
34
|
-
};
|
|
35
|
-
const onEmail = () => {
|
|
36
|
-
window.open(getMailtoLink(email, value), '_self');
|
|
37
|
-
setIsSecretSaved(true);
|
|
38
|
-
};
|
|
39
|
-
return (_jsxs(_Fragment, { children: [_jsxs(InnerStepContainer, { children: [_jsx(Heading, { variant: "headingXS", weight: "semiBold", children: "Save your Recovery Secret" }), _jsxs(ButtonContainer, { children: [_jsx(ActionButton, { icon: "download", onClick: onDownload, children: _jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Download" }) }), _jsx(ActionButton, { icon: isCopied ? 'check' : 'copy', onClick: onCopy, children: _jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: isCopied ? 'Copied!' : 'Copy' }) }), _jsx(ActionButton, { icon: "send", onClick: onEmail, children: _jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Email" }) })] })] }), _jsx(InnerStepContainer, { children: _jsx(CpslButton, { fullWidth: true, onClick: onComplete, disabled: !isSecretSaved, children: !isSecretSaved ? 'Choose an option above to continue' : 'I’ve saved my recovery secret' }) })] }));
|
|
40
|
-
};
|
|
41
|
-
export const RecoverySecretStep = () => {
|
|
42
|
-
const hideWallets = useThemeStore(state => state.hideWallets);
|
|
43
|
-
const setStep = useModalStore(state => state.setStep);
|
|
44
|
-
const authInfo = useUserInfoStore(state => state.getAuthInfo());
|
|
45
|
-
const recoveryShare = useUserInfoStore(state => state.recoveryShare);
|
|
46
|
-
const backupDecryptionKey = JSON.parse(recoveryShare || '{}').backupDecryptionKey;
|
|
47
|
-
const onComplete = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
setStep(ModalStep.WALLET_CREATION_DONE);
|
|
49
|
-
});
|
|
50
|
-
return (_jsxs(StepContainer, { children: [_jsxs(InnerStepContainer, { children: [_jsx(Heading, { variant: "headingS", weight: "bold", children: hideWallets ? "Don't lose access" : "Don't lose your wallet" }), _jsxs(InlineText, { variant: "bodyS", color: "secondary", weight: "medium", children: ["Your", ' ', _jsx(InlineText, { variant: "bodyS", weight: "medium", children: "Recovery Secret" }), ' ', "ensures you will be able to regain access to your ", hideWallets ? 'account' : 'wallet', " if you lose your Passkey or Password."] })] }), _jsx(SaveRecoverySecret, { email: (authInfo === null || authInfo === void 0 ? void 0 : authInfo.authType) === 'email' ? authInfo.identifier : undefined, value: backupDecryptionKey, onComplete: onComplete })] }));
|
|
51
|
-
};
|
|
52
|
-
const ActionButton = styled(StyledCpslTileButton) `
|
|
53
|
-
flex: 1;
|
|
54
|
-
|
|
55
|
-
--button-icon-color: var(--cpsl-color-text-primary);
|
|
56
|
-
`;
|
|
57
|
-
const ButtonContainer = styled.div `
|
|
58
|
-
display: flex;
|
|
59
|
-
align-items: center;
|
|
60
|
-
justify-content: center;
|
|
61
|
-
gap: 8px;
|
|
62
|
-
width: 100%;
|
|
63
|
-
`;
|
|
64
|
-
const InlineText = styled(CpslText) `
|
|
65
|
-
text-align: center;
|
|
66
|
-
display: inline-block;
|
|
67
|
-
`;
|
|
@@ -1,105 +0,0 @@
|
|
|
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, CpslCodeInput, CpslDivider, CpslIcon, CpslQrCode, CpslSpinner, CpslText, } from '@getpara/react-components';
|
|
12
|
-
import { useEffect, useRef, useState } from 'react';
|
|
13
|
-
import { useModalStore } from '../../stores/index.js';
|
|
14
|
-
import { Heading, QRContainer, FilledDisabledInput, StepContainer, InnerStepContainer } from '../common.js';
|
|
15
|
-
import { ModalStep } from '../../utils/steps.js';
|
|
16
|
-
import { styled } from 'styled-components';
|
|
17
|
-
import { useCopyToClipboard } from '@getpara/react-common';
|
|
18
|
-
import { useInternalClient } from '../../../provider/hooks/utils/useInternalClient.js';
|
|
19
|
-
export const Setup2FAStep = ({ onClose }) => {
|
|
20
|
-
const isLogin = useModalStore(state => state.isLogin());
|
|
21
|
-
const setStep = useModalStore(state => state.setStep);
|
|
22
|
-
const para = useInternalClient();
|
|
23
|
-
const isVerifying = useModalStore(state => state.step === ModalStep.VERIFY_2FA);
|
|
24
|
-
const [copied, copy] = useCopyToClipboard();
|
|
25
|
-
const inputRef = useRef(null);
|
|
26
|
-
const [qrCodeValue, setQrCodeValue] = useState(null);
|
|
27
|
-
const [code, setCode] = useState('');
|
|
28
|
-
const [codeError, setCodeError] = useState('');
|
|
29
|
-
const [isVerifyingCode, setIsVerifyingCode] = useState(false);
|
|
30
|
-
const params = qrCodeValue ? new URL(qrCodeValue).searchParams : undefined;
|
|
31
|
-
const secret = params === null || params === void 0 ? void 0 : params.get('secret');
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
function fetchOtpAuthUrl() {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
try {
|
|
36
|
-
const { uri } = yield para.setup2FA();
|
|
37
|
-
setQrCodeValue(uri);
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
console.error('Error fetching OTPAuth URL:', error);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
fetchOtpAuthUrl();
|
|
45
|
-
}, []);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
// Using a small timeout here to ensure the input is mounted before attempting focus
|
|
48
|
-
setTimeout(() => {
|
|
49
|
-
var _a, _b, _c;
|
|
50
|
-
(_c = (_b = (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelectorAll('input')) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.focus();
|
|
51
|
-
}, 10);
|
|
52
|
-
}, [isVerifying]);
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
if (code.length === 6) {
|
|
55
|
-
handleSubmitCode();
|
|
56
|
-
}
|
|
57
|
-
}, [code]);
|
|
58
|
-
const handleNext = () => {
|
|
59
|
-
setStep(ModalStep.VERIFY_2FA);
|
|
60
|
-
};
|
|
61
|
-
const handleSkip = () => {
|
|
62
|
-
if (isLogin) {
|
|
63
|
-
setStep(ModalStep.LOGIN_DONE);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
onClose();
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
const handleCodeInput = (e) => {
|
|
70
|
-
if (codeError) {
|
|
71
|
-
setCodeError('');
|
|
72
|
-
}
|
|
73
|
-
setCode(e.detail.value.trim());
|
|
74
|
-
};
|
|
75
|
-
const handleSubmitCode = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
76
|
-
setIsVerifyingCode(true);
|
|
77
|
-
if (code.length === 6 && /^\d+$/.test(code)) {
|
|
78
|
-
try {
|
|
79
|
-
yield para.enable2FA({ verificationCode: code });
|
|
80
|
-
setStep(ModalStep.TWO_FACTOR_DONE);
|
|
81
|
-
}
|
|
82
|
-
catch (e) {
|
|
83
|
-
setCodeError('Incorrect Code');
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
setCodeError('Incorrect Code');
|
|
88
|
-
}
|
|
89
|
-
setIsVerifyingCode(false);
|
|
90
|
-
});
|
|
91
|
-
const handleCopy = () => {
|
|
92
|
-
copy(secret);
|
|
93
|
-
};
|
|
94
|
-
return (_jsxs(StepContainer, { children: [_jsxs(InnerStepContainer, { children: [_jsx(Heading, { variant: "headingS", weight: "bold", children: "Turn on Two-Factor authentication" }), isVerifying && (_jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Please enter the code from your authenticator app." }))] }), _jsx(InnerStepContainer, { children: isVerifying ? (_jsx(_Fragment, { children: isVerifyingCode ? (_jsx(CpslSpinner, {})) : (_jsx("form", { onSubmit: (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
|
-
e.preventDefault();
|
|
96
|
-
yield handleSubmitCode();
|
|
97
|
-
}), children: _jsx(StyledCodeInput, { ref: inputRef, code: code, onCpslInput: handleCodeInput, errorText: codeError, length: 6, onKeyDown: (e) => __awaiter(void 0, void 0, void 0, function* () { return e.key === 'Enter' && (yield handleSubmitCode()); }) }) })) })) : (_jsxs(_Fragment, { children: [_jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Scan with your preferred authenticator app." }), _jsx(QRContainer, { children: !qrCodeValue ? _jsx(CpslSpinner, { size: 100 }) : _jsx(CpslQrCode, { url: qrCodeValue }) })] })) }), !isVerifying && (_jsxs(_Fragment, { children: [_jsx(InnerStepContainer, { children: _jsx(CpslDivider, { children: "or enter the code manually" }) }), _jsx(InnerStepContainer, { children: _jsx(FilledDisabledInput, { disabled: true, value: secret, noAutoDisable: true, children: _jsx(CpslButton, { slot: "end", variant: "ghost", onClick: handleCopy, children: _jsx(CpslIcon, { icon: copied ? 'check' : 'copy' }) }) }) }), _jsxs(InnerStepContainer, { children: [_jsx(CpslButton, { fullWidth: true, onClick: handleNext, children: "Continue" }), _jsx(SkipButton, { variant: "ghost", onClick: handleSkip, children: "Skip" })] })] }))] }));
|
|
98
|
-
};
|
|
99
|
-
const StyledCodeInput = styled(CpslCodeInput) `
|
|
100
|
-
align-self: center;
|
|
101
|
-
`;
|
|
102
|
-
const SkipButton = styled(CpslButton) `
|
|
103
|
-
margin-top: 8px;
|
|
104
|
-
text-decoration: underline;
|
|
105
|
-
`;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import React from 'react';
|
|
14
|
-
export const STRIPE_PUBLISHABLE_KEY = 'pk_live_51MvquNGrzDeP5yP9EgVSMBPQbrbg0oHDjPIIXypePd0jzOFjbadyfO7wBKLHhUtbKIUiEUVC3YYcTJyAmJ8xA7JE00T2UDfYKz';
|
|
15
|
-
export const STRIPE_PUBLISHABLE_KEY_TEST = 'pk_test_51MvquNGrzDeP5yP98WgPaAUgQ50I3OpfPhVfiLO47FBHepJnZRPO62IzZY2uxT5ovhSS10RwcTcnaVil1mcJOzIi00dHapODdS';
|
|
16
|
-
const CryptoElementsContext = React.createContext(null);
|
|
17
|
-
CryptoElementsContext.displayName = 'CryptoElementsContext';
|
|
18
|
-
export const CryptoElements = ({ stripeOnramp, children }) => {
|
|
19
|
-
const [ctx, setContext] = React.useState(() => ({
|
|
20
|
-
onramp: null,
|
|
21
|
-
}));
|
|
22
|
-
React.useEffect(() => {
|
|
23
|
-
let isMounted = true;
|
|
24
|
-
Promise.resolve(stripeOnramp).then(onramp => {
|
|
25
|
-
if (onramp && isMounted) {
|
|
26
|
-
setContext(ctx => (ctx.onramp ? ctx : { onramp }));
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return () => {
|
|
30
|
-
isMounted = false;
|
|
31
|
-
};
|
|
32
|
-
}, [stripeOnramp]);
|
|
33
|
-
return _jsx(CryptoElementsContext.Provider, { value: ctx, children: children });
|
|
34
|
-
};
|
|
35
|
-
// React hook to get StripeOnramp from context
|
|
36
|
-
export const useStripeOnramp = () => {
|
|
37
|
-
const context = React.useContext(CryptoElementsContext);
|
|
38
|
-
return context === null || context === void 0 ? void 0 : context.onramp;
|
|
39
|
-
};
|
|
40
|
-
// React element to render Onramp UI
|
|
41
|
-
const useOnrampSessionListener = (type, session, callback) => {
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
if (session && callback) {
|
|
44
|
-
const listener = e => callback(e.payload);
|
|
45
|
-
session.addEventListener(type, listener);
|
|
46
|
-
return () => {
|
|
47
|
-
session.removeEventListener(type, listener);
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return () => { };
|
|
51
|
-
}, [session, callback, type]);
|
|
52
|
-
};
|
|
53
|
-
export const OnrampElement = (_a) => {
|
|
54
|
-
var { clientSecret, appearance, onReady = () => { }, onSessionChange } = _a, props = __rest(_a, ["clientSecret", "appearance", "onReady", "onSessionChange"]);
|
|
55
|
-
const stripeOnramp = useStripeOnramp();
|
|
56
|
-
const onrampElementRef = React.useRef(null);
|
|
57
|
-
const [session, setSession] = React.useState();
|
|
58
|
-
const appearanceJSON = JSON.stringify(appearance);
|
|
59
|
-
React.useEffect(() => {
|
|
60
|
-
const containerRef = onrampElementRef.current;
|
|
61
|
-
if (containerRef) {
|
|
62
|
-
// NB: ideally we want to be able to hot swap/update onramp iframe
|
|
63
|
-
// This currently results a flash if one needs to mint a new session when they need to udpate fixed transaction details
|
|
64
|
-
containerRef.innerHTML = '';
|
|
65
|
-
if (clientSecret && stripeOnramp) {
|
|
66
|
-
setSession(stripeOnramp
|
|
67
|
-
.createSession({
|
|
68
|
-
clientSecret,
|
|
69
|
-
appearance: { theme: appearance },
|
|
70
|
-
})
|
|
71
|
-
.mount(containerRef));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}, [appearanceJSON, clientSecret, stripeOnramp]);
|
|
75
|
-
useOnrampSessionListener('onramp_ui_loaded', session, onReady);
|
|
76
|
-
useOnrampSessionListener('onramp_session_updated', session, onSessionChange);
|
|
77
|
-
return _jsx("div", Object.assign({}, props, { ref: onrampElementRef }));
|
|
78
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,135 +0,0 @@
|
|
|
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 { useModalStore, useThemeStore, useUserInfoStore } from '../../stores/index.js';
|
|
16
|
-
import { Heading, InnerStepContainer, StepContainer } from '../common.js';
|
|
17
|
-
import { AuthMethod } from '@getpara/core-sdk';
|
|
18
|
-
import { useInternalClient } from '../../../provider/hooks/utils/useInternalClient.js';
|
|
19
|
-
export const VerificationCodeStep = () => {
|
|
20
|
-
const theme = useThemeStore(state => state.theme);
|
|
21
|
-
const authInfo = useUserInfoStore(state => state.getAuthInfo());
|
|
22
|
-
const setStep = useModalStore(state => state.setStep);
|
|
23
|
-
const setWebAuthURLForCreate = useModalStore(state => state.setWebAuthURLForCreate);
|
|
24
|
-
const setIFrameUrl = useModalStore(state => state.setIFrameUrl);
|
|
25
|
-
const setIsIFrameReady = useModalStore(state => state.setIsIFrameReady);
|
|
26
|
-
const isIFrameReady = useModalStore(state => state.isIFrameReady);
|
|
27
|
-
const para = useInternalClient();
|
|
28
|
-
const inputRef = useRef(null);
|
|
29
|
-
const [code, setCode] = useState('');
|
|
30
|
-
const [codeError, setCodeError] = useState('');
|
|
31
|
-
const [resendStatus, setResendStatus] = useState('Resend.');
|
|
32
|
-
const [resendDisabled, setResendDisabled] = useState(false);
|
|
33
|
-
const [isVerifying, setIsVerifying] = useState(false);
|
|
34
|
-
const [shouldRouteToStep, setShouldRouteToStep] = useState();
|
|
35
|
-
const isEmail = (authInfo === null || authInfo === void 0 ? void 0 : authInfo.authType) === 'email';
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
// Using a small timeout here to ensure the input is mounted before attempting focus
|
|
38
|
-
setTimeout(() => {
|
|
39
|
-
var _a, _b;
|
|
40
|
-
(_b = (_a = inputRef.current.shadowRoot.querySelectorAll('input')) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
41
|
-
}, 10);
|
|
42
|
-
}, []);
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (!!shouldRouteToStep && isIFrameReady) {
|
|
45
|
-
// Using a small timeout here to fully ensure the iframe is loaded before triggering any animation
|
|
46
|
-
setTimeout(() => {
|
|
47
|
-
setStep(shouldRouteToStep);
|
|
48
|
-
setIsVerifying(false);
|
|
49
|
-
}, 200);
|
|
50
|
-
}
|
|
51
|
-
}, [shouldRouteToStep, isIFrameReady]);
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (code.length === 6) {
|
|
54
|
-
handleSubmitCode();
|
|
55
|
-
}
|
|
56
|
-
}, [code]);
|
|
57
|
-
const handleResendClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
-
if (!resendDisabled) {
|
|
59
|
-
setResendStatus('Resent!');
|
|
60
|
-
setResendDisabled(true);
|
|
61
|
-
isEmail ? yield para.resendVerificationCode() : yield para.resendVerificationCodeByPhone();
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
setResendStatus('Resend.');
|
|
64
|
-
setResendDisabled(false);
|
|
65
|
-
}, 3000);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
const handleCodeInput = (e) => {
|
|
69
|
-
if (codeError) {
|
|
70
|
-
setCodeError('');
|
|
71
|
-
}
|
|
72
|
-
setCode(e.detail.value.trim());
|
|
73
|
-
};
|
|
74
|
-
const handleSubmitCode = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
-
setIsVerifying(true);
|
|
76
|
-
if (code.length === 6 && /^\d+$/.test(code)) {
|
|
77
|
-
try {
|
|
78
|
-
const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
|
|
79
|
-
if (supportedCreateAuthMethods.has(AuthMethod.PASSWORD) && supportedCreateAuthMethods.has(AuthMethod.PASSKEY)) {
|
|
80
|
-
setIsIFrameReady(false);
|
|
81
|
-
const webAuthUrl = isEmail
|
|
82
|
-
? yield para.verifyEmail({ verificationCode: code })
|
|
83
|
-
: yield para.verifyPhone({ verificationCode: code });
|
|
84
|
-
const passwordAuthUrl = yield para.getSetupPasswordURL({ authType: authInfo === null || authInfo === void 0 ? void 0 : authInfo.authType, theme });
|
|
85
|
-
setWebAuthURLForCreate(yield para.shortenLoginLink(webAuthUrl));
|
|
86
|
-
setIFrameUrl(yield para.shortenLoginLink(passwordAuthUrl));
|
|
87
|
-
setShouldRouteToStep(ModalStep.BIOMETRIC_CREATION);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
else if (supportedCreateAuthMethods.has(AuthMethod.PASSWORD)) {
|
|
91
|
-
setIsIFrameReady(false);
|
|
92
|
-
isEmail ? yield para.verifyEmail({ verificationCode: code }) : yield para.verifyPhone({ verificationCode: code });
|
|
93
|
-
const url = yield para.getSetupPasswordURL({ authType: authInfo === null || authInfo === void 0 ? void 0 : authInfo.authType, theme });
|
|
94
|
-
setIFrameUrl(yield para.shortenLoginLink(url));
|
|
95
|
-
setShouldRouteToStep(ModalStep.PASSWORD_CREATION);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
const url = isEmail
|
|
100
|
-
? yield para.verifyEmail({ verificationCode: code })
|
|
101
|
-
: yield para.verifyPhone({ verificationCode: code });
|
|
102
|
-
setWebAuthURLForCreate(yield para.shortenLoginLink(url));
|
|
103
|
-
setStep(ModalStep.BIOMETRIC_CREATION);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
catch (e) {
|
|
107
|
-
if (e.message.includes('429')) {
|
|
108
|
-
setCodeError('Too many incorrect attempts. Please try again in 10 minutes.');
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
setCodeError('Incorrect code.');
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
setCodeError('Incorrect code.');
|
|
117
|
-
}
|
|
118
|
-
setIsVerifying(false);
|
|
119
|
-
});
|
|
120
|
-
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* () {
|
|
121
|
-
e.preventDefault();
|
|
122
|
-
yield handleSubmitCode();
|
|
123
|
-
}), 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 })] })] })) })] }));
|
|
124
|
-
};
|
|
125
|
-
const StyledCodeInput = styled(CpslCodeInput) `
|
|
126
|
-
align-self: center;
|
|
127
|
-
`;
|
|
128
|
-
const InlineText = styled(CpslText) `
|
|
129
|
-
text-align: center;
|
|
130
|
-
display: inline-block;
|
|
131
|
-
`;
|
|
132
|
-
const ClickableText = styled(InlineText) `
|
|
133
|
-
cursor: pointer;
|
|
134
|
-
display: inline-block;
|
|
135
|
-
`;
|
|
@@ -1,6 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
`;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { 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
|
-
import { useWalletState } from '../../../provider/index.js';
|
|
8
|
-
import { useInternalClient } from '../../../provider/hooks/utils/useInternalClient.js';
|
|
9
|
-
export const ExternalWalletCard = ({ address, showAddFunds }) => {
|
|
10
|
-
const para = useInternalClient();
|
|
11
|
-
const wallet = para.externalWallets[address];
|
|
12
|
-
if (!wallet) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return (_jsx(SharedWalletCard, { address: truncateAddress(wallet.address, wallet.type), identiconHash: para.getIdenticonHash(wallet.id, wallet.type), showAddFunds: showAddFunds }));
|
|
16
|
-
};
|
|
17
|
-
export const WalletCard = ({ id, type, showAddFunds }) => {
|
|
18
|
-
var _a;
|
|
19
|
-
const para = useInternalClient();
|
|
20
|
-
const appName = useThemeStore(state => state.appName);
|
|
21
|
-
const wallet = para.findWallet(id, type);
|
|
22
|
-
if (!wallet) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
const address = para.getDisplayAddress(wallet.id, { addressType: type });
|
|
26
|
-
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 }));
|
|
27
|
-
};
|
|
28
|
-
const SharedWalletCard = ({ address, name, identiconHash, showAddFunds, id, type }) => {
|
|
29
|
-
const onRampConfig = useModalStore(state => state.onRampConfig);
|
|
30
|
-
const { setSelectedWallet } = useWalletState();
|
|
31
|
-
const setStep = useModalStore(state => state.setStep);
|
|
32
|
-
const isAddFundsEnabled = onRampConfig.isBuyEnabled || onRampConfig.isReceiveEnabled;
|
|
33
|
-
const handleAddFundsClick = () => {
|
|
34
|
-
if (id && type) {
|
|
35
|
-
setSelectedWallet({ id, type });
|
|
36
|
-
isAddFundsEnabled && setStep(onRampConfig.isBuyEnabled ? ModalStep.ADD_FUNDS_BUY : ModalStep.ADD_FUNDS_RECEIVE);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
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" }) }))] }));
|
|
40
|
-
};
|
|
41
|
-
export const WalletCards = styled.div `
|
|
42
|
-
display: flex;
|
|
43
|
-
flex-direction: column;
|
|
44
|
-
gap: 8px;
|
|
45
|
-
width: 100%;
|
|
46
|
-
`;
|
|
47
|
-
const Container = styled.div `
|
|
48
|
-
width: 100%;
|
|
49
|
-
padding: 24px;
|
|
50
|
-
display: flex;
|
|
51
|
-
justify-content: space-between;
|
|
52
|
-
align-items: center;
|
|
53
|
-
gap: 16px;
|
|
54
|
-
background-color: var(--cpsl-color-background-8);
|
|
55
|
-
border-radius: 16px;
|
|
56
|
-
`;
|
|
57
|
-
const InnerContainer = styled.div `
|
|
58
|
-
display: flex;
|
|
59
|
-
justify-content: flex-start;
|
|
60
|
-
gap: 4px;
|
|
61
|
-
align-items: center;
|
|
62
|
-
overflow: hidden;
|
|
63
|
-
`;
|
|
64
|
-
const WalletNameContainer = styled.div `
|
|
65
|
-
flex: 1;
|
|
66
|
-
display: flex;
|
|
67
|
-
flex-direction: column;
|
|
68
|
-
gap: 4px;
|
|
69
|
-
align-items: flex-start;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
overflow: hidden;
|
|
72
|
-
`;
|
|
73
|
-
const Name = styled(CpslText) `
|
|
74
|
-
width: 100%;
|
|
75
|
-
&::part(text-element) {
|
|
76
|
-
line-height: 100%;
|
|
77
|
-
text-overflow: ellipsis;
|
|
78
|
-
overflow: hidden;
|
|
79
|
-
white-space: nowrap;
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
82
|
-
const AddFundsButton = styled(CpslButton) `
|
|
83
|
-
--button-primary-background-color: var(--cpsl-color-card-surface);
|
|
84
|
-
--button-primary-hover-background-color: var(--cpsl-color-background-4);
|
|
85
|
-
--button-primary-color: var(--cpsl-color-text-contrast);
|
|
86
|
-
--button-primary-hover-color: var(--cpsl-color-text-contrast);
|
|
87
|
-
--button-primary-active-color: var(--cpsl-color-text-contrast);
|
|
88
|
-
--button-padding-start: 8px;
|
|
89
|
-
--button-padding-end: 8px;
|
|
90
|
-
--button-padding-top: 8px;
|
|
91
|
-
--button-padding-bottom: 8px;
|
|
92
|
-
--button-border-radius: 8px;
|
|
93
|
-
`;
|
|
@@ -1,50 +0,0 @@
|
|
|
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 { 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
|
-
import { useInternalClient } from '../../../provider/hooks/utils/useInternalClient.js';
|
|
18
|
-
export const WalletCreationDoneStep = ({ twoFactorAuthEnabled, onClose }) => {
|
|
19
|
-
const hideWallets = useThemeStore(state => state.hideWallets);
|
|
20
|
-
const setStep = useModalStore(state => state.setStep);
|
|
21
|
-
const isLogin = useModalStore(state => state.isLogin());
|
|
22
|
-
const onRampConfig = useModalStore(state => state.onRampConfig);
|
|
23
|
-
const para = useInternalClient();
|
|
24
|
-
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);
|
|
25
|
-
const handleNext = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
-
if (isLogin) {
|
|
27
|
-
if (!twoFactorAuthEnabled) {
|
|
28
|
-
setStep(ModalStep.LOGIN_DONE);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const is2FAComplete = yield para.check2FAStatus();
|
|
32
|
-
setStep(is2FAComplete ? ModalStep.LOGIN_DONE : ModalStep.SETUP_2FA);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
if (twoFactorAuthEnabled) {
|
|
36
|
-
setStep(ModalStep.SETUP_2FA);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
onClose();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
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]) => {
|
|
44
|
-
return _jsx(WalletCard, { id: id, type: type, showAddFunds: isOnRampConfigured }, id);
|
|
45
|
-
}) })) }), _jsx(InnerStepContainer, { children: _jsx(CpslButton, { fullWidth: true, onClick: handleNext, children: twoFactorAuthEnabled ? 'Continue' : 'Done' }) })] }));
|
|
46
|
-
};
|
|
47
|
-
const CardContainer = styled(InnerStepContainer) `
|
|
48
|
-
min-height: 196px;
|
|
49
|
-
justify-content: center;
|
|
50
|
-
`;
|