@getpara/react-sdk 2.0.0-dev.3 → 2.0.0-dev.4
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/cosmos/actions/getCosmjsAminoSigner.d.ts +8 -0
- package/dist/cosmos/actions/getCosmjsAminoSigner.js +16 -0
- package/dist/cosmos/actions/getCosmjsProtoSigner.d.ts +8 -0
- package/dist/cosmos/actions/getCosmjsProtoSigner.js +16 -0
- package/dist/cosmos/actions/index.d.ts +2 -0
- package/dist/cosmos/actions/index.js +3 -0
- package/dist/cosmos/hooks/index.d.ts +2 -0
- package/dist/cosmos/hooks/index.js +3 -0
- package/dist/cosmos/hooks/useCosmjsAminoSigner.d.ts +11 -0
- package/dist/cosmos/hooks/useCosmjsAminoSigner.js +37 -0
- package/dist/cosmos/hooks/useCosmjsProtoSigner.d.ts +11 -0
- package/dist/cosmos/hooks/useCosmjsProtoSigner.js +37 -0
- package/dist/cosmos/index.d.ts +2 -0
- package/dist/cosmos/index.js +3 -0
- package/dist/evm/actions/getViemAccount.d.ts +22 -0
- package/dist/evm/actions/getViemAccount.js +20 -0
- package/dist/evm/actions/getViemClient.d.ts +7659 -0
- package/dist/evm/actions/getViemClient.js +25 -0
- package/dist/evm/actions/index.d.ts +2 -0
- package/dist/evm/actions/index.js +3 -0
- package/dist/evm/hooks/index.d.ts +2 -0
- package/dist/evm/hooks/index.js +3 -0
- package/dist/evm/hooks/useViemAccount.d.ts +26 -0
- package/dist/evm/hooks/useViemAccount.js +32 -0
- package/dist/evm/hooks/useViemClient.d.ts +7663 -0
- package/dist/evm/hooks/useViemClient.js +30 -0
- package/dist/evm/index.d.ts +2 -0
- package/dist/evm/index.js +3 -0
- package/dist/index.d.ts +3 -5
- package/dist/index.js +4 -4
- package/dist/provider/ParaProvider.d.ts +1 -2
- package/dist/provider/ParaProvider.js +13 -106
- package/dist/solana/actions/getSolanaSigner.d.ts +8 -0
- package/dist/solana/actions/getSolanaSigner.js +15 -0
- package/dist/solana/actions/index.d.ts +1 -0
- package/dist/solana/actions/index.js +2 -0
- package/dist/solana/hooks/index.d.ts +1 -0
- package/dist/solana/hooks/index.js +2 -0
- package/dist/solana/hooks/useSolanaSigner.d.ts +12 -0
- package/dist/solana/hooks/useSolanaSigner.js +32 -0
- package/dist/solana/index.d.ts +2 -0
- package/dist/solana/index.js +3 -0
- package/package.json +19 -29
- package/styles.css/package.json +1 -1
- package/dist/cli/cli.mjs +0 -50
- package/dist/modal/ParaModal.d.ts +0 -2
- package/dist/modal/ParaModal.js +0 -301
- package/dist/modal/components/Account/Account.d.ts +0 -5
- package/dist/modal/components/Account/Account.js +0 -148
- package/dist/modal/components/Account/AccountProfile.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfile.js +0 -168
- package/dist/modal/components/Account/AccountProfileLink.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfileLink.js +0 -206
- package/dist/modal/components/Account/AccountProfileLinkOptions.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +0 -111
- package/dist/modal/components/Account/AccountProfileUnlink.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfileUnlink.js +0 -47
- package/dist/modal/components/AddFunds/AddFunds.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFunds.js +0 -69
- package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsAsset.js +0 -125
- package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -78
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +0 -31
- package/dist/modal/components/AddFunds/AddFundsContext.js +0 -160
- package/dist/modal/components/AddFunds/AddFundsDone.d.ts +0 -6
- package/dist/modal/components/AddFunds/AddFundsDone.js +0 -49
- package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsProvider.js +0 -109
- package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsReceive.js +0 -83
- package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsSettings.js +0 -237
- package/dist/modal/components/AddFunds/MoonPayEmbed.d.ts +0 -2
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +0 -7
- package/dist/modal/components/AddFunds/common.d.ts +0 -19
- package/dist/modal/components/AddFunds/common.js +0 -24
- package/dist/modal/components/AddFunds/index.d.ts +0 -3
- package/dist/modal/components/AddFunds/index.js +0 -4
- package/dist/modal/components/AuthInput/AuthInput.d.ts +0 -20
- package/dist/modal/components/AuthInput/AuthInput.js +0 -277
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +0 -7
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -33
- package/dist/modal/components/AuthInput/phoneMasks.d.ts +0 -247
- package/dist/modal/components/AuthInput/phoneMasks.js +0 -253
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +0 -9
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -50
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +0 -9
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -164
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +0 -9
- package/dist/modal/components/AuthOptions/AuthOptions.js +0 -85
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.d.ts +0 -1
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -18
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.d.ts +0 -1
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -10
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.d.ts +0 -1
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -18
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +0 -5
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -49
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +0 -1
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -62
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +0 -1
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -48
- package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +0 -6
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -29
- package/dist/modal/components/Body/Body.d.ts +0 -11
- package/dist/modal/components/Body/Body.js +0 -350
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +0 -1
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -95
- package/dist/modal/components/ChainSwitch/config.d.ts +0 -7
- package/dist/modal/components/ChainSwitch/config.js +0 -17
- package/dist/modal/components/Controls/Controls.d.ts +0 -5
- package/dist/modal/components/Controls/Controls.js +0 -78
- package/dist/modal/components/Controls/Selects.d.ts +0 -2
- package/dist/modal/components/Controls/Selects.js +0 -173
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +0 -1
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +0 -75
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +0 -8
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -175
- package/dist/modal/components/ExternalWalletStep/config.d.ts +0 -7
- package/dist/modal/components/ExternalWalletStep/config.js +0 -17
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +0 -1
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +0 -39
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +0 -1
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -184
- package/dist/modal/components/Footer/Footer.d.ts +0 -1
- package/dist/modal/components/Footer/Footer.js +0 -95
- package/dist/modal/components/Header/Header.d.ts +0 -1
- package/dist/modal/components/Header/Header.js +0 -43
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +0 -3
- package/dist/modal/components/Header/hooks/useStepTitle.js +0 -61
- package/dist/modal/components/Hero/Hero.d.ts +0 -1
- package/dist/modal/components/Hero/Hero.js +0 -116
- package/dist/modal/components/IFrameStep/IFrameStep.d.ts +0 -1
- package/dist/modal/components/IFrameStep/IFrameStep.js +0 -59
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +0 -5
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -44
- package/dist/modal/components/ModalContent/ModalContent.d.ts +0 -10
- package/dist/modal/components/ModalContent/ModalContent.js +0 -88
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +0 -3
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -31
- package/dist/modal/components/OAuth/OAuth.d.ts +0 -6
- package/dist/modal/components/OAuth/OAuth.js +0 -79
- package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +0 -8
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -74
- package/dist/modal/components/OnRampComponents/AddingFunds.d.ts +0 -1
- package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -23
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.d.ts +0 -9
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -77
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.d.ts +0 -6
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -107
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.d.ts +0 -5
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -132
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +0 -5
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -27
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +0 -12
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -160
- package/dist/modal/components/Waiting/Waiting.d.ts +0 -6
- package/dist/modal/components/Waiting/Waiting.js +0 -17
- package/dist/modal/components/WalletCard/PartnerIcon.d.ts +0 -6
- package/dist/modal/components/WalletCard/PartnerIcon.js +0 -34
- package/dist/modal/components/WalletCard/WalletCard.d.ts +0 -18
- package/dist/modal/components/WalletCard/WalletCard.js +0 -128
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.d.ts +0 -6
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -83
- package/dist/modal/components/common.d.ts +0 -59
- package/dist/modal/components/common.js +0 -261
- package/dist/modal/components/index.d.ts +0 -1
- package/dist/modal/components/index.js +0 -2
- package/dist/modal/constants/constants.d.ts +0 -40
- package/dist/modal/constants/constants.js +0 -142
- package/dist/modal/constants/defaults.d.ts +0 -5
- package/dist/modal/constants/defaults.js +0 -10
- package/dist/modal/constants/oAuthLogos.d.ts +0 -17
- package/dist/modal/constants/oAuthLogos.js +0 -158
- package/dist/modal/constants/walletTypeConfig.d.ts +0 -6
- package/dist/modal/constants/walletTypeConfig.js +0 -13
- package/dist/modal/hooks/useGoBack.d.ts +0 -1
- package/dist/modal/hooks/useGoBack.js +0 -43
- package/dist/modal/hooks/useTelegramLogin.d.ts +0 -12
- package/dist/modal/hooks/useTelegramLogin.js +0 -65
- package/dist/modal/index.d.ts +0 -8
- package/dist/modal/index.js +0 -29
- package/dist/modal/stores/index.d.ts +0 -1
- package/dist/modal/stores/index.js +0 -2
- package/dist/modal/stores/modal/actions.d.ts +0 -3
- package/dist/modal/stores/modal/actions.js +0 -135
- package/dist/modal/stores/modal/useModalStore.d.ts +0 -103
- package/dist/modal/stores/modal/useModalStore.js +0 -73
- package/dist/modal/types/commonTypes.d.ts +0 -6
- package/dist/modal/types/commonTypes.js +0 -1
- package/dist/modal/types/modalProps.d.ts +0 -129
- package/dist/modal/types/modalProps.js +0 -12
- package/dist/modal/utils/authInputHelpers.d.ts +0 -5
- package/dist/modal/utils/authInputHelpers.js +0 -41
- package/dist/modal/utils/authLayoutHelpers.d.ts +0 -3
- package/dist/modal/utils/authLayoutHelpers.js +0 -8
- package/dist/modal/utils/countryCodes.d.ts +0 -8
- package/dist/modal/utils/countryCodes.js +0 -45
- package/dist/modal/utils/getMailtoLink.d.ts +0 -1
- package/dist/modal/utils/getMailtoLink.js +0 -10
- package/dist/modal/utils/getTileButtonFlex.d.ts +0 -1
- package/dist/modal/utils/getTileButtonFlex.js +0 -20
- package/dist/modal/utils/getWalletDisplayName.d.ts +0 -5
- package/dist/modal/utils/getWalletDisplayName.js +0 -22
- package/dist/modal/utils/isPasskeySupported.d.ts +0 -1
- package/dist/modal/utils/isPasskeySupported.js +0 -15
- package/dist/modal/utils/openPopup.d.ts +0 -6
- package/dist/modal/utils/openPopup.js +0 -60
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +0 -1
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -31
- package/dist/modal/utils/steps.d.ts +0 -133
- package/dist/modal/utils/steps.js +0 -273
- package/dist/modal/utils/stringFormatters.d.ts +0 -5
- package/dist/modal/utils/stringFormatters.js +0 -19
- package/dist/modal/utils/validateOnRampConfig.d.ts +0 -5
- package/dist/modal/utils/validateOnRampConfig.js +0 -32
- package/dist/provider/actions/getEmbeddedAccount.d.ts +0 -26
- package/dist/provider/actions/getEmbeddedAccount.js +0 -52
- package/dist/provider/actions/getWallet.d.ts +0 -5
- package/dist/provider/actions/getWallet.js +0 -18
- package/dist/provider/actions/index.d.ts +0 -47
- package/dist/provider/actions/index.js +0 -79
- package/dist/provider/actions/utils.d.ts +0 -4
- package/dist/provider/actions/utils.js +0 -34
- package/dist/provider/components/CosmosWalletWrapper.d.ts +0 -11
- package/dist/provider/components/CosmosWalletWrapper.js +0 -43
- package/dist/provider/components/EvmWalletWrapper.d.ts +0 -12
- package/dist/provider/components/EvmWalletWrapper.js +0 -43
- package/dist/provider/components/ExternalWalletWrapper.d.ts +0 -8
- package/dist/provider/components/ExternalWalletWrapper.js +0 -140
- package/dist/provider/components/SolanaWalletWrapper.d.ts +0 -9
- package/dist/provider/components/SolanaWalletWrapper.js +0 -44
- package/dist/provider/external/getParaCosmosConnector.d.ts +0 -7
- package/dist/provider/external/getParaCosmosConnector.js +0 -19
- package/dist/provider/external/getParaCosmosLib.d.ts +0 -4
- package/dist/provider/external/getParaCosmosLib.js +0 -16
- package/dist/provider/external/getParaEvmConnector.d.ts +0 -7
- package/dist/provider/external/getParaEvmConnector.js +0 -19
- package/dist/provider/external/getParaEvmLib.d.ts +0 -4
- package/dist/provider/external/getParaEvmLib.js +0 -16
- package/dist/provider/external/getParaSolanaConnector.d.ts +0 -7
- package/dist/provider/external/getParaSolanaConnector.js +0 -19
- package/dist/provider/external/getParaSolanaLib.d.ts +0 -4
- package/dist/provider/external/getParaSolanaLib.js +0 -16
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +0 -2
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +0 -8
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +0 -2
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +0 -8
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +0 -2
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +0 -8
- package/dist/provider/hooks/index.d.ts +0 -3
- package/dist/provider/hooks/index.js +0 -4
- package/dist/provider/hooks/mutations/core.d.ts +0 -27
- package/dist/provider/hooks/mutations/core.js +0 -66
- package/dist/provider/hooks/mutations/index.d.ts +0 -3
- package/dist/provider/hooks/mutations/index.js +0 -9
- package/dist/provider/hooks/mutations/useLinkAccount.d.ts +0 -9
- package/dist/provider/hooks/mutations/useLinkAccount.js +0 -18
- package/dist/provider/hooks/mutations/utils.d.ts +0 -12
- package/dist/provider/hooks/mutations/utils.js +0 -90
- package/dist/provider/hooks/queries/core.d.ts +0 -4
- package/dist/provider/hooks/queries/core.js +0 -16
- package/dist/provider/hooks/queries/index.d.ts +0 -4
- package/dist/provider/hooks/queries/index.js +0 -11
- package/dist/provider/hooks/queries/useAccount.d.ts +0 -90
- package/dist/provider/hooks/queries/useAccount.js +0 -135
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +0 -5
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +0 -24
- package/dist/provider/hooks/queries/useWallet.d.ts +0 -5
- package/dist/provider/hooks/queries/useWallet.js +0 -26
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +0 -6
- package/dist/provider/hooks/queries/useWalletBalance.js +0 -55
- package/dist/provider/hooks/queries/utils.d.ts +0 -7
- package/dist/provider/hooks/queries/utils.js +0 -25
- package/dist/provider/hooks/utils/index.d.ts +0 -3
- package/dist/provider/hooks/utils/index.js +0 -10
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.d.ts +0 -3
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -74
- package/dist/provider/hooks/utils/useClient.d.ts +0 -5
- package/dist/provider/hooks/utils/useClient.js +0 -10
- package/dist/provider/hooks/utils/useEventListeners.d.ts +0 -2
- package/dist/provider/hooks/utils/useEventListeners.js +0 -157
- package/dist/provider/hooks/utils/useFormattedBiometricHints.d.ts +0 -4
- package/dist/provider/hooks/utils/useFormattedBiometricHints.js +0 -27
- package/dist/provider/hooks/utils/useInternalClient.d.ts +0 -5
- package/dist/provider/hooks/utils/useInternalClient.js +0 -10
- package/dist/provider/hooks/utils/useModal.d.ts +0 -11
- package/dist/provider/hooks/utils/useModal.js +0 -27
- package/dist/provider/hooks/utils/useWalletState.d.ts +0 -15
- package/dist/provider/hooks/utils/useWalletState.js +0 -48
- package/dist/provider/index.d.ts +0 -6
- package/dist/provider/index.js +0 -11
- package/dist/provider/providers/AccountLinkProvider.d.ts +0 -47
- package/dist/provider/providers/AccountLinkProvider.js +0 -452
- package/dist/provider/providers/AuthProvider.d.ts +0 -37
- package/dist/provider/providers/AuthProvider.js +0 -523
- package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +0 -7
- package/dist/provider/providers/CosmosExternalWalletProvider.js +0 -66
- package/dist/provider/providers/EvmExternalWalletProvider.d.ts +0 -7
- package/dist/provider/providers/EvmExternalWalletProvider.js +0 -74
- package/dist/provider/providers/ExternalWalletProvider.d.ts +0 -59
- package/dist/provider/providers/ExternalWalletProvider.js +0 -596
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +0 -7
- package/dist/provider/providers/SolanaExternalWalletProvider.js +0 -66
- package/dist/provider/stores/getters.d.ts +0 -4
- package/dist/provider/stores/getters.js +0 -13
- package/dist/provider/stores/setters.d.ts +0 -1
- package/dist/provider/stores/setters.js +0 -7
- package/dist/provider/stores/slices/analytics.d.ts +0 -3
- package/dist/provider/stores/slices/analytics.js +0 -9
- package/dist/provider/stores/slices/client.d.ts +0 -3
- package/dist/provider/stores/slices/client.js +0 -9
- package/dist/provider/stores/slices/config.d.ts +0 -3
- package/dist/provider/stores/slices/config.js +0 -9
- package/dist/provider/stores/slices/externalWallets.d.ts +0 -3
- package/dist/provider/stores/slices/externalWallets.js +0 -46
- package/dist/provider/stores/slices/index.d.ts +0 -5
- package/dist/provider/stores/slices/index.js +0 -6
- package/dist/provider/stores/slices/modal.d.ts +0 -3
- package/dist/provider/stores/slices/modal.js +0 -18
- package/dist/provider/stores/slices/wallet.d.ts +0 -3
- package/dist/provider/stores/slices/wallet.js +0 -13
- package/dist/provider/stores/types.d.ts +0 -76
- package/dist/provider/stores/types.js +0 -1
- package/dist/provider/stores/useStore.d.ts +0 -17
- package/dist/provider/stores/useStore.js +0 -34
- package/dist/provider/types/externalWalletProviders.d.ts +0 -12
- package/dist/provider/types/externalWalletProviders.js +0 -1
- package/dist/provider/types/provider.d.ts +0 -161
- package/dist/provider/types/provider.js +0 -1
- package/dist/provider/types/query.d.ts +0 -3
- package/dist/provider/types/query.js +0 -1
- package/dist/provider/types/utils.d.ts +0 -45
- package/dist/provider/types/utils.js +0 -1
- package/dist/provider/utils/constants.d.ts +0 -5
- package/dist/provider/utils/constants.js +0 -10
- package/dist/provider/utils/paraConfigTypeGuards.d.ts +0 -7
- package/dist/provider/utils/paraConfigTypeGuards.js +0 -13
- package/dist/provider/utils/renameMutations.d.ts +0 -5
- package/dist/provider/utils/renameMutations.js +0 -18
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__spreadProps,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { useEffect, useMemo, useState } from "react";
|
|
8
|
-
import { useAddFunds } from "./AddFundsContext.js";
|
|
9
|
-
import { CpslButton, CpslIcon, CpslInput, CpslRow, CpslText } from "@getpara/react-components";
|
|
10
|
-
import { AssetIcon, HeaderSelect, HeaderSelectContainer, HeaderSelectItem, NetworkIcon } from "../common.js";
|
|
11
|
-
import { getAssetCode, getNetworkName } from "../../constants/constants.js";
|
|
12
|
-
import { EnabledFlow, getOnRampNetworks, OnRampPurchaseType } from "@getpara/web-sdk";
|
|
13
|
-
import { OnRampStep, useModalStore } from "../../stores/index.js";
|
|
14
|
-
import { useStore } from "../../../provider/stores/useStore.js";
|
|
15
|
-
import { safeStyled } from "@getpara/react-common";
|
|
16
|
-
import { contentMotionProps, NoProviders } from "./common.js";
|
|
17
|
-
import { AnimatePresence, motion, useIsPresent } from "framer-motion";
|
|
18
|
-
import { AddFundsAsset } from "./AddFundsAsset.js";
|
|
19
|
-
function NetworkPill({
|
|
20
|
-
network,
|
|
21
|
-
gap = "4px",
|
|
22
|
-
slot,
|
|
23
|
-
start,
|
|
24
|
-
fix = false
|
|
25
|
-
}) {
|
|
26
|
-
return /* @__PURE__ */ jsxs(CpslRow, __spreadProps(__spreadValues({ gap }, slot ? { slot } : {}), { children: [
|
|
27
|
-
start,
|
|
28
|
-
/* @__PURE__ */ jsx(NetworkIcon, { network, size: "24px" }),
|
|
29
|
-
/* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "contrast", style: fix ? { marginRight: "8px" } : void 0, children: getNetworkName(network) })
|
|
30
|
-
] }));
|
|
31
|
-
}
|
|
32
|
-
function AssetPill({ asset, gap = "4px", slot, fix }) {
|
|
33
|
-
if (!asset) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
return /* @__PURE__ */ jsxs(CpslRow, __spreadProps(__spreadValues({ gap }, slot ? { slot } : {}), { children: [
|
|
37
|
-
/* @__PURE__ */ jsx(AssetIcon, { asset, size: "24px" }),
|
|
38
|
-
/* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "contrast", style: fix ? { marginRight: "8px" } : void 0, children: getAssetCode(asset) })
|
|
39
|
-
] }));
|
|
40
|
-
}
|
|
41
|
-
const NetworkLabel = /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", style: { margin: "0 8px" }, children: "Network" });
|
|
42
|
-
function AddFundsSettings() {
|
|
43
|
-
const isPresent = useIsPresent();
|
|
44
|
-
const hideWallets = useStore((state) => {
|
|
45
|
-
var _a;
|
|
46
|
-
return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
|
|
47
|
-
});
|
|
48
|
-
const setOnRampStep = useModalStore((state) => state.setOnRampStep);
|
|
49
|
-
const {
|
|
50
|
-
assets,
|
|
51
|
-
networks,
|
|
52
|
-
asset,
|
|
53
|
-
setAsset,
|
|
54
|
-
network,
|
|
55
|
-
setNetwork,
|
|
56
|
-
fiatQuantity,
|
|
57
|
-
setFiatQuantity,
|
|
58
|
-
onRampConfig,
|
|
59
|
-
activeWallet,
|
|
60
|
-
isProviderAllowed,
|
|
61
|
-
tab
|
|
62
|
-
} = useAddFunds();
|
|
63
|
-
const [value, setValue] = useState(parseFloat(fiatQuantity || "25.00").toFixed(2));
|
|
64
|
-
const narrowedNetworks = useMemo(() => {
|
|
65
|
-
return !asset ? networks : getOnRampNetworks(onRampConfig.assetInfo, {
|
|
66
|
-
walletType: activeWallet == null ? void 0 : activeWallet.type,
|
|
67
|
-
allowed: onRampConfig.allowedAssets ? Object.entries(onRampConfig.allowedAssets).filter(([_, value2]) => value2 === true || value2.includes(asset)).map(([key]) => key) : void 0,
|
|
68
|
-
assets: [asset],
|
|
69
|
-
providers: onRampConfig.providers,
|
|
70
|
-
action: tab === EnabledFlow.BUY ? OnRampPurchaseType.BUY : OnRampPurchaseType.SELL
|
|
71
|
-
});
|
|
72
|
-
}, [networks, network, asset, activeWallet == null ? void 0 : activeWallet.type, onRampConfig.providers, tab]);
|
|
73
|
-
const content = useMemo(() => {
|
|
74
|
-
if (!!asset && Object.values(isProviderAllowed).every((v) => !v) || assets.length === 0) {
|
|
75
|
-
return /* @__PURE__ */ jsx(Container, __spreadProps(__spreadValues({}, contentMotionProps), { isPresent, children: /* @__PURE__ */ jsxs(NoProviders, { isHidden: Object.values(isProviderAllowed).some((v) => !!v), variant: "bodyM", children: [
|
|
76
|
-
"No providers are available for this ",
|
|
77
|
-
hideWallets ? "account" : "wallet"
|
|
78
|
-
] }) }), "noProviders");
|
|
79
|
-
}
|
|
80
|
-
return !!asset ? /* @__PURE__ */ jsx(Container, __spreadProps(__spreadValues({}, contentMotionProps), { isPresent, children: assets.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
81
|
-
/* @__PURE__ */ jsxs(CpslRow, { children: [
|
|
82
|
-
/* @__PURE__ */ jsx(HeaderSelectContainer, { children: assets.length > 1 ? /* @__PURE__ */ jsxs(
|
|
83
|
-
HeaderSelect,
|
|
84
|
-
{
|
|
85
|
-
selectedValue: asset,
|
|
86
|
-
onCpslSelectValueChange: (e) => {
|
|
87
|
-
setAsset(e.detail);
|
|
88
|
-
},
|
|
89
|
-
showFormattedSelectedItem: true,
|
|
90
|
-
placeholder: "Choose asset...",
|
|
91
|
-
anchorElId: "inputContainer",
|
|
92
|
-
$width: 160,
|
|
93
|
-
autoWidth: true,
|
|
94
|
-
selectedItemVariant: "bodyXS",
|
|
95
|
-
children: [
|
|
96
|
-
asset && /* @__PURE__ */ jsx(AssetPill, { asset, slot: "selected-item" }),
|
|
97
|
-
assets.map((a) => /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: a, children: /* @__PURE__ */ jsx(AssetPill, { gap: "8px", asset: a }) }, a))
|
|
98
|
-
]
|
|
99
|
-
}
|
|
100
|
-
) : /* @__PURE__ */ jsx(AssetPill, { asset, fix: true }) }),
|
|
101
|
-
/* @__PURE__ */ jsx(HeaderSelectContainer, { children: narrowedNetworks.length > 1 ? /* @__PURE__ */ jsxs(
|
|
102
|
-
HeaderSelect,
|
|
103
|
-
{
|
|
104
|
-
selectedValue: network,
|
|
105
|
-
onCpslSelectValueChange: (e) => {
|
|
106
|
-
setNetwork(e.detail);
|
|
107
|
-
},
|
|
108
|
-
showFormattedSelectedItem: true,
|
|
109
|
-
placeholder: "Choose network...",
|
|
110
|
-
$width: 160,
|
|
111
|
-
autoWidth: true,
|
|
112
|
-
selectedItemVariant: "bodyXS",
|
|
113
|
-
children: [
|
|
114
|
-
network && /* @__PURE__ */ jsx(NetworkPill, { network, start: NetworkLabel, slot: "selected-item" }),
|
|
115
|
-
narrowedNetworks.map((n) => /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: n, children: /* @__PURE__ */ jsx(NetworkPill, { gap: "8px", network: n }) }, n))
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
) : network ? /* @__PURE__ */ jsx(NetworkPill, { network, start: NetworkLabel, fix: true }) : null })
|
|
119
|
-
] }),
|
|
120
|
-
/* @__PURE__ */ jsxs(CpslRow, { col: true, gap: "16px", children: [
|
|
121
|
-
/* @__PURE__ */ jsx(
|
|
122
|
-
Input,
|
|
123
|
-
{
|
|
124
|
-
value: value || "",
|
|
125
|
-
fitContent: true,
|
|
126
|
-
autoselect: true,
|
|
127
|
-
onKeyDown: (e) => {
|
|
128
|
-
if (!/^(\d|\.)$/.test(e.key) && !["Delete", "Backspace", "Tab", "Shift"].includes(e.key)) {
|
|
129
|
-
e.preventDefault();
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
onChange: (e) => {
|
|
133
|
-
var _a;
|
|
134
|
-
const numericValue = (((_a = e.currentTarget) == null ? void 0 : _a.value) || "").replace(/[^0-9.]/g, "");
|
|
135
|
-
if (numericValue !== "") {
|
|
136
|
-
const formattedValue = parseFloat(numericValue).toFixed(2);
|
|
137
|
-
setValue(formattedValue);
|
|
138
|
-
} else {
|
|
139
|
-
setValue(null);
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
onBlur: (e) => {
|
|
143
|
-
const numericValue = (e.currentTarget.value || "").replace(/[^0-9.]/g, "");
|
|
144
|
-
if (numericValue === "") {
|
|
145
|
-
setValue(null);
|
|
146
|
-
} else {
|
|
147
|
-
setValue(parseFloat(numericValue).toFixed(2));
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
placeholder: "0",
|
|
151
|
-
children: /* @__PURE__ */ jsx(CurrencySign, { slot: "start", children: "$" })
|
|
152
|
-
},
|
|
153
|
-
value || ""
|
|
154
|
-
),
|
|
155
|
-
/* @__PURE__ */ jsx(CpslRow, { style: { width: "100%" }, children: ["25", "50", "100"].map((quantity) => {
|
|
156
|
-
return /* @__PURE__ */ jsxs(PresetButton, { fullWidth: true, variant: "secondary", onClick: () => setValue(`${quantity}.00`), children: [
|
|
157
|
-
"$",
|
|
158
|
-
quantity
|
|
159
|
-
] }, quantity);
|
|
160
|
-
}) })
|
|
161
|
-
] }),
|
|
162
|
-
/* @__PURE__ */ jsxs(
|
|
163
|
-
CpslButton,
|
|
164
|
-
{
|
|
165
|
-
fullWidth: true,
|
|
166
|
-
disabled: value === "",
|
|
167
|
-
onClick: () => {
|
|
168
|
-
setFiatQuantity(value != null ? value : void 0);
|
|
169
|
-
setOnRampStep(OnRampStep.PROVIDER);
|
|
170
|
-
},
|
|
171
|
-
children: [
|
|
172
|
-
"Continue",
|
|
173
|
-
/* @__PURE__ */ jsx(CpslIcon, { icon: "arrow" })
|
|
174
|
-
]
|
|
175
|
-
}
|
|
176
|
-
)
|
|
177
|
-
] }) }), "quantity") : /* @__PURE__ */ jsx(AssetContainer, __spreadProps(__spreadValues({}, contentMotionProps), { isPresent, children: /* @__PURE__ */ jsx(AddFundsAsset, {}) }), "asset");
|
|
178
|
-
}, [asset, network, assets, narrowedNetworks, isProviderAllowed, isPresent, value]);
|
|
179
|
-
useEffect(() => {
|
|
180
|
-
if (!network || !narrowedNetworks.includes(network)) {
|
|
181
|
-
setNetwork(narrowedNetworks[0]);
|
|
182
|
-
}
|
|
183
|
-
}, [narrowedNetworks, network, tab]);
|
|
184
|
-
useEffect(() => {
|
|
185
|
-
if (!!asset && !assets.includes(asset)) {
|
|
186
|
-
setAsset(assets[0]);
|
|
187
|
-
}
|
|
188
|
-
}, [assets, asset, tab]);
|
|
189
|
-
return /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: content });
|
|
190
|
-
}
|
|
191
|
-
const Container = safeStyled(motion.div)`
|
|
192
|
-
width: 100%;
|
|
193
|
-
height: 100%;
|
|
194
|
-
align-self: center;
|
|
195
|
-
display: flex;
|
|
196
|
-
flex-direction: column;
|
|
197
|
-
align-items: center;
|
|
198
|
-
gap: 32px;
|
|
199
|
-
position: relative;
|
|
200
|
-
height: 320px;
|
|
201
|
-
${({ isPresent }) => isPresent ? "transform: none !important;" : ""};
|
|
202
|
-
|
|
203
|
-
& > * {
|
|
204
|
-
width: 100%;
|
|
205
|
-
}
|
|
206
|
-
`;
|
|
207
|
-
const AssetContainer = safeStyled(Container)`
|
|
208
|
-
gap: 8px;
|
|
209
|
-
`;
|
|
210
|
-
const CurrencySign = safeStyled.div`
|
|
211
|
-
font-size: 72px;
|
|
212
|
-
color: var(--cpsl-color-text-primary);
|
|
213
|
-
position: relative;
|
|
214
|
-
right: -16px;
|
|
215
|
-
`;
|
|
216
|
-
const PresetButton = safeStyled(CpslButton)`
|
|
217
|
-
--button-color: var(--cpsl-color-text-contrast);
|
|
218
|
-
--button-font-size: 24px;
|
|
219
|
-
--button-secondary-background-color: var(--cpsl-color-background-8);
|
|
220
|
-
--button-secondary-border-color: var(--cpsl-color-background-8);
|
|
221
|
-
--button-secondary-hover-color: var(--cpsl-color-text-contrast);
|
|
222
|
-
--button-secondary-hover-background-color: var(--cpsl-color-background-16);
|
|
223
|
-
--button-secondary-hover-border-color: var(--cpsl-color-background-16);
|
|
224
|
-
flex: 1;
|
|
225
|
-
`;
|
|
226
|
-
const Input = safeStyled(CpslInput)`
|
|
227
|
-
--container-background-color: transparent;
|
|
228
|
-
--container-height: 90px;
|
|
229
|
-
--container-border-width: 0;
|
|
230
|
-
--input-background-color: transparent;
|
|
231
|
-
--input-font-size: 72px;
|
|
232
|
-
--input-text-align: center;
|
|
233
|
-
--input-width: 100%;
|
|
234
|
-
`;
|
|
235
|
-
export {
|
|
236
|
-
AddFundsSettings
|
|
237
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const contentMotionProps: {
|
|
2
|
-
transition: {
|
|
3
|
-
duration: number;
|
|
4
|
-
};
|
|
5
|
-
initial: {
|
|
6
|
-
opacity: number;
|
|
7
|
-
};
|
|
8
|
-
animate: {
|
|
9
|
-
opacity: number;
|
|
10
|
-
};
|
|
11
|
-
exit: {
|
|
12
|
-
opacity: number;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
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?: ((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
|
-
}, {
|
|
18
|
-
isHidden?: boolean;
|
|
19
|
-
}>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { CpslText } from "@getpara/react-components";
|
|
4
|
-
import { safeStyled } from "@getpara/react-common";
|
|
5
|
-
const contentMotionProps = {
|
|
6
|
-
transition: { duration: 0.2 },
|
|
7
|
-
initial: { opacity: 0 },
|
|
8
|
-
animate: { opacity: 1 },
|
|
9
|
-
exit: { opacity: 0 }
|
|
10
|
-
};
|
|
11
|
-
const NoProviders = safeStyled(CpslText)`
|
|
12
|
-
width: 100%;
|
|
13
|
-
text-align: center;
|
|
14
|
-
visibility: ${({ isHidden }) => isHidden ? "hidden" : "visible"};
|
|
15
|
-
position: absolute;
|
|
16
|
-
top: 0;
|
|
17
|
-
left: 0;
|
|
18
|
-
right: 0;
|
|
19
|
-
transition: visibility 0.2s;
|
|
20
|
-
`;
|
|
21
|
-
export {
|
|
22
|
-
NoProviders,
|
|
23
|
-
contentMotionProps
|
|
24
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { Auth } from '@getpara/user-management-client';
|
|
3
|
-
type ChildProps = {
|
|
4
|
-
isPending: boolean;
|
|
5
|
-
isSubmitting: boolean;
|
|
6
|
-
onSubmit: () => void;
|
|
7
|
-
};
|
|
8
|
-
type AuthInputProps = {
|
|
9
|
-
defaultAuth?: Auth<'email' | 'phone'>;
|
|
10
|
-
onSubmit: (_: Auth<'email' | 'phone'>) => void;
|
|
11
|
-
isSubmitting: boolean;
|
|
12
|
-
disableEmailLogin?: boolean;
|
|
13
|
-
disablePhoneLogin?: boolean;
|
|
14
|
-
disableSubmitButton?: boolean;
|
|
15
|
-
children?: (_: ChildProps) => ReactNode;
|
|
16
|
-
error?: string | null;
|
|
17
|
-
sticky?: boolean;
|
|
18
|
-
};
|
|
19
|
-
export declare const AuthInput: ({ defaultAuth, disableEmailLogin, disablePhoneLogin, onSubmit: _onSubmit, isSubmitting, disableSubmitButton, children: Children, error: propsError, sticky, }: AuthInputProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
-
export {};
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
7
|
-
CpslButton,
|
|
8
|
-
CpslIcon,
|
|
9
|
-
CpslInput,
|
|
10
|
-
CpslSelect,
|
|
11
|
-
CpslSelectItem,
|
|
12
|
-
CpslSpinner,
|
|
13
|
-
CpslText
|
|
14
|
-
} from "@getpara/react-components";
|
|
15
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
16
|
-
import { safeStyled } from "@getpara/react-common";
|
|
17
|
-
import countryCodes from "../../utils/countryCodes.js";
|
|
18
|
-
import { MOBILE_SIZE } from "../../constants/constants.js";
|
|
19
|
-
import { useDropdownPosition } from "./hooks/useDropdownPosition.js";
|
|
20
|
-
import { defaultPhoneMask, phoneMasks } from "./phoneMasks.js";
|
|
21
|
-
import { extractAuthInfo } from "@getpara/user-management-client";
|
|
22
|
-
import parsePhoneNumberFromString from "libphonenumber-js";
|
|
23
|
-
import { isCcMatch, validateInput } from "../../utils/authInputHelpers.js";
|
|
24
|
-
const DEFAULT_COUNTRY = { label: "United States", value: "+1", selectedLabel: "US", icon: "US" };
|
|
25
|
-
const AuthInput = ({
|
|
26
|
-
defaultAuth,
|
|
27
|
-
disableEmailLogin,
|
|
28
|
-
disablePhoneLogin,
|
|
29
|
-
onSubmit: _onSubmit,
|
|
30
|
-
isSubmitting,
|
|
31
|
-
disableSubmitButton,
|
|
32
|
-
children: Children,
|
|
33
|
-
error: propsError,
|
|
34
|
-
sticky = false
|
|
35
|
-
}) => {
|
|
36
|
-
var _a, _b, _c;
|
|
37
|
-
const inputRef = useRef(null);
|
|
38
|
-
const { dropdownMaxHeight, dropdownWidth } = useDropdownPosition(inputRef);
|
|
39
|
-
const [authInfo, storedNationalNumber, storedCountryCode] = useMemo(() => {
|
|
40
|
-
if (!defaultAuth) {
|
|
41
|
-
return [void 0, void 0, void 0];
|
|
42
|
-
}
|
|
43
|
-
const authInfo2 = extractAuthInfo(defaultAuth);
|
|
44
|
-
if (!authInfo2 || (authInfo2 == null ? void 0 : authInfo2.authType) !== "phone") {
|
|
45
|
-
return [authInfo2, void 0, void 0];
|
|
46
|
-
}
|
|
47
|
-
const parsed = parsePhoneNumberFromString(authInfo2.identifier);
|
|
48
|
-
return [authInfo2, parsed == null ? void 0 : parsed.nationalNumber, parsed == null ? void 0 : parsed.countryCallingCode];
|
|
49
|
-
}, [defaultAuth]);
|
|
50
|
-
const [countryCode, setCountryCode] = useState(storedCountryCode != null ? storedCountryCode : "+1");
|
|
51
|
-
const [identifier, setIdentifier] = useState(
|
|
52
|
-
(() => {
|
|
53
|
-
if (!(authInfo == null ? void 0 : authInfo.authType) || ["telegram", "farcaster", "externalWallet"].includes(authInfo == null ? void 0 : authInfo.authType)) {
|
|
54
|
-
return "";
|
|
55
|
-
}
|
|
56
|
-
if (authInfo.authType !== "phone") {
|
|
57
|
-
return authInfo.identifier;
|
|
58
|
-
}
|
|
59
|
-
return storedNationalNumber != null ? storedNationalNumber : "";
|
|
60
|
-
})()
|
|
61
|
-
);
|
|
62
|
-
const [identifierType, setIdentifierType] = useState(
|
|
63
|
-
authInfo && (authInfo.authType === "email" || authInfo.authType === "phone") ? authInfo.authType : void 0
|
|
64
|
-
);
|
|
65
|
-
const [matchedCountryCode, setMatchedCountryCode] = useState(
|
|
66
|
-
(_a = countryCodes.find((option) => isCcMatch(countryCode, option))) != null ? _a : DEFAULT_COUNTRY
|
|
67
|
-
);
|
|
68
|
-
const [error, setError] = useState(propsError || void 0);
|
|
69
|
-
const [isPending, setIsPending] = useState(isSubmitting || false);
|
|
70
|
-
const [search, setSearch] = useState("");
|
|
71
|
-
const setCountryCodes = (countyCodeInput) => {
|
|
72
|
-
setCountryCode(countyCodeInput.value);
|
|
73
|
-
setMatchedCountryCode(countyCodeInput);
|
|
74
|
-
};
|
|
75
|
-
const isEmail = identifierType === "email";
|
|
76
|
-
const isPhone = identifierType === "phone";
|
|
77
|
-
const isUnknown = !identifierType;
|
|
78
|
-
const filteredCountryCodes = search ? countryCodes.filter(
|
|
79
|
-
(cc) => cc.selectedLabel.toLowerCase().includes(search.toLowerCase()) || cc.label.toLowerCase().includes(search.toLowerCase()) || cc.value.toLowerCase().includes(search.toLowerCase())
|
|
80
|
-
) : countryCodes;
|
|
81
|
-
const handleSearchInput = (ev) => {
|
|
82
|
-
setSearch(ev.detail);
|
|
83
|
-
};
|
|
84
|
-
const handleIdentifierInput = (ev) => {
|
|
85
|
-
var _a2;
|
|
86
|
-
if (!sticky) {
|
|
87
|
-
setError(void 0);
|
|
88
|
-
}
|
|
89
|
-
const newIdentifier = (_a2 = ev.detail.value) != null ? _a2 : "";
|
|
90
|
-
let isNewPhone = false, isNewEmail = false;
|
|
91
|
-
if (!disablePhoneLogin) {
|
|
92
|
-
const countryCodeInputMatch = countryCodes.find((option) => isCcMatch(newIdentifier, option));
|
|
93
|
-
if (countryCodeInputMatch) {
|
|
94
|
-
setCountryCodes(countryCodeInputMatch);
|
|
95
|
-
setIdentifierType("phone");
|
|
96
|
-
setIdentifier("");
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
isNewPhone = !isEmail && isPhone ? /\d+$/.test(newIdentifier) : /\d\d\d+$/.test(newIdentifier);
|
|
100
|
-
}
|
|
101
|
-
if (!disableEmailLogin) {
|
|
102
|
-
isNewEmail = /\D.*$/.test(newIdentifier);
|
|
103
|
-
}
|
|
104
|
-
setIdentifierType(isNewEmail ? "email" : isNewPhone ? "phone" : void 0);
|
|
105
|
-
setIdentifier(newIdentifier);
|
|
106
|
-
};
|
|
107
|
-
const handleCountryCodeInput = (ev) => {
|
|
108
|
-
const matchedCountryCode2 = countryCodes.find((code) => code.selectedLabel === ev.detail);
|
|
109
|
-
if (matchedCountryCode2) {
|
|
110
|
-
setCountryCodes(matchedCountryCode2);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
const onSubmit = () => __async(void 0, null, function* () {
|
|
114
|
-
setError(void 0);
|
|
115
|
-
try {
|
|
116
|
-
const auth = validateInput(identifier, countryCode, identifierType);
|
|
117
|
-
_onSubmit(auth);
|
|
118
|
-
} catch (err) {
|
|
119
|
-
setError(err.message);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
useEffect(() => {
|
|
123
|
-
setIsPending(isSubmitting);
|
|
124
|
-
}, [isSubmitting]);
|
|
125
|
-
useEffect(() => {
|
|
126
|
-
if (propsError === null || propsError === void 0 && !sticky) {
|
|
127
|
-
setError(void 0);
|
|
128
|
-
}
|
|
129
|
-
if (propsError) {
|
|
130
|
-
setError(propsError);
|
|
131
|
-
setIsPending(false);
|
|
132
|
-
}
|
|
133
|
-
}, [propsError, sticky]);
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
if (!sticky || isSubmitting) {
|
|
136
|
-
setIsPending(isSubmitting);
|
|
137
|
-
}
|
|
138
|
-
}, [error]);
|
|
139
|
-
if (disableEmailLogin && disablePhoneLogin) {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
return /* @__PURE__ */ jsxs(
|
|
143
|
-
"form",
|
|
144
|
-
{
|
|
145
|
-
onSubmit: (e) => __async(void 0, null, function* () {
|
|
146
|
-
e.preventDefault();
|
|
147
|
-
onSubmit();
|
|
148
|
-
}),
|
|
149
|
-
style: { width: "100%" },
|
|
150
|
-
children: [
|
|
151
|
-
/* @__PURE__ */ jsxs(
|
|
152
|
-
StyledInput,
|
|
153
|
-
{
|
|
154
|
-
ref: inputRef,
|
|
155
|
-
id: "authInput",
|
|
156
|
-
placeholder: isEmail || disablePhoneLogin ? "Enter email" : isPhone || disableEmailLogin ? "Enter phone" : "Enter email or phone",
|
|
157
|
-
onCpslInput: handleIdentifierInput,
|
|
158
|
-
value: identifier,
|
|
159
|
-
errorText: error,
|
|
160
|
-
autofocus: true,
|
|
161
|
-
inputMode: "email",
|
|
162
|
-
onKeyDown: (e) => __async(void 0, null, function* () {
|
|
163
|
-
return e.key === "Enter" && onSubmit();
|
|
164
|
-
}),
|
|
165
|
-
contrastText: true,
|
|
166
|
-
isPhone,
|
|
167
|
-
mask: identifierType === "phone" ? (_c = phoneMasks[(_b = matchedCountryCode.selectedLabel) != null ? _b : ""]) != null ? _c : defaultPhoneMask : void 0,
|
|
168
|
-
enterkeyhint: "go",
|
|
169
|
-
noAutoDisable: true,
|
|
170
|
-
disabled: isPending,
|
|
171
|
-
"data-testid": "auth-input",
|
|
172
|
-
children: [
|
|
173
|
-
/* @__PURE__ */ jsxs(IconContainer, { slot: "start", children: [
|
|
174
|
-
!disableEmailLogin && (isUnknown || isEmail) && /* @__PURE__ */ jsx(CpslIcon, { "aria-label": "email", icon: "mail" }),
|
|
175
|
-
!disablePhoneLogin && isUnknown && /* @__PURE__ */ jsx(CpslIcon, { "aria-label": "phone", icon: "phone" }),
|
|
176
|
-
isPhone && /* @__PURE__ */ jsxs(
|
|
177
|
-
CountryCodeSelect,
|
|
178
|
-
{
|
|
179
|
-
selectedValue: matchedCountryCode.selectedLabel,
|
|
180
|
-
onCpslSelectValueChange: handleCountryCodeInput,
|
|
181
|
-
showFormattedSelectedItem: true,
|
|
182
|
-
autoWidth: true,
|
|
183
|
-
dropdownMaxHeight,
|
|
184
|
-
anchorElId: "authInput",
|
|
185
|
-
$width: dropdownWidth != null ? dropdownWidth : 0,
|
|
186
|
-
showSearch: true,
|
|
187
|
-
searchPlaceholder: "Search Countries",
|
|
188
|
-
onCpslSearchChange: handleSearchInput,
|
|
189
|
-
"data-testid": "country-code-select",
|
|
190
|
-
children: [
|
|
191
|
-
matchedCountryCode && /* @__PURE__ */ jsxs(SelectedItem, { slot: "selected-item", children: [
|
|
192
|
-
/* @__PURE__ */ jsx(CpslText, { children: matchedCountryCode.selectedLabel }),
|
|
193
|
-
/* @__PURE__ */ jsx(CpslText, { children: matchedCountryCode.value })
|
|
194
|
-
] }),
|
|
195
|
-
filteredCountryCodes.map((cc) => /* @__PURE__ */ jsxs(StyledSelectItem, { slot: "items", value: cc.selectedLabel, children: [
|
|
196
|
-
/* @__PURE__ */ jsx(CpslText, { children: cc.label }),
|
|
197
|
-
/* @__PURE__ */ jsx(CpslText, { children: cc.value })
|
|
198
|
-
] }, cc.selectedLabel))
|
|
199
|
-
]
|
|
200
|
-
}
|
|
201
|
-
)
|
|
202
|
-
] }),
|
|
203
|
-
identifier && !disableSubmitButton && /* @__PURE__ */ jsx(CpslButton, { slot: "end", size: "small", fullWidth: true, disabled: isPending, onClick: onSubmit, children: isPending ? /* @__PURE__ */ jsx(CpslSpinner, { size: 16 }) : /* @__PURE__ */ jsx(CpslIcon, { icon: "arrowNarrow" }) })
|
|
204
|
-
]
|
|
205
|
-
},
|
|
206
|
-
"email"
|
|
207
|
-
),
|
|
208
|
-
Children && /* @__PURE__ */ jsx(ChildContainer, { children: /* @__PURE__ */ jsx(Children, { onSubmit, isPending, isSubmitting: isPending }) })
|
|
209
|
-
]
|
|
210
|
-
}
|
|
211
|
-
);
|
|
212
|
-
};
|
|
213
|
-
const IconContainer = safeStyled.div`
|
|
214
|
-
height: 100%;
|
|
215
|
-
display: flex;
|
|
216
|
-
align-items: center;
|
|
217
|
-
gap: 8px;
|
|
218
|
-
padding-right: 12px;
|
|
219
|
-
border-right: 1px solid var(--cpsl-color-background-16);
|
|
220
|
-
|
|
221
|
-
& cpsl-icon {
|
|
222
|
-
--icon-color: var(--cpsl-color-contrast);
|
|
223
|
-
}
|
|
224
|
-
`;
|
|
225
|
-
const CountryCodeSelect = safeStyled(CpslSelect)`
|
|
226
|
-
--container-height: 100%;
|
|
227
|
-
--container-padding-start: 0px;
|
|
228
|
-
--container-padding-end: 0px;
|
|
229
|
-
--container-border-width: 0px;
|
|
230
|
-
--container-gap: 4px;
|
|
231
|
-
--container-background-color: transparent;
|
|
232
|
-
--container-box-shadow: none;
|
|
233
|
-
|
|
234
|
-
&::part(dropdown) {
|
|
235
|
-
width: ${({ $width }) => `${$width - 2}px`};
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
&::part(popover) {
|
|
239
|
-
@media (max-width: ${MOBILE_SIZE}px) {
|
|
240
|
-
top: unset !important;
|
|
241
|
-
bottom: 16px;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
cpsl-auth-modal.force-mobile-media & {
|
|
245
|
-
top: unset !important;
|
|
246
|
-
bottom: 16px;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
`;
|
|
250
|
-
const StyledSelectItem = safeStyled(CpslSelectItem)`
|
|
251
|
-
&::part(inner-container) {
|
|
252
|
-
justify-content: space-between;
|
|
253
|
-
}
|
|
254
|
-
`;
|
|
255
|
-
const SelectedItem = safeStyled.div`
|
|
256
|
-
display: flex;
|
|
257
|
-
gap: 4px;
|
|
258
|
-
align-items: center;
|
|
259
|
-
`;
|
|
260
|
-
const StyledInput = safeStyled(CpslInput)`
|
|
261
|
-
--container-background-color: var(--cpsl-color-background-8);
|
|
262
|
-
--input-background-color: var(--cpsl-color-background-8);
|
|
263
|
-
--container-padding-end: 8px;
|
|
264
|
-
width: 100%;
|
|
265
|
-
`;
|
|
266
|
-
const ChildContainer = safeStyled.div`
|
|
267
|
-
display: flex;
|
|
268
|
-
flex-direction: column;
|
|
269
|
-
align-items: center;
|
|
270
|
-
justify-content: center;
|
|
271
|
-
gap: 8px;
|
|
272
|
-
margin-top: 24px;
|
|
273
|
-
width: 100%;
|
|
274
|
-
`;
|
|
275
|
-
export {
|
|
276
|
-
AuthInput
|
|
277
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { MutableRefObject } from 'react';
|
|
2
|
-
export declare const useDropdownPosition: (inputRef: MutableRefObject<HTMLCpslInputElement | HTMLDivElement | null>) => {
|
|
3
|
-
dropdownMaxHeight: number | undefined;
|
|
4
|
-
dropdownWidth: number | undefined;
|
|
5
|
-
mobileAnchor: number | undefined;
|
|
6
|
-
resize: () => void;
|
|
7
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
const useDropdownPosition = (inputRef) => {
|
|
5
|
-
const [dropdownMaxHeight, setDropdownMaxHeight] = useState();
|
|
6
|
-
const [dropdownWidth, setDropdownWidth] = useState();
|
|
7
|
-
const [mobileAnchor, setMobileAnchor] = useState();
|
|
8
|
-
const resize = () => {
|
|
9
|
-
var _a, _b, _c, _d;
|
|
10
|
-
if (typeof window !== "undefined") {
|
|
11
|
-
const newMaxHeight = Math.max(
|
|
12
|
-
window.innerHeight - ((_b = (_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.getBoundingClientRect().bottom) != null ? _b : 0) - 20,
|
|
13
|
-
window.innerHeight * 0.25
|
|
14
|
-
);
|
|
15
|
-
setDropdownMaxHeight(newMaxHeight);
|
|
16
|
-
setDropdownWidth((_c = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _c.getBoundingClientRect().width);
|
|
17
|
-
setMobileAnchor((_d = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _d.getBoundingClientRect().height);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
if (inputRef.current && !dropdownMaxHeight) {
|
|
21
|
-
resize();
|
|
22
|
-
}
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
typeof window !== "undefined" && window.addEventListener("resize", resize);
|
|
25
|
-
return () => {
|
|
26
|
-
typeof window !== "undefined" && window.removeEventListener("resize", resize);
|
|
27
|
-
};
|
|
28
|
-
}, []);
|
|
29
|
-
return { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize };
|
|
30
|
-
};
|
|
31
|
-
export {
|
|
32
|
-
useDropdownPosition
|
|
33
|
-
};
|