@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.
- package/dist/chunk-MMUBH76A.js +59 -0
- package/dist/cli/cli.mjs +51 -0
- package/dist/css/modal.css +13 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +10 -0
- package/dist/modal/ParaModal.d.ts +2 -0
- package/dist/modal/ParaModal.js +308 -0
- package/dist/modal/components/Account/Account.d.ts +5 -0
- package/dist/modal/components/Account/Account.js +148 -0
- package/dist/modal/components/Account/AccountProfile.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfile.js +168 -0
- package/dist/modal/components/Account/AccountProfileLink.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileLink.js +206 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +111 -0
- package/dist/modal/components/Account/AccountProfileUnlink.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileUnlink.js +47 -0
- package/dist/modal/components/AddFunds/AddFunds.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFunds.js +69 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.js +125 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +78 -0
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +31 -0
- package/dist/modal/components/AddFunds/AddFundsContext.js +160 -0
- package/dist/modal/components/AddFunds/AddFundsDone.d.ts +6 -0
- package/dist/modal/components/AddFunds/AddFundsDone.js +49 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.js +109 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.js +83 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.js +237 -0
- package/dist/modal/components/AddFunds/MoonPayEmbed.d.ts +2 -0
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +7 -0
- package/dist/modal/components/AddFunds/common.d.ts +19 -0
- package/dist/modal/components/AddFunds/common.js +24 -0
- package/dist/modal/components/AddFunds/index.d.ts +3 -0
- package/dist/modal/components/AddFunds/index.js +4 -0
- package/dist/modal/components/AuthInput/AuthInput.d.ts +20 -0
- package/dist/modal/components/AuthInput/AuthInput.js +277 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +7 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
- package/dist/modal/components/AuthInput/phoneMasks.d.ts +247 -0
- package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +9 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +50 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +9 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +179 -0
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +9 -0
- package/dist/modal/components/AuthOptions/AuthOptions.js +85 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.d.ts +1 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.d.ts +1 -0
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.js +12 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.d.ts +1 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.d.ts +1 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +49 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +62 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +48 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +6 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
- package/dist/modal/components/Body/Body.d.ts +11 -0
- package/dist/modal/components/Body/Body.js +354 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +95 -0
- package/dist/modal/components/ChainSwitch/config.d.ts +7 -0
- package/dist/modal/components/ChainSwitch/config.js +17 -0
- package/dist/modal/components/Controls/Controls.d.ts +5 -0
- package/dist/modal/components/Controls/Controls.js +78 -0
- package/dist/modal/components/Controls/Selects.d.ts +2 -0
- package/dist/modal/components/Controls/Selects.js +173 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +75 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +8 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +175 -0
- package/dist/modal/components/ExternalWalletStep/config.d.ts +7 -0
- package/dist/modal/components/ExternalWalletStep/config.js +17 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +39 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +1 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +182 -0
- package/dist/modal/components/Footer/Footer.d.ts +1 -0
- package/dist/modal/components/Footer/Footer.js +95 -0
- package/dist/modal/components/Header/Header.d.ts +1 -0
- package/dist/modal/components/Header/Header.js +43 -0
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +3 -0
- package/dist/modal/components/Header/hooks/useStepTitle.js +62 -0
- package/dist/modal/components/Hero/Hero.d.ts +1 -0
- package/dist/modal/components/Hero/Hero.js +116 -0
- package/dist/modal/components/IFrameStep/IFrameStep.d.ts +1 -0
- package/dist/modal/components/IFrameStep/IFrameStep.js +70 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +5 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +44 -0
- package/dist/modal/components/ModalContent/ModalContent.d.ts +10 -0
- package/dist/modal/components/ModalContent/ModalContent.js +88 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +3 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +31 -0
- package/dist/modal/components/OAuth/OAuth.d.ts +6 -0
- package/dist/modal/components/OAuth/OAuth.js +81 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +8 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +74 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.d.ts +1 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.d.ts +9 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.d.ts +6 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +107 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.d.ts +5 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +132 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +5 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +27 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +12 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +160 -0
- package/dist/modal/components/Waiting/Waiting.d.ts +6 -0
- package/dist/modal/components/Waiting/Waiting.js +17 -0
- package/dist/modal/components/WalletCard/PartnerIcon.d.ts +6 -0
- package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
- package/dist/modal/components/WalletCard/WalletCard.d.ts +18 -0
- package/dist/modal/components/WalletCard/WalletCard.js +128 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.d.ts +6 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +83 -0
- package/dist/modal/components/common.d.ts +59 -0
- package/dist/modal/components/common.js +261 -0
- package/dist/modal/components/index.d.ts +1 -0
- package/dist/modal/components/index.js +2 -0
- package/dist/modal/constants/constants.d.ts +40 -0
- package/dist/modal/constants/constants.js +142 -0
- package/dist/modal/constants/defaults.d.ts +5 -0
- package/dist/modal/constants/defaults.js +10 -0
- package/dist/modal/constants/oAuthLogos.d.ts +17 -0
- package/dist/modal/constants/oAuthLogos.js +158 -0
- package/dist/modal/constants/walletTypeConfig.d.ts +6 -0
- package/dist/modal/constants/walletTypeConfig.js +13 -0
- package/dist/modal/hooks/useGoBack.d.ts +1 -0
- package/dist/modal/hooks/useGoBack.js +43 -0
- package/dist/modal/hooks/useTelegramLogin.d.ts +12 -0
- package/dist/modal/hooks/useTelegramLogin.js +65 -0
- package/dist/modal/index.d.ts +8 -0
- package/dist/modal/index.js +29 -0
- package/dist/modal/stores/index.d.ts +1 -0
- package/dist/modal/stores/index.js +2 -0
- package/dist/modal/stores/modal/actions.d.ts +3 -0
- package/dist/modal/stores/modal/actions.js +139 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +105 -0
- package/dist/modal/stores/modal/useModalStore.js +75 -0
- package/dist/modal/types/commonTypes.d.ts +6 -0
- package/dist/modal/types/commonTypes.js +1 -0
- package/dist/modal/types/modalProps.d.ts +129 -0
- package/dist/modal/types/modalProps.js +12 -0
- package/dist/modal/utils/authInputHelpers.d.ts +5 -0
- package/dist/modal/utils/authInputHelpers.js +41 -0
- package/dist/modal/utils/authLayoutHelpers.d.ts +3 -0
- package/dist/modal/utils/authLayoutHelpers.js +8 -0
- package/dist/modal/utils/countryCodes.d.ts +8 -0
- package/dist/modal/utils/countryCodes.js +45 -0
- package/dist/modal/utils/getMailtoLink.d.ts +1 -0
- package/dist/modal/utils/getMailtoLink.js +10 -0
- package/dist/modal/utils/getTileButtonFlex.d.ts +1 -0
- package/dist/modal/utils/getTileButtonFlex.js +20 -0
- package/dist/modal/utils/getWalletDisplayName.d.ts +5 -0
- package/dist/modal/utils/getWalletDisplayName.js +22 -0
- package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
- package/dist/modal/utils/isPasskeySupported.js +15 -0
- package/dist/modal/utils/openPopup.d.ts +6 -0
- package/dist/modal/utils/openPopup.js +60 -0
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +1 -0
- package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
- package/dist/modal/utils/steps.d.ts +136 -0
- package/dist/modal/utils/steps.js +279 -0
- package/dist/modal/utils/stringFormatters.d.ts +5 -0
- package/dist/modal/utils/stringFormatters.js +19 -0
- package/dist/modal/utils/validateOnRampConfig.d.ts +5 -0
- package/dist/modal/utils/validateOnRampConfig.js +32 -0
- package/dist/package.json +6 -0
- package/dist/provider/ParaProvider.d.ts +4 -0
- package/dist/provider/ParaProvider.js +140 -0
- package/dist/provider/actions/getEmbeddedAccount.d.ts +26 -0
- package/dist/provider/actions/getEmbeddedAccount.js +57 -0
- package/dist/provider/actions/getWallet.d.ts +5 -0
- package/dist/provider/actions/getWallet.js +18 -0
- package/dist/provider/actions/index.d.ts +47 -0
- package/dist/provider/actions/index.js +79 -0
- package/dist/provider/actions/utils.d.ts +4 -0
- package/dist/provider/actions/utils.js +34 -0
- package/dist/provider/components/CosmosWalletWrapper.d.ts +11 -0
- package/dist/provider/components/CosmosWalletWrapper.js +43 -0
- package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
- package/dist/provider/components/EvmWalletWrapper.js +43 -0
- package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
- package/dist/provider/components/ExternalWalletWrapper.js +140 -0
- package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
- package/dist/provider/components/SolanaWalletWrapper.js +44 -0
- package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
- package/dist/provider/external/getParaCosmosConnector.js +19 -0
- package/dist/provider/external/getParaCosmosLib.d.ts +4 -0
- package/dist/provider/external/getParaCosmosLib.js +16 -0
- package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
- package/dist/provider/external/getParaEvmConnector.js +19 -0
- package/dist/provider/external/getParaEvmLib.d.ts +4 -0
- package/dist/provider/external/getParaEvmLib.js +16 -0
- package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
- package/dist/provider/external/getParaSolanaConnector.js +19 -0
- package/dist/provider/external/getParaSolanaLib.d.ts +4 -0
- package/dist/provider/external/getParaSolanaLib.js +16 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +2 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +8 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +2 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +8 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +2 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +8 -0
- package/dist/provider/hooks/index.d.ts +3 -0
- package/dist/provider/hooks/index.js +4 -0
- package/dist/provider/hooks/mutations/core.d.ts +27 -0
- package/dist/provider/hooks/mutations/core.js +66 -0
- package/dist/provider/hooks/mutations/index.d.ts +3 -0
- package/dist/provider/hooks/mutations/index.js +9 -0
- package/dist/provider/hooks/mutations/useLinkAccount.d.ts +9 -0
- package/dist/provider/hooks/mutations/useLinkAccount.js +18 -0
- package/dist/provider/hooks/mutations/utils.d.ts +12 -0
- package/dist/provider/hooks/mutations/utils.js +90 -0
- package/dist/provider/hooks/queries/core.d.ts +4 -0
- package/dist/provider/hooks/queries/core.js +16 -0
- package/dist/provider/hooks/queries/index.d.ts +5 -0
- package/dist/provider/hooks/queries/index.js +13 -0
- package/dist/provider/hooks/queries/useAccount.d.ts +90 -0
- package/dist/provider/hooks/queries/useAccount.js +141 -0
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +5 -0
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +24 -0
- package/dist/provider/hooks/queries/useParaStatus.d.ts +22 -0
- package/dist/provider/hooks/queries/useParaStatus.js +25 -0
- package/dist/provider/hooks/queries/useWallet.d.ts +5 -0
- package/dist/provider/hooks/queries/useWallet.js +26 -0
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +6 -0
- package/dist/provider/hooks/queries/useWalletBalance.js +55 -0
- package/dist/provider/hooks/queries/utils.d.ts +7 -0
- package/dist/provider/hooks/queries/utils.js +25 -0
- package/dist/provider/hooks/utils/index.d.ts +3 -0
- package/dist/provider/hooks/utils/index.js +10 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.d.ts +3 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
- package/dist/provider/hooks/utils/useClient.d.ts +5 -0
- package/dist/provider/hooks/utils/useClient.js +10 -0
- package/dist/provider/hooks/utils/useEventListeners.d.ts +2 -0
- package/dist/provider/hooks/utils/useEventListeners.js +157 -0
- package/dist/provider/hooks/utils/useFormattedBiometricHints.d.ts +4 -0
- package/dist/provider/hooks/utils/useFormattedBiometricHints.js +27 -0
- package/dist/provider/hooks/utils/useInternalClient.d.ts +5 -0
- package/dist/provider/hooks/utils/useInternalClient.js +10 -0
- package/dist/provider/hooks/utils/useModal.d.ts +11 -0
- package/dist/provider/hooks/utils/useModal.js +27 -0
- package/dist/provider/hooks/utils/useWalletState.d.ts +15 -0
- package/dist/provider/hooks/utils/useWalletState.js +48 -0
- package/dist/provider/index.d.ts +6 -0
- package/dist/provider/index.js +11 -0
- package/dist/provider/providers/AccountLinkProvider.d.ts +47 -0
- package/dist/provider/providers/AccountLinkProvider.js +452 -0
- package/dist/provider/providers/AuthProvider.d.ts +38 -0
- package/dist/provider/providers/AuthProvider.js +575 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
- package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
- package/dist/provider/providers/ExternalWalletProvider.d.ts +61 -0
- package/dist/provider/providers/ExternalWalletProvider.js +626 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
- package/dist/provider/stores/getters.d.ts +4 -0
- package/dist/provider/stores/getters.js +13 -0
- package/dist/provider/stores/setters.d.ts +1 -0
- package/dist/provider/stores/setters.js +7 -0
- package/dist/provider/stores/slices/analytics.d.ts +3 -0
- package/dist/provider/stores/slices/analytics.js +9 -0
- package/dist/provider/stores/slices/client.d.ts +3 -0
- package/dist/provider/stores/slices/client.js +9 -0
- package/dist/provider/stores/slices/config.d.ts +3 -0
- package/dist/provider/stores/slices/config.js +11 -0
- package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
- package/dist/provider/stores/slices/externalWallets.js +46 -0
- package/dist/provider/stores/slices/index.d.ts +5 -0
- package/dist/provider/stores/slices/index.js +6 -0
- package/dist/provider/stores/slices/modal.d.ts +3 -0
- package/dist/provider/stores/slices/modal.js +18 -0
- package/dist/provider/stores/slices/wallet.d.ts +3 -0
- package/dist/provider/stores/slices/wallet.js +13 -0
- package/dist/provider/stores/types.d.ts +86 -0
- package/dist/provider/stores/types.js +1 -0
- package/dist/provider/stores/useStore.d.ts +17 -0
- package/dist/provider/stores/useStore.js +34 -0
- package/dist/provider/types/externalWalletProviders.d.ts +12 -0
- package/dist/provider/types/externalWalletProviders.js +1 -0
- package/dist/provider/types/provider.d.ts +166 -0
- package/dist/provider/types/provider.js +1 -0
- package/dist/provider/types/query.d.ts +3 -0
- package/dist/provider/types/query.js +1 -0
- package/dist/provider/types/utils.d.ts +45 -0
- package/dist/provider/types/utils.js +1 -0
- package/dist/provider/utils/constants.d.ts +5 -0
- package/dist/provider/utils/constants.js +10 -0
- package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
- package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
- package/dist/provider/utils/renameMutations.d.ts +5 -0
- package/dist/provider/utils/renameMutations.js +18 -0
- package/dist/public/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/package.json +63 -0
- package/styles.css/package.json +3 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
var __async = (__this, __arguments, generator) => {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
var fulfilled = (value) => {
|
|
36
|
+
try {
|
|
37
|
+
step(generator.next(value));
|
|
38
|
+
} catch (e) {
|
|
39
|
+
reject(e);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var rejected = (value) => {
|
|
43
|
+
try {
|
|
44
|
+
step(generator.throw(value));
|
|
45
|
+
} catch (e) {
|
|
46
|
+
reject(e);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
50
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
__spreadValues,
|
|
56
|
+
__spreadProps,
|
|
57
|
+
__objRest,
|
|
58
|
+
__async
|
|
59
|
+
};
|
package/dist/cli/cli.mjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as fs from 'node:fs/promises';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { createRequire } from 'module';
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
|
|
7
|
+
const PACKAGES_TO_STUB = [
|
|
8
|
+
'@getpara/evm-wallet-connectors',
|
|
9
|
+
'@getpara/cosmos-wallet-connectors',
|
|
10
|
+
'@getpara/solana-wallet-connectors',
|
|
11
|
+
'@farcaster/miniapp-sdk',
|
|
12
|
+
'@farcaster/miniapp-wagmi-connector',
|
|
13
|
+
'@farcaster/mini-app-solana',
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const checkForPackages = async () => {
|
|
17
|
+
const pathToNodeModules = path.resolve('node_modules');
|
|
18
|
+
|
|
19
|
+
for (let i = 0; i < PACKAGES_TO_STUB.length; i++) {
|
|
20
|
+
const packageName = PACKAGES_TO_STUB[i];
|
|
21
|
+
try {
|
|
22
|
+
await import(packageName);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
if (err.code === 'ERR_MODULE_NOT_FOUND') {
|
|
25
|
+
const packageJsonContent = { name: packageName, main: './index.js' };
|
|
26
|
+
|
|
27
|
+
await fs.mkdir(path.join(pathToNodeModules, packageName), { recursive: true });
|
|
28
|
+
const indexPath = path.join(pathToNodeModules, packageName, 'index.js');
|
|
29
|
+
const packageJsonPath = path.join(pathToNodeModules, packageName, 'package.json');
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
await fs.access(indexPath);
|
|
33
|
+
} catch {
|
|
34
|
+
await fs.writeFile(indexPath, '//STUB');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
await fs.access(packageJsonPath);
|
|
39
|
+
} catch {
|
|
40
|
+
await fs.writeFile(packageJsonPath, JSON.stringify(packageJsonContent), {
|
|
41
|
+
encoding: 'utf-8',
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
process.exit();
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
await checkForPackages();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@import url('@getpara/react-components/css/capsule-core.css');
|
|
2
|
+
|
|
3
|
+
@font-face {
|
|
4
|
+
font-family: 'Inter';
|
|
5
|
+
src: url('../public/Inter-VariableFont_slnt,wght.ttf') format('truetype');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
html {
|
|
9
|
+
--cpsl-default-font: 'Inter', sans-serif;
|
|
10
|
+
-webkit-overflow-scrolling: touch;
|
|
11
|
+
|
|
12
|
+
--wcm-z-index: 11000 !important;
|
|
13
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "./chunk-MMUBH76A.js";
|
|
3
|
+
export * from "./modal/index.js";
|
|
4
|
+
export * from "./provider/index.js";
|
|
5
|
+
export * from "@getpara/web-sdk";
|
|
6
|
+
import ParaWeb from "@getpara/web-sdk";
|
|
7
|
+
var src_default = ParaWeb;
|
|
8
|
+
export {
|
|
9
|
+
src_default as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async,
|
|
4
|
+
__objRest,
|
|
5
|
+
__spreadProps,
|
|
6
|
+
__spreadValues
|
|
7
|
+
} from "../chunk-MMUBH76A.js";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { CpslAuthModal, defineCustomElements, generateTheme } from "@getpara/react-components";
|
|
10
|
+
import { ModalContent } from "./components/index.js";
|
|
11
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
12
|
+
import { useModalStore } from "./stores/index.js";
|
|
13
|
+
import { ModalStep, RESET_TO_ACCOUNT_STEPS, RESET_TO_AUTH_STEPS } from "./utils/steps.js";
|
|
14
|
+
import { AuthLayout } from "./types/modalProps.js";
|
|
15
|
+
import { DEFAULTS } from "./constants/defaults.js";
|
|
16
|
+
import { useGoBack } from "./hooks/useGoBack.js";
|
|
17
|
+
import { safeStyled } from "@getpara/react-common";
|
|
18
|
+
import { hasEmbeddedAuth, hasExternalWallet } from "./utils/authLayoutHelpers.js";
|
|
19
|
+
import { useAccount, useModal, useParaStatus, useWalletState } from "../provider/index.js";
|
|
20
|
+
import { useInternalClient } from "../provider/hooks/utils/useInternalClient.js";
|
|
21
|
+
import { useExternalWallets } from "../provider/providers/ExternalWalletProvider.js";
|
|
22
|
+
import { useStore } from "../provider/stores/useStore.js";
|
|
23
|
+
import parsePhoneNumberFromString from "libphonenumber-js";
|
|
24
|
+
import { useAuthActions } from "../provider/providers/AuthProvider.js";
|
|
25
|
+
import { validateInput } from "./utils/authInputHelpers.js";
|
|
26
|
+
import { SDK_VERSION } from "./constants/constants.js";
|
|
27
|
+
defineCustomElements();
|
|
28
|
+
const ParaModal = forwardRef((props, ref) => {
|
|
29
|
+
const storedModalConfig = useStore((state) => state.modalConfig);
|
|
30
|
+
const openedToStep = useStore((state) => state.openedToStep);
|
|
31
|
+
const modalContentRef = useRef(null);
|
|
32
|
+
const refs = useModalStore((state) => state.refs);
|
|
33
|
+
const flow = useModalStore((state) => state.flow);
|
|
34
|
+
const currentStep = useModalStore((state) => state.step);
|
|
35
|
+
const setAuthState = useModalStore((state) => state.setAuthState);
|
|
36
|
+
const setOnModalStepChange = useModalStore((state) => state.setOnModalStepChange);
|
|
37
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
38
|
+
const hasPreviousStep = useModalStore((state) => state.hasPreviousStep());
|
|
39
|
+
const setFlow = useModalStore((state) => state.setFlow);
|
|
40
|
+
const goBack = useGoBack();
|
|
41
|
+
const setAuthLayout = useModalStore((state) => state.setAuthLayout);
|
|
42
|
+
const storedAuthLayout = useModalStore((state) => state.authLayout);
|
|
43
|
+
const resetModalState = useModalStore((state) => state.resetState);
|
|
44
|
+
const setRecoveryShare = useModalStore((state) => state.setRecoveryShare);
|
|
45
|
+
const { disconnectExternalWallet } = useExternalWallets();
|
|
46
|
+
const { isOpen: storedIsOpen, closeModal } = useModal();
|
|
47
|
+
const para = useInternalClient();
|
|
48
|
+
const { setSelectedWallet, updateSelectedWallet } = useWalletState();
|
|
49
|
+
const setAuthStepRoute = useModalStore((state) => state.setAuthStepRoute);
|
|
50
|
+
const { signUpOrLogIn, isCreateGuestWalletsPending } = useAuthActions();
|
|
51
|
+
const { isReady, isFarcasterMiniApp } = useParaStatus();
|
|
52
|
+
const { isLoading: isAccountLoading, isConnected } = useAccount();
|
|
53
|
+
const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
|
|
54
|
+
const setIsIFrameReady = useModalStore((state) => state.setIsIFrameReady);
|
|
55
|
+
const [isModalMounted, setIsModalMounted] = useState(false);
|
|
56
|
+
const externalWallets = useStore((state) => state.externalWallets);
|
|
57
|
+
const providerProps = useStore((state) => state.providerProps);
|
|
58
|
+
const setAccountLinkOptions = useModalStore((state) => state.setAccountLinkOptions);
|
|
59
|
+
const isInitialized = useRef(false);
|
|
60
|
+
const _a = __spreadValues(__spreadValues({}, storedModalConfig), props), {
|
|
61
|
+
isOpen: configIsOpen,
|
|
62
|
+
theme,
|
|
63
|
+
disableEmailLogin = false,
|
|
64
|
+
disablePhoneLogin = false,
|
|
65
|
+
isGuestModeEnabled = false,
|
|
66
|
+
oAuthMethods = ["GOOGLE", "TWITTER"],
|
|
67
|
+
bareModal = false,
|
|
68
|
+
className,
|
|
69
|
+
currentStepOverride,
|
|
70
|
+
authLayout = [AuthLayout.AUTH_FULL, AuthLayout.EXTERNAL_FULL],
|
|
71
|
+
embeddedModal,
|
|
72
|
+
onModalStepChange,
|
|
73
|
+
onClose,
|
|
74
|
+
defaultAuthIdentifier,
|
|
75
|
+
supportedAccountLinks: propsSupportedAccountLinks
|
|
76
|
+
} = _a, rest = __objRest(_a, [
|
|
77
|
+
"isOpen",
|
|
78
|
+
"theme",
|
|
79
|
+
"disableEmailLogin",
|
|
80
|
+
"disablePhoneLogin",
|
|
81
|
+
"isGuestModeEnabled",
|
|
82
|
+
"oAuthMethods",
|
|
83
|
+
"bareModal",
|
|
84
|
+
"className",
|
|
85
|
+
"currentStepOverride",
|
|
86
|
+
"authLayout",
|
|
87
|
+
"embeddedModal",
|
|
88
|
+
"onModalStepChange",
|
|
89
|
+
"onClose",
|
|
90
|
+
"defaultAuthIdentifier",
|
|
91
|
+
"supportedAccountLinks"
|
|
92
|
+
]);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const trackAnalytics = () => __async(void 0, null, function* () {
|
|
95
|
+
try {
|
|
96
|
+
yield para.ctx.client.trackReactSdkAnalytics({
|
|
97
|
+
props: __spreadValues(__spreadProps(__spreadValues({}, providerProps), {
|
|
98
|
+
theme,
|
|
99
|
+
disableEmailLogin,
|
|
100
|
+
disablePhoneLogin,
|
|
101
|
+
isGuestModeEnabled,
|
|
102
|
+
oAuthMethods,
|
|
103
|
+
bareModal,
|
|
104
|
+
className,
|
|
105
|
+
currentStepOverride,
|
|
106
|
+
authLayout,
|
|
107
|
+
embeddedModal,
|
|
108
|
+
onModalStepChange,
|
|
109
|
+
onClose,
|
|
110
|
+
defaultAuthIdentifier
|
|
111
|
+
}), rest),
|
|
112
|
+
reactSdkVersion: SDK_VERSION
|
|
113
|
+
});
|
|
114
|
+
} catch (_) {
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
trackAnalytics();
|
|
118
|
+
}, []);
|
|
119
|
+
const isOpen = configIsOpen != null ? configIsOpen : storedIsOpen;
|
|
120
|
+
useImperativeHandle(ref, () => {
|
|
121
|
+
return {
|
|
122
|
+
goBack() {
|
|
123
|
+
goBack();
|
|
124
|
+
},
|
|
125
|
+
canGoBack() {
|
|
126
|
+
return hasPreviousStep;
|
|
127
|
+
},
|
|
128
|
+
currentStep() {
|
|
129
|
+
return currentStep;
|
|
130
|
+
},
|
|
131
|
+
handleModalClose() {
|
|
132
|
+
var _a2;
|
|
133
|
+
(_a2 = modalContentRef == null ? void 0 : modalContentRef.current) == null ? void 0 : _a2.handleModalClose();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}, [hasPreviousStep, currentStep]);
|
|
137
|
+
const initModal = (shouldAutoLogin) => __async(void 0, null, function* () {
|
|
138
|
+
var _a2;
|
|
139
|
+
if (!isReady) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
setIFrameUrl(void 0);
|
|
143
|
+
setIsIFrameReady(false);
|
|
144
|
+
const isAccount = isConnected, isGuest = isAccount && para.isGuestMode || isCreateGuestWalletsPending;
|
|
145
|
+
switch (true) {
|
|
146
|
+
case !!currentStepOverride:
|
|
147
|
+
setStep(ModalStep[currentStepOverride.toUpperCase()]);
|
|
148
|
+
break;
|
|
149
|
+
case isGuest:
|
|
150
|
+
setFlow("guest");
|
|
151
|
+
setStep(isCreateGuestWalletsPending ? ModalStep.AWAITING_GUEST_WALLET_CREATION : ModalStep.ACCOUNT_MAIN);
|
|
152
|
+
break;
|
|
153
|
+
case isAccount:
|
|
154
|
+
setFlow("account");
|
|
155
|
+
if (!openedToStep.current) {
|
|
156
|
+
setStep(ModalStep.ACCOUNT_MAIN);
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
159
|
+
default:
|
|
160
|
+
if (currentStep !== ModalStep.AUTH_MAIN && currentStep !== ModalStep.SECRET) {
|
|
161
|
+
setFlow(void 0);
|
|
162
|
+
setStep(para.isTelegram ? ModalStep.TELEGRAM_OAUTH : ModalStep.AUTH_MAIN);
|
|
163
|
+
setAuthState();
|
|
164
|
+
setAuthStepRoute();
|
|
165
|
+
}
|
|
166
|
+
if (!isFarcasterMiniApp) {
|
|
167
|
+
yield disconnectExternalWallet();
|
|
168
|
+
setSelectedWallet({ id: void 0, type: void 0 });
|
|
169
|
+
}
|
|
170
|
+
if (shouldAutoLogin) {
|
|
171
|
+
if (defaultAuthIdentifier && ((_a2 = para.authInfo) == null ? void 0 : _a2.identifier) !== defaultAuthIdentifier) {
|
|
172
|
+
const number = parsePhoneNumberFromString(defaultAuthIdentifier);
|
|
173
|
+
try {
|
|
174
|
+
const auth = validateInput(
|
|
175
|
+
number ? number.nationalNumber : defaultAuthIdentifier,
|
|
176
|
+
(number == null ? void 0 : number.countryCallingCode) ? `+${number == null ? void 0 : number.countryCallingCode}` : void 0,
|
|
177
|
+
number ? "phone" : "email"
|
|
178
|
+
);
|
|
179
|
+
para.setAuth(number ? { phone: defaultAuthIdentifier } : { email: defaultAuthIdentifier });
|
|
180
|
+
signUpOrLogIn(auth);
|
|
181
|
+
} catch (err) {
|
|
182
|
+
console.error("invalid user identifier:", err.message);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
if (isReady && isOpen && !isAccountLoading && !isInitialized.current) {
|
|
191
|
+
initModal(isOpen);
|
|
192
|
+
isInitialized.current = true;
|
|
193
|
+
}
|
|
194
|
+
if (isReady && !isOpen && isInitialized.current) {
|
|
195
|
+
initModal();
|
|
196
|
+
isInitialized.current = false;
|
|
197
|
+
}
|
|
198
|
+
}, [isReady, isOpen, isAccountLoading]);
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
let _authLayout = authLayout;
|
|
201
|
+
if (!(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout)) {
|
|
202
|
+
_authLayout = _authLayout.filter((l) => !l.includes("EXTERNAL"));
|
|
203
|
+
}
|
|
204
|
+
if (disableEmailLogin && disablePhoneLogin && !(oAuthMethods == null ? void 0 : oAuthMethods.length) && hasEmbeddedAuth(authLayout)) {
|
|
205
|
+
_authLayout = _authLayout.filter((l) => !l.includes("AUTH"));
|
|
206
|
+
}
|
|
207
|
+
if (JSON.stringify(storedAuthLayout) !== JSON.stringify(_authLayout)) {
|
|
208
|
+
setAuthLayout(_authLayout);
|
|
209
|
+
}
|
|
210
|
+
}, [disableEmailLogin, disablePhoneLogin, oAuthMethods, externalWallets, authLayout, storedAuthLayout]);
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
if (theme) {
|
|
213
|
+
generateTheme(theme);
|
|
214
|
+
}
|
|
215
|
+
}, [theme]);
|
|
216
|
+
useEffect(() => {
|
|
217
|
+
setOnModalStepChange(onModalStepChange);
|
|
218
|
+
}, [onModalStepChange]);
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
updateSelectedWallet();
|
|
221
|
+
}, [para]);
|
|
222
|
+
useEffect(() => {
|
|
223
|
+
if (bareModal && !isAccountLoading && !isConnected && !["signup", "login"].includes(flow != null ? flow : "") && refs.currentStep.current !== ModalStep.AUTH_MAIN) {
|
|
224
|
+
setStep(ModalStep.AUTH_MAIN);
|
|
225
|
+
}
|
|
226
|
+
}, [bareModal, flow, isConnected, isAccountLoading]);
|
|
227
|
+
useEffect(() => {
|
|
228
|
+
setAccountLinkOptions(propsSupportedAccountLinks != null ? propsSupportedAccountLinks : para == null ? void 0 : para.supportedAccountLinks);
|
|
229
|
+
}, [propsSupportedAccountLinks, para == null ? void 0 : para.supportedAccountLinks]);
|
|
230
|
+
const handleClose = () => {
|
|
231
|
+
closeModal();
|
|
232
|
+
onClose == null ? void 0 : onClose();
|
|
233
|
+
};
|
|
234
|
+
const handleModalEntering = () => {
|
|
235
|
+
setIsModalMounted(true);
|
|
236
|
+
};
|
|
237
|
+
const handleModalExited = () => __async(void 0, null, function* () {
|
|
238
|
+
openedToStep.current = null;
|
|
239
|
+
setIsModalMounted(false);
|
|
240
|
+
if (RESET_TO_AUTH_STEPS.includes(currentStep)) {
|
|
241
|
+
resetModalState();
|
|
242
|
+
setRecoveryShare(null);
|
|
243
|
+
} else if (RESET_TO_ACCOUNT_STEPS.includes(currentStep)) {
|
|
244
|
+
setStep(ModalStep.LOGIN_DONE);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
if (!para) {
|
|
248
|
+
console.error("A Para instance is required.");
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
if (!(storedAuthLayout == null ? void 0 : storedAuthLayout.length)) {
|
|
252
|
+
const hasExternalWalletError = !(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout);
|
|
253
|
+
const hasEmbeddedWalletError = disableEmailLogin && disablePhoneLogin && !(oAuthMethods == null ? void 0 : oAuthMethods.length) && hasEmbeddedAuth(authLayout);
|
|
254
|
+
if (hasExternalWalletError || hasEmbeddedWalletError) {
|
|
255
|
+
if (hasExternalWalletError) {
|
|
256
|
+
console.error("At least one external wallet must be provided if external wallet auth is enabled.");
|
|
257
|
+
}
|
|
258
|
+
if (hasEmbeddedWalletError) {
|
|
259
|
+
console.error(
|
|
260
|
+
"At least one login method (email, phone or OAuth) must be provided if embedded wallet auth is enabled."
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
console.error("At least one auth layout selection is required.");
|
|
265
|
+
}
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
return /* @__PURE__ */ jsx(
|
|
269
|
+
StyledAuthModal,
|
|
270
|
+
{
|
|
271
|
+
enterTransitionDuration: DEFAULTS.ANIMATION_DURATION,
|
|
272
|
+
exitTransitionDuration: DEFAULTS.ANIMATION_DURATION,
|
|
273
|
+
open: isOpen,
|
|
274
|
+
onCpslModalExited: handleModalExited,
|
|
275
|
+
onCpslModalEntering: handleModalEntering,
|
|
276
|
+
onCpslModalRequestClose: handleClose,
|
|
277
|
+
noOverlay: bareModal,
|
|
278
|
+
className,
|
|
279
|
+
"data-testid": "modal",
|
|
280
|
+
$embeddedModal: !!embeddedModal,
|
|
281
|
+
children: isModalMounted && ((embeddedModal || bareModal) && isInitialized.current || !embeddedModal && !bareModal) && /* @__PURE__ */ jsx(
|
|
282
|
+
ModalContent,
|
|
283
|
+
__spreadValues({
|
|
284
|
+
oAuthMethods,
|
|
285
|
+
disableEmailLogin,
|
|
286
|
+
disablePhoneLogin,
|
|
287
|
+
isGuestModeEnabled,
|
|
288
|
+
onClose: handleClose
|
|
289
|
+
}, rest)
|
|
290
|
+
)
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
|
+
});
|
|
294
|
+
const StyledAuthModal = safeStyled(CpslAuthModal)`
|
|
295
|
+
${({ $embeddedModal }) => $embeddedModal && `
|
|
296
|
+
&::part(modal-body-card) {
|
|
297
|
+
--card-box-shadow: none;
|
|
298
|
+
--card-border-width: 0px;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
&::part(modal-footer) {
|
|
302
|
+
--card-box-shadow: none;
|
|
303
|
+
--card-border-width: 0px;
|
|
304
|
+
};`}
|
|
305
|
+
`;
|
|
306
|
+
export {
|
|
307
|
+
ParaModal
|
|
308
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { safeStyled } from "@getpara/react-common";
|
|
7
|
+
import { InnerStepContainer, StepContainer, StyledCpslTileButton } from "../common.js";
|
|
8
|
+
import { CpslButton, CpslIcon, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
9
|
+
import { OnRampStep, useModalStore } from "../../stores/index.js";
|
|
10
|
+
import { useEffect, useState } from "react";
|
|
11
|
+
import { ModalStep } from "../../utils/steps.js";
|
|
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";
|
|
18
|
+
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
19
|
+
const Account = ({ onClose }) => {
|
|
20
|
+
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
21
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
22
|
+
const setFlow = useModalStore((state) => state.setFlow);
|
|
23
|
+
const setGuestAddFundsTab = useModalStore((state) => state.setGuestAddFundsTab);
|
|
24
|
+
const setOnRampStep = useModalStore((state) => state.setOnRampStep);
|
|
25
|
+
const hideWallets = useStore((state) => {
|
|
26
|
+
var _a;
|
|
27
|
+
return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
|
|
28
|
+
});
|
|
29
|
+
const { disconnectExternalWallet } = useExternalWallets();
|
|
30
|
+
const para = useInternalClient();
|
|
31
|
+
const { embedded } = useAccount();
|
|
32
|
+
const { data: balance, isLoading: isBalanceLoading } = useWalletBalance();
|
|
33
|
+
const { isEnabled } = useAccountLinking();
|
|
34
|
+
const [isDisconnecting, setIsDisconnecting] = useState(false);
|
|
35
|
+
const isGuestMode = embedded.isConnected && embedded.isGuestMode;
|
|
36
|
+
const cantBuyAndWithdraw = (para.externalWalletConnectionType === "CONNECTION_ONLY" || para.externalWalletConnectionType === "VERIFICATION") && !para.userId;
|
|
37
|
+
const isOnRampLoaded = !!onRampConfig;
|
|
38
|
+
const handleBuyClick = () => {
|
|
39
|
+
if (isGuestMode) {
|
|
40
|
+
if (onRampConfig == null ? void 0 : onRampConfig.isReceiveEnabled) {
|
|
41
|
+
setStep(ModalStep.ADD_FUNDS_RECEIVE);
|
|
42
|
+
} else {
|
|
43
|
+
setGuestAddFundsTab(EnabledFlow.BUY);
|
|
44
|
+
setStep(ModalStep.AUTH_GUEST_SIGNUP);
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
setOnRampStep(OnRampStep.SETTINGS);
|
|
48
|
+
setStep(ModalStep.ADD_FUNDS_BUY);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const handleSellClick = () => {
|
|
52
|
+
if (isGuestMode) {
|
|
53
|
+
setGuestAddFundsTab(EnabledFlow.WITHDRAW);
|
|
54
|
+
setStep(ModalStep.AUTH_GUEST_SIGNUP);
|
|
55
|
+
} else {
|
|
56
|
+
setOnRampStep(OnRampStep.SETTINGS);
|
|
57
|
+
setStep(ModalStep.ADD_FUNDS_WITHDRAW);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const handleProfileClick = () => {
|
|
61
|
+
setStep(ModalStep.ACCOUNT_PROFILE);
|
|
62
|
+
};
|
|
63
|
+
const handleDisconnectClick = () => __async(void 0, null, function* () {
|
|
64
|
+
setIsDisconnecting(true);
|
|
65
|
+
yield para.logout();
|
|
66
|
+
yield disconnectExternalWallet();
|
|
67
|
+
onClose();
|
|
68
|
+
setStep(ModalStep.AUTH_MAIN);
|
|
69
|
+
setFlow(void 0);
|
|
70
|
+
setIsDisconnecting(false);
|
|
71
|
+
});
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
setGuestAddFundsTab();
|
|
74
|
+
}, []);
|
|
75
|
+
return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
76
|
+
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) }) }),
|
|
77
|
+
isGuestMode && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
78
|
+
balance && parseFloat(balance) > 0 && /* @__PURE__ */ jsxs(Alert, { children: [
|
|
79
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "alertTriangle", size: "24px", style: { color: "var(--cpsl-color-utility-yellow)" } }),
|
|
80
|
+
"You've funded this account - complete account setup to maintain access."
|
|
81
|
+
] }),
|
|
82
|
+
/* @__PURE__ */ jsxs(
|
|
83
|
+
CpslButton,
|
|
84
|
+
{
|
|
85
|
+
fullWidth: true,
|
|
86
|
+
variant: "primary",
|
|
87
|
+
onClick: () => {
|
|
88
|
+
setStep(ModalStep.AUTH_GUEST_SIGNUP);
|
|
89
|
+
},
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "stars02" }),
|
|
92
|
+
"Complete Account Setup"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
] }),
|
|
97
|
+
/* @__PURE__ */ jsx(ButtonContainer, { children: isOnRampLoaded ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
98
|
+
onRampConfig.isBuyEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "creditCard", onClick: handleBuyClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Receive" }) }),
|
|
99
|
+
onRampConfig.isWithdrawEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "arrowCircleBrokenDownLeft", onClick: handleSellClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Withdraw" }) }),
|
|
100
|
+
/* @__PURE__ */ jsx(OptionButton, { icon: "user", onClick: handleProfileClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: isEnabled ? "Profile" : "Settings" }) })
|
|
101
|
+
] }) : /* @__PURE__ */ jsx(CpslSpinner, {}) }),
|
|
102
|
+
!isGuestMode && /* @__PURE__ */ jsx(DisconnectButton, { variant: "destructive", fullWidth: true, onClick: handleDisconnectClick, disabled: isDisconnecting, children: isDisconnecting ? /* @__PURE__ */ jsx(CpslSpinner, { size: 16 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
103
|
+
hideWallets ? "Logout" : "Disconnect Wallet",
|
|
104
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "logOut", slot: "end" })
|
|
105
|
+
] }) })
|
|
106
|
+
] }) });
|
|
107
|
+
};
|
|
108
|
+
const ButtonContainer = safeStyled.div`
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
gap: 8px;
|
|
113
|
+
width: 100%;
|
|
114
|
+
height: 88px;
|
|
115
|
+
`;
|
|
116
|
+
const OptionButton = safeStyled(StyledCpslTileButton)`
|
|
117
|
+
flex: 1;
|
|
118
|
+
|
|
119
|
+
--button-icon-color: var(--cpsl-color-text-primary);
|
|
120
|
+
`;
|
|
121
|
+
const DisconnectButton = safeStyled(CpslButton)`
|
|
122
|
+
--button-border-width: 0px;
|
|
123
|
+
`;
|
|
124
|
+
const BalanceContainer = safeStyled.div`
|
|
125
|
+
display: flex;
|
|
126
|
+
justify-content: center;
|
|
127
|
+
align-items: center;
|
|
128
|
+
padding-top: 8px;
|
|
129
|
+
padding-bottom: 24px;
|
|
130
|
+
`;
|
|
131
|
+
const Alert = safeStyled.div`
|
|
132
|
+
--icon-color: var(--cpsl-color-utility-yellow);
|
|
133
|
+
--icon-stroke-color: var(--cpsl-color-utility-yellow);
|
|
134
|
+
--icon-fill-color: var(--cpsl-color-utility-yellow);
|
|
135
|
+
|
|
136
|
+
display: flex;
|
|
137
|
+
padding: 8px;
|
|
138
|
+
align-items: flex-start;
|
|
139
|
+
gap: 8px;
|
|
140
|
+
align-self: stretch;
|
|
141
|
+
border-radius: var(--cpsl-border-radius-alert);
|
|
142
|
+
border: 1px solid var(--cpsl-color-utility-yellow);
|
|
143
|
+
background: var(--cpsl-color-utility-yellow-light);
|
|
144
|
+
font-size: 14px;
|
|
145
|
+
`;
|
|
146
|
+
export {
|
|
147
|
+
Account
|
|
148
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AccountProfile: () => import("react/jsx-runtime").JSX.Element | null;
|