@getpara/react-sdk-lite 2.0.0-alpha.33

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 (311) hide show
  1. package/dist/chunk-MMUBH76A.js +59 -0
  2. package/dist/cli/cli.mjs +51 -0
  3. package/dist/css/modal.css +13 -0
  4. package/dist/index.d.ts +6 -0
  5. package/dist/index.js +10 -0
  6. package/dist/modal/ParaModal.d.ts +2 -0
  7. package/dist/modal/ParaModal.js +308 -0
  8. package/dist/modal/components/Account/Account.d.ts +5 -0
  9. package/dist/modal/components/Account/Account.js +148 -0
  10. package/dist/modal/components/Account/AccountProfile.d.ts +1 -0
  11. package/dist/modal/components/Account/AccountProfile.js +168 -0
  12. package/dist/modal/components/Account/AccountProfileLink.d.ts +1 -0
  13. package/dist/modal/components/Account/AccountProfileLink.js +206 -0
  14. package/dist/modal/components/Account/AccountProfileLinkOptions.d.ts +1 -0
  15. package/dist/modal/components/Account/AccountProfileLinkOptions.js +111 -0
  16. package/dist/modal/components/Account/AccountProfileUnlink.d.ts +1 -0
  17. package/dist/modal/components/Account/AccountProfileUnlink.js +47 -0
  18. package/dist/modal/components/AddFunds/AddFunds.d.ts +1 -0
  19. package/dist/modal/components/AddFunds/AddFunds.js +69 -0
  20. package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +1 -0
  21. package/dist/modal/components/AddFunds/AddFundsAsset.js +125 -0
  22. package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +1 -0
  23. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +78 -0
  24. package/dist/modal/components/AddFunds/AddFundsContext.d.ts +31 -0
  25. package/dist/modal/components/AddFunds/AddFundsContext.js +160 -0
  26. package/dist/modal/components/AddFunds/AddFundsDone.d.ts +6 -0
  27. package/dist/modal/components/AddFunds/AddFundsDone.js +49 -0
  28. package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +1 -0
  29. package/dist/modal/components/AddFunds/AddFundsProvider.js +109 -0
  30. package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +1 -0
  31. package/dist/modal/components/AddFunds/AddFundsReceive.js +83 -0
  32. package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +1 -0
  33. package/dist/modal/components/AddFunds/AddFundsSettings.js +237 -0
  34. package/dist/modal/components/AddFunds/MoonPayEmbed.d.ts +2 -0
  35. package/dist/modal/components/AddFunds/MoonPayEmbed.js +7 -0
  36. package/dist/modal/components/AddFunds/common.d.ts +19 -0
  37. package/dist/modal/components/AddFunds/common.js +24 -0
  38. package/dist/modal/components/AddFunds/index.d.ts +3 -0
  39. package/dist/modal/components/AddFunds/index.js +4 -0
  40. package/dist/modal/components/AuthInput/AuthInput.d.ts +20 -0
  41. package/dist/modal/components/AuthInput/AuthInput.js +277 -0
  42. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +7 -0
  43. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
  44. package/dist/modal/components/AuthInput/phoneMasks.d.ts +247 -0
  45. package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
  46. package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +9 -0
  47. package/dist/modal/components/AuthMainStep/AuthMainStep.js +50 -0
  48. package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +9 -0
  49. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +179 -0
  50. package/dist/modal/components/AuthOptions/AuthOptions.d.ts +9 -0
  51. package/dist/modal/components/AuthOptions/AuthOptions.js +85 -0
  52. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.d.ts +1 -0
  53. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
  54. package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.d.ts +1 -0
  55. package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.js +12 -0
  56. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.d.ts +1 -0
  57. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
  58. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.d.ts +1 -0
  59. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
  60. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -0
  61. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +49 -0
  62. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -0
  63. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +62 -0
  64. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -0
  65. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +48 -0
  66. package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +6 -0
  67. package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
  68. package/dist/modal/components/Body/Body.d.ts +11 -0
  69. package/dist/modal/components/Body/Body.js +354 -0
  70. package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -0
  71. package/dist/modal/components/ChainSwitch/ChainSwitch.js +95 -0
  72. package/dist/modal/components/ChainSwitch/config.d.ts +7 -0
  73. package/dist/modal/components/ChainSwitch/config.js +17 -0
  74. package/dist/modal/components/Controls/Controls.d.ts +5 -0
  75. package/dist/modal/components/Controls/Controls.js +78 -0
  76. package/dist/modal/components/Controls/Selects.d.ts +2 -0
  77. package/dist/modal/components/Controls/Selects.js +173 -0
  78. package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +1 -0
  79. package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +75 -0
  80. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +8 -0
  81. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +175 -0
  82. package/dist/modal/components/ExternalWalletStep/config.d.ts +7 -0
  83. package/dist/modal/components/ExternalWalletStep/config.js +17 -0
  84. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +1 -0
  85. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +39 -0
  86. package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +1 -0
  87. package/dist/modal/components/ExternalWallets/ExternalWallets.js +182 -0
  88. package/dist/modal/components/Footer/Footer.d.ts +1 -0
  89. package/dist/modal/components/Footer/Footer.js +95 -0
  90. package/dist/modal/components/Header/Header.d.ts +1 -0
  91. package/dist/modal/components/Header/Header.js +43 -0
  92. package/dist/modal/components/Header/hooks/useStepTitle.d.ts +3 -0
  93. package/dist/modal/components/Header/hooks/useStepTitle.js +62 -0
  94. package/dist/modal/components/Hero/Hero.d.ts +1 -0
  95. package/dist/modal/components/Hero/Hero.js +116 -0
  96. package/dist/modal/components/IFrameStep/IFrameStep.d.ts +1 -0
  97. package/dist/modal/components/IFrameStep/IFrameStep.js +70 -0
  98. package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +5 -0
  99. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +44 -0
  100. package/dist/modal/components/ModalContent/ModalContent.d.ts +10 -0
  101. package/dist/modal/components/ModalContent/ModalContent.js +88 -0
  102. package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +3 -0
  103. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +31 -0
  104. package/dist/modal/components/OAuth/OAuth.d.ts +6 -0
  105. package/dist/modal/components/OAuth/OAuth.js +81 -0
  106. package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +8 -0
  107. package/dist/modal/components/OAuth/TelegramOAuthStep.js +74 -0
  108. package/dist/modal/components/OnRampComponents/AddingFunds.d.ts +1 -0
  109. package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
  110. package/dist/modal/components/OnRampComponents/OnRampProviderButton.d.ts +9 -0
  111. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
  112. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.d.ts +6 -0
  113. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +107 -0
  114. package/dist/modal/components/Setup2FAStep/Setup2FAStep.d.ts +5 -0
  115. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +132 -0
  116. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +5 -0
  117. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +27 -0
  118. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +12 -0
  119. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +160 -0
  120. package/dist/modal/components/Waiting/Waiting.d.ts +6 -0
  121. package/dist/modal/components/Waiting/Waiting.js +17 -0
  122. package/dist/modal/components/WalletCard/PartnerIcon.d.ts +6 -0
  123. package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
  124. package/dist/modal/components/WalletCard/WalletCard.d.ts +18 -0
  125. package/dist/modal/components/WalletCard/WalletCard.js +128 -0
  126. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.d.ts +6 -0
  127. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +83 -0
  128. package/dist/modal/components/common.d.ts +59 -0
  129. package/dist/modal/components/common.js +261 -0
  130. package/dist/modal/components/index.d.ts +1 -0
  131. package/dist/modal/components/index.js +2 -0
  132. package/dist/modal/constants/constants.d.ts +40 -0
  133. package/dist/modal/constants/constants.js +142 -0
  134. package/dist/modal/constants/defaults.d.ts +5 -0
  135. package/dist/modal/constants/defaults.js +10 -0
  136. package/dist/modal/constants/oAuthLogos.d.ts +17 -0
  137. package/dist/modal/constants/oAuthLogos.js +158 -0
  138. package/dist/modal/constants/walletTypeConfig.d.ts +6 -0
  139. package/dist/modal/constants/walletTypeConfig.js +13 -0
  140. package/dist/modal/hooks/useGoBack.d.ts +1 -0
  141. package/dist/modal/hooks/useGoBack.js +43 -0
  142. package/dist/modal/hooks/useTelegramLogin.d.ts +12 -0
  143. package/dist/modal/hooks/useTelegramLogin.js +65 -0
  144. package/dist/modal/index.d.ts +8 -0
  145. package/dist/modal/index.js +29 -0
  146. package/dist/modal/stores/index.d.ts +1 -0
  147. package/dist/modal/stores/index.js +2 -0
  148. package/dist/modal/stores/modal/actions.d.ts +3 -0
  149. package/dist/modal/stores/modal/actions.js +139 -0
  150. package/dist/modal/stores/modal/useModalStore.d.ts +105 -0
  151. package/dist/modal/stores/modal/useModalStore.js +75 -0
  152. package/dist/modal/types/commonTypes.d.ts +6 -0
  153. package/dist/modal/types/commonTypes.js +1 -0
  154. package/dist/modal/types/modalProps.d.ts +129 -0
  155. package/dist/modal/types/modalProps.js +12 -0
  156. package/dist/modal/utils/authInputHelpers.d.ts +5 -0
  157. package/dist/modal/utils/authInputHelpers.js +41 -0
  158. package/dist/modal/utils/authLayoutHelpers.d.ts +3 -0
  159. package/dist/modal/utils/authLayoutHelpers.js +8 -0
  160. package/dist/modal/utils/countryCodes.d.ts +8 -0
  161. package/dist/modal/utils/countryCodes.js +45 -0
  162. package/dist/modal/utils/getMailtoLink.d.ts +1 -0
  163. package/dist/modal/utils/getMailtoLink.js +10 -0
  164. package/dist/modal/utils/getTileButtonFlex.d.ts +1 -0
  165. package/dist/modal/utils/getTileButtonFlex.js +20 -0
  166. package/dist/modal/utils/getWalletDisplayName.d.ts +5 -0
  167. package/dist/modal/utils/getWalletDisplayName.js +22 -0
  168. package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
  169. package/dist/modal/utils/isPasskeySupported.js +15 -0
  170. package/dist/modal/utils/openPopup.d.ts +6 -0
  171. package/dist/modal/utils/openPopup.js +60 -0
  172. package/dist/modal/utils/routeMobileExternalWallet.d.ts +1 -0
  173. package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
  174. package/dist/modal/utils/steps.d.ts +136 -0
  175. package/dist/modal/utils/steps.js +279 -0
  176. package/dist/modal/utils/stringFormatters.d.ts +5 -0
  177. package/dist/modal/utils/stringFormatters.js +19 -0
  178. package/dist/modal/utils/validateOnRampConfig.d.ts +5 -0
  179. package/dist/modal/utils/validateOnRampConfig.js +32 -0
  180. package/dist/package.json +6 -0
  181. package/dist/provider/ParaProvider.d.ts +4 -0
  182. package/dist/provider/ParaProvider.js +140 -0
  183. package/dist/provider/actions/getEmbeddedAccount.d.ts +26 -0
  184. package/dist/provider/actions/getEmbeddedAccount.js +57 -0
  185. package/dist/provider/actions/getWallet.d.ts +5 -0
  186. package/dist/provider/actions/getWallet.js +18 -0
  187. package/dist/provider/actions/index.d.ts +47 -0
  188. package/dist/provider/actions/index.js +79 -0
  189. package/dist/provider/actions/utils.d.ts +4 -0
  190. package/dist/provider/actions/utils.js +34 -0
  191. package/dist/provider/components/CosmosWalletWrapper.d.ts +11 -0
  192. package/dist/provider/components/CosmosWalletWrapper.js +43 -0
  193. package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
  194. package/dist/provider/components/EvmWalletWrapper.js +43 -0
  195. package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
  196. package/dist/provider/components/ExternalWalletWrapper.js +140 -0
  197. package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
  198. package/dist/provider/components/SolanaWalletWrapper.js +44 -0
  199. package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
  200. package/dist/provider/external/getParaCosmosConnector.js +19 -0
  201. package/dist/provider/external/getParaCosmosLib.d.ts +4 -0
  202. package/dist/provider/external/getParaCosmosLib.js +16 -0
  203. package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
  204. package/dist/provider/external/getParaEvmConnector.js +19 -0
  205. package/dist/provider/external/getParaEvmLib.d.ts +4 -0
  206. package/dist/provider/external/getParaEvmLib.js +16 -0
  207. package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
  208. package/dist/provider/external/getParaSolanaConnector.js +19 -0
  209. package/dist/provider/external/getParaSolanaLib.d.ts +4 -0
  210. package/dist/provider/external/getParaSolanaLib.js +16 -0
  211. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +2 -0
  212. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +8 -0
  213. package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +2 -0
  214. package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +8 -0
  215. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +2 -0
  216. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +8 -0
  217. package/dist/provider/hooks/index.d.ts +3 -0
  218. package/dist/provider/hooks/index.js +4 -0
  219. package/dist/provider/hooks/mutations/core.d.ts +27 -0
  220. package/dist/provider/hooks/mutations/core.js +66 -0
  221. package/dist/provider/hooks/mutations/index.d.ts +3 -0
  222. package/dist/provider/hooks/mutations/index.js +9 -0
  223. package/dist/provider/hooks/mutations/useLinkAccount.d.ts +9 -0
  224. package/dist/provider/hooks/mutations/useLinkAccount.js +18 -0
  225. package/dist/provider/hooks/mutations/utils.d.ts +12 -0
  226. package/dist/provider/hooks/mutations/utils.js +90 -0
  227. package/dist/provider/hooks/queries/core.d.ts +4 -0
  228. package/dist/provider/hooks/queries/core.js +16 -0
  229. package/dist/provider/hooks/queries/index.d.ts +5 -0
  230. package/dist/provider/hooks/queries/index.js +13 -0
  231. package/dist/provider/hooks/queries/useAccount.d.ts +90 -0
  232. package/dist/provider/hooks/queries/useAccount.js +141 -0
  233. package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +5 -0
  234. package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +24 -0
  235. package/dist/provider/hooks/queries/useParaStatus.d.ts +22 -0
  236. package/dist/provider/hooks/queries/useParaStatus.js +25 -0
  237. package/dist/provider/hooks/queries/useWallet.d.ts +5 -0
  238. package/dist/provider/hooks/queries/useWallet.js +26 -0
  239. package/dist/provider/hooks/queries/useWalletBalance.d.ts +6 -0
  240. package/dist/provider/hooks/queries/useWalletBalance.js +55 -0
  241. package/dist/provider/hooks/queries/utils.d.ts +7 -0
  242. package/dist/provider/hooks/queries/utils.js +25 -0
  243. package/dist/provider/hooks/utils/index.d.ts +3 -0
  244. package/dist/provider/hooks/utils/index.js +10 -0
  245. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.d.ts +3 -0
  246. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
  247. package/dist/provider/hooks/utils/useClient.d.ts +5 -0
  248. package/dist/provider/hooks/utils/useClient.js +10 -0
  249. package/dist/provider/hooks/utils/useEventListeners.d.ts +2 -0
  250. package/dist/provider/hooks/utils/useEventListeners.js +157 -0
  251. package/dist/provider/hooks/utils/useFormattedBiometricHints.d.ts +4 -0
  252. package/dist/provider/hooks/utils/useFormattedBiometricHints.js +27 -0
  253. package/dist/provider/hooks/utils/useInternalClient.d.ts +5 -0
  254. package/dist/provider/hooks/utils/useInternalClient.js +10 -0
  255. package/dist/provider/hooks/utils/useModal.d.ts +11 -0
  256. package/dist/provider/hooks/utils/useModal.js +27 -0
  257. package/dist/provider/hooks/utils/useWalletState.d.ts +15 -0
  258. package/dist/provider/hooks/utils/useWalletState.js +48 -0
  259. package/dist/provider/index.d.ts +6 -0
  260. package/dist/provider/index.js +11 -0
  261. package/dist/provider/providers/AccountLinkProvider.d.ts +47 -0
  262. package/dist/provider/providers/AccountLinkProvider.js +452 -0
  263. package/dist/provider/providers/AuthProvider.d.ts +38 -0
  264. package/dist/provider/providers/AuthProvider.js +575 -0
  265. package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
  266. package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
  267. package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
  268. package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
  269. package/dist/provider/providers/ExternalWalletProvider.d.ts +61 -0
  270. package/dist/provider/providers/ExternalWalletProvider.js +626 -0
  271. package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
  272. package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
  273. package/dist/provider/stores/getters.d.ts +4 -0
  274. package/dist/provider/stores/getters.js +13 -0
  275. package/dist/provider/stores/setters.d.ts +1 -0
  276. package/dist/provider/stores/setters.js +7 -0
  277. package/dist/provider/stores/slices/analytics.d.ts +3 -0
  278. package/dist/provider/stores/slices/analytics.js +9 -0
  279. package/dist/provider/stores/slices/client.d.ts +3 -0
  280. package/dist/provider/stores/slices/client.js +9 -0
  281. package/dist/provider/stores/slices/config.d.ts +3 -0
  282. package/dist/provider/stores/slices/config.js +11 -0
  283. package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
  284. package/dist/provider/stores/slices/externalWallets.js +46 -0
  285. package/dist/provider/stores/slices/index.d.ts +5 -0
  286. package/dist/provider/stores/slices/index.js +6 -0
  287. package/dist/provider/stores/slices/modal.d.ts +3 -0
  288. package/dist/provider/stores/slices/modal.js +18 -0
  289. package/dist/provider/stores/slices/wallet.d.ts +3 -0
  290. package/dist/provider/stores/slices/wallet.js +13 -0
  291. package/dist/provider/stores/types.d.ts +86 -0
  292. package/dist/provider/stores/types.js +1 -0
  293. package/dist/provider/stores/useStore.d.ts +17 -0
  294. package/dist/provider/stores/useStore.js +34 -0
  295. package/dist/provider/types/externalWalletProviders.d.ts +12 -0
  296. package/dist/provider/types/externalWalletProviders.js +1 -0
  297. package/dist/provider/types/provider.d.ts +166 -0
  298. package/dist/provider/types/provider.js +1 -0
  299. package/dist/provider/types/query.d.ts +3 -0
  300. package/dist/provider/types/query.js +1 -0
  301. package/dist/provider/types/utils.d.ts +45 -0
  302. package/dist/provider/types/utils.js +1 -0
  303. package/dist/provider/utils/constants.d.ts +5 -0
  304. package/dist/provider/utils/constants.js +10 -0
  305. package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
  306. package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
  307. package/dist/provider/utils/renameMutations.d.ts +5 -0
  308. package/dist/provider/utils/renameMutations.js +18 -0
  309. package/dist/public/Inter-VariableFont_slnt,wght.ttf +0 -0
  310. package/package.json +63 -0
  311. package/styles.css/package.json +3 -0
@@ -0,0 +1,452 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { createContext, useContext, useEffect, useMemo, useState } from "react";
7
+ import { useAccount, useAccountLinkInProgress, useModal } from "../index.js";
8
+ import * as actions from "../actions/index.js";
9
+ import { useQueryClient } from "@tanstack/react-query";
10
+ import {
11
+ AccountLinkError,
12
+ LINKED_ACCOUNT_TYPES
13
+ } from "@getpara/web-sdk";
14
+ import { useModalStore } from "../../modal/stores/index.js";
15
+ import { ModalStep, openPopup } from "../../modal/index.js";
16
+ import { useGoBack } from "../../modal/hooks/useGoBack.js";
17
+ import { useExternalWallets } from "./ExternalWalletProvider.js";
18
+ import { useInternalClient } from "../hooks/utils/useInternalClient.js";
19
+ import { generateInternalMutation } from "../hooks/mutations/utils.js";
20
+ import { validateAuth } from "../../modal/utils/authInputHelpers.js";
21
+ import { extractAuthInfo } from "@getpara/user-management-client";
22
+ import { useStore } from "../stores/useStore.js";
23
+ const AccountLinkContext = createContext({
24
+ isEnabled: false,
25
+ accountLinkInProgress: void 0,
26
+ accountLinkOptions: [...LINKED_ACCOUNT_TYPES],
27
+ linkAccount: () => Promise.resolve(),
28
+ isLinkAccountPending: false,
29
+ verifyEmailOrPhoneLink: () => {
30
+ },
31
+ verifyOAuthLink: () => {
32
+ },
33
+ verifyFarcasterLink: () => {
34
+ },
35
+ verifyTelegramLink: () => {
36
+ },
37
+ verifyLinkedAccount: () => {
38
+ },
39
+ unlinkingAccount: void 0,
40
+ linkAccountStatus: "idle",
41
+ linkAccountError: null,
42
+ setLinkAccountError: () => {
43
+ },
44
+ unlinkAccount: () => {
45
+ },
46
+ unlinkAccountConfirm: () => {
47
+ },
48
+ isUnlinkAccountPending: false,
49
+ cancelLinkAccount: () => {
50
+ },
51
+ onAccountLinked: () => {
52
+ },
53
+ onAccountLinkVerified: () => {
54
+ },
55
+ resetMutations: () => {
56
+ }
57
+ // externalWalletQrUri: undefined,
58
+ });
59
+ const useLinkAccount = generateInternalMutation("linkAccount", actions.linkAccount);
60
+ const useUnlinkAccount = generateInternalMutation("unlinkAccount", actions.unlinkAccount);
61
+ const useVerifyOAuthLink = generateInternalMutation("verifyOAuthLink", actions.verifyOAuthLink, { delay: 500 });
62
+ const useVerifyEmailOrPhoneLink = generateInternalMutation("verifyEmailOrPhoneLink", actions.verifyEmailOrPhoneLink);
63
+ const useVerifyFarcasterLink = generateInternalMutation("verifyFarcasterLink", actions.verifyFarcasterLink, {
64
+ delay: 500
65
+ });
66
+ const useVerifyTelegramLink = generateInternalMutation("verifyTelegramLink", actions.verifyTelegramLink);
67
+ const useVerifyExternalWalletLink = generateInternalMutation("verifyExternalWalletLink", actions.verifyExternalWalletLink);
68
+ const AccountLinkProvider = ({ children }) => {
69
+ var _a;
70
+ const para = useInternalClient();
71
+ const queryClient = useQueryClient();
72
+ const { embedded } = useAccount();
73
+ const { data: coreAccountLinkInProgress } = useAccountLinkInProgress();
74
+ const {
75
+ wallet: connectedWallet,
76
+ wallets,
77
+ signMessage,
78
+ isSigningMessage,
79
+ requestInfo: externalWalletRequestInfo,
80
+ disconnectBase
81
+ } = useExternalWallets();
82
+ const { isOpen, openModal } = useModal();
83
+ const includeWalletVerification = useStore((state) => state.includeWalletVerification);
84
+ const setStep = useModalStore((state) => state.setStep);
85
+ const setFarcasterConnectUri = useModalStore((state) => state.setFarcasterConnectUri);
86
+ const refs = useModalStore((state) => state.refs);
87
+ const externalWalletError = useModalStore((state) => state.externalWalletError);
88
+ const accountLinkOptions = useModalStore((state) => state.accountLinkOptions) || [...LINKED_ACCOUNT_TYPES];
89
+ const setAccountLinkOptions = useModalStore((state) => state.setAccountLinkOptions);
90
+ const goBack = useGoBack();
91
+ const { mutateAsync: mutateLinkAccountAsync, isPending: isLinkAccountPending } = useLinkAccount();
92
+ const { mutate: mutateUnlinkAccount, isPending: isUnlinkAccountPending } = useUnlinkAccount();
93
+ const {
94
+ mutate: mutateVerifyEmailOrPhoneLink,
95
+ status: statusVerifyEmailOrPhoneLink,
96
+ reset: resetVerifyEmailOrPhoneLink
97
+ } = useVerifyEmailOrPhoneLink();
98
+ const { mutate: mutateVerifyOAuthLink, status: statusVerifyOAuthLink, reset: resetVerifyOAuthLink } = useVerifyOAuthLink();
99
+ const {
100
+ mutate: mutateVerifyFarcasterLink,
101
+ status: statusVerifyFarcasterLink,
102
+ reset: resetVerifyFarcasterLink
103
+ } = useVerifyFarcasterLink();
104
+ const {
105
+ mutateAsync: mutateVerifyTelegramLinkAsync,
106
+ status: statusVerifyTelegramLink,
107
+ reset: resetVerifyTelegramLink
108
+ } = useVerifyTelegramLink();
109
+ const {
110
+ mutateAsync: mutateAsyncVerifyExternalWalletLink,
111
+ status: statusVerifyExternalWalletLink,
112
+ reset: resetVerifyExternalWalletLink
113
+ } = useVerifyExternalWalletLink();
114
+ const isEnabled = !!(embedded == null ? void 0 : embedded.isConnected) && !(embedded == null ? void 0 : embedded.isGuestMode) && (!((_a = para.authInfo) == null ? void 0 : _a.externalWallet) || includeWalletVerification);
115
+ const [accountLinkInProgress, setAccountLinkInProgress] = useState(
116
+ coreAccountLinkInProgress || void 0
117
+ );
118
+ const [unlinkingAccount, setUnlinkingAccount] = useState(void 0);
119
+ const [linkAccountError, setLinkAccountError] = useState(null);
120
+ const [linkAccountStatus, setLinkAccountStatus] = useState("pending");
121
+ const linkAccount = (args) => __async(void 0, null, function* () {
122
+ if (!isEnabled) {
123
+ setLinkAccountError(AccountLinkError.NotAuthenticated);
124
+ throw new Error(AccountLinkError.NotAuthenticated);
125
+ }
126
+ setLinkAccountError(null);
127
+ switch (true) {
128
+ case !args:
129
+ case (args && "options" in args):
130
+ {
131
+ const options = (args == null ? void 0 : args.options) || (para == null ? void 0 : para.supportedAccountLinks) || [...LINKED_ACCOUNT_TYPES];
132
+ if (options.length < 2) {
133
+ throw new Error("Account linking options array must contain 2 or more items");
134
+ }
135
+ setAccountLinkOptions(options);
136
+ openModal({ step: ModalStep.ACCOUNT_PROFILE_LIST });
137
+ }
138
+ break;
139
+ case (args && "externalWallet" in args):
140
+ {
141
+ const providerId = args.externalWallet.internalId;
142
+ const type = args.externalWallet.type;
143
+ if (providerId === (connectedWallet == null ? void 0 : connectedWallet.internalId)) {
144
+ throw new Error(`Cannot link the currently connected external wallet: ${providerId}`);
145
+ }
146
+ setAccountLinkInProgress({
147
+ type: "EXTERNAL_WALLET",
148
+ pendingWalletProvider: providerId,
149
+ pendingWalletType: type
150
+ });
151
+ const linkWallet = wallets.find((w) => w.internalId === providerId);
152
+ if (!linkWallet) {
153
+ throw new Error(`wallet not installed: ${providerId}`);
154
+ }
155
+ openModal({ step: !type ? ModalStep.EX_WALLET_NETWORK_SELECT : ModalStep.ACCOUNT_PROFILE_ADD });
156
+ if (!type) {
157
+ return;
158
+ }
159
+ try {
160
+ const externalWallet = yield externalWalletRequestInfo(providerId, type);
161
+ const accountLinkInProgress2 = yield mutateLinkAccountAsync({ externalWallet });
162
+ yield onAccountLinked(accountLinkInProgress2);
163
+ const signatureVerificationMessage = accountLinkInProgress2.externalWallet.signatureVerificationMessage;
164
+ yield new Promise((resolve) => setTimeout(resolve, 100));
165
+ const {
166
+ signature: signedMessage,
167
+ cosmosPublicKeyHex,
168
+ cosmosSigner
169
+ } = yield signMessage({
170
+ message: signatureVerificationMessage,
171
+ externalWallet: accountLinkInProgress2.externalWallet
172
+ });
173
+ const updatedAccounts = yield mutateAsyncVerifyExternalWalletLink({
174
+ signedMessage,
175
+ cosmosPublicKeyHex,
176
+ cosmosSigner
177
+ });
178
+ yield onAccountLinkVerified(updatedAccounts);
179
+ } catch (e) {
180
+ console.error(e);
181
+ setLinkAccountError(`Error authenticating external wallet: ${e.message}`);
182
+ } finally {
183
+ if (linkWallet.type === "EVM" || linkWallet.type === "SOLANA") {
184
+ yield disconnectBase(providerId);
185
+ }
186
+ }
187
+ }
188
+ break;
189
+ default: {
190
+ switch (true) {
191
+ case "auth" in args:
192
+ {
193
+ validateAuth(args.auth);
194
+ const authInfo = extractAuthInfo(args.auth, { isRequired: true });
195
+ setAccountLinkInProgress({
196
+ type: authInfo.authType.toUpperCase(),
197
+ identifier: authInfo.identifier
198
+ });
199
+ }
200
+ break;
201
+ case "type" in args: {
202
+ if (args.type === "EMAIL" || args.type === "PHONE" || !isOpen) {
203
+ setAccountLinkInProgress({ type: args.type === "X" ? "TWITTER" : args.type });
204
+ }
205
+ break;
206
+ }
207
+ }
208
+ if (!isOpen) {
209
+ openModal({ step: ModalStep.ACCOUNT_PROFILE_ADD });
210
+ }
211
+ try {
212
+ const accountLinkInProgress2 = yield mutateLinkAccountAsync(args);
213
+ yield onAccountLinked(accountLinkInProgress2);
214
+ } catch (e) {
215
+ setLinkAccountError(e.message);
216
+ }
217
+ }
218
+ }
219
+ });
220
+ const onAccountLinked = (accountLinkInProgress2) => __async(void 0, null, function* () {
221
+ queryClient.setQueryData(["accountLinkInProgress"], accountLinkInProgress2 != null ? accountLinkInProgress2 : null);
222
+ setStep(ModalStep.ACCOUNT_PROFILE_ADD);
223
+ switch (accountLinkInProgress2.type) {
224
+ case "EMAIL":
225
+ case "PHONE":
226
+ case "TELEGRAM":
227
+ case "EXTERNAL_WALLET":
228
+ break;
229
+ case "FARCASTER":
230
+ verifyFarcasterLink();
231
+ break;
232
+ default:
233
+ verifyLinkedAccount(accountLinkInProgress2);
234
+ }
235
+ });
236
+ const verifyEmailOrPhoneLink = (verificationCode) => __async(void 0, null, function* () {
237
+ mutateVerifyEmailOrPhoneLink(
238
+ { verificationCode },
239
+ {
240
+ onSuccess: onAccountLinkVerified,
241
+ onError: onAccountLinkError
242
+ }
243
+ );
244
+ });
245
+ const verifyOAuthLink = (method) => __async(void 0, null, function* () {
246
+ mutateVerifyOAuthLink(
247
+ {
248
+ method,
249
+ isCanceled: () => {
250
+ var _a2;
251
+ return !!((_a2 = refs.popupWindow.current) == null ? void 0 : _a2.closed);
252
+ },
253
+ onOAuthUrl: (oAuthUrl) => {
254
+ refs.popupWindow.current = openPopup({
255
+ url: oAuthUrl,
256
+ target: `${method}AuthPopup`,
257
+ type: "OAUTH",
258
+ current: refs.popupWindow.current
259
+ });
260
+ }
261
+ },
262
+ {
263
+ onSuccess: onAccountLinkVerified,
264
+ onError: onAccountLinkError
265
+ }
266
+ );
267
+ });
268
+ const verifyFarcasterLink = () => __async(void 0, null, function* () {
269
+ mutateVerifyFarcasterLink(
270
+ {
271
+ isCanceled: () => refs.currentStep.current !== ModalStep.ACCOUNT_PROFILE_ADD,
272
+ onConnectUri: (connectUri) => {
273
+ setFarcasterConnectUri(connectUri);
274
+ }
275
+ },
276
+ {
277
+ onSuccess: onAccountLinkVerified,
278
+ onError: () => {
279
+ if (refs.currentStep.current === ModalStep.ACCOUNT_PROFILE_ADD) {
280
+ goBack();
281
+ }
282
+ }
283
+ }
284
+ );
285
+ });
286
+ const verifyTelegramLink = (telegramAuthResponse) => __async(void 0, null, function* () {
287
+ try {
288
+ const accounts = yield mutateVerifyTelegramLinkAsync({
289
+ telegramAuthResponse
290
+ });
291
+ onAccountLinkVerified(accounts);
292
+ } catch (e) {
293
+ onAccountLinkError(e);
294
+ throw e;
295
+ }
296
+ });
297
+ const verifyLinkedAccount = ({ type }) => {
298
+ switch (type) {
299
+ case "EMAIL":
300
+ case "PHONE":
301
+ case "TELEGRAM":
302
+ case "EXTERNAL_WALLET":
303
+ break;
304
+ case "FARCASTER":
305
+ verifyFarcasterLink();
306
+ break;
307
+ default:
308
+ verifyOAuthLink(type);
309
+ break;
310
+ }
311
+ };
312
+ const onAccountLinkVerified = (updatedAccounts) => {
313
+ queryClient.setQueryData(["getLinkedAccounts"], () => updatedAccounts);
314
+ setTimeout(() => {
315
+ setStep(ModalStep.ACCOUNT_PROFILE);
316
+ }, 2e3);
317
+ };
318
+ const onAccountLinkError = (e) => {
319
+ setLinkAccountError(e instanceof Error ? e.message : e);
320
+ };
321
+ const unlinkAccount = (linkedAccount) => {
322
+ setUnlinkingAccount(linkedAccount);
323
+ setStep(ModalStep.ACCOUNT_PROFILE_REMOVE);
324
+ };
325
+ const unlinkAccountConfirm = () => {
326
+ mutateUnlinkAccount(
327
+ {
328
+ linkedAccountId: unlinkingAccount.id
329
+ },
330
+ {
331
+ onSuccess: (updatedAccounts) => {
332
+ queryClient.setQueryData(["getLinkedAccounts"], () => updatedAccounts);
333
+ setUnlinkingAccount(void 0);
334
+ setStep(ModalStep.ACCOUNT_PROFILE);
335
+ }
336
+ }
337
+ );
338
+ };
339
+ const cancelLinkAccount = () => {
340
+ mutateUnlinkAccount(void 0);
341
+ };
342
+ const resetMutations = () => {
343
+ resetVerifyEmailOrPhoneLink();
344
+ resetVerifyFarcasterLink();
345
+ resetVerifyOAuthLink();
346
+ resetVerifyTelegramLink();
347
+ resetVerifyExternalWalletLink();
348
+ };
349
+ useEffect(() => {
350
+ setAccountLinkInProgress((prev) => {
351
+ return coreAccountLinkInProgress || prev;
352
+ });
353
+ }, [coreAccountLinkInProgress]);
354
+ useEffect(() => {
355
+ if (!isOpen) {
356
+ setLinkAccountError(null);
357
+ setAccountLinkInProgress(void 0);
358
+ setUnlinkingAccount(void 0);
359
+ resetMutations();
360
+ }
361
+ }, [isOpen]);
362
+ useEffect(() => {
363
+ setLinkAccountStatus(() => {
364
+ if (!isEnabled || !accountLinkInProgress) {
365
+ return "idle";
366
+ }
367
+ if ((accountLinkInProgress.type === "EMAIL" || accountLinkInProgress.type === "PHONE") && !accountLinkInProgress.identifier) {
368
+ return "idle";
369
+ }
370
+ if (linkAccountError) return "error";
371
+ switch (true) {
372
+ case accountLinkInProgress.type === "TELEGRAM":
373
+ return statusVerifyTelegramLink;
374
+ case accountLinkInProgress.type === "FARCASTER":
375
+ return statusVerifyFarcasterLink;
376
+ case accountLinkInProgress.type === "EMAIL":
377
+ case accountLinkInProgress.type === "PHONE":
378
+ return statusVerifyEmailOrPhoneLink;
379
+ case accountLinkInProgress.type === "EXTERNAL_WALLET":
380
+ if (isSigningMessage) return "pending";
381
+ return externalWalletError && externalWalletError.length > 0 ? "error" : statusVerifyExternalWalletLink === "idle" ? "pending" : statusVerifyExternalWalletLink;
382
+ default:
383
+ return statusVerifyOAuthLink;
384
+ }
385
+ });
386
+ }, [
387
+ linkAccountError,
388
+ isEnabled,
389
+ accountLinkInProgress,
390
+ statusVerifyEmailOrPhoneLink,
391
+ statusVerifyFarcasterLink,
392
+ statusVerifyOAuthLink,
393
+ statusVerifyTelegramLink,
394
+ statusVerifyExternalWalletLink,
395
+ externalWalletError,
396
+ isSigningMessage
397
+ ]);
398
+ const value = useMemo(
399
+ () => ({
400
+ isEnabled,
401
+ accountLinkInProgress,
402
+ accountLinkOptions,
403
+ linkAccount,
404
+ isLinkAccountPending,
405
+ verifyOAuthLink,
406
+ verifyFarcasterLink,
407
+ verifyTelegramLink,
408
+ verifyEmailOrPhoneLink,
409
+ verifyLinkedAccount,
410
+ linkAccountStatus,
411
+ linkAccountError,
412
+ setLinkAccountError,
413
+ unlinkingAccount,
414
+ unlinkAccount,
415
+ unlinkAccountConfirm,
416
+ isUnlinkAccountPending,
417
+ cancelLinkAccount,
418
+ onAccountLinked,
419
+ onAccountLinkVerified,
420
+ resetMutations
421
+ }),
422
+ [
423
+ isEnabled,
424
+ accountLinkInProgress,
425
+ accountLinkOptions,
426
+ linkAccount,
427
+ isLinkAccountPending,
428
+ verifyOAuthLink,
429
+ verifyFarcasterLink,
430
+ verifyTelegramLink,
431
+ verifyEmailOrPhoneLink,
432
+ verifyLinkedAccount,
433
+ linkAccountStatus,
434
+ linkAccountError,
435
+ setLinkAccountError,
436
+ unlinkAccount,
437
+ unlinkAccountConfirm,
438
+ isUnlinkAccountPending,
439
+ cancelLinkAccount,
440
+ onAccountLinked,
441
+ onAccountLinkVerified,
442
+ resetMutations
443
+ ]
444
+ );
445
+ return /* @__PURE__ */ jsx(AccountLinkContext.Provider, { value, children });
446
+ };
447
+ const useAccountLinking = () => useContext(AccountLinkContext);
448
+ export {
449
+ AccountLinkContext,
450
+ AccountLinkProvider,
451
+ useAccountLinking
452
+ };
@@ -0,0 +1,38 @@
1
+ import { BiometricHints } from '@getpara/react-common';
2
+ import { PropsWithChildren } from 'react';
3
+ import { AuthMethod, CoreMethodParams, AuthState, AuthStateSignup, AuthStateLogin } from '@getpara/web-sdk';
4
+ import { ParaModalProps } from '../../modal/types/modalProps.js';
5
+ import { TelegramAuthResponse, VerifiedAuth } from '@getpara/user-management-client';
6
+ import { MutationStatus } from '@tanstack/react-query';
7
+ type Value = {
8
+ signUpOrLogIn: (_: VerifiedAuth) => void;
9
+ isSignUpOrLogInPending: boolean;
10
+ verifyNewAccount: (_: string) => void;
11
+ verifyNewAccountStatus: MutationStatus;
12
+ verifyNewAccountError: Error | null;
13
+ verifyOAuth: (_: CoreMethodParams<'verifyOAuth'>['method']) => void;
14
+ verifyFarcaster: () => void;
15
+ verifyTelegram: (_: TelegramAuthResponse) => void;
16
+ verifyTelegramStatus: MutationStatus;
17
+ onNewAuthState: (_: AuthState) => void;
18
+ presentSignupUi: (_: AuthMethod, __: AuthStateSignup) => void;
19
+ presentLoginUi: (_: AuthMethod, __: AuthStateLogin) => void;
20
+ isSetup2faPending: boolean;
21
+ createGuestWallets: () => void;
22
+ isCreateGuestWalletsPending: boolean;
23
+ logout: () => void;
24
+ biometricHints?: BiometricHints;
25
+ isOAuthReady?: boolean;
26
+ };
27
+ type Props = PropsWithChildren<{
28
+ is2faEnabled?: boolean;
29
+ isRecoverySecretStepEnabled?: boolean;
30
+ overrides?: {
31
+ login?: ParaModalProps['loginTransitionOverride'];
32
+ createWallets?: ParaModalProps['createWalletOverride'];
33
+ };
34
+ }>;
35
+ export declare const AuthContext: import("react").Context<Value>;
36
+ export declare function AuthProvider({ children, is2faEnabled, isRecoverySecretStepEnabled, overrides, }: Props): import("react/jsx-runtime").JSX.Element;
37
+ export declare const useAuthActions: () => Value;
38
+ export {};