@dynamic-labs/sdk-react-core 0.19.0-alpha.1 → 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 +47 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +9 -9
- package/src/index.cjs +38 -12
- package/src/index.d.ts +4 -7
- package/src/index.js +21 -6
- package/src/lib/Main.cjs +9 -3
- package/src/lib/Main.js +9 -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 +5 -1
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +5 -1
- package/src/lib/components/Divider/Divider.cjs +7 -3
- package/src/lib/components/Divider/Divider.js +7 -3
- package/src/lib/components/ErrorContainer/ErrorContainer.d.ts +1 -1
- 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/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 +5 -1
- package/src/lib/components/NetworkPicker/NetworkPicker.js +5 -1
- 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 +9 -5
- package/src/lib/components/OTPVerificationView/OTPVerificationView.d.ts +1 -0
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +9 -5
- 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/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/context/DynamicContext/DynamicContext.cjs +31 -8
- package/src/lib/context/DynamicContext/DynamicContext.js +32 -9
- 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 +17 -1
- package/src/lib/data/api.d.ts +2 -1
- package/src/lib/data/api.js +17 -2
- 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 +8 -4
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +8 -4
- 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/index.d.ts +10 -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/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/index.d.ts +6 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.cjs +10 -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 +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.d.ts +2 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -2
- package/src/lib/utils/hooks/index.d.ts +6 -1
- 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 +1 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +1 -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/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/useTransactionWithGasPrice/useTransactionWithGasPrice.cjs +47 -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/useWalletEventListeners/useWalletEventListeners.d.ts +1 -1
- 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 +8 -4
- package/src/lib/views/AccountExistsView/AccountExistsView.js +8 -4
- 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 +8 -5
- package/src/lib/views/CollectUserDataView/UserDataFields/index.js +8 -5
- 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 +12 -6
- package/src/lib/views/EmailUpdate/EmailUpdate.js +12 -6
- package/src/lib/views/EmailVerification/EmailVerification.cjs +45 -9
- package/src/lib/views/EmailVerification/EmailVerification.js +46 -10
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +6 -2
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +6 -2
- 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 +9 -5
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.d.ts +5 -1
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js +9 -5
- 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 +7 -3
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +7 -3
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +11 -4
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +11 -4
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +11 -5
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +11 -5
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +11 -5
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +11 -5
- package/src/lib/views/NoAccess/NoAccess.cjs +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 +8 -5
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +8 -5
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.cjs +7 -3
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.js +7 -3
- 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} +21 -36
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.d.ts +11 -0
- package/src/lib/views/TransactionConfirmationView/hooks/{useTransactionData/useTransactionData.js → useTransactionGas/useTransactionGas.js} +21 -36
- 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 +2 -0
- package/src/lib/views/viewToComponentMap.js +2 -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 +7 -3
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.js +7 -3
- 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/DynamicUserProfile/DynamicUserProfile.cjs +7 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +7 -3
- 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 +7 -3
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +7 -3
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +8 -4
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +8 -4
- 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/views/TransactionConfirmationView/hooks/useTransactionData/index.d.ts +0 -1
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.d.ts +0 -18
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;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getUserProfileFields } from '../../../../functions/getUserProfileFields/getUserProfileFields.js';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line multiline-comment-style
|
|
4
|
+
/** This function is used to verify that an update request with modal is valid
|
|
5
|
+
* @returns empty string if request is valid, a string with the error message otherwise
|
|
6
|
+
*/
|
|
7
|
+
const validateUpdateRequest = (fields, user, projectSettings) => {
|
|
8
|
+
// Catch no fields
|
|
9
|
+
if (!fields.length)
|
|
10
|
+
return 'At least one field must be provided for editing';
|
|
11
|
+
// Catch no user
|
|
12
|
+
if (!user)
|
|
13
|
+
return 'No signed-in user';
|
|
14
|
+
// Catch field not set in dashboard
|
|
15
|
+
const allUserFields = getUserProfileFields({
|
|
16
|
+
projectSettingsKyc: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc,
|
|
17
|
+
user,
|
|
18
|
+
});
|
|
19
|
+
for (const field of fields) {
|
|
20
|
+
// i.e. If any of the provided fields is not found in the project settings fields
|
|
21
|
+
if (!allUserFields.find(({ name }) => name === field))
|
|
22
|
+
return `Please ensure field "${field}" is enabled under "Configurations > Onboarding > Information capture" in your app's dashboard before using it with updateUserWithModal`;
|
|
23
|
+
}
|
|
24
|
+
return '';
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { validateUpdateRequest };
|
|
@@ -2,102 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var yup = require('yup');
|
|
8
|
-
var useInternalDynamicContext = require('../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
9
|
-
var api = require('../../../data/api.cjs');
|
|
10
|
-
var isEmailVerificationRequired = require('../../functions/authenication/isEmailVerificationRequired/isEmailVerificationRequired.cjs');
|
|
11
|
-
var EmailVerificationContext = require('../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
12
|
-
var useEmailVerificationRequest = require('../authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.cjs');
|
|
13
|
-
var useUpdateUserProfileByJWTCallback = require('../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.cjs');
|
|
14
|
-
var decodeJwt = require('../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
15
|
-
require('@dynamic-labs/iconic');
|
|
16
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
17
|
-
require('react/jsx-runtime');
|
|
18
|
-
require('../../../context/ViewContext/ViewContext.cjs');
|
|
19
|
-
require('../../../shared/logger.cjs');
|
|
20
|
-
require('@dynamic-labs/wallet-book');
|
|
21
|
-
require('@dynamic-labs/utils');
|
|
22
|
-
require('../../constants/colors.cjs');
|
|
23
|
-
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
24
|
-
require('ethers');
|
|
25
|
-
require('../../../shared/consts/index.cjs');
|
|
5
|
+
var useUpdateUser = require('./useUpdateUser/useUpdateUser.cjs');
|
|
6
|
+
var useUpdateUserWithModal = require('./useUpdateUserWithModal/useUpdateUserWithModal.cjs');
|
|
26
7
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
alias: yup.string(),
|
|
30
|
-
btcWallet: yup.string(),
|
|
31
|
-
ckbWallet: yup.string(),
|
|
32
|
-
country: yup.string(),
|
|
33
|
-
discordNotification: yup.boolean(),
|
|
34
|
-
dogeWallet: yup.string(),
|
|
35
|
-
email: yup.string(),
|
|
36
|
-
emailNotification: yup.boolean(),
|
|
37
|
-
firstName: yup.string(),
|
|
38
|
-
jobTitle: yup.string(),
|
|
39
|
-
kasWallet: yup.string(),
|
|
40
|
-
kdaWallet: yup.string(),
|
|
41
|
-
lastName: yup.string(),
|
|
42
|
-
ltcWallet: yup.string(),
|
|
43
|
-
newsletterNotification: yup.boolean(),
|
|
44
|
-
phoneNumber: yup.string(),
|
|
45
|
-
tShirtSize: yup.string(),
|
|
46
|
-
team: yup.string(),
|
|
47
|
-
username: yup.string(),
|
|
48
|
-
});
|
|
49
|
-
// Hook exposed to the public
|
|
8
|
+
/* eslint-disable sort-keys */
|
|
9
|
+
// Hook only available internally
|
|
50
10
|
const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
const { verifyEmail: verifyEmailFn } = useEmailVerificationRequest.useEmailVerificationRequest();
|
|
55
|
-
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
|
|
56
|
-
const updateUser = React.useCallback((userFields, userEnvironmentId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
-
var _a, _b, _c;
|
|
58
|
-
const validatedUserFields = yield userFieldsSchema.validate(userFields, {
|
|
59
|
-
stripUnknown: validationSchemaStripUnknown,
|
|
60
|
-
});
|
|
61
|
-
const updateUserProfileResponse = yield api.updateUserProfileFields(jwtToken, userEnvironmentId || environmentId, validatedUserFields);
|
|
62
|
-
// check if decoded JWT still somehow has missing fields, we can't proceed if it does
|
|
63
|
-
const decodedJwt = decodeJwt.decodeJwt(updateUserProfileResponse.jwt);
|
|
64
|
-
const missingFields = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : [];
|
|
65
|
-
const _isEmailVerificationRequired = isEmailVerificationRequired.isEmailVerificationRequired(updateUserProfileResponse);
|
|
66
|
-
if (!_isEmailVerificationRequired) {
|
|
67
|
-
// If email verification is not needed then we can update the user profile immediately.
|
|
68
|
-
yield updateUserProfileByJWT(updateUserProfileResponse.jwt);
|
|
69
|
-
return {
|
|
70
|
-
isEmailVerificationRequired: false,
|
|
71
|
-
missingFields,
|
|
72
|
-
updateUserProfileResponse,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
// We update EmailContext to use this information in the Email Verification view
|
|
76
|
-
setEmail((_b = updateUserProfileResponse.emailVerification) === null || _b === void 0 ? void 0 : _b.email);
|
|
77
|
-
setVerificationUUID((_c = updateUserProfileResponse.emailVerification) === null || _c === void 0 ? void 0 : _c.verificationUUID);
|
|
78
|
-
// DYN-2046 - Customers have the opportunity to programmatically use our email verification and profile editing.
|
|
79
|
-
// VerifyEmailFN was scoped to bypass the problem with memoization of the state at the beginning of Promise.
|
|
80
|
-
// setEmail and setVerificationUUID in the above lines will are not visible in this promise.
|
|
81
|
-
const scopedVerifyEmailFn = (verificationToken) => {
|
|
82
|
-
var _a;
|
|
83
|
-
return verifyEmailFn(verificationToken, (_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.verificationUUID);
|
|
84
|
-
};
|
|
85
|
-
return {
|
|
86
|
-
isEmailVerificationRequired: true,
|
|
87
|
-
missingFields,
|
|
88
|
-
updateUserProfileResponse,
|
|
89
|
-
verifyEmailFn: scopedVerifyEmailFn,
|
|
90
|
-
};
|
|
91
|
-
}), [
|
|
92
|
-
environmentId,
|
|
93
|
-
jwtToken,
|
|
94
|
-
setEmail,
|
|
95
|
-
setVerificationUUID,
|
|
96
|
-
validationSchemaStripUnknown,
|
|
97
|
-
updateUserProfileByJWT,
|
|
98
|
-
verifyEmailFn,
|
|
99
|
-
]);
|
|
100
|
-
return { updateUser };
|
|
11
|
+
const updateUser = useUpdateUser.useUpdateUser(validationSchemaStripUnknown);
|
|
12
|
+
const updateUserWithModal = useUpdateUserWithModal.useUpdateUserWithModal(updateUser);
|
|
13
|
+
return { updateUser, updateUserWithModal };
|
|
101
14
|
};
|
|
102
15
|
// Hook exposed to the clients
|
|
103
16
|
// We do not want customers to be able to edit properties such as policiesConsent or captchaToken
|
|
@@ -1,30 +1,10 @@
|
|
|
1
|
-
import { UserFields } from '@dynamic-labs/sdk-api';
|
|
2
|
-
export type UpdateUserFieldsArg = Omit<UserFields, 'captchaToken' | 'policiesConsent'>;
|
|
3
1
|
export declare const useUserUpdateRequestInternal: ({ validationSchemaStripUnknown, }: {
|
|
4
2
|
validationSchemaStripUnknown: boolean;
|
|
5
3
|
}) => {
|
|
6
|
-
updateUser: (userFields: UpdateUserFieldsArg, userEnvironmentId?: string) => Promise<
|
|
7
|
-
|
|
8
|
-
missingFields: import("@dynamic-labs/sdk-api").ProjectSettingsKyc[];
|
|
9
|
-
updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
|
|
10
|
-
verifyEmailFn?: undefined;
|
|
11
|
-
} | {
|
|
12
|
-
isEmailVerificationRequired: boolean;
|
|
13
|
-
missingFields: import("@dynamic-labs/sdk-api").ProjectSettingsKyc[];
|
|
14
|
-
updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
|
|
15
|
-
verifyEmailFn: (verificationToken: string) => Promise<import("@dynamic-labs/sdk-api").UpdateSelfResponse>;
|
|
16
|
-
}>;
|
|
4
|
+
updateUser: (userFields: import("./useUpdateUser").UpdateUserFieldsArg, userEnvironmentId?: string | undefined) => Promise<import("./useUpdateUser").UpdateUserReturnPayload>;
|
|
5
|
+
updateUserWithModal: (fields: import("./useUpdateUserWithModal").UpdateUserWithModalFields, options?: import("./useUpdateUserWithModal").UpdateUserWithModalOptions | undefined) => Promise<import("@dynamic-labs/sdk-api").UserFields>;
|
|
17
6
|
};
|
|
18
7
|
export declare const useUserUpdateRequest: () => {
|
|
19
|
-
updateUser: (userFields: UpdateUserFieldsArg, userEnvironmentId?: string) => Promise<
|
|
20
|
-
|
|
21
|
-
missingFields: import("@dynamic-labs/sdk-api").ProjectSettingsKyc[];
|
|
22
|
-
updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
|
|
23
|
-
verifyEmailFn?: undefined;
|
|
24
|
-
} | {
|
|
25
|
-
isEmailVerificationRequired: boolean;
|
|
26
|
-
missingFields: import("@dynamic-labs/sdk-api").ProjectSettingsKyc[];
|
|
27
|
-
updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
|
|
28
|
-
verifyEmailFn: (verificationToken: string) => Promise<import("@dynamic-labs/sdk-api").UpdateSelfResponse>;
|
|
29
|
-
}>;
|
|
8
|
+
updateUser: (userFields: import("./useUpdateUser").UpdateUserFieldsArg, userEnvironmentId?: string | undefined) => Promise<import("./useUpdateUser").UpdateUserReturnPayload>;
|
|
9
|
+
updateUserWithModal: (fields: import("./useUpdateUserWithModal").UpdateUserWithModalFields, options?: import("./useUpdateUserWithModal").UpdateUserWithModalOptions | undefined) => Promise<import("@dynamic-labs/sdk-api").UserFields>;
|
|
30
10
|
};
|
|
@@ -1,99 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { object, string, boolean } from 'yup';
|
|
4
|
-
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
5
|
-
import { updateUserProfileFields } from '../../../data/api.js';
|
|
6
|
-
import { isEmailVerificationRequired } from '../../functions/authenication/isEmailVerificationRequired/isEmailVerificationRequired.js';
|
|
7
|
-
import { useEmailVerificationContext } from '../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
8
|
-
import { useEmailVerificationRequest } from '../authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js';
|
|
9
|
-
import { useUpdateUserProfileByJWTCallback } from '../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.js';
|
|
10
|
-
import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
11
|
-
import '@dynamic-labs/iconic';
|
|
12
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
13
|
-
import 'react/jsx-runtime';
|
|
14
|
-
import '../../../context/ViewContext/ViewContext.js';
|
|
15
|
-
import '../../../shared/logger.js';
|
|
16
|
-
import '@dynamic-labs/wallet-book';
|
|
17
|
-
import '@dynamic-labs/utils';
|
|
18
|
-
import '../../constants/colors.js';
|
|
19
|
-
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
20
|
-
import 'ethers';
|
|
21
|
-
import '../../../shared/consts/index.js';
|
|
1
|
+
import { useUpdateUser } from './useUpdateUser/useUpdateUser.js';
|
|
2
|
+
import { useUpdateUserWithModal } from './useUpdateUserWithModal/useUpdateUserWithModal.js';
|
|
22
3
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
alias: string(),
|
|
26
|
-
btcWallet: string(),
|
|
27
|
-
ckbWallet: string(),
|
|
28
|
-
country: string(),
|
|
29
|
-
discordNotification: boolean(),
|
|
30
|
-
dogeWallet: string(),
|
|
31
|
-
email: string(),
|
|
32
|
-
emailNotification: boolean(),
|
|
33
|
-
firstName: string(),
|
|
34
|
-
jobTitle: string(),
|
|
35
|
-
kasWallet: string(),
|
|
36
|
-
kdaWallet: string(),
|
|
37
|
-
lastName: string(),
|
|
38
|
-
ltcWallet: string(),
|
|
39
|
-
newsletterNotification: boolean(),
|
|
40
|
-
phoneNumber: string(),
|
|
41
|
-
tShirtSize: string(),
|
|
42
|
-
team: string(),
|
|
43
|
-
username: string(),
|
|
44
|
-
});
|
|
45
|
-
// Hook exposed to the public
|
|
4
|
+
/* eslint-disable sort-keys */
|
|
5
|
+
// Hook only available internally
|
|
46
6
|
const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const { verifyEmail: verifyEmailFn } = useEmailVerificationRequest();
|
|
51
|
-
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
52
|
-
const updateUser = useCallback((userFields, userEnvironmentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
-
var _a, _b, _c;
|
|
54
|
-
const validatedUserFields = yield userFieldsSchema.validate(userFields, {
|
|
55
|
-
stripUnknown: validationSchemaStripUnknown,
|
|
56
|
-
});
|
|
57
|
-
const updateUserProfileResponse = yield updateUserProfileFields(jwtToken, userEnvironmentId || environmentId, validatedUserFields);
|
|
58
|
-
// check if decoded JWT still somehow has missing fields, we can't proceed if it does
|
|
59
|
-
const decodedJwt = decodeJwt(updateUserProfileResponse.jwt);
|
|
60
|
-
const missingFields = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : [];
|
|
61
|
-
const _isEmailVerificationRequired = isEmailVerificationRequired(updateUserProfileResponse);
|
|
62
|
-
if (!_isEmailVerificationRequired) {
|
|
63
|
-
// If email verification is not needed then we can update the user profile immediately.
|
|
64
|
-
yield updateUserProfileByJWT(updateUserProfileResponse.jwt);
|
|
65
|
-
return {
|
|
66
|
-
isEmailVerificationRequired: false,
|
|
67
|
-
missingFields,
|
|
68
|
-
updateUserProfileResponse,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
// We update EmailContext to use this information in the Email Verification view
|
|
72
|
-
setEmail((_b = updateUserProfileResponse.emailVerification) === null || _b === void 0 ? void 0 : _b.email);
|
|
73
|
-
setVerificationUUID((_c = updateUserProfileResponse.emailVerification) === null || _c === void 0 ? void 0 : _c.verificationUUID);
|
|
74
|
-
// DYN-2046 - Customers have the opportunity to programmatically use our email verification and profile editing.
|
|
75
|
-
// VerifyEmailFN was scoped to bypass the problem with memoization of the state at the beginning of Promise.
|
|
76
|
-
// setEmail and setVerificationUUID in the above lines will are not visible in this promise.
|
|
77
|
-
const scopedVerifyEmailFn = (verificationToken) => {
|
|
78
|
-
var _a;
|
|
79
|
-
return verifyEmailFn(verificationToken, (_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.verificationUUID);
|
|
80
|
-
};
|
|
81
|
-
return {
|
|
82
|
-
isEmailVerificationRequired: true,
|
|
83
|
-
missingFields,
|
|
84
|
-
updateUserProfileResponse,
|
|
85
|
-
verifyEmailFn: scopedVerifyEmailFn,
|
|
86
|
-
};
|
|
87
|
-
}), [
|
|
88
|
-
environmentId,
|
|
89
|
-
jwtToken,
|
|
90
|
-
setEmail,
|
|
91
|
-
setVerificationUUID,
|
|
92
|
-
validationSchemaStripUnknown,
|
|
93
|
-
updateUserProfileByJWT,
|
|
94
|
-
verifyEmailFn,
|
|
95
|
-
]);
|
|
96
|
-
return { updateUser };
|
|
7
|
+
const updateUser = useUpdateUser(validationSchemaStripUnknown);
|
|
8
|
+
const updateUserWithModal = useUpdateUserWithModal(updateUser);
|
|
9
|
+
return { updateUser, updateUserWithModal };
|
|
97
10
|
};
|
|
98
11
|
// Hook exposed to the clients
|
|
99
12
|
// We do not want customers to be able to edit properties such as policiesConsent or captchaToken
|
|
@@ -101,6 +101,7 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
|
|
|
101
101
|
setView('wallet-used');
|
|
102
102
|
setIsSingleWalletAccount(false);
|
|
103
103
|
if (e.code === 'reassign_wallet_error') {
|
|
104
|
+
setView('wallet-cannot-be-transferred');
|
|
104
105
|
setIsSingleWalletAccount(true);
|
|
105
106
|
}
|
|
106
107
|
return;
|
|
@@ -145,6 +146,7 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
|
|
|
145
146
|
return ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
146
147
|
const walletProvider = getWalletProvider.getWalletProvider(walletConnector);
|
|
147
148
|
try {
|
|
149
|
+
setIsVerificationInProgress(true);
|
|
148
150
|
const Jwt = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth);
|
|
149
151
|
const decodedJwt = decodeJwt.decodeJwt(Jwt);
|
|
150
152
|
if (decodedJwt === undefined)
|
|
@@ -97,6 +97,7 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
|
|
|
97
97
|
setView('wallet-used');
|
|
98
98
|
setIsSingleWalletAccount(false);
|
|
99
99
|
if (e.code === 'reassign_wallet_error') {
|
|
100
|
+
setView('wallet-cannot-be-transferred');
|
|
100
101
|
setIsSingleWalletAccount(true);
|
|
101
102
|
}
|
|
102
103
|
return;
|
|
@@ -141,6 +142,7 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
|
|
|
141
142
|
return ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
142
143
|
const walletProvider = getWalletProvider(walletConnector);
|
|
143
144
|
try {
|
|
145
|
+
setIsVerificationInProgress(true);
|
|
144
146
|
const Jwt = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth);
|
|
145
147
|
const decodedJwt = decodeJwt(Jwt);
|
|
146
148
|
if (decodedJwt === undefined)
|
|
@@ -17,7 +17,7 @@ export type UseWalletEventListenersArgs = {
|
|
|
17
17
|
setSelectedWalletWithAction(walletWithAction: WalletWithAction | null): void;
|
|
18
18
|
user: UserProfile | undefined;
|
|
19
19
|
authMode: AuthModeType;
|
|
20
|
-
refreshConnectedWallet: (walletId: string, walletConnector: WalletConnector) => Promise<void>;
|
|
20
|
+
refreshConnectedWallet: (walletId: string, walletConnector: WalletConnector, shouldCallCallback?: boolean) => Promise<void>;
|
|
21
21
|
};
|
|
22
22
|
export declare const useWalletEventListeners: ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnector, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, authMode, refreshConnectedWallet, }: UseWalletEventListenersArgs) => {
|
|
23
23
|
loadingNetwork: boolean;
|
|
@@ -27,6 +27,7 @@ require('../../../config/ApiEndpoint.cjs');
|
|
|
27
27
|
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
28
28
|
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
29
29
|
var useConnectAndSignSplitSteps = require('../authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs');
|
|
30
|
+
require('../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
30
31
|
|
|
31
32
|
const useWalletItemActions = () => {
|
|
32
33
|
const { setMultiWalletWidgetState, setShowAuthFlow, setSelectedWalletConnector, wallets, setQrcodeUri, setDesktopUri, user, linkedWallets, setLegacyIsVerifying, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -23,6 +23,7 @@ import '../../../config/ApiEndpoint.js';
|
|
|
23
23
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
24
24
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
25
25
|
import { useConnectAndSignSplitSteps } from '../authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js';
|
|
26
|
+
import '../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
26
27
|
|
|
27
28
|
const useWalletItemActions = () => {
|
|
28
29
|
const { setMultiWalletWidgetState, setShowAuthFlow, setSelectedWalletConnector, wallets, setQrcodeUri, setDesktopUri, user, linkedWallets, setLegacyIsVerifying, } = useInternalDynamicContext();
|
|
@@ -36,13 +36,17 @@ require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
|
36
36
|
var useConfirmationModal = require('../useConfirmationModal/useConfirmationModal.cjs');
|
|
37
37
|
require('../../../context/MockContext/MockContext.cjs');
|
|
38
38
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
39
|
-
require('
|
|
39
|
+
require('../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
40
|
+
require('@dynamic-labs/types');
|
|
41
|
+
require('../useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
42
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
43
|
+
require('yup');
|
|
44
|
+
require('../../../views/CollectUserDataView/fieldsConfig.cjs');
|
|
40
45
|
require('../../../components/IconButton/IconButton.cjs');
|
|
41
46
|
require('../../../components/Alert/Alert.cjs');
|
|
42
47
|
require('../../../components/Popper/Popper/Popper.cjs');
|
|
43
48
|
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
44
49
|
require('formik');
|
|
45
|
-
require('yup');
|
|
46
50
|
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
47
51
|
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
48
52
|
|
|
@@ -67,11 +71,11 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
|
67
71
|
}
|
|
68
72
|
return openSignMessage((resolve, reject) => (jsxRuntime.jsx(SignMessageConfirmationModal.SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject })));
|
|
69
73
|
}, [appLogoUrl, appName, getAppOrigin, openSignMessage, shouldConfirmAction]);
|
|
70
|
-
const sendTransaction = React.useCallback(({ transaction, handler, provider }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
+
const sendTransaction = React.useCallback(({ transaction, handler, provider, connector }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
71
75
|
if (!shouldConfirmAction()) {
|
|
72
76
|
return handler(transaction);
|
|
73
77
|
}
|
|
74
|
-
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { title: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
78
|
+
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { walletConnector: connector, title: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
75
79
|
}), [openSendTransaction, shouldConfirmAction]);
|
|
76
80
|
const disabledConfirmationOnce = React.useCallback(() => {
|
|
77
81
|
confirmationStateRef.current = 'disabled';
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { WalletUiUtils } from '@dynamic-labs/types';
|
|
3
|
+
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
4
|
import { WalletUiUtilsHookProps } from './useWalletUiUtils.types';
|
|
4
|
-
export declare const useWalletUiUtils: ({ appLogoUrl, appName, getAppOrigin, }: WalletUiUtilsHookProps) => [
|
|
5
|
+
export declare const useWalletUiUtils: ({ appLogoUrl, appName, getAppOrigin, }: WalletUiUtilsHookProps) => [
|
|
6
|
+
ReactNode | undefined,
|
|
7
|
+
WalletUiUtils<WalletConnector>
|
|
8
|
+
];
|
|
@@ -32,13 +32,17 @@ import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
|
32
32
|
import { useConfirmationModal } from '../useConfirmationModal/useConfirmationModal.js';
|
|
33
33
|
import '../../../context/MockContext/MockContext.js';
|
|
34
34
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
35
|
-
import '
|
|
35
|
+
import '../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
36
|
+
import '@dynamic-labs/types';
|
|
37
|
+
import '../useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
38
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
39
|
+
import 'yup';
|
|
40
|
+
import '../../../views/CollectUserDataView/fieldsConfig.js';
|
|
36
41
|
import '../../../components/IconButton/IconButton.js';
|
|
37
42
|
import '../../../components/Alert/Alert.js';
|
|
38
43
|
import '../../../components/Popper/Popper/Popper.js';
|
|
39
44
|
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
40
45
|
import 'formik';
|
|
41
|
-
import 'yup';
|
|
42
46
|
import '../../../components/InlineWidget/InlineWidget.js';
|
|
43
47
|
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
44
48
|
|
|
@@ -63,11 +67,11 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
|
63
67
|
}
|
|
64
68
|
return openSignMessage((resolve, reject) => (jsx(SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject })));
|
|
65
69
|
}, [appLogoUrl, appName, getAppOrigin, openSignMessage, shouldConfirmAction]);
|
|
66
|
-
const sendTransaction = useCallback(({ transaction, handler, provider }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
+
const sendTransaction = useCallback(({ transaction, handler, provider, connector }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
71
|
if (!shouldConfirmAction()) {
|
|
68
72
|
return handler(transaction);
|
|
69
73
|
}
|
|
70
|
-
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { title: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
74
|
+
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { walletConnector: connector, title: 'Send Transaction', transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
71
75
|
}), [openSendTransaction, shouldConfirmAction]);
|
|
72
76
|
const disabledConfirmationOnce = useCallback(() => {
|
|
73
77
|
confirmationStateRef.current = 'disabled';
|