@dynamic-labs/sdk-react-core 0.17.0-RC.6 → 0.17.0-RC.7
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 +3 -3
- package/package.js +3 -3
- package/package.json +9 -6
- package/src/index.cjs +2 -0
- package/src/index.d.ts +2 -1
- package/src/index.js +1 -0
- package/src/lib/Main.cjs +1 -0
- package/src/lib/Main.js +1 -0
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.cjs +1 -0
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.js +1 -0
- package/src/lib/components/AnimatePresence/AnimatePresence.cjs +1 -0
- package/src/lib/components/AnimatePresence/AnimatePresence.js +1 -0
- package/src/lib/components/Divider/Divider.cjs +1 -0
- package/src/lib/components/Divider/Divider.js +1 -0
- package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +1 -1
- package/src/lib/components/IconWithSpinner/IconWithSpinner.js +1 -1
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +3 -2
- package/src/lib/components/NetworkPicker/NetworkPicker.d.ts +3 -2
- package/src/lib/components/NetworkPicker/NetworkPicker.js +3 -2
- package/src/lib/components/NetworkPicker/components/ActionList/ActionList.cjs +1 -0
- package/src/lib/components/NetworkPicker/components/ActionList/ActionList.js +1 -0
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.cjs +6 -4
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.d.ts +2 -2
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.js +6 -4
- package/src/lib/components/NetworkPicker/components/Network/Network.cjs +1 -0
- package/src/lib/components/NetworkPicker/components/Network/Network.js +1 -0
- package/src/lib/components/NetworkPicker/components/NetworkAction/NetworkAction.d.ts +4 -4
- package/src/lib/components/NetworkPicker/components/NetworkControl/NetworkControl.d.ts +2 -2
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.cjs +1 -0
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.js +1 -0
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +1 -0
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +1 -0
- package/src/lib/components/OverlayCard/OverlayCard.cjs +1 -0
- package/src/lib/components/OverlayCard/OverlayCard.js +1 -0
- package/src/lib/components/Portal/Portal.cjs +1 -1
- package/src/lib/components/Portal/Portal.js +1 -1
- package/src/lib/components/Tooltip/Tooltip.cjs +1 -0
- package/src/lib/components/Tooltip/Tooltip.js +1 -0
- package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.cjs +1 -0
- package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.js +1 -0
- package/src/lib/components/UserAddress/UserAddress.cjs +4 -6
- package/src/lib/components/UserAddress/UserAddress.js +5 -7
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +1 -0
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +1 -0
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.cjs +1 -0
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.js +1 -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 +25 -6
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +7 -5
- package/src/lib/context/DynamicContext/DynamicContext.js +25 -6
- package/src/lib/context/DynamicContext/hooks/useNameService/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useNameService/useNameService.cjs +82 -0
- package/src/lib/context/DynamicContext/hooks/useNameService/useNameService.d.ts +11 -0
- package/src/lib/context/DynamicContext/hooks/useNameService/useNameService.js +78 -0
- package/src/lib/context/DynamicContext/hooks/useNameService/useNameService.types.d.ts +4 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs +1 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.js +1 -0
- package/src/lib/context/DynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext.js +2 -1
- package/src/lib/context/FundingContext/FundingContext.cjs +69 -0
- package/src/lib/context/FundingContext/FundingContext.d.ts +14 -0
- package/src/lib/context/FundingContext/FundingContext.js +63 -0
- package/src/lib/context/FundingContext/index.d.ts +1 -0
- package/src/lib/context/QrCodeContext/QrCodeContext.cjs +1 -0
- package/src/lib/context/QrCodeContext/QrCodeContext.js +1 -0
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +1 -0
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +1 -0
- package/src/lib/data/api.cjs +14 -0
- package/src/lib/data/api.d.ts +8 -1
- package/src/lib/data/api.js +14 -1
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +1 -0
- package/src/lib/layout/DynamicAuthLayout/Footer/Footer.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/Footer/Footer.js +1 -0
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/Item/Item.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/Item/Item.js +1 -0
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +1 -0
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletListFooterContent.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletListFooterContent.js +1 -0
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.js +1 -0
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +1 -0
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +1 -0
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +1 -0
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +1 -0
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +1 -0
- package/src/lib/shared/types/index.d.ts +3 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/localStorage.cjs +3 -1
- package/src/lib/utils/constants/localStorage.d.ts +1 -0
- package/src/lib/utils/constants/localStorage.js +3 -2
- package/src/lib/utils/functions/getNetwork/getNetwork.cjs +1 -6
- package/src/lib/utils/functions/getNetwork/getNetwork.d.ts +1 -1
- package/src/lib/utils/functions/getNetwork/getNetwork.js +1 -6
- package/src/lib/utils/functions/getWalletVerifiedCredential/getWalletVerifiedCredential.cjs +1 -1
- package/src/lib/utils/functions/getWalletVerifiedCredential/getWalletVerifiedCredential.d.ts +1 -2
- package/src/lib/utils/functions/getWalletVerifiedCredential/getWalletVerifiedCredential.js +1 -1
- package/src/lib/utils/functions/isProgrammableNetworkSwitchSupported/isProgrammableNetworkSwitchSupported.cjs +16 -1
- package/src/lib/utils/functions/isProgrammableNetworkSwitchSupported/isProgrammableNetworkSwitchSupported.d.ts +6 -0
- package/src/lib/utils/functions/isProgrammableNetworkSwitchSupported/isProgrammableNetworkSwitchSupported.js +16 -1
- package/src/lib/utils/functions/isSupportedNetwork/isSupportedNetwork.cjs +6 -1
- package/src/lib/utils/functions/isSupportedNetwork/isSupportedNetwork.d.ts +1 -1
- package/src/lib/utils/functions/isSupportedNetwork/isSupportedNetwork.js +6 -1
- package/src/lib/utils/functions/parseWalletLinks/parseWalletLinks.cjs +1 -0
- package/src/lib/utils/functions/parseWalletLinks/parseWalletLinks.d.ts +2 -0
- package/src/lib/utils/functions/parseWalletLinks/parseWalletLinks.js +1 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs +50 -24
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.d.ts +4 -4
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js +50 -24
- package/src/lib/utils/hooks/useRpcProviders/useRpcProviders.cjs +6 -5
- package/src/lib/utils/hooks/useRpcProviders/useRpcProviders.d.ts +2 -2
- package/src/lib/utils/hooks/useRpcProviders/useRpcProviders.js +8 -7
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs +17 -19
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.d.ts +8 -6
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js +17 -19
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +25 -24
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +25 -24
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +2 -2
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +2 -4
- package/src/lib/utils/hooks/useWallets/useWallets.d.ts +2 -1
- package/src/lib/utils/hooks/useWallets/useWallets.js +2 -4
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +1 -0
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +1 -0
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +5 -3
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +5 -3
- package/src/lib/views/CollectUserDataView/{UserDataForm/UserDataForm.cjs → OnboardingUserDataForm/OnboardingUserDataForm.cjs} +4 -4
- package/src/lib/views/CollectUserDataView/{UserDataForm/UserDataForm.d.ts → OnboardingUserDataForm/OnboardingUserDataForm.d.ts} +1 -1
- package/src/lib/views/CollectUserDataView/{UserDataForm/UserDataForm.js → OnboardingUserDataForm/OnboardingUserDataForm.js} +4 -4
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/index.d.ts +1 -0
- package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +1 -0
- package/src/lib/views/CollectUserDataView/UserDataFields/index.js +1 -0
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs +3 -2
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js +3 -2
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +1 -0
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +1 -0
- 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 +2 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +2 -1
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +1 -0
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +1 -0
- package/src/lib/views/LoginWithEmailView/components/ListItemButton/ListItemButton.cjs +1 -0
- package/src/lib/views/LoginWithEmailView/components/ListItemButton/ListItemButton.js +1 -0
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs +1 -0
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js +1 -0
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +1 -0
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +1 -0
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +13 -6
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +13 -6
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +11 -5
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +11 -5
- package/src/lib/views/NoAccess/NoAccess.cjs +1 -0
- package/src/lib/views/NoAccess/NoAccess.js +1 -0
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +1 -0
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +1 -0
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.cjs +1 -0
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.js +1 -0
- package/src/lib/views/PendingConnectView/PendingConnectView.cjs +1 -0
- package/src/lib/views/PendingConnectView/PendingConnectView.js +1 -0
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +1 -0
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +1 -0
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +1 -0
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +1 -0
- package/src/lib/views/QrCodeView/QrCodeView.cjs +1 -0
- package/src/lib/views/QrCodeView/QrCodeView.js +1 -0
- package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +1 -0
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +1 -0
- package/src/lib/views/WalletList/SearchInstead/SearchInstead.cjs +1 -0
- package/src/lib/views/WalletList/SearchInstead/SearchInstead.js +1 -0
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +1 -0
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +1 -0
- package/src/lib/views/WalletList/data.cjs +2 -1
- package/src/lib/views/WalletList/data.d.ts +1 -1
- package/src/lib/views/WalletList/data.js +2 -1
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +1 -0
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +1 -0
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -0
- package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -0
- package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/DynamicWidget.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +4 -4
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +4 -4
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenuWrapper/DotsMenuWrapper.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenuWrapper/DotsMenuWrapper.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +10 -6
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +10 -6
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetPrompts/DynamicWidgetPrompts.cjs +3 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetPrompts/DynamicWidgetPrompts.js +3 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetSwitcher/DynamicWidgetSwitcher.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetSwitcher/DynamicWidgetSwitcher.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +2 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +2 -1
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.js +1 -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/context/DynamicWidgetContext.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +1 -0
- package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/hooks/useFetchNameService/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/hooks/useFetchNameService/useFetchNameService.cjs +22 -0
- package/src/lib/widgets/DynamicWidget/hooks/useFetchNameService/useFetchNameService.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/hooks/useFetchNameService/useFetchNameService.js +18 -0
- package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +52 -0
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +48 -0
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +1 -0
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +1 -0
- package/src/lib/widgets/DynamicWidget/views/IndexView/IndexView.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/views/IndexView/IndexView.js +1 -0
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +1 -0
- package/src/lib/widgets/FundingWidget/FundingWidget.cjs +10 -0
- package/src/lib/widgets/FundingWidget/FundingWidget.d.ts +2 -0
- package/src/lib/widgets/FundingWidget/FundingWidget.js +6 -0
- package/src/lib/widgets/FundingWidget/index.d.ts +1 -0
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.cjs +54 -0
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.d.ts +5 -0
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.js +49 -0
- package/src/lib/widgets/FundingWidget/views/FundWalletView/index.d.ts +1 -0
- package/src/lib/widgets/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWallets/utils/getMagicLinkApiKeyFromProviders/getMagicLinkApiKeyFromProviders.cjs +0 -12
- package/src/lib/utils/hooks/useWallets/utils/getMagicLinkApiKeyFromProviders/getMagicLinkApiKeyFromProviders.d.ts +0 -2
- package/src/lib/utils/hooks/useWallets/utils/getMagicLinkApiKeyFromProviders/getMagicLinkApiKeyFromProviders.js +0 -8
- package/src/lib/utils/hooks/useWallets/utils/getMagicLinkApiKeyFromProviders/index.d.ts +0 -1
- package/src/lib/utils/hooks/useWallets/utils/index.d.ts +0 -1
- package/src/lib/views/CollectUserDataView/UserDataForm/index.d.ts +0 -1
|
@@ -16,6 +16,7 @@ require('../../utils/constants/colors.cjs');
|
|
|
16
16
|
var index = require('../../shared/consts/index.cjs');
|
|
17
17
|
var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
18
18
|
require('../../config/ApiEndpoint.cjs');
|
|
19
|
+
require('@dynamic-labs/rpc-providers');
|
|
19
20
|
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
20
21
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
21
22
|
var useElementById = require('../../utils/hooks/useElementById/useElementById.cjs');
|
|
@@ -12,6 +12,7 @@ import '../../utils/constants/colors.js';
|
|
|
12
12
|
import { tooltipZIndex } from '../../shared/consts/index.js';
|
|
13
13
|
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
14
14
|
import '../../config/ApiEndpoint.js';
|
|
15
|
+
import '@dynamic-labs/rpc-providers';
|
|
15
16
|
import '../../context/DynamicContext/DynamicContext.js';
|
|
16
17
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
17
18
|
import { useElementById } from '../../utils/hooks/useElementById/useElementById.js';
|
|
@@ -13,6 +13,7 @@ require('@dynamic-labs/iconic');
|
|
|
13
13
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
14
14
|
require('../../../utils/constants/colors.cjs');
|
|
15
15
|
require('../../../shared/consts/index.cjs');
|
|
16
|
+
require('@dynamic-labs/rpc-providers');
|
|
16
17
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
17
18
|
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
18
19
|
var useResizeObserver = require('../../../utils/hooks/useResizeObserver/useResizeObserver.cjs');
|
|
@@ -9,6 +9,7 @@ import '@dynamic-labs/iconic';
|
|
|
9
9
|
import '../../../context/ViewContext/ViewContext.js';
|
|
10
10
|
import '../../../utils/constants/colors.js';
|
|
11
11
|
import '../../../shared/consts/index.js';
|
|
12
|
+
import '@dynamic-labs/rpc-providers';
|
|
12
13
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
13
14
|
import '../../../context/ErrorContext/ErrorContext.js';
|
|
14
15
|
import { useResizeObserver } from '../../../utils/hooks/useResizeObserver/useResizeObserver.js';
|
|
@@ -12,17 +12,15 @@ require('react');
|
|
|
12
12
|
var shortenWalletAddress = require('../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
13
13
|
require('../../utils/constants/colors.cjs');
|
|
14
14
|
require('../../shared/consts/index.cjs');
|
|
15
|
+
var useFetchNameService = require('../../widgets/DynamicWidget/hooks/useFetchNameService/useFetchNameService.cjs');
|
|
15
16
|
var StatusDot = require('../StatusDot/StatusDot.cjs');
|
|
16
17
|
var Typography = require('../Typography/Typography.cjs');
|
|
17
18
|
|
|
18
19
|
const UserAddress = ({ userProfile }) => {
|
|
19
20
|
var _a;
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
? userProfile.ens.name
|
|
24
|
-
: walletAddress;
|
|
25
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: 'user-address__container' }, { children: [jsxRuntime.jsx(StatusDot.StatusDot, { variant: 'green', containerClassName: 'user-address__status-dot' }), userAddress && (jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'numbers_big', color: 'primary', className: 'user-address' }, { children: userAddress })))] })));
|
|
21
|
+
const walletAddress = (_a = userProfile === null || userProfile === void 0 ? void 0 : userProfile.verifiedCredentials.find((verifiedCredential) => verifiedCredential.id === userProfile.lastVerifiedCredentialId)) === null || _a === void 0 ? void 0 : _a.address;
|
|
22
|
+
const nameService = useFetchNameService.useFetchNameService(walletAddress);
|
|
23
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: 'user-address__container' }, { children: [jsxRuntime.jsx(StatusDot.StatusDot, { variant: 'green', containerClassName: 'user-address__status-dot' }), (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'numbers_big', color: 'primary', className: 'user-address' }, { children: nameService.name })), jsxRuntime.jsx("div", { className: 'dynamic-widget-wallet-header__seperator' }), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'numbers_medium', color: 'secondary', className: 'user-address' }, { children: shortenWalletAddress.shortenWalletAddress(walletAddress, 3, 3) }))] })) : (jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'numbers_big', color: 'primary', className: 'user-address' }, { children: shortenWalletAddress.shortenWalletAddress(walletAddress, 4, 4) })))] })));
|
|
26
24
|
};
|
|
27
25
|
|
|
28
26
|
exports.UserAddress = UserAddress;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import '@dynamic-labs/sdk-api';
|
|
3
3
|
import '../../shared/logger.js';
|
|
4
4
|
import '@dynamic-labs/iconic';
|
|
@@ -8,17 +8,15 @@ import 'react';
|
|
|
8
8
|
import { shortenWalletAddress } from '../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
9
9
|
import '../../utils/constants/colors.js';
|
|
10
10
|
import '../../shared/consts/index.js';
|
|
11
|
+
import { useFetchNameService } from '../../widgets/DynamicWidget/hooks/useFetchNameService/useFetchNameService.js';
|
|
11
12
|
import { StatusDot } from '../StatusDot/StatusDot.js';
|
|
12
13
|
import { Typography } from '../Typography/Typography.js';
|
|
13
14
|
|
|
14
15
|
const UserAddress = ({ userProfile }) => {
|
|
15
16
|
var _a;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
? userProfile.ens.name
|
|
20
|
-
: walletAddress;
|
|
21
|
-
return (jsxs("div", Object.assign({ className: 'user-address__container' }, { children: [jsx(StatusDot, { variant: 'green', containerClassName: 'user-address__status-dot' }), userAddress && (jsx(Typography, Object.assign({ variant: 'numbers_big', color: 'primary', className: 'user-address' }, { children: userAddress })))] })));
|
|
17
|
+
const walletAddress = (_a = userProfile === null || userProfile === void 0 ? void 0 : userProfile.verifiedCredentials.find((verifiedCredential) => verifiedCredential.id === userProfile.lastVerifiedCredentialId)) === null || _a === void 0 ? void 0 : _a.address;
|
|
18
|
+
const nameService = useFetchNameService(walletAddress);
|
|
19
|
+
return (jsxs("div", Object.assign({ className: 'user-address__container' }, { children: [jsx(StatusDot, { variant: 'green', containerClassName: 'user-address__status-dot' }), (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? (jsxs(Fragment, { children: [jsx(Typography, Object.assign({ variant: 'numbers_big', color: 'primary', className: 'user-address' }, { children: nameService.name })), jsx("div", { className: 'dynamic-widget-wallet-header__seperator' }), jsx(Typography, Object.assign({ variant: 'numbers_medium', color: 'secondary', className: 'user-address' }, { children: shortenWalletAddress(walletAddress, 3, 3) }))] })) : (jsx(Typography, Object.assign({ variant: 'numbers_big', color: 'primary', className: 'user-address' }, { children: shortenWalletAddress(walletAddress, 4, 4) })))] })));
|
|
22
20
|
};
|
|
23
21
|
|
|
24
22
|
export { UserAddress };
|
|
@@ -21,6 +21,7 @@ require('../../../Transition/ZoomTransition/ZoomTransition.cjs');
|
|
|
21
21
|
require('../../../Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
22
22
|
require('../../../Transition/OpacityTransition/OpacityTransition.cjs');
|
|
23
23
|
require('../../../../config/ApiEndpoint.cjs');
|
|
24
|
+
require('@dynamic-labs/rpc-providers');
|
|
24
25
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
25
26
|
require('ethers');
|
|
26
27
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
@@ -17,6 +17,7 @@ import '../../../Transition/ZoomTransition/ZoomTransition.js';
|
|
|
17
17
|
import '../../../Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
18
18
|
import '../../../Transition/OpacityTransition/OpacityTransition.js';
|
|
19
19
|
import '../../../../config/ApiEndpoint.js';
|
|
20
|
+
import '@dynamic-labs/rpc-providers';
|
|
20
21
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
21
22
|
import 'ethers';
|
|
22
23
|
import '../../../../context/MockContext/MockContext.js';
|
|
@@ -21,6 +21,7 @@ require('../../../Transition/ZoomTransition/ZoomTransition.cjs');
|
|
|
21
21
|
require('../../../Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
22
22
|
require('../../../Transition/OpacityTransition/OpacityTransition.cjs');
|
|
23
23
|
require('../../../../config/ApiEndpoint.cjs');
|
|
24
|
+
require('@dynamic-labs/rpc-providers');
|
|
24
25
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
25
26
|
require('ethers');
|
|
26
27
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
@@ -17,6 +17,7 @@ import '../../../Transition/ZoomTransition/ZoomTransition.js';
|
|
|
17
17
|
import '../../../Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
18
18
|
import '../../../Transition/OpacityTransition/OpacityTransition.js';
|
|
19
19
|
import '../../../../config/ApiEndpoint.js';
|
|
20
|
+
import '@dynamic-labs/rpc-providers';
|
|
20
21
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
21
22
|
import 'ethers';
|
|
22
23
|
import '../../../../context/MockContext/MockContext.js';
|
package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs
CHANGED
|
@@ -25,6 +25,7 @@ require('../../../Transition/ZoomTransition/ZoomTransition.cjs');
|
|
|
25
25
|
require('../../../Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
26
26
|
require('../../../Transition/OpacityTransition/OpacityTransition.cjs');
|
|
27
27
|
var api = require('../../../../data/api.cjs');
|
|
28
|
+
require('@dynamic-labs/rpc-providers');
|
|
28
29
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
29
30
|
require('ethers');
|
|
30
31
|
require('../../../../context/MockContext/MockContext.cjs');
|
package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js
CHANGED
|
@@ -21,6 +21,7 @@ import '../../../Transition/ZoomTransition/ZoomTransition.js';
|
|
|
21
21
|
import '../../../Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
22
22
|
import '../../../Transition/OpacityTransition/OpacityTransition.js';
|
|
23
23
|
import { unlinkOAuth, verifyOAuth } from '../../../../data/api.js';
|
|
24
|
+
import '@dynamic-labs/rpc-providers';
|
|
24
25
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
25
26
|
import 'ethers';
|
|
26
27
|
import '../../../../context/MockContext/MockContext.js';
|
|
@@ -54,17 +54,28 @@ require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
|
54
54
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
55
55
|
require('../../components/IconButton/IconButton.cjs');
|
|
56
56
|
var useGlobalLoading = require('../../shared/utils/hooks/useGlobalLoading/useGlobalLoading.cjs');
|
|
57
|
+
var FundingContext = require('../FundingContext/FundingContext.cjs');
|
|
58
|
+
require('@dynamic-labs/wallet-book');
|
|
59
|
+
require('@dynamic-labs/utils');
|
|
60
|
+
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
61
|
+
require('qrcode');
|
|
62
|
+
require('../../views/CollectUserDataView/fieldsConfig.cjs');
|
|
63
|
+
require('../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
|
|
64
|
+
require('formik');
|
|
65
|
+
require('yup');
|
|
66
|
+
var FundingWidget = require('../../widgets/FundingWidget/FundingWidget.cjs');
|
|
57
67
|
var helpers = require('./helpers.cjs');
|
|
58
68
|
var validators = require('./validators.cjs');
|
|
59
69
|
var useCustomerCallbacks = require('./useCustomerCallbacks/useCustomerCallbacks.cjs');
|
|
60
70
|
var useCustomerAuthFlowCallbacks = require('./useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs');
|
|
61
71
|
var useEmailLoginState = require('./hooks/useEmailLoginState/useEmailLoginState.cjs');
|
|
62
72
|
var useDisplayOrderState = require('./hooks/useDisplayOrderState/useDisplayOrderState.cjs');
|
|
73
|
+
var useNameService = require('./hooks/useNameService/useNameService.cjs');
|
|
63
74
|
|
|
64
75
|
const EMPTY_INITIAL_USER = undefined;
|
|
65
76
|
const DynamicContext = React.createContext(undefined);
|
|
66
77
|
const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, accessDeniedMessageSecondary, apiBaseUrl, appLogoUrl = 'https://demo.dynamic.xyz/assets/dynamic-logo.svg', appName = 'Dynamic Example', cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, initialAuthenticationMode = 'connect-and-sign', vendorCredentials, debugError = false, displayTermsOfService = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, eventsCallbacks, evmNetworks, walletsFilter, logLevel = 'WARN', multiWallet: multiWallet$1 = false, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, magicLinkConfig, }, children, theme, }) => {
|
|
67
|
-
var _a, _b;
|
|
78
|
+
var _a, _b, _c;
|
|
68
79
|
logger.logger.setLogLevel(logLevel);
|
|
69
80
|
multiWallet.logger.setLogLevel(logLevel);
|
|
70
81
|
ApiEndpoint.setBaseUrl((_a = process.env.DYNAMIC_API_BASE_URL) !== null && _a !== void 0 ? _a : apiBaseUrl);
|
|
@@ -84,7 +95,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
84
95
|
const { configurations: serverNetworkConfigurations, removeLsNetworks } = useFetchNetworkConfigurations.useFetchNetworkConfigurations({
|
|
85
96
|
authToken: getAuthToken.getAuthToken(),
|
|
86
97
|
environmentId,
|
|
87
|
-
|
|
98
|
+
evmNetworks,
|
|
88
99
|
});
|
|
89
100
|
const { imageUserInAccessList, imageUserNotInAccessList, displayName, appLogo, } = (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) || {};
|
|
90
101
|
appLogoUrl = appLogo || appLogoUrl;
|
|
@@ -128,6 +139,10 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
128
139
|
projectSettings,
|
|
129
140
|
user,
|
|
130
141
|
});
|
|
142
|
+
const { getNameService, removeConnectedNameService } = useNameService.useNameService({
|
|
143
|
+
authToken: (_b = getAuthToken.getAuthToken()) !== null && _b !== void 0 ? _b : onboardingOnlyJwt,
|
|
144
|
+
currentWallet: primaryWallet !== null && primaryWallet !== void 0 ? primaryWallet : connectedWallet,
|
|
145
|
+
});
|
|
131
146
|
const walletForUserFacingContext = authMode === 'connect-and-sign' || user ? primaryWallet : connectedWallet;
|
|
132
147
|
useSyncPrimaryWallet.useSyncPrimaryWallet({
|
|
133
148
|
multiWalletWidgetState,
|
|
@@ -141,7 +156,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
141
156
|
clearOphanedWalletConnectSessions,
|
|
142
157
|
]);
|
|
143
158
|
const handleLogOut = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
144
|
-
var
|
|
159
|
+
var _d, _e;
|
|
145
160
|
clearAllWalletConnectSessions();
|
|
146
161
|
const jwt = getAuthToken.getAuthToken();
|
|
147
162
|
if (jwt && user) {
|
|
@@ -151,7 +166,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
151
166
|
for (const connector of walletConnectors) {
|
|
152
167
|
yield connector.endSession();
|
|
153
168
|
}
|
|
154
|
-
(
|
|
169
|
+
(_d = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector) === null || _d === void 0 ? void 0 : _d.endSession();
|
|
155
170
|
setShowAuthFlow(false);
|
|
156
171
|
setMultiWalletWidgetState('idle');
|
|
157
172
|
removeAuthTokenAndUser();
|
|
@@ -160,7 +175,8 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
160
175
|
setOnboardingOnlyJwt(undefined);
|
|
161
176
|
removeConnectedInfo();
|
|
162
177
|
clearWalletStates();
|
|
163
|
-
(
|
|
178
|
+
removeConnectedNameService();
|
|
179
|
+
(_e = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onLogout) === null || _e === void 0 ? void 0 : _e.call(eventsCallbacks, user);
|
|
164
180
|
}), [
|
|
165
181
|
clearAllWalletConnectSessions,
|
|
166
182
|
user,
|
|
@@ -170,6 +186,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
170
186
|
setConnectedWallet,
|
|
171
187
|
removeLsNetworks,
|
|
172
188
|
removeConnectedInfo,
|
|
189
|
+
removeConnectedNameService,
|
|
173
190
|
clearWalletStates,
|
|
174
191
|
eventsCallbacks,
|
|
175
192
|
environmentId,
|
|
@@ -276,6 +293,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
276
293
|
displayTermsOfService,
|
|
277
294
|
environmentId,
|
|
278
295
|
eventsCallbacks,
|
|
296
|
+
getNameService,
|
|
279
297
|
handleLogOut,
|
|
280
298
|
handleUnlinkWallet,
|
|
281
299
|
isAuthenticated,
|
|
@@ -364,6 +382,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
364
382
|
displayTermsOfService,
|
|
365
383
|
environmentId,
|
|
366
384
|
eventsCallbacks,
|
|
385
|
+
getNameService,
|
|
367
386
|
handleLogOut,
|
|
368
387
|
handleUnlinkWallet,
|
|
369
388
|
isAuthenticated,
|
|
@@ -446,7 +465,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
446
465
|
setShowDynamicUserProfile(true);
|
|
447
466
|
}
|
|
448
467
|
}, [multiWallet$1, multiWalletWidgetState, showDynamicUserProfile, user]);
|
|
449
|
-
return (jsxRuntime.jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, Object.assign({ customerTheme: parseTheme.parseTheme(theme, ((
|
|
468
|
+
return (jsxRuntime.jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, Object.assign({ customerTheme: parseTheme.parseTheme(theme, ((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _c === void 0 ? void 0 : _c.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design }, { children: jsxRuntime.jsx(LoadingContext.LoadingContextProvider, { children: jsxRuntime.jsx(ViewContext.ViewContextProvider, Object.assign({ loginWithEmail: loginWithEmail }, { children: jsxRuntime.jsx(QrCodeContext.QrCodeContextProvider, { children: jsxRuntime.jsx(EmailVerificationContext.EmailVerificationContextProvider, { children: jsxRuntime.jsx(ErrorContext.ErrorContextProvider, { children: jsxRuntime.jsx(DynamicWidgetContext.DynamicWidgetContextProvider, { children: jsxRuntime.jsx(CaptchaContext.CaptchaContextProvider, { children: jsxRuntime.jsxs(FundingContext.FundingContextProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(Toolkit.Toolkit, {}), jsxRuntime.jsx(FundingWidget.FundingWidget, {}), confirmationModal, children] }) }) }) }) }) }) })) }) })) })));
|
|
450
469
|
};
|
|
451
470
|
|
|
452
471
|
exports.DynamicContext = DynamicContext;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { VendorCredentials, WalletUiUtils, MagicLinkConfig } from '@dynamic-labs/multi-wallet';
|
|
3
3
|
import { WalletConnector, FetchPublicAddressOpts } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
-
import { DynamicJwt, ProjectSettings } from '@dynamic-labs/sdk-api';
|
|
4
|
+
import { DynamicJwt, NameServiceData, ProjectSettings } from '@dynamic-labs/sdk-api';
|
|
5
5
|
import { LogLevel } from '@dynamic-labs/logger';
|
|
6
|
+
import { EvmNetwork, NetworkConfigurationMap } from '@dynamic-labs/types';
|
|
6
7
|
import { WalletOption, UserProfile, Wallet, MultiWalletWidgetState, AccountSwitchState, AwaitingSignatureState, ChainToWalletMap, AuthModeType, DynamicRPCProviders, DynamicEventsCallbacks } from '../../shared';
|
|
7
8
|
import { ThemeData, ThemeSetting } from '../ThemeContext';
|
|
8
9
|
import { MultiWalletWidgetStateSetter } from '../../utils/hooks/multiWallet';
|
|
@@ -33,6 +34,7 @@ export interface IDynamicContext {
|
|
|
33
34
|
displayTermsOfService: boolean;
|
|
34
35
|
environmentId: string;
|
|
35
36
|
eventsCallbacks?: DynamicEventsCallbacks;
|
|
37
|
+
getNameService: (address?: string) => Promise<NameServiceData | undefined>;
|
|
36
38
|
handleLogOut: () => Promise<void>;
|
|
37
39
|
handleUnlinkWallet(walletId: string): Promise<void>;
|
|
38
40
|
isAuthenticated: boolean;
|
|
@@ -43,7 +45,7 @@ export interface IDynamicContext {
|
|
|
43
45
|
loginWithEmail: boolean;
|
|
44
46
|
multiWallet: boolean;
|
|
45
47
|
multiWalletWidgetState: MultiWalletWidgetState;
|
|
46
|
-
network: number | undefined;
|
|
48
|
+
network: number | string | undefined;
|
|
47
49
|
networkConfigurations: NetworkConfigurationMap | undefined;
|
|
48
50
|
newToWeb3WalletChainMap: ChainToWalletMap;
|
|
49
51
|
notInTheListImageUrl?: string;
|
|
@@ -67,9 +69,9 @@ export interface IDynamicContext {
|
|
|
67
69
|
setIsVerifying: Dispatch<SetStateAction<boolean>>;
|
|
68
70
|
setLogInWithEmail: Dispatch<SetStateAction<boolean>>;
|
|
69
71
|
setMultiWalletWidgetState: MultiWalletWidgetStateSetter;
|
|
70
|
-
setNetwork: Dispatch<SetStateAction<number | undefined>>;
|
|
72
|
+
setNetwork: Dispatch<SetStateAction<number | string | undefined>>;
|
|
71
73
|
setOnboardingOnlyJwt: Dispatch<SetStateAction<string | undefined>>;
|
|
72
|
-
setPrimaryWallet: (walletId: string) => void
|
|
74
|
+
setPrimaryWallet: (walletId: string) => Promise<void>;
|
|
73
75
|
setPrimaryWalletId: (walletId: string) => void;
|
|
74
76
|
setQrcodeUri: Dispatch<SetStateAction<string>>;
|
|
75
77
|
setSelectedWalletConnector: (connector: WalletConnector | null) => void;
|
|
@@ -50,17 +50,28 @@ import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
|
50
50
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
51
51
|
import '../../components/IconButton/IconButton.js';
|
|
52
52
|
import { useGlobalLoading } from '../../shared/utils/hooks/useGlobalLoading/useGlobalLoading.js';
|
|
53
|
+
import { FundingContextProvider } from '../FundingContext/FundingContext.js';
|
|
54
|
+
import '@dynamic-labs/wallet-book';
|
|
55
|
+
import '@dynamic-labs/utils';
|
|
56
|
+
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
57
|
+
import 'qrcode';
|
|
58
|
+
import '../../views/CollectUserDataView/fieldsConfig.js';
|
|
59
|
+
import '../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
60
|
+
import 'formik';
|
|
61
|
+
import 'yup';
|
|
62
|
+
import { FundingWidget } from '../../widgets/FundingWidget/FundingWidget.js';
|
|
53
63
|
import { initExpirationTime } from './helpers.js';
|
|
54
64
|
import { validateAuthUser } from './validators.js';
|
|
55
65
|
import { useCustomerCallbacks } from './useCustomerCallbacks/useCustomerCallbacks.js';
|
|
56
66
|
import { useCustomerAuthFlowCallbacks } from './useCustomerCallbacks/useCustomerAuthFlowCallbacks.js';
|
|
57
67
|
import { useEmailLoginState } from './hooks/useEmailLoginState/useEmailLoginState.js';
|
|
58
68
|
import { useDisplayOrderState } from './hooks/useDisplayOrderState/useDisplayOrderState.js';
|
|
69
|
+
import { useNameService } from './hooks/useNameService/useNameService.js';
|
|
59
70
|
|
|
60
71
|
const EMPTY_INITIAL_USER = undefined;
|
|
61
72
|
const DynamicContext = createContext(undefined);
|
|
62
73
|
const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, accessDeniedMessageSecondary, apiBaseUrl, appLogoUrl = 'https://demo.dynamic.xyz/assets/dynamic-logo.svg', appName = 'Dynamic Example', cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, initialAuthenticationMode = 'connect-and-sign', vendorCredentials, debugError = false, displayTermsOfService = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, eventsCallbacks, evmNetworks, walletsFilter, logLevel = 'WARN', multiWallet = false, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, magicLinkConfig, }, children, theme, }) => {
|
|
63
|
-
var _a, _b;
|
|
74
|
+
var _a, _b, _c;
|
|
64
75
|
logger.setLogLevel(logLevel);
|
|
65
76
|
logger$1.setLogLevel(logLevel);
|
|
66
77
|
ApiEndpoint.setBaseUrl((_a = process.env.DYNAMIC_API_BASE_URL) !== null && _a !== void 0 ? _a : apiBaseUrl);
|
|
@@ -80,7 +91,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
80
91
|
const { configurations: serverNetworkConfigurations, removeLsNetworks } = useFetchNetworkConfigurations({
|
|
81
92
|
authToken: getAuthToken(),
|
|
82
93
|
environmentId,
|
|
83
|
-
|
|
94
|
+
evmNetworks,
|
|
84
95
|
});
|
|
85
96
|
const { imageUserInAccessList, imageUserNotInAccessList, displayName, appLogo, } = (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) || {};
|
|
86
97
|
appLogoUrl = appLogo || appLogoUrl;
|
|
@@ -124,6 +135,10 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
124
135
|
projectSettings,
|
|
125
136
|
user,
|
|
126
137
|
});
|
|
138
|
+
const { getNameService, removeConnectedNameService } = useNameService({
|
|
139
|
+
authToken: (_b = getAuthToken()) !== null && _b !== void 0 ? _b : onboardingOnlyJwt,
|
|
140
|
+
currentWallet: primaryWallet !== null && primaryWallet !== void 0 ? primaryWallet : connectedWallet,
|
|
141
|
+
});
|
|
127
142
|
const walletForUserFacingContext = authMode === 'connect-and-sign' || user ? primaryWallet : connectedWallet;
|
|
128
143
|
useSyncPrimaryWallet({
|
|
129
144
|
multiWalletWidgetState,
|
|
@@ -137,7 +152,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
137
152
|
clearOphanedWalletConnectSessions,
|
|
138
153
|
]);
|
|
139
154
|
const handleLogOut = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
140
|
-
var
|
|
155
|
+
var _d, _e;
|
|
141
156
|
clearAllWalletConnectSessions();
|
|
142
157
|
const jwt = getAuthToken();
|
|
143
158
|
if (jwt && user) {
|
|
@@ -147,7 +162,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
147
162
|
for (const connector of walletConnectors) {
|
|
148
163
|
yield connector.endSession();
|
|
149
164
|
}
|
|
150
|
-
(
|
|
165
|
+
(_d = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector) === null || _d === void 0 ? void 0 : _d.endSession();
|
|
151
166
|
setShowAuthFlow(false);
|
|
152
167
|
setMultiWalletWidgetState('idle');
|
|
153
168
|
removeAuthTokenAndUser();
|
|
@@ -156,7 +171,8 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
156
171
|
setOnboardingOnlyJwt(undefined);
|
|
157
172
|
removeConnectedInfo();
|
|
158
173
|
clearWalletStates();
|
|
159
|
-
(
|
|
174
|
+
removeConnectedNameService();
|
|
175
|
+
(_e = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onLogout) === null || _e === void 0 ? void 0 : _e.call(eventsCallbacks, user);
|
|
160
176
|
}), [
|
|
161
177
|
clearAllWalletConnectSessions,
|
|
162
178
|
user,
|
|
@@ -166,6 +182,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
166
182
|
setConnectedWallet,
|
|
167
183
|
removeLsNetworks,
|
|
168
184
|
removeConnectedInfo,
|
|
185
|
+
removeConnectedNameService,
|
|
169
186
|
clearWalletStates,
|
|
170
187
|
eventsCallbacks,
|
|
171
188
|
environmentId,
|
|
@@ -272,6 +289,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
272
289
|
displayTermsOfService,
|
|
273
290
|
environmentId,
|
|
274
291
|
eventsCallbacks,
|
|
292
|
+
getNameService,
|
|
275
293
|
handleLogOut,
|
|
276
294
|
handleUnlinkWallet,
|
|
277
295
|
isAuthenticated,
|
|
@@ -360,6 +378,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
360
378
|
displayTermsOfService,
|
|
361
379
|
environmentId,
|
|
362
380
|
eventsCallbacks,
|
|
381
|
+
getNameService,
|
|
363
382
|
handleLogOut,
|
|
364
383
|
handleUnlinkWallet,
|
|
365
384
|
isAuthenticated,
|
|
@@ -442,7 +461,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
442
461
|
setShowDynamicUserProfile(true);
|
|
443
462
|
}
|
|
444
463
|
}, [multiWallet, multiWalletWidgetState, showDynamicUserProfile, user]);
|
|
445
|
-
return (jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsx(ThemeContextProvider, Object.assign({ customerTheme: parseTheme(theme, ((
|
|
464
|
+
return (jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsx(ThemeContextProvider, Object.assign({ customerTheme: parseTheme(theme, ((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _c === void 0 ? void 0 : _c.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design }, { children: jsx(LoadingContextProvider, { children: jsx(ViewContextProvider, Object.assign({ loginWithEmail: loginWithEmail }, { children: jsx(QrCodeContextProvider, { children: jsx(EmailVerificationContextProvider, { children: jsx(ErrorContextProvider, { children: jsx(DynamicWidgetContextProvider, { children: jsx(CaptchaContextProvider, { children: jsxs(FundingContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(Toolkit, {}), jsx(FundingWidget, {}), confirmationModal, children] }) }) }) }) }) }) })) }) })) })));
|
|
446
465
|
};
|
|
447
466
|
|
|
448
467
|
export { DynamicContext, DynamicContextProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useNameService } from './useNameService';
|
|
@@ -0,0 +1,82 @@
|
|
|
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 decodeJwt = require('../../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
8
|
+
require('../../../../shared/logger.cjs');
|
|
9
|
+
require('@dynamic-labs/iconic');
|
|
10
|
+
require('@dynamic-labs/multi-wallet');
|
|
11
|
+
require('react/jsx-runtime');
|
|
12
|
+
require('../../../ViewContext/ViewContext.cjs');
|
|
13
|
+
var localStorage = require('../../../../utils/constants/localStorage.cjs');
|
|
14
|
+
require('../../../../utils/constants/colors.cjs');
|
|
15
|
+
var useLocalStorage = require('../../../../shared/utils/hooks/useLocalStorage/useLocalStorage.cjs');
|
|
16
|
+
require('../../../../shared/consts/index.cjs');
|
|
17
|
+
var getWalletVerifiedCredential = require('../../../../utils/functions/getWalletVerifiedCredential/getWalletVerifiedCredential.cjs');
|
|
18
|
+
|
|
19
|
+
const useNameService = ({ currentWallet, authToken }) => {
|
|
20
|
+
const [connectedNameService, setConnectedNameService, removeConnectedNameService,] = useLocalStorage.useLocalStorage(localStorage.CONNECTED_WALLET_NAME_SERVICE, null);
|
|
21
|
+
const lastFetchedNameServiceAddress = React.useRef();
|
|
22
|
+
const fetchNameServiceFromBlockchain = React.useCallback((wallet) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
+
const { address, connector } = wallet;
|
|
24
|
+
if (address === lastFetchedNameServiceAddress.current) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
setConnectedNameService(null);
|
|
28
|
+
// store last address used to fetch name service so we can check for it when promise resolves
|
|
29
|
+
// to avoid race conditions
|
|
30
|
+
lastFetchedNameServiceAddress.current = address;
|
|
31
|
+
let ns;
|
|
32
|
+
try {
|
|
33
|
+
ns = yield connector.getNameService();
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
// do nothing
|
|
37
|
+
}
|
|
38
|
+
// only sets name service if the address used to fetch it is the last one used for fetching
|
|
39
|
+
// this avoid issues with promises not resolving in the correct order
|
|
40
|
+
if (lastFetchedNameServiceAddress.current === address) {
|
|
41
|
+
setConnectedNameService({
|
|
42
|
+
address,
|
|
43
|
+
avatar: ns === null || ns === void 0 ? void 0 : ns.avatar,
|
|
44
|
+
name: ns === null || ns === void 0 ? void 0 : ns.name,
|
|
45
|
+
});
|
|
46
|
+
return ns;
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
49
|
+
}), [setConnectedNameService]);
|
|
50
|
+
const getNameService = (address) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
if (!currentWallet) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const verifiedCredentials = (_a = decodeJwt.decodeJwt(authToken)) === null || _a === void 0 ? void 0 : _a.verifiedCredentials;
|
|
56
|
+
//if there are verified credentials, check if there is a name service for the current wallet
|
|
57
|
+
if (verifiedCredentials) {
|
|
58
|
+
const verifiedCredential = getWalletVerifiedCredential.getWalletVerifiedCredential(currentWallet === null || currentWallet === void 0 ? void 0 : currentWallet.address, verifiedCredentials);
|
|
59
|
+
if (verifiedCredential && ((_b = verifiedCredential.nameService) === null || _b === void 0 ? void 0 : _b.name)) {
|
|
60
|
+
return verifiedCredential.nameService;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// don't look for name service in blockchain if provided address doesn't match current wallet
|
|
64
|
+
if (address && (currentWallet === null || currentWallet === void 0 ? void 0 : currentWallet.address) !== address) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
// if finds name service info in local storage and its related address matches the connected wallet address,
|
|
68
|
+
// return it
|
|
69
|
+
if (connectedNameService &&
|
|
70
|
+
connectedNameService.address === (currentWallet === null || currentWallet === void 0 ? void 0 : currentWallet.address)) {
|
|
71
|
+
return {
|
|
72
|
+
avatar: connectedNameService.avatar,
|
|
73
|
+
name: connectedNameService.name,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
// if doesn't find correct name service in verified credentials or local storage, fetch it from blockchain
|
|
77
|
+
return fetchNameServiceFromBlockchain(currentWallet);
|
|
78
|
+
});
|
|
79
|
+
return { getNameService, removeConnectedNameService };
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
exports.useNameService = useNameService;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NameServiceData } from '@dynamic-labs/sdk-api';
|
|
2
|
+
import { Wallet } from '../../../../shared';
|
|
3
|
+
type Props = {
|
|
4
|
+
authToken: string | undefined;
|
|
5
|
+
currentWallet: Wallet | null;
|
|
6
|
+
};
|
|
7
|
+
export declare const useNameService: ({ currentWallet, authToken }: Props) => {
|
|
8
|
+
getNameService: (address?: string) => Promise<NameServiceData | undefined>;
|
|
9
|
+
removeConnectedNameService: () => void;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { useRef, useCallback } from 'react';
|
|
3
|
+
import { decodeJwt } from '../../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
4
|
+
import '../../../../shared/logger.js';
|
|
5
|
+
import '@dynamic-labs/iconic';
|
|
6
|
+
import '@dynamic-labs/multi-wallet';
|
|
7
|
+
import 'react/jsx-runtime';
|
|
8
|
+
import '../../../ViewContext/ViewContext.js';
|
|
9
|
+
import { CONNECTED_WALLET_NAME_SERVICE } from '../../../../utils/constants/localStorage.js';
|
|
10
|
+
import '../../../../utils/constants/colors.js';
|
|
11
|
+
import { useLocalStorage } from '../../../../shared/utils/hooks/useLocalStorage/useLocalStorage.js';
|
|
12
|
+
import '../../../../shared/consts/index.js';
|
|
13
|
+
import { getWalletVerifiedCredential } from '../../../../utils/functions/getWalletVerifiedCredential/getWalletVerifiedCredential.js';
|
|
14
|
+
|
|
15
|
+
const useNameService = ({ currentWallet, authToken }) => {
|
|
16
|
+
const [connectedNameService, setConnectedNameService, removeConnectedNameService,] = useLocalStorage(CONNECTED_WALLET_NAME_SERVICE, null);
|
|
17
|
+
const lastFetchedNameServiceAddress = useRef();
|
|
18
|
+
const fetchNameServiceFromBlockchain = useCallback((wallet) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
const { address, connector } = wallet;
|
|
20
|
+
if (address === lastFetchedNameServiceAddress.current) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
setConnectedNameService(null);
|
|
24
|
+
// store last address used to fetch name service so we can check for it when promise resolves
|
|
25
|
+
// to avoid race conditions
|
|
26
|
+
lastFetchedNameServiceAddress.current = address;
|
|
27
|
+
let ns;
|
|
28
|
+
try {
|
|
29
|
+
ns = yield connector.getNameService();
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
// do nothing
|
|
33
|
+
}
|
|
34
|
+
// only sets name service if the address used to fetch it is the last one used for fetching
|
|
35
|
+
// this avoid issues with promises not resolving in the correct order
|
|
36
|
+
if (lastFetchedNameServiceAddress.current === address) {
|
|
37
|
+
setConnectedNameService({
|
|
38
|
+
address,
|
|
39
|
+
avatar: ns === null || ns === void 0 ? void 0 : ns.avatar,
|
|
40
|
+
name: ns === null || ns === void 0 ? void 0 : ns.name,
|
|
41
|
+
});
|
|
42
|
+
return ns;
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}), [setConnectedNameService]);
|
|
46
|
+
const getNameService = (address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
if (!currentWallet) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const verifiedCredentials = (_a = decodeJwt(authToken)) === null || _a === void 0 ? void 0 : _a.verifiedCredentials;
|
|
52
|
+
//if there are verified credentials, check if there is a name service for the current wallet
|
|
53
|
+
if (verifiedCredentials) {
|
|
54
|
+
const verifiedCredential = getWalletVerifiedCredential(currentWallet === null || currentWallet === void 0 ? void 0 : currentWallet.address, verifiedCredentials);
|
|
55
|
+
if (verifiedCredential && ((_b = verifiedCredential.nameService) === null || _b === void 0 ? void 0 : _b.name)) {
|
|
56
|
+
return verifiedCredential.nameService;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// don't look for name service in blockchain if provided address doesn't match current wallet
|
|
60
|
+
if (address && (currentWallet === null || currentWallet === void 0 ? void 0 : currentWallet.address) !== address) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// if finds name service info in local storage and its related address matches the connected wallet address,
|
|
64
|
+
// return it
|
|
65
|
+
if (connectedNameService &&
|
|
66
|
+
connectedNameService.address === (currentWallet === null || currentWallet === void 0 ? void 0 : currentWallet.address)) {
|
|
67
|
+
return {
|
|
68
|
+
avatar: connectedNameService.avatar,
|
|
69
|
+
name: connectedNameService.name,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// if doesn't find correct name service in verified credentials or local storage, fetch it from blockchain
|
|
73
|
+
return fetchNameServiceFromBlockchain(currentWallet);
|
|
74
|
+
});
|
|
75
|
+
return { getNameService, removeConnectedNameService };
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export { useNameService };
|
package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs
CHANGED
|
@@ -12,6 +12,7 @@ require('react/jsx-runtime');
|
|
|
12
12
|
require('../../ViewContext/ViewContext.cjs');
|
|
13
13
|
require('../../../utils/constants/colors.cjs');
|
|
14
14
|
require('../../../shared/consts/index.cjs');
|
|
15
|
+
require('@dynamic-labs/rpc-providers');
|
|
15
16
|
require('../DynamicContext.cjs');
|
|
16
17
|
require('../../ErrorContext/ErrorContext.cjs');
|
|
17
18
|
var usePrevious = require('../../../utils/hooks/usePrevious/usePrevious.cjs');
|
|
@@ -8,6 +8,7 @@ import 'react/jsx-runtime';
|
|
|
8
8
|
import '../../ViewContext/ViewContext.js';
|
|
9
9
|
import '../../../utils/constants/colors.js';
|
|
10
10
|
import '../../../shared/consts/index.js';
|
|
11
|
+
import '@dynamic-labs/rpc-providers';
|
|
11
12
|
import '../DynamicContext.js';
|
|
12
13
|
import '../../ErrorContext/ErrorContext.js';
|
|
13
14
|
import { usePrevious } from '../../../utils/hooks/usePrevious/usePrevious.js';
|