@dynamic-labs/sdk-react-core 0.19.0-alpha.0 → 0.19.0-alpha.2
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 +78 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +11 -10
- package/src/index.cjs +40 -12
- package/src/index.d.ts +4 -7
- package/src/index.js +22 -6
- package/src/lib/Main.cjs +14 -3
- package/src/lib/Main.js +14 -3
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.cjs +5 -1
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.js +5 -1
- package/src/lib/components/AnimatePresence/AnimatePresence.cjs +6 -2
- package/src/lib/components/AnimatePresence/AnimatePresence.js +6 -2
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +14 -7
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +14 -7
- package/src/lib/components/Button/Button.cjs +10 -7
- package/src/lib/components/Button/Button.d.ts +3 -3
- package/src/lib/components/Button/Button.js +10 -7
- package/src/lib/components/Divider/Divider.cjs +7 -3
- package/src/lib/components/Divider/Divider.js +7 -3
- package/src/lib/components/DynamicConnectButton/components/ConnectButton.cjs +1 -1
- package/src/lib/components/DynamicConnectButton/components/ConnectButton.js +1 -1
- package/src/lib/components/ErrorContainer/ErrorContainer.d.ts +1 -1
- package/src/lib/components/Icon/Icon.cjs +1 -0
- package/src/lib/components/Icon/Icon.js +1 -0
- package/src/lib/components/Icon/Icon.types.d.ts +1 -1
- package/src/lib/components/IconWithSpinner/IconWithSpinner.d.ts +1 -1
- package/src/lib/components/ListTile/ListTile.cjs +1 -1
- package/src/lib/components/ListTile/ListTile.js +1 -1
- package/src/lib/components/ListTile/ListTile.types.d.ts +1 -0
- package/src/lib/components/MenuList/Dropdown/Dropdown.cjs +5 -1
- package/src/lib/components/MenuList/Dropdown/Dropdown.js +5 -1
- package/src/lib/components/Modal/Modal.cjs +5 -1
- package/src/lib/components/Modal/Modal.js +5 -1
- package/src/lib/components/ModalHeader/ModalHeader.cjs +2 -2
- package/src/lib/components/ModalHeader/ModalHeader.js +2 -2
- package/src/lib/components/ModalHeader/ModalHeader.types.d.ts +2 -1
- package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.cjs +4 -2
- package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.d.ts +2 -1
- package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.js +4 -2
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +6 -2
- package/src/lib/components/NetworkPicker/NetworkPicker.js +6 -2
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.cjs +7 -3
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.js +7 -3
- package/src/lib/components/NetworkPicker/components/Network/Network.cjs +7 -3
- package/src/lib/components/NetworkPicker/components/Network/Network.js +7 -3
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.cjs +7 -3
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.js +7 -3
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +12 -6
- package/src/lib/components/OTPVerificationView/OTPVerificationView.d.ts +2 -0
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +12 -6
- package/src/lib/components/OverlayCard/OverlayCard.cjs +5 -1
- package/src/lib/components/OverlayCard/OverlayCard.js +5 -1
- package/src/lib/components/Portal/Portal.cjs +5 -1
- package/src/lib/components/Portal/Portal.js +5 -1
- package/src/lib/components/PoweredByDynamic/PoweredByDynamic.cjs +6 -2
- package/src/lib/components/PoweredByDynamic/PoweredByDynamic.d.ts +1 -0
- package/src/lib/components/PoweredByDynamic/PoweredByDynamic.js +6 -2
- package/src/lib/components/Tooltip/Tooltip.cjs +5 -1
- package/src/lib/components/Tooltip/Tooltip.js +5 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +3 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +3 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +7 -3
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +7 -3
- package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.cjs +5 -1
- package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.js +5 -1
- package/src/lib/components/Typography/Typography.cjs +1 -0
- package/src/lib/components/Typography/Typography.js +1 -0
- package/src/lib/components/Typography/Typography.types.d.ts +1 -1
- package/src/lib/components/UserAddress/UserAddress.cjs +5 -1
- package/src/lib/components/UserAddress/UserAddress.js +5 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +7 -3
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +7 -3
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.cjs +7 -3
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.js +7 -3
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +7 -4
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +7 -4
- package/src/lib/components/UserProfileForm/UserProfileForm.cjs +26 -14
- package/src/lib/components/UserProfileForm/UserProfileForm.d.ts +14 -3
- package/src/lib/components/UserProfileForm/UserProfileForm.js +27 -15
- package/src/lib/components/UserProfileForm/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +40 -11
- package/src/lib/context/DynamicContext/DynamicContext.js +42 -13
- package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.cjs +13 -3
- package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.js +13 -3
- package/src/lib/context/DynamicContext/internalEvents/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.cjs +14 -0
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.d.ts +8 -0
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.js +6 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +8 -5
- package/src/lib/context/DynamicContext/useCustomerCallbacks/types.d.ts +9 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs +5 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.js +5 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +64 -33
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.d.ts +3 -3
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +64 -33
- 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/MockContext/MockContext.cjs +7 -3
- package/src/lib/context/MockContext/MockContext.js +7 -3
- package/src/lib/context/QrCodeContext/QrCodeContext.cjs +6 -2
- package/src/lib/context/QrCodeContext/QrCodeContext.js +6 -2
- package/src/lib/context/SendBalanceContext/SendBalanceContext.cjs +5 -1
- package/src/lib/context/SendBalanceContext/SendBalanceContext.js +5 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +8 -3
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +8 -3
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.cjs +67 -0
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.d.ts +14 -0
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.js +62 -0
- package/src/lib/context/UserFieldEditorContext/index.d.ts +1 -0
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
- package/src/lib/context/WalletContext/WalletContext.cjs +1 -0
- package/src/lib/context/WalletContext/WalletContext.js +1 -0
- package/src/lib/data/api.cjs +33 -1
- package/src/lib/data/api.d.ts +3 -1
- package/src/lib/data/api.js +34 -4
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +7 -3
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +7 -3
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +18 -6
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +18 -6
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.cjs +7 -3
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.js +7 -3
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/Item/Item.cjs +7 -3
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/Item/Item.js +7 -3
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +7 -3
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +7 -3
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs +7 -3
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js +7 -3
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletMoreInfoContent/WalletMoreInfoContent.cjs +7 -3
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletMoreInfoContent/WalletMoreInfoContent.js +7 -3
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.cjs +7 -3
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.js +7 -3
- package/src/lib/layout/DynamicAuthLayout/WalletProgressStepper/WalletProgressStepper.cjs +7 -3
- package/src/lib/layout/DynamicAuthLayout/WalletProgressStepper/WalletProgressStepper.js +7 -3
- package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.cjs +7 -3
- package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.js +7 -3
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.cjs +7 -3
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.js +7 -3
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.cjs +7 -3
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.js +7 -3
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.cjs +7 -3
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.js +7 -3
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +7 -3
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +7 -3
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +18 -5
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +18 -5
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.types.d.ts +2 -0
- package/src/lib/modals/UserFieldEditorModal/UserFieldEditorModal.cjs +76 -0
- package/src/lib/modals/UserFieldEditorModal/UserFieldEditorModal.d.ts +10 -0
- package/src/lib/modals/UserFieldEditorModal/UserFieldEditorModal.js +72 -0
- package/src/lib/modals/UserFieldEditorModal/index.d.ts +1 -0
- package/src/lib/modals/index.d.ts +1 -0
- package/src/lib/shared/assets/at.cjs +53 -0
- package/src/lib/shared/assets/at.js +29 -0
- package/src/lib/shared/assets/double-arrow-right.cjs +53 -0
- package/src/lib/shared/assets/double-arrow-right.js +29 -0
- package/src/lib/shared/assets/index.d.ts +11 -0
- package/src/lib/shared/assets/justified-text.cjs +53 -0
- package/src/lib/shared/assets/justified-text.js +29 -0
- package/src/lib/shared/assets/location.cjs +53 -0
- package/src/lib/shared/assets/location.js +29 -0
- package/src/lib/shared/assets/mail.cjs +53 -0
- package/src/lib/shared/assets/mail.js +29 -0
- package/src/lib/shared/assets/phone.cjs +53 -0
- package/src/lib/shared/assets/phone.js +29 -0
- package/src/lib/shared/assets/size-labels.cjs +53 -0
- package/src/lib/shared/assets/size-labels.js +29 -0
- package/src/lib/shared/assets/sparkles.cjs +53 -0
- package/src/lib/shared/assets/sparkles.js +29 -0
- package/src/lib/shared/assets/user-card.cjs +53 -0
- package/src/lib/shared/assets/user-card.js +29 -0
- package/src/lib/shared/assets/user.cjs +53 -0
- package/src/lib/shared/assets/user.js +29 -0
- package/src/lib/shared/assets/work-suitcase.cjs +53 -0
- package/src/lib/shared/assets/work-suitcase.js +29 -0
- package/src/lib/shared/types/index.d.ts +4 -0
- package/src/lib/shared/utils/functions/splitCamelCase/index.d.ts +1 -0
- package/src/lib/shared/utils/functions/splitCamelCase/splitCamelCase.cjs +8 -0
- package/src/lib/shared/utils/functions/splitCamelCase/splitCamelCase.d.ts +1 -0
- package/src/lib/shared/utils/functions/splitCamelCase/splitCamelCase.js +4 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/errors.cjs +7 -0
- package/src/lib/utils/constants/errors.d.ts +1 -0
- package/src/lib/utils/constants/errors.js +3 -0
- package/src/lib/utils/constants/index.d.ts +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/digestSHA256/digestSHA256.cjs +11 -0
- package/src/lib/utils/functions/digestSHA256/digestSHA256.d.ts +1 -0
- package/src/lib/utils/functions/digestSHA256/digestSHA256.js +7 -0
- package/src/lib/utils/functions/digestSHA256/index.d.ts +1 -0
- package/src/lib/utils/functions/encodeBase64URL/encodeBase64URL.cjs +14 -0
- package/src/lib/utils/functions/encodeBase64URL/encodeBase64URL.d.ts +1 -0
- package/src/lib/utils/functions/encodeBase64URL/encodeBase64URL.js +10 -0
- package/src/lib/utils/functions/encodeBase64URL/index.d.ts +1 -0
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.cjs +1 -1
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.js +1 -1
- package/src/lib/utils/functions/getRedirectURIOrigin/getRedirectURIOrigin.cjs +33 -0
- package/src/lib/utils/functions/getRedirectURIOrigin/getRedirectURIOrigin.d.ts +1 -0
- package/src/lib/utils/functions/getRedirectURIOrigin/getRedirectURIOrigin.js +29 -0
- package/src/lib/utils/functions/getRedirectURIOrigin/index.d.ts +1 -0
- package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.cjs +14 -2
- package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.d.ts +3 -2
- package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.js +14 -2
- package/src/lib/utils/functions/getUserProfileFields/index.d.ts +1 -0
- package/src/lib/utils/functions/index.d.ts +8 -0
- package/src/lib/utils/functions/isMagicConnector/index.d.ts +1 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.cjs +10 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.d.ts +2 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.js +6 -0
- package/src/lib/utils/functions/randomString/index.d.ts +1 -0
- package/src/lib/utils/functions/randomString/randomString.cjs +14 -0
- package/src/lib/utils/functions/randomString/randomString.d.ts +1 -0
- package/src/lib/utils/functions/randomString/randomString.js +10 -0
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/index.d.ts +1 -0
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.cjs +45 -0
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.d.ts +17 -0
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.js +40 -0
- package/src/lib/utils/functions/stringifyURIQuery/index.d.ts +1 -0
- package/src/lib/utils/functions/stringifyURIQuery/stringifyURIQuery.cjs +13 -0
- package/src/lib/utils/functions/stringifyURIQuery/stringifyURIQuery.d.ts +1 -0
- package/src/lib/utils/functions/stringifyURIQuery/stringifyURIQuery.js +9 -0
- package/src/lib/utils/hooks/authenticationHooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +7 -5
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.d.ts +4 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +7 -5
- package/src/lib/utils/hooks/index.d.ts +10 -2
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.cjs +19 -3
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.d.ts +1 -2
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.js +20 -4
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +11 -9
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.d.ts +1 -1
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +11 -9
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.cjs +1 -0
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js +1 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +2 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +2 -1
- package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.cjs +1 -0
- package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.js +1 -0
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.cjs +7 -0
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.d.ts +6 -0
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.js +7 -0
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +2 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +2 -2
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +7 -6
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +7 -6
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs +2 -7
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js +2 -7
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/index.d.ts +1 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.cjs +16 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.d.ts +2 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.js +12 -0
- package/src/lib/utils/hooks/useFindSocialIcon/index.d.ts +1 -0
- package/src/lib/utils/hooks/{useGetSocialIcon/useGetSocialIcon.cjs → useFindSocialIcon/useFindSocialIcon.cjs} +3 -3
- package/src/lib/utils/hooks/useFindSocialIcon/useFindSocialIcon.d.ts +3 -0
- package/src/lib/utils/hooks/useFindSocialIcon/useFindSocialIcon.js +10 -0
- package/src/lib/utils/hooks/useOnUnmount/index.d.ts +1 -0
- package/src/lib/utils/hooks/useOnUnmount/useOnUnmount.cjs +21 -0
- package/src/lib/utils/hooks/useOnUnmount/useOnUnmount.d.ts +1 -0
- package/src/lib/utils/hooks/useOnUnmount/useOnUnmount.js +17 -0
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs +6 -2
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.d.ts +2 -1
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js +6 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +164 -35
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.d.ts +7 -3
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +166 -37
- package/src/lib/utils/hooks/useTransactionEstimatedGas/index.d.ts +1 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.cjs +61 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.d.ts +20 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.js +57 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/index.d.ts +1 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.cjs +47 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.d.ts +32 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.js +43 -0
- package/src/lib/utils/hooks/useUserDataForm/index.d.ts +1 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/index.d.ts +3 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/index.d.ts +1 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs +107 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.d.ts +9 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js +103 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/index.d.ts +2 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/types.d.ts +7 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.cjs +73 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.d.ts +7 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.js +69 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/validateUpdateRequest/index.d.ts +1 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/validateUpdateRequest/validateUpdateRequest.cjs +31 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/validateUpdateRequest/validateUpdateRequest.d.ts +6 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/validateUpdateRequest/validateUpdateRequest.js +27 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs +7 -94
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.d.ts +4 -24
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js +7 -94
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -0
- package/src/lib/utils/hooks/useWalletConnectorEvent/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.cjs +42 -0
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.d.ts +12 -0
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.js +38 -0
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +12 -0
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +12 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +91 -136
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +1 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +92 -137
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +1 -0
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +1 -0
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +8 -4
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.d.ts +5 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +8 -4
- package/src/lib/utils/hooks/useWallets/useWallets.d.ts +2 -2
- package/src/lib/views/AccountExistsView/AccountExistsView.cjs +10 -6
- package/src/lib/views/AccountExistsView/AccountExistsView.js +10 -6
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +17 -7
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +17 -7
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +7 -3
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +7 -3
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +6 -2
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +6 -2
- package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +11 -4
- package/src/lib/views/CollectUserDataView/UserDataFields/index.js +11 -4
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs +7 -3
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js +7 -3
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +7 -3
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +7 -3
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +20 -8
- package/src/lib/views/EmailUpdate/EmailUpdate.js +20 -8
- package/src/lib/views/EmailVerification/EmailVerification.cjs +56 -11
- package/src/lib/views/EmailVerification/EmailVerification.js +59 -14
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +8 -3
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +8 -3
- package/src/lib/views/LoginWithEmailView/components/ListItemButton/ListItemButton.cjs +7 -3
- package/src/lib/views/LoginWithEmailView/components/ListItemButton/ListItemButton.js +7 -3
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs +14 -8
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.d.ts +5 -1
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js +15 -9
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.cjs +4 -1
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.js +4 -1
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +10 -6
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +10 -6
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +114 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.d.ts +2 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +110 -0
- package/src/lib/views/MergeUserAccountsView/index.d.ts +1 -0
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +22 -6
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +22 -6
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +23 -7
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +23 -7
- package/src/lib/views/NoAccess/NoAccess.cjs +7 -4
- package/src/lib/views/NoAccess/NoAccess.js +7 -4
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +7 -3
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +7 -3
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.cjs +7 -3
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.js +7 -3
- package/src/lib/views/PendingConnectView/PendingConnectView.cjs +7 -3
- package/src/lib/views/PendingConnectView/PendingConnectView.js +7 -3
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +7 -3
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +7 -3
- package/src/lib/views/QrCodeView/QRCode.cjs +5 -1
- package/src/lib/views/QrCodeView/QRCode.js +5 -1
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +7 -3
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +7 -3
- package/src/lib/views/QrCodeView/QrCodeView.cjs +7 -3
- package/src/lib/views/QrCodeView/QrCodeView.js +7 -3
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +18 -17
- package/src/lib/views/SendBalanceView/SendBalanceView.js +18 -17
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.cjs +71 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.d.ts +8 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.js +67 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/index.d.ts +1 -0
- package/src/lib/views/SendBalanceView/components/index.d.ts +1 -0
- package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +10 -7
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +10 -7
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.cjs +10 -6
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.js +10 -6
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +27 -5
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +27 -5
- package/src/lib/views/TransactionConfirmationView/hooks/index.d.ts +2 -1
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/index.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/hooks/{useTransactionData/useTransactionData.cjs → useTransactionGas/useTransactionGas.cjs} +22 -43
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.d.ts +11 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.js +71 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/index.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.cjs +14 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.d.ts +7 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.js +10 -0
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.cjs +73 -0
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.d.ts +9 -0
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.js +69 -0
- package/src/lib/views/UserFieldEditorView/UserFieldsToIcon/UserFieldsToIcon.cjs +48 -0
- package/src/lib/views/UserFieldEditorView/UserFieldsToIcon/UserFieldsToIcon.d.ts +7 -0
- package/src/lib/views/UserFieldEditorView/UserFieldsToIcon/UserFieldsToIcon.js +44 -0
- package/src/lib/views/UserFieldEditorView/UserFieldsToIcon/index.d.ts +1 -0
- package/src/lib/views/UserFieldEditorView/index.d.ts +1 -0
- package/src/lib/views/UserFieldEditorView/useAssignDefaultValues/index.d.ts +1 -0
- package/src/lib/views/UserFieldEditorView/useAssignDefaultValues/useAssignDefaultValues.cjs +34 -0
- package/src/lib/views/UserFieldEditorView/useAssignDefaultValues/useAssignDefaultValues.d.ts +7 -0
- package/src/lib/views/UserFieldEditorView/useAssignDefaultValues/useAssignDefaultValues.js +30 -0
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.cjs +68 -0
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.d.ts +2 -0
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.js +64 -0
- package/src/lib/views/WalletCannotBeTransferredView/index.d.ts +1 -0
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.cjs +7 -3
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.js +7 -3
- package/src/lib/views/WalletList/WalletList.cjs +4 -1
- package/src/lib/views/WalletList/WalletList.js +4 -1
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +9 -3
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +9 -3
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +27 -7
- package/src/lib/views/WalletLockedView/WalletLockedView.js +27 -7
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +7 -3
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +7 -3
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +7 -3
- package/src/lib/views/WalletUsedView/WalletUsedView.js +7 -3
- package/src/lib/views/viewToComponentMap.cjs +4 -0
- package/src/lib/views/viewToComponentMap.js +4 -0
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.cjs +7 -3
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.js +7 -3
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.cjs +8 -4
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.js +8 -4
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCard/DynamicBridgeWalletCard.cjs +7 -3
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCard/DynamicBridgeWalletCard.js +7 -3
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +7 -3
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +7 -3
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetEmptyCard/DynamicBridgeWidgetEmptyCard.cjs +7 -3
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetEmptyCard/DynamicBridgeWidgetEmptyCard.js +7 -3
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.cjs +8 -4
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.js +8 -4
- package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/DynamicWidget.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.cjs +2 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.js +2 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetFooter/DynamicWidgetFooter.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetFooter/DynamicWidgetFooter.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +6 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +6 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.cjs +5 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.js +5 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +7 -3
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.js +7 -3
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +6 -2
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +6 -2
- package/src/lib/widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.cjs +4 -1
- package/src/lib/widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.js +4 -1
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.js +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.js +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.js +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.js +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +7 -3
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +7 -2
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +7 -2
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.cjs +8 -4
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +8 -4
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +9 -5
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +9 -5
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.cjs +7 -3
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.js +7 -3
- package/src/lib/widgets/OAuthIFrameContainer/OAuthIFrameContainer.cjs +13 -0
- package/src/lib/widgets/OAuthIFrameContainer/OAuthIFrameContainer.d.ts +2 -0
- package/src/lib/widgets/OAuthIFrameContainer/OAuthIFrameContainer.js +9 -0
- package/src/lib/widgets/OAuthIFrameContainer/index.d.ts +1 -0
- package/src/lib/widgets/index.d.ts +1 -0
- package/src/lib/utils/hooks/useGetSocialIcon/index.d.ts +0 -1
- package/src/lib/utils/hooks/useGetSocialIcon/useGetSocialIcon.d.ts +0 -2
- package/src/lib/utils/hooks/useGetSocialIcon/useGetSocialIcon.js +0 -10
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/index.d.ts +0 -1
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.d.ts +0 -18
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.js +0 -92
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to estimate the gas required for a transaction.
|
|
4
|
+
*
|
|
5
|
+
* This hook uses the `usePromise` hook to asynchronously estimate the gas required for a transaction.
|
|
6
|
+
* It first tries to estimate the gas without the 'from' field in the transaction, as the Alchemy API
|
|
7
|
+
* checks the origin address funds and can return an error if the origin wallet has no funds for the transaction.
|
|
8
|
+
* If the error 'UNPREDICTABLE_GAS_LIMIT' is encountered, it tries to estimate the gas again with the
|
|
9
|
+
* original transaction.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link https://docs.alchemy.com/reference/eth-estimategas}
|
|
12
|
+
* @see {@link https://docs.ethers.org/v5/troubleshooting/errors/#help-UNPREDICTABLE_GAS_LIMIT}
|
|
13
|
+
*
|
|
14
|
+
* @param {ethers.providers.Web3Provider} provider - The Web3 provider to use for estimating the gas.
|
|
15
|
+
* @param {ethers.utils.Deferrable<ethers.providers.TransactionRequest>} transaction - The transaction for
|
|
16
|
+
* which to estimate the gas.
|
|
17
|
+
*
|
|
18
|
+
* @returns {PromiseState<ethers.BigNumber>} A promise that resolves to the estimated gas for the transaction.
|
|
19
|
+
*/
|
|
20
|
+
export declare const useTransactionEstimatedGas: (provider: ethers.providers.Web3Provider, transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>) => import("../usePromise").PromiseState<ethers.BigNumber, Error>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { __awaiter, __rest } from '../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { usePromise } from '../usePromise/usePromise.js';
|
|
3
|
+
import '@dynamic-labs/sdk-api';
|
|
4
|
+
import { logger } from '../../../shared/logger.js';
|
|
5
|
+
import '@dynamic-labs/iconic';
|
|
6
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
7
|
+
import 'react/jsx-runtime';
|
|
8
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '@dynamic-labs/wallet-book';
|
|
11
|
+
import '@dynamic-labs/utils';
|
|
12
|
+
import '../../constants/colors.js';
|
|
13
|
+
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
14
|
+
import 'ethers';
|
|
15
|
+
import '../../../shared/consts/index.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Hook to estimate the gas required for a transaction.
|
|
19
|
+
*
|
|
20
|
+
* This hook uses the `usePromise` hook to asynchronously estimate the gas required for a transaction.
|
|
21
|
+
* It first tries to estimate the gas without the 'from' field in the transaction, as the Alchemy API
|
|
22
|
+
* checks the origin address funds and can return an error if the origin wallet has no funds for the transaction.
|
|
23
|
+
* If the error 'UNPREDICTABLE_GAS_LIMIT' is encountered, it tries to estimate the gas again with the
|
|
24
|
+
* original transaction.
|
|
25
|
+
*
|
|
26
|
+
* @see {@link https://docs.alchemy.com/reference/eth-estimategas}
|
|
27
|
+
* @see {@link https://docs.ethers.org/v5/troubleshooting/errors/#help-UNPREDICTABLE_GAS_LIMIT}
|
|
28
|
+
*
|
|
29
|
+
* @param {ethers.providers.Web3Provider} provider - The Web3 provider to use for estimating the gas.
|
|
30
|
+
* @param {ethers.utils.Deferrable<ethers.providers.TransactionRequest>} transaction - The transaction for
|
|
31
|
+
* which to estimate the gas.
|
|
32
|
+
*
|
|
33
|
+
* @returns {PromiseState<ethers.BigNumber>} A promise that resolves to the estimated gas for the transaction.
|
|
34
|
+
*/
|
|
35
|
+
const useTransactionEstimatedGas = (provider, transaction) => usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
// To safely run estimateGas using alchemy, we need to remove the from address
|
|
37
|
+
// because alchemy checks the origin address funds and can return an error if
|
|
38
|
+
// origin wallet has no funds for the transaction
|
|
39
|
+
// https://docs.alchemy.com/reference/eth-estimategas
|
|
40
|
+
const transactionWithNoOrigin = __rest(transaction, ["from"]);
|
|
41
|
+
try {
|
|
42
|
+
return yield provider.estimateGas(transactionWithNoOrigin);
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
logger.error(err);
|
|
47
|
+
// If the error is UNPREDICTABLE_GAS_LIMIT, we try to estimate gas again
|
|
48
|
+
// with original transaction
|
|
49
|
+
// https://docs.ethers.org/v5/troubleshooting/errors/#help-UNPREDICTABLE_GAS_LIMIT
|
|
50
|
+
if (err.code === 'UNPREDICTABLE_GAS_LIMIT') {
|
|
51
|
+
return provider.estimateGas(transaction);
|
|
52
|
+
}
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
55
|
+
}), { deps: [transaction, provider] });
|
|
56
|
+
|
|
57
|
+
export { useTransactionEstimatedGas };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTransactionWithGasPrice } from './useTransactionWithGasPrice';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var usePromise = require('../usePromise/usePromise.cjs');
|
|
6
|
+
|
|
7
|
+
const increaseGasPrice = (gasPrice, increasePercentage) => {
|
|
8
|
+
const increaseFactor = 100 + increasePercentage;
|
|
9
|
+
return gasPrice.mul(increaseFactor).div(100);
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A React Hook that returns a transaction object with the gas price set to the current gas price from the provider.
|
|
13
|
+
* The gas price is increased by a certain percentage specified by the user. The hook also allows the user to enable
|
|
14
|
+
* or disable this functionality.
|
|
15
|
+
*
|
|
16
|
+
* @param {Object} props - The properties for the hook.
|
|
17
|
+
* @param {ethers.providers.Provider} props.provider - The provider to use for getting the current gas price.
|
|
18
|
+
* @param {ethers.utils.Deferrable<ethers.providers.TransactionRequest>} props.transaction - The transaction object.
|
|
19
|
+
* @param {number} props.increasePercentage - The percentage by which to increase the current gas price.
|
|
20
|
+
* @param {boolean} [props.enabled=true] - A flag to enable or disable the gas price increase functionality.
|
|
21
|
+
*
|
|
22
|
+
* @returns {ethers.utils.Deferrable<ethers.providers.TransactionRequest>} A new transaction object with the gas price.
|
|
23
|
+
* If the `enabled` flag is set to false, or if the gas price is not available, or if the transaction already has a
|
|
24
|
+
* gas price set, the original transaction object is returned.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* const updatedTransaction = useTransactionWithGasPrice({
|
|
28
|
+
* provider: myProvider,
|
|
29
|
+
* transaction: myTransaction,
|
|
30
|
+
* increasePercentage: 10,
|
|
31
|
+
* enabled: true,
|
|
32
|
+
* });
|
|
33
|
+
*/
|
|
34
|
+
const useTransactionWithGasPrice = ({ increasePercentage = 0, provider, transaction, enabled = true, }) => {
|
|
35
|
+
const isGasPriceDefinedInTransaction = Boolean(transaction.gasPrice);
|
|
36
|
+
const shouldLoadGasPrice = enabled && increasePercentage > 0 && !isGasPriceDefinedInTransaction;
|
|
37
|
+
const { data: gasPrice } = usePromise.usePromise(() => provider.getGasPrice(), {
|
|
38
|
+
deps: [transaction, provider],
|
|
39
|
+
enabled: shouldLoadGasPrice,
|
|
40
|
+
});
|
|
41
|
+
if (!gasPrice) {
|
|
42
|
+
return transaction;
|
|
43
|
+
}
|
|
44
|
+
return Object.assign(Object.assign({}, transaction), { gasPrice: increaseGasPrice(gasPrice, increasePercentage) });
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.useTransactionWithGasPrice = useTransactionWithGasPrice;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
type UseTransactionWithGasPriceProps = {
|
|
3
|
+
provider: ethers.providers.Provider;
|
|
4
|
+
transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>;
|
|
5
|
+
increasePercentage?: number;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* A React Hook that returns a transaction object with the gas price set to the current gas price from the provider.
|
|
10
|
+
* The gas price is increased by a certain percentage specified by the user. The hook also allows the user to enable
|
|
11
|
+
* or disable this functionality.
|
|
12
|
+
*
|
|
13
|
+
* @param {Object} props - The properties for the hook.
|
|
14
|
+
* @param {ethers.providers.Provider} props.provider - The provider to use for getting the current gas price.
|
|
15
|
+
* @param {ethers.utils.Deferrable<ethers.providers.TransactionRequest>} props.transaction - The transaction object.
|
|
16
|
+
* @param {number} props.increasePercentage - The percentage by which to increase the current gas price.
|
|
17
|
+
* @param {boolean} [props.enabled=true] - A flag to enable or disable the gas price increase functionality.
|
|
18
|
+
*
|
|
19
|
+
* @returns {ethers.utils.Deferrable<ethers.providers.TransactionRequest>} A new transaction object with the gas price.
|
|
20
|
+
* If the `enabled` flag is set to false, or if the gas price is not available, or if the transaction already has a
|
|
21
|
+
* gas price set, the original transaction object is returned.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const updatedTransaction = useTransactionWithGasPrice({
|
|
25
|
+
* provider: myProvider,
|
|
26
|
+
* transaction: myTransaction,
|
|
27
|
+
* increasePercentage: 10,
|
|
28
|
+
* enabled: true,
|
|
29
|
+
* });
|
|
30
|
+
*/
|
|
31
|
+
export declare const useTransactionWithGasPrice: ({ increasePercentage, provider, transaction, enabled, }: UseTransactionWithGasPriceProps) => ethers.utils.Deferrable<ethers.providers.TransactionRequest>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { usePromise } from '../usePromise/usePromise.js';
|
|
2
|
+
|
|
3
|
+
const increaseGasPrice = (gasPrice, increasePercentage) => {
|
|
4
|
+
const increaseFactor = 100 + increasePercentage;
|
|
5
|
+
return gasPrice.mul(increaseFactor).div(100);
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A React Hook that returns a transaction object with the gas price set to the current gas price from the provider.
|
|
9
|
+
* The gas price is increased by a certain percentage specified by the user. The hook also allows the user to enable
|
|
10
|
+
* or disable this functionality.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} props - The properties for the hook.
|
|
13
|
+
* @param {ethers.providers.Provider} props.provider - The provider to use for getting the current gas price.
|
|
14
|
+
* @param {ethers.utils.Deferrable<ethers.providers.TransactionRequest>} props.transaction - The transaction object.
|
|
15
|
+
* @param {number} props.increasePercentage - The percentage by which to increase the current gas price.
|
|
16
|
+
* @param {boolean} [props.enabled=true] - A flag to enable or disable the gas price increase functionality.
|
|
17
|
+
*
|
|
18
|
+
* @returns {ethers.utils.Deferrable<ethers.providers.TransactionRequest>} A new transaction object with the gas price.
|
|
19
|
+
* If the `enabled` flag is set to false, or if the gas price is not available, or if the transaction already has a
|
|
20
|
+
* gas price set, the original transaction object is returned.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const updatedTransaction = useTransactionWithGasPrice({
|
|
24
|
+
* provider: myProvider,
|
|
25
|
+
* transaction: myTransaction,
|
|
26
|
+
* increasePercentage: 10,
|
|
27
|
+
* enabled: true,
|
|
28
|
+
* });
|
|
29
|
+
*/
|
|
30
|
+
const useTransactionWithGasPrice = ({ increasePercentage = 0, provider, transaction, enabled = true, }) => {
|
|
31
|
+
const isGasPriceDefinedInTransaction = Boolean(transaction.gasPrice);
|
|
32
|
+
const shouldLoadGasPrice = enabled && increasePercentage > 0 && !isGasPriceDefinedInTransaction;
|
|
33
|
+
const { data: gasPrice } = usePromise(() => provider.getGasPrice(), {
|
|
34
|
+
deps: [transaction, provider],
|
|
35
|
+
enabled: shouldLoadGasPrice,
|
|
36
|
+
});
|
|
37
|
+
if (!gasPrice) {
|
|
38
|
+
return transaction;
|
|
39
|
+
}
|
|
40
|
+
return Object.assign(Object.assign({}, transaction), { gasPrice: increaseGasPrice(gasPrice, increasePercentage) });
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { useTransactionWithGasPrice };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useUserDataForm';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useUpdateUser';
|
|
@@ -0,0 +1,107 @@
|
|
|
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 yup = require('yup');
|
|
8
|
+
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
9
|
+
var EmailVerificationContext = require('../../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
10
|
+
var api = require('../../../../data/api.cjs');
|
|
11
|
+
var decodeJwt = require('../../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
12
|
+
require('@dynamic-labs/iconic');
|
|
13
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
14
|
+
require('react/jsx-runtime');
|
|
15
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
16
|
+
require('../../../../shared/logger.cjs');
|
|
17
|
+
require('@dynamic-labs/wallet-book');
|
|
18
|
+
require('@dynamic-labs/utils');
|
|
19
|
+
require('../../../constants/colors.cjs');
|
|
20
|
+
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
21
|
+
require('ethers');
|
|
22
|
+
require('../../../../shared/consts/index.cjs');
|
|
23
|
+
var isEmailVerificationRequired = require('../../../functions/authenication/isEmailVerificationRequired/isEmailVerificationRequired.cjs');
|
|
24
|
+
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
25
|
+
require('@dynamic-labs/multi-wallet');
|
|
26
|
+
require('@dynamic-labs/sdk-api');
|
|
27
|
+
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
28
|
+
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
29
|
+
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
30
|
+
var useEmailVerificationRequest = require('../../authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.cjs');
|
|
31
|
+
var useUpdateUserProfileByJWTCallback = require('../../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.cjs');
|
|
32
|
+
|
|
33
|
+
// User Fields Schema without captchaToken and policiesConsent properties
|
|
34
|
+
const userFieldsSchema = yup.object().shape({
|
|
35
|
+
alias: yup.string(),
|
|
36
|
+
btcWallet: yup.string(),
|
|
37
|
+
ckbWallet: yup.string(),
|
|
38
|
+
country: yup.string(),
|
|
39
|
+
discordNotification: yup.boolean(),
|
|
40
|
+
dogeWallet: yup.string(),
|
|
41
|
+
email: yup.string(),
|
|
42
|
+
emailNotification: yup.boolean(),
|
|
43
|
+
firstName: yup.string(),
|
|
44
|
+
jobTitle: yup.string(),
|
|
45
|
+
kasWallet: yup.string(),
|
|
46
|
+
kdaWallet: yup.string(),
|
|
47
|
+
lastName: yup.string(),
|
|
48
|
+
ltcWallet: yup.string(),
|
|
49
|
+
newsletterNotification: yup.boolean(),
|
|
50
|
+
phoneNumber: yup.string(),
|
|
51
|
+
tShirtSize: yup.string(),
|
|
52
|
+
team: yup.string(),
|
|
53
|
+
username: yup.string(),
|
|
54
|
+
});
|
|
55
|
+
const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
56
|
+
const { authToken, onboardingOnlyJwt, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
57
|
+
const jwtToken = onboardingOnlyJwt || authToken;
|
|
58
|
+
const { setVerificationUUID, setEmail } = EmailVerificationContext.useEmailVerificationContext();
|
|
59
|
+
const { verifyEmail } = useEmailVerificationRequest.useEmailVerificationRequest();
|
|
60
|
+
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
|
|
61
|
+
return React.useCallback((userFields, userEnvironmentId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
+
var _a, _b, _c;
|
|
63
|
+
const validatedUserFields = yield userFieldsSchema.validate(userFields, {
|
|
64
|
+
stripUnknown: validationSchemaStripUnknown,
|
|
65
|
+
});
|
|
66
|
+
const updateUserProfileResponse = yield api.updateUserProfileFields(jwtToken, userEnvironmentId || environmentId, validatedUserFields);
|
|
67
|
+
// check if decoded JWT still somehow has missing fields, we can't proceed if it does
|
|
68
|
+
const decodedJwt = decodeJwt.decodeJwt(updateUserProfileResponse.jwt);
|
|
69
|
+
const missingFields = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : [];
|
|
70
|
+
const _isEmailVerificationRequired = isEmailVerificationRequired.isEmailVerificationRequired(updateUserProfileResponse);
|
|
71
|
+
if (!_isEmailVerificationRequired) {
|
|
72
|
+
// If email verification is not needed then we can update the user profile immediately.
|
|
73
|
+
yield updateUserProfileByJWT(updateUserProfileResponse.jwt);
|
|
74
|
+
return {
|
|
75
|
+
isEmailVerificationRequired: false,
|
|
76
|
+
missingFields,
|
|
77
|
+
updateUserProfileResponse,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// We update EmailContext to use this information in the Email Verification view
|
|
81
|
+
setEmail((_b = updateUserProfileResponse.emailVerification) === null || _b === void 0 ? void 0 : _b.email);
|
|
82
|
+
setVerificationUUID((_c = updateUserProfileResponse.emailVerification) === null || _c === void 0 ? void 0 : _c.verificationUUID);
|
|
83
|
+
// DYN-2046 - Customers have the opportunity to programmatically use our email verification and profile editing.
|
|
84
|
+
// VerifyEmailFN was scoped to bypass the problem with memoization of the state at the beginning of Promise.
|
|
85
|
+
// setEmail and setVerificationUUID in the above lines will are not visible in this promise.
|
|
86
|
+
const scopedVerifyEmailFn = (verificationToken) => {
|
|
87
|
+
var _a;
|
|
88
|
+
return verifyEmail(verificationToken, (_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.verificationUUID);
|
|
89
|
+
};
|
|
90
|
+
return {
|
|
91
|
+
isEmailVerificationRequired: true,
|
|
92
|
+
missingFields,
|
|
93
|
+
updateUserProfileResponse,
|
|
94
|
+
verifyEmailFn: scopedVerifyEmailFn,
|
|
95
|
+
};
|
|
96
|
+
}), [
|
|
97
|
+
environmentId,
|
|
98
|
+
jwtToken,
|
|
99
|
+
setEmail,
|
|
100
|
+
setVerificationUUID,
|
|
101
|
+
validationSchemaStripUnknown,
|
|
102
|
+
updateUserProfileByJWT,
|
|
103
|
+
verifyEmail,
|
|
104
|
+
]);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
exports.useUpdateUser = useUpdateUser;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ProjectSettingsKyc, UpdateSelfResponse, UserFields } from '@dynamic-labs/sdk-api';
|
|
2
|
+
export type UpdateUserFieldsArg = Omit<UserFields, 'captchaToken' | 'policiesConsent'>;
|
|
3
|
+
export type UpdateUserReturnPayload = {
|
|
4
|
+
isEmailVerificationRequired: boolean;
|
|
5
|
+
missingFields: ProjectSettingsKyc[];
|
|
6
|
+
updateUserProfileResponse: UpdateSelfResponse;
|
|
7
|
+
verifyEmailFn?: (verificationToken: string) => Promise<UpdateSelfResponse>;
|
|
8
|
+
};
|
|
9
|
+
export declare const useUpdateUser: (validationSchemaStripUnknown: boolean) => (userFields: UpdateUserFieldsArg, userEnvironmentId?: string) => Promise<UpdateUserReturnPayload>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { object, string, boolean } from 'yup';
|
|
4
|
+
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
5
|
+
import { useEmailVerificationContext } from '../../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
6
|
+
import { updateUserProfileFields } from '../../../../data/api.js';
|
|
7
|
+
import { decodeJwt } from '../../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
8
|
+
import '@dynamic-labs/iconic';
|
|
9
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
10
|
+
import 'react/jsx-runtime';
|
|
11
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
12
|
+
import '../../../../shared/logger.js';
|
|
13
|
+
import '@dynamic-labs/wallet-book';
|
|
14
|
+
import '@dynamic-labs/utils';
|
|
15
|
+
import '../../../constants/colors.js';
|
|
16
|
+
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
17
|
+
import 'ethers';
|
|
18
|
+
import '../../../../shared/consts/index.js';
|
|
19
|
+
import { isEmailVerificationRequired } from '../../../functions/authenication/isEmailVerificationRequired/isEmailVerificationRequired.js';
|
|
20
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
21
|
+
import '@dynamic-labs/multi-wallet';
|
|
22
|
+
import '@dynamic-labs/sdk-api';
|
|
23
|
+
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
24
|
+
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
25
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
26
|
+
import { useEmailVerificationRequest } from '../../authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js';
|
|
27
|
+
import { useUpdateUserProfileByJWTCallback } from '../../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.js';
|
|
28
|
+
|
|
29
|
+
// User Fields Schema without captchaToken and policiesConsent properties
|
|
30
|
+
const userFieldsSchema = object().shape({
|
|
31
|
+
alias: string(),
|
|
32
|
+
btcWallet: string(),
|
|
33
|
+
ckbWallet: string(),
|
|
34
|
+
country: string(),
|
|
35
|
+
discordNotification: boolean(),
|
|
36
|
+
dogeWallet: string(),
|
|
37
|
+
email: string(),
|
|
38
|
+
emailNotification: boolean(),
|
|
39
|
+
firstName: string(),
|
|
40
|
+
jobTitle: string(),
|
|
41
|
+
kasWallet: string(),
|
|
42
|
+
kdaWallet: string(),
|
|
43
|
+
lastName: string(),
|
|
44
|
+
ltcWallet: string(),
|
|
45
|
+
newsletterNotification: boolean(),
|
|
46
|
+
phoneNumber: string(),
|
|
47
|
+
tShirtSize: string(),
|
|
48
|
+
team: string(),
|
|
49
|
+
username: string(),
|
|
50
|
+
});
|
|
51
|
+
const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
52
|
+
const { authToken, onboardingOnlyJwt, environmentId } = useInternalDynamicContext();
|
|
53
|
+
const jwtToken = onboardingOnlyJwt || authToken;
|
|
54
|
+
const { setVerificationUUID, setEmail } = useEmailVerificationContext();
|
|
55
|
+
const { verifyEmail } = useEmailVerificationRequest();
|
|
56
|
+
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
57
|
+
return useCallback((userFields, userEnvironmentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
+
var _a, _b, _c;
|
|
59
|
+
const validatedUserFields = yield userFieldsSchema.validate(userFields, {
|
|
60
|
+
stripUnknown: validationSchemaStripUnknown,
|
|
61
|
+
});
|
|
62
|
+
const updateUserProfileResponse = yield updateUserProfileFields(jwtToken, userEnvironmentId || environmentId, validatedUserFields);
|
|
63
|
+
// check if decoded JWT still somehow has missing fields, we can't proceed if it does
|
|
64
|
+
const decodedJwt = decodeJwt(updateUserProfileResponse.jwt);
|
|
65
|
+
const missingFields = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : [];
|
|
66
|
+
const _isEmailVerificationRequired = isEmailVerificationRequired(updateUserProfileResponse);
|
|
67
|
+
if (!_isEmailVerificationRequired) {
|
|
68
|
+
// If email verification is not needed then we can update the user profile immediately.
|
|
69
|
+
yield updateUserProfileByJWT(updateUserProfileResponse.jwt);
|
|
70
|
+
return {
|
|
71
|
+
isEmailVerificationRequired: false,
|
|
72
|
+
missingFields,
|
|
73
|
+
updateUserProfileResponse,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
// We update EmailContext to use this information in the Email Verification view
|
|
77
|
+
setEmail((_b = updateUserProfileResponse.emailVerification) === null || _b === void 0 ? void 0 : _b.email);
|
|
78
|
+
setVerificationUUID((_c = updateUserProfileResponse.emailVerification) === null || _c === void 0 ? void 0 : _c.verificationUUID);
|
|
79
|
+
// DYN-2046 - Customers have the opportunity to programmatically use our email verification and profile editing.
|
|
80
|
+
// VerifyEmailFN was scoped to bypass the problem with memoization of the state at the beginning of Promise.
|
|
81
|
+
// setEmail and setVerificationUUID in the above lines will are not visible in this promise.
|
|
82
|
+
const scopedVerifyEmailFn = (verificationToken) => {
|
|
83
|
+
var _a;
|
|
84
|
+
return verifyEmail(verificationToken, (_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.verificationUUID);
|
|
85
|
+
};
|
|
86
|
+
return {
|
|
87
|
+
isEmailVerificationRequired: true,
|
|
88
|
+
missingFields,
|
|
89
|
+
updateUserProfileResponse,
|
|
90
|
+
verifyEmailFn: scopedVerifyEmailFn,
|
|
91
|
+
};
|
|
92
|
+
}), [
|
|
93
|
+
environmentId,
|
|
94
|
+
jwtToken,
|
|
95
|
+
setEmail,
|
|
96
|
+
setVerificationUUID,
|
|
97
|
+
validationSchemaStripUnknown,
|
|
98
|
+
updateUserProfileByJWT,
|
|
99
|
+
verifyEmail,
|
|
100
|
+
]);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export { useUpdateUser };
|
package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.cjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
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 utils = require('@dynamic-labs/utils');
|
|
8
|
+
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
9
|
+
var UserFieldEditorContext = require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
10
|
+
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
11
|
+
var validateUpdateRequest = require('./validateUpdateRequest/validateUpdateRequest.cjs');
|
|
12
|
+
|
|
13
|
+
/** Saves the values updated by the user */
|
|
14
|
+
const saveUserValues = ({ fields: newValues, updateUserResult: { isEmailVerificationRequired }, }, internalEvents, setShowAuthFlow, setView, resolve, reject) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
// If no verification is needed, we are done
|
|
16
|
+
if (!isEmailVerificationRequired) {
|
|
17
|
+
resolve(newValues);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// Show email verification view
|
|
21
|
+
setShowAuthFlow(true);
|
|
22
|
+
setView('verify-email');
|
|
23
|
+
// Subscribe to email verification result
|
|
24
|
+
internalEvents.current.once('emailVerificationResult', (wasSuccessful) => {
|
|
25
|
+
wasSuccessful
|
|
26
|
+
? resolve(newValues)
|
|
27
|
+
: reject('Failed to verify email, no fields were updated');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
// eslint-disable-next-line multiline-comment-style
|
|
31
|
+
/** This hook allows to open the widget modal and expose any fields for editing.
|
|
32
|
+
* The fields must have been previously enabled in the dashboard
|
|
33
|
+
*/
|
|
34
|
+
const useUpdateUserWithModal = (updateUser) => {
|
|
35
|
+
const { user, projectSettings, setShowAuthFlow, internalEvents } = useInternalDynamicContext.useInternalDynamicContext();
|
|
36
|
+
const { setView } = ViewContext.useViewContext();
|
|
37
|
+
const editorContext = React.useContext(UserFieldEditorContext.UserFieldEditorContext);
|
|
38
|
+
if (!editorContext)
|
|
39
|
+
throw new utils.DynamicError('useUserUpdateRequest can only be used inside the context of DynamicContextProvider');
|
|
40
|
+
const { open: promptUserForValues } = editorContext;
|
|
41
|
+
const updateUserWithModal = React.useCallback((fields, options) => new Promise((resolve, reject) => {
|
|
42
|
+
// Catch invalid requests
|
|
43
|
+
const errorResponse = validateUpdateRequest.validateUpdateRequest(fields, user, projectSettings);
|
|
44
|
+
if (errorResponse) {
|
|
45
|
+
reject(errorResponse);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
// Get user values
|
|
49
|
+
promptUserForValues({
|
|
50
|
+
fields,
|
|
51
|
+
submitText: options === null || options === void 0 ? void 0 : options.submitText,
|
|
52
|
+
subtitle: options === null || options === void 0 ? void 0 : options.subtitle,
|
|
53
|
+
title: options === null || options === void 0 ? void 0 : options.title,
|
|
54
|
+
}, updateUser)
|
|
55
|
+
.then((updateValues) => saveUserValues(updateValues, internalEvents, setShowAuthFlow, setView, resolve, reject))
|
|
56
|
+
.catch((error) => {
|
|
57
|
+
if (/email already exists/gi.test(error))
|
|
58
|
+
throw error;
|
|
59
|
+
reject(error);
|
|
60
|
+
});
|
|
61
|
+
}), [
|
|
62
|
+
user,
|
|
63
|
+
projectSettings,
|
|
64
|
+
promptUserForValues,
|
|
65
|
+
updateUser,
|
|
66
|
+
setShowAuthFlow,
|
|
67
|
+
setView,
|
|
68
|
+
internalEvents,
|
|
69
|
+
]);
|
|
70
|
+
return updateUserWithModal;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
exports.useUpdateUserWithModal = useUpdateUserWithModal;
|
package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UserFields } from '@dynamic-labs/sdk-api';
|
|
2
|
+
import { useUpdateUser } from '../useUpdateUser/';
|
|
3
|
+
import { UpdateUserWithModalFields, UpdateUserWithModalOptions } from './types';
|
|
4
|
+
/** This hook allows to open the widget modal and expose any fields for editing.
|
|
5
|
+
* The fields must have been previously enabled in the dashboard
|
|
6
|
+
*/
|
|
7
|
+
export declare const useUpdateUserWithModal: (updateUser: ReturnType<typeof useUpdateUser>) => (fields: UpdateUserWithModalFields, options?: UpdateUserWithModalOptions) => Promise<UserFields>;
|
package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { useContext, useCallback } from 'react';
|
|
3
|
+
import { DynamicError } from '@dynamic-labs/utils';
|
|
4
|
+
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
5
|
+
import { UserFieldEditorContext } from '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
6
|
+
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
7
|
+
import { validateUpdateRequest } from './validateUpdateRequest/validateUpdateRequest.js';
|
|
8
|
+
|
|
9
|
+
/** Saves the values updated by the user */
|
|
10
|
+
const saveUserValues = ({ fields: newValues, updateUserResult: { isEmailVerificationRequired }, }, internalEvents, setShowAuthFlow, setView, resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
// If no verification is needed, we are done
|
|
12
|
+
if (!isEmailVerificationRequired) {
|
|
13
|
+
resolve(newValues);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
// Show email verification view
|
|
17
|
+
setShowAuthFlow(true);
|
|
18
|
+
setView('verify-email');
|
|
19
|
+
// Subscribe to email verification result
|
|
20
|
+
internalEvents.current.once('emailVerificationResult', (wasSuccessful) => {
|
|
21
|
+
wasSuccessful
|
|
22
|
+
? resolve(newValues)
|
|
23
|
+
: reject('Failed to verify email, no fields were updated');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
// eslint-disable-next-line multiline-comment-style
|
|
27
|
+
/** This hook allows to open the widget modal and expose any fields for editing.
|
|
28
|
+
* The fields must have been previously enabled in the dashboard
|
|
29
|
+
*/
|
|
30
|
+
const useUpdateUserWithModal = (updateUser) => {
|
|
31
|
+
const { user, projectSettings, setShowAuthFlow, internalEvents } = useInternalDynamicContext();
|
|
32
|
+
const { setView } = useViewContext();
|
|
33
|
+
const editorContext = useContext(UserFieldEditorContext);
|
|
34
|
+
if (!editorContext)
|
|
35
|
+
throw new DynamicError('useUserUpdateRequest can only be used inside the context of DynamicContextProvider');
|
|
36
|
+
const { open: promptUserForValues } = editorContext;
|
|
37
|
+
const updateUserWithModal = useCallback((fields, options) => new Promise((resolve, reject) => {
|
|
38
|
+
// Catch invalid requests
|
|
39
|
+
const errorResponse = validateUpdateRequest(fields, user, projectSettings);
|
|
40
|
+
if (errorResponse) {
|
|
41
|
+
reject(errorResponse);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// Get user values
|
|
45
|
+
promptUserForValues({
|
|
46
|
+
fields,
|
|
47
|
+
submitText: options === null || options === void 0 ? void 0 : options.submitText,
|
|
48
|
+
subtitle: options === null || options === void 0 ? void 0 : options.subtitle,
|
|
49
|
+
title: options === null || options === void 0 ? void 0 : options.title,
|
|
50
|
+
}, updateUser)
|
|
51
|
+
.then((updateValues) => saveUserValues(updateValues, internalEvents, setShowAuthFlow, setView, resolve, reject))
|
|
52
|
+
.catch((error) => {
|
|
53
|
+
if (/email already exists/gi.test(error))
|
|
54
|
+
throw error;
|
|
55
|
+
reject(error);
|
|
56
|
+
});
|
|
57
|
+
}), [
|
|
58
|
+
user,
|
|
59
|
+
projectSettings,
|
|
60
|
+
promptUserForValues,
|
|
61
|
+
updateUser,
|
|
62
|
+
setShowAuthFlow,
|
|
63
|
+
setView,
|
|
64
|
+
internalEvents,
|
|
65
|
+
]);
|
|
66
|
+
return updateUserWithModal;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export { useUpdateUserWithModal };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './validateUpdateRequest';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var getUserProfileFields = require('../../../../functions/getUserProfileFields/getUserProfileFields.cjs');
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line multiline-comment-style
|
|
8
|
+
/** This function is used to verify that an update request with modal is valid
|
|
9
|
+
* @returns empty string if request is valid, a string with the error message otherwise
|
|
10
|
+
*/
|
|
11
|
+
const validateUpdateRequest = (fields, user, projectSettings) => {
|
|
12
|
+
// Catch no fields
|
|
13
|
+
if (!fields.length)
|
|
14
|
+
return 'At least one field must be provided for editing';
|
|
15
|
+
// Catch no user
|
|
16
|
+
if (!user)
|
|
17
|
+
return 'No signed-in user';
|
|
18
|
+
// Catch field not set in dashboard
|
|
19
|
+
const allUserFields = getUserProfileFields.getUserProfileFields({
|
|
20
|
+
projectSettingsKyc: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc,
|
|
21
|
+
user,
|
|
22
|
+
});
|
|
23
|
+
for (const field of fields) {
|
|
24
|
+
// i.e. If any of the provided fields is not found in the project settings fields
|
|
25
|
+
if (!allUserFields.find(({ name }) => name === field))
|
|
26
|
+
return `Please ensure field "${field}" is enabled under "Configurations > Onboarding > Information capture" in your app's dashboard before using it with updateUserWithModal`;
|
|
27
|
+
}
|
|
28
|
+
return '';
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.validateUpdateRequest = validateUpdateRequest;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ProjectSettings, UserFields } from '@dynamic-labs/sdk-api';
|
|
2
|
+
import { UserProfile } from '../../../../../shared';
|
|
3
|
+
/** This function is used to verify that an update request with modal is valid
|
|
4
|
+
* @returns empty string if request is valid, a string with the error message otherwise
|
|
5
|
+
*/
|
|
6
|
+
export declare const validateUpdateRequest: (fields: (keyof UserFields)[], user: UserProfile | undefined, projectSettings: ProjectSettings | undefined) => string;
|