@getpara/react-sdk 1.6.0 → 1.6.1-dev.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.js +6 -6367
- package/dist/modal/ParaModal.js +337 -0
- package/dist/modal/components/Account/Account.js +69 -0
- package/dist/modal/components/AddFunds/AddFunds.js +220 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +72 -0
- package/dist/modal/components/AddFunds/AddFundsDone.js +43 -0
- package/dist/{MoonPayEmbed-Q2HP2BFI.js → modal/components/AddFunds/MoonPayEmbed.js} +1 -3
- package/dist/modal/components/AddFunds/index.js +4 -0
- package/dist/modal/components/AuthInput/AuthInput.js +283 -0
- package/dist/modal/components/AuthInput/countryCodes.js +42 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
- package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +37 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +113 -0
- package/dist/modal/components/AuthOptions/AuthOptions.js +33 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +44 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +52 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +93 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
- package/dist/modal/components/Body/Body.js +304 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +94 -0
- package/dist/modal/components/ChainSwitch/config.js +17 -0
- package/dist/modal/components/Controls/Controls.js +74 -0
- package/dist/modal/components/Controls/Selects.js +213 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +151 -0
- package/dist/modal/components/ExternalWalletStep/config.js +17 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +172 -0
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +123 -0
- package/dist/modal/components/Footer/Footer.js +93 -0
- package/dist/modal/components/Header/Header.js +43 -0
- package/dist/modal/components/Header/hooks/useStepTitle.js +50 -0
- package/dist/modal/components/Hero/Hero.js +122 -0
- package/dist/modal/components/IFrameStep/IFrameStep.js +55 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +28 -0
- package/dist/modal/components/ModalContent/ModalContent.js +310 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +81 -0
- package/dist/modal/components/OAuth/OAuth.js +153 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +139 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +101 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +141 -0
- package/dist/modal/components/StripeComponents/StripeComponents.js +88 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +24 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +159 -0
- package/dist/modal/components/Waiting/Waiting.js +17 -0
- package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
- package/dist/modal/components/WalletCard/WalletCard.js +127 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +52 -0
- package/dist/modal/components/common.js +83 -0
- package/dist/modal/components/index.js +2 -0
- package/dist/modal/constants/constants.js +111 -0
- package/dist/modal/constants/defaults.js +10 -0
- package/dist/modal/constants/oAuthLogos.js +24 -0
- package/dist/modal/hooks/useActiveWallet.js +15 -0
- package/dist/modal/hooks/useCreateAccount.js +72 -0
- package/dist/modal/hooks/useEmbeddedExternalConnection.js +39 -0
- package/dist/modal/hooks/useGoBack.js +35 -0
- package/dist/modal/hooks/useSetLoginURLs.d.ts +8 -0
- package/dist/modal/hooks/useSetLoginURLs.js +45 -0
- package/dist/modal/index.js +32 -0
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +34 -0
- package/dist/modal/providers/EvmExternalWalletContextStub.js +38 -0
- package/dist/modal/providers/ExternalWalletContext.js +275 -0
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +19 -0
- package/dist/modal/stores/externalWalletProvider/actions.js +10 -0
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +20 -0
- package/dist/modal/stores/index.js +4 -0
- package/dist/modal/stores/modal/actions.js +70 -0
- package/dist/modal/stores/modal/useModalStore.js +65 -0
- package/dist/modal/stores/theme/actions.js +28 -0
- package/dist/modal/stores/theme/useThemeStore.js +21 -0
- package/dist/modal/stores/userInfo/actions.js +30 -0
- package/dist/modal/stores/userInfo/useUserInfoStore.js +17 -0
- package/dist/modal/types/commonTypes.js +1 -0
- package/dist/modal/types/externalWallets.js +31 -0
- package/dist/modal/types/modalProps.js +12 -0
- package/dist/modal/utils/authLayoutHelpers.js +8 -0
- package/dist/modal/utils/getMailtoLink.js +10 -0
- package/dist/modal/utils/getTileButtonFlex.js +20 -0
- package/dist/modal/utils/openPopup.js +60 -0
- package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
- package/dist/modal/utils/steps.js +228 -0
- package/dist/modal/utils/stringFormatters.js +14 -0
- package/dist/modal/utils/validateOnRampConfig.js +32 -0
- package/dist/provider/ParaProvider.js +22 -0
- package/dist/provider/actions/checkIfUserExists.js +21 -0
- package/dist/provider/actions/createUser.js +26 -0
- package/dist/provider/actions/getAccount.js +22 -0
- package/dist/provider/actions/getWallet.js +14 -0
- package/dist/provider/actions/initiateLogin.js +20 -0
- package/dist/provider/actions/keepSessionAlive.js +20 -0
- package/dist/provider/actions/logout.js +17 -0
- package/dist/provider/actions/signMessage.js +20 -0
- package/dist/provider/actions/signTransaction.js +20 -0
- package/dist/provider/actions/waitForAccountCreation.js +21 -0
- package/dist/provider/actions/waitForLoginAndSetup.js +24 -0
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +21 -0
- package/dist/provider/hooks/index.js +4 -0
- package/dist/provider/hooks/mutations/index.js +24 -0
- package/dist/provider/hooks/mutations/useCheckIfUserExists.js +23 -0
- package/dist/provider/hooks/mutations/useCreateUser.js +20 -0
- package/dist/provider/hooks/mutations/useInitiateLogin.js +23 -0
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +20 -0
- package/dist/provider/hooks/mutations/useLogout.js +30 -0
- package/dist/provider/hooks/mutations/useSignMessage.js +33 -0
- package/dist/provider/hooks/mutations/useSignTransaction.js +33 -0
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +30 -0
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +30 -0
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +30 -0
- package/dist/provider/hooks/queries/index.js +8 -0
- package/dist/provider/hooks/queries/useAccount.js +21 -0
- package/dist/provider/hooks/queries/useWallet.js +22 -0
- package/dist/provider/hooks/utils/index.js +10 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
- package/dist/provider/hooks/utils/useClient.js +10 -0
- package/dist/provider/hooks/utils/useEventListeners.js +105 -0
- package/dist/provider/hooks/utils/useInternalClient.js +10 -0
- package/dist/provider/hooks/utils/useModal.js +17 -0
- package/dist/provider/hooks/utils/useWalletState.js +33 -0
- package/dist/provider/index.js +8 -0
- package/dist/provider/stores/getters.js +13 -0
- package/dist/provider/stores/slices/client.js +9 -0
- package/dist/provider/stores/slices/index.js +4 -0
- package/dist/provider/stores/slices/modal.js +9 -0
- package/dist/provider/stores/slices/wallet.js +11 -0
- package/dist/provider/stores/types.js +1 -0
- package/dist/provider/stores/useStore.js +27 -0
- package/dist/provider/types/provider.js +1 -0
- package/dist/provider/types/query.js +1 -0
- package/dist/provider/types/utils.js +1 -0
- package/dist/provider/utils/renameMutations.js +16 -0
- package/package.json +2 -2
- package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
- package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
- package/dist/chunk-MMUBH76A.js.br +0 -0
- package/dist/chunk-MMUBH76A.js.gz +0 -0
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { OnRampPurchaseStatus } from "@getpara/web-sdk";
|
|
5
|
+
import { SpinnerContainer } from "../common.js";
|
|
6
|
+
import { ON_RAMP_PROVIDERS } from "../../constants/constants.js";
|
|
7
|
+
import { useModalStore } from "../../stores/index.js";
|
|
8
|
+
import { CpslSpinner, CpslText } from "@getpara/react-components";
|
|
9
|
+
const AddingFunds = () => {
|
|
10
|
+
const onRampPurchase = useModalStore((state) => state.onRampPurchase);
|
|
11
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
|
+
/* @__PURE__ */ jsx(SpinnerContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) }),
|
|
13
|
+
/* @__PURE__ */ jsxs(CpslText, { children: [
|
|
14
|
+
"Follow the prompts presented by",
|
|
15
|
+
" ",
|
|
16
|
+
OnRampPurchaseStatus ? ON_RAMP_PROVIDERS[onRampPurchase.provider].name : "the provider",
|
|
17
|
+
"."
|
|
18
|
+
] })
|
|
19
|
+
] });
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
AddingFunds
|
|
23
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { ON_RAMP_PROVIDERS } from "../../constants/constants.js";
|
|
8
|
+
import styled from "styled-components";
|
|
9
|
+
import { CpslButton, CpslIcon, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
10
|
+
import { motion } from "framer-motion";
|
|
11
|
+
const OnRampProviderButton = ({ config, index, onClick: _onClick }) => {
|
|
12
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
13
|
+
const provider = config.providers[index];
|
|
14
|
+
const { feeLower, feeUpper, name, icon, backgroundColors } = ON_RAMP_PROVIDERS[provider];
|
|
15
|
+
const feeString = `Fee ${feeLower}% - ${feeUpper}%`;
|
|
16
|
+
const onClick = () => __async(void 0, null, function* () {
|
|
17
|
+
setIsLoading(true);
|
|
18
|
+
yield _onClick();
|
|
19
|
+
setIsLoading(false);
|
|
20
|
+
});
|
|
21
|
+
return /* @__PURE__ */ jsx(StyledButton, { $gradientColors: backgroundColors, fullWidth: true, onClick, children: /* @__PURE__ */ jsxs(Container, { $backgroundColor: backgroundColors[1], children: [
|
|
22
|
+
/* @__PURE__ */ jsx(IconContainer, { children: /* @__PURE__ */ jsx(CpslIcon, { icon }) }),
|
|
23
|
+
/* @__PURE__ */ jsxs(ProviderInfoContainer, { children: [
|
|
24
|
+
/* @__PURE__ */ jsx(Text, { variant: "bodyL", weight: "medium", children: name }),
|
|
25
|
+
/* @__PURE__ */ jsx(ProviderInfoInnerContainer, { children: /* @__PURE__ */ jsx(Text, { variant: "bodyXS", weight: "medium", children: feeString }) })
|
|
26
|
+
] }),
|
|
27
|
+
isLoading ? /* @__PURE__ */ jsx(CpslSpinner, { size: 16 }) : /* @__PURE__ */ jsx(Chevron, { icon: "chevronUp" })
|
|
28
|
+
] }) });
|
|
29
|
+
};
|
|
30
|
+
const StyledButton = styled(CpslButton)`
|
|
31
|
+
width: 100%;
|
|
32
|
+
--button-primary-background-color: ${({ $gradientColors }) => `linear-gradient(90deg, ${$gradientColors[0]} 0%, ${$gradientColors[1]} 100%)`};
|
|
33
|
+
--button-primary-hover-background-color: ${({ $gradientColors }) => `linear-gradient(90deg, ${$gradientColors[0]} 0%, ${$gradientColors[0]} 100%)`};
|
|
34
|
+
--button-primary-active-background-color: ${({ $gradientColors }) => `linear-gradient(90deg, ${$gradientColors[0]} 0%, ${$gradientColors[0]} 100%)`};
|
|
35
|
+
`;
|
|
36
|
+
const Container = styled(motion.div)`
|
|
37
|
+
display: flex;
|
|
38
|
+
gap: 8px;
|
|
39
|
+
flex: 1;
|
|
40
|
+
align-items: center;
|
|
41
|
+
|
|
42
|
+
& cpsl-spinner {
|
|
43
|
+
--background-color: ${({ $backgroundColor }) => `${$backgroundColor}`};
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
const ProviderInfoContainer = styled.div`
|
|
47
|
+
flex: 1;
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
align-items: start;
|
|
51
|
+
gap: 2px;
|
|
52
|
+
`;
|
|
53
|
+
const ProviderInfoInnerContainer = styled.div`
|
|
54
|
+
display: flex;
|
|
55
|
+
gap: 16px;
|
|
56
|
+
`;
|
|
57
|
+
const IconContainer = styled.span`
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
background-color: #fff;
|
|
62
|
+
border-radius: 100%;
|
|
63
|
+
height: 48px;
|
|
64
|
+
width: 48px;
|
|
65
|
+
`;
|
|
66
|
+
const Text = styled(CpslText)`
|
|
67
|
+
&::part(text-element) {
|
|
68
|
+
color: #fff;
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
const Chevron = styled(CpslIcon)`
|
|
72
|
+
transform: rotate(90deg);
|
|
73
|
+
--icon-color: #fff;
|
|
74
|
+
`;
|
|
75
|
+
export {
|
|
76
|
+
OnRampProviderButton
|
|
77
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { CpslButton, CpslText } from "@getpara/react-components";
|
|
7
|
+
import { useModalStore, useThemeStore, useUserInfoStore } from "../../stores/index.js";
|
|
8
|
+
import { ModalStep } from "../../utils/steps.js";
|
|
9
|
+
import { Heading, InnerStepContainer, StepContainer, StyledCpslTileButton } from "../common.js";
|
|
10
|
+
import { styled } from "styled-components";
|
|
11
|
+
import { useCopyToClipboard } from "@getpara/react-common";
|
|
12
|
+
import { getMailtoLink } from "../../utils/getMailtoLink.js";
|
|
13
|
+
import { useState } from "react";
|
|
14
|
+
const SaveRecoverySecret = ({
|
|
15
|
+
email,
|
|
16
|
+
value,
|
|
17
|
+
onComplete
|
|
18
|
+
}) => {
|
|
19
|
+
const [isSecretSaved, setIsSecretSaved] = useState(false);
|
|
20
|
+
const [isCopied, copy] = useCopyToClipboard();
|
|
21
|
+
const onCopy = () => {
|
|
22
|
+
copy(value);
|
|
23
|
+
setIsSecretSaved(true);
|
|
24
|
+
};
|
|
25
|
+
const onDownload = () => {
|
|
26
|
+
const element = document.createElement("a");
|
|
27
|
+
const file = new Blob([value], { type: "text/plain" });
|
|
28
|
+
element.href = URL.createObjectURL(file);
|
|
29
|
+
element.download = "recovery.txt";
|
|
30
|
+
document.body.appendChild(element);
|
|
31
|
+
element.click();
|
|
32
|
+
setIsSecretSaved(true);
|
|
33
|
+
};
|
|
34
|
+
const onEmail = () => {
|
|
35
|
+
typeof window !== "undefined" && window.open(getMailtoLink(email, value), "_self");
|
|
36
|
+
setIsSecretSaved(true);
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
|
+
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Heading, { variant: "headingXS", weight: "semiBold", children: "Save your Recovery Secret" }),
|
|
41
|
+
/* @__PURE__ */ jsxs(ButtonContainer, { children: [
|
|
42
|
+
/* @__PURE__ */ jsx(ActionButton, { icon: "download", onClick: onDownload, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Download" }) }),
|
|
43
|
+
/* @__PURE__ */ jsx(ActionButton, { icon: isCopied ? "check" : "copy", onClick: onCopy, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: isCopied ? "Copied!" : "Copy" }) }),
|
|
44
|
+
/* @__PURE__ */ jsx(ActionButton, { icon: "send", onClick: onEmail, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Email" }) })
|
|
45
|
+
] })
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: onComplete, disabled: !isSecretSaved, children: !isSecretSaved ? "Choose an option above to continue" : "I\u2019ve saved my recovery secret" }) })
|
|
48
|
+
] });
|
|
49
|
+
};
|
|
50
|
+
const RecoverySecretStep = () => {
|
|
51
|
+
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
52
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
53
|
+
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
54
|
+
const recoveryShare = useUserInfoStore((state) => state.recoveryShare);
|
|
55
|
+
const backupDecryptionKey = JSON.parse(recoveryShare || "{}").backupDecryptionKey;
|
|
56
|
+
const onComplete = () => __async(void 0, null, function* () {
|
|
57
|
+
setStep(ModalStep.WALLET_CREATION_DONE);
|
|
58
|
+
});
|
|
59
|
+
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
60
|
+
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
61
|
+
/* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: hideWallets ? "Don't lose access" : "Don't lose your wallet" }),
|
|
62
|
+
/* @__PURE__ */ jsxs(InlineText, { variant: "bodyS", color: "secondary", weight: "medium", children: [
|
|
63
|
+
"Your",
|
|
64
|
+
" ",
|
|
65
|
+
/* @__PURE__ */ jsx(InlineText, { variant: "bodyS", weight: "medium", children: "Recovery Secret" }),
|
|
66
|
+
" ",
|
|
67
|
+
"ensures you will be able to regain access to your ",
|
|
68
|
+
hideWallets ? "account" : "wallet",
|
|
69
|
+
" if you lose your Passkey or Password."
|
|
70
|
+
] })
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
SaveRecoverySecret,
|
|
74
|
+
{
|
|
75
|
+
email: (authInfo == null ? void 0 : authInfo.authType) === "email" ? authInfo.identifier : void 0,
|
|
76
|
+
value: backupDecryptionKey,
|
|
77
|
+
onComplete
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] });
|
|
81
|
+
};
|
|
82
|
+
const ActionButton = styled(StyledCpslTileButton)`
|
|
83
|
+
flex: 1;
|
|
84
|
+
|
|
85
|
+
--button-icon-color: var(--cpsl-color-text-primary);
|
|
86
|
+
`;
|
|
87
|
+
const ButtonContainer = styled.div`
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
gap: 8px;
|
|
92
|
+
width: 100%;
|
|
93
|
+
`;
|
|
94
|
+
const InlineText = styled(CpslText)`
|
|
95
|
+
text-align: center;
|
|
96
|
+
display: inline-block;
|
|
97
|
+
`;
|
|
98
|
+
export {
|
|
99
|
+
RecoverySecretStep,
|
|
100
|
+
SaveRecoverySecret
|
|
101
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import {
|
|
7
|
+
CpslButton,
|
|
8
|
+
CpslCodeInput,
|
|
9
|
+
CpslDivider,
|
|
10
|
+
CpslIcon,
|
|
11
|
+
CpslQrCode,
|
|
12
|
+
CpslSpinner,
|
|
13
|
+
CpslText
|
|
14
|
+
} from "@getpara/react-components";
|
|
15
|
+
import { useEffect, useRef, useState } from "react";
|
|
16
|
+
import { useModalStore } from "../../stores/index.js";
|
|
17
|
+
import { Heading, QRContainer, FilledDisabledInput, StepContainer, InnerStepContainer } from "../common.js";
|
|
18
|
+
import { ModalStep } from "../../utils/steps.js";
|
|
19
|
+
import { styled } from "styled-components";
|
|
20
|
+
import { useCopyToClipboard } from "@getpara/react-common";
|
|
21
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
22
|
+
const Setup2FAStep = ({ onClose }) => {
|
|
23
|
+
const isLogin = useModalStore((state) => state.isLogin());
|
|
24
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
25
|
+
const para = useInternalClient();
|
|
26
|
+
const isVerifying = useModalStore((state) => state.step === ModalStep.VERIFY_2FA);
|
|
27
|
+
const [copied, copy] = useCopyToClipboard();
|
|
28
|
+
const inputRef = useRef(null);
|
|
29
|
+
const [qrCodeValue, setQrCodeValue] = useState(null);
|
|
30
|
+
const [code, setCode] = useState("");
|
|
31
|
+
const [codeError, setCodeError] = useState("");
|
|
32
|
+
const [isVerifyingCode, setIsVerifyingCode] = useState(false);
|
|
33
|
+
const params = qrCodeValue ? new URL(qrCodeValue).searchParams : void 0;
|
|
34
|
+
const secret = params == null ? void 0 : params.get("secret");
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
function fetchOtpAuthUrl() {
|
|
37
|
+
return __async(this, null, function* () {
|
|
38
|
+
try {
|
|
39
|
+
const { uri } = yield para.setup2FA();
|
|
40
|
+
setQrCodeValue(uri);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error("Error fetching OTPAuth URL:", error);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
fetchOtpAuthUrl();
|
|
47
|
+
}, []);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
var _a, _b, _c;
|
|
51
|
+
(_c = (_b = (_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.shadowRoot.querySelectorAll("input")) == null ? void 0 : _b[0]) == null ? void 0 : _c.focus();
|
|
52
|
+
}, 10);
|
|
53
|
+
}, [isVerifying]);
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (code.length === 6) {
|
|
56
|
+
handleSubmitCode();
|
|
57
|
+
}
|
|
58
|
+
}, [code]);
|
|
59
|
+
const handleNext = () => {
|
|
60
|
+
setStep(ModalStep.VERIFY_2FA);
|
|
61
|
+
};
|
|
62
|
+
const handleSkip = () => {
|
|
63
|
+
if (isLogin) {
|
|
64
|
+
setStep(ModalStep.LOGIN_DONE);
|
|
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 = () => __async(void 0, null, 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
|
+
} catch (e) {
|
|
82
|
+
setCodeError("Incorrect Code");
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
setCodeError("Incorrect Code");
|
|
86
|
+
}
|
|
87
|
+
setIsVerifyingCode(false);
|
|
88
|
+
});
|
|
89
|
+
const handleCopy = () => {
|
|
90
|
+
copy(secret);
|
|
91
|
+
};
|
|
92
|
+
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
93
|
+
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
94
|
+
/* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Turn on Two-Factor authentication" }),
|
|
95
|
+
isVerifying && /* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Please enter the code from your authenticator app." })
|
|
96
|
+
] }),
|
|
97
|
+
/* @__PURE__ */ jsx(InnerStepContainer, { children: isVerifying ? /* @__PURE__ */ jsx(Fragment, { children: isVerifyingCode ? /* @__PURE__ */ jsx(CpslSpinner, {}) : /* @__PURE__ */ jsx(
|
|
98
|
+
"form",
|
|
99
|
+
{
|
|
100
|
+
onSubmit: (e) => __async(void 0, null, function* () {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
yield handleSubmitCode();
|
|
103
|
+
}),
|
|
104
|
+
children: /* @__PURE__ */ jsx(
|
|
105
|
+
StyledCodeInput,
|
|
106
|
+
{
|
|
107
|
+
ref: inputRef,
|
|
108
|
+
code,
|
|
109
|
+
onCpslInput: handleCodeInput,
|
|
110
|
+
errorText: codeError,
|
|
111
|
+
length: 6,
|
|
112
|
+
onKeyDown: (e) => __async(void 0, null, function* () {
|
|
113
|
+
return e.key === "Enter" && (yield handleSubmitCode());
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
119
|
+
/* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Scan with your preferred authenticator app." }),
|
|
120
|
+
/* @__PURE__ */ jsx(QRContainer, { children: !qrCodeValue ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: qrCodeValue }) })
|
|
121
|
+
] }) }),
|
|
122
|
+
!isVerifying && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
123
|
+
/* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslDivider, { children: "or enter the code manually" }) }),
|
|
124
|
+
/* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(FilledDisabledInput, { disabled: true, value: secret, noAutoDisable: true, children: /* @__PURE__ */ jsx(CpslButton, { slot: "end", variant: "ghost", onClick: handleCopy, children: /* @__PURE__ */ jsx(CpslIcon, { icon: copied ? "check" : "copy" }) }) }) }),
|
|
125
|
+
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
126
|
+
/* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: handleNext, children: "Continue" }),
|
|
127
|
+
/* @__PURE__ */ jsx(SkipButton, { variant: "ghost", onClick: handleSkip, children: "Skip" })
|
|
128
|
+
] })
|
|
129
|
+
] })
|
|
130
|
+
] });
|
|
131
|
+
};
|
|
132
|
+
const StyledCodeInput = styled(CpslCodeInput)`
|
|
133
|
+
align-self: center;
|
|
134
|
+
`;
|
|
135
|
+
const SkipButton = styled(CpslButton)`
|
|
136
|
+
margin-top: 8px;
|
|
137
|
+
text-decoration: underline;
|
|
138
|
+
`;
|
|
139
|
+
export {
|
|
140
|
+
Setup2FAStep
|
|
141
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import React from "react";
|
|
9
|
+
const STRIPE_PUBLISHABLE_KEY = "pk_live_51MvquNGrzDeP5yP9EgVSMBPQbrbg0oHDjPIIXypePd0jzOFjbadyfO7wBKLHhUtbKIUiEUVC3YYcTJyAmJ8xA7JE00T2UDfYKz";
|
|
10
|
+
const STRIPE_PUBLISHABLE_KEY_TEST = "pk_test_51MvquNGrzDeP5yP98WgPaAUgQ50I3OpfPhVfiLO47FBHepJnZRPO62IzZY2uxT5ovhSS10RwcTcnaVil1mcJOzIi00dHapODdS";
|
|
11
|
+
const CryptoElementsContext = React.createContext(null);
|
|
12
|
+
CryptoElementsContext.displayName = "CryptoElementsContext";
|
|
13
|
+
const CryptoElements = ({ stripeOnramp, children }) => {
|
|
14
|
+
const [ctx, setContext] = React.useState(() => ({
|
|
15
|
+
onramp: null
|
|
16
|
+
}));
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
let isMounted = true;
|
|
19
|
+
Promise.resolve(stripeOnramp).then((onramp) => {
|
|
20
|
+
if (onramp && isMounted) {
|
|
21
|
+
setContext((ctx2) => ctx2.onramp ? ctx2 : { onramp });
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return () => {
|
|
25
|
+
isMounted = false;
|
|
26
|
+
};
|
|
27
|
+
}, [stripeOnramp]);
|
|
28
|
+
return /* @__PURE__ */ jsx(CryptoElementsContext.Provider, { value: ctx, children });
|
|
29
|
+
};
|
|
30
|
+
const useStripeOnramp = () => {
|
|
31
|
+
const context = React.useContext(CryptoElementsContext);
|
|
32
|
+
return context == null ? void 0 : context.onramp;
|
|
33
|
+
};
|
|
34
|
+
const useOnrampSessionListener = (type, session, callback) => {
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
if (session && callback) {
|
|
37
|
+
const listener = (e) => callback(e.payload);
|
|
38
|
+
session.addEventListener(type, listener);
|
|
39
|
+
return () => {
|
|
40
|
+
session.removeEventListener(type, listener);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return () => {
|
|
44
|
+
};
|
|
45
|
+
}, [session, callback, type]);
|
|
46
|
+
};
|
|
47
|
+
const OnrampElement = (_a) => {
|
|
48
|
+
var _b = _a, {
|
|
49
|
+
clientSecret,
|
|
50
|
+
appearance,
|
|
51
|
+
onReady = () => {
|
|
52
|
+
},
|
|
53
|
+
onSessionChange
|
|
54
|
+
} = _b, props = __objRest(_b, [
|
|
55
|
+
"clientSecret",
|
|
56
|
+
"appearance",
|
|
57
|
+
"onReady",
|
|
58
|
+
"onSessionChange"
|
|
59
|
+
]);
|
|
60
|
+
const stripeOnramp = useStripeOnramp();
|
|
61
|
+
const onrampElementRef = React.useRef(null);
|
|
62
|
+
const [session, setSession] = React.useState();
|
|
63
|
+
const appearanceJSON = JSON.stringify(appearance);
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
const containerRef = onrampElementRef.current;
|
|
66
|
+
if (containerRef) {
|
|
67
|
+
containerRef.innerHTML = "";
|
|
68
|
+
if (clientSecret && stripeOnramp) {
|
|
69
|
+
setSession(
|
|
70
|
+
stripeOnramp.createSession({
|
|
71
|
+
clientSecret,
|
|
72
|
+
appearance: { theme: appearance }
|
|
73
|
+
}).mount(containerRef)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, [appearanceJSON, clientSecret, stripeOnramp]);
|
|
78
|
+
useOnrampSessionListener("onramp_ui_loaded", session, onReady);
|
|
79
|
+
useOnrampSessionListener("onramp_session_updated", session, onSessionChange);
|
|
80
|
+
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, props), { ref: onrampElementRef }));
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
CryptoElements,
|
|
84
|
+
OnrampElement,
|
|
85
|
+
STRIPE_PUBLISHABLE_KEY,
|
|
86
|
+
STRIPE_PUBLISHABLE_KEY_TEST,
|
|
87
|
+
useStripeOnramp
|
|
88
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { CpslButton, CpslText } from "@getpara/react-components";
|
|
5
|
+
import { Heading, StepContainer, InnerStepContainer, HeroIcon } from "../common.js";
|
|
6
|
+
import { useThemeStore } from "../../stores/index.js";
|
|
7
|
+
const TwoFactorDoneStep = ({ onClose }) => {
|
|
8
|
+
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
9
|
+
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
10
|
+
/* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
|
|
11
|
+
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
12
|
+
/* @__PURE__ */ jsx(Heading, { variant: "headingXS", weight: "semiBold", children: "Success" }),
|
|
13
|
+
/* @__PURE__ */ jsxs(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: [
|
|
14
|
+
"Your ",
|
|
15
|
+
hideWallets ? "account" : "wallet",
|
|
16
|
+
" is now protected by 2FA"
|
|
17
|
+
] })
|
|
18
|
+
] }),
|
|
19
|
+
/* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: onClose, children: "Done" })
|
|
20
|
+
] });
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
TwoFactorDoneStep
|
|
24
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { CpslCodeInput, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
7
|
+
import { useEffect, useRef, useState } from "react";
|
|
8
|
+
import { styled } from "styled-components";
|
|
9
|
+
import { ModalStep } from "../../utils/steps.js";
|
|
10
|
+
import { useModalStore, useThemeStore, useUserInfoStore } from "../../stores/index.js";
|
|
11
|
+
import { Heading, InnerStepContainer, StepContainer } from "../common.js";
|
|
12
|
+
import { AuthMethod } from "@getpara/core-sdk";
|
|
13
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
14
|
+
const VerificationCodeStep = () => {
|
|
15
|
+
const theme = useThemeStore((state) => state.theme);
|
|
16
|
+
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
17
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
18
|
+
const setWebAuthURLForCreate = useModalStore((state) => state.setWebAuthURLForCreate);
|
|
19
|
+
const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
|
|
20
|
+
const setIsIFrameReady = useModalStore((state) => state.setIsIFrameReady);
|
|
21
|
+
const setAuthStepRoute = useModalStore((state) => state.setAuthStepRoute);
|
|
22
|
+
const para = useInternalClient();
|
|
23
|
+
const inputRef = useRef(null);
|
|
24
|
+
const [code, setCode] = useState("");
|
|
25
|
+
const [codeError, setCodeError] = useState("");
|
|
26
|
+
const [resendStatus, setResendStatus] = useState("Resend.");
|
|
27
|
+
const [resendDisabled, setResendDisabled] = useState(false);
|
|
28
|
+
const [isVerifying, setIsVerifying] = useState(false);
|
|
29
|
+
const isEmail = (authInfo == null ? void 0 : authInfo.authType) === "email";
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
(_b = (_a = inputRef.current.shadowRoot.querySelectorAll("input")) == null ? void 0 : _a[0]) == null ? void 0 : _b.focus();
|
|
34
|
+
}, 10);
|
|
35
|
+
}, []);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (code.length === 6) {
|
|
38
|
+
handleSubmitCode();
|
|
39
|
+
}
|
|
40
|
+
}, [code]);
|
|
41
|
+
const handleResendClick = () => __async(void 0, null, function* () {
|
|
42
|
+
if (!resendDisabled) {
|
|
43
|
+
setResendStatus("Resent!");
|
|
44
|
+
setResendDisabled(true);
|
|
45
|
+
isEmail ? yield para.resendVerificationCode() : yield para.resendVerificationCodeByPhone();
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
setResendStatus("Resend.");
|
|
48
|
+
setResendDisabled(false);
|
|
49
|
+
}, 3e3);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const handleCodeInput = (e) => {
|
|
53
|
+
if (codeError) {
|
|
54
|
+
setCodeError("");
|
|
55
|
+
}
|
|
56
|
+
setCode(e.detail.value.trim());
|
|
57
|
+
};
|
|
58
|
+
const handleSubmitCode = () => __async(void 0, null, function* () {
|
|
59
|
+
setIsVerifying(true);
|
|
60
|
+
if (code.length === 6 && /^\d+$/.test(code)) {
|
|
61
|
+
try {
|
|
62
|
+
const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
|
|
63
|
+
if (supportedCreateAuthMethods.has(AuthMethod.PASSWORD) && supportedCreateAuthMethods.has(AuthMethod.PASSKEY)) {
|
|
64
|
+
setIsIFrameReady(false);
|
|
65
|
+
const webAuthUrl = isEmail ? yield para.verifyEmail({ verificationCode: code }) : yield para.verifyPhone({ verificationCode: code });
|
|
66
|
+
const passwordAuthUrl = yield para.getSetupPasswordURL({ authType: authInfo == null ? void 0 : authInfo.authType, theme });
|
|
67
|
+
setWebAuthURLForCreate(yield para.shortenLoginLink(webAuthUrl));
|
|
68
|
+
setIFrameUrl(yield para.shortenLoginLink(passwordAuthUrl));
|
|
69
|
+
setAuthStepRoute(ModalStep.BIOMETRIC_CREATION);
|
|
70
|
+
return;
|
|
71
|
+
} else if (supportedCreateAuthMethods.has(AuthMethod.PASSWORD)) {
|
|
72
|
+
setIsIFrameReady(false);
|
|
73
|
+
isEmail ? yield para.verifyEmail({ verificationCode: code }) : yield para.verifyPhone({ verificationCode: code });
|
|
74
|
+
const url = yield para.getSetupPasswordURL({ authType: authInfo == null ? void 0 : authInfo.authType, theme });
|
|
75
|
+
setIFrameUrl(yield para.shortenLoginLink(url));
|
|
76
|
+
setAuthStepRoute(ModalStep.PASSWORD_CREATION);
|
|
77
|
+
return;
|
|
78
|
+
} else {
|
|
79
|
+
const url = isEmail ? yield para.verifyEmail({ verificationCode: code }) : yield para.verifyPhone({ verificationCode: code });
|
|
80
|
+
setWebAuthURLForCreate(yield para.shortenLoginLink(url));
|
|
81
|
+
setStep(ModalStep.BIOMETRIC_CREATION);
|
|
82
|
+
}
|
|
83
|
+
} catch (e) {
|
|
84
|
+
if (e.message.includes("429")) {
|
|
85
|
+
setCodeError("Too many incorrect attempts. Please try again in 10 minutes.");
|
|
86
|
+
} else {
|
|
87
|
+
setCodeError("Incorrect code.");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
setCodeError("Incorrect code.");
|
|
92
|
+
}
|
|
93
|
+
setIsVerifying(false);
|
|
94
|
+
});
|
|
95
|
+
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
96
|
+
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
97
|
+
/* @__PURE__ */ jsxs(Heading, { variant: "headingS", weight: "bold", children: [
|
|
98
|
+
"Verify ",
|
|
99
|
+
isEmail ? "Email" : "Phone Number"
|
|
100
|
+
] }),
|
|
101
|
+
/* @__PURE__ */ jsxs(InlineText, { variant: "bodyS", color: "secondary", children: [
|
|
102
|
+
"Please enter the code we sent to ",
|
|
103
|
+
/* @__PURE__ */ jsx(InlineText, { variant: "bodyS", children: authInfo == null ? void 0 : authInfo.identifier })
|
|
104
|
+
] })
|
|
105
|
+
] }),
|
|
106
|
+
/* @__PURE__ */ jsx(InnerStepContainer, { children: isVerifying ? /* @__PURE__ */ jsx(CpslSpinner, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
"form",
|
|
109
|
+
{
|
|
110
|
+
onSubmit: (e) => __async(void 0, null, function* () {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
yield handleSubmitCode();
|
|
113
|
+
}),
|
|
114
|
+
children: /* @__PURE__ */ jsx(
|
|
115
|
+
StyledCodeInput,
|
|
116
|
+
{
|
|
117
|
+
ref: inputRef,
|
|
118
|
+
length: 6,
|
|
119
|
+
type: "number",
|
|
120
|
+
code,
|
|
121
|
+
onCpslInput: handleCodeInput,
|
|
122
|
+
errorText: codeError,
|
|
123
|
+
onKeyDown: (e) => __async(void 0, null, function* () {
|
|
124
|
+
return e.key === "Enter" && (yield handleSubmitCode());
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ jsxs(InlineText, { variant: "bodyS", color: "secondary", children: [
|
|
131
|
+
"Didn\u2019t receive a code?",
|
|
132
|
+
" ",
|
|
133
|
+
/* @__PURE__ */ jsx(
|
|
134
|
+
ClickableText,
|
|
135
|
+
{
|
|
136
|
+
variant: "bodyS",
|
|
137
|
+
style: { cursor: resendDisabled ? "default" : "pointer" },
|
|
138
|
+
onClick: handleResendClick,
|
|
139
|
+
children: resendStatus
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
] })
|
|
143
|
+
] }) })
|
|
144
|
+
] });
|
|
145
|
+
};
|
|
146
|
+
const StyledCodeInput = styled(CpslCodeInput)`
|
|
147
|
+
align-self: center;
|
|
148
|
+
`;
|
|
149
|
+
const InlineText = styled(CpslText)`
|
|
150
|
+
text-align: center;
|
|
151
|
+
display: inline-block;
|
|
152
|
+
`;
|
|
153
|
+
const ClickableText = styled(InlineText)`
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
display: inline-block;
|
|
156
|
+
`;
|
|
157
|
+
export {
|
|
158
|
+
VerificationCodeStep
|
|
159
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { CpslSpinner, CpslText } from "@getpara/react-components";
|
|
5
|
+
import { Heading, SpinnerContainer, StepContainer, InnerStepContainer } from "../common.js";
|
|
6
|
+
const Waiting = ({ heading, subheading }) => {
|
|
7
|
+
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
8
|
+
/* @__PURE__ */ jsx(SpinnerContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) }),
|
|
9
|
+
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
10
|
+
/* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: heading }),
|
|
11
|
+
/* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: subheading })
|
|
12
|
+
] })
|
|
13
|
+
] });
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
Waiting
|
|
17
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
import { CpslIcon, CpslText } from "@getpara/react-components";
|
|
6
|
+
const PartnerIcon = ({ partner }) => {
|
|
7
|
+
const { logoUrl, displayName, backgroundColor, foregroundColor } = partner;
|
|
8
|
+
if (logoUrl) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Icon, { src: logoUrl });
|
|
10
|
+
}
|
|
11
|
+
return /* @__PURE__ */ jsx(Container, { $backgroundColor: backgroundColor, children: /* @__PURE__ */ jsx(Text, { variant: "bodyXS", $color: foregroundColor, children: displayName[0] }) });
|
|
12
|
+
};
|
|
13
|
+
const Container = styled.div`
|
|
14
|
+
width: 14px;
|
|
15
|
+
height: 14px;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
background-color: ${({ $backgroundColor }) => `${$backgroundColor != null ? $backgroundColor : "var(--cpsl-color-contrast)"}`};
|
|
20
|
+
border-radius: 100%;
|
|
21
|
+
`;
|
|
22
|
+
const Text = styled(CpslText)`
|
|
23
|
+
&::part(text-element) {
|
|
24
|
+
line-height: 100%;
|
|
25
|
+
color: ${({ $color }) => `${$color != null ? $color : "var(--cpsl-color-foreground-0)"}`};
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
const Icon = styled(CpslIcon)`
|
|
29
|
+
--height: 14px;
|
|
30
|
+
--width: 14px;
|
|
31
|
+
`;
|
|
32
|
+
export {
|
|
33
|
+
PartnerIcon
|
|
34
|
+
};
|