@dynamic-labs/sdk-react-core 0.17.0-RC.9 → 0.17.1
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 +330 -0
- package/package.cjs +9 -10
- package/package.js +9 -10
- package/package.json +17 -17
- package/src/index.cjs +31 -4
- package/src/index.d.ts +3 -0
- package/src/index.js +19 -4
- package/src/lib/Main.cjs +21 -10
- package/src/lib/Main.js +19 -8
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.cjs +7 -0
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.js +7 -0
- package/src/lib/components/Alert/Alert.cjs +1 -0
- package/src/lib/components/Alert/Alert.js +1 -0
- package/src/lib/components/AnimatePresence/AnimatePresence.cjs +7 -0
- package/src/lib/components/AnimatePresence/AnimatePresence.js +7 -0
- package/src/lib/components/AppOriginTile/AppOriginTile.types.d.ts +1 -1
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +89 -0
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.d.ts +10 -0
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +85 -0
- package/src/lib/components/AuthProviderIcon/index.d.ts +1 -0
- package/src/lib/components/ChainCard/ChainCard.d.ts +7 -0
- package/src/lib/components/Checkbox/Checkbox.cjs +1 -0
- package/src/lib/components/Checkbox/Checkbox.js +1 -0
- package/src/lib/components/Chip/Chip.cjs +13 -0
- package/src/lib/components/Chip/Chip.d.ts +7 -0
- package/src/lib/components/Chip/Chip.js +9 -0
- package/src/lib/components/Chip/index.d.ts +1 -0
- package/src/lib/components/Divider/Divider.cjs +13 -3
- package/src/lib/components/Divider/Divider.d.ts +7 -3
- package/src/lib/components/Divider/Divider.js +14 -4
- package/src/lib/components/ErrorContainer/ErrorContainer.cjs +3 -2
- package/src/lib/components/ErrorContainer/ErrorContainer.d.ts +3 -1
- package/src/lib/components/ErrorContainer/ErrorContainer.js +3 -2
- package/src/lib/components/FormFieldLabel/FormFieldLabel.cjs +10 -0
- package/src/lib/components/FormFieldLabel/FormFieldLabel.d.ts +8 -0
- package/src/lib/components/FormFieldLabel/FormFieldLabel.js +6 -0
- package/src/lib/components/FormFieldLabel/index.d.ts +1 -0
- package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +5 -3
- package/src/lib/components/IconWithSpinner/IconWithSpinner.js +5 -3
- package/src/lib/components/IconWithSpinner/Indicator/Indicator.cjs +1 -0
- package/src/lib/components/IconWithSpinner/Indicator/Indicator.js +1 -0
- package/src/lib/components/IconWithSpinner/Spinner/Spinner.cjs +5 -3
- package/src/lib/components/IconWithSpinner/Spinner/Spinner.js +5 -3
- package/src/lib/components/IconWithStatus/IconWithStatus.cjs +12 -8
- package/src/lib/components/IconWithStatus/IconWithStatus.d.ts +2 -1
- package/src/lib/components/IconWithStatus/IconWithStatus.js +12 -8
- package/src/lib/components/Input/Input.cjs +13 -6
- package/src/lib/components/Input/Input.js +13 -6
- package/src/lib/components/Input/Input.types.d.ts +4 -0
- package/src/lib/components/LogoutButton/LogoutButton.cjs +1 -0
- package/src/lib/components/LogoutButton/LogoutButton.js +1 -0
- package/src/lib/components/Modal/Modal.cjs +10 -0
- package/src/lib/components/Modal/Modal.d.ts +6 -0
- package/src/lib/components/Modal/Modal.js +6 -0
- package/src/lib/components/Modal/index.d.ts +1 -0
- package/src/lib/components/ModalCard/ModalCard.cjs +9 -0
- package/src/lib/components/ModalCard/ModalCard.d.ts +2 -0
- package/src/lib/components/ModalCard/ModalCard.js +5 -0
- package/src/lib/components/ModalCard/index.d.ts +1 -0
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +5 -1
- package/src/lib/components/NetworkPicker/NetworkPicker.js +5 -1
- package/src/lib/components/NetworkPicker/components/ActionList/ActionList.cjs +7 -0
- package/src/lib/components/NetworkPicker/components/ActionList/ActionList.js +7 -0
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.cjs +14 -7
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.js +14 -7
- package/src/lib/components/NetworkPicker/components/Network/Network.cjs +10 -3
- package/src/lib/components/NetworkPicker/components/Network/Network.js +10 -3
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.cjs +10 -3
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.js +10 -3
- package/src/lib/components/NetworkPicker/components/UnsupportedNetwork/UnsupportedNetwork.cjs +1 -0
- package/src/lib/components/NetworkPicker/components/UnsupportedNetwork/UnsupportedNetwork.js +1 -0
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +15 -7
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +15 -7
- package/src/lib/components/OverlayCard/OverlayCard.cjs +7 -0
- package/src/lib/components/OverlayCard/OverlayCard.js +7 -0
- package/src/lib/components/Popper/Popper/Popper.cjs +54 -0
- package/src/lib/components/Popper/Popper/Popper.d.ts +12 -0
- package/src/lib/components/Popper/Popper/Popper.js +50 -0
- package/src/lib/components/Popper/Popper/index.d.ts +1 -0
- package/src/lib/components/Popper/Popper.types.d.ts +6 -0
- package/src/lib/components/Popper/PopperContent/PopperContent.cjs +18 -0
- package/src/lib/components/Popper/PopperContent/PopperContent.d.ts +9 -0
- package/src/lib/components/Popper/PopperContent/PopperContent.js +14 -0
- package/src/lib/components/Popper/PopperContent/index.d.ts +1 -0
- package/src/lib/components/Popper/PopperContext/PopperContext.cjs +26 -0
- package/src/lib/components/Popper/PopperContext/PopperContext.d.ts +8 -0
- package/src/lib/components/Popper/PopperContext/PopperContext.js +20 -0
- package/src/lib/components/Popper/PopperContext/index.d.ts +1 -0
- package/src/lib/components/Popper/index.d.ts +2 -0
- package/src/lib/components/Popper/utils/getChildPosition/getChildPosition.cjs +14 -0
- package/src/lib/components/Popper/utils/getChildPosition/getChildPosition.d.ts +2 -0
- package/src/lib/components/Popper/utils/getChildPosition/getChildPosition.js +10 -0
- package/src/lib/components/Popper/utils/getChildPosition/index.d.ts +1 -0
- package/src/lib/components/Popper/utils/index.d.ts +3 -0
- package/src/lib/components/Popper/utils/isScrollable/index.d.ts +1 -0
- package/src/lib/components/Popper/utils/isScrollable/isScrollable.cjs +16 -0
- package/src/lib/components/Popper/utils/isScrollable/isScrollable.d.ts +1 -0
- package/src/lib/components/Popper/utils/isScrollable/isScrollable.js +12 -0
- package/src/lib/components/Popper/utils/watchToScrollInHierarchy/index.d.ts +1 -0
- package/src/lib/components/Popper/utils/watchToScrollInHierarchy/watchToScrollInHierarchy.cjs +24 -0
- package/src/lib/components/Popper/utils/watchToScrollInHierarchy/watchToScrollInHierarchy.d.ts +1 -0
- package/src/lib/components/Popper/utils/watchToScrollInHierarchy/watchToScrollInHierarchy.js +20 -0
- package/src/lib/components/Portal/Portal.cjs +7 -0
- package/src/lib/components/Portal/Portal.js +7 -0
- package/src/lib/components/Select/Select.cjs +1 -0
- package/src/lib/components/Select/Select.js +1 -0
- package/src/lib/components/SelectNetworkButton/SelectNetworkButton.cjs +13 -0
- package/src/lib/components/SelectNetworkButton/SelectNetworkButton.d.ts +8 -0
- package/src/lib/components/SelectNetworkButton/SelectNetworkButton.js +9 -0
- package/src/lib/components/SelectWalletChainLayout/SelectWalletChainLayout.d.ts +8 -0
- package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +61 -0
- package/src/lib/components/SendBalanceForm/SendBalanceForm.d.ts +11 -0
- package/src/lib/components/SendBalanceForm/SendBalanceForm.js +57 -0
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +51 -0
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.d.ts +19 -0
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +47 -0
- package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.cjs +26 -0
- package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.d.ts +8 -0
- package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.js +22 -0
- package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/index.d.ts +1 -0
- package/src/lib/components/SendBalancePageLayout/components/index.d.ts +1 -0
- package/src/lib/components/SendBalancePageLayout/index.d.ts +2 -0
- package/src/lib/components/ShadowDOM/utils.cjs +1 -0
- package/src/lib/components/ShadowDOM/utils.js +1 -0
- package/src/lib/components/Spinner/spinner.cjs +1 -0
- package/src/lib/components/Spinner/spinner.js +1 -0
- package/src/lib/components/Step/Step.d.ts +7 -0
- package/src/lib/components/Step/index.d.ts +1 -0
- package/src/lib/components/Stepper/Stepper.d.ts +2 -0
- package/src/lib/components/Stepper/index.d.ts +1 -0
- package/src/lib/components/Toolkit/Toolkit.cjs +1 -0
- package/src/lib/components/Toolkit/Toolkit.js +1 -0
- package/src/lib/components/Toolkit/components/LoginWithEmailViewDisplayPriorityOrderSwitch.cjs +1 -0
- package/src/lib/components/Toolkit/components/LoginWithEmailViewDisplayPriorityOrderSwitch.js +1 -0
- package/src/lib/components/Tooltip/Tooltip.cjs +7 -0
- package/src/lib/components/Tooltip/Tooltip.js +7 -0
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +41 -0
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.d.ts +17 -0
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +37 -0
- package/src/lib/components/TransactionConfirmationPageLayout/components/TransactionRow/TransactionRow.cjs +11 -0
- package/src/lib/components/TransactionConfirmationPageLayout/components/TransactionRow/TransactionRow.d.ts +12 -0
- package/src/lib/components/TransactionConfirmationPageLayout/components/TransactionRow/TransactionRow.js +7 -0
- package/src/lib/components/TransactionConfirmationPageLayout/components/TransactionRow/index.d.ts +1 -0
- package/src/lib/components/TransactionConfirmationPageLayout/components/index.d.ts +1 -0
- package/src/lib/components/TransactionConfirmationPageLayout/index.d.ts +2 -0
- package/src/lib/components/TransactionOriginDestination/TransactionOriginDestination.d.ts +11 -0
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +57 -0
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.d.ts +12 -0
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +53 -0
- package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.cjs +7 -0
- package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.js +7 -0
- package/src/lib/components/UserAddress/UserAddress.cjs +1 -0
- package/src/lib/components/UserAddress/UserAddress.js +1 -0
- package/src/lib/components/UserProfile/UserProfile.cjs +3 -2
- package/src/lib/components/UserProfile/UserProfile.js +2 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +10 -3
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +10 -3
- package/src/lib/components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs +3 -2
- package/src/lib/components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.d.ts +2 -0
- package/src/lib/components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js +3 -2
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.cjs +10 -3
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.js +10 -3
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +31 -13
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +31 -13
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/components/ConnectedAccountAvatar/ConnectedAccountAvatar.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/components/ConnectedAccountAvatar/ConnectedAccountAvatar.d.ts +2 -0
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/components/ConnectedAccountAvatar/ConnectedAccountAvatar.js +1 -1
- package/src/lib/components/index.d.ts +9 -0
- package/src/lib/config/LSSuffix.cjs +24 -0
- package/src/lib/config/LSSuffix.d.ts +7 -0
- package/src/lib/config/LSSuffix.js +22 -0
- package/src/lib/context/AccessDeniedContext/AccessDeniedContext.cjs +30 -0
- package/src/lib/context/AccessDeniedContext/AccessDeniedContext.d.ts +13 -0
- package/src/lib/context/AccessDeniedContext/AccessDeniedContext.js +24 -0
- package/src/lib/context/AccessDeniedContext/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +76 -30
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +26 -3
- package/src/lib/context/DynamicContext/DynamicContext.js +73 -27
- package/src/lib/context/DynamicContext/helpers.cjs +5 -3
- package/src/lib/context/DynamicContext/helpers.js +4 -2
- package/src/lib/context/DynamicContext/hooks/useDisplayOrderState/useDisplayOrderState.cjs +1 -0
- package/src/lib/context/DynamicContext/hooks/useDisplayOrderState/useDisplayOrderState.js +1 -0
- package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.cjs +5 -3
- package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.js +5 -3
- package/src/lib/context/DynamicContext/hooks/useNameService/useNameService.cjs +1 -0
- package/src/lib/context/DynamicContext/hooks/useNameService/useNameService.js +1 -0
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.cjs +27 -0
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.d.ts +14 -0
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.js +23 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs +7 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.js +7 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +1 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +1 -0
- package/src/lib/context/DynamicContext/validators.cjs +1 -0
- package/src/lib/context/DynamicContext/validators.js +1 -0
- package/src/lib/context/MockContext/MockContext.cjs +2 -0
- package/src/lib/context/MockContext/MockContext.js +2 -0
- package/src/lib/context/QrCodeContext/QrCodeContext.cjs +7 -0
- package/src/lib/context/QrCodeContext/QrCodeContext.js +7 -0
- package/src/lib/context/SendBalanceContext/SendBalanceContext.cjs +74 -0
- package/src/lib/context/SendBalanceContext/SendBalanceContext.d.ts +4 -0
- package/src/lib/context/SendBalanceContext/SendBalanceContext.errors.cjs +11 -0
- package/src/lib/context/SendBalanceContext/SendBalanceContext.errors.d.ts +3 -0
- package/src/lib/context/SendBalanceContext/SendBalanceContext.errors.js +6 -0
- package/src/lib/context/SendBalanceContext/SendBalanceContext.js +69 -0
- package/src/lib/context/SendBalanceContext/SendBalanceContext.types.d.ts +9 -0
- package/src/lib/context/SendBalanceContext/index.d.ts +1 -0
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +103 -19
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.d.ts +3 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +104 -20
- package/src/lib/context/ThemeContext/themesData.cjs +19 -18
- package/src/lib/context/ThemeContext/themesData.d.ts +3 -3
- package/src/lib/context/ThemeContext/themesData.js +19 -18
- package/src/lib/context/ViewContext/ViewContext.cjs +21 -12
- package/src/lib/context/ViewContext/ViewContext.d.ts +10 -8
- package/src/lib/context/ViewContext/ViewContext.js +22 -13
- package/src/lib/data/api.cjs +6 -2
- package/src/lib/data/api.d.ts +2 -2
- package/src/lib/data/api.js +6 -2
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +10 -3
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +10 -3
- package/src/lib/layout/DynamicAuthLayout/Footer/Footer.cjs +9 -2
- package/src/lib/layout/DynamicAuthLayout/Footer/Footer.js +9 -2
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/Item/Item.cjs +9 -2
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/Item/Item.js +9 -2
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +9 -2
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +9 -2
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletListFooterContent.cjs +8 -2
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletListFooterContent.js +8 -2
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.cjs +14 -7
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.js +14 -7
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +19 -9
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +19 -9
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.d.ts +15 -0
- package/src/lib/layouts/BridgeWelcomeLayout/index.d.ts +1 -0
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.cjs +69 -0
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.d.ts +10 -0
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.js +65 -0
- package/src/lib/modals/SendBalanceModal/index.d.ts +1 -0
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +19 -10
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +19 -10
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +35 -83
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +37 -85
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.types.d.ts +0 -4
- package/src/lib/modals/index.d.ts +1 -0
- package/src/lib/shared/assets/add.cjs +8 -9
- package/src/lib/shared/assets/add.js +8 -9
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/shared/assets/send.cjs +56 -0
- package/src/lib/shared/assets/send.js +32 -0
- package/src/lib/shared/types/index.d.ts +14 -2
- package/src/lib/shared/utils/functions/ceil/ceil.cjs +10 -0
- package/src/lib/shared/utils/functions/ceil/ceil.d.ts +1 -0
- package/src/lib/shared/utils/functions/ceil/ceil.js +6 -0
- package/src/lib/shared/utils/functions/ceil/index.d.ts +1 -0
- package/src/lib/shared/utils/functions/formatBigNumber/formatBigNumber.cjs +9 -10
- package/src/lib/shared/utils/functions/formatBigNumber/formatBigNumber.d.ts +1 -1
- package/src/lib/shared/utils/functions/formatBigNumber/formatBigNumber.js +9 -10
- package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.cjs +1 -0
- package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.js +1 -0
- package/src/lib/shared/utils/functions/index.d.ts +2 -0
- package/src/lib/shared/utils/functions/shortenEmail/shortenEmail.cjs +27 -0
- package/src/lib/shared/utils/functions/shortenEmail/shortenEmail.d.ts +6 -0
- package/src/lib/shared/utils/functions/shortenEmail/shortenEmail.js +23 -0
- package/src/lib/shared/utils/functions/storage/getDynamicLSKey.cjs +9 -0
- package/src/lib/shared/utils/functions/storage/getDynamicLSKey.d.ts +1 -0
- package/src/lib/shared/utils/functions/storage/getDynamicLSKey.js +5 -0
- package/src/lib/shared/utils/functions/storage/getFromLS.cjs +2 -1
- package/src/lib/shared/utils/functions/storage/getFromLS.js +2 -1
- package/src/lib/shared/utils/functions/storage/index.d.ts +2 -0
- package/src/lib/shared/utils/functions/storage/removeFromLS.cjs +15 -0
- package/src/lib/shared/utils/functions/storage/removeFromLS.d.ts +1 -0
- package/src/lib/shared/utils/functions/storage/removeFromLS.js +11 -0
- package/src/lib/shared/utils/functions/storage/setToLS.cjs +5 -2
- package/src/lib/shared/utils/functions/storage/setToLS.js +5 -2
- package/src/lib/shared/utils/functions/trimEnd/index.d.ts +1 -0
- package/src/lib/shared/utils/functions/trimEnd/trimEnd.cjs +13 -0
- package/src/lib/shared/utils/functions/trimEnd/trimEnd.d.ts +1 -0
- package/src/lib/shared/utils/functions/trimEnd/trimEnd.js +9 -0
- package/src/lib/shared/utils/hooks/index.d.ts +1 -0
- package/src/lib/shared/utils/hooks/useLocalStorage/useLocalStorage.cjs +5 -3
- package/src/lib/shared/utils/hooks/useLocalStorage/useLocalStorage.js +5 -3
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getAppOrigin/getAppOrigin.cjs +12 -0
- package/src/lib/utils/functions/getAppOrigin/getAppOrigin.d.ts +1 -0
- package/src/lib/utils/functions/getAppOrigin/getAppOrigin.js +8 -0
- package/src/lib/utils/functions/getAppOrigin/index.d.ts +1 -0
- package/src/lib/utils/functions/getAuthToken/getAuthToken.cjs +14 -2
- package/src/lib/utils/functions/getAuthToken/getAuthToken.d.ts +1 -1
- package/src/lib/utils/functions/getAuthToken/getAuthToken.js +13 -1
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.cjs +1 -0
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.js +1 -0
- package/src/lib/utils/functions/getReferencedAccount/getReferencedAccount.cjs +30 -0
- package/src/lib/utils/functions/getReferencedAccount/getReferencedAccount.d.ts +7 -0
- package/src/lib/utils/functions/getReferencedAccount/getReferencedAccount.js +26 -0
- package/src/lib/utils/functions/getReferencedAccount/index.d.ts +1 -0
- package/src/lib/utils/functions/{getEnabledUserProfileFields/getEnabledUserProfileFields.cjs → getUserProfileFields/getUserProfileFields.cjs} +4 -0
- package/src/lib/utils/functions/{getEnabledUserProfileFields/getEnabledUserProfileFields.js → getUserProfileFields/getUserProfileFields.js} +4 -0
- package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.cjs +2 -0
- package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.d.ts +1 -0
- package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.js +2 -0
- package/src/lib/utils/functions/handleUnlinkHelper/handleUnlinkHelper.cjs +1 -0
- package/src/lib/utils/functions/handleUnlinkHelper/handleUnlinkHelper.js +1 -0
- package/src/lib/utils/functions/hasWalletGroupFlag/hasWalletGroupFlag.d.ts +1 -0
- package/src/lib/utils/functions/index.d.ts +3 -0
- package/src/lib/utils/functions/isNetworkUnsupported/index.d.ts +1 -0
- package/src/lib/utils/functions/isNetworkUnsupported/isNetworkUnsupported.cjs +12 -0
- package/src/lib/utils/functions/isNetworkUnsupported/isNetworkUnsupported.d.ts +2 -0
- package/src/lib/utils/functions/isNetworkUnsupported/isNetworkUnsupported.js +8 -0
- package/src/lib/utils/functions/isWalletLinked/index.d.ts +1 -0
- package/src/lib/utils/functions/isWalletLinked/isWalletLinked.cjs +15 -0
- package/src/lib/utils/functions/isWalletLinked/isWalletLinked.d.ts +2 -0
- package/src/lib/utils/functions/isWalletLinked/isWalletLinked.js +11 -0
- package/src/lib/utils/functions/parseWalletLinks/parseWalletLinks.cjs +1 -0
- package/src/lib/utils/functions/parseWalletLinks/parseWalletLinks.js +1 -0
- package/src/lib/utils/functions/storeAuthToken/index.cjs +14 -2
- package/src/lib/utils/functions/storeAuthToken/index.js +13 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +1 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +1 -0
- package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.cjs +2 -0
- package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js +2 -0
- package/src/lib/utils/hooks/index.d.ts +4 -0
- package/src/lib/utils/hooks/multiWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/multiWallet/useMultiWalletWidgetState/useMultiWalletWidgetState.cjs +0 -2
- package/src/lib/utils/hooks/multiWallet/useMultiWalletWidgetState/useMultiWalletWidgetState.js +0 -2
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +66 -7
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.d.ts +10 -3
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +67 -8
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.cjs +2 -0
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js +2 -0
- package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.cjs +2 -0
- package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.js +2 -0
- package/src/lib/utils/hooks/useColorSchemePreference/index.d.ts +1 -0
- package/src/lib/utils/hooks/useColorSchemePreference/useColorSchemePreference.cjs +27 -0
- package/src/lib/utils/hooks/useColorSchemePreference/useColorSchemePreference.d.ts +1 -0
- package/src/lib/utils/hooks/useColorSchemePreference/useColorSchemePreference.js +23 -0
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.cjs +6 -1
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.js +6 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +1 -0
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +1 -0
- package/src/lib/utils/hooks/useConnectWithEmail/useConnectWithEmail.cjs +1 -0
- package/src/lib/utils/hooks/useConnectWithEmail/useConnectWithEmail.js +1 -0
- package/src/lib/utils/hooks/useConnectedAccountWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useConnectedAccountWallet/useConnectedAccountWallet.cjs +30 -0
- package/src/lib/utils/hooks/useConnectedAccountWallet/useConnectedAccountWallet.d.ts +2 -0
- package/src/lib/utils/hooks/useConnectedAccountWallet/useConnectedAccountWallet.js +26 -0
- package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.cjs +1 -0
- package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.js +1 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs +4 -1
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js +5 -2
- package/src/lib/utils/hooks/useFetchNonce/useFetchNonce.cjs +1 -0
- package/src/lib/utils/hooks/useFetchNonce/useFetchNonce.js +1 -0
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +1 -0
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +1 -0
- package/src/lib/utils/hooks/useFetchWalletsForChainsMap/useFetchWalletsForChainsMap.cjs +1 -0
- package/src/lib/utils/hooks/useFetchWalletsForChainsMap/useFetchWalletsForChainsMap.js +1 -0
- package/src/lib/utils/hooks/useGetSocialIcon/index.d.ts +1 -0
- package/src/lib/utils/hooks/useGetSocialIcon/useGetSocialIcon.cjs +14 -0
- package/src/lib/utils/hooks/useGetSocialIcon/useGetSocialIcon.d.ts +2 -0
- package/src/lib/utils/hooks/useGetSocialIcon/useGetSocialIcon.js +10 -0
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.cjs +26 -2
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.js +26 -2
- package/src/lib/utils/hooks/useIconThemeVariant/index.d.ts +1 -0
- package/src/lib/utils/hooks/useIconThemeVariant/useIconThemeVariant.cjs +15 -0
- package/src/lib/utils/hooks/useIconThemeVariant/useIconThemeVariant.d.ts +2 -0
- package/src/lib/utils/hooks/useIconThemeVariant/useIconThemeVariant.js +11 -0
- package/src/lib/utils/hooks/useKYCFlag/useKYCFlag.cjs +4 -4
- package/src/lib/utils/hooks/useKYCFlag/useKYCFlag.js +3 -3
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.cjs +1 -0
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.js +1 -0
- package/src/lib/utils/hooks/usePrevious/usePrevious.cjs +0 -1
- package/src/lib/utils/hooks/usePrevious/usePrevious.d.ts +1 -1
- package/src/lib/utils/hooks/usePrevious/usePrevious.js +0 -1
- package/src/lib/utils/hooks/useRpcProviders/useRpcProviders.cjs +1 -0
- package/src/lib/utils/hooks/useRpcProviders/useRpcProviders.js +1 -0
- package/src/lib/utils/hooks/useUserDataForm/useUserDataForm.cjs +1 -0
- package/src/lib/utils/hooks/useUserDataForm/useUserDataForm.js +1 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs +4 -3
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js +4 -3
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +20 -11
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +20 -11
- package/src/lib/utils/hooks/useWalletConnectors/reconnectSocialWallet.cjs +39 -0
- package/src/lib/utils/hooks/useWalletConnectors/reconnectSocialWallet.d.ts +8 -0
- package/src/lib/utils/hooks/useWalletConnectors/reconnectSocialWallet.js +35 -0
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +50 -73
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.d.ts +2 -1
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +52 -75
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +56 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.d.ts +8 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +52 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/index.d.ts +2 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/primaryWalletIdValidator/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/primaryWalletIdValidator/primaryWalletIdValidator.cjs +7 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/primaryWalletIdValidator/primaryWalletIdValidator.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/primaryWalletIdValidator/primaryWalletIdValidator.js +3 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +88 -52
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +4 -2
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +89 -53
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +14 -14
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +14 -14
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +51 -16
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +51 -16
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +33 -27
- package/src/lib/utils/hooks/useWallets/useWallets.d.ts +5 -3
- package/src/lib/utils/hooks/useWallets/useWallets.js +34 -28
- package/src/lib/utils/hooks/useWalletsConnectionState/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.cjs +47 -0
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.d.ts +14 -0
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.js +43 -0
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +9 -3
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +9 -3
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +13 -7
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +13 -7
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +9 -3
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +9 -3
- package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +8 -2
- package/src/lib/views/CollectUserDataView/UserDataFields/index.js +8 -2
- package/src/lib/views/CollectUserDataView/fieldsConfig.cjs +3 -2
- package/src/lib/views/CollectUserDataView/fieldsConfig.js +3 -2
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs +9 -2
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js +9 -2
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +11 -4
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +11 -4
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +10 -3
- package/src/lib/views/EmailUpdate/EmailUpdate.js +10 -3
- package/src/lib/views/EmailVerification/EmailVerification.cjs +17 -9
- package/src/lib/views/EmailVerification/EmailVerification.js +17 -9
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +7 -0
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +7 -0
- package/src/lib/views/LoginWithEmailView/LoginWithEmailView.cjs +9 -5
- package/src/lib/views/LoginWithEmailView/LoginWithEmailView.js +9 -5
- package/src/lib/views/LoginWithEmailView/components/ListItemButton/ListItemButton.cjs +9 -2
- package/src/lib/views/LoginWithEmailView/components/ListItemButton/ListItemButton.js +9 -2
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs +8 -4
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js +9 -5
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.cjs +12 -2
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.js +11 -1
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +18 -8
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +18 -8
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +27 -7
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +27 -7
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +9 -3
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +9 -3
- package/src/lib/views/NoAccess/NoAccess.cjs +25 -29
- package/src/lib/views/NoAccess/NoAccess.js +26 -30
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +8 -2
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +8 -2
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.cjs +9 -2
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.js +9 -2
- package/src/lib/views/PendingConnectView/PendingConnectView.cjs +10 -4
- package/src/lib/views/PendingConnectView/PendingConnectView.js +10 -4
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +14 -8
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +14 -8
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +9 -2
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +9 -2
- package/src/lib/views/QrCodeView/QrCodeView.cjs +9 -3
- package/src/lib/views/QrCodeView/QrCodeView.js +9 -3
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +117 -0
- package/src/lib/views/SendBalanceView/SendBalanceView.d.ts +13 -0
- package/src/lib/views/SendBalanceView/SendBalanceView.js +113 -0
- package/src/lib/views/SendBalanceView/index.d.ts +1 -0
- package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +15 -12
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +15 -12
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.cjs +62 -0
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.d.ts +2 -0
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.js +58 -0
- package/src/lib/views/SocialWrongAccountView/index.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +95 -0
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.d.ts +14 -0
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +91 -0
- package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/helpers/transactionErrorMessage.cjs +7 -1
- package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/helpers/transactionErrorMessage.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.js +18 -0
- package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/hooks/useTransactionData/useTransactionData.cjs +7 -0
- package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/hooks/useTransactionData/useTransactionData.js +7 -0
- package/src/lib/views/TransactionConfirmationView/index.d.ts +2 -0
- package/src/lib/views/WalletList/SearchInstead/SearchInstead.cjs +9 -2
- package/src/lib/views/WalletList/SearchInstead/SearchInstead.js +9 -2
- package/src/lib/views/WalletList/WalletList.cjs +10 -8
- package/src/lib/views/WalletList/WalletList.js +5 -3
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +8 -2
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +8 -2
- package/src/lib/views/WalletList/data.cjs +5 -5
- package/src/lib/views/WalletList/data.d.ts +2 -2
- package/src/lib/views/WalletList/data.js +5 -5
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +10 -4
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +10 -4
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +9 -3
- package/src/lib/views/WalletUsedView/WalletUsedView.js +9 -3
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.cjs +46 -0
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.d.ts +6 -0
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.js +42 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.cjs +22 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.d.ts +5 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.js +18 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetNav/DynamicBridgeWidgetNav.cjs +9 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetNav/DynamicBridgeWidgetNav.d.ts +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetNav/DynamicBridgeWidgetNav.js +5 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetViews/DynamicBridgeWidgetViews.cjs +27 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetViews/DynamicBridgeWidgetViews.d.ts +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetViews/DynamicBridgeWidgetViews.js +19 -0
- package/src/lib/widgets/DynamicBridgeWidget/context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.cjs +45 -0
- package/src/lib/widgets/DynamicBridgeWidget/context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.d.ts +16 -0
- package/src/lib/widgets/DynamicBridgeWidget/context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.js +35 -0
- package/src/lib/widgets/DynamicBridgeWidget/index.d.ts +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.cjs +10 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.d.ts +3 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.js +5 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/ProfileView/ProfileView.cjs +10 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/ProfileView/ProfileView.d.ts +3 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/ProfileView/ProfileView.js +5 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.cjs +10 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.d.ts +3 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.js +5 -0
- package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +9 -2
- package/src/lib/widgets/DynamicWidget/DynamicWidget.js +9 -2
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +14 -6
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +14 -6
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +80 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +76 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +10 -3
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +10 -3
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.cjs +15 -30
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.d.ts +6 -2
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.js +16 -31
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +13 -5
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +13 -5
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.types.d.ts +3 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +13 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +13 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetCard/DynamicWidgetCard.cjs +3 -5
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetCard/DynamicWidgetCard.d.ts +4 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetCard/DynamicWidgetCard.js +3 -5
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +9 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.d.ts +5 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +9 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +42 -26
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.d.ts +5 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +44 -28
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetPrompts/DynamicWidgetPrompts.cjs +17 -8
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetPrompts/DynamicWidgetPrompts.js +17 -8
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetSwitcher/DynamicWidgetSwitcher.cjs +9 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetSwitcher/DynamicWidgetSwitcher.js +9 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/DynamicWidgetVariants.cjs +2 -4
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/DynamicWidgetVariants.d.ts +4 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/DynamicWidgetVariants.js +2 -4
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.cjs +8 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.js +8 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.cjs +13 -6
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.js +13 -6
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/types.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/DynamicWidgetViews.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/DynamicWidgetViews.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +12 -7
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +12 -7
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.cjs +10 -3
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.js +10 -3
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +21 -3
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +21 -3
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.cjs +9 -2
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.js +9 -2
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +10 -3
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +10 -3
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +34 -21
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.d.ts +2 -3
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +34 -21
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.cjs +6 -4
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.js +6 -4
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.cjs +43 -6
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.d.ts +2 -1
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.js +44 -7
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +9 -10
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.d.ts +1 -5
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +10 -11
- package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.cjs +5 -3
- package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.js +5 -3
- package/src/lib/widgets/DynamicWidget/hooks/useFetchChain/useFetchChain.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/hooks/useFetchChain/useFetchChain.js +1 -1
- package/src/lib/widgets/DynamicWidget/{components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs → prompts/DefaultPromptModal/DefaultPromptModal.cjs} +15 -15
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.d.ts +13 -0
- package/src/lib/widgets/DynamicWidget/{components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js → prompts/DefaultPromptModal/DefaultPromptModal.js} +15 -15
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.cjs +10 -3
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.js +10 -3
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +9 -3
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +9 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.cjs +17 -40
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.js +18 -41
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.cjs +45 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.d.ts +7 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.js +41 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +71 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.d.ts +8 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +67 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +61 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +57 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.cjs +64 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.js +60 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +68 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +64 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/PendingSignModal.cjs +2 -33
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/PendingSignModal.js +2 -33
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +12 -8
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +13 -9
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +9 -3
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +9 -3
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +13 -8
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +13 -8
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +13 -7
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +13 -7
- package/src/lib/widgets/DynamicWidget/views/IndexView/IndexView.cjs +10 -3
- package/src/lib/widgets/DynamicWidget/views/IndexView/IndexView.js +10 -3
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.cjs +13 -5
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +12 -4
- package/src/lib/widgets/DynamicWidget/views/SendBalanceWidgetView/SendBalanceWidgetView.cjs +15 -0
- package/src/lib/widgets/DynamicWidget/views/SendBalanceWidgetView/SendBalanceWidgetView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SendBalanceWidgetView/SendBalanceWidgetView.js +11 -0
- package/src/lib/widgets/DynamicWidget/views/SendBalanceWidgetView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/index.d.ts +1 -0
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.cjs +9 -2
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.js +9 -2
- package/src/lib/widgets/index.d.ts +1 -0
- package/src/polyfills.cjs +11 -0
- package/src/polyfills.d.ts +1 -0
- package/src/polyfills.js +9 -0
- package/src/shim/process.cjs +238 -0
- package/src/shim/process.d.ts +34 -0
- package/src/shim/process.js +234 -0
- package/src/lib/modals/TransactionConfirmationModal/helpers/transactionErrorMessage.js +0 -12
- package/src/lib/utils/functions/getSocialIcon/getSocialIcon.cjs +0 -22
- package/src/lib/utils/functions/getSocialIcon/getSocialIcon.d.ts +0 -3
- package/src/lib/utils/functions/getSocialIcon/getSocialIcon.js +0 -18
- package/src/lib/utils/functions/getSocialIcon/index.d.ts +0 -1
- package/src/lib/widgets/DynamicWidget/components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.d.ts +0 -2
- package/src/lib/widgets/DynamicWidget/components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.types.d.ts +0 -7
- package/src/lib/widgets/DynamicWidget/components/DotsMenuWrapper/DotsMenuWrapper.cjs +0 -68
- package/src/lib/widgets/DynamicWidget/components/DotsMenuWrapper/DotsMenuWrapper.js +0 -64
- package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.cjs +0 -59
- package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.d.ts +0 -6
- package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.js +0 -55
- package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/index.d.ts +0 -1
- /package/src/lib/utils/functions/{getEnabledUserProfileFields/getEnabledUserProfileFields.d.ts → getUserProfileFields/getUserProfileFields.d.ts} +0 -0
- /package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/hooks/index.d.ts +0 -0
- /package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/hooks/useTransactionData/index.d.ts +0 -0
- /package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/hooks/useTransactionData/useTransactionData.d.ts +0 -0
- /package/src/lib/widgets/DynamicWidget/{components → prompts/PendingSignModal}/DefaultPendingSignModalContent/index.d.ts +0 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
6
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
6
7
|
var utils = require('@dynamic-labs/utils');
|
|
7
8
|
var api = require('../../../data/api.cjs');
|
|
8
9
|
var index = require('../../functions/storeAuthToken/index.cjs');
|
|
@@ -11,13 +12,14 @@ var localStorage = require('../../constants/localStorage.cjs');
|
|
|
11
12
|
require('../../constants/colors.cjs');
|
|
12
13
|
var decodeJwt = require('../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
13
14
|
var logger = require('../../../shared/logger.cjs');
|
|
15
|
+
require('../../../config/LSSuffix.cjs');
|
|
14
16
|
var setToLS = require('../../../shared/utils/functions/storage/setToLS.cjs');
|
|
15
17
|
require('@dynamic-labs/iconic');
|
|
16
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
17
18
|
require('react/jsx-runtime');
|
|
18
19
|
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
19
20
|
require('react');
|
|
20
21
|
require('ethers');
|
|
22
|
+
require('../../../shared/consts/index.cjs');
|
|
21
23
|
var getVerifyArgs = require('../../functions/getVerifyArgs/getVerifyArgs.cjs');
|
|
22
24
|
var createUserProfile = require('../../functions/createUserProfile/createUserProfile.cjs');
|
|
23
25
|
var isSupportedNetwork = require('../../functions/isSupportedNetwork/isSupportedNetwork.cjs');
|
|
@@ -27,20 +29,21 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useInte
|
|
|
27
29
|
var ErrorContext = require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
28
30
|
var getSiweStatement = require('../../functions/getSiweStatement/getSiweStatement.cjs');
|
|
29
31
|
var getWalletProvider = require('../../functions/getWalletProvider/getWalletProvider.cjs');
|
|
30
|
-
require('../../../
|
|
32
|
+
var AccessDeniedContext = require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
31
33
|
|
|
32
34
|
// This logic is used to both verify or link a wallet
|
|
33
35
|
// Since we are re-using the different screens to authenticate or link the wallet.
|
|
34
36
|
// This logic is the best place to determine whether we should verify or verify and link.
|
|
35
37
|
const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, }) => {
|
|
36
|
-
const {
|
|
38
|
+
const { setDeniedAddress, setDeniedOauthProvider } = AccessDeniedContext.useAccessDeniedContext();
|
|
39
|
+
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
37
40
|
const { setErrorMessage, setError } = ErrorContext.useErrorContext();
|
|
38
|
-
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken,
|
|
41
|
+
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
39
42
|
// If the user is not already logged it means that we only need to verify
|
|
40
43
|
// We need this boolean for the part of the logic where we already persisted a new authToken,
|
|
41
44
|
// and need to distinguish between logic for verify or linking.
|
|
42
45
|
const verifyOnly = !authToken;
|
|
43
|
-
const generateJWT = (walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
const generateJWT = (walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
44
47
|
let Jwt;
|
|
45
48
|
const nonce = consumeNonce();
|
|
46
49
|
if (nonce === undefined)
|
|
@@ -56,7 +59,8 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
56
59
|
walletProvider,
|
|
57
60
|
});
|
|
58
61
|
if (authToken === undefined || !multiWalletEnabled) {
|
|
59
|
-
Jwt = yield api.verifyWallet(environmentId, Object.assign(Object.assign({}, verifyArgs), { captchaToken
|
|
62
|
+
Jwt = yield api.verifyWallet(environmentId, Object.assign(Object.assign({}, verifyArgs), { captchaToken,
|
|
63
|
+
oauth }));
|
|
60
64
|
}
|
|
61
65
|
else {
|
|
62
66
|
Jwt = yield api.linkWallet(environmentId, verifyArgs, authToken);
|
|
@@ -86,7 +90,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
};
|
|
89
|
-
const handleError = (e, walletConnector) => {
|
|
93
|
+
const handleError = (e, walletConnector, address, oauth) => {
|
|
90
94
|
// This is a special case where the user is trying to link a wallet
|
|
91
95
|
// and the wallet is already linked and we don't want to kill the session.
|
|
92
96
|
if (e instanceof utils.WalletUsedError) {
|
|
@@ -104,13 +108,18 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
104
108
|
return;
|
|
105
109
|
}
|
|
106
110
|
if (e instanceof utils.NoAccessError) {
|
|
111
|
+
setDeniedAddress(address);
|
|
112
|
+
// we need to set this value if it's magic in order to set proper icon
|
|
113
|
+
if (walletConnectorCore.isSocialWalletConnector(walletConnector)) {
|
|
114
|
+
setDeniedOauthProvider(oauth === null || oauth === void 0 ? void 0 : oauth.provider);
|
|
115
|
+
}
|
|
107
116
|
setView('no-access');
|
|
108
117
|
return;
|
|
109
118
|
}
|
|
110
119
|
if (connectedWallet && authMode === 'connect-only') {
|
|
111
120
|
throw new utils.DynamicError(e.message);
|
|
112
121
|
}
|
|
113
|
-
|
|
122
|
+
goToInitialView();
|
|
114
123
|
logger.logger.error(e);
|
|
115
124
|
if (debugError) {
|
|
116
125
|
setError(`${e.message}\n ${e.stack}`);
|
|
@@ -119,7 +128,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
119
128
|
setErrorMessage(e.code);
|
|
120
129
|
}
|
|
121
130
|
};
|
|
122
|
-
return ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
131
|
+
return ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
123
132
|
const walletProvider = getWalletProvider.getWalletProvider(walletConnector);
|
|
124
133
|
const network = yield walletConnector.getNetwork();
|
|
125
134
|
const _isSupportedNetwork = isSupportedNetwork.isSupportedNetwork({
|
|
@@ -127,7 +136,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
127
136
|
walletConnector,
|
|
128
137
|
});
|
|
129
138
|
try {
|
|
130
|
-
const Jwt = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken);
|
|
139
|
+
const Jwt = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth);
|
|
131
140
|
const decodedJwt = decodeJwt.decodeJwt(Jwt);
|
|
132
141
|
if (decodedJwt === undefined)
|
|
133
142
|
throw new utils.DynamicError('Invalid token!');
|
|
@@ -165,7 +174,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
165
174
|
}
|
|
166
175
|
}
|
|
167
176
|
catch (e) {
|
|
168
|
-
handleError(e, walletConnector);
|
|
177
|
+
handleError(e, walletConnector, publicWalletAddress, oauth);
|
|
169
178
|
}
|
|
170
179
|
});
|
|
171
180
|
};
|
|
@@ -5,5 +5,5 @@ type UseVerifyWalletArgs = VerifyProps & ProjectSettingsProps & {
|
|
|
5
5
|
displayTermsOfService: boolean;
|
|
6
6
|
setIsSingleWalletAccount: Dispatch<SetStateAction<boolean>>;
|
|
7
7
|
};
|
|
8
|
-
export declare const useVerifyWallet: ({ consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, }: UseVerifyWalletArgs) => ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, }: VerifyCallbackArgs) => Promise<void>;
|
|
8
|
+
export declare const useVerifyWallet: ({ consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, }: UseVerifyWalletArgs) => ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, }: VerifyCallbackArgs) => Promise<void>;
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { isSocialWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
3
|
import { DynamicError, WalletUsedError, ChainalysisError, NoAccessError } from '@dynamic-labs/utils';
|
|
3
4
|
import { verifyWallet, linkWallet } from '../../../data/api.js';
|
|
4
5
|
import { storeAuthToken } from '../../functions/storeAuthToken/index.js';
|
|
@@ -7,13 +8,14 @@ import { LAST_USED_WALLET } from '../../constants/localStorage.js';
|
|
|
7
8
|
import '../../constants/colors.js';
|
|
8
9
|
import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
9
10
|
import { logger } from '../../../shared/logger.js';
|
|
11
|
+
import '../../../config/LSSuffix.js';
|
|
10
12
|
import { setToLS } from '../../../shared/utils/functions/storage/setToLS.js';
|
|
11
13
|
import '@dynamic-labs/iconic';
|
|
12
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
13
14
|
import 'react/jsx-runtime';
|
|
14
15
|
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
15
16
|
import 'react';
|
|
16
17
|
import 'ethers';
|
|
18
|
+
import '../../../shared/consts/index.js';
|
|
17
19
|
import { getVerifyArgs } from '../../functions/getVerifyArgs/getVerifyArgs.js';
|
|
18
20
|
import { createUserProfile } from '../../functions/createUserProfile/createUserProfile.js';
|
|
19
21
|
import { isSupportedNetwork } from '../../functions/isSupportedNetwork/isSupportedNetwork.js';
|
|
@@ -23,20 +25,21 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useIn
|
|
|
23
25
|
import { useErrorContext } from '../../../context/ErrorContext/ErrorContext.js';
|
|
24
26
|
import { getSiweStatement } from '../../functions/getSiweStatement/getSiweStatement.js';
|
|
25
27
|
import { getWalletProvider } from '../../functions/getWalletProvider/getWalletProvider.js';
|
|
26
|
-
import '../../../
|
|
28
|
+
import { useAccessDeniedContext } from '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
27
29
|
|
|
28
30
|
// This logic is used to both verify or link a wallet
|
|
29
31
|
// Since we are re-using the different screens to authenticate or link the wallet.
|
|
30
32
|
// This logic is the best place to determine whether we should verify or verify and link.
|
|
31
33
|
const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, }) => {
|
|
32
|
-
const {
|
|
34
|
+
const { setDeniedAddress, setDeniedOauthProvider } = useAccessDeniedContext();
|
|
35
|
+
const { setView, goToInitialView } = useViewContext();
|
|
33
36
|
const { setErrorMessage, setError } = useErrorContext();
|
|
34
|
-
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken,
|
|
37
|
+
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, } = useInternalDynamicContext();
|
|
35
38
|
// If the user is not already logged it means that we only need to verify
|
|
36
39
|
// We need this boolean for the part of the logic where we already persisted a new authToken,
|
|
37
40
|
// and need to distinguish between logic for verify or linking.
|
|
38
41
|
const verifyOnly = !authToken;
|
|
39
|
-
const generateJWT = (walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
const generateJWT = (walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
43
|
let Jwt;
|
|
41
44
|
const nonce = consumeNonce();
|
|
42
45
|
if (nonce === undefined)
|
|
@@ -52,7 +55,8 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
52
55
|
walletProvider,
|
|
53
56
|
});
|
|
54
57
|
if (authToken === undefined || !multiWalletEnabled) {
|
|
55
|
-
Jwt = yield verifyWallet(environmentId, Object.assign(Object.assign({}, verifyArgs), { captchaToken
|
|
58
|
+
Jwt = yield verifyWallet(environmentId, Object.assign(Object.assign({}, verifyArgs), { captchaToken,
|
|
59
|
+
oauth }));
|
|
56
60
|
}
|
|
57
61
|
else {
|
|
58
62
|
Jwt = yield linkWallet(environmentId, verifyArgs, authToken);
|
|
@@ -82,7 +86,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
88
|
};
|
|
85
|
-
const handleError = (e, walletConnector) => {
|
|
89
|
+
const handleError = (e, walletConnector, address, oauth) => {
|
|
86
90
|
// This is a special case where the user is trying to link a wallet
|
|
87
91
|
// and the wallet is already linked and we don't want to kill the session.
|
|
88
92
|
if (e instanceof WalletUsedError) {
|
|
@@ -100,13 +104,18 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
100
104
|
return;
|
|
101
105
|
}
|
|
102
106
|
if (e instanceof NoAccessError) {
|
|
107
|
+
setDeniedAddress(address);
|
|
108
|
+
// we need to set this value if it's magic in order to set proper icon
|
|
109
|
+
if (isSocialWalletConnector(walletConnector)) {
|
|
110
|
+
setDeniedOauthProvider(oauth === null || oauth === void 0 ? void 0 : oauth.provider);
|
|
111
|
+
}
|
|
103
112
|
setView('no-access');
|
|
104
113
|
return;
|
|
105
114
|
}
|
|
106
115
|
if (connectedWallet && authMode === 'connect-only') {
|
|
107
116
|
throw new DynamicError(e.message);
|
|
108
117
|
}
|
|
109
|
-
|
|
118
|
+
goToInitialView();
|
|
110
119
|
logger.error(e);
|
|
111
120
|
if (debugError) {
|
|
112
121
|
setError(`${e.message}\n ${e.stack}`);
|
|
@@ -115,7 +124,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
115
124
|
setErrorMessage(e.code);
|
|
116
125
|
}
|
|
117
126
|
};
|
|
118
|
-
return ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
|
+
return ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
119
128
|
const walletProvider = getWalletProvider(walletConnector);
|
|
120
129
|
const network = yield walletConnector.getNetwork();
|
|
121
130
|
const _isSupportedNetwork = isSupportedNetwork({
|
|
@@ -123,7 +132,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
123
132
|
walletConnector,
|
|
124
133
|
});
|
|
125
134
|
try {
|
|
126
|
-
const Jwt = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken);
|
|
135
|
+
const Jwt = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth);
|
|
127
136
|
const decodedJwt = decodeJwt(Jwt);
|
|
128
137
|
if (decodedJwt === undefined)
|
|
129
138
|
throw new DynamicError('Invalid token!');
|
|
@@ -161,7 +170,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
161
170
|
}
|
|
162
171
|
}
|
|
163
172
|
catch (e) {
|
|
164
|
-
handleError(e, walletConnector);
|
|
173
|
+
handleError(e, walletConnector, publicWalletAddress, oauth);
|
|
165
174
|
}
|
|
166
175
|
});
|
|
167
176
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
6
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
7
|
+
require('@dynamic-labs/sdk-api');
|
|
8
|
+
require('../../../shared/logger.cjs');
|
|
9
|
+
require('../../../config/LSSuffix.cjs');
|
|
10
|
+
require('@dynamic-labs/iconic');
|
|
11
|
+
require('react/jsx-runtime');
|
|
12
|
+
require('../../../context/ViewContext/ViewContext.cjs');
|
|
13
|
+
require('react');
|
|
14
|
+
require('@dynamic-labs/utils');
|
|
15
|
+
require('../../constants/colors.cjs');
|
|
16
|
+
require('ethers');
|
|
17
|
+
require('../../../shared/consts/index.cjs');
|
|
18
|
+
require('@dynamic-labs/multi-wallet');
|
|
19
|
+
var getReferencedAccount = require('../../functions/getReferencedAccount/getReferencedAccount.cjs');
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* This function will use a referenced account to kick off the social wallet
|
|
23
|
+
* authentication. This is useful in the multiwallet scenario where the user
|
|
24
|
+
* wants to set their disconnected social wallet as their primary wallet, in
|
|
25
|
+
* which case the wallet needs to be reconnected
|
|
26
|
+
*/
|
|
27
|
+
const reconnectSocialWallet = (jwt, wallet) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
if (!walletConnectorCore.isSocialWalletConnector(wallet.connector)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const socialAccountDataForWallet = getReferencedAccount.getReferencedAccount(jwt, wallet.id);
|
|
32
|
+
if (!socialAccountDataForWallet ||
|
|
33
|
+
!socialAccountDataForWallet.oauthProvider) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
yield wallet.connector.connect(socialAccountDataForWallet.oauthProvider);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
exports.reconnectSocialWallet = reconnectSocialWallet;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Wallet } from '../../../shared';
|
|
2
|
+
/**
|
|
3
|
+
* This function will use a referenced account to kick off the social wallet
|
|
4
|
+
* authentication. This is useful in the multiwallet scenario where the user
|
|
5
|
+
* wants to set their disconnected social wallet as their primary wallet, in
|
|
6
|
+
* which case the wallet needs to be reconnected
|
|
7
|
+
*/
|
|
8
|
+
export declare const reconnectSocialWallet: (jwt: string | undefined, wallet: Wallet) => Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { isSocialWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import '@dynamic-labs/sdk-api';
|
|
4
|
+
import '../../../shared/logger.js';
|
|
5
|
+
import '../../../config/LSSuffix.js';
|
|
6
|
+
import '@dynamic-labs/iconic';
|
|
7
|
+
import 'react/jsx-runtime';
|
|
8
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '@dynamic-labs/utils';
|
|
11
|
+
import '../../constants/colors.js';
|
|
12
|
+
import 'ethers';
|
|
13
|
+
import '../../../shared/consts/index.js';
|
|
14
|
+
import '@dynamic-labs/multi-wallet';
|
|
15
|
+
import { getReferencedAccount } from '../../functions/getReferencedAccount/getReferencedAccount.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This function will use a referenced account to kick off the social wallet
|
|
19
|
+
* authentication. This is useful in the multiwallet scenario where the user
|
|
20
|
+
* wants to set their disconnected social wallet as their primary wallet, in
|
|
21
|
+
* which case the wallet needs to be reconnected
|
|
22
|
+
*/
|
|
23
|
+
const reconnectSocialWallet = (jwt, wallet) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
if (!isSocialWalletConnector(wallet.connector)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const socialAccountDataForWallet = getReferencedAccount(jwt, wallet.id);
|
|
28
|
+
if (!socialAccountDataForWallet ||
|
|
29
|
+
!socialAccountDataForWallet.oauthProvider) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
yield wallet.connector.connect(socialAccountDataForWallet.oauthProvider);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export { reconnectSocialWallet };
|
|
@@ -6,8 +6,9 @@ var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
8
|
var utils = require('@dynamic-labs/utils');
|
|
9
|
-
|
|
9
|
+
require('@dynamic-labs/sdk-api');
|
|
10
10
|
var logger = require('../../../shared/logger.cjs');
|
|
11
|
+
require('../../../config/LSSuffix.cjs');
|
|
11
12
|
require('@dynamic-labs/iconic');
|
|
12
13
|
require('react/jsx-runtime');
|
|
13
14
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
@@ -16,79 +17,35 @@ require('../../constants/colors.cjs');
|
|
|
16
17
|
require('ethers');
|
|
17
18
|
var useLocalStorage = require('../../../shared/utils/hooks/useLocalStorage/useLocalStorage.cjs');
|
|
18
19
|
require('../../../shared/consts/index.cjs');
|
|
19
|
-
var isWalletConnected = require('../../functions/isWalletConnected/isWalletConnected.cjs');
|
|
20
20
|
var isSameWalletName = require('../../functions/isSameWalletName/isSameWalletName.cjs');
|
|
21
|
-
require('
|
|
22
|
-
require('
|
|
23
|
-
var
|
|
21
|
+
var useWalletsConnectionState = require('../useWalletsConnectionState/useWalletsConnectionState.cjs');
|
|
22
|
+
var primaryWalletIdValidator = require('./utils/primaryWalletIdValidator/primaryWalletIdValidator.cjs');
|
|
23
|
+
var createLinkedWalletsFromWalletOptions = require('./utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs');
|
|
24
|
+
var reconnectSocialWallet = require('./reconnectSocialWallet.cjs');
|
|
24
25
|
|
|
25
26
|
const useWalletConnectors = ({ authToken, wallets: availableWallets, multiWalletWidgetState, setDesktopUri, setMultiWalletWidgetState, setQrcodeUri, }) => {
|
|
26
27
|
const [showQrcodeModal, setShowQrcodeModal] = React.useState(false);
|
|
27
|
-
const [
|
|
28
|
-
const
|
|
28
|
+
const [primaryWalletId, setPrimaryWalletIdState, clearPrimaryWalletId] = useLocalStorage.useLocalStorage(localStorage$1.PRIMARY_WALLET_ID, undefined, primaryWalletIdValidator.primaryWalletIdValidator);
|
|
29
|
+
const linkedWallets = React.useMemo(() => {
|
|
30
|
+
if (!authToken) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
return createLinkedWalletsFromWalletOptions.createLinkedWalletsFromWalletOptions({
|
|
34
|
+
authToken,
|
|
35
|
+
primaryWalletId,
|
|
36
|
+
walletOptions: availableWallets,
|
|
37
|
+
});
|
|
38
|
+
}, [availableWallets, primaryWalletId, authToken]);
|
|
39
|
+
const { connectedWalletMap, computeConnectedStateForWallets, didConnectedStateLoad, } = useWalletsConnectionState.useWalletsConnectionState(linkedWallets);
|
|
40
|
+
const wallets = React.useMemo(() => linkedWallets.map((wallet) => (Object.assign(Object.assign({}, wallet), { connected: Boolean(connectedWalletMap[wallet.id]) }))), [connectedWalletMap, linkedWallets]);
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
computeConnectedStateForWallets();
|
|
43
|
+
}, [primaryWalletId, computeConnectedStateForWallets]);
|
|
29
44
|
const setPrimaryWalletId = React.useCallback((walletId) => {
|
|
30
45
|
setPrimaryWalletIdState(walletId);
|
|
31
46
|
}, [setPrimaryWalletIdState]);
|
|
32
|
-
const
|
|
33
|
-
setWallets([]);
|
|
34
|
-
clearPrimaryWalletId();
|
|
35
|
-
}, [clearPrimaryWalletId]);
|
|
36
|
-
const getPrimaryWallet = React.useCallback(() => {
|
|
37
|
-
const primaryWallet = wallets.find((wallet) => wallet.id === primaryWalletId);
|
|
38
|
-
if (!primaryWallet) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
return primaryWallet;
|
|
42
|
-
}, [primaryWalletId, wallets]);
|
|
47
|
+
const getPrimaryWallet = React.useCallback(() => { var _a; return (_a = wallets.find((wallet) => wallet.id === primaryWalletId)) !== null && _a !== void 0 ? _a : null; }, [primaryWalletId, wallets]);
|
|
43
48
|
const getSecondaryWallets = React.useCallback(() => wallets.filter((wallet) => wallet.id !== primaryWalletId), [primaryWalletId, wallets]);
|
|
44
|
-
React.useEffect(() => {
|
|
45
|
-
const decodedJwt = decodeJwt.decodeJwt(authToken);
|
|
46
|
-
// wallet state should be null while loading all the wallets or when there is no user
|
|
47
|
-
if (!availableWallets || !decodedJwt) {
|
|
48
|
-
setWallets([]);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
Promise.all(decodedJwt.verifiedCredentials.map((account) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
-
const wallet = availableWallets.find((wallet) => account.walletName &&
|
|
53
|
-
isSameWalletName.isSameWalletName(wallet.name, account.walletName));
|
|
54
|
-
// this probably shouldn't happen. this would mean that the user has an account linked
|
|
55
|
-
// with wallet W, but the customer has toggled off wallet W or the chain that
|
|
56
|
-
// supports wallet W
|
|
57
|
-
/* istanbul ignore next */
|
|
58
|
-
if (!wallet)
|
|
59
|
-
return null;
|
|
60
|
-
if (account.id === primaryWalletId &&
|
|
61
|
-
shouldManuallyReconnectOnRefresh.shouldManuallyReconnectOnRefresh(wallet.walletConnector)) {
|
|
62
|
-
yield wallet.walletConnector.connect();
|
|
63
|
-
}
|
|
64
|
-
if (account.address && account.chain) {
|
|
65
|
-
return {
|
|
66
|
-
address: account.address,
|
|
67
|
-
chain: account.chain,
|
|
68
|
-
connected: yield isWalletConnected.isWalletConnected({
|
|
69
|
-
address: account.address,
|
|
70
|
-
chain: account.chain,
|
|
71
|
-
connector: wallet.walletConnector,
|
|
72
|
-
}),
|
|
73
|
-
connector: wallet.walletConnector,
|
|
74
|
-
id: account.id,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
return null;
|
|
78
|
-
}))).then((result) => {
|
|
79
|
-
setWallets(result.filter((wc) => wc !== null));
|
|
80
|
-
return null;
|
|
81
|
-
});
|
|
82
|
-
}, [availableWallets, primaryWalletId, authToken]);
|
|
83
|
-
const computeConnectedStateForWallets = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
-
if (!primaryWalletId)
|
|
85
|
-
return;
|
|
86
|
-
const connectionMap = {};
|
|
87
|
-
for (const wallet of wallets) {
|
|
88
|
-
connectionMap[wallet.id] = yield isWalletConnected.isWalletConnected(wallet);
|
|
89
|
-
}
|
|
90
|
-
setWallets((currentWallets) => currentWallets.map((wallet) => (Object.assign(Object.assign({}, wallet), { connected: connectionMap[wallet.id] }))));
|
|
91
|
-
}), [primaryWalletId, wallets]);
|
|
92
49
|
const getSelectedWallet = React.useCallback((walletId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
93
50
|
const newWallet = wallets.find(({ id }) => id === walletId);
|
|
94
51
|
if (!newWallet) {
|
|
@@ -97,9 +54,7 @@ const useWalletConnectors = ({ authToken, wallets: availableWallets, multiWallet
|
|
|
97
54
|
const connectedAccounts = yield newWallet.connector.getConnectedAccounts();
|
|
98
55
|
return { connectedAccounts, newWallet };
|
|
99
56
|
}), [wallets]);
|
|
100
|
-
const checkIfAccountChangeIsRequired = React.useCallback((primaryWallet, newPrimaryWallet) => {
|
|
101
|
-
if (!primaryWallet)
|
|
102
|
-
return;
|
|
57
|
+
const checkIfAccountChangeIsRequired = React.useCallback((primaryWallet, newPrimaryWallet, connectedAccounts) => {
|
|
103
58
|
/**
|
|
104
59
|
* we need to check multiWalletWidgetState here because `setPrimaryWallet` currently gets
|
|
105
60
|
* called twice: once when the user clicks "make active" and once when the user performs
|
|
@@ -107,8 +62,12 @@ const useWalletConnectors = ({ authToken, wallets: availableWallets, multiWallet
|
|
|
107
62
|
* (https://github.com/dynamic-labs/DynamicAuth/pull/550) is merged, since setting the
|
|
108
63
|
* primary wallet will be simpler, so we won't need to call `setPrimaryWallet` twice.
|
|
109
64
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
65
|
+
if (!primaryWallet || multiWalletWidgetState !== 'idle')
|
|
66
|
+
return;
|
|
67
|
+
const accountIsNotConnectedInSecondaryWallet = connectedAccounts &&
|
|
68
|
+
!connectedAccounts.find((connectedAccount) => connectedAccount.toLowerCase() ===
|
|
69
|
+
newPrimaryWallet.address.toLowerCase());
|
|
70
|
+
return (isSameWalletName.isSameWalletName(newPrimaryWallet.connector.name, primaryWallet.connector.name) || accountIsNotConnectedInSecondaryWallet);
|
|
112
71
|
}, [multiWalletWidgetState]);
|
|
113
72
|
const checkIfShowQrCodeModal = React.useCallback((wallet) => !wallet.connector.isInstalledOnBrowser() &&
|
|
114
73
|
!wallet.connector.canConnectViaCustodialService, []);
|
|
@@ -123,7 +82,8 @@ const useWalletConnectors = ({ authToken, wallets: availableWallets, multiWallet
|
|
|
123
82
|
return;
|
|
124
83
|
const primaryWallet = getPrimaryWallet();
|
|
125
84
|
if (checkIfAccountChangeIsRequired(primaryWallet, newPrimaryWallet)) {
|
|
126
|
-
|
|
85
|
+
yield newPrimaryWallet.connector.connect();
|
|
86
|
+
setPrimaryWalletId(walletId);
|
|
127
87
|
return;
|
|
128
88
|
}
|
|
129
89
|
if (!connectedAccounts.length) {
|
|
@@ -137,6 +97,11 @@ const useWalletConnectors = ({ authToken, wallets: availableWallets, multiWallet
|
|
|
137
97
|
emailConnector.setEmail(email);
|
|
138
98
|
}
|
|
139
99
|
}
|
|
100
|
+
if (walletConnectorCore.isSocialWalletConnector(newPrimaryWallet.connector) &&
|
|
101
|
+
!newPrimaryWallet.connected) {
|
|
102
|
+
reconnectSocialWallet.reconnectSocialWallet(authToken, newPrimaryWallet);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
140
105
|
/* istanbul ignore next */
|
|
141
106
|
const publicAddress = yield newPrimaryWallet.connector.fetchPublicAddress({
|
|
142
107
|
onDesktopUri: (uri) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -146,6 +111,16 @@ const useWalletConnectors = ({ authToken, wallets: availableWallets, multiWallet
|
|
|
146
111
|
setQrcodeUri(uri);
|
|
147
112
|
}),
|
|
148
113
|
});
|
|
114
|
+
/**
|
|
115
|
+
* need to check for connected account again for wallets that disconnect on refresh
|
|
116
|
+
* and only reconnect upon fetching public address above
|
|
117
|
+
*/
|
|
118
|
+
const updatedConnectedAccounts = yield newPrimaryWallet.connector.getConnectedAccounts();
|
|
119
|
+
if (checkIfAccountChangeIsRequired(primaryWallet, newPrimaryWallet, updatedConnectedAccounts) &&
|
|
120
|
+
!walletConnectorCore.isEmailWalletConnector(newPrimaryWallet.connector)) {
|
|
121
|
+
setMultiWalletWidgetState('awaiting_account_switch', 'switching_primary');
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
149
124
|
if (publicAddress) {
|
|
150
125
|
setPrimaryWalletId(walletId);
|
|
151
126
|
setMultiWalletWidgetState('idle');
|
|
@@ -154,6 +129,7 @@ const useWalletConnectors = ({ authToken, wallets: availableWallets, multiWallet
|
|
|
154
129
|
logger.logger.error('Failed to connect to wallet');
|
|
155
130
|
}
|
|
156
131
|
}), [
|
|
132
|
+
authToken,
|
|
157
133
|
checkIfAccountChangeIsRequired,
|
|
158
134
|
checkIfShowQrCodeModal,
|
|
159
135
|
getPrimaryWallet,
|
|
@@ -166,8 +142,9 @@ const useWalletConnectors = ({ authToken, wallets: availableWallets, multiWallet
|
|
|
166
142
|
]);
|
|
167
143
|
const walletConnectors = wallets.map((wallet) => wallet.connector);
|
|
168
144
|
return {
|
|
169
|
-
|
|
145
|
+
clearPrimaryWalletId,
|
|
170
146
|
computeConnectedStateForWallets,
|
|
147
|
+
didConnectedStateLoad,
|
|
171
148
|
getPrimaryWallet,
|
|
172
149
|
getSecondaryWallets,
|
|
173
150
|
primaryWallet: getPrimaryWallet(),
|
|
@@ -11,8 +11,9 @@ type Props = {
|
|
|
11
11
|
wallets: WalletOption[];
|
|
12
12
|
};
|
|
13
13
|
export interface UseWalletConnectors {
|
|
14
|
-
|
|
14
|
+
clearPrimaryWalletId: () => void;
|
|
15
15
|
computeConnectedStateForWallets: () => Promise<void>;
|
|
16
|
+
didConnectedStateLoad: boolean;
|
|
16
17
|
getPrimaryWallet: () => Wallet | null;
|
|
17
18
|
getSecondaryWallets: () => Wallet[];
|
|
18
19
|
primaryWallet: Wallet | null;
|