@getpara/react-sdk 1.8.0 → 2.0.0-alpha.3

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 (248) hide show
  1. package/dist/{modal/components/AddFunds/MoonPayEmbed.js → MoonPayEmbed-Q2HP2BFI.js} +3 -1
  2. package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
  3. package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
  4. package/dist/chunk-MMUBH76A.js.br +0 -0
  5. package/dist/chunk-MMUBH76A.js.gz +0 -0
  6. package/dist/cli/cli.mjs +40 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +6499 -6
  9. package/dist/index.js.br +0 -0
  10. package/dist/index.js.gz +0 -0
  11. package/dist/modal/components/AuthInput/AuthInput.d.ts +1 -1
  12. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +4 -4
  13. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -1
  14. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -1
  15. package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -1
  16. package/dist/modal/components/Controls/Selects.d.ts +1 -1
  17. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +1 -1
  18. package/dist/modal/components/Footer/Footer.d.ts +1 -1
  19. package/dist/modal/components/WalletCard/WalletCard.d.ts +2 -2
  20. package/dist/modal/components/common.d.ts +7 -7
  21. package/dist/modal/constants/constants.d.ts +1 -1
  22. package/dist/modal/index.d.ts +0 -2
  23. package/dist/modal/stores/index.d.ts +0 -2
  24. package/dist/modal/stores/modal/useModalStore.d.ts +22 -20
  25. package/dist/modal/types/commonTypes.d.ts +4 -9
  26. package/dist/modal/types/externalWallets.d.ts +0 -2
  27. package/dist/modal/types/modalProps.d.ts +1 -33
  28. package/dist/modal/utils/authLayoutHelpers.d.ts +2 -2
  29. package/dist/modal/utils/getTileButtonFlex.d.ts +1 -1
  30. package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
  31. package/dist/modal/utils/openPopup.d.ts +2 -2
  32. package/dist/modal/utils/stringFormatters.d.ts +0 -1
  33. package/dist/provider/ParaProvider.d.ts +3 -1
  34. package/dist/provider/actions/getAccount.d.ts +19 -7
  35. package/dist/provider/actions/getWallet.d.ts +1 -1
  36. package/dist/provider/actions/index.d.ts +25 -0
  37. package/dist/provider/actions/utils.d.ts +3 -0
  38. package/dist/provider/components/CosmosWalletWrapper.d.ts +11 -0
  39. package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
  40. package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
  41. package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
  42. package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
  43. package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
  44. package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
  45. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +12 -0
  46. package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +3 -0
  47. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +8 -0
  48. package/dist/provider/hooks/mutations/index.d.ts +25 -10
  49. package/dist/provider/hooks/mutations/utils.d.ts +4 -0
  50. package/dist/provider/hooks/queries/index.d.ts +0 -1
  51. package/dist/provider/hooks/queries/useAccount.d.ts +1 -6
  52. package/dist/provider/hooks/queries/useWallet.d.ts +1 -1
  53. package/dist/provider/hooks/utils/useWalletState.d.ts +3 -2
  54. package/dist/provider/index.d.ts +1 -0
  55. package/dist/provider/providers/AuthProvider.d.ts +31 -0
  56. package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
  57. package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
  58. package/dist/provider/providers/ExternalWalletProvider.d.ts +73 -0
  59. package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
  60. package/dist/provider/stores/getters.d.ts +3 -3
  61. package/dist/provider/stores/setters.d.ts +1 -0
  62. package/dist/provider/stores/slices/config.d.ts +3 -0
  63. package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
  64. package/dist/provider/stores/slices/index.d.ts +1 -0
  65. package/dist/provider/stores/types.d.ts +46 -3
  66. package/dist/provider/types/externalWalletProviders.d.ts +12 -0
  67. package/dist/provider/types/provider.d.ts +119 -16
  68. package/dist/provider/types/utils.d.ts +16 -0
  69. package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
  70. package/dist/provider/utils/renameMutations.d.ts +3 -0
  71. package/package.json +19 -7
  72. package/dist/modal/ParaModal.js +0 -362
  73. package/dist/modal/components/Account/Account.js +0 -77
  74. package/dist/modal/components/AddFunds/AddFunds.js +0 -220
  75. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -72
  76. package/dist/modal/components/AddFunds/AddFundsDone.js +0 -43
  77. package/dist/modal/components/AddFunds/index.js +0 -4
  78. package/dist/modal/components/AuthInput/AuthInput.js +0 -283
  79. package/dist/modal/components/AuthInput/countryCodes.js +0 -42
  80. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -33
  81. package/dist/modal/components/AuthInput/phoneMasks.js +0 -253
  82. package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -37
  83. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -113
  84. package/dist/modal/components/AuthOptions/AuthOptions.js +0 -33
  85. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -18
  86. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -10
  87. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -18
  88. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -44
  89. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -55
  90. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -93
  91. package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -29
  92. package/dist/modal/components/Body/Body.js +0 -308
  93. package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -94
  94. package/dist/modal/components/ChainSwitch/config.js +0 -17
  95. package/dist/modal/components/Controls/Controls.js +0 -74
  96. package/dist/modal/components/Controls/Selects.js +0 -234
  97. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -140
  98. package/dist/modal/components/ExternalWalletStep/config.js +0 -17
  99. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +0 -96
  100. package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -172
  101. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +0 -8
  102. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -124
  103. package/dist/modal/components/Footer/Footer.js +0 -93
  104. package/dist/modal/components/Header/Header.js +0 -43
  105. package/dist/modal/components/Header/hooks/useStepTitle.js +0 -50
  106. package/dist/modal/components/Hero/Hero.js +0 -116
  107. package/dist/modal/components/IFrameStep/IFrameStep.js +0 -55
  108. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -28
  109. package/dist/modal/components/ModalContent/ModalContent.js +0 -324
  110. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -81
  111. package/dist/modal/components/OAuth/OAuth.js +0 -153
  112. package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -139
  113. package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -23
  114. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -77
  115. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -101
  116. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -141
  117. package/dist/modal/components/StripeComponents/StripeComponents.js +0 -88
  118. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -24
  119. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -159
  120. package/dist/modal/components/Waiting/Waiting.js +0 -17
  121. package/dist/modal/components/WalletCard/PartnerIcon.js +0 -34
  122. package/dist/modal/components/WalletCard/WalletCard.js +0 -127
  123. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -52
  124. package/dist/modal/components/common.js +0 -96
  125. package/dist/modal/components/index.js +0 -2
  126. package/dist/modal/constants/constants.js +0 -111
  127. package/dist/modal/constants/defaults.js +0 -10
  128. package/dist/modal/constants/oAuthLogos.js +0 -24
  129. package/dist/modal/hooks/useActiveWallet.d.ts +0 -1
  130. package/dist/modal/hooks/useActiveWallet.js +0 -15
  131. package/dist/modal/hooks/useCreateAccount.d.ts +0 -4
  132. package/dist/modal/hooks/useCreateAccount.js +0 -72
  133. package/dist/modal/hooks/useEmbeddedExternalConnection.d.ts +0 -1
  134. package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -54
  135. package/dist/modal/hooks/useGoBack.js +0 -42
  136. package/dist/modal/hooks/useSetLoginURLs.d.ts +0 -8
  137. package/dist/modal/hooks/useSetLoginURLs.js +0 -49
  138. package/dist/modal/hooks/useWalletBalance.d.ts +0 -4
  139. package/dist/modal/hooks/useWalletBalance.js +0 -47
  140. package/dist/modal/index.js +0 -33
  141. package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +0 -42
  142. package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -38
  143. package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +0 -46
  144. package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -55
  145. package/dist/modal/providers/ExternalWalletContext.d.ts +0 -92
  146. package/dist/modal/providers/ExternalWalletContext.js +0 -394
  147. package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +0 -32
  148. package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -32
  149. package/dist/modal/stores/externalWalletProvider/actions.d.ts +0 -3
  150. package/dist/modal/stores/externalWalletProvider/actions.js +0 -10
  151. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +0 -22
  152. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -21
  153. package/dist/modal/stores/index.js +0 -4
  154. package/dist/modal/stores/modal/actions.js +0 -70
  155. package/dist/modal/stores/modal/useModalStore.js +0 -65
  156. package/dist/modal/stores/theme/actions.d.ts +0 -3
  157. package/dist/modal/stores/theme/actions.js +0 -28
  158. package/dist/modal/stores/theme/useThemeStore.d.ts +0 -20
  159. package/dist/modal/stores/theme/useThemeStore.js +0 -21
  160. package/dist/modal/stores/userInfo/actions.d.ts +0 -3
  161. package/dist/modal/stores/userInfo/actions.js +0 -30
  162. package/dist/modal/stores/userInfo/useUserInfoStore.d.ts +0 -19
  163. package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -17
  164. package/dist/modal/types/commonTypes.js +0 -1
  165. package/dist/modal/types/externalWallets.js +0 -32
  166. package/dist/modal/types/modalProps.js +0 -12
  167. package/dist/modal/utils/authLayoutHelpers.js +0 -8
  168. package/dist/modal/utils/getMailtoLink.js +0 -10
  169. package/dist/modal/utils/getTileButtonFlex.js +0 -20
  170. package/dist/modal/utils/openPopup.js +0 -60
  171. package/dist/modal/utils/routeMobileExternalWallet.js +0 -31
  172. package/dist/modal/utils/steps.js +0 -232
  173. package/dist/modal/utils/stringFormatters.js +0 -19
  174. package/dist/modal/utils/validateOnRampConfig.js +0 -32
  175. package/dist/package.json +0 -6
  176. package/dist/provider/ParaProvider.js +0 -22
  177. package/dist/provider/actions/checkIfUserExists.d.ts +0 -9
  178. package/dist/provider/actions/checkIfUserExists.js +0 -21
  179. package/dist/provider/actions/createUser.d.ts +0 -12
  180. package/dist/provider/actions/createUser.js +0 -26
  181. package/dist/provider/actions/getAccount.js +0 -22
  182. package/dist/provider/actions/getWallet.js +0 -14
  183. package/dist/provider/actions/getWalletBalance.d.ts +0 -2
  184. package/dist/provider/actions/getWalletBalance.js +0 -14
  185. package/dist/provider/actions/initiateLogin.d.ts +0 -4
  186. package/dist/provider/actions/initiateLogin.js +0 -20
  187. package/dist/provider/actions/keepSessionAlive.d.ts +0 -2
  188. package/dist/provider/actions/keepSessionAlive.js +0 -20
  189. package/dist/provider/actions/logout.d.ts +0 -2
  190. package/dist/provider/actions/logout.js +0 -17
  191. package/dist/provider/actions/signMessage.d.ts +0 -8
  192. package/dist/provider/actions/signMessage.js +0 -20
  193. package/dist/provider/actions/signTransaction.d.ts +0 -8
  194. package/dist/provider/actions/signTransaction.js +0 -20
  195. package/dist/provider/actions/waitForAccountCreation.d.ts +0 -2
  196. package/dist/provider/actions/waitForAccountCreation.js +0 -21
  197. package/dist/provider/actions/waitForLoginAndSetup.d.ts +0 -6
  198. package/dist/provider/actions/waitForLoginAndSetup.js +0 -24
  199. package/dist/provider/actions/waitForPasskeyAndCreateWallet.d.ts +0 -2
  200. package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -21
  201. package/dist/provider/hooks/index.js +0 -4
  202. package/dist/provider/hooks/mutations/index.js +0 -24
  203. package/dist/provider/hooks/mutations/useCheckIfUserExists.d.ts +0 -13
  204. package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
  205. package/dist/provider/hooks/mutations/useCreateUser.d.ts +0 -13
  206. package/dist/provider/hooks/mutations/useCreateUser.js +0 -20
  207. package/dist/provider/hooks/mutations/useInitiateLogin.d.ts +0 -14
  208. package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
  209. package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +0 -12
  210. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -20
  211. package/dist/provider/hooks/mutations/useLogout.d.ts +0 -12
  212. package/dist/provider/hooks/mutations/useLogout.js +0 -30
  213. package/dist/provider/hooks/mutations/useSignMessage.d.ts +0 -15
  214. package/dist/provider/hooks/mutations/useSignMessage.js +0 -39
  215. package/dist/provider/hooks/mutations/useSignTransaction.d.ts +0 -14
  216. package/dist/provider/hooks/mutations/useSignTransaction.js +0 -39
  217. package/dist/provider/hooks/mutations/useWaitForAccountCreation.d.ts +0 -12
  218. package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
  219. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.d.ts +0 -14
  220. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
  221. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.d.ts +0 -13
  222. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
  223. package/dist/provider/hooks/queries/index.js +0 -10
  224. package/dist/provider/hooks/queries/useAccount.js +0 -21
  225. package/dist/provider/hooks/queries/useWallet.js +0 -22
  226. package/dist/provider/hooks/queries/useWalletBalance.d.ts +0 -7
  227. package/dist/provider/hooks/queries/useWalletBalance.js +0 -26
  228. package/dist/provider/hooks/utils/index.js +0 -10
  229. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -74
  230. package/dist/provider/hooks/utils/useClient.js +0 -10
  231. package/dist/provider/hooks/utils/useEventListeners.js +0 -105
  232. package/dist/provider/hooks/utils/useInternalClient.js +0 -10
  233. package/dist/provider/hooks/utils/useModal.js +0 -17
  234. package/dist/provider/hooks/utils/useWalletState.js +0 -33
  235. package/dist/provider/index.js +0 -8
  236. package/dist/provider/stores/getters.js +0 -13
  237. package/dist/provider/stores/slices/client.js +0 -9
  238. package/dist/provider/stores/slices/index.js +0 -4
  239. package/dist/provider/stores/slices/modal.js +0 -9
  240. package/dist/provider/stores/slices/wallet.js +0 -13
  241. package/dist/provider/stores/types.js +0 -1
  242. package/dist/provider/stores/useStore.js +0 -27
  243. package/dist/provider/types/provider.js +0 -1
  244. package/dist/provider/types/query.js +0 -1
  245. package/dist/provider/types/utils.js +0 -1
  246. package/dist/provider/utils/constants.d.ts +0 -5
  247. package/dist/provider/utils/constants.js +0 -11
  248. package/dist/provider/utils/renameMutations.js +0 -16
@@ -1,29 +0,0 @@
1
- "use client";
2
- import "../../../chunk-MMUBH76A.js";
3
- import { jsx } from "react/jsx-runtime";
4
- import { motion } from "framer-motion";
5
- import { useEffect, useRef, useState } from "react";
6
- import styled from "styled-components";
7
- const AnimatedHeightWrapper = ({ children, className }) => {
8
- const containerRef = useRef(null);
9
- const [height, setHeight] = useState("auto");
10
- useEffect(() => {
11
- if (containerRef.current) {
12
- const resizeObserver = new ResizeObserver((entries) => {
13
- const observedHeight = entries[0].contentRect.height;
14
- setHeight(observedHeight);
15
- });
16
- resizeObserver.observe(containerRef.current);
17
- return () => {
18
- resizeObserver.disconnect();
19
- };
20
- }
21
- }, []);
22
- return /* @__PURE__ */ jsx(Container, { className, style: { height }, animate: { height }, transition: { duration: 0.2 }, children: /* @__PURE__ */ jsx("div", { ref: containerRef, children }) });
23
- };
24
- const Container = styled(motion.div)`
25
- overflow: hidden;
26
- `;
27
- export {
28
- AnimatedHeightWrapper
29
- };
@@ -1,308 +0,0 @@
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 { IFrameSteps, ModalStep } from "../../utils/steps.js";
6
- import { CpslAlert, CpslIcon } from "@getpara/react-components";
7
- import { VerificationCodeStep } from "../VerificationCodeStep/VerificationCodeStep.js";
8
- import { ExternalWalletVerificationStep } from "../ExternalWalletVerificationStep/ExternalWalletVerificationStep.js";
9
- import { useModalStore, useThemeStore } from "../../stores/index.js";
10
- import { BiometricLoginStep } from "../BiometricLoginStep/BiometricLoginStep.js";
11
- import { Setup2FAStep } from "../Setup2FAStep/Setup2FAStep.js";
12
- import { LoginDoneStep } from "../LoginDoneStep/LoginDoneStep.js";
13
- import { EnabledFlow } from "@getpara/web-sdk";
14
- import { AwaitingBiometricsStep } from "../AwaitingBiometricsStep/AwaitingBiometricsStep.js";
15
- import { AwaitingWalletCreationStep } from "../AwaitingWalletCreationStep/AwaitingWalletCreationStep.js";
16
- import { WalletCreationDoneStep } from "../WalletCreationDoneStep/WalletCreationDoneStep.js";
17
- import { RecoverySecretStep } from "../RecoverySecretStep/RecoverySecretStep.js";
18
- import { TwoFactorDoneStep } from "../TwoFactorDoneStep/TwoFactorDoneStep.js";
19
- import { BiometricCreationStep } from "../BiometricCreationStep/BiometricCreationStep.js";
20
- import { AwaitingOAuthStep } from "../AwaitingOAuthStep/AwaitingOAuthStep.js";
21
- import { AddFundsAwaiting, AddFundsDone, AddFunds } from "../AddFunds/index.js";
22
- import FarcasterOAuthStep from "../OAuth/FarcasterOAuthStep.js";
23
- import { Header } from "../Header/Header.js";
24
- import { AuthMainStep } from "../AuthMainStep/AuthMainStep.js";
25
- import { BODY_MOTION_VARIANTS, BODY_TRANSITION, MOBILE_SIZE } from "../../constants/constants.js";
26
- import { Account } from "../Account/Account.js";
27
- import { AuthOptions } from "../AuthOptions/AuthOptions.js";
28
- import { ExternalWallets } from "../ExternalWallets/ExternalWallets.js";
29
- import { ExternalWalletStep } from "../ExternalWalletStep/ExternalWalletStep.js";
30
- import { Hero } from "../Hero/Hero.js";
31
- import { AnimatedHeightWrapper } from "./AnimatedHeightWrapper.js";
32
- import { ChainSwitch } from "../ChainSwitch/ChainSwitch.js";
33
- import { motion, AnimatePresence } from "framer-motion";
34
- import { Controls } from "../Controls/Controls.js";
35
- import { useEffect, useState } from "react";
36
- import { TelegramOAuthStep } from "../OAuth/TelegramOAuthStep.js";
37
- import { AwaitingPasswordStep } from "../AwaitingPasswordStep/AwaitingPasswordStep.js";
38
- import { IFrameStep } from "../IFrameStep/IFrameStep.js";
39
- const MIN_HEIGHT = {
40
- [ModalStep.ADD_FUNDS_AWAITING]: "680px"
41
- };
42
- const PADDING_TOP = {
43
- [ModalStep.TELEGRAM_OAUTH]: "36px"
44
- };
45
- const PADDING_BOTTOM = {
46
- [ModalStep.TELEGRAM_OAUTH]: "16px"
47
- };
48
- const Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhoneLogin, onClose }) => {
49
- const currentStep = useModalStore((state) => state.step);
50
- const onRampConfig = useModalStore((state) => state.onRampConfig);
51
- const stepDirection = useModalStore((state) => state.stepDirection);
52
- const setStepDirection = useModalStore((state) => state.setStepDirection);
53
- const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
54
- const setAccountAddFundTab = useModalStore((state) => state.setAccountAddFundTab);
55
- const appName = useThemeStore((state) => state.appName);
56
- const embeddedModal = useThemeStore((state) => state.embeddedModal);
57
- const [isTestModeAlert, setIsTestModeAlert] = useState(onRampConfig == null ? void 0 : onRampConfig.testMode);
58
- const Content = () => {
59
- switch (currentStep) {
60
- case ModalStep.AUTH_MAIN: {
61
- return /* @__PURE__ */ jsx(
62
- AuthMainStep,
63
- {
64
- oAuthMethods,
65
- disableEmailLogin,
66
- disablePhoneLogin
67
- }
68
- );
69
- }
70
- case ModalStep.EX_WALLET_MORE: {
71
- return /* @__PURE__ */ jsx(ExternalWallets, {});
72
- }
73
- case ModalStep.AUTH_MORE: {
74
- return /* @__PURE__ */ jsx(
75
- AuthOptions,
76
- {
77
- oAuthMethods,
78
- disableEmailLogin,
79
- disablePhoneLogin
80
- }
81
- );
82
- }
83
- case ModalStep.VERIFICATIONS: {
84
- return /* @__PURE__ */ jsx(VerificationCodeStep, {});
85
- }
86
- case ModalStep.EXTERNAL_WALLET_VERIFICATION: {
87
- return /* @__PURE__ */ jsx(ExternalWalletVerificationStep, {});
88
- }
89
- case ModalStep.BIOMETRIC_LOGIN: {
90
- return /* @__PURE__ */ jsx(BiometricLoginStep, {});
91
- }
92
- case ModalStep.SETUP_2FA:
93
- case ModalStep.VERIFY_2FA: {
94
- return /* @__PURE__ */ jsx(Setup2FAStep, { onClose });
95
- }
96
- case ModalStep.LOGIN_DONE: {
97
- return /* @__PURE__ */ jsx(LoginDoneStep, { onClose });
98
- }
99
- case ModalStep.AWAITING_BIOMETRIC_LOGIN:
100
- case ModalStep.AWAITING_BIOMETRIC_CREATION: {
101
- return /* @__PURE__ */ jsx(AwaitingBiometricsStep, {});
102
- }
103
- case ModalStep.AWAITING_PASSWORD_LOGIN:
104
- case ModalStep.AWAITING_PASSWORD_CREATION: {
105
- return /* @__PURE__ */ jsx(AwaitingPasswordStep, {});
106
- }
107
- case ModalStep.AWAITING_WALLET_CREATION: {
108
- return /* @__PURE__ */ jsx(AwaitingWalletCreationStep, {});
109
- }
110
- case ModalStep.WALLET_CREATION_DONE: {
111
- return /* @__PURE__ */ jsx(WalletCreationDoneStep, { twoFactorAuthEnabled, onClose });
112
- }
113
- case ModalStep.SECRET: {
114
- return /* @__PURE__ */ jsx(RecoverySecretStep, {});
115
- }
116
- case ModalStep.TWO_FACTOR_DONE: {
117
- return /* @__PURE__ */ jsx(TwoFactorDoneStep, { onClose });
118
- }
119
- case ModalStep.BIOMETRIC_CREATION: {
120
- return /* @__PURE__ */ jsx(BiometricCreationStep, {});
121
- }
122
- case ModalStep.AWAITING_OAUTH: {
123
- return /* @__PURE__ */ jsx(AwaitingOAuthStep, {});
124
- }
125
- case ModalStep.FARCASTER_OAUTH: {
126
- return /* @__PURE__ */ jsx(FarcasterOAuthStep, {});
127
- }
128
- case ModalStep.TELEGRAM_OAUTH: {
129
- return /* @__PURE__ */ jsx(TelegramOAuthStep, {});
130
- }
131
- case ModalStep.ADD_FUNDS_BUY:
132
- case ModalStep.ADD_FUNDS_RECEIVE:
133
- case ModalStep.ADD_FUNDS_WITHDRAW: {
134
- return /* @__PURE__ */ jsx(AddFunds, {});
135
- }
136
- case ModalStep.ADD_FUNDS_AWAITING: {
137
- return /* @__PURE__ */ jsx(AddFundsAwaiting, {});
138
- }
139
- case ModalStep.ADD_FUNDS_SUCCESS: {
140
- return /* @__PURE__ */ jsx(AddFundsDone, { isSuccess: true, onClose });
141
- }
142
- case ModalStep.ADD_FUNDS_FAILURE: {
143
- return /* @__PURE__ */ jsx(AddFundsDone, { onClose });
144
- }
145
- case ModalStep.ACCOUNT_MAIN: {
146
- return /* @__PURE__ */ jsx(Account, { onClose });
147
- }
148
- case ModalStep.EX_WALLET_SELECTED: {
149
- return /* @__PURE__ */ jsx(ExternalWalletStep, {});
150
- }
151
- case ModalStep.CHAIN_SWITCH: {
152
- return /* @__PURE__ */ jsx(ChainSwitch, {});
153
- }
154
- default: {
155
- if (IFrameSteps.includes(currentStep)) {
156
- return null;
157
- }
158
- }
159
- }
160
- };
161
- useEffect(() => {
162
- if (!isTestModeAlert && (onRampConfig == null ? void 0 : onRampConfig.testMode)) {
163
- setIsTestModeAlert(true);
164
- }
165
- }, [onRampConfig == null ? void 0 : onRampConfig.testMode]);
166
- useEffect(() => {
167
- switch (currentStep) {
168
- case ModalStep.ADD_FUNDS_BUY:
169
- setAccountAddFundTab(EnabledFlow.BUY);
170
- break;
171
- case ModalStep.ADD_FUNDS_RECEIVE:
172
- setAccountAddFundTab(EnabledFlow.RECEIVE);
173
- break;
174
- case ModalStep.ADD_FUNDS_WITHDRAW:
175
- setAccountAddFundTab(EnabledFlow.WITHDRAW);
176
- break;
177
- default:
178
- break;
179
- }
180
- }, [currentStep]);
181
- return /* @__PURE__ */ jsxs(Container, { slot: "body", "data-testid": "modal-content", children: [
182
- !embeddedModal && /* @__PURE__ */ jsxs(Fragment, { children: [
183
- /* @__PURE__ */ jsx(Controls, { onClose }),
184
- /* @__PURE__ */ jsx(Header, {})
185
- ] }),
186
- /* @__PURE__ */ jsxs(AnimatedWrapper, { children: [
187
- /* @__PURE__ */ jsx(
188
- AnimatePresence,
189
- {
190
- mode: "popLayout",
191
- initial: false,
192
- onExitComplete: () => {
193
- setStepDirection(1);
194
- },
195
- custom: stepDirection,
196
- children: /* @__PURE__ */ jsxs(
197
- BodyContainer,
198
- {
199
- custom: stepDirection,
200
- variants: BODY_MOTION_VARIANTS,
201
- initial: "enter",
202
- animate: "center",
203
- exit: "exit",
204
- transition: BODY_TRANSITION,
205
- children: [
206
- /* @__PURE__ */ jsx(Hero, {}),
207
- /* @__PURE__ */ jsxs(
208
- InnerContainer,
209
- {
210
- $embeddedModal: embeddedModal,
211
- $step: currentStep,
212
- $isIFrameStep: IFrameSteps.includes(currentStep),
213
- children: [
214
- Content(),
215
- (onRampConfig == null ? void 0 : onRampConfig.testMode) && [
216
- ModalStep.ADD_FUNDS_BUY,
217
- ModalStep.ADD_FUNDS_WITHDRAW,
218
- ModalStep.ADD_FUNDS_AWAITING,
219
- ModalStep.ADD_FUNDS_FAILURE,
220
- ModalStep.ADD_FUNDS_SUCCESS
221
- ].includes(currentStep) && isTestModeAlert && accountAddFundTab !== EnabledFlow.RECEIVE && /* @__PURE__ */ jsx(TestModeAlert, { children: /* @__PURE__ */ jsxs("div", { style: { fontSize: "14px" }, children: [
222
- "This Para Modal is configured to run on-ramp services in ",
223
- /* @__PURE__ */ jsx("b", { children: "test mode" }),
224
- " only, for development purposes. If you are a user of ",
225
- appName,
226
- ", please contact support.",
227
- /* @__PURE__ */ jsx(CloseButton, { onClick: () => setIsTestModeAlert(false), children: /* @__PURE__ */ jsx(CloseX, { icon: "x" }) })
228
- ] }) })
229
- ]
230
- }
231
- )
232
- ]
233
- },
234
- ["ADD_FUNDS_BUY", "ADD_FUNDS_RECEIVE", "ADD_FUNDS_WITHDRAW"].includes(currentStep) ? "ADD_FUNDS" : currentStep
235
- )
236
- }
237
- ),
238
- /* @__PURE__ */ jsx(IFrameStep, {})
239
- ] })
240
- ] });
241
- };
242
- const Container = styled.div`
243
- position: relative;
244
- `;
245
- const AnimatedWrapper = styled(AnimatedHeightWrapper)`
246
- margin-top: -16px;
247
- `;
248
- const BodyContainer = styled(motion.div)`
249
- position: relative;
250
- display: flex;
251
- flex-direction: column;
252
- gap: 24px;
253
- will-change: auto !important;
254
- `;
255
- const InnerContainer = styled.div`
256
- z-index: 1;
257
- flex: 1;
258
- display: flex;
259
- flex-direction: column;
260
- justify-content: flex-start;
261
- gap: 24px;
262
- padding: ${({ $embeddedModal, $step, $isIFrameStep }) => {
263
- var _a, _b;
264
- return $isIFrameStep ? "0px" : $embeddedModal ? "12px 0px 0px" : `${(_a = PADDING_TOP[$step]) != null ? _a : "72px"} 72px ${(_b = PADDING_BOTTOM[$step]) != null ? _b : "32px"}`;
265
- }};
266
- min-height: ${({ $step }) => {
267
- var _a;
268
- return (_a = MIN_HEIGHT[$step]) != null ? _a : "auto";
269
- }};
270
- height: ${({ $step }) => {
271
- var _a;
272
- return (_a = MIN_HEIGHT[$step]) != null ? _a : "auto";
273
- }};
274
-
275
- @media (max-width: ${MOBILE_SIZE}px) {
276
- padding: ${({ $embeddedModal, $step, $isIFrameStep }) => {
277
- var _a;
278
- return $isIFrameStep ? "0px" : $embeddedModal ? "12px 0px 0px" : `${(_a = PADDING_TOP[$step]) != null ? _a : "72px"} 16px 0px`;
279
- }};
280
- }
281
-
282
- cpsl-auth-modal.force-mobile-media & {
283
- padding: 72px 16px 0px;
284
- }
285
- `;
286
- const TestModeAlert = styled(CpslAlert)`
287
- --container-padding-end: 40px;
288
- position: absolute;
289
- bottom: 16px;
290
- left: 16px;
291
- right: 16px;
292
- z-index: 1000;
293
- `;
294
- const CloseButton = styled.button`
295
- background-color: transparent;
296
- border: none;
297
- padding: 4px;
298
- cursor: pointer;
299
- position: absolute;
300
- top: 0;
301
- right: 0;
302
- `;
303
- const CloseX = styled(CpslIcon)`
304
- --icon-color: var(--cpsl-color-foreground-0);
305
- `;
306
- export {
307
- Body
308
- };
@@ -1,94 +0,0 @@
1
- "use client";
2
- import {
3
- __async
4
- } from "../../../chunk-MMUBH76A.js";
5
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
- import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
7
- import { CenteredText, InnerStepContainer, QRContainer, StepContainer } from "../common.js";
8
- import { useEffect, useMemo } from "react";
9
- import { useModalStore } from "../../stores/index.js";
10
- import styled from "styled-components";
11
- import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
12
- import { useCopyToClipboard } from "@getpara/react-common";
13
- import { ModalStep } from "../../utils/steps.js";
14
- import { routeMobileExternalWallet } from "../../utils/routeMobileExternalWallet.js";
15
- import { NETWORK_NOT_SUPPORTED_ERROR } from "../../constants/constants.js";
16
- import { WalletType } from "@getpara/web-sdk";
17
- const ChainSwitch = () => {
18
- const [isCopied, copy] = useCopyToClipboard();
19
- const externalWalletError = useModalStore((state) => state.externalWalletError);
20
- const setStep = useModalStore((state) => state.setStep);
21
- const setStepDirection = useModalStore((state) => state.setStepDirection);
22
- const { switchChain, wallet, qrUri, chainIdSwitchingTo, walletDisplayHelpers } = useExternalWallets();
23
- useEffect(() => {
24
- if ((wallet == null ? void 0 : wallet.type) === WalletType.COSMOS) {
25
- routeMobileExternalWallet(qrUri);
26
- }
27
- }, [qrUri, wallet]);
28
- useEffect(() => {
29
- if (!wallet) {
30
- setStepDirection(-1);
31
- setStep(ModalStep.ACCOUNT_MAIN);
32
- }
33
- }, [wallet]);
34
- const handleTryAgainClick = () => __async(void 0, null, function* () {
35
- if (chainIdSwitchingTo) {
36
- yield switchChain(chainIdSwitchingTo);
37
- }
38
- });
39
- const handleCopy = () => {
40
- copy(qrUri);
41
- };
42
- const Content = useMemo(() => {
43
- var _a;
44
- if (!wallet) {
45
- return null;
46
- }
47
- const { isCosmosMobileWallet } = walletDisplayHelpers;
48
- if (isCosmosMobileWallet) {
49
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
50
- /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", children: "Scan with your mobile device to switch networks" }),
51
- /* @__PURE__ */ jsx(QRContainer, { children: !qrUri ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: qrUri, imageSrc: wallet.iconUrl }) }),
52
- /* @__PURE__ */ jsxs(CpslButton, { size: "small", variant: "ghost", onClick: handleCopy, children: [
53
- /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: isCopied ? "check" : "copy" }),
54
- isCopied ? "Copied" : "Copy Link"
55
- ] })
56
- ] }) });
57
- }
58
- return /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
59
- !(externalWalletError == null ? void 0 : externalWalletError.length) ? /* @__PURE__ */ jsx(CenteredText, { color: "contrast", weight: "semiBold", children: `Confirm the request to change networks in your ${wallet.name} wallet.` }) : /* @__PURE__ */ jsxs(Fragment, { children: [
60
- /* @__PURE__ */ jsxs(ErrorContainer, { children: [
61
- /* @__PURE__ */ jsx(ErrorIcon, { icon: "alertCircle" }),
62
- /* @__PURE__ */ jsx(CenteredText, { weight: "semiBold", color: "error", children: externalWalletError[0] })
63
- ] }),
64
- externalWalletError[1] && /* @__PURE__ */ jsx(CenteredText, { color: "secondary", weight: "medium", children: externalWalletError[1] })
65
- ] }),
66
- ((_a = externalWalletError == null ? void 0 : externalWalletError[0]) == null ? void 0 : _a.toLowerCase()) !== NETWORK_NOT_SUPPORTED_ERROR && /* @__PURE__ */ jsxs(CpslButton, { variant: "secondary", onClick: handleTryAgainClick, children: [
67
- /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "refresh" }),
68
- "Try Again"
69
- ] })
70
- ] });
71
- }, [wallet, walletDisplayHelpers, externalWalletError, qrUri]);
72
- if (!wallet) {
73
- return null;
74
- }
75
- return /* @__PURE__ */ jsx(Container, { children: Content });
76
- };
77
- const Container = styled(StepContainer)`
78
- flex: 1;
79
- justify-content: space-between;
80
- `;
81
- const ErrorContainer = styled.div`
82
- display: flex;
83
- align-items: center;
84
- justify-content: center;
85
- gap: 4px;
86
- `;
87
- const ErrorIcon = styled(CpslIcon)`
88
- --height: 16px;
89
- --width: 16px;
90
- --icon-color: var(--cpsl-color-text-error);
91
- `;
92
- export {
93
- ChainSwitch
94
- };
@@ -1,17 +0,0 @@
1
- "use client";
2
- import "../../../chunk-MMUBH76A.js";
3
- var TabValue = /* @__PURE__ */ ((TabValue2) => {
4
- TabValue2["extension"] = "extension";
5
- TabValue2["mobile"] = "mobile";
6
- TabValue2["web"] = "web";
7
- return TabValue2;
8
- })(TabValue || {});
9
- const TABS = {
10
- extension: { label: "Extension", value: "extension" /* extension */, icon: "puzzlePiece" },
11
- mobile: { label: "Mobile", value: "mobile" /* mobile */, icon: "phone" },
12
- web: { label: "Web", value: "web" /* web */, icon: "globe" }
13
- };
14
- export {
15
- TABS,
16
- TabValue
17
- };
@@ -1,74 +0,0 @@
1
- "use client";
2
- import "../../../chunk-MMUBH76A.js";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- import { CpslIcon } from "@getpara/react-components";
5
- import { styled } from "styled-components";
6
- import { useModalStore } from "../../stores/index.js";
7
- import { useThemeStore } from "../../stores/theme/useThemeStore.js";
8
- import { useGoBack } from "../../hooks/useGoBack.js";
9
- import { AccountSelect, ChainSelect } from "./Selects.js";
10
- import { ModalStep } from "../../utils/steps.js";
11
- import { HeaderButton } from "@getpara/react-common";
12
- const Controls = ({ onClose }) => {
13
- const bareModal = useThemeStore((state) => state.bareModal);
14
- const hasPreviousStep = useModalStore((state) => state.hasPreviousStep());
15
- const step = useModalStore((state) => state.step);
16
- const isFullyLoggedIn = useModalStore((state) => state.isFullyLoggedIn);
17
- const goBack = useGoBack();
18
- const shouldShowSelects = [
19
- ModalStep.ACCOUNT_MAIN,
20
- ModalStep.CHAIN_SWITCH,
21
- ModalStep.ADD_FUNDS_BUY,
22
- ModalStep.ADD_FUNDS_RECEIVE,
23
- ModalStep.ADD_FUNDS_WITHDRAW
24
- ].includes(step);
25
- const handleBackClick = () => {
26
- goBack();
27
- };
28
- return /* @__PURE__ */ jsxs(Container, { children: [
29
- /* @__PURE__ */ jsx(
30
- BackButton,
31
- {
32
- variant: "ghost",
33
- style: {
34
- visibility: hasPreviousStep ? "visible" : "hidden"
35
- },
36
- onClick: handleBackClick,
37
- children: /* @__PURE__ */ jsx(CpslIcon, { icon: "arrow" })
38
- }
39
- ),
40
- /* @__PURE__ */ jsx(MiddleContainer, { children: shouldShowSelects && isFullyLoggedIn && /* @__PURE__ */ jsxs(Fragment, { children: [
41
- /* @__PURE__ */ jsx(ChainSelect, {}),
42
- /* @__PURE__ */ jsx(AccountSelect, {})
43
- ] }) }),
44
- /* @__PURE__ */ jsx(CloseButton, { bareModal, variant: "ghost", onClick: onClose, children: /* @__PURE__ */ jsx(CpslIcon, { icon: "close" }) })
45
- ] });
46
- };
47
- const Container = styled.div`
48
- position: absolute;
49
- width: 100%;
50
- top: 16px;
51
-
52
- z-index: 3;
53
- display: flex;
54
- align-items: center;
55
- justify-content: space-between;
56
- gap: 8px;
57
- `;
58
- const MiddleContainer = styled.div`
59
- flex: 1;
60
- display: flex;
61
- align-items: center;
62
- justify-content: center;
63
- gap: 4px;
64
- `;
65
- const CloseButton = styled(HeaderButton)`
66
- transform: rotate(180deg);
67
- visibility: ${({ bareModal }) => bareModal ? "hidden" : "visible"};
68
- `;
69
- const BackButton = styled(HeaderButton)`
70
- transform: rotate(180deg);
71
- `;
72
- export {
73
- Controls
74
- };