@dynamic-labs/sdk-react-core 0.19.0-alpha.8 → 0.19.0-alpha.9
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/CHANGELOG.md +29 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +9 -9
- package/src/index.cjs +14 -5
- package/src/index.d.ts +1 -1
- package/src/index.js +8 -3
- package/src/lib/Main.cjs +2 -1
- package/src/lib/Main.js +2 -1
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +1 -1
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +1 -1
- package/src/lib/components/Divider/Divider.cjs +1 -1
- package/src/lib/components/Divider/Divider.js +1 -1
- package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +1 -0
- package/src/lib/components/IconWithSpinner/IconWithSpinner.js +1 -0
- package/src/lib/components/IconWithSpinner/Indicator/Indicator.cjs +1 -0
- package/src/lib/components/IconWithSpinner/Indicator/Indicator.js +1 -0
- package/src/lib/components/IconWithSpinner/Spinner/Spinner.cjs +1 -0
- package/src/lib/components/IconWithSpinner/Spinner/Spinner.js +1 -0
- package/src/lib/components/IconWithStatus/IconWithStatus.cjs +1 -0
- package/src/lib/components/IconWithStatus/IconWithStatus.js +1 -0
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +1 -1
- package/src/lib/components/NetworkPicker/NetworkPicker.js +1 -1
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.cjs +1 -1
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.js +1 -1
- package/src/lib/components/NetworkPicker/components/Network/Network.cjs +1 -1
- package/src/lib/components/NetworkPicker/components/Network/Network.js +1 -1
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.cjs +1 -1
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.js +1 -1
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +1 -1
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +1 -1
- package/src/lib/components/SignMessagePreview/SignMessagePreview.cjs +27 -0
- package/src/lib/components/SignMessagePreview/SignMessagePreview.d.ts +6 -0
- package/src/lib/components/SignMessagePreview/SignMessagePreview.js +23 -0
- package/src/lib/components/SignMessagePreview/SignMessagePreview.types.d.ts +8 -0
- package/src/lib/components/SignMessagePreview/components/SignTypedDataPreview/SignTypedDataPreview.cjs +44 -0
- package/src/lib/components/SignMessagePreview/components/SignTypedDataPreview/SignTypedDataPreview.d.ts +8 -0
- package/src/lib/components/SignMessagePreview/components/SignTypedDataPreview/SignTypedDataPreview.js +40 -0
- package/src/lib/components/SignMessagePreview/components/SignTypedDataPreview/index.d.ts +1 -0
- package/src/lib/components/SignMessagePreview/components/index.d.ts +1 -0
- package/src/lib/components/SignMessagePreview/index.d.ts +1 -0
- package/src/lib/components/SignMessagePreview/utils/index.d.ts +1 -0
- package/src/lib/components/SignMessagePreview/utils/isSignTypedData/index.d.ts +1 -0
- package/src/lib/components/SignMessagePreview/utils/isSignTypedData/isSignTypedData.cjs +17 -0
- package/src/lib/components/SignMessagePreview/utils/isSignTypedData/isSignTypedData.d.ts +2 -0
- package/src/lib/components/SignMessagePreview/utils/isSignTypedData/isSignTypedData.js +13 -0
- package/src/lib/components/Toolkit/Toolkit.cjs +2 -1
- package/src/lib/components/Toolkit/Toolkit.js +2 -1
- package/src/lib/components/Toolkit/components/MultiWalletSwitch.cjs +1 -1
- package/src/lib/components/Toolkit/components/MultiWalletSwitch.d.ts +1 -2
- package/src/lib/components/Toolkit/components/MultiWalletSwitch.js +1 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +1 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +1 -1
- package/src/lib/components/UserAvatar/UserAvatar.cjs +22 -0
- package/src/lib/components/UserAvatar/UserAvatar.d.ts +7 -0
- package/src/lib/components/UserAvatar/UserAvatar.js +18 -0
- package/src/lib/components/UserProfile/UserProfile.cjs +9 -2
- package/src/lib/components/UserProfile/UserProfile.js +9 -2
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.js +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +1 -1
- package/src/lib/components/UserProfileForm/UserProfileForm.cjs +1 -0
- package/src/lib/components/UserProfileForm/UserProfileForm.js +1 -0
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +2 -3
- package/src/lib/context/DynamicContext/DynamicContext.js +2 -3
- package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.cjs +1 -0
- package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.js +1 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +1 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +1 -0
- package/src/lib/context/FundingContext/FundingContext.cjs +1 -0
- package/src/lib/context/FundingContext/FundingContext.js +1 -0
- package/src/lib/context/MockContext/MockContext.cjs +1 -1
- package/src/lib/context/MockContext/MockContext.js +1 -1
- package/src/lib/context/ViewContext/ViewContext.cjs +4 -19
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
- package/src/lib/context/ViewContext/ViewContext.js +5 -20
- package/src/lib/context/WalletContext/WalletContext.cjs +1 -1
- package/src/lib/context/WalletContext/WalletContext.js +1 -1
- package/src/lib/data/api.cjs +22 -16
- package/src/lib/data/api.d.ts +5 -3
- package/src/lib/data/api.js +22 -16
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +5 -2
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +5 -2
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpContent.cjs +5 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpContent.js +5 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.cjs +4 -3
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.js +4 -3
- package/src/lib/layout/DynamicAuthLayout/HelpContent/PasskeyInfoHelper/PasskeyInfoHelper.cjs +61 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/PasskeyInfoHelper/PasskeyInfoHelper.d.ts +1 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/PasskeyInfoHelper/PasskeyInfoHelper.js +57 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/PasskeyInfoHelper/index.d.ts +1 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/Item/Item.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/Item/Item.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs +2 -2
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js +2 -2
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletMoreInfoContent/WalletMoreInfoContent.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletMoreInfoContent/WalletMoreInfoContent.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/index.d.ts +1 -0
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/WalletProgressStepper/WalletProgressStepper.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/WalletProgressStepper/WalletProgressStepper.js +1 -1
- package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.cjs +1 -1
- package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.js +1 -1
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.cjs +1 -1
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.js +1 -1
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.cjs +1 -1
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.js +1 -1
- package/src/lib/locale/en/translation.cjs +41 -1
- package/src/lib/locale/en/translation.js +39 -2
- package/src/lib/locale/locale.cjs +17 -4
- package/src/lib/locale/locale.d.ts +1 -0
- package/src/lib/locale/locale.js +17 -4
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.cjs +1 -1
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.js +1 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +3 -2
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +3 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +1 -1
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +1 -1
- package/src/lib/modals/UserFieldEditorModal/UserFieldEditorModal.cjs +1 -1
- package/src/lib/modals/UserFieldEditorModal/UserFieldEditorModal.js +1 -1
- package/src/lib/shared/assets/android-face-id.cjs +61 -0
- package/src/lib/shared/assets/android-face-id.js +37 -0
- package/src/lib/shared/assets/index.d.ts +6 -0
- package/src/lib/shared/assets/iphone-face-id.cjs +53 -0
- package/src/lib/shared/assets/iphone-face-id.js +29 -0
- package/src/lib/shared/assets/iphone-touch-id.cjs +72 -0
- package/src/lib/shared/assets/iphone-touch-id.js +48 -0
- package/src/lib/shared/assets/passkey-intro-icon.cjs +97 -0
- package/src/lib/shared/assets/passkey-intro-icon.js +73 -0
- package/src/lib/shared/assets/passkey-success-icon.cjs +94 -0
- package/src/lib/shared/assets/passkey-success-icon.js +70 -0
- package/src/lib/shared/assets/user-account-2.cjs +53 -0
- package/src/lib/shared/assets/user-account-2.js +29 -0
- package/src/lib/shared/types/index.d.ts +1 -0
- package/src/lib/shared/utils/functions/wallet/createWallet.cjs +7 -5
- package/src/lib/shared/utils/functions/wallet/createWallet.js +7 -5
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.cjs +72 -0
- package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.d.ts +2 -0
- package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.js +68 -0
- package/src/lib/utils/functions/getOauthLoginUrl/index.d.ts +1 -0
- package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.d.ts +1 -1
- package/src/lib/utils/functions/getWalletProvider/getWalletProvider.cjs +3 -0
- package/src/lib/utils/functions/getWalletProvider/getWalletProvider.js +3 -0
- package/src/lib/utils/functions/handleUnlinkHelper/handleUnlinkHelper.cjs +1 -0
- package/src/lib/utils/functions/handleUnlinkHelper/handleUnlinkHelper.js +1 -0
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +8 -23
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +9 -24
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.cjs +1 -1
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js +1 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +5 -2
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +5 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +1 -0
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +1 -0
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +1 -0
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +1 -0
- package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.cjs +1 -0
- package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.js +1 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +10 -5
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.d.ts +3 -1
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +10 -5
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +1 -0
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +1 -0
- package/src/lib/utils/hooks/useHandleWalletsToConnect/useHandleWalletsToConnect.cjs +15 -1
- package/src/lib/utils/hooks/useHandleWalletsToConnect/useHandleWalletsToConnect.js +15 -1
- package/src/lib/utils/hooks/useKYCFlag/useKYCFlag.cjs +1 -0
- package/src/lib/utils/hooks/useKYCFlag/useKYCFlag.js +1 -0
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.cjs +0 -4
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.js +0 -4
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs +1 -0
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js +1 -0
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +5 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +5 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +44 -45
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +45 -46
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs +1 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js +1 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +1 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/reconnectSocialWallet.cjs +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/reconnectSocialWallet.js +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +1 -0
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +1 -1
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +1 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +1 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +1 -1
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +15 -26
- package/src/lib/utils/hooks/useWallets/useWallets.js +16 -27
- package/src/lib/utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs +1 -0
- package/src/lib/utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js +1 -0
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.cjs +1 -0
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.js +1 -0
- package/src/lib/views/AccountExistsView/AccountExistsView.cjs +1 -1
- package/src/lib/views/AccountExistsView/AccountExistsView.js +1 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +1 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +1 -1
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +1 -1
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +1 -1
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +1 -1
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +1 -1
- package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +1 -1
- package/src/lib/views/CollectUserDataView/UserDataFields/index.js +1 -1
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs +4 -3
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js +4 -3
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +1 -1
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +1 -1
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +1 -0
- package/src/lib/views/EmailUpdate/EmailUpdate.js +1 -0
- package/src/lib/views/EmailVerification/EmailVerification.cjs +1 -0
- package/src/lib/views/EmailVerification/EmailVerification.js +1 -0
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +12 -4
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +12 -4
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +1 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +1 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +1 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +1 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +1 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +1 -0
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSignInSection.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSignInSection.js +1 -1
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +1 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +1 -0
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +1 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +1 -1
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +1 -1
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +1 -1
- package/src/lib/views/NoAccess/NoAccess.cjs +1 -1
- package/src/lib/views/NoAccess/NoAccess.js +1 -1
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +1 -1
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +1 -1
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.cjs +1 -1
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.js +1 -1
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.cjs +90 -0
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.d.ts +2 -0
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.js +86 -0
- package/src/lib/views/PasskeyIntroView/index.d.ts +1 -0
- package/src/lib/views/PasskeySuccessView/PasskeySuccessView.cjs +63 -0
- package/src/lib/views/PasskeySuccessView/PasskeySuccessView.d.ts +2 -0
- package/src/lib/views/PasskeySuccessView/PasskeySuccessView.js +59 -0
- package/src/lib/views/PasskeySuccessView/index.d.ts +1 -0
- package/src/lib/views/PendingConnectView/PendingConnectView.cjs +1 -1
- package/src/lib/views/PendingConnectView/PendingConnectView.js +1 -1
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +1 -1
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +1 -1
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +1 -1
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +1 -1
- package/src/lib/views/QrCodeView/QrCodeView.cjs +1 -1
- package/src/lib/views/QrCodeView/QrCodeView.js +1 -1
- package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +1 -1
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +1 -1
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.cjs +1 -1
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.js +1 -1
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.cjs +1 -1
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.js +1 -1
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.cjs +4 -2
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.js +4 -2
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.cjs +1 -1
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.js +1 -1
- package/src/lib/views/WalletList/WalletList.cjs +1 -4
- package/src/lib/views/WalletList/WalletList.js +1 -4
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +1 -1
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +1 -1
- package/src/lib/views/WalletList/data.cjs +3 -15
- package/src/lib/views/WalletList/data.d.ts +4 -2
- package/src/lib/views/WalletList/data.js +3 -14
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +1 -1
- package/src/lib/views/WalletLockedView/WalletLockedView.js +1 -1
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +1 -1
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +1 -1
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -0
- package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -0
- package/src/lib/views/viewToComponentMap.cjs +4 -0
- package/src/lib/views/viewToComponentMap.js +4 -0
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCard/DynamicBridgeWalletCard.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCard/DynamicBridgeWalletCard.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetEmptyCard/DynamicBridgeWidgetEmptyCard.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetEmptyCard/DynamicBridgeWidgetEmptyCard.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.cjs +4 -4
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.js +4 -4
- package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/DynamicWidget.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +4 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +4 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +3 -3
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.js +1 -1
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +7 -10
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +8 -11
- package/src/lib/widgets/DynamicWidget/hooks/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.js +1 -0
- package/src/lib/widgets/DynamicWidget/hooks/useViewController/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/hooks/useViewController/useViewController.cjs +17 -0
- package/src/lib/widgets/DynamicWidget/hooks/useViewController/useViewController.d.ts +6 -0
- package/src/lib/widgets/DynamicWidget/hooks/useViewController/useViewController.js +13 -0
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +4 -4
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +4 -4
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/SendBalanceWidgetView/SendBalanceWidgetView.cjs +2 -3
- package/src/lib/widgets/DynamicWidget/views/SendBalanceWidgetView/SendBalanceWidgetView.js +2 -3
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +4 -4
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +4 -4
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.cjs +1 -1
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.js +1 -1
- package/src/lib/widgets/index.d.ts +0 -1
- package/src/lib/utils/functions/getRedirectURIOrigin/getRedirectURIOrigin.cjs +0 -33
- package/src/lib/utils/functions/getRedirectURIOrigin/getRedirectURIOrigin.js +0 -29
- package/src/lib/widgets/OAuthIFrameContainer/OAuthIFrameContainer.cjs +0 -13
- package/src/lib/widgets/OAuthIFrameContainer/OAuthIFrameContainer.d.ts +0 -2
- package/src/lib/widgets/OAuthIFrameContainer/OAuthIFrameContainer.js +0 -9
- package/src/lib/widgets/OAuthIFrameContainer/index.d.ts +0 -1
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var sdkApi = require('@dynamic-labs/sdk-api');
|
|
7
8
|
var types = require('@dynamic-labs/types');
|
|
8
9
|
var utils = require('@dynamic-labs/utils');
|
|
9
10
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
@@ -22,12 +23,11 @@ require('ethers');
|
|
|
22
23
|
require('../../../shared/consts/index.cjs');
|
|
23
24
|
require('@dynamic-labs/multi-wallet');
|
|
24
25
|
var getAuthToken = require('../../functions/getAuthToken/getAuthToken.cjs');
|
|
25
|
-
require('@dynamic-labs/sdk-api');
|
|
26
26
|
var randomString = require('../../functions/randomString/randomString.cjs');
|
|
27
27
|
var stringifyURIQuery = require('../../functions/stringifyURIQuery/stringifyURIQuery.cjs');
|
|
28
28
|
var digestSHA256 = require('../../functions/digestSHA256/digestSHA256.cjs');
|
|
29
29
|
var encodeBase64URL = require('../../functions/encodeBase64URL/encodeBase64URL.cjs');
|
|
30
|
-
var
|
|
30
|
+
var getOauthLoginUrl = require('../../functions/getOauthLoginUrl/getOauthLoginUrl.cjs');
|
|
31
31
|
var useCreateUserProfileByJWTCallback = require('../useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.cjs');
|
|
32
32
|
var ErrorContext = require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
33
33
|
|
|
@@ -47,15 +47,16 @@ const providersWithoutWindowOpenerRefence = ['twitter'];
|
|
|
47
47
|
// Hook to handle common social auth logic (for social linking and social sign in)
|
|
48
48
|
const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
49
49
|
var _a;
|
|
50
|
-
const { environmentId, onboardingOnlyJwt, setOnboardingOnlyJwt, setCallback, setShowAuthFlow, setIsVerificationInProgress, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
50
|
+
const { environmentId, onboardingOnlyJwt, setOnboardingOnlyJwt, setCallback, setShowAuthFlow, setIsVerificationInProgress, projectSettings, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
51
51
|
const { setView } = ViewContext.useViewContext();
|
|
52
52
|
const { setErrorMessage, setError: setContextError } = ErrorContext.useErrorContext();
|
|
53
53
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
|
|
54
54
|
const { createUserProfileByJWT } = useCreateUserProfileByJWTCallback.useCreateUserProfileByJWTCallback();
|
|
55
55
|
const [isProcessing, setIsProcessing] = React.useState(false);
|
|
56
56
|
const [error, setError] = React.useState();
|
|
57
|
-
const
|
|
57
|
+
const providersWaitingOauthMessage = React.useRef({});
|
|
58
58
|
const authWindowInterval = React.useRef();
|
|
59
|
+
const shouldPool = React.useRef(false);
|
|
59
60
|
const userJwt = (_a = getAuthToken.getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
60
61
|
const clearError = () => {
|
|
61
62
|
setError(undefined);
|
|
@@ -69,23 +70,26 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
69
70
|
onError === null || onError === void 0 ? void 0 : onError();
|
|
70
71
|
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
71
72
|
};
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
let oauthIFrame = document.getElementById('oauth-iframe');
|
|
75
|
-
if (!container || oauthIFrame) {
|
|
73
|
+
const poolOauthResult = (provider, state) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
+
if (!shouldPool.current) {
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const oauthIFrame = document.getElementById('oauth-iframe');
|
|
85
|
-
if (oauthIFrame) {
|
|
86
|
-
oauthIFrame.remove();
|
|
77
|
+
const result = yield api.getOAuthResult(environmentId, provider, {
|
|
78
|
+
state,
|
|
79
|
+
});
|
|
80
|
+
if ((result === null || result === void 0 ? void 0 : result.status) !== sdkApi.OauthResultStatus.Completed) {
|
|
81
|
+
setTimeout(() => poolOauthResult(provider, state), 1000);
|
|
82
|
+
return;
|
|
87
83
|
}
|
|
88
|
-
|
|
84
|
+
shouldPool.current = false;
|
|
85
|
+
const authMessage = {
|
|
86
|
+
code: result === null || result === void 0 ? void 0 : result.code,
|
|
87
|
+
error: result === null || result === void 0 ? void 0 : result.error,
|
|
88
|
+
provider,
|
|
89
|
+
type: 'authorization_response',
|
|
90
|
+
};
|
|
91
|
+
window.postMessage(authMessage, '*');
|
|
92
|
+
});
|
|
89
93
|
const checkValidProvider = (provider) => {
|
|
90
94
|
if (!provider) {
|
|
91
95
|
handleError(types.SocialOAuthErrorCode.NO_PROVIDER, 'Provider is required');
|
|
@@ -149,7 +153,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
149
153
|
}
|
|
150
154
|
});
|
|
151
155
|
const connectSocialAccount = (provider, validator) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
152
|
-
var _b;
|
|
156
|
+
var _b, _c;
|
|
153
157
|
clearInterval(authWindowInterval.current);
|
|
154
158
|
clearError();
|
|
155
159
|
setIsProcessing(true);
|
|
@@ -160,15 +164,15 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
160
164
|
if (validator && !validator(provider)) {
|
|
161
165
|
return;
|
|
162
166
|
}
|
|
167
|
+
const authWindow = window.open('', '_blank', 'width=500,height=600');
|
|
163
168
|
const state = randomString.randomString(8);
|
|
164
169
|
const verifier = randomString.randomString(43);
|
|
165
170
|
const clearListeners = () => {
|
|
166
|
-
removeOAuthIFrame();
|
|
167
171
|
window.removeEventListener('message', handleAuthWindowMessage);
|
|
168
|
-
|
|
172
|
+
providersWaitingOauthMessage.current = Object.assign(Object.assign({}, providersWaitingOauthMessage.current), { [provider]: false });
|
|
169
173
|
};
|
|
170
174
|
const handleAuthWindowMessage = (event) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
171
|
-
var
|
|
175
|
+
var _d;
|
|
172
176
|
const message = event.data;
|
|
173
177
|
const isAuthorizationMessage = (message === null || message === void 0 ? void 0 : message.type) === 'authorization_response';
|
|
174
178
|
if (isAuthorizationMessage) {
|
|
@@ -180,7 +184,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
180
184
|
return;
|
|
181
185
|
}
|
|
182
186
|
setIsProcessing(true);
|
|
183
|
-
if (!((
|
|
187
|
+
if (!((_d = providersWaitingOauthMessage.current) === null || _d === void 0 ? void 0 : _d[provider])) {
|
|
184
188
|
handleError(types.SocialOAuthErrorCode.SESSION_TIMEOUT, `Connecting ${provider} account session timeout.`);
|
|
185
189
|
return;
|
|
186
190
|
}
|
|
@@ -202,16 +206,11 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
202
206
|
}
|
|
203
207
|
setIsProcessing(false);
|
|
204
208
|
});
|
|
205
|
-
const loginUrl =
|
|
209
|
+
const loginUrl = getOauthLoginUrl.getOauthLoginUrl((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _b !== void 0 ? _b : [], provider, environmentId);
|
|
206
210
|
if (!loginUrl) {
|
|
207
211
|
handleError(types.SocialOAuthErrorCode.NO_OAUTH_URL, `Failed to get login url to connect social account: ${provider}`);
|
|
208
212
|
return;
|
|
209
213
|
}
|
|
210
|
-
// we need to use an iframe to be the intermediary in communications between the popup and the sdk
|
|
211
|
-
// because of twitter limitations with accessing the window.opener and BroadcastChannel not working between
|
|
212
|
-
// different origins (our api redirect page and the app where the sdk is running)
|
|
213
|
-
const oauthIFrameUrl = `${getRedirectURIOrigin.getRedirectURIOrigin(loginUrl)}/sdkoauth`;
|
|
214
|
-
addOAuthIFrame(oauthIFrameUrl);
|
|
215
214
|
let oauthLoginUrl = loginUrl;
|
|
216
215
|
if (providersRequiringPkce.includes(provider)) {
|
|
217
216
|
const digest = yield digestSHA256.digestSHA256(verifier);
|
|
@@ -222,16 +221,11 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
222
221
|
});
|
|
223
222
|
oauthLoginUrl = `${loginUrl}&${pkceParams}`;
|
|
224
223
|
}
|
|
225
|
-
if (!((
|
|
224
|
+
if (!((_c = providersWaitingOauthMessage.current) === null || _c === void 0 ? void 0 : _c[provider])) {
|
|
226
225
|
window.addEventListener('message', handleAuthWindowMessage);
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
const authWindow = window.open(oauthLoginUrl, '_blank', 'width=500,height=600');
|
|
230
|
-
if (authWindow === null || typeof authWindow === 'undefined') {
|
|
231
|
-
// Pop-ups are blocked
|
|
232
|
-
handleError(types.SocialOAuthErrorCode.OAUTH_WINDOW_BLOCKED, 'Please allow popups and try again.');
|
|
233
|
-
return;
|
|
226
|
+
providersWaitingOauthMessage.current = Object.assign(Object.assign({}, providersWaitingOauthMessage.current), { [provider]: true });
|
|
234
227
|
}
|
|
228
|
+
authWindow === null || authWindow === void 0 ? void 0 : authWindow.location.assign(oauthLoginUrl);
|
|
235
229
|
if (!providersWithoutWindowOpenerRefence.includes(provider)) {
|
|
236
230
|
// For provider that support window.opener, we need to clear all states/listeners when the window is closed
|
|
237
231
|
authWindowInterval.current = setInterval(() => {
|
|
@@ -242,26 +236,31 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
242
236
|
clearInterval(authWindowInterval.current);
|
|
243
237
|
setIsProcessing(false);
|
|
244
238
|
// user didn't complete oauth
|
|
245
|
-
if ((_a =
|
|
239
|
+
if ((_a = providersWaitingOauthMessage.current) === null || _a === void 0 ? void 0 : _a[provider]) {
|
|
246
240
|
onError === null || onError === void 0 ? void 0 : onError();
|
|
247
241
|
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
248
242
|
}
|
|
249
243
|
}, 2000);
|
|
250
244
|
}
|
|
251
245
|
else {
|
|
252
|
-
// For provider that don't support window.opener, we need to use a timeout to
|
|
253
|
-
//
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
246
|
+
// For provider that don't support window.opener, we need to use a timeout to pool the oauth result
|
|
247
|
+
// If we don't get a valid result in {async sessionTimeout} ms, we'll assume the user closed the window
|
|
248
|
+
// and we'll clear all states/listeners
|
|
249
|
+
// start pooling oauth result
|
|
250
|
+
shouldPool.current = true;
|
|
251
|
+
poolOauthResult(provider, state);
|
|
252
|
+
authWindowInterval.current = setInterval(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
253
|
+
var _e;
|
|
254
|
+
shouldPool.current = false;
|
|
255
|
+
// clear all states/listeners, assuming user closed the window before completing oauth
|
|
256
|
+
if ((_e = providersWaitingOauthMessage.current) === null || _e === void 0 ? void 0 : _e[provider]) {
|
|
258
257
|
clearListeners();
|
|
259
258
|
handleError(types.SocialOAuthErrorCode.OAUTH_WINDOW_TIMEOUT, `Connecting ${provider} account window timeout.`);
|
|
260
259
|
}
|
|
261
260
|
clearInterval(authWindowInterval.current);
|
|
262
261
|
setIsProcessing(false);
|
|
263
262
|
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
264
|
-
}, sessionTimeout);
|
|
263
|
+
}), sessionTimeout);
|
|
265
264
|
}
|
|
266
265
|
});
|
|
267
266
|
return {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
2
2
|
import { useState, useRef } from 'react';
|
|
3
|
+
import { OauthResultStatus } from '@dynamic-labs/sdk-api';
|
|
3
4
|
import { SocialOAuthErrorCode } from '@dynamic-labs/types';
|
|
4
5
|
import { SocialAccountAlreadyExistsError, NoAccessError } from '@dynamic-labs/utils';
|
|
5
6
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
6
|
-
import {
|
|
7
|
+
import { getOAuthResult, verifyOAuth, signInOAuth } from '../../../data/api.js';
|
|
7
8
|
import { useUpdateUserProfileByJWTCallback } from '../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.js';
|
|
8
9
|
import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
9
10
|
import '@dynamic-labs/iconic';
|
|
@@ -18,12 +19,11 @@ import 'ethers';
|
|
|
18
19
|
import '../../../shared/consts/index.js';
|
|
19
20
|
import '@dynamic-labs/multi-wallet';
|
|
20
21
|
import { getAuthToken } from '../../functions/getAuthToken/getAuthToken.js';
|
|
21
|
-
import '@dynamic-labs/sdk-api';
|
|
22
22
|
import { randomString } from '../../functions/randomString/randomString.js';
|
|
23
23
|
import { stringifyURIQuery } from '../../functions/stringifyURIQuery/stringifyURIQuery.js';
|
|
24
24
|
import { digestSHA256 } from '../../functions/digestSHA256/digestSHA256.js';
|
|
25
25
|
import { encodeBase64URL } from '../../functions/encodeBase64URL/encodeBase64URL.js';
|
|
26
|
-
import {
|
|
26
|
+
import { getOauthLoginUrl } from '../../functions/getOauthLoginUrl/getOauthLoginUrl.js';
|
|
27
27
|
import { useCreateUserProfileByJWTCallback } from '../useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.js';
|
|
28
28
|
import { useErrorContext } from '../../../context/ErrorContext/ErrorContext.js';
|
|
29
29
|
|
|
@@ -43,15 +43,16 @@ const providersWithoutWindowOpenerRefence = ['twitter'];
|
|
|
43
43
|
// Hook to handle common social auth logic (for social linking and social sign in)
|
|
44
44
|
const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
45
45
|
var _a;
|
|
46
|
-
const { environmentId, onboardingOnlyJwt, setOnboardingOnlyJwt, setCallback, setShowAuthFlow, setIsVerificationInProgress, } = useInternalDynamicContext();
|
|
46
|
+
const { environmentId, onboardingOnlyJwt, setOnboardingOnlyJwt, setCallback, setShowAuthFlow, setIsVerificationInProgress, projectSettings, } = useInternalDynamicContext();
|
|
47
47
|
const { setView } = useViewContext();
|
|
48
48
|
const { setErrorMessage, setError: setContextError } = useErrorContext();
|
|
49
49
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
50
50
|
const { createUserProfileByJWT } = useCreateUserProfileByJWTCallback();
|
|
51
51
|
const [isProcessing, setIsProcessing] = useState(false);
|
|
52
52
|
const [error, setError] = useState();
|
|
53
|
-
const
|
|
53
|
+
const providersWaitingOauthMessage = useRef({});
|
|
54
54
|
const authWindowInterval = useRef();
|
|
55
|
+
const shouldPool = useRef(false);
|
|
55
56
|
const userJwt = (_a = getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
56
57
|
const clearError = () => {
|
|
57
58
|
setError(undefined);
|
|
@@ -65,23 +66,26 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
65
66
|
onError === null || onError === void 0 ? void 0 : onError();
|
|
66
67
|
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
67
68
|
};
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
let oauthIFrame = document.getElementById('oauth-iframe');
|
|
71
|
-
if (!container || oauthIFrame) {
|
|
69
|
+
const poolOauthResult = (provider, state) => __awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
+
if (!shouldPool.current) {
|
|
72
71
|
return;
|
|
73
72
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const oauthIFrame = document.getElementById('oauth-iframe');
|
|
81
|
-
if (oauthIFrame) {
|
|
82
|
-
oauthIFrame.remove();
|
|
73
|
+
const result = yield getOAuthResult(environmentId, provider, {
|
|
74
|
+
state,
|
|
75
|
+
});
|
|
76
|
+
if ((result === null || result === void 0 ? void 0 : result.status) !== OauthResultStatus.Completed) {
|
|
77
|
+
setTimeout(() => poolOauthResult(provider, state), 1000);
|
|
78
|
+
return;
|
|
83
79
|
}
|
|
84
|
-
|
|
80
|
+
shouldPool.current = false;
|
|
81
|
+
const authMessage = {
|
|
82
|
+
code: result === null || result === void 0 ? void 0 : result.code,
|
|
83
|
+
error: result === null || result === void 0 ? void 0 : result.error,
|
|
84
|
+
provider,
|
|
85
|
+
type: 'authorization_response',
|
|
86
|
+
};
|
|
87
|
+
window.postMessage(authMessage, '*');
|
|
88
|
+
});
|
|
85
89
|
const checkValidProvider = (provider) => {
|
|
86
90
|
if (!provider) {
|
|
87
91
|
handleError(SocialOAuthErrorCode.NO_PROVIDER, 'Provider is required');
|
|
@@ -145,7 +149,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
145
149
|
}
|
|
146
150
|
});
|
|
147
151
|
const connectSocialAccount = (provider, validator) => __awaiter(void 0, void 0, void 0, function* () {
|
|
148
|
-
var _b;
|
|
152
|
+
var _b, _c;
|
|
149
153
|
clearInterval(authWindowInterval.current);
|
|
150
154
|
clearError();
|
|
151
155
|
setIsProcessing(true);
|
|
@@ -156,15 +160,15 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
156
160
|
if (validator && !validator(provider)) {
|
|
157
161
|
return;
|
|
158
162
|
}
|
|
163
|
+
const authWindow = window.open('', '_blank', 'width=500,height=600');
|
|
159
164
|
const state = randomString(8);
|
|
160
165
|
const verifier = randomString(43);
|
|
161
166
|
const clearListeners = () => {
|
|
162
|
-
removeOAuthIFrame();
|
|
163
167
|
window.removeEventListener('message', handleAuthWindowMessage);
|
|
164
|
-
|
|
168
|
+
providersWaitingOauthMessage.current = Object.assign(Object.assign({}, providersWaitingOauthMessage.current), { [provider]: false });
|
|
165
169
|
};
|
|
166
170
|
const handleAuthWindowMessage = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
167
|
-
var
|
|
171
|
+
var _d;
|
|
168
172
|
const message = event.data;
|
|
169
173
|
const isAuthorizationMessage = (message === null || message === void 0 ? void 0 : message.type) === 'authorization_response';
|
|
170
174
|
if (isAuthorizationMessage) {
|
|
@@ -176,7 +180,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
176
180
|
return;
|
|
177
181
|
}
|
|
178
182
|
setIsProcessing(true);
|
|
179
|
-
if (!((
|
|
183
|
+
if (!((_d = providersWaitingOauthMessage.current) === null || _d === void 0 ? void 0 : _d[provider])) {
|
|
180
184
|
handleError(SocialOAuthErrorCode.SESSION_TIMEOUT, `Connecting ${provider} account session timeout.`);
|
|
181
185
|
return;
|
|
182
186
|
}
|
|
@@ -198,16 +202,11 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
198
202
|
}
|
|
199
203
|
setIsProcessing(false);
|
|
200
204
|
});
|
|
201
|
-
const loginUrl =
|
|
205
|
+
const loginUrl = getOauthLoginUrl((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _b !== void 0 ? _b : [], provider, environmentId);
|
|
202
206
|
if (!loginUrl) {
|
|
203
207
|
handleError(SocialOAuthErrorCode.NO_OAUTH_URL, `Failed to get login url to connect social account: ${provider}`);
|
|
204
208
|
return;
|
|
205
209
|
}
|
|
206
|
-
// we need to use an iframe to be the intermediary in communications between the popup and the sdk
|
|
207
|
-
// because of twitter limitations with accessing the window.opener and BroadcastChannel not working between
|
|
208
|
-
// different origins (our api redirect page and the app where the sdk is running)
|
|
209
|
-
const oauthIFrameUrl = `${getRedirectURIOrigin(loginUrl)}/sdkoauth`;
|
|
210
|
-
addOAuthIFrame(oauthIFrameUrl);
|
|
211
210
|
let oauthLoginUrl = loginUrl;
|
|
212
211
|
if (providersRequiringPkce.includes(provider)) {
|
|
213
212
|
const digest = yield digestSHA256(verifier);
|
|
@@ -218,16 +217,11 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
218
217
|
});
|
|
219
218
|
oauthLoginUrl = `${loginUrl}&${pkceParams}`;
|
|
220
219
|
}
|
|
221
|
-
if (!((
|
|
220
|
+
if (!((_c = providersWaitingOauthMessage.current) === null || _c === void 0 ? void 0 : _c[provider])) {
|
|
222
221
|
window.addEventListener('message', handleAuthWindowMessage);
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
const authWindow = window.open(oauthLoginUrl, '_blank', 'width=500,height=600');
|
|
226
|
-
if (authWindow === null || typeof authWindow === 'undefined') {
|
|
227
|
-
// Pop-ups are blocked
|
|
228
|
-
handleError(SocialOAuthErrorCode.OAUTH_WINDOW_BLOCKED, 'Please allow popups and try again.');
|
|
229
|
-
return;
|
|
222
|
+
providersWaitingOauthMessage.current = Object.assign(Object.assign({}, providersWaitingOauthMessage.current), { [provider]: true });
|
|
230
223
|
}
|
|
224
|
+
authWindow === null || authWindow === void 0 ? void 0 : authWindow.location.assign(oauthLoginUrl);
|
|
231
225
|
if (!providersWithoutWindowOpenerRefence.includes(provider)) {
|
|
232
226
|
// For provider that support window.opener, we need to clear all states/listeners when the window is closed
|
|
233
227
|
authWindowInterval.current = setInterval(() => {
|
|
@@ -238,26 +232,31 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
238
232
|
clearInterval(authWindowInterval.current);
|
|
239
233
|
setIsProcessing(false);
|
|
240
234
|
// user didn't complete oauth
|
|
241
|
-
if ((_a =
|
|
235
|
+
if ((_a = providersWaitingOauthMessage.current) === null || _a === void 0 ? void 0 : _a[provider]) {
|
|
242
236
|
onError === null || onError === void 0 ? void 0 : onError();
|
|
243
237
|
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
244
238
|
}
|
|
245
239
|
}, 2000);
|
|
246
240
|
}
|
|
247
241
|
else {
|
|
248
|
-
// For provider that don't support window.opener, we need to use a timeout to
|
|
249
|
-
//
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
242
|
+
// For provider that don't support window.opener, we need to use a timeout to pool the oauth result
|
|
243
|
+
// If we don't get a valid result in {async sessionTimeout} ms, we'll assume the user closed the window
|
|
244
|
+
// and we'll clear all states/listeners
|
|
245
|
+
// start pooling oauth result
|
|
246
|
+
shouldPool.current = true;
|
|
247
|
+
poolOauthResult(provider, state);
|
|
248
|
+
authWindowInterval.current = setInterval(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
249
|
+
var _e;
|
|
250
|
+
shouldPool.current = false;
|
|
251
|
+
// clear all states/listeners, assuming user closed the window before completing oauth
|
|
252
|
+
if ((_e = providersWaitingOauthMessage.current) === null || _e === void 0 ? void 0 : _e[provider]) {
|
|
254
253
|
clearListeners();
|
|
255
254
|
handleError(SocialOAuthErrorCode.OAUTH_WINDOW_TIMEOUT, `Connecting ${provider} account window timeout.`);
|
|
256
255
|
}
|
|
257
256
|
clearInterval(authWindowInterval.current);
|
|
258
257
|
setIsProcessing(false);
|
|
259
258
|
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
260
|
-
}, sessionTimeout);
|
|
259
|
+
}), sessionTimeout);
|
|
261
260
|
}
|
|
262
261
|
});
|
|
263
262
|
return {
|
|
@@ -24,6 +24,7 @@ var isEmailVerificationRequired = require('../../../functions/authenication/isEm
|
|
|
24
24
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
25
25
|
require('@dynamic-labs/multi-wallet');
|
|
26
26
|
require('@dynamic-labs/sdk-api');
|
|
27
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
27
28
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
28
29
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
29
30
|
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
@@ -20,6 +20,7 @@ import { isEmailVerificationRequired } from '../../../functions/authenication/is
|
|
|
20
20
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
21
21
|
import '@dynamic-labs/multi-wallet';
|
|
22
22
|
import '@dynamic-labs/sdk-api';
|
|
23
|
+
import '../../../../config/ApiEndpoint.js';
|
|
23
24
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
24
25
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
25
26
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
@@ -23,6 +23,7 @@ require('../../../shared/consts/index.cjs');
|
|
|
23
23
|
var getVerifyArgs = require('../../functions/getVerifyArgs/getVerifyArgs.cjs');
|
|
24
24
|
var createUserProfile = require('../../functions/createUserProfile/createUserProfile.cjs');
|
|
25
25
|
require('@dynamic-labs/sdk-api');
|
|
26
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
26
27
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
27
28
|
var ErrorContext = require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
28
29
|
var getSiweStatement = require('../../functions/getSiweStatement/getSiweStatement.cjs');
|
|
@@ -19,6 +19,7 @@ import '../../../shared/consts/index.js';
|
|
|
19
19
|
import { getVerifyArgs } from '../../functions/getVerifyArgs/getVerifyArgs.js';
|
|
20
20
|
import { createUserProfile } from '../../functions/createUserProfile/createUserProfile.js';
|
|
21
21
|
import '@dynamic-labs/sdk-api';
|
|
22
|
+
import '../../../config/ApiEndpoint.js';
|
|
22
23
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
23
24
|
import { useErrorContext } from '../../../context/ErrorContext/ErrorContext.js';
|
|
24
25
|
import { getSiweStatement } from '../../functions/getSiweStatement/getSiweStatement.js';
|
|
@@ -18,6 +18,7 @@ require('ethers');
|
|
|
18
18
|
require('../../../shared/consts/index.cjs');
|
|
19
19
|
require('@dynamic-labs/multi-wallet');
|
|
20
20
|
var getReferencedAccount = require('../../functions/getReferencedAccount/getReferencedAccount.cjs');
|
|
21
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* This function will use a referenced account to kick off the social wallet
|
|
@@ -14,6 +14,7 @@ import 'ethers';
|
|
|
14
14
|
import '../../../shared/consts/index.js';
|
|
15
15
|
import '@dynamic-labs/multi-wallet';
|
|
16
16
|
import { getReferencedAccount } from '../../functions/getReferencedAccount/getReferencedAccount.js';
|
|
17
|
+
import '../../../config/ApiEndpoint.js';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* This function will use a referenced account to kick off the social wallet
|
|
@@ -19,6 +19,7 @@ var isSameWalletName = require('../../../../functions/isSameWalletName/isSameWal
|
|
|
19
19
|
require('@dynamic-labs/multi-wallet');
|
|
20
20
|
require('@dynamic-labs/sdk-api');
|
|
21
21
|
var shouldManuallyReconnectOnRefresh = require('../../../../functions/shouldManuallyReconnectOnRefresh/shouldManuallyReconnectOnRefresh.cjs');
|
|
22
|
+
require('../../../../../config/ApiEndpoint.cjs');
|
|
22
23
|
|
|
23
24
|
const createLinkedWalletsFromWalletOptions = ({ authToken, walletOptions, primaryWalletId, }) => {
|
|
24
25
|
const decodedJwt = decodeJwt.decodeJwt(authToken);
|
|
@@ -15,6 +15,7 @@ import { isSameWalletName } from '../../../../functions/isSameWalletName/isSameW
|
|
|
15
15
|
import '@dynamic-labs/multi-wallet';
|
|
16
16
|
import '@dynamic-labs/sdk-api';
|
|
17
17
|
import { shouldManuallyReconnectOnRefresh } from '../../../../functions/shouldManuallyReconnectOnRefresh/shouldManuallyReconnectOnRefresh.js';
|
|
18
|
+
import '../../../../../config/ApiEndpoint.js';
|
|
18
19
|
|
|
19
20
|
const createLinkedWalletsFromWalletOptions = ({ authToken, walletOptions, primaryWalletId, }) => {
|
|
20
21
|
const decodedJwt = decodeJwt(authToken);
|
|
@@ -21,9 +21,9 @@ require('ethers');
|
|
|
21
21
|
require('../../../shared/consts/index.cjs');
|
|
22
22
|
require('@dynamic-labs/multi-wallet');
|
|
23
23
|
var requiresTwoStepAuthentication = require('../../functions/requiresTwoStepAuthentication/requiresTwoStepAuthentication.cjs');
|
|
24
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
24
25
|
var isSelectedWalletAlreadyConnected = require('../../functions/isSelectedWalletAlreadyConnected/isSelectedWalletAlreadyConnected.cjs');
|
|
25
26
|
var useConnectAndSign = require('../authenticationHooks/useConnectAndSign/useConnectAndSign.cjs');
|
|
26
|
-
require('../../../config/ApiEndpoint.cjs');
|
|
27
27
|
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
28
28
|
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
29
29
|
var useConnectAndSignSplitSteps = require('../authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs');
|
|
@@ -17,9 +17,9 @@ import 'ethers';
|
|
|
17
17
|
import '../../../shared/consts/index.js';
|
|
18
18
|
import '@dynamic-labs/multi-wallet';
|
|
19
19
|
import { requiresTwoStepAuthentication } from '../../functions/requiresTwoStepAuthentication/requiresTwoStepAuthentication.js';
|
|
20
|
+
import '../../../config/ApiEndpoint.js';
|
|
20
21
|
import { isSelectedWalletAlreadyConnected } from '../../functions/isSelectedWalletAlreadyConnected/isSelectedWalletAlreadyConnected.js';
|
|
21
22
|
import { useConnectAndSign } from '../authenticationHooks/useConnectAndSign/useConnectAndSign.js';
|
|
22
|
-
import '../../../config/ApiEndpoint.js';
|
|
23
23
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
24
24
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
25
25
|
import { useConnectAndSignSplitSteps } from '../authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js';
|
|
@@ -20,6 +20,7 @@ require('ethers');
|
|
|
20
20
|
require('../../../shared/consts/index.cjs');
|
|
21
21
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
22
22
|
require('@dynamic-labs/multi-wallet');
|
|
23
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
23
24
|
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
24
25
|
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
25
26
|
require('react-dom');
|
|
@@ -27,7 +28,6 @@ require('react-focus-lock');
|
|
|
27
28
|
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
28
29
|
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
29
30
|
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
30
|
-
require('../../../config/ApiEndpoint.cjs');
|
|
31
31
|
require('@dynamic-labs/rpc-providers');
|
|
32
32
|
require('../useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
33
33
|
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
@@ -16,6 +16,7 @@ import 'ethers';
|
|
|
16
16
|
import '../../../shared/consts/index.js';
|
|
17
17
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
18
18
|
import '@dynamic-labs/multi-wallet';
|
|
19
|
+
import '../../../config/ApiEndpoint.js';
|
|
19
20
|
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
20
21
|
import '../../../context/ThemeContext/ThemeContext.js';
|
|
21
22
|
import 'react-dom';
|
|
@@ -23,7 +24,6 @@ import 'react-focus-lock';
|
|
|
23
24
|
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
24
25
|
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
25
26
|
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
26
|
-
import '../../../config/ApiEndpoint.js';
|
|
27
27
|
import '@dynamic-labs/rpc-providers';
|
|
28
28
|
import '../useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
29
29
|
import '../../../context/ErrorContext/ErrorContext.js';
|
|
@@ -10,33 +10,22 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, deepLinkPreference,
|
|
|
10
10
|
const wallets = React.useMemo(() => {
|
|
11
11
|
if (!projectSettings || !Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length)
|
|
12
12
|
return [];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
return data.getWallets({
|
|
14
|
+
getSupportedWalletOpts: {
|
|
15
|
+
appLogoUrl,
|
|
16
|
+
appName,
|
|
17
|
+
customerApiProviders: projectSettings.providers || [],
|
|
18
|
+
deepLinkPreference,
|
|
19
|
+
flowNetwork,
|
|
20
|
+
networkConfigurations,
|
|
21
|
+
skipMemo: true,
|
|
22
|
+
walletBook,
|
|
23
|
+
walletConnectV1Bridge,
|
|
24
|
+
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
25
|
+
walletUiUtils,
|
|
26
|
+
},
|
|
27
|
+
settings: projectSettings,
|
|
25
28
|
});
|
|
26
|
-
const notInstalledWallets = data.getNotInstalledWallets(projectSettings, {
|
|
27
|
-
appLogoUrl,
|
|
28
|
-
appName,
|
|
29
|
-
customerApiProviders: projectSettings.providers || [],
|
|
30
|
-
deepLinkPreference,
|
|
31
|
-
flowNetwork,
|
|
32
|
-
networkConfigurations,
|
|
33
|
-
skipMemo: true,
|
|
34
|
-
walletBook,
|
|
35
|
-
walletConnectV1Bridge,
|
|
36
|
-
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
37
|
-
walletUiUtils,
|
|
38
|
-
});
|
|
39
|
-
return [...installedWallets, ...notInstalledWallets];
|
|
40
29
|
// Cannot include walletUiUtils in the dependency array because it will cause an infinite loop
|
|
41
30
|
}, [
|
|
42
31
|
appLogoUrl,
|