@getpara/react-sdk 1.7.0 → 1.8.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 -6657
- package/dist/modal/ParaModal.js +362 -0
- package/dist/modal/components/Account/Account.js +77 -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 +55 -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 +308 -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 +234 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +140 -0
- package/dist/modal/components/ExternalWalletStep/config.js +17 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +96 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +172 -0
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +124 -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 +116 -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 +324 -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.d.ts +6 -6
- package/dist/modal/components/common.js +96 -0
- package/dist/modal/components/index.js +2 -0
- package/dist/modal/constants/constants.d.ts +1 -1
- 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 +54 -0
- package/dist/modal/hooks/useGoBack.js +42 -0
- package/dist/modal/hooks/useSetLoginURLs.js +49 -0
- package/dist/modal/hooks/useWalletBalance.d.ts +4 -0
- package/dist/modal/hooks/useWalletBalance.js +47 -0
- package/dist/modal/index.js +33 -0
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +38 -0
- package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +2 -0
- package/dist/modal/providers/EvmExternalWalletContextStub.js +55 -0
- package/dist/modal/providers/ExternalWalletContext.d.ts +3 -0
- package/dist/modal/providers/ExternalWalletContext.js +394 -0
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +32 -0
- package/dist/modal/stores/externalWalletProvider/actions.js +10 -0
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +21 -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 +32 -0
- package/dist/modal/types/modalProps.d.ts +4 -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 +232 -0
- package/dist/modal/utils/stringFormatters.d.ts +1 -0
- package/dist/modal/utils/stringFormatters.js +19 -0
- package/dist/modal/utils/validateOnRampConfig.js +32 -0
- package/dist/package.json +3 -1
- 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/getWalletBalance.d.ts +2 -0
- package/dist/provider/actions/getWalletBalance.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 +39 -0
- package/dist/provider/hooks/mutations/useSignTransaction.js +39 -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.d.ts +1 -0
- package/dist/provider/hooks/queries/index.js +10 -0
- package/dist/provider/hooks/queries/useAccount.js +21 -0
- package/dist/provider/hooks/queries/useWallet.js +22 -0
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +7 -0
- package/dist/provider/hooks/queries/useWalletBalance.js +26 -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 +13 -0
- package/dist/provider/stores/types.d.ts +2 -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/constants.js +11 -0
- package/dist/provider/utils/renameMutations.js +16 -0
- package/package.json +5 -5
- 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,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
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
import { useModalStore, useThemeStore } from "../../stores/index.js";
|
|
6
|
+
import { CpslButton, CpslIdenticon, CpslText } from "@getpara/react-components";
|
|
7
|
+
import { truncateAddress } from "@getpara/web-sdk";
|
|
8
|
+
import { ModalStep } from "../../utils/steps.js";
|
|
9
|
+
import { useWalletState } from "../../../provider/index.js";
|
|
10
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
11
|
+
const ExternalWalletCard = ({ address, showAddFunds }) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const para = useInternalClient();
|
|
14
|
+
const wallet = para.externalWallets[address];
|
|
15
|
+
if (!wallet) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
SharedWalletCard,
|
|
20
|
+
{
|
|
21
|
+
address: (_a = wallet.ensName) != null ? _a : truncateAddress(wallet.address, wallet.type),
|
|
22
|
+
identiconHash: para.getIdenticonHash(wallet.id, wallet.type),
|
|
23
|
+
showAddFunds
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
const WalletCard = ({ id, type, showAddFunds }) => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const para = useInternalClient();
|
|
30
|
+
const appName = useThemeStore((state) => state.appName);
|
|
31
|
+
const wallet = para.findWallet(id, type);
|
|
32
|
+
if (!wallet) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const address = para.getDisplayAddress(wallet.id, { addressType: type });
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
SharedWalletCard,
|
|
38
|
+
{
|
|
39
|
+
id: wallet.id,
|
|
40
|
+
type: wallet.type,
|
|
41
|
+
address: (_a = wallet.ensName) != null ? _a : truncateAddress(address, type, { prefix: para.cosmosPrefix }),
|
|
42
|
+
name: (_b = wallet.name) != null ? _b : `${appName ? `${appName} ` : ""}Wallet`,
|
|
43
|
+
identiconHash: para.getIdenticonHash(wallet.id, type),
|
|
44
|
+
showAddFunds
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
const SharedWalletCard = ({ address, name, identiconHash, showAddFunds, id, type }) => {
|
|
49
|
+
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
50
|
+
const { setSelectedWallet } = useWalletState();
|
|
51
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
52
|
+
const isAddFundsEnabled = onRampConfig.isBuyEnabled || onRampConfig.isReceiveEnabled;
|
|
53
|
+
const handleAddFundsClick = () => {
|
|
54
|
+
if (id && type) {
|
|
55
|
+
setSelectedWallet({ id, type });
|
|
56
|
+
isAddFundsEnabled && setStep(onRampConfig.isBuyEnabled ? ModalStep.ADD_FUNDS_BUY : ModalStep.ADD_FUNDS_RECEIVE);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
60
|
+
/* @__PURE__ */ jsxs(InnerContainer, { children: [
|
|
61
|
+
/* @__PURE__ */ jsx(CpslIdenticon, { size: "48px", hash: identiconHash }),
|
|
62
|
+
/* @__PURE__ */ jsxs(WalletNameContainer, { children: [
|
|
63
|
+
!!name && /* @__PURE__ */ jsx(Name, { color: "contrast", variant: "bodyL", weight: "semiBold", children: name }),
|
|
64
|
+
/* @__PURE__ */ jsx(Name, { color: "secondary", variant: "bodyS", weight: "medium", children: address })
|
|
65
|
+
] })
|
|
66
|
+
] }),
|
|
67
|
+
showAddFunds && isAddFundsEnabled && /* @__PURE__ */ jsx(AddFundsButton, { onClick: handleAddFundsClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "contrast", weight: "medium", children: "Add Funds" }) })
|
|
68
|
+
] });
|
|
69
|
+
};
|
|
70
|
+
const WalletCards = styled.div`
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
gap: 8px;
|
|
74
|
+
width: 100%;
|
|
75
|
+
`;
|
|
76
|
+
const Container = styled.div`
|
|
77
|
+
width: 100%;
|
|
78
|
+
padding: 24px;
|
|
79
|
+
display: flex;
|
|
80
|
+
justify-content: space-between;
|
|
81
|
+
align-items: center;
|
|
82
|
+
gap: 16px;
|
|
83
|
+
background-color: var(--cpsl-color-background-8);
|
|
84
|
+
border-radius: 16px;
|
|
85
|
+
`;
|
|
86
|
+
const InnerContainer = styled.div`
|
|
87
|
+
display: flex;
|
|
88
|
+
justify-content: flex-start;
|
|
89
|
+
gap: 8px;
|
|
90
|
+
align-items: center;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
`;
|
|
93
|
+
const WalletNameContainer = styled.div`
|
|
94
|
+
flex: 1;
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
gap: 4px;
|
|
98
|
+
align-items: flex-start;
|
|
99
|
+
justify-content: center;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
`;
|
|
102
|
+
const Name = styled(CpslText)`
|
|
103
|
+
width: 100%;
|
|
104
|
+
&::part(text-element) {
|
|
105
|
+
line-height: 100%;
|
|
106
|
+
text-overflow: ellipsis;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
white-space: nowrap;
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
const AddFundsButton = styled(CpslButton)`
|
|
112
|
+
--button-primary-background-color: var(--cpsl-color-card-surface);
|
|
113
|
+
--button-primary-hover-background-color: var(--cpsl-color-background-4);
|
|
114
|
+
--button-primary-color: var(--cpsl-color-text-contrast);
|
|
115
|
+
--button-primary-hover-color: var(--cpsl-color-text-contrast);
|
|
116
|
+
--button-primary-active-color: var(--cpsl-color-text-contrast);
|
|
117
|
+
--button-padding-start: 8px;
|
|
118
|
+
--button-padding-end: 8px;
|
|
119
|
+
--button-padding-top: 8px;
|
|
120
|
+
--button-padding-bottom: 8px;
|
|
121
|
+
--button-border-radius: 8px;
|
|
122
|
+
`;
|
|
123
|
+
export {
|
|
124
|
+
ExternalWalletCard,
|
|
125
|
+
WalletCard,
|
|
126
|
+
WalletCards
|
|
127
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { StepContainer, InnerStepContainer, HeroIcon } from "../common.js";
|
|
8
|
+
import { useModalStore, useThemeStore } from "../../stores/index.js";
|
|
9
|
+
import { ModalStep } from "../../utils/steps.js";
|
|
10
|
+
import { WalletCard, WalletCards } from "../WalletCard/WalletCard.js";
|
|
11
|
+
import styled from "styled-components";
|
|
12
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
13
|
+
const WalletCreationDoneStep = ({ twoFactorAuthEnabled, onClose }) => {
|
|
14
|
+
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
15
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
16
|
+
const isLogin = useModalStore((state) => state.isLogin());
|
|
17
|
+
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
18
|
+
const para = useInternalClient();
|
|
19
|
+
const isOnRampConfigured = (onRampConfig == null ? void 0 : onRampConfig.isBuyEnabled) || (onRampConfig == null ? void 0 : onRampConfig.isReceiveEnabled) || (onRampConfig == null ? void 0 : onRampConfig.isWithdrawEnabled);
|
|
20
|
+
const handleNext = () => __async(void 0, null, function* () {
|
|
21
|
+
if (isLogin) {
|
|
22
|
+
if (!twoFactorAuthEnabled) {
|
|
23
|
+
setStep(ModalStep.LOGIN_DONE);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const is2FAComplete = yield para.check2FAStatus();
|
|
27
|
+
setStep(is2FAComplete ? ModalStep.LOGIN_DONE : ModalStep.SETUP_2FA);
|
|
28
|
+
} else {
|
|
29
|
+
if (twoFactorAuthEnabled) {
|
|
30
|
+
setStep(ModalStep.SETUP_2FA);
|
|
31
|
+
} else {
|
|
32
|
+
onClose();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
37
|
+
/* @__PURE__ */ jsx(CardContainer, { children: hideWallets ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
|
|
39
|
+
/* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "secondary", weight: "medium", style: { marginTop: "16px" }, children: "Your account has been created." })
|
|
40
|
+
] }) : /* @__PURE__ */ jsx(WalletCards, { children: para.currentWalletIdsArray.map(([id, type]) => {
|
|
41
|
+
return /* @__PURE__ */ jsx(WalletCard, { id, type, showAddFunds: isOnRampConfigured }, id);
|
|
42
|
+
}) }) }),
|
|
43
|
+
/* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: handleNext, children: twoFactorAuthEnabled ? "Continue" : "Done" }) })
|
|
44
|
+
] });
|
|
45
|
+
};
|
|
46
|
+
const CardContainer = styled(InnerStepContainer)`
|
|
47
|
+
min-height: 196px;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
`;
|
|
50
|
+
export {
|
|
51
|
+
WalletCreationDoneStep
|
|
52
|
+
};
|
|
@@ -14,10 +14,10 @@ export declare const StepContainer: import("styled-components/dist/types").IStyl
|
|
|
14
14
|
}>> & string;
|
|
15
15
|
export declare const Heading: typeof CpslText;
|
|
16
16
|
export declare const StyledCpslTileButton: typeof CpslTileButton;
|
|
17
|
-
export declare const HeroIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<
|
|
18
|
-
ref?: import("react").Ref<
|
|
19
|
-
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<
|
|
17
|
+
export declare const HeroIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
18
|
+
ref?: import("react").Ref<any>;
|
|
19
|
+
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
20
20
|
export declare const ErrorContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
21
|
-
export declare const ErrorIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<
|
|
22
|
-
ref?: import("react").Ref<
|
|
23
|
-
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<
|
|
21
|
+
export declare const ErrorIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
22
|
+
ref?: import("react").Ref<any>;
|
|
23
|
+
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { CpslIcon, CpslInput, CpslText, CpslTileButton } from "@getpara/react-components";
|
|
4
|
+
import { styled } from "styled-components";
|
|
5
|
+
const SpinnerContainer = styled.div`
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
`;
|
|
10
|
+
const QRContainer = styled.div`
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
width: 286px;
|
|
15
|
+
height: 286px;
|
|
16
|
+
`;
|
|
17
|
+
const InfoBoxContent = styled.div`
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: 8px;
|
|
21
|
+
`;
|
|
22
|
+
const InfoBoxHeader = styled.div`
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: 4px;
|
|
26
|
+
|
|
27
|
+
cpsl-icon {
|
|
28
|
+
--height: 20px;
|
|
29
|
+
--width: 20px;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const FilledDisabledInput = styled(CpslInput)`
|
|
33
|
+
--container-border-color: var(--cpsl-color-input-border-placeholder);
|
|
34
|
+
--container-background-color: var(--cpsl-color-background-0);
|
|
35
|
+
--input-background-color: transparent;
|
|
36
|
+
--input-font-weight: 500;
|
|
37
|
+
--input-color: var(--cpsl-color-text-secondary);
|
|
38
|
+
`;
|
|
39
|
+
const FullWidthFilledDisabledInput = styled(FilledDisabledInput)`
|
|
40
|
+
width: 100%;
|
|
41
|
+
`;
|
|
42
|
+
const CenteredText = styled(CpslText)`
|
|
43
|
+
width: 100%;
|
|
44
|
+
text-align: center;
|
|
45
|
+
`;
|
|
46
|
+
const InnerStepContainer = styled.div`
|
|
47
|
+
width: 100%;
|
|
48
|
+
height: 100%;
|
|
49
|
+
align-self: center;
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: 8px;
|
|
54
|
+
`;
|
|
55
|
+
const StepContainer = styled(InnerStepContainer)`
|
|
56
|
+
gap: ${({ $wide }) => $wide ? "32px" : "24px"};
|
|
57
|
+
`;
|
|
58
|
+
const Heading = styled(CenteredText)``;
|
|
59
|
+
const StyledCpslTileButton = styled(CpslTileButton)`
|
|
60
|
+
--button-width: 100%;
|
|
61
|
+
--button-height: 87px;
|
|
62
|
+
--button-icon-height: 32px;
|
|
63
|
+
--button-icon-width: 32px;
|
|
64
|
+
`;
|
|
65
|
+
const HeroIcon = styled(CpslIcon)`
|
|
66
|
+
--height: 80px;
|
|
67
|
+
--width: 80px;
|
|
68
|
+
--icon-color: var(--cpsl-color-text-primary);
|
|
69
|
+
`;
|
|
70
|
+
const ErrorContainer = styled.div`
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
gap: 4px;
|
|
75
|
+
`;
|
|
76
|
+
const ErrorIcon = styled(CpslIcon)`
|
|
77
|
+
--height: 16px;
|
|
78
|
+
--width: 16px;
|
|
79
|
+
--icon-color: var(--cpsl-color-text-error);
|
|
80
|
+
`;
|
|
81
|
+
export {
|
|
82
|
+
CenteredText,
|
|
83
|
+
ErrorContainer,
|
|
84
|
+
ErrorIcon,
|
|
85
|
+
FilledDisabledInput,
|
|
86
|
+
FullWidthFilledDisabledInput,
|
|
87
|
+
Heading,
|
|
88
|
+
HeroIcon,
|
|
89
|
+
InfoBoxContent,
|
|
90
|
+
InfoBoxHeader,
|
|
91
|
+
InnerStepContainer,
|
|
92
|
+
QRContainer,
|
|
93
|
+
SpinnerContainer,
|
|
94
|
+
StepContainer,
|
|
95
|
+
StyledCpslTileButton
|
|
96
|
+
};
|
|
@@ -24,7 +24,7 @@ export declare const ON_RAMP_ASSETS: Record<OnRampAsset, {
|
|
|
24
24
|
export declare function getNetworkName(str: Network | string): string;
|
|
25
25
|
export declare function getNetworkIcon(str: Network | string): IconType;
|
|
26
26
|
export declare function getAssetName(str: OnRampAsset | string): string;
|
|
27
|
-
export declare function getAssetIcon(str: OnRampAsset | string): "code" | "menu" | "image" | "polygon" | "key" | "search" | "download" | "x" | "
|
|
27
|
+
export declare function getAssetIcon(str: OnRampAsset | string): "code" | "menu" | "image" | "polygon" | "key" | "search" | "download" | "x" | "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowNarrow" | "arrow" | "asterisk" | "backupKit" | "bank" | "baseBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "close" | "clubhouseBrand" | "clubhouse" | "copy07" | "copy" | "cosmos" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "discord" | "dot" | "dots" | "downloadCloud" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "farcaster" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "googleBrand" | "google" | "gridDots" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "infoCircle" | "instagramBrand" | "instagram" | "laptop" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "optimismBrand" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "para" | "passcode" | "phone" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "puzzlePiece" | "qrCode02" | "qrCode" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "send" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solana" | "spacingHeight" | "star04Filled" | "stars01Filled" | "stars" | "stopSquare" | "stripeBrand" | "telegramBrand" | "telegram" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "userCircle" | "user" | "wallet" | "youtubeBrand" | "youtube" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BQ2" | "BQ3" | "BR" | "BS" | "BT" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CD2" | "CF" | "CH" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DS" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB2" | "GB" | "GD" | "GE" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GQ" | "GR" | "GT" | "GU" | "GW" | "GY" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "US" | "UY" | "UZ" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WS" | "YE" | "ZA" | "ZM" | "ZW";
|
|
28
28
|
export declare const MOBILE_SIZE = 480;
|
|
29
29
|
export declare const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
30
30
|
export declare const EMAIL_REGEX: RegExp;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { Network, OnRampAsset, OnRampMethod, OnRampProvider } from "@getpara/core-sdk";
|
|
4
|
+
const PARA_CONNECT = "https://connect.getpara.com/";
|
|
5
|
+
const PARA_TERMS_AND_CONDITIONS = "https://getpara.com/terms";
|
|
6
|
+
const ON_RAMP_PROVIDERS = {
|
|
7
|
+
[OnRampProvider.STRIPE]: {
|
|
8
|
+
name: "Stripe",
|
|
9
|
+
feeLower: 0.99,
|
|
10
|
+
feeUpper: 4.49,
|
|
11
|
+
methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
|
|
12
|
+
icon: "stripeBrand",
|
|
13
|
+
backgroundColors: ["#6772E5", "#808AF4"]
|
|
14
|
+
},
|
|
15
|
+
[OnRampProvider.RAMP]: {
|
|
16
|
+
name: "Ramp",
|
|
17
|
+
feeLower: 0.99,
|
|
18
|
+
feeUpper: 4.49,
|
|
19
|
+
methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
|
|
20
|
+
icon: "rampNetworkBrand",
|
|
21
|
+
backgroundColors: ["#21BF73", "#3AE492"]
|
|
22
|
+
},
|
|
23
|
+
[OnRampProvider.MOONPAY]: {
|
|
24
|
+
name: "MoonPay",
|
|
25
|
+
feeLower: 1,
|
|
26
|
+
feeUpper: 4.5,
|
|
27
|
+
methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
|
|
28
|
+
icon: "moonpayBrand",
|
|
29
|
+
backgroundColors: ["#7715F5", "#9647fd"]
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const NETWORKS = {
|
|
33
|
+
[Network.ETHEREUM]: { name: "Ethereum", icon: "ethereum" },
|
|
34
|
+
[Network.SEPOLIA]: { name: "Sepolia", icon: "ethereum" },
|
|
35
|
+
[Network.ARBITRUM]: { name: "Arbitrum", icon: "arbitrumBrand" },
|
|
36
|
+
[Network.BASE]: { name: "Base", icon: "baseBrand" },
|
|
37
|
+
[Network.OPTIMISM]: { name: "Optimism", icon: "optimismBrand" },
|
|
38
|
+
[Network.POLYGON]: { name: "Polygon", icon: "polygonBrand" },
|
|
39
|
+
[Network.SOLANA]: { name: "Solana", icon: "solana" },
|
|
40
|
+
[Network.COSMOS]: { name: "Cosmos", icon: "cosmos" },
|
|
41
|
+
[Network.CELO]: { name: "Celo", icon: "celoBrand" },
|
|
42
|
+
[Network.NOBLE]: { name: "Noble", icon: "nobleBrand" }
|
|
43
|
+
};
|
|
44
|
+
const ON_RAMP_ASSETS = {
|
|
45
|
+
[OnRampAsset.ETHEREUM]: { name: "Ethereum", code: "ETH", icon: "ethereum" },
|
|
46
|
+
[OnRampAsset.USDC]: { name: "USDC", code: "USDC", icon: "usdcBrand" },
|
|
47
|
+
[OnRampAsset.POLYGON]: { name: "Polygon", code: "MATIC", icon: "polygonBrand" },
|
|
48
|
+
[OnRampAsset.SOLANA]: { name: "Solana", code: "SOL", icon: "solana" },
|
|
49
|
+
[OnRampAsset.ATOM]: { name: "Atom", code: "ATOM", icon: "cosmos" },
|
|
50
|
+
[OnRampAsset.CELO]: { name: "Celo", code: "CELO", icon: "celoBrand" },
|
|
51
|
+
[OnRampAsset.TETHER]: { name: "Tether", code: "USDT", icon: "tetherBrand" },
|
|
52
|
+
[OnRampAsset.CUSD]: { name: "Celo Dollar", code: "CUSD", icon: "celoBrand" },
|
|
53
|
+
[OnRampAsset.CEUR]: { name: "Celo Euro", code: "CEUR", icon: "celoBrand" },
|
|
54
|
+
[OnRampAsset.CREAL]: { name: "Celo Real", code: "CREAL", icon: "celoBrand" }
|
|
55
|
+
};
|
|
56
|
+
function getNetworkName(str) {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
return (_b = (_a = NETWORKS[str]) == null ? void 0 : _a.name) != null ? _b : `${str[0]}${str.slice(1).toLowerCase()}`;
|
|
59
|
+
}
|
|
60
|
+
function getNetworkIcon(str) {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
return (_b = (_a = NETWORKS[str]) == null ? void 0 : _a.icon) != null ? _b : "globe";
|
|
63
|
+
}
|
|
64
|
+
function getAssetName(str) {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
return (_b = (_a = ON_RAMP_ASSETS[str]) == null ? void 0 : _a.code) != null ? _b : str;
|
|
67
|
+
}
|
|
68
|
+
function getAssetIcon(str) {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
return (_b = (_a = ON_RAMP_ASSETS[str]) == null ? void 0 : _a.icon) != null ? _b : "emptyCircle";
|
|
71
|
+
}
|
|
72
|
+
const MOBILE_SIZE = 480;
|
|
73
|
+
const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
74
|
+
const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
75
|
+
const BODY_MOTION_VARIANTS = {
|
|
76
|
+
enter: (direction) => {
|
|
77
|
+
return {
|
|
78
|
+
scale: direction > 0 ? 0.9 : 1.1,
|
|
79
|
+
opacity: 0
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
center: {
|
|
83
|
+
scale: 1,
|
|
84
|
+
opacity: 1
|
|
85
|
+
},
|
|
86
|
+
exit: (direction) => {
|
|
87
|
+
return {
|
|
88
|
+
scale: direction < 0 ? 0.9 : 1.1,
|
|
89
|
+
opacity: 0
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const BODY_TRANSITION = {
|
|
94
|
+
duration: 0.2
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
BODY_MOTION_VARIANTS,
|
|
98
|
+
BODY_TRANSITION,
|
|
99
|
+
EMAIL_REGEX,
|
|
100
|
+
MOBILE_SIZE,
|
|
101
|
+
NETWORKS,
|
|
102
|
+
NETWORK_NOT_SUPPORTED_ERROR,
|
|
103
|
+
ON_RAMP_ASSETS,
|
|
104
|
+
ON_RAMP_PROVIDERS,
|
|
105
|
+
PARA_CONNECT,
|
|
106
|
+
PARA_TERMS_AND_CONDITIONS,
|
|
107
|
+
getAssetIcon,
|
|
108
|
+
getAssetName,
|
|
109
|
+
getNetworkIcon,
|
|
110
|
+
getNetworkName
|
|
111
|
+
};
|