@getpara/react-sdk 1.1.0 → 1.3.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.
Files changed (146) hide show
  1. package/dist/MoonPayEmbed-GAWXP6V7.js +2 -0
  2. package/dist/MoonPayEmbed-GAWXP6V7.js.br +0 -0
  3. package/dist/MoonPayEmbed-GAWXP6V7.js.gz +0 -0
  4. package/dist/index.js +675 -5
  5. package/dist/index.js.br +0 -0
  6. package/dist/index.js.gz +0 -0
  7. package/dist/provider/hooks/utils/useEventListeners.d.ts +1 -1
  8. package/dist/provider/stores/useStore.d.ts +7 -2
  9. package/dist/provider/types/provider.d.ts +15 -3
  10. package/package.json +8 -7
  11. package/dist/modal/ParaModal.js +0 -281
  12. package/dist/modal/components/Account/Account.js +0 -60
  13. package/dist/modal/components/AddFunds/AddFunds.js +0 -147
  14. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -65
  15. package/dist/modal/components/AddFunds/AddFundsDone.js +0 -26
  16. package/dist/modal/components/AddFunds/MoonPayEmbed.js +0 -2
  17. package/dist/modal/components/AddFunds/index.js +0 -3
  18. package/dist/modal/components/AuthInput/AuthInput.js +0 -221
  19. package/dist/modal/components/AuthInput/countryCodes.js +0 -40
  20. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -23
  21. package/dist/modal/components/AuthInput/phoneMasks.js +0 -247
  22. package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -21
  23. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -89
  24. package/dist/modal/components/AuthOptions/AuthOptions.js +0 -28
  25. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -7
  26. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -5
  27. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -7
  28. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -18
  29. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -17
  30. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -131
  31. package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -26
  32. package/dist/modal/components/Body/Body.js +0 -232
  33. package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -77
  34. package/dist/modal/components/ChainSwitch/config.js +0 -11
  35. package/dist/modal/components/Controls/Controls.js +0 -54
  36. package/dist/modal/components/Controls/Selects.js +0 -159
  37. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -116
  38. package/dist/modal/components/ExternalWalletStep/config.js +0 -11
  39. package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -142
  40. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -119
  41. package/dist/modal/components/Footer/Footer.js +0 -71
  42. package/dist/modal/components/Header/Header.js +0 -24
  43. package/dist/modal/components/Header/hooks/useStepTitle.js +0 -42
  44. package/dist/modal/components/Hero/Hero.js +0 -119
  45. package/dist/modal/components/IFrameStep/IFrameStep.js +0 -41
  46. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -19
  47. package/dist/modal/components/ModalContent/ModalContent.js +0 -280
  48. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -82
  49. package/dist/modal/components/OAuth/OAuth.js +0 -125
  50. package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -133
  51. package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -10
  52. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -72
  53. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -67
  54. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -105
  55. package/dist/modal/components/StripeComponents/StripeComponents.js +0 -78
  56. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -8
  57. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -135
  58. package/dist/modal/components/Waiting/Waiting.js +0 -6
  59. package/dist/modal/components/WalletCard/PartnerIcon.js +0 -29
  60. package/dist/modal/components/WalletCard/WalletCard.js +0 -93
  61. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -50
  62. package/dist/modal/components/common.js +0 -67
  63. package/dist/modal/components/index.js +0 -1
  64. package/dist/modal/constants/constants.js +0 -93
  65. package/dist/modal/constants/defaults.js +0 -5
  66. package/dist/modal/constants/oAuthLogos.js +0 -18
  67. package/dist/modal/hooks/useActiveWallet.js +0 -11
  68. package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -46
  69. package/dist/modal/hooks/useGoBack.js +0 -34
  70. package/dist/modal/index.js +0 -9
  71. package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -18
  72. package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -22
  73. package/dist/modal/providers/ExternalWalletContext.js +0 -253
  74. package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -12
  75. package/dist/modal/stores/externalWalletProvider/actions.js +0 -5
  76. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -13
  77. package/dist/modal/stores/index.js +0 -3
  78. package/dist/modal/stores/modal/actions.js +0 -64
  79. package/dist/modal/stores/modal/useModalStore.js +0 -41
  80. package/dist/modal/stores/para/actions.js +0 -5
  81. package/dist/modal/stores/para/useParaStore.js +0 -3
  82. package/dist/modal/stores/theme/actions.js +0 -24
  83. package/dist/modal/stores/theme/useThemeStore.js +0 -14
  84. package/dist/modal/stores/userInfo/actions.js +0 -34
  85. package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -9
  86. package/dist/modal/types/commonTypes.js +0 -1
  87. package/dist/modal/types/externalWallets.js +0 -21
  88. package/dist/modal/types/modalProps.js +0 -7
  89. package/dist/modal/utils/authLayoutHelpers.js +0 -2
  90. package/dist/modal/utils/getMailtoLink.js +0 -5
  91. package/dist/modal/utils/getTileButtonFlex.js +0 -15
  92. package/dist/modal/utils/isPasskeySupported.js +0 -10
  93. package/dist/modal/utils/openPopup.js +0 -55
  94. package/dist/modal/utils/routeMobileExternalWallet.js +0 -35
  95. package/dist/modal/utils/steps.js +0 -215
  96. package/dist/modal/utils/stringFormatters.js +0 -12
  97. package/dist/modal/utils/validateOnRampConfig.js +0 -26
  98. package/dist/provider/ParaProvider.js +0 -16
  99. package/dist/provider/actions/checkIfUserExists.js +0 -26
  100. package/dist/provider/actions/createUser.js +0 -30
  101. package/dist/provider/actions/getAccount.js +0 -24
  102. package/dist/provider/actions/getWallet.js +0 -16
  103. package/dist/provider/actions/initiateLogin.js +0 -23
  104. package/dist/provider/actions/keepSessionAlive.js +0 -23
  105. package/dist/provider/actions/logout.js +0 -20
  106. package/dist/provider/actions/signMessage.js +0 -23
  107. package/dist/provider/actions/signTransaction.js +0 -23
  108. package/dist/provider/actions/waitForAccountCreation.js +0 -24
  109. package/dist/provider/actions/waitForLoginAndSetup.js +0 -27
  110. package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -24
  111. package/dist/provider/hooks/index.js +0 -3
  112. package/dist/provider/hooks/mutations/index.js +0 -10
  113. package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
  114. package/dist/provider/hooks/mutations/useCreateUser.js +0 -23
  115. package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
  116. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -23
  117. package/dist/provider/hooks/mutations/useLogout.js +0 -33
  118. package/dist/provider/hooks/mutations/useSignMessage.js +0 -33
  119. package/dist/provider/hooks/mutations/useSignTransaction.js +0 -33
  120. package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
  121. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
  122. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
  123. package/dist/provider/hooks/queries/index.js +0 -2
  124. package/dist/provider/hooks/queries/useAccount.js +0 -23
  125. package/dist/provider/hooks/queries/useWallet.js +0 -24
  126. package/dist/provider/hooks/utils/index.js +0 -3
  127. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -79
  128. package/dist/provider/hooks/utils/useClient.js +0 -8
  129. package/dist/provider/hooks/utils/useEventListeners.js +0 -87
  130. package/dist/provider/hooks/utils/useInternalClient.js +0 -9
  131. package/dist/provider/hooks/utils/useModal.js +0 -15
  132. package/dist/provider/hooks/utils/useWalletState.js +0 -33
  133. package/dist/provider/index.js +0 -3
  134. package/dist/provider/stores/getters.js +0 -5
  135. package/dist/provider/stores/slices/client.js +0 -4
  136. package/dist/provider/stores/slices/index.js +0 -3
  137. package/dist/provider/stores/slices/modal.js +0 -4
  138. package/dist/provider/stores/slices/wallet.js +0 -6
  139. package/dist/provider/stores/types.js +0 -1
  140. package/dist/provider/stores/useStore.js +0 -12
  141. package/dist/provider/types/provider.js +0 -1
  142. package/dist/provider/types/query.js +0 -1
  143. package/dist/provider/types/utils.js +0 -1
  144. package/dist/provider/utils/renameMutations.js +0 -19
  145. /package/dist/{modal/css → css}/modal.css +0 -0
  146. /package/dist/{modal/public → public}/Inter-VariableFont_slnt,wght.ttf +0 -0
@@ -1,119 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import { useEffect, useState } from 'react';
12
- import { ExternalWalletProvider } from '../../providers/ExternalWalletContext.js';
13
- import { EvmExternalWalletContext, EvmExternalWalletProvider, } from '../../providers/EvmExternalWalletContextStub.js';
14
- import { CosmosWallet, EvmWallet, SolanaWallet } from '../../types/externalWallets.js';
15
- import { SolanaExternalWalletContext, SolanaExternalWalletProvider, } from '../../providers/SolanaExternalWalletContextStub.js';
16
- import { CosmosExternalWalletContext, CosmosExternalWalletProvider, } from '../../providers/CosmosExternalWalletContextStub.js';
17
- import { useModalStore, useUserInfoStore } from '../../stores/index.js';
18
- import { useExternalWalletProviderStore } from '../../stores/externalWalletProvider/useExternalWalletProviderStore.js';
19
- import { useInternalClient } from '../../../provider/hooks/utils/useInternalClient.js';
20
- export const ExternalWalletsWrapper = ({ children, wallets }) => {
21
- const para = useInternalClient();
22
- const resetModalState = useModalStore(state => state.resetState);
23
- const resetUserInfoState = useUserInfoStore(state => state.resetState);
24
- const StoredEvmProvider = useExternalWalletProviderStore(state => state.EvmProvider);
25
- const storedEvmContext = useExternalWalletProviderStore(state => state.evmContext);
26
- const StoredSolanaProvider = useExternalWalletProviderStore(state => state.SolanaProvider);
27
- const storedSolanaContext = useExternalWalletProviderStore(state => state.solanaContext);
28
- const StoredCosmosProvider = useExternalWalletProviderStore(state => state.CosmosProvider);
29
- const storedCosmosContext = useExternalWalletProviderStore(state => state.cosmosContext);
30
- // EVM
31
- const [EvmProvider, setEvmProvider] = useState(null);
32
- const [evmContext, setEvmContext] = useState(null);
33
- // Solana
34
- const [SolanaProvider, setSolanaProvider] = useState(null);
35
- const [solanaContext, setSolanaContext] = useState(null);
36
- // Cosmos
37
- const [CosmosProvider, setCosmosProvider] = useState(null);
38
- const [cosmosContext, setCosmosContext] = useState(null);
39
- useEffect(() => {
40
- const loadProviders = () => __awaiter(void 0, void 0, void 0, function* () {
41
- let newEvmContext = EvmExternalWalletContext;
42
- let newEvmProvider = EvmExternalWalletProvider;
43
- let newSolanaContext = SolanaExternalWalletContext;
44
- let newSolanaProvider = SolanaExternalWalletProvider;
45
- let newCosmosContext = CosmosExternalWalletContext;
46
- let newCosmosProvider = CosmosExternalWalletProvider;
47
- if (!(wallets === null || wallets === void 0 ? void 0 : wallets.length)) {
48
- newEvmContext = EvmExternalWalletContext;
49
- newEvmProvider = EvmExternalWalletProvider;
50
- newSolanaContext = SolanaExternalWalletContext;
51
- newSolanaProvider = SolanaExternalWalletProvider;
52
- newCosmosContext = CosmosExternalWalletContext;
53
- newCosmosProvider = CosmosExternalWalletProvider;
54
- }
55
- else {
56
- for (let i = 0; i < wallets.length; i++) {
57
- const wallet = wallets[i];
58
- // Handle EVM Wallets
59
- if (wallet in EvmWallet) {
60
- if (!StoredEvmProvider || !storedEvmContext) {
61
- throw new Error('@getpara/evm-wallet-connectors is required to use an external EVM wallet.');
62
- }
63
- else {
64
- newEvmContext = storedEvmContext;
65
- newEvmProvider = StoredEvmProvider;
66
- }
67
- }
68
- // Handle Solana Wallets
69
- if (wallet in SolanaWallet) {
70
- if (!StoredSolanaProvider || !storedSolanaContext) {
71
- throw new Error('@getpara/solana-wallet-connectors is required to use an external Solana wallet.');
72
- }
73
- else {
74
- newSolanaContext = storedSolanaContext;
75
- newSolanaProvider = StoredSolanaProvider;
76
- }
77
- }
78
- // Handle Cosmos Wallets
79
- if (wallet in CosmosWallet) {
80
- if (!StoredCosmosProvider || !storedCosmosContext) {
81
- throw new Error('@getpara/cosmos-wallet-connectors is required to use an external Cosmos wallet.');
82
- }
83
- else {
84
- newCosmosContext = storedCosmosContext;
85
- newCosmosProvider = StoredCosmosProvider;
86
- }
87
- }
88
- }
89
- }
90
- setEvmContext(newEvmContext);
91
- setEvmProvider(() => newEvmProvider);
92
- setSolanaContext(newSolanaContext);
93
- setSolanaProvider(() => newSolanaProvider);
94
- setCosmosContext(newCosmosContext);
95
- setCosmosProvider(() => newCosmosProvider);
96
- });
97
- loadProviders();
98
- }, [
99
- wallets,
100
- storedEvmContext,
101
- StoredEvmProvider,
102
- storedSolanaContext,
103
- StoredSolanaProvider,
104
- storedCosmosContext,
105
- StoredCosmosProvider,
106
- ]);
107
- const handleSwitchWallet = ({ address, error }) => {
108
- // If we error on switch wallets we logged out the Para instance so we need to reset the modal state
109
- // Or if we don't return an address on switch wallets we logged out the Para instance so we need to reset the modal state
110
- if (error || !address) {
111
- resetModalState();
112
- resetUserInfoState();
113
- }
114
- };
115
- if (!para || !EvmProvider || !SolanaProvider || !CosmosProvider) {
116
- return null;
117
- }
118
- return (_jsx(EvmProvider, { para: para, onSwitchWallet: handleSwitchWallet, children: _jsx(SolanaProvider, { para: para, onSwitchWallet: handleSwitchWallet, children: _jsx(CosmosProvider, { para: para, onSwitchWallet: handleSwitchWallet, children: _jsx(ExternalWalletProvider, { evmContext: evmContext, solanaContext: solanaContext, cosmosContext: cosmosContext, walletSort: wallets, children: children }) }) }) }));
119
- };
@@ -1,71 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { styled } from 'styled-components';
3
- import { CpslButton, CpslIcon, CpslText } from '@getpara/react-components';
4
- import { useModalStore } from '../../stores/index.js';
5
- import { PARA_CONNECT, PARA_TERMS_AND_CONDITIONS } from '../../constants/constants.js';
6
- import { useMemo } from 'react';
7
- import { getStepHasFooter } from '../../utils/steps.js';
8
- export const Footer = () => {
9
- const isAccount = useModalStore(state => state.isAccount());
10
- const currentStep = useModalStore(state => state.step);
11
- const showFooter = isAccount || getStepHasFooter(currentStep);
12
- const Content = useMemo(() => {
13
- if (isAccount) {
14
- return (_jsxs(ConnectContainer, { children: [_jsxs(ConnectText, { variant: "bodyS", color: "secondary", weight: "medium", children: ["Access all your wallet\u2019s features at", ' ', _jsx("a", { href: PARA_CONNECT, target: "blank", children: _jsx(ClickableText, { variant: "bodyS", weight: "medium", children: "Para Connect" }) })] }), _jsx(CpslButton, { as: "a", href: PARA_CONNECT, target: "blank", variant: "ghost", children: _jsx(RightChevron, { icon: "chevronUp" }) })] }));
15
- }
16
- return (_jsxs(_Fragment, { children: [_jsxs(InlineText, { variant: "body2XS", color: "secondary", weight: "medium", children: ["By logging in you agree to our", ' ', _jsx("a", { href: PARA_TERMS_AND_CONDITIONS, target: "blank", children: _jsx(ClickableText, { variant: "body2XS", weight: "medium", children: "Terms & Conditions" }) })] }), _jsxs(PoweredByContainer, { children: [_jsx(InlineText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Powered by" }), _jsx(ParaLogo, { icon: "para" })] })] }));
17
- }, [isAccount]);
18
- if (!showFooter) {
19
- return null;
20
- }
21
- return (_jsx(FooterContainer, { slot: "footer", children: _jsx(FooterContentContainer, { children: Content }) }));
22
- };
23
- const FooterContainer = styled.div `
24
- display: flex;
25
- flex-direction: column;
26
- align-items: center;
27
- gap: 16px;
28
- padding: 8px 0px;
29
- `;
30
- const FooterContentContainer = styled.div `
31
- display: flex;
32
- flex-direction: column;
33
- align-items: center;
34
- gap: 8px;
35
- `;
36
- const PoweredByContainer = styled.div `
37
- display: flex;
38
- gap: 5px;
39
- align-items: center;
40
- justify-content: center;
41
- `;
42
- const ConnectContainer = styled.div `
43
- display: flex;
44
- gap: 8px;
45
- align-items: center;
46
- justify-content: center;
47
- `;
48
- const RightChevron = styled(CpslIcon) `
49
- transform: rotate(90deg);
50
-
51
- /* --icon-color: var(--cpsl-color-text-tertiary); */
52
- --height: 24px;
53
- --width: 24px;
54
- `;
55
- const InlineText = styled(CpslText) `
56
- text-align: center;
57
- display: inline-block;
58
- `;
59
- const ConnectText = styled(InlineText) `
60
- line-height: 20px;
61
- `;
62
- const ClickableText = styled(InlineText) `
63
- cursor: pointer;
64
- display: inline-block;
65
- `;
66
- const ParaLogo = styled(CpslIcon) `
67
- display: inline-block;
68
- --icon-color: var(--cpsl-color-text-secondary);
69
- --width: 49px;
70
- --height: auto;
71
- `;
@@ -1,24 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { styled } from 'styled-components';
3
- import { useStepTitle } from './hooks/useStepTitle.js';
4
- import { CenteredText } from '../common.js';
5
- import { AnimatePresence, motion } from 'framer-motion';
6
- import { useModalStore } from '../../stores/index.js';
7
- import { BODY_MOTION_VARIANTS, BODY_TRANSITION } from '../../constants/constants.js';
8
- export const Header = () => {
9
- const { title } = useStepTitle();
10
- const stepDirection = useModalStore(state => state.stepDirection);
11
- const currentStep = useModalStore(state => state.step);
12
- return (_jsx(AnimatePresence, { mode: "popLayout", initial: false, custom: stepDirection, children: _jsx(Container, { custom: stepDirection, variants: BODY_MOTION_VARIANTS, initial: "enter", animate: "center", exit: "exit", transition: BODY_TRANSITION, slot: "header", id: "header", children: _jsx(CenteredText, { weight: "semiBold", color: "secondary", children: title }) }, ['ADD_FUNDS_BUY', 'ADD_FUNDS_RECEIVE', 'ADD_FUNDS_WITHDRAW'].includes(currentStep) ? 'ADD_FUNDS' : currentStep) }));
13
- };
14
- const Container = styled(motion.div) `
15
- position: absolute;
16
- top: 16px;
17
- width: 100%;
18
- z-index: 2;
19
- display: flex;
20
- align-items: center;
21
- justify-content: space-between;
22
- gap: 8px;
23
- flex-wrap: wrap;
24
- `;
@@ -1,42 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { useModalStore } from '../../../stores/modal/useModalStore.js';
3
- import { ModalStep } from '../../../utils/steps.js';
4
- import { useExternalWallets } from '../../../providers/ExternalWalletContext.js';
5
- import { useThemeStore } from '../../../stores/index.js';
6
- export const useStepTitle = () => {
7
- const hideWallets = useThemeStore(state => state.hideWallets);
8
- const isLogin = useModalStore(state => state.isLogin());
9
- const currentStep = useModalStore(state => state.step);
10
- const { chainId } = useExternalWallets();
11
- const titles = useMemo(() => ({
12
- [ModalStep.AUTH_MAIN]: '',
13
- [ModalStep.AUTH_MORE]: 'Sign Up or Log In',
14
- [ModalStep.EX_WALLET_MORE]: 'Connect Wallet',
15
- [ModalStep.VERIFICATIONS]: 'Sign Up',
16
- [ModalStep.AWAITING_OAUTH]: isLogin ? 'Login' : 'Sign Up',
17
- [ModalStep.FARCASTER_OAUTH]: isLogin ? 'Login' : 'Sign Up',
18
- [ModalStep.BIOMETRIC_CREATION]: 'Sign Up',
19
- [ModalStep.PASSWORD_CREATION]: 'Sign Up',
20
- [ModalStep.AWAITING_BIOMETRIC_CREATION]: 'Sign Up',
21
- [ModalStep.AWAITING_WALLET_CREATION]: isLogin ? 'Login' : 'Sign Up',
22
- [ModalStep.AWAITING_PASSWORD_CREATION]: 'Sign Up',
23
- [ModalStep.WALLET_CREATION_DONE]: hideWallets ? 'Account Created' : 'Wallet Created',
24
- [ModalStep.SECRET]: isLogin ? 'Login' : 'Sign Up',
25
- [ModalStep.BIOMETRIC_LOGIN]: 'Login',
26
- [ModalStep.AWAITING_PASSWORD_LOGIN]: 'Login',
27
- [ModalStep.AWAITING_BIOMETRIC_LOGIN]: 'Login',
28
- [ModalStep.LOGIN_DONE]: '',
29
- [ModalStep.SETUP_2FA]: '2FA',
30
- [ModalStep.VERIFY_2FA]: '2FA',
31
- [ModalStep.TWO_FACTOR_DONE]: '2FA',
32
- [ModalStep.ADD_FUNDS_BUY]: '',
33
- [ModalStep.ADD_FUNDS_RECEIVE]: '',
34
- [ModalStep.ADD_FUNDS_WITHDRAW]: '',
35
- [ModalStep.ADD_FUNDS_AWAITING]: '',
36
- [ModalStep.ADD_FUNDS_SUCCESS]: '',
37
- [ModalStep.ADD_FUNDS_FAILURE]: '',
38
- [ModalStep.ACCOUNT_MAIN]: '',
39
- [ModalStep.CHAIN_SWITCH]: '',
40
- }), [isLogin, chainId, hideWallets]);
41
- return { title: titles[currentStep] };
42
- };
@@ -1,119 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { CpslHero, CpslIcon, CpslIdenticon } from '@getpara/react-components';
3
- import styled from 'styled-components';
4
- import { ModalStep } from '../../utils/steps.js';
5
- import { useModalStore } from '../../stores/index.js';
6
- import { useExternalWallets } from '../../providers/ExternalWalletContext.js';
7
- import { NETWORK_NOT_SUPPORTED_ERROR } from '../../constants/constants.js';
8
- import { useEffect, useState } from 'react';
9
- import { isMobile } from '@getpara/web-sdk';
10
- import { useActiveWallet } from '../../hooks/useActiveWallet.js';
11
- import { useInternalClient } from '../../../provider/hooks/utils/useInternalClient.js';
12
- const getStepConfig = ({ externalWalletError, }) => {
13
- var _a;
14
- return ({
15
- [ModalStep.EX_WALLET_SELECTED]: {
16
- variant: 'externalWalletConnection',
17
- topOffset: 40,
18
- spacerHeight: 158,
19
- hideFadeOut: true,
20
- },
21
- [ModalStep.CHAIN_SWITCH]: {
22
- variant: ((_a = externalWalletError === null || externalWalletError === void 0 ? void 0 : externalWalletError[0]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === NETWORK_NOT_SUPPORTED_ERROR ? 'failed' : 'externalWalletConnection',
23
- topOffset: 20,
24
- spacerHeight: 158,
25
- hideFadeOut: true,
26
- },
27
- [ModalStep.ACCOUNT_MAIN]: {
28
- variant: 'customContent',
29
- topOffset: 0,
30
- spacerHeight: 104,
31
- hideFadeOut: true,
32
- },
33
- [ModalStep.FARCASTER_OAUTH]: {
34
- variant: 'externalWalletConnection',
35
- topOffset: 40,
36
- spacerHeight: 158,
37
- hideFadeOut: true,
38
- },
39
- });
40
- };
41
- export const Hero = () => {
42
- const para = useInternalClient();
43
- const { wallet: connector, walletDisplayHelpers, avatar } = useExternalWallets();
44
- const step = useModalStore(state => state.step);
45
- const externalWalletError = useModalStore(state => state.externalWalletError);
46
- const activeWallet = useActiveWallet();
47
- const [currentStep, setCurrentStep] = useState(step);
48
- const stepConfig = getStepConfig({
49
- externalWalletError,
50
- })[currentStep];
51
- // Watching the step here to make the animation in/out of the hero look correct
52
- useEffect(() => {
53
- const prevStepConfig = getStepConfig({
54
- externalWalletError,
55
- })[currentStep];
56
- const newStepConfig = getStepConfig({
57
- externalWalletError,
58
- })[step];
59
- const delay = newStepConfig && prevStepConfig ? 0 : newStepConfig && !prevStepConfig ? 0 : 200;
60
- setTimeout(() => {
61
- setCurrentStep(step);
62
- }, delay);
63
- }, [step]);
64
- const isExternalStep = currentStep === ModalStep.EX_WALLET_SELECTED;
65
- const isChainSwitchStep = currentStep === ModalStep.CHAIN_SWITCH;
66
- const isAccountStep = currentStep === ModalStep.ACCOUNT_MAIN;
67
- const isFarcasterStep = currentStep === ModalStep.FARCASTER_OAUTH;
68
- const { showExtension, isCosmosMobileWallet } = walletDisplayHelpers;
69
- // Hide if:
70
- // 1. On a step with no hero config
71
- // 2. On the external wallet step and not showing the extension connection screen
72
- // 3. On the network switch step on web for Cosmos mobile connectors
73
- // 4. On the farcaster step on desktop
74
- const shouldHide = !stepConfig ||
75
- (!isMobile() && isExternalStep && !showExtension) ||
76
- (!isMobile() && isChainSwitchStep && isCosmosMobileWallet) ||
77
- (!isMobile() && isFarcasterStep);
78
- const { variant, topOffset, spacerHeight, hideFadeOut } = stepConfig !== null && stepConfig !== void 0 ? stepConfig : {};
79
- return (_jsxs(_Fragment, { children: [_jsx(Container, { "$top": -45 + topOffset, children: shouldHide ? null : (_jsxs(StyledHero, { "$isAccount": isAccountStep, hideFadeOut: hideFadeOut, variant: variant, height: 480, withDefaultTheme: true, children: [(isExternalStep || isChainSwitchStep) && _jsx(WalletLogo, { slot: "connectionLeft", src: connector === null || connector === void 0 ? void 0 : connector.iconUrl }), isFarcasterStep && _jsx(WalletLogo, { slot: "connectionLeft", icon: "farcasterBrand" }), isAccountStep &&
80
- (avatar ? (_jsx(Avatar, { slot: "image", src: avatar })) : activeWallet ? (_jsx(IconAvatar, { slot: "image", size: "100%", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) })) : null)] })) }), !shouldHide && _jsx(Spacer, { "$height": spacerHeight })] }));
81
- };
82
- const Container = styled.div `
83
- display: flex;
84
- position: absolute;
85
- justify-content: center;
86
- align-items: center;
87
- width: 100%;
88
-
89
- top: ${({ $top }) => `${$top}px`};
90
- `;
91
- const Spacer = styled.div `
92
- height: ${({ $height }) => `${$height}px`};
93
- `;
94
- const WalletLogo = styled(CpslIcon) `
95
- --height: 60px;
96
- --width: 60px;
97
- `;
98
- const Avatar = styled.img `
99
- width: 100%;
100
- height: 100%;
101
- object-fit: contain;
102
- `;
103
- const IconAvatar = styled(CpslIdenticon) `
104
- border-radius: 1000px;
105
- `;
106
- const StyledHero = styled(CpslHero) `
107
- ${({ $isAccount }) => $isAccount &&
108
- `
109
- --ring-3-size: 560px;
110
- --ring-2-size: 402px;
111
- --ring-1-size: 228px;
112
- --ring-0-size: 104px;
113
-
114
- --default-theme-ring-3-opacity: 0.02;
115
- --default-theme-ring-2-opacity: 0.04;
116
- --default-theme-ring-1-opacity: 0.06;
117
- --default-theme-ring-0-opacity: 0.1;
118
- `}
119
- `;
@@ -1,41 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useModalStore, useThemeStore } from '../../stores/index.js';
3
- import { IFrameSteps } from '../../utils/steps.js';
4
- import styled from 'styled-components';
5
- import { SpinnerContainer } from '@getpara/react-common';
6
- import { CpslSpinner } from '@getpara/react-components';
7
- import { MOBILE_SIZE } from '../../constants/constants.js';
8
- export const IFrameStep = () => {
9
- const iFrameUrl = useModalStore(state => state.iFrameUrl);
10
- const setIsReady = useModalStore(state => state.setIsIFrameReady);
11
- const isReady = useModalStore(state => state.isIFrameReady);
12
- const currentStep = useModalStore(state => state.step);
13
- const embeddedModal = useThemeStore(state => state.embeddedModal);
14
- return (_jsxs(OuterContainer, { "$isVisible": IFrameSteps.includes(currentStep), "$embeddedModal": embeddedModal, children: [_jsx(Container, { "$isReady": isReady, children: _jsx("iframe", { src: iFrameUrl, onLoad: () => {
15
- setIsReady(true);
16
- } }) }), !isReady && (_jsx(SpinnerContainer, { style: { width: '100%', height: '100%', flex: 1 }, children: _jsx(CpslSpinner, { size: 100 }) }))] }));
17
- };
18
- const OuterContainer = styled.div `
19
- height: ${({ $isVisible }) => ($isVisible ? '100%' : '0px')};
20
- width: ${({ $isVisible }) => ($isVisible ? '100%' : '0px')};
21
- flex: ${({ $isVisible }) => ($isVisible ? 1 : 'auto')};
22
- padding: ${({ $embeddedModal, $isVisible }) => (!$isVisible ? '0px' : $embeddedModal ? '12px 0px 0px' : '72px 72px 32px')};
23
- display: flex;
24
- align-items: center;
25
- justify-content: center;
26
-
27
- @media (max-width: ${MOBILE_SIZE}px) {
28
- padding: ${({ $embeddedModal, $isVisible }) => !$isVisible ? '0px' : $embeddedModal ? '12px 0px 0px' : '72px 16px 0px'};
29
- }
30
- `;
31
- const Container = styled.div `
32
- height: 100%;
33
- width: 100%;
34
- display: ${({ $isReady }) => ($isReady ? 'block' : 'none')};
35
-
36
- & > iframe {
37
- height: 360px;
38
- width: 100%;
39
- border: none;
40
- }
41
- `;
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect } from 'react';
3
- import { Heading, HeroIcon, StepContainer } from '../common.js';
4
- import { ExternalWalletCard, WalletCard, WalletCards } from '../WalletCard/WalletCard.js';
5
- import { useThemeStore } from '../../stores/index.js';
6
- import { useInternalClient } from '../../../provider/hooks/utils/useInternalClient.js';
7
- export const LoginDoneStep = ({ onClose }) => {
8
- var _a;
9
- const para = useInternalClient();
10
- const hideWallets = useThemeStore(state => state.hideWallets);
11
- useEffect(() => {
12
- setTimeout(() => {
13
- onClose();
14
- }, 1600);
15
- }, []);
16
- return (_jsxs(StepContainer, { children: [_jsx(HeroIcon, { icon: "checkCircleFilled" }), _jsx(Heading, { variant: "headingS", weight: "bold", children: "Connected" }), !hideWallets && (_jsx(WalletCards, { children: para.isUsingExternalWallet() ? (_jsx(ExternalWalletCard, { address: (_a = para.currentExternalWalletAddresses) === null || _a === void 0 ? void 0 : _a[0] })) : (para.currentWalletIdsArray.map(([id, type]) => {
17
- return _jsx(WalletCard, { id: id, type: type }, `${id}-${type}`);
18
- })) }))] }));
19
- };