@getpara/react-sdk 1.12.0 → 2.0.0-alpha.10

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 (241) hide show
  1. package/dist/cli/cli.mjs +35 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +5 -0
  4. package/dist/modal/ParaModal.js +211 -313
  5. package/dist/modal/components/Account/Account.js +73 -16
  6. package/dist/modal/components/AddFunds/AddFunds.js +5 -6
  7. package/dist/modal/components/AddFunds/AddFundsAsset.js +15 -13
  8. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +16 -10
  9. package/dist/modal/components/AddFunds/AddFundsContext.d.ts +2 -2
  10. package/dist/modal/components/AddFunds/AddFundsContext.js +20 -14
  11. package/dist/modal/components/AddFunds/AddFundsDone.js +10 -4
  12. package/dist/modal/components/AddFunds/AddFundsProvider.js +11 -7
  13. package/dist/modal/components/AddFunds/AddFundsReceive.js +17 -13
  14. package/dist/modal/components/AddFunds/AddFundsSettings.js +10 -6
  15. package/dist/modal/components/AddFunds/common.d.ts +1 -1
  16. package/dist/modal/components/AuthInput/AuthInput.d.ts +1 -1
  17. package/dist/modal/components/AuthInput/AuthInput.js +70 -91
  18. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +4 -4
  19. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +4 -4
  20. package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +4 -3
  21. package/dist/modal/components/AuthMainStep/AuthMainStep.js +20 -7
  22. package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +4 -3
  23. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +54 -10
  24. package/dist/modal/components/AuthOptions/AuthOptions.d.ts +4 -3
  25. package/dist/modal/components/AuthOptions/AuthOptions.js +35 -7
  26. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -1
  27. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +9 -4
  28. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -3
  29. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +25 -17
  30. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -1
  31. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +34 -72
  32. package/dist/modal/components/Body/Body.d.ts +4 -3
  33. package/dist/modal/components/Body/Body.js +27 -10
  34. package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -1
  35. package/dist/modal/components/ChainSwitch/ChainSwitch.js +5 -4
  36. package/dist/modal/components/Controls/Controls.js +5 -2
  37. package/dist/modal/components/Controls/Selects.d.ts +1 -1
  38. package/dist/modal/components/Controls/Selects.js +30 -25
  39. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +1 -1
  40. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +10 -6
  41. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +7 -69
  42. package/dist/modal/components/ExternalWallets/ExternalWallets.js +7 -6
  43. package/dist/modal/components/Footer/Footer.d.ts +1 -1
  44. package/dist/modal/components/Footer/Footer.js +6 -4
  45. package/dist/modal/components/Header/hooks/useStepTitle.js +7 -3
  46. package/dist/modal/components/Hero/Hero.js +5 -5
  47. package/dist/modal/components/IFrameStep/IFrameStep.js +8 -4
  48. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +7 -4
  49. package/dist/modal/components/ModalContent/ModalContent.js +14 -243
  50. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +3 -57
  51. package/dist/modal/components/OAuth/OAuth.d.ts +2 -2
  52. package/dist/modal/components/OAuth/OAuth.js +11 -85
  53. package/dist/modal/components/OAuth/TelegramOAuthStep.js +11 -60
  54. package/dist/modal/components/OnRampComponents/AddingFunds.js +1 -1
  55. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +10 -4
  56. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +23 -32
  57. package/dist/modal/components/StripeComponents/StripeComponents.js +1 -1
  58. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +5 -2
  59. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +44 -60
  60. package/dist/modal/components/WalletCard/WalletCard.d.ts +5 -5
  61. package/dist/modal/components/WalletCard/WalletCard.js +8 -7
  62. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +33 -12
  63. package/dist/modal/components/common.d.ts +5 -5
  64. package/dist/modal/components/common.js +10 -4
  65. package/dist/modal/constants/constants.d.ts +1 -1
  66. package/dist/modal/constants/oAuthLogos.d.ts +3 -3
  67. package/dist/modal/hooks/useGoBack.js +6 -5
  68. package/dist/modal/index.d.ts +0 -3
  69. package/dist/modal/index.js +1 -5
  70. package/dist/modal/stores/index.d.ts +0 -2
  71. package/dist/modal/stores/index.js +0 -2
  72. package/dist/modal/stores/modal/actions.js +69 -16
  73. package/dist/modal/stores/modal/useModalStore.d.ts +26 -22
  74. package/dist/modal/stores/modal/useModalStore.js +9 -13
  75. package/dist/modal/types/commonTypes.d.ts +0 -52
  76. package/dist/modal/types/modalProps.d.ts +8 -32
  77. package/dist/modal/utils/authInputHelpers.d.ts +7 -0
  78. package/dist/modal/utils/authInputHelpers.js +38 -0
  79. package/dist/modal/utils/authLayoutHelpers.d.ts +2 -2
  80. package/dist/modal/{components/AuthInput → utils}/countryCodes.js +6 -3
  81. package/dist/modal/utils/getTileButtonFlex.d.ts +1 -1
  82. package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
  83. package/dist/modal/utils/isPasskeySupported.js +15 -0
  84. package/dist/modal/utils/openPopup.d.ts +2 -2
  85. package/dist/modal/utils/openPopup.js +2 -2
  86. package/dist/modal/utils/steps.d.ts +6 -0
  87. package/dist/modal/utils/steps.js +15 -0
  88. package/dist/provider/ParaProvider.d.ts +3 -1
  89. package/dist/provider/ParaProvider.js +69 -8
  90. package/dist/provider/actions/getAccount.d.ts +26 -8
  91. package/dist/provider/actions/getAccount.js +42 -14
  92. package/dist/provider/actions/getWallet.d.ts +3 -3
  93. package/dist/provider/actions/index.d.ts +27 -0
  94. package/dist/provider/actions/index.js +59 -0
  95. package/dist/provider/actions/utils.d.ts +3 -0
  96. package/dist/provider/actions/utils.js +15 -0
  97. package/dist/provider/components/CosmosWalletWrapper.d.ts +11 -0
  98. package/dist/provider/components/CosmosWalletWrapper.js +34 -0
  99. package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
  100. package/dist/provider/components/EvmWalletWrapper.js +34 -0
  101. package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
  102. package/dist/provider/components/ExternalWalletWrapper.js +139 -0
  103. package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
  104. package/dist/provider/components/SolanaWalletWrapper.js +36 -0
  105. package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
  106. package/dist/provider/external/getParaCosmosConnector.js +22 -0
  107. package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
  108. package/dist/provider/external/getParaEvmConnector.js +22 -0
  109. package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
  110. package/dist/provider/external/getParaSolanaConnector.js +22 -0
  111. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +12 -0
  112. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +18 -0
  113. package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +3 -0
  114. package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +21 -0
  115. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +8 -0
  116. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +14 -0
  117. package/dist/provider/hooks/mutations/index.d.ts +27 -11
  118. package/dist/provider/hooks/mutations/index.js +54 -17
  119. package/dist/provider/hooks/mutations/utils.d.ts +5 -0
  120. package/dist/provider/hooks/mutations/utils.js +59 -0
  121. package/dist/provider/hooks/queries/useAccount.d.ts +1 -7
  122. package/dist/provider/hooks/queries/useWallet.d.ts +1 -1
  123. package/dist/provider/hooks/queries/useWalletBalance.d.ts +1 -2
  124. package/dist/provider/hooks/queries/useWalletBalance.js +40 -11
  125. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +5 -5
  126. package/dist/provider/hooks/utils/useEventListeners.d.ts +1 -1
  127. package/dist/provider/hooks/utils/useEventListeners.js +100 -56
  128. package/dist/provider/hooks/utils/useWalletState.d.ts +5 -4
  129. package/dist/provider/hooks/utils/useWalletState.js +24 -9
  130. package/dist/provider/index.d.ts +1 -0
  131. package/dist/provider/index.js +1 -0
  132. package/dist/provider/providers/AuthProvider.d.ts +35 -0
  133. package/dist/provider/providers/AuthProvider.js +498 -0
  134. package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
  135. package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
  136. package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
  137. package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
  138. package/dist/provider/providers/ExternalWalletProvider.d.ts +76 -0
  139. package/dist/{modal/providers/ExternalWalletContext.js → provider/providers/ExternalWalletProvider.js} +146 -112
  140. package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
  141. package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
  142. package/dist/provider/stores/getters.d.ts +3 -3
  143. package/dist/provider/stores/setters.d.ts +1 -0
  144. package/dist/provider/stores/setters.js +7 -0
  145. package/dist/provider/stores/slices/config.d.ts +3 -0
  146. package/dist/provider/stores/slices/config.js +9 -0
  147. package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
  148. package/dist/provider/stores/slices/externalWallets.js +40 -0
  149. package/dist/provider/stores/slices/index.d.ts +1 -0
  150. package/dist/provider/stores/slices/index.js +1 -0
  151. package/dist/provider/stores/slices/modal.js +11 -4
  152. package/dist/provider/stores/types.d.ts +50 -4
  153. package/dist/provider/stores/useStore.js +4 -3
  154. package/dist/provider/types/externalWalletProviders.d.ts +12 -0
  155. package/dist/provider/types/externalWalletProviders.js +1 -0
  156. package/dist/provider/types/provider.d.ts +126 -17
  157. package/dist/provider/types/utils.d.ts +20 -0
  158. package/dist/provider/utils/constants.js +3 -4
  159. package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
  160. package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
  161. package/dist/provider/utils/renameMutations.d.ts +3 -0
  162. package/dist/provider/utils/renameMutations.js +5 -3
  163. package/package.json +20 -8
  164. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +0 -8
  165. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -124
  166. package/dist/modal/hooks/useActiveWallet.d.ts +0 -1
  167. package/dist/modal/hooks/useActiveWallet.js +0 -15
  168. package/dist/modal/hooks/useCreateAccount.d.ts +0 -6
  169. package/dist/modal/hooks/useCreateAccount.js +0 -77
  170. package/dist/modal/hooks/useEmbeddedExternalConnection.d.ts +0 -1
  171. package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -54
  172. package/dist/modal/hooks/useSetLoginURLs.d.ts +0 -8
  173. package/dist/modal/hooks/useSetLoginURLs.js +0 -49
  174. package/dist/modal/hooks/useWalletBalance.d.ts +0 -4
  175. package/dist/modal/hooks/useWalletBalance.js +0 -49
  176. package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +0 -42
  177. package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -38
  178. package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +0 -46
  179. package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -55
  180. package/dist/modal/providers/ExternalWalletContext.d.ts +0 -92
  181. package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +0 -32
  182. package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -32
  183. package/dist/modal/stores/externalWalletProvider/actions.d.ts +0 -3
  184. package/dist/modal/stores/externalWalletProvider/actions.js +0 -10
  185. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +0 -22
  186. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -21
  187. package/dist/modal/stores/theme/actions.d.ts +0 -3
  188. package/dist/modal/stores/theme/actions.js +0 -28
  189. package/dist/modal/stores/theme/useThemeStore.d.ts +0 -20
  190. package/dist/modal/stores/theme/useThemeStore.js +0 -21
  191. package/dist/modal/stores/userInfo/actions.d.ts +0 -3
  192. package/dist/modal/stores/userInfo/actions.js +0 -30
  193. package/dist/modal/stores/userInfo/useUserInfoStore.d.ts +0 -19
  194. package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -17
  195. package/dist/provider/actions/checkIfUserExists.d.ts +0 -9
  196. package/dist/provider/actions/checkIfUserExists.js +0 -21
  197. package/dist/provider/actions/createGuestWallets.d.ts +0 -2
  198. package/dist/provider/actions/createGuestWallets.js +0 -13
  199. package/dist/provider/actions/createUser.d.ts +0 -12
  200. package/dist/provider/actions/createUser.js +0 -26
  201. package/dist/provider/actions/getWalletBalance.d.ts +0 -2
  202. package/dist/provider/actions/getWalletBalance.js +0 -14
  203. package/dist/provider/actions/initiateLogin.d.ts +0 -4
  204. package/dist/provider/actions/initiateLogin.js +0 -20
  205. package/dist/provider/actions/keepSessionAlive.d.ts +0 -2
  206. package/dist/provider/actions/keepSessionAlive.js +0 -20
  207. package/dist/provider/actions/logout.d.ts +0 -2
  208. package/dist/provider/actions/logout.js +0 -17
  209. package/dist/provider/actions/signMessage.d.ts +0 -8
  210. package/dist/provider/actions/signMessage.js +0 -20
  211. package/dist/provider/actions/signTransaction.d.ts +0 -8
  212. package/dist/provider/actions/signTransaction.js +0 -20
  213. package/dist/provider/actions/waitForAccountCreation.d.ts +0 -2
  214. package/dist/provider/actions/waitForAccountCreation.js +0 -21
  215. package/dist/provider/actions/waitForLoginAndSetup.d.ts +0 -6
  216. package/dist/provider/actions/waitForLoginAndSetup.js +0 -24
  217. package/dist/provider/actions/waitForPasskeyAndCreateWallet.d.ts +0 -2
  218. package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -21
  219. package/dist/provider/hooks/mutations/useCheckIfUserExists.d.ts +0 -13
  220. package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
  221. package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +0 -15
  222. package/dist/provider/hooks/mutations/useCreateGuestWallets.js +0 -23
  223. package/dist/provider/hooks/mutations/useCreateUser.d.ts +0 -13
  224. package/dist/provider/hooks/mutations/useCreateUser.js +0 -20
  225. package/dist/provider/hooks/mutations/useInitiateLogin.d.ts +0 -14
  226. package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
  227. package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +0 -12
  228. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -20
  229. package/dist/provider/hooks/mutations/useLogout.d.ts +0 -12
  230. package/dist/provider/hooks/mutations/useLogout.js +0 -30
  231. package/dist/provider/hooks/mutations/useSignMessage.d.ts +0 -15
  232. package/dist/provider/hooks/mutations/useSignMessage.js +0 -39
  233. package/dist/provider/hooks/mutations/useSignTransaction.d.ts +0 -14
  234. package/dist/provider/hooks/mutations/useSignTransaction.js +0 -39
  235. package/dist/provider/hooks/mutations/useWaitForAccountCreation.d.ts +0 -12
  236. package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
  237. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.d.ts +0 -14
  238. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
  239. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.d.ts +0 -13
  240. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
  241. /package/dist/modal/{components/AuthInput → utils}/countryCodes.d.ts +0 -0
@@ -6,52 +6,94 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import styled from "styled-components";
7
7
  import { InnerStepContainer, StepContainer, StyledCpslTileButton } from "../common.js";
8
8
  import { CpslButton, CpslIcon, CpslSpinner, CpslText } from "@getpara/react-components";
9
- import { OnRampStep, useModalStore, useThemeStore } from "../../stores/index.js";
10
- import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
11
- import { useState } from "react";
9
+ import { OnRampStep, useModalStore } from "../../stores/index.js";
10
+ import { useEffect, useState } from "react";
12
11
  import { ModalStep } from "../../utils/steps.js";
13
- import { useWalletBalance } from "../../hooks/useWalletBalance.js";
14
- import { formatBalanceString } from "../../utils/stringFormatters.js";
15
12
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
13
+ import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
14
+ import { useStore } from "../../../provider/stores/useStore.js";
15
+ import { formatBalanceString } from "../../utils/stringFormatters.js";
16
+ import { useAccount, useWalletBalance } from "../../../provider/index.js";
17
+ import { EnabledFlow } from "@getpara/web-sdk";
16
18
  const Account = ({ onClose }) => {
17
19
  const onRampConfig = useModalStore((state) => state.onRampConfig);
18
20
  const setStep = useModalStore((state) => state.setStep);
19
21
  const setFlow = useModalStore((state) => state.setFlow);
22
+ const setGuestAddFundsTab = useModalStore((state) => state.setGuestAddFundsTab);
20
23
  const setOnRampStep = useModalStore((state) => state.setOnRampStep);
21
- const hideWallets = useThemeStore((state) => state.hideWallets);
24
+ const hideWallets = useStore((state) => {
25
+ var _a;
26
+ return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
27
+ });
22
28
  const { disconnectExternalWallet } = useExternalWallets();
23
- const { balance, isLoading: isBalanceLoading } = useWalletBalance();
24
29
  const para = useInternalClient();
30
+ const { data: account } = useAccount();
31
+ const { data: balance, isLoading: isBalanceLoading } = useWalletBalance();
25
32
  const [isDisconnecting, setIsDisconnecting] = useState(false);
33
+ const isGuestMode = (account == null ? void 0 : account.isConnected) && account.isGuestMode;
34
+ const cantBuyAndWithdraw = para.externalWalletConnectionType === "CONNECTION_ONLY" && !para.userId;
26
35
  const isOnRampLoaded = !!onRampConfig;
27
- const canBuyAndWithdraw = !!para.userId;
28
36
  const handleBuyClick = () => {
29
- setOnRampStep(OnRampStep.SETTINGS);
30
- setStep(ModalStep.ADD_FUNDS_BUY);
37
+ if (isGuestMode) {
38
+ setGuestAddFundsTab(EnabledFlow.BUY);
39
+ setStep(ModalStep.AUTH_GUEST_SIGNUP);
40
+ } else {
41
+ setOnRampStep(OnRampStep.SETTINGS);
42
+ setStep(ModalStep.ADD_FUNDS_BUY);
43
+ }
31
44
  };
32
45
  const handleReceiveClick = () => {
33
46
  setStep(ModalStep.ADD_FUNDS_RECEIVE);
34
47
  };
35
48
  const handleSellClick = () => {
36
- setOnRampStep(OnRampStep.SETTINGS);
37
- setStep(ModalStep.ADD_FUNDS_WITHDRAW);
49
+ if (isGuestMode) {
50
+ setGuestAddFundsTab(EnabledFlow.WITHDRAW);
51
+ setStep(ModalStep.AUTH_GUEST_SIGNUP);
52
+ } else {
53
+ setOnRampStep(OnRampStep.SETTINGS);
54
+ setStep(ModalStep.ADD_FUNDS_WITHDRAW);
55
+ }
38
56
  };
39
57
  const handleDisconnectClick = () => __async(void 0, null, function* () {
40
58
  setIsDisconnecting(true);
59
+ yield para.logout();
41
60
  yield disconnectExternalWallet();
42
61
  onClose();
43
62
  setStep(ModalStep.AUTH_MAIN);
44
63
  setFlow(void 0);
45
64
  setIsDisconnecting(false);
46
65
  });
66
+ useEffect(() => {
67
+ setGuestAddFundsTab();
68
+ }, []);
47
69
  return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
48
- isBalanceLoading ? /* @__PURE__ */ jsx(BalanceContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, { size: 39 }) }) : balance !== void 0 && /* @__PURE__ */ jsx(BalanceContainer, { children: /* @__PURE__ */ jsx(CpslText, { variant: "headingS", weight: "medium", children: formatBalanceString(balance) }) }),
70
+ isBalanceLoading ? /* @__PURE__ */ jsx(BalanceContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, { size: 39 }) }) : balance !== void 0 && balance !== null && /* @__PURE__ */ jsx(BalanceContainer, { children: /* @__PURE__ */ jsx(CpslText, { variant: "headingS", weight: "medium", children: formatBalanceString(balance) }) }),
71
+ isGuestMode && /* @__PURE__ */ jsxs(Fragment, { children: [
72
+ balance && parseFloat(balance) > 0 && /* @__PURE__ */ jsxs(Alert, { children: [
73
+ /* @__PURE__ */ jsx(CpslIcon, { icon: "alertTriangle", size: "24px", style: { color: "var(--cpsl-color-utility-yellow)" } }),
74
+ "You've funded this account - complete account setup to maintain access."
75
+ ] }),
76
+ /* @__PURE__ */ jsxs(
77
+ CpslButton,
78
+ {
79
+ fullWidth: true,
80
+ variant: "primary",
81
+ onClick: () => {
82
+ setStep(ModalStep.AUTH_GUEST_SIGNUP);
83
+ },
84
+ children: [
85
+ /* @__PURE__ */ jsx(CpslIcon, { icon: "stars02" }),
86
+ "Complete Account Setup"
87
+ ]
88
+ }
89
+ )
90
+ ] }),
49
91
  /* @__PURE__ */ jsx(ButtonContainer, { children: isOnRampLoaded ? /* @__PURE__ */ jsxs(Fragment, { children: [
50
- canBuyAndWithdraw && onRampConfig.isBuyEnabled && /* @__PURE__ */ jsx(OptionButton, { icon: "creditCard", onClick: handleBuyClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Buy Crypto" }) }),
92
+ onRampConfig.isBuyEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "creditCard", onClick: handleBuyClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Buy Crypto" }) }),
51
93
  onRampConfig.isReceiveEnabled && /* @__PURE__ */ jsx(OptionButton, { icon: "qrCode02", onClick: handleReceiveClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Receive" }) }),
52
- canBuyAndWithdraw && onRampConfig.isWithdrawEnabled && /* @__PURE__ */ jsx(OptionButton, { icon: "arrowCircleBrokenDownLeft", onClick: handleSellClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Withdraw" }) })
94
+ onRampConfig.isWithdrawEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "arrowCircleBrokenDownLeft", onClick: handleSellClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Withdraw" }) })
53
95
  ] }) : /* @__PURE__ */ jsx(CpslSpinner, {}) }),
54
- /* @__PURE__ */ jsx(DisconnectButton, { variant: "destructive", fullWidth: true, onClick: handleDisconnectClick, disabled: isDisconnecting, children: isDisconnecting ? /* @__PURE__ */ jsx(CpslSpinner, { size: 16 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
96
+ !isGuestMode && /* @__PURE__ */ jsx(DisconnectButton, { variant: "destructive", fullWidth: true, onClick: handleDisconnectClick, disabled: isDisconnecting, children: isDisconnecting ? /* @__PURE__ */ jsx(CpslSpinner, { size: 16 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
55
97
  hideWallets ? "Logout" : "Disconnect Wallet",
56
98
  /* @__PURE__ */ jsx(CpslIcon, { icon: "logOut", slot: "end" })
57
99
  ] }) })
@@ -80,6 +122,21 @@ const BalanceContainer = styled.div`
80
122
  padding-top: 8px;
81
123
  padding-bottom: 24px;
82
124
  `;
125
+ const Alert = styled.div`
126
+ --icon-color: var(--cpsl-color-utility-yellow);
127
+ --icon-stroke-color: var(--cpsl-color-utility-yellow);
128
+ --icon-fill-color: var(--cpsl-color-utility-yellow);
129
+
130
+ display: flex;
131
+ padding: 8px;
132
+ align-items: flex-start;
133
+ gap: 8px;
134
+ align-self: stretch;
135
+ border-radius: var(--cpsl-border-radius-alert);
136
+ border: 1px solid var(--cpsl-color-utility-yellow);
137
+ background: var(--cpsl-color-utility-yellow-light);
138
+ font-size: 14px;
139
+ `;
83
140
  export {
84
141
  Account
85
142
  };
@@ -7,26 +7,25 @@ import { CpslIcon, CpslSpinner, CpslTab, CpslTabs } from "@getpara/react-compone
7
7
  import { OnRampStep } from "../../stores/index.js";
8
8
  import { useModalStore } from "../../stores/modal/useModalStore.js";
9
9
  import { useEffect, useMemo } from "react";
10
- import { useActiveWallet } from "../../hooks/useActiveWallet.js";
11
10
  import { getAddFundsStep } from "../../utils/steps.js";
12
11
  import styled from "styled-components";
12
+ import { useAccount, useWallet } from "../../../provider/index.js";
13
13
  import { AddFundsProvider } from "./AddFundsProvider.js";
14
14
  import { AddFundsReceive } from "./AddFundsReceive.js";
15
15
  import { AddFundsContextProvider, TABS } from "./AddFundsContext.js";
16
16
  import { AnimatePresence } from "framer-motion";
17
17
  import { AddFundsSettings } from "./AddFundsSettings.js";
18
- import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
19
18
  const AddFunds = () => {
20
19
  const onRampConfig = useModalStore((state) => state.onRampConfig);
21
20
  const onRampStep = useModalStore((state) => state.onRampStep);
22
21
  const storedTab = useModalStore((state) => state.accountAddFundTab);
23
22
  const setModalStep = useModalStore((state) => state.setStep);
24
23
  const setOnRampPurchase = useModalStore((state) => state.setOnRampPurchase);
25
- const para = useInternalClient();
26
- const activeWallet = useActiveWallet();
27
- const canBuyAndWithdraw = !!para.userId;
24
+ const { data: activeWallet } = useWallet();
25
+ const { data: account } = useAccount();
26
+ const isGuestMode = (account == null ? void 0 : account.isConnected) && account.isGuestMode;
28
27
  const tabs = TABS.filter(
29
- ([, key]) => !!(onRampConfig == null ? void 0 : onRampConfig[key]) && (["isBuyEnabled", "isWithdrawEnabled"].includes(key) && canBuyAndWithdraw || !["isBuyEnabled", "isWithdrawEnabled"].includes(key))
28
+ ([enabledFlow, key]) => !!(onRampConfig == null ? void 0 : onRampConfig[key]) && (!isGuestMode || enabledFlow === EnabledFlow.RECEIVE)
30
29
  );
31
30
  const tab = storedTab != null ? storedTab : tabs[0][0];
32
31
  const isMultiFlow = tabs.length > 1;
@@ -12,21 +12,21 @@ import { getAssetCode, getAssetName, ON_RAMP_ASSETS } from "../../constants/cons
12
12
  import { useModalStore } from "../../stores/index.js";
13
13
  import { useRef, useState } from "react";
14
14
  import { useAddFunds } from "./AddFundsContext.js";
15
- import { useActiveWallet } from "../../hooks/useActiveWallet.js";
15
+ import { useWallet } from "../../../provider/hooks/queries/useWallet.js";
16
16
  import { AssetIcon } from "../common.js";
17
17
  import { AnimatePresence, motion } from "framer-motion";
18
18
  import { contentMotionProps } from "./common.js";
19
19
  function AddFundsAsset() {
20
20
  const onRampConfig = useModalStore((state) => state.onRampConfig);
21
21
  const { assets, setAsset, network, setNetwork } = useAddFunds();
22
- const activeWallet = useActiveWallet();
22
+ const { data: activeWallet } = useWallet();
23
23
  const [isAtBottom, setIsAtBottom] = useState(false);
24
24
  const [isAtTop, setIsAtTop] = useState(true);
25
25
  const [searchStr, setSearchStr] = useState("");
26
26
  const ref = useRef(null);
27
27
  const onSelect = (_asset) => __async(this, null, function* () {
28
28
  yield setAsset(_asset);
29
- if (!network) {
29
+ if (!network && !!onRampConfig && !!activeWallet) {
30
30
  yield setNetwork(
31
31
  getOnRampNetworks(onRampConfig.assetInfo, {
32
32
  walletType: activeWallet.type,
@@ -36,16 +36,18 @@ function AddFundsAsset() {
36
36
  }
37
37
  });
38
38
  const onScroll = () => {
39
- const { scrollTop, scrollHeight, clientHeight } = ref.current;
40
- if (scrollTop + clientHeight >= scrollHeight - 30) {
41
- setIsAtBottom(true);
42
- } else {
43
- setIsAtBottom(false);
44
- }
45
- if (scrollTop < 30) {
46
- setIsAtTop(true);
47
- } else {
48
- setIsAtTop(false);
39
+ if (ref.current) {
40
+ const { scrollTop, scrollHeight, clientHeight } = ref.current;
41
+ if (scrollTop + clientHeight >= scrollHeight - 30) {
42
+ setIsAtBottom(true);
43
+ } else {
44
+ setIsAtBottom(false);
45
+ }
46
+ if (scrollTop < 30) {
47
+ setIsAtTop(true);
48
+ } else {
49
+ setIsAtTop(false);
50
+ }
49
51
  }
50
52
  };
51
53
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1,17 +1,19 @@
1
1
  "use client";
2
2
  import {
3
+ __spreadProps,
3
4
  __spreadValues
4
5
  } from "../../../chunk-MMUBH76A.js";
5
6
  import { jsx } from "react/jsx-runtime";
6
7
  import { StepContainer } from "../common.js";
7
8
  import { OnRampProvider } from "@getpara/web-sdk";
8
- import { useModalStore, useThemeStore } from "../../stores/index.js";
9
+ import { useModalStore } from "../../stores/index.js";
9
10
  import { lazy, useEffect, useMemo, useState } from "react";
10
11
  import { ModalStep } from "../../utils/steps.js";
11
12
  import { RampEmbed, StripeEmbed } from "@getpara/react-common";
12
13
  import styled from "styled-components";
13
14
  import { useGoBack } from "../../hooks/useGoBack.js";
14
15
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
16
+ import { useStore } from "../../../provider/stores/useStore.js";
15
17
  const STEPS = {
16
18
  CANCELLED: ModalStep.ADD_FUNDS_FAILURE,
17
19
  FINISHED: ModalStep.ADD_FUNDS_SUCCESS
@@ -23,9 +25,9 @@ const AddFundsAwaiting = () => {
23
25
  const onRampPurchase = useModalStore((state) => state.onRampPurchase);
24
26
  const setOnRampPurchase = useModalStore((state) => state.setOnRampPurchase);
25
27
  const para = useInternalClient();
26
- const appName = useThemeStore((state) => state.appName);
27
- const isDark = useThemeStore((state) => state.isDark);
28
- const [MoonPayEmbed, setMoonPayEmbed] = useState(null);
28
+ const appName = useStore((state) => state.appName);
29
+ const isDark = useStore((state) => state.isDarkTheme);
30
+ const [MoonPayEmbed, setMoonPayEmbed] = useState();
29
31
  const props = {
30
32
  para,
31
33
  appName,
@@ -38,26 +40,30 @@ const AddFundsAwaiting = () => {
38
40
  };
39
41
  useEffect(() => {
40
42
  const _MoonPayEmbed = lazy(() => import("./MoonPayEmbed.js"));
41
- setMoonPayEmbed(_MoonPayEmbed);
43
+ if (_MoonPayEmbed) {
44
+ setMoonPayEmbed(_MoonPayEmbed);
45
+ }
42
46
  }, []);
43
47
  const onRampEmbed = useMemo(() => {
44
- if (!onRampPurchase.id) {
48
+ var _a, _b;
49
+ if (!(onRampPurchase == null ? void 0 : onRampPurchase.id) || !props.onRampConfig) {
45
50
  return null;
46
51
  }
47
52
  switch (onRampPurchase == null ? void 0 : onRampPurchase.provider) {
48
53
  case OnRampProvider.STRIPE:
49
- return /* @__PURE__ */ jsx(StripeEmbed, __spreadValues({}, props));
54
+ return /* @__PURE__ */ jsx(StripeEmbed, __spreadProps(__spreadValues({}, props), { onRampConfig: props.onRampConfig }));
50
55
  case OnRampProvider.MOONPAY:
51
- return !MoonPayEmbed || typeof window === "undefined" ? null : /* @__PURE__ */ jsx(MoonPayEmbed, __spreadValues({}, props));
56
+ return !MoonPayEmbed || typeof window === "undefined" ? null : /* @__PURE__ */ jsx(MoonPayEmbed, __spreadProps(__spreadValues({}, props), { onRampConfig: props.onRampConfig }));
52
57
  case OnRampProvider.RAMP:
53
- return /* @__PURE__ */ jsx(RampEmbed, __spreadValues({ apiKey: onRampConfig.rampApiKey }, props));
58
+ return /* @__PURE__ */ jsx(RampEmbed, __spreadProps(__spreadValues({}, props), { apiKey: (_b = (_a = props.onRampConfig) == null ? void 0 : _a.rampApiKey) != null ? _b : "", onRampConfig: props.onRampConfig }));
54
59
  }
55
60
  }, [onRampPurchase == null ? void 0 : onRampPurchase.provider, MoonPayEmbed]);
56
61
  useEffect(() => {
57
62
  let timeoutId;
58
63
  if ((onRampPurchase == null ? void 0 : onRampPurchase.status) && ["CANCELLED", "FINISHED"].includes(onRampPurchase.status)) {
59
64
  timeoutId = setTimeout(() => {
60
- setStep(STEPS[onRampPurchase.status]);
65
+ var _a;
66
+ setStep(STEPS[(_a = onRampPurchase.status) != null ? _a : ""]);
61
67
  }, 5e3);
62
68
  }
63
69
  return () => clearTimeout(timeoutId);
@@ -1,5 +1,5 @@
1
1
  import { Dispatch, PropsWithChildren, ReactNode, SetStateAction } from 'react';
2
- import { useActiveWallet } from '../../hooks/useActiveWallet.js';
2
+ import { useWallet } from '../../../provider/hooks/index.js';
3
3
  import { EnabledFlow, Network, OnRampAsset, OnRampConfig, OnRampProvider } from '@getpara/web-sdk';
4
4
  import { IconType } from '@getpara/react-components';
5
5
  export type Tab = EnabledFlow;
@@ -20,7 +20,7 @@ type Value = {
20
20
  assets: OnRampAsset[];
21
21
  isProviderAllowed: Partial<Record<OnRampProvider, boolean>>;
22
22
  tab: Tab;
23
- activeWallet: ReturnType<typeof useActiveWallet>;
23
+ activeWallet: ReturnType<typeof useWallet>['data'];
24
24
  onRampConfig: OnRampConfig;
25
25
  };
26
26
  export declare const AddFundsContext: import("react").Context<Value>;
@@ -12,8 +12,8 @@ import {
12
12
  useState
13
13
  } from "react";
14
14
  import { OnRampStep, useModalStore } from "../../stores/index.js";
15
- import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
16
- import { useActiveWallet } from "../../hooks/useActiveWallet.js";
15
+ import { useWallet } from "../../../provider/hooks/index.js";
16
+ import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
17
17
  import {
18
18
  EnabledFlow,
19
19
  getOnRampAssets,
@@ -43,9 +43,9 @@ const DEFAULT = {
43
43
  onRampConfig: {},
44
44
  activeWallet: {}
45
45
  };
46
- function isValid({ assetInfo }, walletType, network, asset) {
46
+ function isValid(onRampConfig, walletType, network, asset) {
47
47
  var _a, _b;
48
- return !!((_b = (_a = assetInfo[walletType]) == null ? void 0 : _a[network]) == null ? void 0 : _b[asset]);
48
+ return network && asset && walletType ? !!((_b = (_a = onRampConfig == null ? void 0 : onRampConfig.assetInfo[walletType]) == null ? void 0 : _a[network]) == null ? void 0 : _b[asset]) : false;
49
49
  }
50
50
  const AddFundsContext = createContext(DEFAULT);
51
51
  function AddFundsContextProvider({ tab, children }) {
@@ -54,19 +54,25 @@ function AddFundsContextProvider({ tab, children }) {
54
54
  const onRampStep = useModalStore((state) => state.onRampStep);
55
55
  const setOnRampStep = useModalStore((state) => state.setOnRampStep);
56
56
  const { chainId } = useExternalWallets();
57
- const activeWallet = useActiveWallet();
58
- const [fiatQuantity, setFiatQuantity] = useState((_b = (_a = onRampConfig.defaultBuyAmount) == null ? void 0 : _a[0]) != null ? _b : "25.00");
57
+ const { data: activeWallet } = useWallet();
58
+ const [fiatQuantity, setFiatQuantity] = useState((_b = (_a = onRampConfig == null ? void 0 : onRampConfig.defaultBuyAmount) == null ? void 0 : _a[0]) != null ? _b : "25.00");
59
59
  const networks = useMemo(() => {
60
+ if (!onRampConfig) {
61
+ return [];
62
+ }
60
63
  const detectedNetwork = getNetworkFromChainId(chainId);
61
- const isExternal = activeWallet.isExternal && !!detectedNetwork;
64
+ const isExternal = (activeWallet == null ? void 0 : activeWallet.isExternal) && !!detectedNetwork;
62
65
  return isExternal ? [getNetworkOrMainNetEquivalent(detectedNetwork, onRampConfig.testMode)] : getOnRampNetworks(onRampConfig.assetInfo, {
63
- walletType: activeWallet.type,
66
+ walletType: activeWallet == null ? void 0 : activeWallet.type,
64
67
  allowed: onRampConfig.allowedAssets ? Object.keys(onRampConfig.allowedAssets) : void 0,
65
68
  providers: onRampConfig.providers,
66
69
  action: OnRampPurchaseType[tab === EnabledFlow.BUY ? "BUY" : "SELL"]
67
70
  });
68
71
  }, [chainId, activeWallet, onRampConfig, tab]);
69
72
  const assets = useMemo(() => {
73
+ if (!onRampConfig) {
74
+ return [];
75
+ }
70
76
  return [
71
77
  ...new Set(
72
78
  Object.values(
@@ -76,7 +82,7 @@ function AddFundsContextProvider({ tab, children }) {
76
82
  const allowed = configValue === true ? void 0 : configValue;
77
83
  return __spreadProps(__spreadValues({}, acc), {
78
84
  [network2]: getOnRampAssets(onRampConfig.assetInfo, {
79
- walletType: activeWallet.type,
85
+ walletType: activeWallet == null ? void 0 : activeWallet.type,
80
86
  network: network2,
81
87
  allowed,
82
88
  providers: onRampConfig.providers,
@@ -89,13 +95,13 @@ function AddFundsContextProvider({ tab, children }) {
89
95
  ];
90
96
  }, [networks, onRampConfig, activeWallet, tab]);
91
97
  const [network, setNetwork] = useState(
92
- !!(onRampConfig == null ? void 0 : onRampConfig.defaultOnRampNetwork) && !!onRampConfig.assetInfo[activeWallet.type][onRampConfig.defaultOnRampNetwork] ? onRampConfig.defaultOnRampNetwork : void 0
98
+ !!(activeWallet == null ? void 0 : activeWallet.type) && !!(onRampConfig == null ? void 0 : onRampConfig.defaultOnRampNetwork) && !!onRampConfig.assetInfo[activeWallet.type][onRampConfig.defaultOnRampNetwork] ? onRampConfig.defaultOnRampNetwork : void 0
93
99
  );
94
100
  const [asset, setAsset] = useState(
95
101
  !!network && !!(onRampConfig == null ? void 0 : onRampConfig.defaultOnRampAsset) && assets.includes(onRampConfig.defaultOnRampAsset) ? onRampConfig.defaultOnRampAsset : void 0
96
102
  );
97
103
  const isProviderAllowed = useMemo(
98
- () => onRampConfig.providers.reduce(
104
+ () => onRampConfig && !!(activeWallet == null ? void 0 : activeWallet.type) ? onRampConfig.providers.reduce(
99
105
  (acc, id) => {
100
106
  var _a2, _b2, _c, _d, _e;
101
107
  return __spreadProps(__spreadValues({}, acc), {
@@ -103,7 +109,7 @@ function AddFundsContextProvider({ tab, children }) {
103
109
  });
104
110
  },
105
111
  {}
106
- ),
112
+ ) : {},
107
113
  [onRampConfig, network, asset, activeWallet, tab]
108
114
  );
109
115
  const value = useMemo(() => {
@@ -139,10 +145,10 @@ function AddFundsContextProvider({ tab, children }) {
139
145
  onRampConfig
140
146
  ]);
141
147
  useEffect(() => {
142
- if (onRampStep === OnRampStep.PROVIDER && !isValid(onRampConfig, activeWallet.type, network, asset)) {
148
+ if (!!activeWallet && onRampStep === OnRampStep.PROVIDER && !isValid(onRampConfig, activeWallet.type, network, asset)) {
143
149
  setOnRampStep(OnRampStep.SETTINGS);
144
150
  }
145
- }, [onRampStep, onRampConfig, activeWallet.type, network, asset, setOnRampStep]);
151
+ }, [onRampStep, onRampConfig, activeWallet, network, asset, setOnRampStep]);
146
152
  return /* @__PURE__ */ jsx(AddFundsContext.Provider, { value, children });
147
153
  }
148
154
  const useAddFunds = () => useContext(AddFundsContext);
@@ -2,12 +2,18 @@
2
2
  import "../../../chunk-MMUBH76A.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { Heading, HeroIcon, InnerStepContainer, StepContainer } from "../common.js";
5
- import { useModalStore, useThemeStore } from "../../stores/index.js";
5
+ import { useModalStore } from "../../stores/index.js";
6
6
  import { useMemo } from "react";
7
7
  import { CpslButton, CpslText } from "@getpara/react-components";
8
8
  import { getAddFundsStep } from "../../utils/steps.js";
9
+ import { useStore } from "../../../provider/stores/useStore.js";
10
+ import { EnabledFlow } from "@getpara/web-sdk";
9
11
  const AddFundsDone = ({ isSuccess, onClose }) => {
10
- const hideWallets = useThemeStore((state) => state.hideWallets);
12
+ var _a;
13
+ const hideWallets = useStore((state) => {
14
+ var _a2;
15
+ return (_a2 = state.modalConfig) == null ? void 0 : _a2.hideWallets;
16
+ });
11
17
  const setStep = useModalStore((state) => state.setStep);
12
18
  const onRampPurchase = useModalStore((state) => state.onRampPurchase);
13
19
  const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
@@ -18,7 +24,7 @@ const AddFundsDone = ({ isSuccess, onClose }) => {
18
24
  });
19
25
  }, [onRampPurchase == null ? void 0 : onRampPurchase.fiat]);
20
26
  const heading = isSuccess ? "Transaction Successful" : "Something Went Wrong";
21
- const text = isSuccess ? `${formatter.format(parseFloat(onRampPurchase == null ? void 0 : onRampPurchase.fiatQuantity))} is now available in your ${hideWallets ? "account" : "wallet"}.` : `No funds were added to your ${hideWallets ? "account" : "wallet"}.`;
27
+ const text = isSuccess ? `${formatter.format(parseFloat((_a = onRampPurchase == null ? void 0 : onRampPurchase.fiatQuantity) != null ? _a : "0"))} is now available in your ${hideWallets ? "account" : "wallet"}.` : `No funds were added to your ${hideWallets ? "account" : "wallet"}.`;
22
28
  const buttonText = isSuccess ? "Done" : "Try Again";
23
29
  return /* @__PURE__ */ jsxs(StepContainer, { children: [
24
30
  /* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
@@ -31,7 +37,7 @@ const AddFundsDone = ({ isSuccess, onClose }) => {
31
37
  {
32
38
  fullWidth: true,
33
39
  onClick: () => {
34
- isSuccess ? onClose() : setStep(getAddFundsStep(accountAddFundTab));
40
+ isSuccess ? onClose() : setStep(getAddFundsStep(accountAddFundTab != null ? accountAddFundTab : EnabledFlow.BUY));
35
41
  },
36
42
  children: buttonText
37
43
  }
@@ -9,22 +9,26 @@ import styled from "styled-components";
9
9
  import { Heading, InnerStepContainer } from "../common.js";
10
10
  import { CpslText } from "@getpara/react-components";
11
11
  import { useAddFunds } from "./AddFundsContext.js";
12
- import { useModalStore, useThemeStore } from "../../stores/index.js";
12
+ import { useModalStore } from "../../stores/index.js";
13
+ import { useStore } from "../../../provider/stores/useStore.js";
13
14
  import { motion, AnimatePresence } from "framer-motion";
14
15
  import { OnRampProviderButton } from "../OnRampComponents/OnRampProviderButton.js";
15
- import { useActiveWallet } from "../../hooks/useActiveWallet.js";
16
+ import { useWallet } from "../../../provider/index.js";
16
17
  import { EnabledFlow, OnRampProvider, OnRampPurchaseType } from "@getpara/web-sdk";
17
18
  import { ModalStep } from "../../utils/steps.js";
18
19
  import { contentMotionProps } from "./common.js";
19
20
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
20
21
  function AddFundsProvider() {
21
22
  const para = useInternalClient();
22
- const hideWallets = useThemeStore((state) => state.hideWallets);
23
+ const hideWallets = useStore((state) => {
24
+ var _a;
25
+ return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
26
+ });
23
27
  const onRampConfig = useModalStore((state) => state.onRampConfig);
24
28
  const setOnRampPurchase = useModalStore((state) => state.setOnRampPurchase);
25
29
  const setModalStep = useModalStore((state) => state.setStep);
26
30
  const { asset, network, fiatQuantity, isProviderAllowed, tab } = useAddFunds();
27
- const activeWallet = useActiveWallet();
31
+ const { data: activeWallet } = useWallet();
28
32
  return /* @__PURE__ */ jsxs(Container, __spreadProps(__spreadValues({}, contentMotionProps), { children: [
29
33
  /* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Choose Provider" }),
30
34
  /* @__PURE__ */ jsxs($InnerStepContainer, { children: [
@@ -32,7 +36,7 @@ function AddFundsProvider() {
32
36
  "No providers are available for this ",
33
37
  hideWallets ? "account" : "wallet"
34
38
  ] }),
35
- /* @__PURE__ */ jsx(AnimatePresence, { children: onRampConfig.providers.map((id, index) => {
39
+ /* @__PURE__ */ jsx(AnimatePresence, { children: onRampConfig ? onRampConfig.providers.map((id, index) => {
36
40
  return isProviderAllowed[id] ? /* @__PURE__ */ jsx(
37
41
  motion.div,
38
42
  {
@@ -61,7 +65,7 @@ function AddFundsProvider() {
61
65
  network,
62
66
  asset,
63
67
  fiatQuantity,
64
- testMode: onRampConfig.testMode
68
+ testMode: onRampConfig == null ? void 0 : onRampConfig.testMode
65
69
  }
66
70
  });
67
71
  setOnRampPurchase(__spreadProps(__spreadValues({}, newOnRampPurchase), { fiat: "USD" }));
@@ -73,7 +77,7 @@ function AddFundsProvider() {
73
77
  },
74
78
  id
75
79
  ) : null;
76
- }) })
80
+ }) : null })
77
81
  ] })
78
82
  ] }));
79
83
  }
@@ -11,27 +11,31 @@ import {
11
11
  CpslText
12
12
  } from "@getpara/react-components";
13
13
  import { CenteredText, FilledDisabledInput, InnerStepContainer, QRContainer } from "../common.js";
14
- import { isMobile, WalletType } from "@getpara/web-sdk";
15
- import { useModalStore, useThemeStore } from "../../stores/index.js";
14
+ import { isMobile } from "@getpara/web-sdk";
15
+ import { useModalStore } from "../../stores/index.js";
16
+ import { useStore } from "../../../provider/stores/useStore.js";
16
17
  import { useCopyToClipboard } from "@getpara/react-common";
17
18
  import { useMemo } from "react";
18
- import { useActiveWallet } from "../../hooks/useActiveWallet.js";
19
+ import { useWallet } from "../../../provider/hooks/index.js";
19
20
  import { useAddFunds } from "./AddFundsContext.js";
20
21
  import { formatNetworkList } from "../../utils/stringFormatters.js";
21
22
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
22
23
  const GENERIC_WALLET = {
23
- [WalletType.EVM]: "Ethereum or EVM-based L2s",
24
- [WalletType.SOLANA]: "Solana",
25
- [WalletType.COSMOS]: "Cosmos"
24
+ EVM: "Ethereum or EVM-based L2s",
25
+ SOLANA: "Solana",
26
+ COSMOS: "Cosmos"
26
27
  };
27
28
  function AddFundsReceive() {
28
29
  const [isCopied, copy] = useCopyToClipboard();
29
30
  const { networks } = useAddFunds();
30
31
  const para = useInternalClient();
31
- const appName = useThemeStore((state) => state.appName);
32
- const hideWallets = useThemeStore((state) => state.hideWallets);
32
+ const appName = useStore((state) => state.appName);
33
+ const hideWallets = useStore((state) => {
34
+ var _a;
35
+ return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
36
+ });
33
37
  const onRampConfig = useModalStore((state) => state.onRampConfig);
34
- const activeWallet = useActiveWallet();
38
+ const { data: activeWallet } = useWallet();
35
39
  const address = useMemo(
36
40
  () => activeWallet ? para.getDisplayAddress(activeWallet.id, { addressType: activeWallet.type }) : "",
37
41
  [para, activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type]
@@ -40,7 +44,7 @@ function AddFundsReceive() {
40
44
  copy(address);
41
45
  };
42
46
  return /* @__PURE__ */ jsxs(Fragment, { children: [
43
- /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsxs(
47
+ activeWallet && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsxs(
44
48
  FilledDisabledInput,
45
49
  {
46
50
  noAutoDisable: true,
@@ -64,13 +68,13 @@ function AddFundsReceive() {
64
68
  /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "secondary", children: "Scan with your crypto wallet" })
65
69
  ] })
66
70
  ] }),
67
- /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
71
+ (activeWallet == null ? void 0 : activeWallet.type) && /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
68
72
  /* @__PURE__ */ jsxs(CenteredText, { weight: "semiBold", children: [
69
- !!onRampConfig.allowedAssets && networks.length > 0 || hideWallets ? appName != null ? appName : "This App" : "This Wallet",
73
+ !!(onRampConfig == null ? void 0 : onRampConfig.allowedAssets) && networks.length > 0 || hideWallets ? appName != null ? appName : "This App" : "This Wallet",
70
74
  " ",
71
75
  "Only Supports:"
72
76
  ] }),
73
- /* @__PURE__ */ jsx(CenteredText, { weight: "medium", color: "secondary", children: !!onRampConfig.allowedAssets && networks.length > 0 ? formatNetworkList(networks) : GENERIC_WALLET[activeWallet.type] })
77
+ /* @__PURE__ */ jsx(CenteredText, { weight: "medium", color: "secondary", children: !!(onRampConfig == null ? void 0 : onRampConfig.allowedAssets) && networks.length > 0 ? formatNetworkList(networks) : GENERIC_WALLET[activeWallet.type] })
74
78
  ] })
75
79
  ] });
76
80
  }
@@ -10,7 +10,8 @@ import { CpslButton, CpslIcon, CpslInput, CpslRow, CpslText } from "@getpara/rea
10
10
  import { AssetIcon, HeaderSelect, HeaderSelectContainer, HeaderSelectItem, NetworkIcon } from "../common.js";
11
11
  import { getAssetCode, getNetworkName } from "../../constants/constants.js";
12
12
  import { EnabledFlow, getOnRampNetworks, OnRampPurchaseType } from "@getpara/web-sdk";
13
- import { OnRampStep, useModalStore, useThemeStore } from "../../stores/index.js";
13
+ import { OnRampStep, useModalStore } from "../../stores/index.js";
14
+ import { useStore } from "../../../provider/stores/useStore.js";
14
15
  import styled from "styled-components";
15
16
  import { contentMotionProps, NoProviders } from "./common.js";
16
17
  import { AnimatePresence, motion, useIsPresent } from "framer-motion";
@@ -40,7 +41,10 @@ function AssetPill({ asset, gap = "4px", slot, fix }) {
40
41
  const NetworkLabel = /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", style: { margin: "0 8px" }, children: "Network" });
41
42
  function AddFundsSettings() {
42
43
  const isPresent = useIsPresent();
43
- const hideWallets = useThemeStore((state) => state.hideWallets);
44
+ const hideWallets = useStore((state) => {
45
+ var _a;
46
+ return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
47
+ });
44
48
  const setOnRampStep = useModalStore((state) => state.setOnRampStep);
45
49
  const {
46
50
  assets,
@@ -56,16 +60,16 @@ function AddFundsSettings() {
56
60
  isProviderAllowed,
57
61
  tab
58
62
  } = useAddFunds();
59
- const [value, setValue] = useState(parseFloat(fiatQuantity).toFixed(2) || "25.00");
63
+ const [value, setValue] = useState(parseFloat(fiatQuantity || "25.00").toFixed(2));
60
64
  const narrowedNetworks = useMemo(() => {
61
65
  return !asset ? networks : getOnRampNetworks(onRampConfig.assetInfo, {
62
- walletType: activeWallet.type,
66
+ walletType: activeWallet == null ? void 0 : activeWallet.type,
63
67
  allowed: onRampConfig.allowedAssets ? Object.entries(onRampConfig.allowedAssets).filter(([_, value2]) => value2 === true || value2.includes(asset)).map(([key]) => key) : void 0,
64
68
  assets: [asset],
65
69
  providers: onRampConfig.providers,
66
70
  action: tab === EnabledFlow.BUY ? OnRampPurchaseType.BUY : OnRampPurchaseType.SELL
67
71
  });
68
- }, [networks, network, asset, activeWallet.type, onRampConfig.providers, tab]);
72
+ }, [networks, network, asset, activeWallet == null ? void 0 : activeWallet.type, onRampConfig.providers, tab]);
69
73
  const content = useMemo(() => {
70
74
  if (!!asset && Object.values(isProviderAllowed).every((v) => !v) || assets.length === 0) {
71
75
  return /* @__PURE__ */ jsx(Container, __spreadProps(__spreadValues({}, contentMotionProps), { isPresent, children: /* @__PURE__ */ jsxs(NoProviders, { isHidden: Object.values(isProviderAllowed).some((v) => !!v), variant: "bodyM", children: [
@@ -161,7 +165,7 @@ function AddFundsSettings() {
161
165
  fullWidth: true,
162
166
  disabled: value === "",
163
167
  onClick: () => {
164
- setFiatQuantity(value);
168
+ setFiatQuantity(value != null ? value : void 0);
165
169
  setOnRampStep(OnRampStep.PROVIDER);
166
170
  },
167
171
  children: [
@@ -13,7 +13,7 @@ export declare const contentMotionProps: {
13
13
  };
14
14
  };
15
15
  export declare const NoProviders: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
16
- ref?: import("react").Ref<any>;
16
+ ref?: ((instance: any) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<any> | null | undefined;
17
17
  }, {
18
18
  isHidden?: boolean;
19
19
  }>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;