@getpara/react-sdk 2.0.0-alpha.32 → 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 → chunk-3GWWZKX7.js} +1 -22
- package/dist/index.d.ts +3 -5
- package/dist/index.js +5 -5
- package/dist/provider/ParaProvider.d.ts +1 -2
- package/dist/provider/ParaProvider.js +14 -107
- package/package.json +6 -28
- 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 -305
- 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/AwaitingIFrameStep/AwaitingIFrameStep.d.ts +0 -1
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.js +0 -12
- 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 -354
- 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 -62
- 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 -70
- 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 -136
- package/dist/modal/utils/steps.js +0 -279
- 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 -94
- package/dist/provider/hooks/queries/useAccount.js +0 -138
- 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 -553
- 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
|
@@ -30,30 +30,9 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
}
|
|
31
31
|
return target;
|
|
32
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
33
|
|
|
54
34
|
export {
|
|
55
35
|
__spreadValues,
|
|
56
36
|
__spreadProps,
|
|
57
|
-
__objRest
|
|
58
|
-
__async
|
|
37
|
+
__objRest
|
|
59
38
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
|
|
3
|
-
export * from '@getpara/web-sdk';
|
|
4
|
-
export type { Theme } from '@getpara/react-components';
|
|
5
|
-
import ParaWeb from '@getpara/web-sdk';
|
|
1
|
+
export * from '@getpara/react-sdk-lite';
|
|
2
|
+
import ParaWeb from '@getpara/react-sdk-lite';
|
|
6
3
|
export default ParaWeb;
|
|
4
|
+
export { ParaProvider } from './provider/ParaProvider.js';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "./chunk-
|
|
3
|
-
export * from "
|
|
4
|
-
|
|
5
|
-
export * from "@getpara/web-sdk";
|
|
6
|
-
import ParaWeb from "@getpara/web-sdk";
|
|
2
|
+
import "./chunk-3GWWZKX7.js";
|
|
3
|
+
export * from "@getpara/react-sdk-lite";
|
|
4
|
+
import ParaWeb from "@getpara/react-sdk-lite";
|
|
7
5
|
var src_default = ParaWeb;
|
|
6
|
+
import { ParaProvider } from "./provider/ParaProvider.js";
|
|
8
7
|
export {
|
|
8
|
+
ParaProvider,
|
|
9
9
|
src_default as default
|
|
10
10
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ParaProviderProps } from '
|
|
1
|
+
import { ParaModalHandle, ParaProviderProps } from '@getpara/react-sdk-lite';
|
|
2
2
|
import { Chain, Transport } from 'viem';
|
|
3
|
-
import { ParaModalHandle } from '../modal/index.js';
|
|
4
3
|
export declare const ParaProvider: import("react").ForwardRefExoticComponent<ParaProviderProps<readonly [Chain, ...Chain[]], Record<number, Transport>> & import("react").RefAttributes<ParaModalHandle>>;
|
|
@@ -1,115 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
__objRest,
|
|
3
4
|
__spreadProps,
|
|
4
5
|
__spreadValues
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import { jsx
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import { ParaModal } from "../modal/ParaModal.js";
|
|
13
|
-
import { isConfigType, isParaWeb } from "./utils/paraConfigTypeGuards.js";
|
|
14
|
-
import ParaWeb from "@getpara/web-sdk";
|
|
15
|
-
import { EXTERNAL_WALLET_TYPES } from "@getpara/web-sdk";
|
|
16
|
-
import { AuthProvider } from "./providers/AuthProvider.js";
|
|
17
|
-
import { AccountLinkProvider } from "./providers/AccountLinkProvider.js";
|
|
18
|
-
const ParaProvider = forwardRef(({ children, paraClientConfig, callbacks, config, externalWalletConfig, paraModalConfig }, ref) => {
|
|
19
|
-
useEventListeners(callbacks);
|
|
20
|
-
useAutoSessionKeepAlive({ disabled: config.disableAutoSessionKeepAlive });
|
|
21
|
-
const setClient = useStore((state) => state.setClient);
|
|
22
|
-
const client = useStore((state) => state.client);
|
|
23
|
-
const setExternalWallets = useStore((state) => state.setExternalWallets);
|
|
24
|
-
const externalWallets = useStore((state) => state.externalWallets);
|
|
25
|
-
const setExternalWalletsWithFullAuth = useStore((state) => state.setExternalWalletsWithFullAuth);
|
|
26
|
-
const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
|
|
27
|
-
const setIncludeWalletVerification = useStore((state) => state.setIncludeWalletVerification);
|
|
28
|
-
const includeWalletVerification = useStore((state) => state.includeWalletVerification);
|
|
29
|
-
const setConnectionOnly = useStore((state) => state.setConnectionOnly);
|
|
30
|
-
const connectionOnly = useStore((state) => state.connectionOnly);
|
|
31
|
-
const setModalConfig = useStore((state) => state.setModalConfig);
|
|
32
|
-
const modalConfig = useStore((state) => state.modalConfig);
|
|
33
|
-
const setAppName = useStore((state) => state.setAppName);
|
|
34
|
-
const appName = useStore((state) => state.appName);
|
|
35
|
-
const rpcUrl = useStore((state) => state.rpcUrl);
|
|
36
|
-
const setRpcUrl = useStore((state) => state.setRpcUrl);
|
|
37
|
-
const setProviderProps = useStore((state) => state.setProviderProps);
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
setProviderProps(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, config), externalWalletConfig), paraModalConfig), {
|
|
40
|
-
// Redacting walletConnect to avoid exposing project id
|
|
41
|
-
walletConnect: void 0
|
|
42
|
-
}));
|
|
43
|
-
}, [config, externalWalletConfig, paraModalConfig]);
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
if (rpcUrl !== config.rpcUrl) setRpcUrl(config.rpcUrl);
|
|
46
|
-
}, [config.rpcUrl]);
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
if (appName !== config.appName) setAppName(config.appName);
|
|
49
|
-
}, [config.appName]);
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
if (modalConfig !== paraModalConfig) setModalConfig(paraModalConfig);
|
|
52
|
-
}, [paraModalConfig]);
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
var _a;
|
|
55
|
-
if (connectionOnly !== (externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly)) {
|
|
56
|
-
setConnectionOnly((_a = externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) != null ? _a : false);
|
|
57
|
-
}
|
|
58
|
-
}, [externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly]);
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
var _a, _b;
|
|
61
|
-
if (includeWalletVerification !== (externalWalletConfig == null ? void 0 : externalWalletConfig.includeWalletVerification)) {
|
|
62
|
-
if ((externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) || (isConfigType(paraClientConfig) ? (_a = paraClientConfig.opts) == null ? void 0 : _a.externalWalletConnectionOnly : paraClientConfig.externalWalletConnectionOnly)) {
|
|
63
|
-
console.warn("includeWalletVerification has no effect when using connection only external wallets");
|
|
64
|
-
setIncludeWalletVerification(false);
|
|
65
|
-
} else {
|
|
66
|
-
setIncludeWalletVerification((_b = externalWalletConfig == null ? void 0 : externalWalletConfig.includeWalletVerification) != null ? _b : false);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}, [externalWalletConfig == null ? void 0 : externalWalletConfig.includeWalletVerification]);
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
var _a;
|
|
72
|
-
if (externalWallets !== (externalWalletConfig == null ? void 0 : externalWalletConfig.wallets)) {
|
|
73
|
-
setExternalWallets((_a = externalWalletConfig == null ? void 0 : externalWalletConfig.wallets) != null ? _a : [...EXTERNAL_WALLET_TYPES]);
|
|
74
|
-
}
|
|
75
|
-
}, [externalWalletConfig == null ? void 0 : externalWalletConfig.wallets]);
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
var _a, _b;
|
|
78
|
-
if (externalWalletsWithFullAuth !== (externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets)) {
|
|
79
|
-
if ((externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) || (isConfigType(paraClientConfig) ? (_a = paraClientConfig.opts) == null ? void 0 : _a.externalWalletConnectionOnly : paraClientConfig.externalWalletConnectionOnly)) {
|
|
80
|
-
console.warn("createLinkedEmbeddedForExternalWallets has no effect when using connection only external wallets");
|
|
81
|
-
setExternalWalletsWithFullAuth([]);
|
|
82
|
-
} else {
|
|
83
|
-
setExternalWalletsWithFullAuth(
|
|
84
|
-
(externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets) === "ALL" ? [...EXTERNAL_WALLET_TYPES] : (_b = externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets) != null ? _b : []
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}, [externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets]);
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
if (!isConfigType(paraClientConfig) && !isParaWeb(paraClientConfig)) {
|
|
91
|
-
throw new Error("Invalid Para config");
|
|
92
|
-
}
|
|
93
|
-
const newClient = isConfigType(paraClientConfig) ? new ParaWeb(paraClientConfig.env, paraClientConfig.apiKey, paraClientConfig.opts) : paraClientConfig;
|
|
94
|
-
setClient(newClient);
|
|
95
|
-
}, [paraClientConfig]);
|
|
96
|
-
if (!client) {
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
6
|
+
} from "../chunk-3GWWZKX7.js";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { ParaProvider as ParaProviderMin } from "@getpara/react-sdk-lite";
|
|
9
|
+
import { forwardRef } from "react";
|
|
10
|
+
const ParaProvider = forwardRef((_a, ref) => {
|
|
11
|
+
var _b = _a, { children, externalWalletConfig } = _b, providerProps = __objRest(_b, ["children", "externalWalletConfig"]);
|
|
12
|
+
var _a2;
|
|
99
13
|
return /* @__PURE__ */ jsx(
|
|
100
|
-
|
|
101
|
-
{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
createWallets: paraModalConfig == null ? void 0 : paraModalConfig.createWalletOverride
|
|
107
|
-
},
|
|
108
|
-
children: /* @__PURE__ */ jsx(ExternalWalletWrapper, { config: externalWalletConfig, children: /* @__PURE__ */ jsxs(AccountLinkProvider, { children: [
|
|
109
|
-
children,
|
|
110
|
-
!config.disableEmbeddedModal && client.isReady && /* @__PURE__ */ jsx(ParaModal, { ref })
|
|
111
|
-
] }) })
|
|
112
|
-
}
|
|
14
|
+
ParaProviderMin,
|
|
15
|
+
__spreadProps(__spreadValues({}, providerProps), {
|
|
16
|
+
externalWalletConfig: __spreadProps(__spreadValues({}, externalWalletConfig), { wallets: (_a2 = externalWalletConfig == null ? void 0 : externalWalletConfig.wallets) != null ? _a2 : [] }),
|
|
17
|
+
ref,
|
|
18
|
+
children
|
|
19
|
+
})
|
|
113
20
|
);
|
|
114
21
|
});
|
|
115
22
|
export {
|
package/package.json
CHANGED
|
@@ -1,30 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.33",
|
|
4
4
|
"bin": {
|
|
5
5
|
"setup-para": "dist/cli/cli.mjs"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@getpara/
|
|
9
|
-
"@getpara/
|
|
10
|
-
"@getpara/
|
|
11
|
-
"
|
|
12
|
-
"framer-motion": "^11.3.31",
|
|
13
|
-
"libphonenumber-js": "^1.11.7",
|
|
14
|
-
"styled-components": "^6.1.8",
|
|
15
|
-
"zustand": "^4.5.2",
|
|
16
|
-
"zustand-sync-tabs": "^0.2.2"
|
|
8
|
+
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.33",
|
|
9
|
+
"@getpara/evm-wallet-connectors": "2.0.0-alpha.33",
|
|
10
|
+
"@getpara/react-sdk-lite": "2.0.0-alpha.33",
|
|
11
|
+
"@getpara/solana-wallet-connectors": "2.0.0-alpha.33"
|
|
17
12
|
},
|
|
18
13
|
"devDependencies": {
|
|
19
|
-
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.32",
|
|
20
|
-
"@getpara/evm-wallet-connectors": "2.0.0-alpha.32",
|
|
21
|
-
"@getpara/solana-wallet-connectors": "2.0.0-alpha.32",
|
|
22
|
-
"@tanstack/react-query": "^5.74.0",
|
|
23
|
-
"@testing-library/dom": "^10.4.0",
|
|
24
|
-
"@testing-library/react": "^16.3.0",
|
|
25
|
-
"@testing-library/react-hooks": "^8.0.1",
|
|
26
|
-
"@testing-library/user-event": "^14.6.1",
|
|
27
|
-
"@types/chrome": "^0.0.237",
|
|
28
14
|
"@types/react": "^18.0.31",
|
|
29
15
|
"@types/react-dom": "^18.2.7",
|
|
30
16
|
"typescript": "^5.8.3"
|
|
@@ -38,24 +24,16 @@
|
|
|
38
24
|
"package.json",
|
|
39
25
|
"styles.css"
|
|
40
26
|
],
|
|
41
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "f338306fa30497d2190f8da2ff72ddd8d9d9032f",
|
|
42
28
|
"main": "dist/index.js",
|
|
43
29
|
"peerDependencies": {
|
|
44
|
-
"@getpara/cosmos-wallet-connectors": "^2.0.0-alpha.26",
|
|
45
|
-
"@getpara/evm-wallet-connectors": "^2.0.0-alpha.26",
|
|
46
|
-
"@getpara/solana-wallet-connectors": "^2.0.0-alpha.26",
|
|
47
30
|
"@tanstack/react-query": ">=5.0.0",
|
|
48
31
|
"react": "*",
|
|
49
32
|
"react-dom": "*"
|
|
50
33
|
},
|
|
51
|
-
"resolutions": {
|
|
52
|
-
"styled-components": "^6"
|
|
53
|
-
},
|
|
54
34
|
"scripts": {
|
|
55
35
|
"build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs && yarn post-build",
|
|
56
|
-
"cli": "node ./dist/cli/cli.mjs",
|
|
57
36
|
"post-build": "./scripts/post-build.sh",
|
|
58
|
-
"test": "vitest run --coverage",
|
|
59
37
|
"typegen": "tsc --emitDeclarationOnly"
|
|
60
38
|
},
|
|
61
39
|
"sideEffects": [
|
package/styles.css/package.json
CHANGED
package/dist/cli/cli.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
];
|
|
14
|
-
|
|
15
|
-
const checkForPackages = async () => {
|
|
16
|
-
const pathToNodeModules = path.resolve('node_modules');
|
|
17
|
-
|
|
18
|
-
for (let i = 0; i < PACKAGES_TO_STUB.length; i++) {
|
|
19
|
-
const packageName = PACKAGES_TO_STUB[i];
|
|
20
|
-
try {
|
|
21
|
-
await import(packageName);
|
|
22
|
-
} catch (err) {
|
|
23
|
-
if (err.code === 'ERR_MODULE_NOT_FOUND') {
|
|
24
|
-
const packageJsonContent = { name: packageName, main: './index.js' };
|
|
25
|
-
|
|
26
|
-
await fs.mkdir(path.join(pathToNodeModules, packageName), { recursive: true });
|
|
27
|
-
const indexPath = path.join(pathToNodeModules, packageName, 'index.js');
|
|
28
|
-
const packageJsonPath = path.join(pathToNodeModules, packageName, 'package.json');
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
await fs.access(indexPath);
|
|
32
|
-
} catch {
|
|
33
|
-
await fs.writeFile(indexPath, '//STUB');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
await fs.access(packageJsonPath);
|
|
38
|
-
} catch {
|
|
39
|
-
await fs.writeFile(packageJsonPath, JSON.stringify(packageJsonContent), {
|
|
40
|
-
encoding: 'utf-8',
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
process.exit();
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
await checkForPackages();
|
package/dist/modal/ParaModal.js
DELETED
|
@@ -1,305 +0,0 @@
|
|
|
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, 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 { isLoading: isAccountLoading, isConnected } = useAccount();
|
|
52
|
-
const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
|
|
53
|
-
const setIsIFrameReady = useModalStore((state) => state.setIsIFrameReady);
|
|
54
|
-
const [isModalMounted, setIsModalMounted] = useState(false);
|
|
55
|
-
const externalWallets = useStore((state) => state.externalWallets);
|
|
56
|
-
const providerProps = useStore((state) => state.providerProps);
|
|
57
|
-
const setAccountLinkOptions = useModalStore((state) => state.setAccountLinkOptions);
|
|
58
|
-
const isInitialized = useRef(false);
|
|
59
|
-
const _a = __spreadValues(__spreadValues({}, storedModalConfig), props), {
|
|
60
|
-
isOpen: configIsOpen,
|
|
61
|
-
theme,
|
|
62
|
-
disableEmailLogin = false,
|
|
63
|
-
disablePhoneLogin = false,
|
|
64
|
-
isGuestModeEnabled = false,
|
|
65
|
-
oAuthMethods = ["GOOGLE", "TWITTER"],
|
|
66
|
-
bareModal = false,
|
|
67
|
-
className,
|
|
68
|
-
currentStepOverride,
|
|
69
|
-
authLayout = [AuthLayout.AUTH_FULL, AuthLayout.EXTERNAL_FULL],
|
|
70
|
-
embeddedModal,
|
|
71
|
-
onModalStepChange,
|
|
72
|
-
onClose,
|
|
73
|
-
defaultAuthIdentifier,
|
|
74
|
-
supportedAccountLinks: propsSupportedAccountLinks
|
|
75
|
-
} = _a, rest = __objRest(_a, [
|
|
76
|
-
"isOpen",
|
|
77
|
-
"theme",
|
|
78
|
-
"disableEmailLogin",
|
|
79
|
-
"disablePhoneLogin",
|
|
80
|
-
"isGuestModeEnabled",
|
|
81
|
-
"oAuthMethods",
|
|
82
|
-
"bareModal",
|
|
83
|
-
"className",
|
|
84
|
-
"currentStepOverride",
|
|
85
|
-
"authLayout",
|
|
86
|
-
"embeddedModal",
|
|
87
|
-
"onModalStepChange",
|
|
88
|
-
"onClose",
|
|
89
|
-
"defaultAuthIdentifier",
|
|
90
|
-
"supportedAccountLinks"
|
|
91
|
-
]);
|
|
92
|
-
useEffect(() => {
|
|
93
|
-
const trackAnalytics = () => __async(void 0, null, function* () {
|
|
94
|
-
try {
|
|
95
|
-
yield para.ctx.client.trackReactSdkAnalytics({
|
|
96
|
-
props: __spreadValues(__spreadProps(__spreadValues({}, providerProps), {
|
|
97
|
-
theme,
|
|
98
|
-
disableEmailLogin,
|
|
99
|
-
disablePhoneLogin,
|
|
100
|
-
isGuestModeEnabled,
|
|
101
|
-
oAuthMethods,
|
|
102
|
-
bareModal,
|
|
103
|
-
className,
|
|
104
|
-
currentStepOverride,
|
|
105
|
-
authLayout,
|
|
106
|
-
embeddedModal,
|
|
107
|
-
onModalStepChange,
|
|
108
|
-
onClose,
|
|
109
|
-
defaultAuthIdentifier
|
|
110
|
-
}), rest),
|
|
111
|
-
reactSdkVersion: SDK_VERSION
|
|
112
|
-
});
|
|
113
|
-
} catch (_) {
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
trackAnalytics();
|
|
117
|
-
}, []);
|
|
118
|
-
const isOpen = configIsOpen != null ? configIsOpen : storedIsOpen;
|
|
119
|
-
useImperativeHandle(ref, () => {
|
|
120
|
-
return {
|
|
121
|
-
goBack() {
|
|
122
|
-
goBack();
|
|
123
|
-
},
|
|
124
|
-
canGoBack() {
|
|
125
|
-
return hasPreviousStep;
|
|
126
|
-
},
|
|
127
|
-
currentStep() {
|
|
128
|
-
return currentStep;
|
|
129
|
-
},
|
|
130
|
-
handleModalClose() {
|
|
131
|
-
var _a2;
|
|
132
|
-
(_a2 = modalContentRef == null ? void 0 : modalContentRef.current) == null ? void 0 : _a2.handleModalClose();
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
}, [hasPreviousStep, currentStep]);
|
|
136
|
-
const initModal = (shouldAutoLogin) => __async(void 0, null, function* () {
|
|
137
|
-
var _a2;
|
|
138
|
-
if (!para.isReady) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
setIFrameUrl(void 0);
|
|
142
|
-
setIsIFrameReady(false);
|
|
143
|
-
const isAccount = isConnected, isGuest = isAccount && para.isGuestMode || isCreateGuestWalletsPending;
|
|
144
|
-
switch (true) {
|
|
145
|
-
case !!currentStepOverride:
|
|
146
|
-
setStep(ModalStep[currentStepOverride.toUpperCase()]);
|
|
147
|
-
break;
|
|
148
|
-
case isGuest:
|
|
149
|
-
setFlow("guest");
|
|
150
|
-
setStep(isCreateGuestWalletsPending ? ModalStep.AWAITING_GUEST_WALLET_CREATION : ModalStep.ACCOUNT_MAIN);
|
|
151
|
-
break;
|
|
152
|
-
case isAccount:
|
|
153
|
-
setFlow("account");
|
|
154
|
-
if (!openedToStep.current) {
|
|
155
|
-
setStep(ModalStep.ACCOUNT_MAIN);
|
|
156
|
-
}
|
|
157
|
-
break;
|
|
158
|
-
default:
|
|
159
|
-
if (currentStep !== ModalStep.AUTH_MAIN && currentStep !== ModalStep.SECRET) {
|
|
160
|
-
setFlow(void 0);
|
|
161
|
-
setStep(para.isTelegram ? ModalStep.TELEGRAM_OAUTH : ModalStep.AUTH_MAIN);
|
|
162
|
-
setAuthState();
|
|
163
|
-
setAuthStepRoute();
|
|
164
|
-
}
|
|
165
|
-
yield disconnectExternalWallet();
|
|
166
|
-
setSelectedWallet({ id: void 0, type: void 0 });
|
|
167
|
-
if (shouldAutoLogin) {
|
|
168
|
-
if (defaultAuthIdentifier && ((_a2 = para.authInfo) == null ? void 0 : _a2.identifier) !== defaultAuthIdentifier) {
|
|
169
|
-
const number = parsePhoneNumberFromString(defaultAuthIdentifier);
|
|
170
|
-
try {
|
|
171
|
-
const auth = validateInput(
|
|
172
|
-
number ? number.nationalNumber : defaultAuthIdentifier,
|
|
173
|
-
(number == null ? void 0 : number.countryCallingCode) ? `+${number == null ? void 0 : number.countryCallingCode}` : void 0,
|
|
174
|
-
number ? "phone" : "email"
|
|
175
|
-
);
|
|
176
|
-
para.setAuth(number ? { phone: defaultAuthIdentifier } : { email: defaultAuthIdentifier });
|
|
177
|
-
signUpOrLogIn(auth);
|
|
178
|
-
} catch (err) {
|
|
179
|
-
console.error("invalid user identifier:", err.message);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
useEffect(() => {
|
|
187
|
-
if ((para == null ? void 0 : para.isReady) && isOpen && !isAccountLoading && !isInitialized.current) {
|
|
188
|
-
initModal(isOpen);
|
|
189
|
-
isInitialized.current = true;
|
|
190
|
-
}
|
|
191
|
-
if ((para == null ? void 0 : para.isReady) && !isOpen && isInitialized.current) {
|
|
192
|
-
initModal();
|
|
193
|
-
isInitialized.current = false;
|
|
194
|
-
}
|
|
195
|
-
}, [para == null ? void 0 : para.isReady, isOpen, isAccountLoading]);
|
|
196
|
-
useEffect(() => {
|
|
197
|
-
let _authLayout = authLayout;
|
|
198
|
-
if (!(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout)) {
|
|
199
|
-
_authLayout = _authLayout.filter((l) => !l.includes("EXTERNAL"));
|
|
200
|
-
}
|
|
201
|
-
if (disableEmailLogin && disablePhoneLogin && !(oAuthMethods == null ? void 0 : oAuthMethods.length) && hasEmbeddedAuth(authLayout)) {
|
|
202
|
-
_authLayout = _authLayout.filter((l) => !l.includes("AUTH"));
|
|
203
|
-
}
|
|
204
|
-
if (JSON.stringify(storedAuthLayout) !== JSON.stringify(_authLayout)) {
|
|
205
|
-
setAuthLayout(_authLayout);
|
|
206
|
-
}
|
|
207
|
-
}, [disableEmailLogin, disablePhoneLogin, oAuthMethods, externalWallets, authLayout, storedAuthLayout]);
|
|
208
|
-
useEffect(() => {
|
|
209
|
-
if (theme) {
|
|
210
|
-
generateTheme(theme);
|
|
211
|
-
}
|
|
212
|
-
}, [theme]);
|
|
213
|
-
useEffect(() => {
|
|
214
|
-
setOnModalStepChange(onModalStepChange);
|
|
215
|
-
}, [onModalStepChange]);
|
|
216
|
-
useEffect(() => {
|
|
217
|
-
updateSelectedWallet();
|
|
218
|
-
}, [para]);
|
|
219
|
-
useEffect(() => {
|
|
220
|
-
if (bareModal && !isAccountLoading && !isConnected && !["signup", "login"].includes(flow != null ? flow : "") && refs.currentStep.current !== ModalStep.AUTH_MAIN) {
|
|
221
|
-
setStep(ModalStep.AUTH_MAIN);
|
|
222
|
-
}
|
|
223
|
-
}, [bareModal, flow, isConnected, isAccountLoading]);
|
|
224
|
-
useEffect(() => {
|
|
225
|
-
setAccountLinkOptions(propsSupportedAccountLinks != null ? propsSupportedAccountLinks : para == null ? void 0 : para.supportedAccountLinks);
|
|
226
|
-
}, [propsSupportedAccountLinks, para == null ? void 0 : para.supportedAccountLinks]);
|
|
227
|
-
const handleClose = () => {
|
|
228
|
-
closeModal();
|
|
229
|
-
onClose == null ? void 0 : onClose();
|
|
230
|
-
};
|
|
231
|
-
const handleModalEntering = () => {
|
|
232
|
-
setIsModalMounted(true);
|
|
233
|
-
};
|
|
234
|
-
const handleModalExited = () => __async(void 0, null, function* () {
|
|
235
|
-
openedToStep.current = null;
|
|
236
|
-
setIsModalMounted(false);
|
|
237
|
-
if (RESET_TO_AUTH_STEPS.includes(currentStep)) {
|
|
238
|
-
resetModalState();
|
|
239
|
-
setRecoveryShare(null);
|
|
240
|
-
} else if (RESET_TO_ACCOUNT_STEPS.includes(currentStep)) {
|
|
241
|
-
setStep(ModalStep.LOGIN_DONE);
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
if (!para) {
|
|
245
|
-
console.error("A Para instance is required.");
|
|
246
|
-
return null;
|
|
247
|
-
}
|
|
248
|
-
if (!(storedAuthLayout == null ? void 0 : storedAuthLayout.length)) {
|
|
249
|
-
const hasExternalWalletError = !(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout);
|
|
250
|
-
const hasEmbeddedWalletError = disableEmailLogin && disablePhoneLogin && !(oAuthMethods == null ? void 0 : oAuthMethods.length) && hasEmbeddedAuth(authLayout);
|
|
251
|
-
if (hasExternalWalletError || hasEmbeddedWalletError) {
|
|
252
|
-
if (hasExternalWalletError) {
|
|
253
|
-
console.error("At least one external wallet must be provided if external wallet auth is enabled.");
|
|
254
|
-
}
|
|
255
|
-
if (hasEmbeddedWalletError) {
|
|
256
|
-
console.error(
|
|
257
|
-
"At least one login method (email, phone or OAuth) must be provided if embedded wallet auth is enabled."
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
} else {
|
|
261
|
-
console.error("At least one auth layout selection is required.");
|
|
262
|
-
}
|
|
263
|
-
return null;
|
|
264
|
-
}
|
|
265
|
-
return /* @__PURE__ */ jsx(
|
|
266
|
-
StyledAuthModal,
|
|
267
|
-
{
|
|
268
|
-
enterTransitionDuration: DEFAULTS.ANIMATION_DURATION,
|
|
269
|
-
exitTransitionDuration: DEFAULTS.ANIMATION_DURATION,
|
|
270
|
-
open: isOpen,
|
|
271
|
-
onCpslModalExited: handleModalExited,
|
|
272
|
-
onCpslModalEntering: handleModalEntering,
|
|
273
|
-
onCpslModalRequestClose: handleClose,
|
|
274
|
-
noOverlay: bareModal,
|
|
275
|
-
className,
|
|
276
|
-
"data-testid": "modal",
|
|
277
|
-
$embeddedModal: !!embeddedModal,
|
|
278
|
-
children: isModalMounted && ((embeddedModal || bareModal) && isInitialized.current || !embeddedModal && !bareModal) && /* @__PURE__ */ jsx(
|
|
279
|
-
ModalContent,
|
|
280
|
-
__spreadValues({
|
|
281
|
-
oAuthMethods,
|
|
282
|
-
disableEmailLogin,
|
|
283
|
-
disablePhoneLogin,
|
|
284
|
-
isGuestModeEnabled,
|
|
285
|
-
onClose: handleClose
|
|
286
|
-
}, rest)
|
|
287
|
-
)
|
|
288
|
-
}
|
|
289
|
-
);
|
|
290
|
-
});
|
|
291
|
-
const StyledAuthModal = safeStyled(CpslAuthModal)`
|
|
292
|
-
${({ $embeddedModal }) => $embeddedModal && `
|
|
293
|
-
&::part(modal-body-card) {
|
|
294
|
-
--card-box-shadow: none;
|
|
295
|
-
--card-border-width: 0px;
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
&::part(modal-footer) {
|
|
299
|
-
--card-box-shadow: none;
|
|
300
|
-
--card-border-width: 0px;
|
|
301
|
-
};`}
|
|
302
|
-
`;
|
|
303
|
-
export {
|
|
304
|
-
ParaModal
|
|
305
|
-
};
|