@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,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { ExternalWalletProvider } from "../../providers/ExternalWalletContext.js";
|
|
8
|
+
import {
|
|
9
|
+
EvmExternalWalletContext,
|
|
10
|
+
EvmExternalWalletProvider
|
|
11
|
+
} from "../../providers/EvmExternalWalletContextStub.js";
|
|
12
|
+
import { CosmosWallet, EvmWallet, SolanaWallet } from "../../types/externalWallets.js";
|
|
13
|
+
import {
|
|
14
|
+
SolanaExternalWalletContext,
|
|
15
|
+
SolanaExternalWalletProvider
|
|
16
|
+
} from "../../providers/SolanaExternalWalletContextStub.js";
|
|
17
|
+
import {
|
|
18
|
+
CosmosExternalWalletContext,
|
|
19
|
+
CosmosExternalWalletProvider
|
|
20
|
+
} from "../../providers/CosmosExternalWalletContextStub.js";
|
|
21
|
+
import { useModalStore, useUserInfoStore } from "../../stores/index.js";
|
|
22
|
+
import { useExternalWalletProviderStore } from "../../stores/externalWalletProvider/useExternalWalletProviderStore.js";
|
|
23
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
24
|
+
const ExternalWalletsWrapper = ({ children, wallets, externalWalletsWithFullAuth }) => {
|
|
25
|
+
const para = useInternalClient();
|
|
26
|
+
const resetModalState = useModalStore((state) => state.resetState);
|
|
27
|
+
const resetUserInfoState = useUserInfoStore((state) => state.resetState);
|
|
28
|
+
const StoredEvmProvider = useExternalWalletProviderStore((state) => state.EvmProvider);
|
|
29
|
+
const storedEvmContext = useExternalWalletProviderStore((state) => state.evmContext);
|
|
30
|
+
const StoredSolanaProvider = useExternalWalletProviderStore((state) => state.SolanaProvider);
|
|
31
|
+
const storedSolanaContext = useExternalWalletProviderStore((state) => state.solanaContext);
|
|
32
|
+
const StoredCosmosProvider = useExternalWalletProviderStore((state) => state.CosmosProvider);
|
|
33
|
+
const storedCosmosContext = useExternalWalletProviderStore((state) => state.cosmosContext);
|
|
34
|
+
const [EvmProvider, setEvmProvider] = useState(null);
|
|
35
|
+
const [evmContext, setEvmContext] = useState(null);
|
|
36
|
+
const [SolanaProvider, setSolanaProvider] = useState(null);
|
|
37
|
+
const [solanaContext, setSolanaContext] = useState(null);
|
|
38
|
+
const [CosmosProvider, setCosmosProvider] = useState(null);
|
|
39
|
+
const [cosmosContext, setCosmosContext] = useState(null);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const loadProviders = () => __async(void 0, null, function* () {
|
|
42
|
+
let newEvmContext = EvmExternalWalletContext;
|
|
43
|
+
let newEvmProvider = EvmExternalWalletProvider;
|
|
44
|
+
let newSolanaContext = SolanaExternalWalletContext;
|
|
45
|
+
let newSolanaProvider = SolanaExternalWalletProvider;
|
|
46
|
+
let newCosmosContext = CosmosExternalWalletContext;
|
|
47
|
+
let newCosmosProvider = CosmosExternalWalletProvider;
|
|
48
|
+
if (!(wallets == null ? void 0 : wallets.length)) {
|
|
49
|
+
newEvmContext = EvmExternalWalletContext;
|
|
50
|
+
newEvmProvider = EvmExternalWalletProvider;
|
|
51
|
+
newSolanaContext = SolanaExternalWalletContext;
|
|
52
|
+
newSolanaProvider = SolanaExternalWalletProvider;
|
|
53
|
+
newCosmosContext = CosmosExternalWalletContext;
|
|
54
|
+
newCosmosProvider = CosmosExternalWalletProvider;
|
|
55
|
+
} else {
|
|
56
|
+
for (let i = 0; i < wallets.length; i++) {
|
|
57
|
+
const wallet = wallets[i];
|
|
58
|
+
if (wallet in EvmWallet) {
|
|
59
|
+
if (!StoredEvmProvider || !storedEvmContext) {
|
|
60
|
+
throw new Error("@getpara/evm-wallet-connectors is required to use an external EVM wallet.");
|
|
61
|
+
} else {
|
|
62
|
+
newEvmContext = storedEvmContext;
|
|
63
|
+
newEvmProvider = StoredEvmProvider;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (wallet in SolanaWallet) {
|
|
67
|
+
if (!StoredSolanaProvider || !storedSolanaContext) {
|
|
68
|
+
throw new Error("@getpara/solana-wallet-connectors is required to use an external Solana wallet.");
|
|
69
|
+
} else {
|
|
70
|
+
newSolanaContext = storedSolanaContext;
|
|
71
|
+
newSolanaProvider = StoredSolanaProvider;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (wallet in CosmosWallet) {
|
|
75
|
+
if (!StoredCosmosProvider || !storedCosmosContext) {
|
|
76
|
+
throw new Error("@getpara/cosmos-wallet-connectors is required to use an external Cosmos wallet.");
|
|
77
|
+
} else {
|
|
78
|
+
newCosmosContext = storedCosmosContext;
|
|
79
|
+
newCosmosProvider = StoredCosmosProvider;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
setEvmContext(newEvmContext);
|
|
85
|
+
setEvmProvider(() => newEvmProvider);
|
|
86
|
+
setSolanaContext(newSolanaContext);
|
|
87
|
+
setSolanaProvider(() => newSolanaProvider);
|
|
88
|
+
setCosmosContext(newCosmosContext);
|
|
89
|
+
setCosmosProvider(() => newCosmosProvider);
|
|
90
|
+
});
|
|
91
|
+
loadProviders();
|
|
92
|
+
}, [
|
|
93
|
+
wallets,
|
|
94
|
+
storedEvmContext,
|
|
95
|
+
StoredEvmProvider,
|
|
96
|
+
storedSolanaContext,
|
|
97
|
+
StoredSolanaProvider,
|
|
98
|
+
storedCosmosContext,
|
|
99
|
+
StoredCosmosProvider
|
|
100
|
+
]);
|
|
101
|
+
const handleSwitchWallet = ({ address, error }) => {
|
|
102
|
+
if (error || !address) {
|
|
103
|
+
resetModalState();
|
|
104
|
+
resetUserInfoState();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
if (!para || !EvmProvider || !SolanaProvider || !CosmosProvider) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
return /* @__PURE__ */ jsx(EvmProvider, { para, onSwitchWallet: handleSwitchWallet, children: /* @__PURE__ */ jsx(SolanaProvider, { para, onSwitchWallet: handleSwitchWallet, children: /* @__PURE__ */ jsx(CosmosProvider, { para, onSwitchWallet: handleSwitchWallet, children: /* @__PURE__ */ jsx(
|
|
111
|
+
ExternalWalletProvider,
|
|
112
|
+
{
|
|
113
|
+
evmContext,
|
|
114
|
+
solanaContext,
|
|
115
|
+
cosmosContext,
|
|
116
|
+
walletSort: wallets,
|
|
117
|
+
externalWalletsWithFullAuth,
|
|
118
|
+
children
|
|
119
|
+
}
|
|
120
|
+
) }) }) });
|
|
121
|
+
};
|
|
122
|
+
export {
|
|
123
|
+
ExternalWalletsWrapper
|
|
124
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { styled } from "styled-components";
|
|
5
|
+
import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
|
|
6
|
+
import { useModalStore } from "../../stores/index.js";
|
|
7
|
+
import { PARA_CONNECT, PARA_TERMS_AND_CONDITIONS } from "../../constants/constants.js";
|
|
8
|
+
import { useMemo } from "react";
|
|
9
|
+
import { getStepHasFooter } from "../../utils/steps.js";
|
|
10
|
+
const Footer = () => {
|
|
11
|
+
const isAccount = useModalStore((state) => state.isAccount());
|
|
12
|
+
const currentStep = useModalStore((state) => state.step);
|
|
13
|
+
const showFooter = isAccount || getStepHasFooter(currentStep);
|
|
14
|
+
const Content = useMemo(() => {
|
|
15
|
+
if (isAccount) {
|
|
16
|
+
return /* @__PURE__ */ jsxs(ConnectContainer, { children: [
|
|
17
|
+
/* @__PURE__ */ jsxs(ConnectText, { variant: "bodyS", color: "secondary", weight: "medium", children: [
|
|
18
|
+
"Access all your wallet\u2019s features at",
|
|
19
|
+
" ",
|
|
20
|
+
/* @__PURE__ */ jsx("a", { href: PARA_CONNECT, target: "blank", children: /* @__PURE__ */ jsx(ClickableText, { variant: "bodyS", weight: "medium", children: "Para Connect" }) })
|
|
21
|
+
] }),
|
|
22
|
+
/* @__PURE__ */ jsx(CpslButton, { as: "a", href: PARA_CONNECT, target: "blank", variant: "ghost", children: /* @__PURE__ */ jsx(RightChevron, { icon: "chevronUp" }) })
|
|
23
|
+
] });
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
+
/* @__PURE__ */ jsxs(InlineText, { variant: "body2XS", color: "secondary", weight: "medium", children: [
|
|
27
|
+
"By logging in you agree to our",
|
|
28
|
+
" ",
|
|
29
|
+
/* @__PURE__ */ jsx("a", { href: PARA_TERMS_AND_CONDITIONS, target: "blank", children: /* @__PURE__ */ jsx(ClickableText, { variant: "body2XS", weight: "medium", children: "Terms & Conditions" }) })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ jsxs(PoweredByContainer, { children: [
|
|
32
|
+
/* @__PURE__ */ jsx(InlineText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Powered by" }),
|
|
33
|
+
/* @__PURE__ */ jsx(ParaLogo, { icon: "para" })
|
|
34
|
+
] })
|
|
35
|
+
] });
|
|
36
|
+
}, [isAccount]);
|
|
37
|
+
if (!showFooter) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return /* @__PURE__ */ jsx(FooterContainer, { slot: "footer", children: /* @__PURE__ */ jsx(FooterContentContainer, { children: Content }) });
|
|
41
|
+
};
|
|
42
|
+
const FooterContainer = styled.div`
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: 16px;
|
|
47
|
+
padding: 8px 0px;
|
|
48
|
+
`;
|
|
49
|
+
const FooterContentContainer = styled.div`
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: 8px;
|
|
54
|
+
`;
|
|
55
|
+
const PoweredByContainer = styled.div`
|
|
56
|
+
display: flex;
|
|
57
|
+
gap: 5px;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
`;
|
|
61
|
+
const ConnectContainer = styled.div`
|
|
62
|
+
display: flex;
|
|
63
|
+
gap: 8px;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
`;
|
|
67
|
+
const RightChevron = styled(CpslIcon)`
|
|
68
|
+
transform: rotate(90deg);
|
|
69
|
+
|
|
70
|
+
/* --icon-color: var(--cpsl-color-text-tertiary); */
|
|
71
|
+
--height: 24px;
|
|
72
|
+
--width: 24px;
|
|
73
|
+
`;
|
|
74
|
+
const InlineText = styled(CpslText)`
|
|
75
|
+
text-align: center;
|
|
76
|
+
display: inline-block;
|
|
77
|
+
`;
|
|
78
|
+
const ConnectText = styled(InlineText)`
|
|
79
|
+
line-height: 20px;
|
|
80
|
+
`;
|
|
81
|
+
const ClickableText = styled(InlineText)`
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
display: inline-block;
|
|
84
|
+
`;
|
|
85
|
+
const ParaLogo = styled(CpslIcon)`
|
|
86
|
+
display: inline-block;
|
|
87
|
+
--icon-color: var(--cpsl-color-text-secondary);
|
|
88
|
+
--width: 49px;
|
|
89
|
+
--height: auto;
|
|
90
|
+
`;
|
|
91
|
+
export {
|
|
92
|
+
Footer
|
|
93
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { styled } from "styled-components";
|
|
5
|
+
import { useStepTitle } from "./hooks/useStepTitle.js";
|
|
6
|
+
import { CenteredText } from "../common.js";
|
|
7
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
8
|
+
import { useModalStore } from "../../stores/index.js";
|
|
9
|
+
import { BODY_MOTION_VARIANTS, BODY_TRANSITION } from "../../constants/constants.js";
|
|
10
|
+
const Header = () => {
|
|
11
|
+
const { title } = useStepTitle();
|
|
12
|
+
const stepDirection = useModalStore((state) => state.stepDirection);
|
|
13
|
+
const currentStep = useModalStore((state) => state.step);
|
|
14
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, custom: stepDirection, children: /* @__PURE__ */ jsx(
|
|
15
|
+
Container,
|
|
16
|
+
{
|
|
17
|
+
custom: stepDirection,
|
|
18
|
+
variants: BODY_MOTION_VARIANTS,
|
|
19
|
+
initial: "enter",
|
|
20
|
+
animate: "center",
|
|
21
|
+
exit: "exit",
|
|
22
|
+
transition: BODY_TRANSITION,
|
|
23
|
+
slot: "header",
|
|
24
|
+
id: "header",
|
|
25
|
+
children: /* @__PURE__ */ jsx(CenteredText, { weight: "semiBold", color: "secondary", children: title })
|
|
26
|
+
},
|
|
27
|
+
["ADD_FUNDS_BUY", "ADD_FUNDS_RECEIVE", "ADD_FUNDS_WITHDRAW"].includes(currentStep) ? "ADD_FUNDS" : currentStep
|
|
28
|
+
) });
|
|
29
|
+
};
|
|
30
|
+
const Container = styled(motion.div)`
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 16px;
|
|
33
|
+
width: 100%;
|
|
34
|
+
z-index: 2;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
gap: 8px;
|
|
39
|
+
flex-wrap: wrap;
|
|
40
|
+
`;
|
|
41
|
+
export {
|
|
42
|
+
Header
|
|
43
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { useModalStore } from "../../../stores/modal/useModalStore.js";
|
|
5
|
+
import { ModalStep } from "../../../utils/steps.js";
|
|
6
|
+
import { useExternalWallets } from "../../../providers/ExternalWalletContext.js";
|
|
7
|
+
import { useThemeStore } from "../../../stores/index.js";
|
|
8
|
+
const useStepTitle = () => {
|
|
9
|
+
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
10
|
+
const isLogin = useModalStore((state) => state.isLogin());
|
|
11
|
+
const currentStep = useModalStore((state) => state.step);
|
|
12
|
+
const { chainId } = useExternalWallets();
|
|
13
|
+
const titles = useMemo(
|
|
14
|
+
() => ({
|
|
15
|
+
[ModalStep.AUTH_MAIN]: "",
|
|
16
|
+
[ModalStep.AUTH_MORE]: "Sign Up or Log In",
|
|
17
|
+
[ModalStep.EX_WALLET_MORE]: "Connect Wallet",
|
|
18
|
+
[ModalStep.VERIFICATIONS]: "Sign Up",
|
|
19
|
+
[ModalStep.AWAITING_OAUTH]: isLogin ? "Login" : "Sign Up",
|
|
20
|
+
[ModalStep.FARCASTER_OAUTH]: isLogin ? "Login" : "Sign Up",
|
|
21
|
+
[ModalStep.BIOMETRIC_CREATION]: "Sign Up",
|
|
22
|
+
[ModalStep.PASSWORD_CREATION]: "Sign Up",
|
|
23
|
+
[ModalStep.AWAITING_BIOMETRIC_CREATION]: "Sign Up",
|
|
24
|
+
[ModalStep.AWAITING_WALLET_CREATION]: isLogin ? "Login" : "Sign Up",
|
|
25
|
+
[ModalStep.AWAITING_PASSWORD_CREATION]: "Sign Up",
|
|
26
|
+
[ModalStep.WALLET_CREATION_DONE]: hideWallets ? "Account Created" : "Wallet Created",
|
|
27
|
+
[ModalStep.SECRET]: isLogin ? "Login" : "Sign Up",
|
|
28
|
+
[ModalStep.BIOMETRIC_LOGIN]: "Login",
|
|
29
|
+
[ModalStep.AWAITING_PASSWORD_LOGIN]: "Login",
|
|
30
|
+
[ModalStep.AWAITING_BIOMETRIC_LOGIN]: "Login",
|
|
31
|
+
[ModalStep.LOGIN_DONE]: "",
|
|
32
|
+
[ModalStep.SETUP_2FA]: "2FA",
|
|
33
|
+
[ModalStep.VERIFY_2FA]: "2FA",
|
|
34
|
+
[ModalStep.TWO_FACTOR_DONE]: "2FA",
|
|
35
|
+
[ModalStep.ADD_FUNDS_BUY]: "",
|
|
36
|
+
[ModalStep.ADD_FUNDS_RECEIVE]: "",
|
|
37
|
+
[ModalStep.ADD_FUNDS_WITHDRAW]: "",
|
|
38
|
+
[ModalStep.ADD_FUNDS_AWAITING]: "",
|
|
39
|
+
[ModalStep.ADD_FUNDS_SUCCESS]: "",
|
|
40
|
+
[ModalStep.ADD_FUNDS_FAILURE]: "",
|
|
41
|
+
[ModalStep.ACCOUNT_MAIN]: "",
|
|
42
|
+
[ModalStep.CHAIN_SWITCH]: ""
|
|
43
|
+
}),
|
|
44
|
+
[isLogin, chainId, hideWallets]
|
|
45
|
+
);
|
|
46
|
+
return { title: titles[currentStep] };
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
useStepTitle
|
|
50
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { CpslHero, CpslIcon, CpslIdenticon } from "@getpara/react-components";
|
|
5
|
+
import styled from "styled-components";
|
|
6
|
+
import { ModalStep } from "../../utils/steps.js";
|
|
7
|
+
import { useModalStore } from "../../stores/index.js";
|
|
8
|
+
import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
|
|
9
|
+
import { NETWORK_NOT_SUPPORTED_ERROR } from "../../constants/constants.js";
|
|
10
|
+
import { useEffect, useState } from "react";
|
|
11
|
+
import { isMobile } from "@getpara/web-sdk";
|
|
12
|
+
import { useActiveWallet } from "../../hooks/useActiveWallet.js";
|
|
13
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
14
|
+
const getStepConfig = ({
|
|
15
|
+
externalWalletError
|
|
16
|
+
}) => {
|
|
17
|
+
var _a;
|
|
18
|
+
return {
|
|
19
|
+
[ModalStep.EX_WALLET_SELECTED]: {
|
|
20
|
+
variant: "externalWalletConnection",
|
|
21
|
+
topOffset: 40,
|
|
22
|
+
spacerHeight: 158,
|
|
23
|
+
hideFadeOut: true
|
|
24
|
+
},
|
|
25
|
+
[ModalStep.CHAIN_SWITCH]: {
|
|
26
|
+
variant: ((_a = externalWalletError == null ? void 0 : externalWalletError[0]) == null ? void 0 : _a.toLowerCase()) === NETWORK_NOT_SUPPORTED_ERROR ? "failed" : "externalWalletConnection",
|
|
27
|
+
topOffset: 20,
|
|
28
|
+
spacerHeight: 158,
|
|
29
|
+
hideFadeOut: true
|
|
30
|
+
},
|
|
31
|
+
[ModalStep.FARCASTER_OAUTH]: {
|
|
32
|
+
variant: "externalWalletConnection",
|
|
33
|
+
topOffset: 40,
|
|
34
|
+
spacerHeight: 158,
|
|
35
|
+
hideFadeOut: true
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const Hero = () => {
|
|
40
|
+
const para = useInternalClient();
|
|
41
|
+
const { wallet: connector, walletDisplayHelpers, avatar } = useExternalWallets();
|
|
42
|
+
const step = useModalStore((state) => state.step);
|
|
43
|
+
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
44
|
+
const activeWallet = useActiveWallet();
|
|
45
|
+
const [currentStep, setCurrentStep] = useState(step);
|
|
46
|
+
const stepConfig = getStepConfig({
|
|
47
|
+
externalWalletError
|
|
48
|
+
})[currentStep];
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const prevStepConfig = getStepConfig({
|
|
51
|
+
externalWalletError
|
|
52
|
+
})[currentStep];
|
|
53
|
+
const newStepConfig = getStepConfig({
|
|
54
|
+
externalWalletError
|
|
55
|
+
})[step];
|
|
56
|
+
const delay = newStepConfig && prevStepConfig ? 0 : newStepConfig && !prevStepConfig ? 0 : 200;
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
setCurrentStep(step);
|
|
59
|
+
}, delay);
|
|
60
|
+
}, [step]);
|
|
61
|
+
const isExternalStep = currentStep === ModalStep.EX_WALLET_SELECTED;
|
|
62
|
+
const isChainSwitchStep = currentStep === ModalStep.CHAIN_SWITCH;
|
|
63
|
+
const isAccountStep = currentStep === ModalStep.ACCOUNT_MAIN;
|
|
64
|
+
const isFarcasterStep = currentStep === ModalStep.FARCASTER_OAUTH;
|
|
65
|
+
const { showExtension, isCosmosMobileWallet } = walletDisplayHelpers;
|
|
66
|
+
const shouldHide = !stepConfig || !isMobile() && isExternalStep && !showExtension || !isMobile() && isChainSwitchStep && isCosmosMobileWallet || !isMobile() && isFarcasterStep;
|
|
67
|
+
const { variant, topOffset, spacerHeight, hideFadeOut } = stepConfig != null ? stepConfig : {};
|
|
68
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
+
/* @__PURE__ */ jsx(Container, { $top: -45 + topOffset, children: shouldHide ? null : /* @__PURE__ */ jsxs(StyledHero, { $isAccount: isAccountStep, hideFadeOut, variant, height: 480, withDefaultTheme: true, children: [
|
|
70
|
+
(isExternalStep || isChainSwitchStep) && /* @__PURE__ */ jsx(WalletLogo, { slot: "connectionLeft", src: connector == null ? void 0 : connector.iconUrl }),
|
|
71
|
+
isFarcasterStep && /* @__PURE__ */ jsx(WalletLogo, { slot: "connectionLeft", icon: "farcasterBrand" }),
|
|
72
|
+
isAccountStep && (avatar ? /* @__PURE__ */ jsx(Avatar, { slot: "image", src: avatar }) : activeWallet ? /* @__PURE__ */ jsx(IconAvatar, { slot: "image", size: "100%", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }) : null)
|
|
73
|
+
] }) }),
|
|
74
|
+
!shouldHide && /* @__PURE__ */ jsx(Spacer, { $height: spacerHeight })
|
|
75
|
+
] });
|
|
76
|
+
};
|
|
77
|
+
const Container = styled.div`
|
|
78
|
+
display: flex;
|
|
79
|
+
position: absolute;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
align-items: center;
|
|
82
|
+
width: 100%;
|
|
83
|
+
|
|
84
|
+
top: ${({ $top }) => `${$top}px`};
|
|
85
|
+
`;
|
|
86
|
+
const Spacer = styled.div`
|
|
87
|
+
height: ${({ $height }) => `${$height}px`};
|
|
88
|
+
`;
|
|
89
|
+
const WalletLogo = styled(CpslIcon)`
|
|
90
|
+
--height: 60px;
|
|
91
|
+
--width: 60px;
|
|
92
|
+
`;
|
|
93
|
+
const Avatar = styled.img`
|
|
94
|
+
width: 100%;
|
|
95
|
+
height: 100%;
|
|
96
|
+
object-fit: contain;
|
|
97
|
+
`;
|
|
98
|
+
const IconAvatar = styled(CpslIdenticon)`
|
|
99
|
+
border-radius: 1000px;
|
|
100
|
+
`;
|
|
101
|
+
const StyledHero = styled(CpslHero)`
|
|
102
|
+
${({ $isAccount }) => $isAccount && `
|
|
103
|
+
--ring-3-size: 560px;
|
|
104
|
+
--ring-2-size: 402px;
|
|
105
|
+
--ring-1-size: 228px;
|
|
106
|
+
--ring-0-size: 104px;
|
|
107
|
+
|
|
108
|
+
--default-theme-ring-3-opacity: 0.02;
|
|
109
|
+
--default-theme-ring-2-opacity: 0.04;
|
|
110
|
+
--default-theme-ring-1-opacity: 0.06;
|
|
111
|
+
--default-theme-ring-0-opacity: 0.1;
|
|
112
|
+
`}
|
|
113
|
+
`;
|
|
114
|
+
export {
|
|
115
|
+
Hero
|
|
116
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useModalStore, useThemeStore } from "../../stores/index.js";
|
|
5
|
+
import { IFrameSteps } from "../../utils/steps.js";
|
|
6
|
+
import styled from "styled-components";
|
|
7
|
+
import { SpinnerContainer } from "@getpara/react-common";
|
|
8
|
+
import { CpslSpinner } from "@getpara/react-components";
|
|
9
|
+
import { MOBILE_SIZE } from "../../constants/constants.js";
|
|
10
|
+
const IFrameStep = () => {
|
|
11
|
+
const iFrameUrl = useModalStore((state) => state.iFrameUrl);
|
|
12
|
+
const setIsReady = useModalStore((state) => state.setIsIFrameReady);
|
|
13
|
+
const isReady = useModalStore((state) => state.isIFrameReady);
|
|
14
|
+
const currentStep = useModalStore((state) => state.step);
|
|
15
|
+
const embeddedModal = useThemeStore((state) => state.embeddedModal);
|
|
16
|
+
return /* @__PURE__ */ jsxs(OuterContainer, { $isVisible: IFrameSteps.includes(currentStep), $embeddedModal: embeddedModal, children: [
|
|
17
|
+
/* @__PURE__ */ jsx(Container, { $isReady: isReady, children: /* @__PURE__ */ jsx(
|
|
18
|
+
"iframe",
|
|
19
|
+
{
|
|
20
|
+
src: iFrameUrl,
|
|
21
|
+
onLoad: () => {
|
|
22
|
+
setIsReady(true);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
) }),
|
|
26
|
+
!isReady && /* @__PURE__ */ jsx(SpinnerContainer, { style: { width: "100%", height: "100%", flex: 1 }, children: /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) })
|
|
27
|
+
] });
|
|
28
|
+
};
|
|
29
|
+
const OuterContainer = styled.div`
|
|
30
|
+
height: ${({ $isVisible }) => $isVisible ? "100%" : "0px"};
|
|
31
|
+
width: ${({ $isVisible }) => $isVisible ? "100%" : "0px"};
|
|
32
|
+
flex: ${({ $isVisible }) => $isVisible ? 1 : "auto"};
|
|
33
|
+
padding: ${({ $embeddedModal, $isVisible }) => !$isVisible ? "0px" : $embeddedModal ? "12px 0px 0px" : "72px 72px 32px"};
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
|
|
38
|
+
@media (max-width: ${MOBILE_SIZE}px) {
|
|
39
|
+
padding: ${({ $embeddedModal, $isVisible }) => !$isVisible ? "0px" : $embeddedModal ? "12px 0px 0px" : "72px 16px 0px"};
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
const Container = styled.div`
|
|
43
|
+
height: 100%;
|
|
44
|
+
width: 100%;
|
|
45
|
+
display: ${({ $isReady }) => $isReady ? "block" : "none"};
|
|
46
|
+
|
|
47
|
+
& > iframe {
|
|
48
|
+
height: 360px;
|
|
49
|
+
width: 100%;
|
|
50
|
+
border: none;
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
export {
|
|
54
|
+
IFrameStep
|
|
55
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
import { Heading, HeroIcon, StepContainer } from "../common.js";
|
|
6
|
+
import { ExternalWalletCard, WalletCard, WalletCards } from "../WalletCard/WalletCard.js";
|
|
7
|
+
import { useThemeStore } from "../../stores/index.js";
|
|
8
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
9
|
+
const LoginDoneStep = ({ onClose }) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const para = useInternalClient();
|
|
12
|
+
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
onClose();
|
|
16
|
+
}, 1600);
|
|
17
|
+
}, []);
|
|
18
|
+
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
19
|
+
/* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
|
|
20
|
+
/* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Connected" }),
|
|
21
|
+
!hideWallets && /* @__PURE__ */ jsx(WalletCards, { children: para.isUsingExternalWallet() ? /* @__PURE__ */ jsx(ExternalWalletCard, { address: (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.address }) : para.currentWalletIdsArray.map(([id, type]) => {
|
|
22
|
+
return /* @__PURE__ */ jsx(WalletCard, { id, type }, `${id}-${type}`);
|
|
23
|
+
}) })
|
|
24
|
+
] });
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
LoginDoneStep
|
|
28
|
+
};
|