@dynamic-labs/sdk-react-core 0.19.2 → 0.19.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +10 -10
- package/src/index.cjs +8 -2
- package/src/index.js +5 -1
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.cjs +2 -0
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.js +2 -0
- package/src/lib/components/AnimatePresence/AnimatePresence.cjs +2 -0
- package/src/lib/components/AnimatePresence/AnimatePresence.js +2 -0
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +2 -0
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +2 -0
- package/src/lib/components/Button/Button.cjs +4 -2
- package/src/lib/components/Button/Button.d.ts +1 -0
- package/src/lib/components/Button/Button.js +4 -2
- package/src/lib/components/Divider/Divider.cjs +2 -0
- package/src/lib/components/Divider/Divider.js +2 -0
- package/src/lib/components/MenuList/Dropdown/Dropdown.cjs +2 -0
- package/src/lib/components/MenuList/Dropdown/Dropdown.js +2 -0
- package/src/lib/components/Modal/Modal.cjs +2 -0
- package/src/lib/components/Modal/Modal.js +2 -0
- package/src/lib/components/NeedHelpSection/NeedHelpSection.cjs +5 -2
- package/src/lib/components/NeedHelpSection/NeedHelpSection.js +5 -2
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +2 -0
- package/src/lib/components/NetworkPicker/NetworkPicker.js +2 -0
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.cjs +2 -0
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.js +2 -0
- package/src/lib/components/NetworkPicker/components/Network/Network.cjs +2 -0
- package/src/lib/components/NetworkPicker/components/Network/Network.js +2 -0
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.cjs +2 -0
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.js +2 -0
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +2 -0
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +2 -0
- package/src/lib/components/OverlayCard/OverlayCard.cjs +2 -0
- package/src/lib/components/OverlayCard/OverlayCard.js +2 -0
- package/src/lib/components/Portal/Portal.cjs +2 -0
- package/src/lib/components/Portal/Portal.js +2 -0
- package/src/lib/components/SocialSignIn/SocialSignIn.cjs +2 -0
- package/src/lib/components/SocialSignIn/SocialSignIn.js +2 -0
- package/src/lib/components/SyncPasskeyFlow/SyncPasskeyFlow.cjs +18 -5
- package/src/lib/components/SyncPasskeyFlow/SyncPasskeyFlow.js +18 -5
- package/src/lib/components/Textarea/Textarea.d.ts +2 -0
- package/src/lib/components/Textarea/Textarea.types.d.ts +14 -0
- package/src/lib/components/Textarea/index.d.ts +1 -0
- package/src/lib/components/Tooltip/Tooltip.cjs +2 -0
- package/src/lib/components/Tooltip/Tooltip.js +2 -0
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +2 -0
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +2 -0
- package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.cjs +2 -0
- package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.js +2 -0
- package/src/lib/components/UserAddress/UserAddress.cjs +2 -0
- package/src/lib/components/UserAddress/UserAddress.js +2 -0
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +2 -0
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +2 -0
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.cjs +2 -0
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.js +2 -0
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +1 -0
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +15 -14
- package/src/lib/context/DynamicContext/DynamicContext.js +16 -15
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.d.ts +2 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs +2 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.js +2 -0
- package/src/lib/context/QrCodeContext/QrCodeContext.cjs +2 -0
- package/src/lib/context/QrCodeContext/QrCodeContext.js +2 -0
- package/src/lib/context/SendBalanceContext/SendBalanceContext.cjs +2 -0
- package/src/lib/context/SendBalanceContext/SendBalanceContext.js +2 -0
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +2 -0
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +2 -0
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.cjs +2 -0
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.js +2 -0
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
- package/src/lib/data/api.cjs +37 -0
- package/src/lib/data/api.d.ts +20 -0
- package/src/lib/data/api.js +36 -2
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +2 -0
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +2 -0
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +2 -0
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.cjs +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.js +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/PasskeyInfoHelper/PasskeyInfoHelper.cjs +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/PasskeyInfoHelper/PasskeyInfoHelper.js +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/Item/Item.cjs +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/Item/Item.js +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletMoreInfoContent/WalletMoreInfoContent.cjs +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletMoreInfoContent/WalletMoreInfoContent.js +2 -0
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.cjs +2 -0
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.js +2 -0
- package/src/lib/layout/DynamicAuthLayout/WalletProgressStepper/WalletProgressStepper.cjs +2 -0
- package/src/lib/layout/DynamicAuthLayout/WalletProgressStepper/WalletProgressStepper.js +2 -0
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.cjs +7 -1
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.js +7 -1
- package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.cjs +2 -0
- package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.js +2 -0
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.cjs +2 -0
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.js +2 -0
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.cjs +2 -0
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.js +2 -0
- package/src/lib/locale/en/translation.cjs +123 -5
- package/src/lib/locale/en/translation.d.ts +122 -4
- package/src/lib/locale/en/translation.js +123 -5
- package/src/lib/main.global.cjs +1 -1
- package/src/lib/main.global.js +1 -1
- package/src/lib/modals/DynamicAuthModal/DynamicAuthModal.cjs +2 -0
- package/src/lib/modals/DynamicAuthModal/DynamicAuthModal.js +2 -0
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.cjs +2 -0
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.js +2 -0
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +2 -0
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +2 -0
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.types.d.ts +2 -7
- package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.cjs +17 -8
- package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.d.ts +1 -1
- package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.js +17 -8
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +5 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +5 -2
- package/src/lib/modals/UserFieldEditorModal/UserFieldEditorModal.cjs +2 -0
- package/src/lib/modals/UserFieldEditorModal/UserFieldEditorModal.js +2 -0
- package/src/lib/shared/assets/circle-locker.cjs +53 -0
- package/src/lib/shared/assets/circle-locker.js +29 -0
- package/src/lib/shared/assets/index.d.ts +2 -0
- package/src/lib/shared/assets/turnkey.cjs +79 -0
- package/src/lib/shared/assets/turnkey.js +55 -0
- package/src/lib/shared/utils/functions/detectBrowser/detectBrowser.cjs +5 -5
- package/src/lib/shared/utils/functions/detectBrowser/detectBrowser.d.ts +1 -1
- package/src/lib/shared/utils/functions/detectBrowser/detectBrowser.js +5 -5
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/functions/removeElementById/index.d.ts +1 -0
- package/src/lib/utils/functions/removeElementById/removeElementById.cjs +16 -0
- package/src/lib/utils/functions/removeElementById/removeElementById.d.ts +1 -0
- package/src/lib/utils/functions/removeElementById/removeElementById.js +12 -0
- 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/useDynamicLayoutData/useDynamicLayoutData.cjs +9 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +9 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +35 -18
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +35 -18
- package/src/lib/utils/hooks/useIsFirstRender/useIsFirstRender.cjs +6 -4
- package/src/lib/utils/hooks/useIsFirstRender/useIsFirstRender.js +7 -5
- package/src/lib/utils/hooks/usePasskeyRecovery/index.d.ts +1 -0
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +67 -0
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.d.ts +4 -0
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +63 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs +5 -1
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js +5 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +2 -0
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +2 -0
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.cjs +13 -1
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.js +14 -2
- package/src/lib/views/AccountExistsView/AccountExistsView.cjs +2 -0
- package/src/lib/views/AccountExistsView/AccountExistsView.js +2 -0
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +2 -0
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +2 -0
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +2 -0
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +2 -0
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +2 -0
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +2 -0
- package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +2 -0
- package/src/lib/views/CollectUserDataView/UserDataFields/index.js +2 -0
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs +2 -0
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js +2 -0
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +2 -0
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +2 -0
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +2 -0
- package/src/lib/views/EmailUpdate/EmailUpdate.js +2 -0
- package/src/lib/views/EmailVerification/EmailVerification.cjs +2 -0
- package/src/lib/views/EmailVerification/EmailVerification.js +2 -0
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +2 -0
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +2 -0
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +2 -0
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +2 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +2 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +2 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +2 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +2 -0
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +2 -0
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +2 -0
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSignInSection.cjs +2 -0
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSignInSection.js +2 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +2 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +2 -0
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +2 -0
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +2 -0
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +2 -0
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +2 -0
- package/src/lib/views/NoAccess/NoAccess.cjs +2 -0
- package/src/lib/views/NoAccess/NoAccess.js +2 -0
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +2 -0
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +2 -0
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.cjs +2 -0
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.js +2 -0
- package/src/lib/views/Passkey/PasskeyDeviceIcon/PasskeyDeviceIcon.cjs +90 -0
- package/src/lib/views/Passkey/PasskeyDeviceIcon/PasskeyDeviceIcon.d.ts +2 -0
- package/src/lib/views/Passkey/PasskeyDeviceIcon/PasskeyDeviceIcon.js +86 -0
- package/src/lib/views/Passkey/PasskeyDeviceIcon/index.d.ts +1 -0
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +133 -0
- package/src/lib/views/{PasskeyIntroView → Passkey/PasskeyIntroView}/PasskeyIntroView.d.ts +1 -1
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +129 -0
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +136 -0
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.d.ts +2 -0
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +132 -0
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/index.d.ts +1 -0
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.cjs +108 -0
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.d.ts +2 -0
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.js +104 -0
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/index.d.ts +1 -0
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.cjs +115 -0
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.d.ts +2 -0
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.js +111 -0
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/index.d.ts +1 -0
- package/src/lib/views/Passkey/PasskeyRecovery/constants.cjs +9 -0
- package/src/lib/views/Passkey/PasskeyRecovery/constants.d.ts +2 -0
- package/src/lib/views/Passkey/PasskeyRecovery/constants.js +4 -0
- package/src/lib/views/Passkey/PasskeyRecovery/index.d.ts +3 -0
- package/src/lib/views/Passkey/index.d.ts +2 -0
- package/src/lib/views/Passkey/passkey.types.d.ts +8 -0
- package/src/lib/views/Passkey/utils/passkeyRecovery/index.d.ts +1 -0
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +141 -0
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.d.ts +26 -0
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +134 -0
- package/src/lib/views/PendingConnectView/PendingConnectView.cjs +2 -0
- package/src/lib/views/PendingConnectView/PendingConnectView.js +2 -0
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +2 -0
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +2 -0
- package/src/lib/views/QrCodeView/QRCode.cjs +2 -0
- package/src/lib/views/QrCodeView/QRCode.js +2 -0
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +2 -0
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +2 -0
- package/src/lib/views/QrCodeView/QrCodeView.cjs +2 -0
- package/src/lib/views/QrCodeView/QrCodeView.js +2 -0
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +2 -0
- package/src/lib/views/SendBalanceView/SendBalanceView.js +2 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.cjs +2 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.js +2 -0
- package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +2 -0
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +2 -0
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.cjs +2 -0
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.js +2 -0
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +2 -0
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +2 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.cjs +2 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.js +2 -0
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.cjs +2 -0
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.js +2 -0
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.cjs +2 -0
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.js +2 -0
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.cjs +2 -0
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.js +2 -0
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +2 -0
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +2 -0
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +2 -0
- package/src/lib/views/WalletLockedView/WalletLockedView.js +2 -0
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +2 -0
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +2 -0
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +2 -0
- package/src/lib/views/WalletUsedView/WalletUsedView.js +2 -0
- package/src/lib/views/viewToComponentMap.cjs +7 -1
- package/src/lib/views/viewToComponentMap.js +7 -1
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.cjs +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.js +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.cjs +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.js +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCard/DynamicBridgeWalletCard.cjs +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCard/DynamicBridgeWalletCard.js +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetEmptyCard/DynamicBridgeWidgetEmptyCard.cjs +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetEmptyCard/DynamicBridgeWidgetEmptyCard.js +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.cjs +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.js +2 -0
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs +4 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.d.ts +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js +4 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.d.ts +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js +2 -1
- package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/DynamicWidget.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +11 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +11 -2
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.js +2 -0
- 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/DynamicWidgetHeader.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/DynamicWidgetVariants.cjs +10 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/DynamicWidgetVariants.js +10 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/DynamicWidgetViews.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/DynamicWidgetViews.d.ts +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/DynamicWidgetViews.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.js +2 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.d.ts +2 -13
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +2 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.cjs +9 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +17 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.js +4 -0
- package/src/lib/widgets/DynamicWidget/helpers/getPasskeyProviderFromUserAgent.cjs +33 -0
- package/src/lib/widgets/DynamicWidget/helpers/getPasskeyProviderFromUserAgent.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/helpers/getPasskeyProviderFromUserAgent.js +29 -0
- package/src/lib/widgets/DynamicWidget/helpers/getTimeSince.cjs +64 -0
- package/src/lib/widgets/DynamicWidget/helpers/getTimeSince.d.ts +4 -0
- package/src/lib/widgets/DynamicWidget/helpers/getTimeSince.js +60 -0
- package/src/lib/widgets/DynamicWidget/helpers/helpers.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/helpers/helpers.d.ts +2 -1
- package/src/lib/widgets/DynamicWidget/helpers/helpers.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.js +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.js +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.js +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +2 -0
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +2 -0
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.cjs +96 -0
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.js +92 -0
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs +98 -0
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.d.ts +7 -0
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js +94 -0
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +2 -0
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +2 -0
- package/src/lib/widgets/DynamicWidget/views/index.d.ts +1 -0
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.cjs +2 -0
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.js +2 -0
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.cjs +0 -156
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.js +0 -152
- /package/src/lib/views/{PasskeyIntroView → Passkey/PasskeyIntroView}/index.d.ts +0 -0
- /package/src/lib/views/{PasskeyIntroView → Passkey}/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.cjs +0 -0
- /package/src/lib/views/{PasskeyIntroView → Passkey}/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.d.ts +0 -0
- /package/src/lib/views/{PasskeyIntroView → Passkey}/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.js +0 -0
- /package/src/lib/views/{PasskeyIntroView → Passkey}/utils/createEmbeddedWalletWithPasskey/index.d.ts +0 -0
- /package/src/lib/views/{PasskeyIntroView → Passkey}/utils/findPasskeyEmailWalletConnector/findPasskeyEmailWalletConnector.cjs +0 -0
- /package/src/lib/views/{PasskeyIntroView → Passkey}/utils/findPasskeyEmailWalletConnector/findPasskeyEmailWalletConnector.d.ts +0 -0
- /package/src/lib/views/{PasskeyIntroView → Passkey}/utils/findPasskeyEmailWalletConnector/findPasskeyEmailWalletConnector.js +0 -0
- /package/src/lib/views/{PasskeyIntroView → Passkey}/utils/findPasskeyEmailWalletConnector/index.d.ts +0 -0
- /package/src/lib/views/{PasskeyIntroView → Passkey}/utils/index.d.ts +0 -0
|
@@ -10,7 +10,7 @@ var decodeJwt = require('../../../shared/utils/functions/decodeJwt/decodeJwt.cjs
|
|
|
10
10
|
require('@dynamic-labs/iconic');
|
|
11
11
|
require('@dynamic-labs/wallet-connector-core');
|
|
12
12
|
require('react/jsx-runtime');
|
|
13
|
-
require('../../../shared/logger.cjs');
|
|
13
|
+
var logger = require('../../../shared/logger.cjs');
|
|
14
14
|
require('@dynamic-labs/wallet-book');
|
|
15
15
|
require('../../constants/colors.cjs');
|
|
16
16
|
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
@@ -39,7 +39,7 @@ const useEmbeddedWallet = () => {
|
|
|
39
39
|
return isEmbeddedWalletPresent.isEmbeddedWalletPresent(jwt);
|
|
40
40
|
};
|
|
41
41
|
const createEmbeddedWallet = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
-
var _a
|
|
42
|
+
var _a;
|
|
43
43
|
const jwt = (_a = getAuthToken.getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
44
44
|
if (!jwt) {
|
|
45
45
|
throw new Error('User is not logged in');
|
|
@@ -50,21 +50,46 @@ const useEmbeddedWallet = () => {
|
|
|
50
50
|
const userWaletsCredentials = getUserWalletsFromVerifiedCredentials.getUserWalletsFromVerifiedCredentials(jwt);
|
|
51
51
|
// if user doesn't have a wallet yet, show the passkey view to create an embedded wallet
|
|
52
52
|
if (!(userWaletsCredentials === null || userWaletsCredentials === void 0 ? void 0 : userWaletsCredentials.length)) {
|
|
53
|
-
|
|
54
|
-
setView('passkey-intro');
|
|
55
|
-
return new Promise((resolve, reject) => {
|
|
56
|
-
internalEvents.current.once('embeddedWalletCreated', (wallet) => resolve(wallet));
|
|
57
|
-
internalEvents.current.once('embeddedWalletFailed', (error) => reject(error));
|
|
58
|
-
});
|
|
53
|
+
return startEmbeddedWalletCreationFlow();
|
|
59
54
|
}
|
|
60
55
|
internalSetShowAuthFlow(false);
|
|
61
56
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(jwt);
|
|
62
|
-
const turnkeyWallet = findTurnkeyWallet.findTurnkeyWallet(wallets);
|
|
63
57
|
// if user logged in with MM for example, just continue the flow
|
|
64
58
|
if (!embeddedWalletVerifiedCredential) {
|
|
65
59
|
return Promise.resolve(primaryWallet);
|
|
66
60
|
}
|
|
61
|
+
// if user already has embedded wallet, returns it
|
|
62
|
+
return returnEmbeddedWallet(jwt, embeddedWalletVerifiedCredential);
|
|
63
|
+
}), [
|
|
64
|
+
internalEvents,
|
|
65
|
+
internalSetShowAuthFlow,
|
|
66
|
+
onboardingOnlyJwt,
|
|
67
|
+
projectSettings,
|
|
68
|
+
setPrimaryWalletId,
|
|
69
|
+
setView,
|
|
70
|
+
wallets,
|
|
71
|
+
]);
|
|
72
|
+
const startEmbeddedWalletCreationFlow = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
internalSetShowAuthFlow(true);
|
|
74
|
+
setView('passkey-intro');
|
|
75
|
+
return new Promise((resolve, reject) => {
|
|
76
|
+
internalEvents.current.once('embeddedWalletCreated', (wallet) => resolve(wallet));
|
|
77
|
+
internalEvents.current.once('embeddedWalletFailed', (error) => {
|
|
78
|
+
// when creating a passkey, if user cancels the passkey modal more than once
|
|
79
|
+
// it will throw this DOMException, but we don't want to let user to have access
|
|
80
|
+
// to the app before they've a passkey correctly setup
|
|
81
|
+
if (error instanceof DOMException && error.name === 'NotAllowedError') {
|
|
82
|
+
logger.logger.error('User cancelled the passkey creation.', error);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
reject(error);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
const returnEmbeddedWallet = (jwt, embeddedWalletVerifiedCredential) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
+
var _b, _c, _d;
|
|
67
91
|
const decodedJwt = decodeJwt.decodeJwt(jwt);
|
|
92
|
+
const turnkeyWallet = findTurnkeyWallet.findTurnkeyWallet(wallets);
|
|
68
93
|
// if user already has embedded wallet, set it as primary wallet
|
|
69
94
|
if (decodedJwt) {
|
|
70
95
|
(_b = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _b === void 0 ? void 0 : _b.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
@@ -78,15 +103,7 @@ const useEmbeddedWallet = () => {
|
|
|
78
103
|
id: embeddedWalletVerifiedCredential.id,
|
|
79
104
|
};
|
|
80
105
|
return Promise.resolve(passkeyWallet);
|
|
81
|
-
})
|
|
82
|
-
internalEvents,
|
|
83
|
-
internalSetShowAuthFlow,
|
|
84
|
-
onboardingOnlyJwt,
|
|
85
|
-
projectSettings,
|
|
86
|
-
setPrimaryWalletId,
|
|
87
|
-
setView,
|
|
88
|
-
wallets,
|
|
89
|
-
]);
|
|
106
|
+
});
|
|
90
107
|
return {
|
|
91
108
|
createEmbeddedWallet,
|
|
92
109
|
userHasEmbeddedWallet,
|
|
@@ -6,7 +6,7 @@ import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.j
|
|
|
6
6
|
import '@dynamic-labs/iconic';
|
|
7
7
|
import '@dynamic-labs/wallet-connector-core';
|
|
8
8
|
import 'react/jsx-runtime';
|
|
9
|
-
import '../../../shared/logger.js';
|
|
9
|
+
import { logger } from '../../../shared/logger.js';
|
|
10
10
|
import '@dynamic-labs/wallet-book';
|
|
11
11
|
import '../../constants/colors.js';
|
|
12
12
|
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
@@ -35,7 +35,7 @@ const useEmbeddedWallet = () => {
|
|
|
35
35
|
return isEmbeddedWalletPresent(jwt);
|
|
36
36
|
};
|
|
37
37
|
const createEmbeddedWallet = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
-
var _a
|
|
38
|
+
var _a;
|
|
39
39
|
const jwt = (_a = getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
40
40
|
if (!jwt) {
|
|
41
41
|
throw new Error('User is not logged in');
|
|
@@ -46,21 +46,46 @@ const useEmbeddedWallet = () => {
|
|
|
46
46
|
const userWaletsCredentials = getUserWalletsFromVerifiedCredentials(jwt);
|
|
47
47
|
// if user doesn't have a wallet yet, show the passkey view to create an embedded wallet
|
|
48
48
|
if (!(userWaletsCredentials === null || userWaletsCredentials === void 0 ? void 0 : userWaletsCredentials.length)) {
|
|
49
|
-
|
|
50
|
-
setView('passkey-intro');
|
|
51
|
-
return new Promise((resolve, reject) => {
|
|
52
|
-
internalEvents.current.once('embeddedWalletCreated', (wallet) => resolve(wallet));
|
|
53
|
-
internalEvents.current.once('embeddedWalletFailed', (error) => reject(error));
|
|
54
|
-
});
|
|
49
|
+
return startEmbeddedWalletCreationFlow();
|
|
55
50
|
}
|
|
56
51
|
internalSetShowAuthFlow(false);
|
|
57
52
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials(jwt);
|
|
58
|
-
const turnkeyWallet = findTurnkeyWallet(wallets);
|
|
59
53
|
// if user logged in with MM for example, just continue the flow
|
|
60
54
|
if (!embeddedWalletVerifiedCredential) {
|
|
61
55
|
return Promise.resolve(primaryWallet);
|
|
62
56
|
}
|
|
57
|
+
// if user already has embedded wallet, returns it
|
|
58
|
+
return returnEmbeddedWallet(jwt, embeddedWalletVerifiedCredential);
|
|
59
|
+
}), [
|
|
60
|
+
internalEvents,
|
|
61
|
+
internalSetShowAuthFlow,
|
|
62
|
+
onboardingOnlyJwt,
|
|
63
|
+
projectSettings,
|
|
64
|
+
setPrimaryWalletId,
|
|
65
|
+
setView,
|
|
66
|
+
wallets,
|
|
67
|
+
]);
|
|
68
|
+
const startEmbeddedWalletCreationFlow = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
+
internalSetShowAuthFlow(true);
|
|
70
|
+
setView('passkey-intro');
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
internalEvents.current.once('embeddedWalletCreated', (wallet) => resolve(wallet));
|
|
73
|
+
internalEvents.current.once('embeddedWalletFailed', (error) => {
|
|
74
|
+
// when creating a passkey, if user cancels the passkey modal more than once
|
|
75
|
+
// it will throw this DOMException, but we don't want to let user to have access
|
|
76
|
+
// to the app before they've a passkey correctly setup
|
|
77
|
+
if (error instanceof DOMException && error.name === 'NotAllowedError') {
|
|
78
|
+
logger.error('User cancelled the passkey creation.', error);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
reject(error);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
const returnEmbeddedWallet = (jwt, embeddedWalletVerifiedCredential) => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
var _b, _c, _d;
|
|
63
87
|
const decodedJwt = decodeJwt(jwt);
|
|
88
|
+
const turnkeyWallet = findTurnkeyWallet(wallets);
|
|
64
89
|
// if user already has embedded wallet, set it as primary wallet
|
|
65
90
|
if (decodedJwt) {
|
|
66
91
|
(_b = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _b === void 0 ? void 0 : _b.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
@@ -74,15 +99,7 @@ const useEmbeddedWallet = () => {
|
|
|
74
99
|
id: embeddedWalletVerifiedCredential.id,
|
|
75
100
|
};
|
|
76
101
|
return Promise.resolve(passkeyWallet);
|
|
77
|
-
})
|
|
78
|
-
internalEvents,
|
|
79
|
-
internalSetShowAuthFlow,
|
|
80
|
-
onboardingOnlyJwt,
|
|
81
|
-
projectSettings,
|
|
82
|
-
setPrimaryWalletId,
|
|
83
|
-
setView,
|
|
84
|
-
wallets,
|
|
85
|
-
]);
|
|
102
|
+
});
|
|
86
103
|
return {
|
|
87
104
|
createEmbeddedWallet,
|
|
88
105
|
userHasEmbeddedWallet,
|
|
@@ -6,10 +6,12 @@ var React = require('react');
|
|
|
6
6
|
|
|
7
7
|
const useIsFirstRender = () => {
|
|
8
8
|
const isFirst = React.useRef(true);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
// force it to be false on second client render only avoiding SSR issues
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
if (isFirst.current) {
|
|
12
|
+
isFirst.current = false;
|
|
13
|
+
}
|
|
14
|
+
}, []);
|
|
13
15
|
return isFirst.current;
|
|
14
16
|
};
|
|
15
17
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { useRef } from 'react';
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
const useIsFirstRender = () => {
|
|
4
4
|
const isFirst = useRef(true);
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
// force it to be false on second client render only avoiding SSR issues
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (isFirst.current) {
|
|
8
|
+
isFirst.current = false;
|
|
9
|
+
}
|
|
10
|
+
}, []);
|
|
9
11
|
return isFirst.current;
|
|
10
12
|
};
|
|
11
13
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { usePasskeyRecovery } from './usePasskeyRecovery';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
8
|
+
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
9
|
+
var constants = require('../../../views/Passkey/PasskeyRecovery/constants.cjs');
|
|
10
|
+
require('@dynamic-labs/sdk-api');
|
|
11
|
+
require('../../../shared/logger.cjs');
|
|
12
|
+
require('@dynamic-labs/iconic');
|
|
13
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
14
|
+
require('react/jsx-runtime');
|
|
15
|
+
require('@dynamic-labs/wallet-book');
|
|
16
|
+
require('../../constants/colors.cjs');
|
|
17
|
+
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
18
|
+
require('viem');
|
|
19
|
+
require('@dynamic-labs/utils');
|
|
20
|
+
require('../../../shared/consts/index.cjs');
|
|
21
|
+
require('@dynamic-labs/multi-wallet');
|
|
22
|
+
var getAuthToken = require('../../functions/getAuthToken/getAuthToken.cjs');
|
|
23
|
+
var removeElementById = require('../../functions/removeElementById/removeElementById.cjs');
|
|
24
|
+
var isTurnkeyEnabled = require('../../functions/isTurnkeyEnabled/isTurnkeyEnabled.cjs');
|
|
25
|
+
var useEmbeddedWallet = require('../useEmbeddedWallet/useEmbeddedWallet.cjs');
|
|
26
|
+
|
|
27
|
+
// Hook exposed to customers and used internally to trigger passkey recovery
|
|
28
|
+
const usePasskeyRecovery = () => {
|
|
29
|
+
const { projectSettings, onboardingOnlyJwt, setPrimaryWalletId, wallets, internalSetShowAuthFlow, internalEvents, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
30
|
+
const { userHasEmbeddedWallet } = useEmbeddedWallet.useEmbeddedWallet();
|
|
31
|
+
const { setView } = ViewContext.useViewContext();
|
|
32
|
+
const initPasskeyRecoveryProcess = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
const jwt = getAuthToken.getAuthToken();
|
|
34
|
+
if (!jwt) {
|
|
35
|
+
throw new Error('User is not logged in');
|
|
36
|
+
}
|
|
37
|
+
if (!isTurnkeyEnabled.isTurnkeyEnabled(projectSettings)) {
|
|
38
|
+
throw new Error('Passkey embedded wallet is not enabled. Go to the dashboard and make sure to have both Turnkey/Passkey Embedded wallets and at least one EVM network enabled. Also, check if EthereumWalletConnectors is in the DynamicContextProvider > settings > walletConnectors.');
|
|
39
|
+
}
|
|
40
|
+
if (!userHasEmbeddedWallet()) {
|
|
41
|
+
throw new Error('Passkey embedded wallet not found');
|
|
42
|
+
}
|
|
43
|
+
// if user clicks twice to recover,
|
|
44
|
+
// since the iframe can still exist it can't be recreated by Turnkey
|
|
45
|
+
// and throws an error
|
|
46
|
+
removeElementById.removeElementById(constants.iframeContainerId);
|
|
47
|
+
internalSetShowAuthFlow(true);
|
|
48
|
+
setView('passkey-recovery-start');
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
internalEvents.current.once('passkeyRecoveryCompleted', (wallet) => resolve(wallet));
|
|
51
|
+
internalEvents.current.once('passkeyRecoveryFailed', (error) => reject(error));
|
|
52
|
+
});
|
|
53
|
+
}), [
|
|
54
|
+
internalEvents,
|
|
55
|
+
internalSetShowAuthFlow,
|
|
56
|
+
onboardingOnlyJwt,
|
|
57
|
+
projectSettings,
|
|
58
|
+
setPrimaryWalletId,
|
|
59
|
+
setView,
|
|
60
|
+
wallets,
|
|
61
|
+
]);
|
|
62
|
+
return {
|
|
63
|
+
initPasskeyRecoveryProcess,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
exports.usePasskeyRecovery = usePasskeyRecovery;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
4
|
+
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
5
|
+
import { iframeContainerId } from '../../../views/Passkey/PasskeyRecovery/constants.js';
|
|
6
|
+
import '@dynamic-labs/sdk-api';
|
|
7
|
+
import '../../../shared/logger.js';
|
|
8
|
+
import '@dynamic-labs/iconic';
|
|
9
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
10
|
+
import 'react/jsx-runtime';
|
|
11
|
+
import '@dynamic-labs/wallet-book';
|
|
12
|
+
import '../../constants/colors.js';
|
|
13
|
+
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
14
|
+
import 'viem';
|
|
15
|
+
import '@dynamic-labs/utils';
|
|
16
|
+
import '../../../shared/consts/index.js';
|
|
17
|
+
import '@dynamic-labs/multi-wallet';
|
|
18
|
+
import { getAuthToken } from '../../functions/getAuthToken/getAuthToken.js';
|
|
19
|
+
import { removeElementById } from '../../functions/removeElementById/removeElementById.js';
|
|
20
|
+
import { isTurnkeyEnabled } from '../../functions/isTurnkeyEnabled/isTurnkeyEnabled.js';
|
|
21
|
+
import { useEmbeddedWallet } from '../useEmbeddedWallet/useEmbeddedWallet.js';
|
|
22
|
+
|
|
23
|
+
// Hook exposed to customers and used internally to trigger passkey recovery
|
|
24
|
+
const usePasskeyRecovery = () => {
|
|
25
|
+
const { projectSettings, onboardingOnlyJwt, setPrimaryWalletId, wallets, internalSetShowAuthFlow, internalEvents, } = useInternalDynamicContext();
|
|
26
|
+
const { userHasEmbeddedWallet } = useEmbeddedWallet();
|
|
27
|
+
const { setView } = useViewContext();
|
|
28
|
+
const initPasskeyRecoveryProcess = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
const jwt = getAuthToken();
|
|
30
|
+
if (!jwt) {
|
|
31
|
+
throw new Error('User is not logged in');
|
|
32
|
+
}
|
|
33
|
+
if (!isTurnkeyEnabled(projectSettings)) {
|
|
34
|
+
throw new Error('Passkey embedded wallet is not enabled. Go to the dashboard and make sure to have both Turnkey/Passkey Embedded wallets and at least one EVM network enabled. Also, check if EthereumWalletConnectors is in the DynamicContextProvider > settings > walletConnectors.');
|
|
35
|
+
}
|
|
36
|
+
if (!userHasEmbeddedWallet()) {
|
|
37
|
+
throw new Error('Passkey embedded wallet not found');
|
|
38
|
+
}
|
|
39
|
+
// if user clicks twice to recover,
|
|
40
|
+
// since the iframe can still exist it can't be recreated by Turnkey
|
|
41
|
+
// and throws an error
|
|
42
|
+
removeElementById(iframeContainerId);
|
|
43
|
+
internalSetShowAuthFlow(true);
|
|
44
|
+
setView('passkey-recovery-start');
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
internalEvents.current.once('passkeyRecoveryCompleted', (wallet) => resolve(wallet));
|
|
47
|
+
internalEvents.current.once('passkeyRecoveryFailed', (error) => reject(error));
|
|
48
|
+
});
|
|
49
|
+
}), [
|
|
50
|
+
internalEvents,
|
|
51
|
+
internalSetShowAuthFlow,
|
|
52
|
+
onboardingOnlyJwt,
|
|
53
|
+
projectSettings,
|
|
54
|
+
setPrimaryWalletId,
|
|
55
|
+
setView,
|
|
56
|
+
wallets,
|
|
57
|
+
]);
|
|
58
|
+
return {
|
|
59
|
+
initPasskeyRecoveryProcess,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export { usePasskeyRecovery };
|
|
@@ -46,6 +46,7 @@ const userFieldsSchema = yup.object().shape({
|
|
|
46
46
|
kdaWallet: yup.string(),
|
|
47
47
|
lastName: yup.string(),
|
|
48
48
|
ltcWallet: yup.string(),
|
|
49
|
+
metadata: yup.object(),
|
|
49
50
|
newsletterNotification: yup.boolean(),
|
|
50
51
|
phoneNumber: yup.string(),
|
|
51
52
|
tShirtSize: yup.string(),
|
|
@@ -60,10 +61,13 @@ const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
|
60
61
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
|
|
61
62
|
return React.useCallback((userFields, userEnvironmentId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
62
63
|
var _a, _b, _c;
|
|
64
|
+
// `stripUnknown: true` will automatically strip out any values in the metadata object
|
|
65
|
+
// so we need to pull out the metadata object here and then re-add it after stripping unknown fields
|
|
66
|
+
const { metadata } = userFields;
|
|
63
67
|
const validatedUserFields = yield userFieldsSchema.validate(userFields, {
|
|
64
68
|
stripUnknown: validationSchemaStripUnknown,
|
|
65
69
|
});
|
|
66
|
-
const updateUserProfileResponse = yield api.updateUserProfileFields(jwtToken, userEnvironmentId || environmentId, validatedUserFields);
|
|
70
|
+
const updateUserProfileResponse = yield api.updateUserProfileFields(jwtToken, userEnvironmentId || environmentId, Object.assign(Object.assign({}, validatedUserFields), { metadata }));
|
|
67
71
|
// check if decoded JWT still somehow has missing fields, we can't proceed if it does
|
|
68
72
|
const decodedJwt = decodeJwt.decodeJwt(updateUserProfileResponse.jwt);
|
|
69
73
|
const missingFields = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : [];
|
|
@@ -42,6 +42,7 @@ const userFieldsSchema = object().shape({
|
|
|
42
42
|
kdaWallet: string(),
|
|
43
43
|
lastName: string(),
|
|
44
44
|
ltcWallet: string(),
|
|
45
|
+
metadata: object(),
|
|
45
46
|
newsletterNotification: boolean(),
|
|
46
47
|
phoneNumber: string(),
|
|
47
48
|
tShirtSize: string(),
|
|
@@ -56,10 +57,13 @@ const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
|
56
57
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
57
58
|
return useCallback((userFields, userEnvironmentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
59
|
var _a, _b, _c;
|
|
60
|
+
// `stripUnknown: true` will automatically strip out any values in the metadata object
|
|
61
|
+
// so we need to pull out the metadata object here and then re-add it after stripping unknown fields
|
|
62
|
+
const { metadata } = userFields;
|
|
59
63
|
const validatedUserFields = yield userFieldsSchema.validate(userFields, {
|
|
60
64
|
stripUnknown: validationSchemaStripUnknown,
|
|
61
65
|
});
|
|
62
|
-
const updateUserProfileResponse = yield updateUserProfileFields(jwtToken, userEnvironmentId || environmentId, validatedUserFields);
|
|
66
|
+
const updateUserProfileResponse = yield updateUserProfileFields(jwtToken, userEnvironmentId || environmentId, Object.assign(Object.assign({}, validatedUserFields), { metadata }));
|
|
63
67
|
// check if decoded JWT still somehow has missing fields, we can't proceed if it does
|
|
64
68
|
const decodedJwt = decodeJwt(updateUserProfileResponse.jwt);
|
|
65
69
|
const missingFields = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : [];
|
|
@@ -54,8 +54,10 @@ require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
|
54
54
|
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
55
55
|
require('qrcode');
|
|
56
56
|
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
57
|
+
require('i18next');
|
|
57
58
|
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
58
59
|
require('../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
|
|
60
|
+
require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
59
61
|
var SignMessageConfirmationModal = require('../../../modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs');
|
|
60
62
|
var TransactionConfirmationModal = require('../../../modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs');
|
|
61
63
|
|
|
@@ -50,8 +50,10 @@ import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
|
50
50
|
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
51
51
|
import 'qrcode';
|
|
52
52
|
import '../../../context/LoadingContext/LoadingContext.js';
|
|
53
|
+
import 'i18next';
|
|
53
54
|
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
54
55
|
import '../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
56
|
+
import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
55
57
|
import { SignMessageConfirmationModal } from '../../../modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js';
|
|
56
58
|
import { TransactionConfirmationModal } from '../../../modals/TransactionConfirmationModal/TransactionConfirmationModal.js';
|
|
57
59
|
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
require('@dynamic-labs/sdk-api');
|
|
8
|
-
require('../../../shared/logger.cjs');
|
|
8
|
+
var logger = require('../../../shared/logger.cjs');
|
|
9
9
|
require('@dynamic-labs/iconic');
|
|
10
10
|
require('@dynamic-labs/wallet-connector-core');
|
|
11
11
|
require('react/jsx-runtime');
|
|
@@ -31,7 +31,19 @@ const useWalletsConnectionState = (linkedWallets) => {
|
|
|
31
31
|
connectedWalletsMap: {},
|
|
32
32
|
didLoad: false,
|
|
33
33
|
});
|
|
34
|
+
const lastCallTimestamp = React.useRef(0);
|
|
34
35
|
const computeConnectedStateForWallets = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
if (!linkedWallets.length)
|
|
37
|
+
return;
|
|
38
|
+
const callTimestamp = new Date().getTime();
|
|
39
|
+
const diffFromLastCall = callTimestamp - lastCallTimestamp.current;
|
|
40
|
+
lastCallTimestamp.current = callTimestamp;
|
|
41
|
+
// getConnectedAccounts trigger accountChanged event for Phantom EVM wallets
|
|
42
|
+
// which causes a loop of calls to this function
|
|
43
|
+
if (diffFromLastCall < 1000) {
|
|
44
|
+
logger.logger.warn('computeConnectedStateForWallets: skipping due too many calls.');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
35
47
|
const connectedWalletsMap = {};
|
|
36
48
|
yield Promise.all(linkedWallets.map((wallet) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
37
49
|
connectedWalletsMap[wallet.id] = yield isWalletConnected.isWalletConnected(wallet);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
2
|
-
import { useReducer, useCallback } from 'react';
|
|
2
|
+
import { useReducer, useRef, useCallback } from 'react';
|
|
3
3
|
import '@dynamic-labs/sdk-api';
|
|
4
|
-
import '../../../shared/logger.js';
|
|
4
|
+
import { logger } from '../../../shared/logger.js';
|
|
5
5
|
import '@dynamic-labs/iconic';
|
|
6
6
|
import '@dynamic-labs/wallet-connector-core';
|
|
7
7
|
import 'react/jsx-runtime';
|
|
@@ -27,7 +27,19 @@ const useWalletsConnectionState = (linkedWallets) => {
|
|
|
27
27
|
connectedWalletsMap: {},
|
|
28
28
|
didLoad: false,
|
|
29
29
|
});
|
|
30
|
+
const lastCallTimestamp = useRef(0);
|
|
30
31
|
const computeConnectedStateForWallets = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
if (!linkedWallets.length)
|
|
33
|
+
return;
|
|
34
|
+
const callTimestamp = new Date().getTime();
|
|
35
|
+
const diffFromLastCall = callTimestamp - lastCallTimestamp.current;
|
|
36
|
+
lastCallTimestamp.current = callTimestamp;
|
|
37
|
+
// getConnectedAccounts trigger accountChanged event for Phantom EVM wallets
|
|
38
|
+
// which causes a loop of calls to this function
|
|
39
|
+
if (diffFromLastCall < 1000) {
|
|
40
|
+
logger.warn('computeConnectedStateForWallets: skipping due too many calls.');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
31
43
|
const connectedWalletsMap = {};
|
|
32
44
|
yield Promise.all(linkedWallets.map((wallet) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
45
|
connectedWalletsMap[wallet.id] = yield isWalletConnected(wallet);
|
|
@@ -45,6 +45,7 @@ require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
|
45
45
|
require('../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
46
46
|
require('qrcode');
|
|
47
47
|
require('../../context/LoadingContext/LoadingContext.cjs');
|
|
48
|
+
require('i18next');
|
|
48
49
|
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
49
50
|
require('yup');
|
|
50
51
|
require('../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
|
|
@@ -54,6 +55,7 @@ require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
|
54
55
|
require('formik');
|
|
55
56
|
require('../../components/IconButton/IconButton.cjs');
|
|
56
57
|
require('../../components/Alert/Alert.cjs');
|
|
58
|
+
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
57
59
|
var useMutation = require('../../utils/hooks/useMutation/useMutation.cjs');
|
|
58
60
|
var useFindSocialIcon = require('../../utils/hooks/useFindSocialIcon/useFindSocialIcon.cjs');
|
|
59
61
|
var IconListTile = require('../../components/IconListTile/IconListTile.cjs');
|
|
@@ -41,6 +41,7 @@ import '../../context/CaptchaContext/CaptchaContext.js';
|
|
|
41
41
|
import '../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
42
42
|
import 'qrcode';
|
|
43
43
|
import '../../context/LoadingContext/LoadingContext.js';
|
|
44
|
+
import 'i18next';
|
|
44
45
|
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
45
46
|
import 'yup';
|
|
46
47
|
import '../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
@@ -50,6 +51,7 @@ import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
|
50
51
|
import 'formik';
|
|
51
52
|
import '../../components/IconButton/IconButton.js';
|
|
52
53
|
import '../../components/Alert/Alert.js';
|
|
54
|
+
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
53
55
|
import { useMutation } from '../../utils/hooks/useMutation/useMutation.js';
|
|
54
56
|
import { useFindSocialIcon } from '../../utils/hooks/useFindSocialIcon/useFindSocialIcon.js';
|
|
55
57
|
import { IconListTile } from '../../components/IconListTile/IconListTile.js';
|
|
@@ -46,6 +46,7 @@ require('../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
|
46
46
|
require('qrcode');
|
|
47
47
|
require('../../context/LoadingContext/LoadingContext.cjs');
|
|
48
48
|
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
49
|
+
require('i18next');
|
|
49
50
|
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
50
51
|
require('yup');
|
|
51
52
|
require('../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
|
|
@@ -55,6 +56,7 @@ require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
|
55
56
|
require('formik');
|
|
56
57
|
require('../../components/IconButton/IconButton.cjs');
|
|
57
58
|
require('../../components/Alert/Alert.cjs');
|
|
59
|
+
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
58
60
|
require('../../components/Popper/Popper/Popper.cjs');
|
|
59
61
|
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
60
62
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
@@ -42,6 +42,7 @@ import '../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
|
42
42
|
import 'qrcode';
|
|
43
43
|
import '../../context/LoadingContext/LoadingContext.js';
|
|
44
44
|
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
45
|
+
import 'i18next';
|
|
45
46
|
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
46
47
|
import 'yup';
|
|
47
48
|
import '../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
@@ -51,6 +52,7 @@ import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
|
51
52
|
import 'formik';
|
|
52
53
|
import '../../components/IconButton/IconButton.js';
|
|
53
54
|
import '../../components/Alert/Alert.js';
|
|
55
|
+
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
54
56
|
import '../../components/Popper/Popper/Popper.js';
|
|
55
57
|
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
56
58
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
@@ -49,6 +49,7 @@ require('../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
|
49
49
|
require('qrcode');
|
|
50
50
|
require('../../context/LoadingContext/LoadingContext.cjs');
|
|
51
51
|
var AuthProviderIcon = require('../../components/AuthProviderIcon/AuthProviderIcon.cjs');
|
|
52
|
+
require('i18next');
|
|
52
53
|
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
53
54
|
require('yup');
|
|
54
55
|
var ErrorContainer = require('../../components/ErrorContainer/ErrorContainer.cjs');
|
|
@@ -59,6 +60,7 @@ require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
|
59
60
|
require('formik');
|
|
60
61
|
require('../../components/IconButton/IconButton.cjs');
|
|
61
62
|
require('../../components/Alert/Alert.cjs');
|
|
63
|
+
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
62
64
|
var TextButton = require('../../components/TextButton/TextButton.cjs');
|
|
63
65
|
require('../../components/Popper/Popper/Popper.cjs');
|
|
64
66
|
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
@@ -45,6 +45,7 @@ import '../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
|
45
45
|
import 'qrcode';
|
|
46
46
|
import '../../context/LoadingContext/LoadingContext.js';
|
|
47
47
|
import { AuthProviderIcon } from '../../components/AuthProviderIcon/AuthProviderIcon.js';
|
|
48
|
+
import 'i18next';
|
|
48
49
|
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
49
50
|
import 'yup';
|
|
50
51
|
import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.js';
|
|
@@ -55,6 +56,7 @@ import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
|
55
56
|
import 'formik';
|
|
56
57
|
import '../../components/IconButton/IconButton.js';
|
|
57
58
|
import '../../components/Alert/Alert.js';
|
|
59
|
+
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
58
60
|
import { TextButton } from '../../components/TextButton/TextButton.js';
|
|
59
61
|
import '../../components/Popper/Popper/Popper.js';
|
|
60
62
|
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
@@ -44,6 +44,7 @@ require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
|
44
44
|
require('../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
45
45
|
require('qrcode');
|
|
46
46
|
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
47
|
+
require('i18next');
|
|
47
48
|
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
48
49
|
require('yup');
|
|
49
50
|
require('../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
|
|
@@ -55,6 +56,7 @@ var index = require('../UserDataFields/index.cjs');
|
|
|
55
56
|
var Button = require('../../../components/Button/Button.cjs');
|
|
56
57
|
require('../../../components/IconButton/IconButton.cjs');
|
|
57
58
|
require('../../../components/Alert/Alert.cjs');
|
|
59
|
+
require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
58
60
|
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
59
61
|
require('../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
60
62
|
require('../../../components/Popper/Popper/Popper.cjs');
|
|
@@ -40,6 +40,7 @@ import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
|
40
40
|
import '../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
41
41
|
import 'qrcode';
|
|
42
42
|
import '../../../context/LoadingContext/LoadingContext.js';
|
|
43
|
+
import 'i18next';
|
|
43
44
|
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
44
45
|
import 'yup';
|
|
45
46
|
import '../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
@@ -51,6 +52,7 @@ import { UserDataFields } from '../UserDataFields/index.js';
|
|
|
51
52
|
import { Button } from '../../../components/Button/Button.js';
|
|
52
53
|
import '../../../components/IconButton/IconButton.js';
|
|
53
54
|
import '../../../components/Alert/Alert.js';
|
|
55
|
+
import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
54
56
|
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
55
57
|
import '../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
56
58
|
import '../../../components/Popper/Popper/Popper.js';
|