@dynamic-labs/sdk-react-core 0.19.0-alpha.6 → 0.19.0-alpha.8
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 +8 -6
- package/package.js +8 -6
- package/package.json +15 -13
- package/src/index.cjs +3 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -0
- package/src/lib/Main.cjs +2 -0
- package/src/lib/Main.js +2 -0
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.cjs +1 -0
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.js +1 -0
- package/src/lib/components/AnimatePresence/AnimatePresence.cjs +1 -0
- package/src/lib/components/AnimatePresence/AnimatePresence.js +1 -0
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +3 -2
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +3 -2
- package/src/lib/components/Divider/Divider.cjs +1 -0
- package/src/lib/components/Divider/Divider.js +1 -0
- package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +3 -2
- package/src/lib/components/IconWithSpinner/IconWithSpinner.d.ts +4 -2
- package/src/lib/components/IconWithSpinner/IconWithSpinner.js +3 -2
- package/src/lib/components/IconWithStatus/IconWithStatus.cjs +3 -3
- package/src/lib/components/IconWithStatus/IconWithStatus.d.ts +2 -2
- package/src/lib/components/IconWithStatus/IconWithStatus.js +3 -3
- package/src/lib/components/MenuList/Dropdown/Dropdown.cjs +1 -0
- package/src/lib/components/MenuList/Dropdown/Dropdown.js +1 -0
- package/src/lib/components/MockedQrCode/MockedQrCode.cjs +1 -1
- package/src/lib/components/MockedQrCode/MockedQrCode.js +1 -1
- package/src/lib/components/Modal/Modal.cjs +1 -0
- package/src/lib/components/Modal/Modal.js +1 -0
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +1 -0
- package/src/lib/components/NetworkPicker/NetworkPicker.js +1 -0
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.cjs +1 -0
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.js +1 -0
- package/src/lib/components/NetworkPicker/components/Network/Network.cjs +1 -0
- package/src/lib/components/NetworkPicker/components/Network/Network.d.ts +0 -1
- package/src/lib/components/NetworkPicker/components/Network/Network.js +1 -0
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.cjs +1 -0
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.js +1 -0
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +9 -3
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +9 -3
- package/src/lib/components/OverlayCard/OverlayCard.cjs +1 -1
- package/src/lib/components/OverlayCard/OverlayCard.js +1 -1
- package/src/lib/components/Portal/Portal.cjs +1 -0
- package/src/lib/components/Portal/Portal.js +1 -0
- package/src/lib/components/Search/Search.d.ts +0 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +2 -2
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.d.ts +1 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +2 -2
- package/src/lib/components/SocialSignIn/SocialSignIn.cjs +98 -0
- package/src/lib/components/SocialSignIn/SocialSignIn.d.ts +12 -0
- package/src/lib/components/SocialSignIn/SocialSignIn.js +94 -0
- package/src/lib/components/Switch/Switch.d.ts +0 -1
- package/src/lib/components/Toolkit/components/AuthModeSwitch.d.ts +0 -1
- package/src/lib/components/Toolkit/components/LoginWithEmailSwitch.d.ts +0 -1
- package/src/lib/components/Toolkit/components/LoginWithEmailViewDisplayPriorityOrderSwitch.d.ts +0 -1
- package/src/lib/components/Toolkit/components/MultiWalletSwitch.d.ts +0 -1
- package/src/lib/components/Toolkit/components/TemplateSelect.d.ts +0 -1
- package/src/lib/components/Toolkit/components/ThemeSwitch.d.ts +0 -1
- package/src/lib/components/Tooltip/Tooltip.cjs +1 -0
- package/src/lib/components/Tooltip/Tooltip.js +1 -0
- package/src/lib/components/TosAndPp/TosAndPp.d.ts +0 -1
- package/src/lib/components/TransactionOriginDestination/TransactionOriginDestination.d.ts +1 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +1 -0
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +1 -0
- package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.cjs +1 -0
- package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.js +1 -0
- package/src/lib/components/UserAddress/UserAddress.cjs +1 -0
- package/src/lib/components/UserAddress/UserAddress.js +1 -0
- package/src/lib/components/UserProfile/UserProfile.cjs +4 -1
- package/src/lib/components/UserProfile/UserProfile.js +4 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +1 -0
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +1 -0
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.cjs +1 -0
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.js +1 -0
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +16 -13
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +16 -13
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +36 -18
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +14 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +36 -18
- package/src/lib/context/DynamicContext/helpers.cjs +42 -3
- package/src/lib/context/DynamicContext/helpers.d.ts +7 -1
- package/src/lib/context/DynamicContext/helpers.js +38 -4
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.cjs +5 -2
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.d.ts +4 -2
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.js +5 -2
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.d.ts +1 -1
- package/src/lib/context/DynamicContext/types/index.d.ts +6 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs +1 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.js +1 -0
- package/src/lib/context/DynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext.js +2 -1
- package/src/lib/context/ErrorContext/ErrorContext.cjs +5 -1
- package/src/lib/context/ErrorContext/ErrorContext.js +5 -1
- package/src/lib/context/MockContext/MockContext.cjs +1 -0
- package/src/lib/context/MockContext/MockContext.js +1 -0
- package/src/lib/context/QrCodeContext/QrCodeContext.cjs +1 -0
- package/src/lib/context/QrCodeContext/QrCodeContext.js +1 -0
- package/src/lib/context/SendBalanceContext/SendBalanceContext.cjs +1 -0
- package/src/lib/context/SendBalanceContext/SendBalanceContext.js +1 -0
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +8 -4
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.d.ts +5 -5
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +8 -4
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.cjs +1 -0
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.js +1 -0
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
- package/src/lib/context/WalletContext/WalletContext.cjs +2 -16
- package/src/lib/context/WalletContext/WalletContext.js +2 -16
- package/src/lib/data/api.cjs +49 -10
- package/src/lib/data/api.d.ts +1 -0
- package/src/lib/data/api.js +50 -12
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +2 -2
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +2 -2
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/Header/header.d.ts +0 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +1 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.cjs +3 -2
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.js +3 -2
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/Item/Item.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/Item/Item.js +1 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +1 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs +2 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.d.ts +0 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js +2 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletMoreInfoContent/WalletMoreInfoContent.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletMoreInfoContent/WalletMoreInfoContent.d.ts +0 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletMoreInfoContent/WalletMoreInfoContent.js +1 -0
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.js +1 -0
- package/src/lib/layout/DynamicAuthLayout/WalletProgressStepper/WalletProgressStepper.cjs +1 -0
- package/src/lib/layout/DynamicAuthLayout/WalletProgressStepper/WalletProgressStepper.js +1 -0
- package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.cjs +1 -0
- package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.js +1 -0
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.cjs +1 -0
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.js +1 -0
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.cjs +1 -0
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.js +1 -0
- package/src/lib/locale/en/translation.cjs +90 -0
- package/src/lib/locale/en/translation.js +77 -0
- package/src/lib/locale/index.d.ts +1 -0
- package/src/lib/locale/locale.cjs +55 -0
- package/src/lib/locale/locale.d.ts +13 -0
- package/src/lib/locale/locale.js +46 -0
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.cjs +1 -0
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.js +1 -0
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +1 -0
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +1 -0
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +1 -0
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +1 -0
- package/src/lib/modals/UserFieldEditorModal/UserFieldEditorModal.cjs +1 -0
- package/src/lib/modals/UserFieldEditorModal/UserFieldEditorModal.js +1 -0
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/shared/assets/sign-in-with-email.cjs +59 -0
- package/src/lib/shared/assets/sign-in-with-email.js +35 -0
- package/src/lib/shared/types/index.d.ts +4 -0
- package/src/lib/shared/utils/functions/wallet/createWallet.cjs +1 -1
- package/src/lib/shared/utils/functions/wallet/createWallet.js +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/localStorage.cjs +5 -1
- package/src/lib/utils/constants/localStorage.d.ts +2 -0
- package/src/lib/utils/constants/localStorage.js +4 -2
- package/src/lib/utils/functions/getActiveOauthCredential/getActiveOauthCredential.cjs +11 -0
- package/src/lib/utils/functions/getActiveOauthCredential/getActiveOauthCredential.d.ts +2 -0
- package/src/lib/utils/functions/getActiveOauthCredential/getActiveOauthCredential.js +7 -0
- package/src/lib/utils/functions/getActiveOauthCredential/index.d.ts +1 -0
- package/src/lib/utils/functions/getEnabledSocialSignInProvidersAsProviderEnum/getEnabledSocialSignInProvidersAsProviderEnum.d.ts +2 -0
- package/src/lib/utils/functions/getEnabledSocialSignInProvidersAsProviderEnum/index.d.ts +1 -0
- package/src/lib/utils/functions/getProviderEnumForSocialSignInProvider/getProviderEnumForSocialSignInProvider.cjs +19 -0
- package/src/lib/utils/functions/getProviderEnumForSocialSignInProvider/getProviderEnumForSocialSignInProvider.d.ts +2 -0
- package/src/lib/utils/functions/getProviderEnumForSocialSignInProvider/getProviderEnumForSocialSignInProvider.js +15 -0
- package/src/lib/utils/functions/getProviderEnumForSocialSignInProvider/index.d.ts +1 -0
- package/src/lib/utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.cjs +19 -0
- package/src/lib/utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.d.ts +2 -0
- package/src/lib/utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.js +15 -0
- package/src/lib/utils/functions/getSocialSignInProviderForProviderEnum/index.d.ts +1 -0
- package/src/lib/utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.cjs +19 -0
- package/src/lib/utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.d.ts +2 -0
- package/src/lib/utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.js +15 -0
- package/src/lib/utils/functions/getSocialSignInProviderFromString/index.d.ts +1 -0
- package/src/lib/utils/functions/index.d.ts +5 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +31 -16
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +31 -16
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +6 -2
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +6 -2
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +9 -4
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.d.ts +1 -19
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +9 -4
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +4 -3
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +4 -3
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +11 -15
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +1 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +12 -16
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +74 -0
- package/src/lib/utils/{functions/getDynamicLayoutData/getDynamicLayoutData.d.ts → hooks/useDynamicLayoutData/useDynamicLayoutData.d.ts} +2 -2
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +70 -0
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +10 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +10 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +10 -164
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.d.ts +2 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +12 -166
- package/src/lib/utils/hooks/useSocialAuth/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +278 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +20 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +274 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.cjs +8 -6
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.js +8 -6
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +13 -3
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +13 -3
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.cjs +0 -5
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.js +0 -5
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +0 -2
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +0 -2
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +7 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +7 -0
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +1 -0
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +1 -0
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +3 -1
- package/src/lib/utils/hooks/useWallets/useWallets.d.ts +3 -2
- package/src/lib/utils/hooks/useWallets/useWallets.js +3 -1
- package/src/lib/views/AccountExistsView/AccountExistsView.cjs +6 -3
- package/src/lib/views/AccountExistsView/AccountExistsView.js +6 -3
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.cjs +1 -1
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.js +1 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +1 -0
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +1 -0
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +1 -0
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +1 -0
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +4 -3
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +4 -3
- package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +1 -0
- package/src/lib/views/CollectUserDataView/UserDataFields/index.js +1 -0
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs +1 -0
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js +1 -0
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +1 -0
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +1 -0
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +1 -0
- package/src/lib/views/EmailUpdate/EmailUpdate.js +1 -0
- package/src/lib/views/EmailVerification/EmailVerification.cjs +10 -3
- package/src/lib/views/EmailVerification/EmailVerification.js +11 -4
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +1 -0
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +1 -0
- package/src/lib/views/LoginView/LoginView.cjs +6 -6
- package/src/lib/views/LoginView/LoginView.js +6 -6
- package/src/lib/views/LoginView/{components/EmailSignIn → sections/EmailSignInSection}/LoginEmailForm.cjs +1 -0
- package/src/lib/views/LoginView/{components/EmailSignIn → sections/EmailSignInSection}/LoginEmailForm.js +1 -0
- package/src/lib/views/LoginView/sections/LoginWidget.d.ts +10 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +77 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.d.ts +3 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +73 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/index.d.ts +1 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +65 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.d.ts +3 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +61 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/index.d.ts +1 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +49 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.d.ts +7 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +45 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/index.d.ts +1 -0
- package/src/lib/views/LoginView/{components/WalletSignIn → sections/WalletSignInSection}/ListItemButton/ListItemButton.cjs +1 -0
- package/src/lib/views/LoginView/{components/WalletSignIn → sections/WalletSignInSection}/ListItemButton/ListItemButton.js +1 -0
- package/src/lib/views/LoginView/{components/WalletSignIn/WalletSignIn.cjs → sections/WalletSignInSection/WalletSignInSection.cjs} +9 -3
- package/src/lib/views/LoginView/{components/WalletSignIn/WalletSignIn.d.ts → sections/WalletSignInSection/WalletSignInSection.d.ts} +1 -1
- package/src/lib/views/LoginView/{components/WalletSignIn/WalletSignIn.js → sections/WalletSignInSection/WalletSignInSection.js} +9 -3
- package/src/lib/views/LoginView/{components/WalletSignIn → sections/WalletSignInSection}/WalletSimpleSignIn/WalletSimpleSignIn.cjs +3 -1
- package/src/lib/views/LoginView/{components/WalletSignIn → sections/WalletSignInSection}/WalletSimpleSignIn/WalletSimpleSignIn.js +3 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/index.d.ts +1 -0
- package/src/lib/views/LoginView/sections/index.d.ts +4 -0
- package/src/lib/views/LoginView/useLoginView.cjs +11 -8
- package/src/lib/views/LoginView/useLoginView.js +11 -8
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +2 -1
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +2 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +2 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +2 -1
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +2 -1
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +2 -1
- package/src/lib/views/NoAccess/NoAccess.cjs +1 -0
- package/src/lib/views/NoAccess/NoAccess.js +1 -0
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +3 -2
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +3 -2
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.cjs +1 -0
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.js +1 -0
- package/src/lib/views/PendingConnectView/PendingConnectView.cjs +2 -1
- package/src/lib/views/PendingConnectView/PendingConnectView.js +2 -1
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +2 -1
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +2 -1
- package/src/lib/views/QrCodeView/QRCode.cjs +4 -3
- package/src/lib/views/QrCodeView/QRCode.d.ts +2 -2
- package/src/lib/views/QrCodeView/QRCode.js +4 -3
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +3 -2
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.d.ts +2 -1
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +3 -2
- package/src/lib/views/QrCodeView/QrCodeView.cjs +3 -2
- package/src/lib/views/QrCodeView/QrCodeView.js +3 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +2 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.js +2 -1
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.cjs +1 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.js +1 -0
- package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +5 -6
- package/src/lib/views/SocialRedirectView/SocialRedirectView.d.ts +1 -1
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +5 -6
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.cjs +1 -0
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.js +1 -0
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +1 -0
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +1 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.cjs +1 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.js +1 -0
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.cjs +1 -0
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.js +1 -0
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.cjs +2 -1
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.js +2 -1
- package/src/lib/views/WalletGroupView/WalletGroupView.cjs +1 -1
- package/src/lib/views/WalletGroupView/WalletGroupView.js +1 -1
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.cjs +1 -0
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.js +1 -0
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +3 -2
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +3 -2
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +2 -1
- package/src/lib/views/WalletLockedView/WalletLockedView.js +2 -1
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +3 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +3 -2
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +2 -1
- package/src/lib/views/WalletUsedView/WalletUsedView.js +2 -1
- package/src/lib/views/viewToComponentMap.cjs +1 -0
- package/src/lib/views/viewToComponentMap.js +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.cjs +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.js +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.cjs +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.js +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCard/DynamicBridgeWalletCard.cjs +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCard/DynamicBridgeWalletCard.js +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +3 -2
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.d.ts +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +3 -2
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetEmptyCard/DynamicBridgeWidgetEmptyCard.cjs +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetEmptyCard/DynamicBridgeWidgetEmptyCard.js +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.cjs +3 -3
- package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.js +3 -3
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.cjs +2 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.js +2 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +7 -1
- package/src/lib/widgets/DynamicWidget/DynamicWidget.js +7 -1
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +19 -3
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +19 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +10 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +10 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +4 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +4 -1
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.d.ts +2 -2
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.js +1 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +4 -3
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +4 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +2 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +2 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +2 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +2 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +2 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +2 -1
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +2 -1
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +2 -1
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +7 -5
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +7 -5
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +1 -0
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +4 -3
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +4 -3
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +1 -0
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +1 -0
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.cjs +1 -0
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.js +1 -0
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.cjs +0 -67
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.js +0 -63
- package/src/lib/views/LoginView/components/LoginWidget.d.ts +0 -5
- package/src/lib/views/LoginView/components/SocialSignIn/SocialSignIn.cjs +0 -88
- package/src/lib/views/LoginView/components/SocialSignIn/SocialSignIn.d.ts +0 -2
- package/src/lib/views/LoginView/components/SocialSignIn/SocialSignIn.js +0 -84
- package/src/lib/views/LoginView/components/WalletSignIn/index.d.ts +0 -1
- package/src/lib/views/LoginView/components/index.d.ts +0 -3
- /package/src/lib/{views/LoginView/components → components}/SocialSignIn/index.d.ts +0 -0
- /package/src/lib/views/LoginView/{components/EmailSignIn → sections/EmailSignInSection}/LoginEmailForm.d.ts +0 -0
- /package/src/lib/views/LoginView/{components/EmailSignIn → sections/EmailSignInSection}/index.d.ts +0 -0
- /package/src/lib/views/LoginView/{components/WalletSignIn → sections/WalletSignInSection}/ListItemButton/ListItemButton.d.ts +0 -0
- /package/src/lib/views/LoginView/{components/WalletSignIn → sections/WalletSignInSection}/ListItemButton/index.d.ts +0 -0
- /package/src/lib/views/LoginView/{components/WalletSignIn → sections/WalletSignInSection}/WalletSimpleSignIn/WalletSimpleSignIn.d.ts +0 -0
- /package/src/lib/views/LoginView/{components/WalletSignIn → sections/WalletSignInSection}/WalletSimpleSignIn/index.d.ts +0 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { useState, useRef } from 'react';
|
|
3
|
+
import { SocialOAuthErrorCode } from '@dynamic-labs/types';
|
|
4
|
+
import { SocialAccountAlreadyExistsError, NoAccessError } from '@dynamic-labs/utils';
|
|
5
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
6
|
+
import { getOauthLoginUrl, verifyOAuth, signInOAuth } from '../../../data/api.js';
|
|
7
|
+
import { useUpdateUserProfileByJWTCallback } from '../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.js';
|
|
8
|
+
import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
9
|
+
import '@dynamic-labs/iconic';
|
|
10
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
11
|
+
import 'react/jsx-runtime';
|
|
12
|
+
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
13
|
+
import { logger } from '../../../shared/logger.js';
|
|
14
|
+
import '@dynamic-labs/wallet-book';
|
|
15
|
+
import '../../constants/colors.js';
|
|
16
|
+
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
17
|
+
import 'ethers';
|
|
18
|
+
import '../../../shared/consts/index.js';
|
|
19
|
+
import '@dynamic-labs/multi-wallet';
|
|
20
|
+
import { getAuthToken } from '../../functions/getAuthToken/getAuthToken.js';
|
|
21
|
+
import '@dynamic-labs/sdk-api';
|
|
22
|
+
import { randomString } from '../../functions/randomString/randomString.js';
|
|
23
|
+
import { stringifyURIQuery } from '../../functions/stringifyURIQuery/stringifyURIQuery.js';
|
|
24
|
+
import { digestSHA256 } from '../../functions/digestSHA256/digestSHA256.js';
|
|
25
|
+
import { encodeBase64URL } from '../../functions/encodeBase64URL/encodeBase64URL.js';
|
|
26
|
+
import { getRedirectURIOrigin } from '../../functions/getRedirectURIOrigin/getRedirectURIOrigin.js';
|
|
27
|
+
import { useCreateUserProfileByJWTCallback } from '../useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.js';
|
|
28
|
+
import { useErrorContext } from '../../../context/ErrorContext/ErrorContext.js';
|
|
29
|
+
|
|
30
|
+
const socialProviders = [
|
|
31
|
+
'discord',
|
|
32
|
+
'facebook',
|
|
33
|
+
'github',
|
|
34
|
+
'google',
|
|
35
|
+
'instagram',
|
|
36
|
+
'twitch',
|
|
37
|
+
'twitter',
|
|
38
|
+
];
|
|
39
|
+
// pkce params are only required for twitter and break if added for other providers, like google
|
|
40
|
+
// so we should only add provider that support pkce to this list
|
|
41
|
+
const providersRequiringPkce = ['twitter', 'github'];
|
|
42
|
+
const providersWithoutWindowOpenerRefence = ['twitter'];
|
|
43
|
+
// Hook to handle common social auth logic (for social linking and social sign in)
|
|
44
|
+
const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
45
|
+
var _a;
|
|
46
|
+
const { environmentId, onboardingOnlyJwt, setOnboardingOnlyJwt, setCallback, setShowAuthFlow, setIsVerificationInProgress, } = useInternalDynamicContext();
|
|
47
|
+
const { setView } = useViewContext();
|
|
48
|
+
const { setErrorMessage, setError: setContextError } = useErrorContext();
|
|
49
|
+
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
50
|
+
const { createUserProfileByJWT } = useCreateUserProfileByJWTCallback();
|
|
51
|
+
const [isProcessing, setIsProcessing] = useState(false);
|
|
52
|
+
const [error, setError] = useState();
|
|
53
|
+
const providersWaitingOauthMessages = useRef({});
|
|
54
|
+
const authWindowInterval = useRef();
|
|
55
|
+
const userJwt = (_a = getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
56
|
+
const clearError = () => {
|
|
57
|
+
setError(undefined);
|
|
58
|
+
setContextError(undefined);
|
|
59
|
+
};
|
|
60
|
+
const handleError = (code, message) => {
|
|
61
|
+
logger.error(message);
|
|
62
|
+
setIsProcessing(false);
|
|
63
|
+
setError({ code, message });
|
|
64
|
+
setErrorMessage(code);
|
|
65
|
+
onError === null || onError === void 0 ? void 0 : onError();
|
|
66
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
67
|
+
};
|
|
68
|
+
const addOAuthIFrame = (url) => {
|
|
69
|
+
const container = document.getElementById('oauth-iframe-container');
|
|
70
|
+
let oauthIFrame = document.getElementById('oauth-iframe');
|
|
71
|
+
if (!container || oauthIFrame) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
oauthIFrame = document.createElement('iframe');
|
|
75
|
+
oauthIFrame.setAttribute('id', 'oauth-iframe');
|
|
76
|
+
oauthIFrame.setAttribute('src', url);
|
|
77
|
+
container.appendChild(oauthIFrame);
|
|
78
|
+
};
|
|
79
|
+
const removeOAuthIFrame = () => {
|
|
80
|
+
const oauthIFrame = document.getElementById('oauth-iframe');
|
|
81
|
+
if (oauthIFrame) {
|
|
82
|
+
oauthIFrame.remove();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const checkValidProvider = (provider) => {
|
|
86
|
+
if (!provider) {
|
|
87
|
+
handleError(SocialOAuthErrorCode.NO_PROVIDER, 'Provider is required');
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (!socialProviders.includes(provider)) {
|
|
91
|
+
handleError(SocialOAuthErrorCode.INVALID_PROVIDER, `Invalid social provider. Valid providers are: ${socialProviders.join(', ')}`);
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
};
|
|
96
|
+
const linkAccount = (provider, code, verifier, state) => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
+
try {
|
|
98
|
+
const jwt = yield verifyOAuth(environmentId, provider, {
|
|
99
|
+
code,
|
|
100
|
+
codeVerifier: verifier,
|
|
101
|
+
state,
|
|
102
|
+
}, String(userJwt));
|
|
103
|
+
if (!jwt) {
|
|
104
|
+
handleError(SocialOAuthErrorCode.VERIFICATION_ERROR, `Failed to link social account: ${provider}`);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
yield updateUserProfileByJWT(jwt);
|
|
108
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (error instanceof SocialAccountAlreadyExistsError) {
|
|
112
|
+
handleError(SocialOAuthErrorCode.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_PROFILE, `Social account already linked to a different profile: ${provider}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
const signInAccount = (provider, code, verifier, state) => __awaiter(void 0, void 0, void 0, function* () {
|
|
117
|
+
try {
|
|
118
|
+
const jwt = yield signInOAuth(environmentId, provider, {
|
|
119
|
+
code,
|
|
120
|
+
codeVerifier: verifier,
|
|
121
|
+
state,
|
|
122
|
+
});
|
|
123
|
+
if (!jwt) {
|
|
124
|
+
handleError(SocialOAuthErrorCode.SIGNIN_ERROR, `Failed to sign-in with social account: ${provider}`);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
setIsVerificationInProgress(true);
|
|
128
|
+
const decodedJwt = decodeJwt(jwt);
|
|
129
|
+
if (decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields.length) {
|
|
130
|
+
setOnboardingOnlyJwt(jwt);
|
|
131
|
+
setView('collect-user-data-login-with-email');
|
|
132
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
setCallback('authSuccess');
|
|
136
|
+
yield createUserProfileByJWT(jwt);
|
|
137
|
+
setShowAuthFlow(false);
|
|
138
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
if (error instanceof NoAccessError) {
|
|
142
|
+
setView('no-access');
|
|
143
|
+
}
|
|
144
|
+
handleError(SocialOAuthErrorCode.GENERAL_ERROR, error);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
const connectSocialAccount = (provider, validator) => __awaiter(void 0, void 0, void 0, function* () {
|
|
148
|
+
var _b;
|
|
149
|
+
clearInterval(authWindowInterval.current);
|
|
150
|
+
clearError();
|
|
151
|
+
setIsProcessing(true);
|
|
152
|
+
if (!checkValidProvider(provider)) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
// invalid connect request
|
|
156
|
+
if (validator && !validator(provider)) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const state = randomString(8);
|
|
160
|
+
const verifier = randomString(43);
|
|
161
|
+
const clearListeners = () => {
|
|
162
|
+
removeOAuthIFrame();
|
|
163
|
+
window.removeEventListener('message', handleAuthWindowMessage);
|
|
164
|
+
providersWaitingOauthMessages.current = Object.assign(Object.assign({}, providersWaitingOauthMessages.current), { [provider]: false });
|
|
165
|
+
};
|
|
166
|
+
const handleAuthWindowMessage = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
167
|
+
var _c;
|
|
168
|
+
const message = event.data;
|
|
169
|
+
const isAuthorizationMessage = (message === null || message === void 0 ? void 0 : message.type) === 'authorization_response';
|
|
170
|
+
if (isAuthorizationMessage) {
|
|
171
|
+
logger.debug('Message received', { data: message });
|
|
172
|
+
}
|
|
173
|
+
const isValidMessage = isAuthorizationMessage && (message === null || message === void 0 ? void 0 : message.provider) === provider;
|
|
174
|
+
// don't process invalid messages for provider
|
|
175
|
+
if (!isValidMessage) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
setIsProcessing(true);
|
|
179
|
+
if (!((_c = providersWaitingOauthMessages.current) === null || _c === void 0 ? void 0 : _c[provider])) {
|
|
180
|
+
handleError(SocialOAuthErrorCode.SESSION_TIMEOUT, `Connecting ${provider} account session timeout.`);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
clearListeners();
|
|
184
|
+
const { code, error } = message;
|
|
185
|
+
if (error && error !== 'undefined') {
|
|
186
|
+
handleError(SocialOAuthErrorCode.OAUTH_ERROR, `Failed to connect ${provider} social account: ${error}`);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (!code) {
|
|
190
|
+
handleError(SocialOAuthErrorCode.NO_AUTH_CODE, `Failed to connect ${provider} social account: no authorization code`);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (authMode === 'signin') {
|
|
194
|
+
yield signInAccount(provider, code, verifier, state);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
yield linkAccount(provider, code, verifier, state);
|
|
198
|
+
}
|
|
199
|
+
setIsProcessing(false);
|
|
200
|
+
});
|
|
201
|
+
const loginUrl = yield getOauthLoginUrl(environmentId, provider, String(userJwt));
|
|
202
|
+
if (!loginUrl) {
|
|
203
|
+
handleError(SocialOAuthErrorCode.NO_OAUTH_URL, `Failed to get login url to connect social account: ${provider}`);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
// we need to use an iframe to be the intermediary in communications between the popup and the sdk
|
|
207
|
+
// because of twitter limitations with accessing the window.opener and BroadcastChannel not working between
|
|
208
|
+
// different origins (our api redirect page and the app where the sdk is running)
|
|
209
|
+
const oauthIFrameUrl = `${getRedirectURIOrigin(loginUrl)}/sdkoauth`;
|
|
210
|
+
addOAuthIFrame(oauthIFrameUrl);
|
|
211
|
+
let oauthLoginUrl = loginUrl;
|
|
212
|
+
if (providersRequiringPkce.includes(provider)) {
|
|
213
|
+
const digest = yield digestSHA256(verifier);
|
|
214
|
+
const pkceParams = stringifyURIQuery({
|
|
215
|
+
code_challenge: encodeBase64URL(digest),
|
|
216
|
+
code_challenge_method: 'S256',
|
|
217
|
+
state: state,
|
|
218
|
+
});
|
|
219
|
+
oauthLoginUrl = `${loginUrl}&${pkceParams}`;
|
|
220
|
+
}
|
|
221
|
+
if (!((_b = providersWaitingOauthMessages.current) === null || _b === void 0 ? void 0 : _b[provider])) {
|
|
222
|
+
window.addEventListener('message', handleAuthWindowMessage);
|
|
223
|
+
providersWaitingOauthMessages.current = Object.assign(Object.assign({}, providersWaitingOauthMessages.current), { [provider]: true });
|
|
224
|
+
}
|
|
225
|
+
const authWindow = window.open(oauthLoginUrl, '_blank', 'width=500,height=600');
|
|
226
|
+
if (authWindow === null || typeof authWindow === 'undefined') {
|
|
227
|
+
// Pop-ups are blocked
|
|
228
|
+
handleError(SocialOAuthErrorCode.OAUTH_WINDOW_BLOCKED, 'Please allow popups and try again.');
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (!providersWithoutWindowOpenerRefence.includes(provider)) {
|
|
232
|
+
// For provider that support window.opener, we need to clear all states/listeners when the window is closed
|
|
233
|
+
authWindowInterval.current = setInterval(() => {
|
|
234
|
+
var _a;
|
|
235
|
+
if (!(authWindow === null || authWindow === void 0 ? void 0 : authWindow.closed)) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
clearInterval(authWindowInterval.current);
|
|
239
|
+
setIsProcessing(false);
|
|
240
|
+
// user didn't complete oauth
|
|
241
|
+
if ((_a = providersWaitingOauthMessages.current) === null || _a === void 0 ? void 0 : _a[provider]) {
|
|
242
|
+
onError === null || onError === void 0 ? void 0 : onError();
|
|
243
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
244
|
+
}
|
|
245
|
+
}, 2000);
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
// For provider that don't support window.opener, we need to use a timeout to try to detect when the
|
|
249
|
+
// window is closed
|
|
250
|
+
authWindowInterval.current = setInterval(() => {
|
|
251
|
+
var _a;
|
|
252
|
+
// user didn't complete oauth
|
|
253
|
+
if ((_a = providersWaitingOauthMessages.current) === null || _a === void 0 ? void 0 : _a[provider]) {
|
|
254
|
+
clearListeners();
|
|
255
|
+
handleError(SocialOAuthErrorCode.OAUTH_WINDOW_TIMEOUT, `Connecting ${provider} account window timeout.`);
|
|
256
|
+
}
|
|
257
|
+
clearInterval(authWindowInterval.current);
|
|
258
|
+
setIsProcessing(false);
|
|
259
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
260
|
+
}, sessionTimeout);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
return {
|
|
264
|
+
checkValidProvider,
|
|
265
|
+
connectSocialAccount,
|
|
266
|
+
error,
|
|
267
|
+
handleError,
|
|
268
|
+
isProcessing,
|
|
269
|
+
setError,
|
|
270
|
+
setIsProcessing,
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
export { useSocialAuth };
|
package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.cjs
CHANGED
|
@@ -11,17 +11,19 @@ var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
|
11
11
|
var validateUpdateRequest = require('./validateUpdateRequest/validateUpdateRequest.cjs');
|
|
12
12
|
|
|
13
13
|
/** Saves the values updated by the user */
|
|
14
|
-
const saveUserValues = ({ fields: newValues, updateUserResult: { isEmailVerificationRequired }, }, internalEvents,
|
|
14
|
+
const saveUserValues = ({ fields: newValues, updateUserResult: { isEmailVerificationRequired }, }, internalEvents, internalSetShowAuthFlow, setView, resolve, reject) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
// If no verification is needed, we are done
|
|
16
16
|
if (!isEmailVerificationRequired) {
|
|
17
17
|
resolve(newValues);
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
// Show email verification view
|
|
21
|
-
|
|
21
|
+
internalSetShowAuthFlow(true);
|
|
22
22
|
setView('verify-email');
|
|
23
23
|
// Subscribe to email verification result
|
|
24
|
-
internalEvents.current.once('emailVerificationResult', (wasSuccessful) => {
|
|
24
|
+
internalEvents.current.once('emailVerificationResult', (wasSuccessful, newEmail) => {
|
|
25
|
+
// Make sure we're using the correct, updated email. User might have changed it mid-OTP
|
|
26
|
+
newValues.email = newEmail;
|
|
25
27
|
wasSuccessful
|
|
26
28
|
? resolve(newValues)
|
|
27
29
|
: reject('Failed to verify email, no fields were updated');
|
|
@@ -32,7 +34,7 @@ const saveUserValues = ({ fields: newValues, updateUserResult: { isEmailVerifica
|
|
|
32
34
|
* The fields must have been previously enabled in the dashboard
|
|
33
35
|
*/
|
|
34
36
|
const useUpdateUserWithModal = (updateUser) => {
|
|
35
|
-
const { user, projectSettings,
|
|
37
|
+
const { user, projectSettings, internalSetShowAuthFlow, internalEvents } = useInternalDynamicContext.useInternalDynamicContext();
|
|
36
38
|
const { setView } = ViewContext.useViewContext();
|
|
37
39
|
const editorContext = React.useContext(UserFieldEditorContext.UserFieldEditorContext);
|
|
38
40
|
if (!editorContext)
|
|
@@ -52,7 +54,7 @@ const useUpdateUserWithModal = (updateUser) => {
|
|
|
52
54
|
subtitle: options === null || options === void 0 ? void 0 : options.subtitle,
|
|
53
55
|
title: options === null || options === void 0 ? void 0 : options.title,
|
|
54
56
|
}, updateUser)
|
|
55
|
-
.then((updateValues) => saveUserValues(updateValues, internalEvents,
|
|
57
|
+
.then((updateValues) => saveUserValues(updateValues, internalEvents, internalSetShowAuthFlow, setView, resolve, reject))
|
|
56
58
|
.catch((error) => {
|
|
57
59
|
if (/email already exists/gi.test(error))
|
|
58
60
|
throw error;
|
|
@@ -63,7 +65,7 @@ const useUpdateUserWithModal = (updateUser) => {
|
|
|
63
65
|
projectSettings,
|
|
64
66
|
promptUserForValues,
|
|
65
67
|
updateUser,
|
|
66
|
-
|
|
68
|
+
internalSetShowAuthFlow,
|
|
67
69
|
setView,
|
|
68
70
|
internalEvents,
|
|
69
71
|
]);
|
package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.js
CHANGED
|
@@ -7,17 +7,19 @@ import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
|
7
7
|
import { validateUpdateRequest } from './validateUpdateRequest/validateUpdateRequest.js';
|
|
8
8
|
|
|
9
9
|
/** Saves the values updated by the user */
|
|
10
|
-
const saveUserValues = ({ fields: newValues, updateUserResult: { isEmailVerificationRequired }, }, internalEvents,
|
|
10
|
+
const saveUserValues = ({ fields: newValues, updateUserResult: { isEmailVerificationRequired }, }, internalEvents, internalSetShowAuthFlow, setView, resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
11
|
// If no verification is needed, we are done
|
|
12
12
|
if (!isEmailVerificationRequired) {
|
|
13
13
|
resolve(newValues);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
// Show email verification view
|
|
17
|
-
|
|
17
|
+
internalSetShowAuthFlow(true);
|
|
18
18
|
setView('verify-email');
|
|
19
19
|
// Subscribe to email verification result
|
|
20
|
-
internalEvents.current.once('emailVerificationResult', (wasSuccessful) => {
|
|
20
|
+
internalEvents.current.once('emailVerificationResult', (wasSuccessful, newEmail) => {
|
|
21
|
+
// Make sure we're using the correct, updated email. User might have changed it mid-OTP
|
|
22
|
+
newValues.email = newEmail;
|
|
21
23
|
wasSuccessful
|
|
22
24
|
? resolve(newValues)
|
|
23
25
|
: reject('Failed to verify email, no fields were updated');
|
|
@@ -28,7 +30,7 @@ const saveUserValues = ({ fields: newValues, updateUserResult: { isEmailVerifica
|
|
|
28
30
|
* The fields must have been previously enabled in the dashboard
|
|
29
31
|
*/
|
|
30
32
|
const useUpdateUserWithModal = (updateUser) => {
|
|
31
|
-
const { user, projectSettings,
|
|
33
|
+
const { user, projectSettings, internalSetShowAuthFlow, internalEvents } = useInternalDynamicContext();
|
|
32
34
|
const { setView } = useViewContext();
|
|
33
35
|
const editorContext = useContext(UserFieldEditorContext);
|
|
34
36
|
if (!editorContext)
|
|
@@ -48,7 +50,7 @@ const useUpdateUserWithModal = (updateUser) => {
|
|
|
48
50
|
subtitle: options === null || options === void 0 ? void 0 : options.subtitle,
|
|
49
51
|
title: options === null || options === void 0 ? void 0 : options.title,
|
|
50
52
|
}, updateUser)
|
|
51
|
-
.then((updateValues) => saveUserValues(updateValues, internalEvents,
|
|
53
|
+
.then((updateValues) => saveUserValues(updateValues, internalEvents, internalSetShowAuthFlow, setView, resolve, reject))
|
|
52
54
|
.catch((error) => {
|
|
53
55
|
if (/email already exists/gi.test(error))
|
|
54
56
|
throw error;
|
|
@@ -59,7 +61,7 @@ const useUpdateUserWithModal = (updateUser) => {
|
|
|
59
61
|
projectSettings,
|
|
60
62
|
promptUserForValues,
|
|
61
63
|
updateUser,
|
|
62
|
-
|
|
64
|
+
internalSetShowAuthFlow,
|
|
63
65
|
setView,
|
|
64
66
|
internalEvents,
|
|
65
67
|
]);
|
|
@@ -38,7 +38,7 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
|
|
|
38
38
|
const { setExistentAccountData } = AccountExistsContext.useAccountExistsContext();
|
|
39
39
|
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
40
40
|
const { setErrorMessage, setError } = ErrorContext.useErrorContext();
|
|
41
|
-
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, setAuthMode, removeConnectedWalletsInfo, setIsVerificationInProgress, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
41
|
+
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, setAuthMode, removeConnectedWalletsInfo, setIsVerificationInProgress, eventsCallbacks, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
42
42
|
// If the user is not already logged it means that we only need to verify
|
|
43
43
|
// We need this boolean for the part of the logic where we already persisted a new authToken,
|
|
44
44
|
// and need to distinguish between logic for verify or linking.
|
|
@@ -68,7 +68,7 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
|
|
|
68
68
|
if (Jwt === undefined)
|
|
69
69
|
throw new utils.DynamicError('Could not obtain a valid JWT');
|
|
70
70
|
// TODO DYN-523: add verification here that the JWT is valid with the publicKey
|
|
71
|
-
return Jwt;
|
|
71
|
+
return { Jwt, verifyArgs };
|
|
72
72
|
});
|
|
73
73
|
// Overrides the stored primary wallet id when the
|
|
74
74
|
// user logs in for the first time.
|
|
@@ -149,13 +149,23 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
|
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
return ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
152
|
+
var _a;
|
|
152
153
|
const walletProvider = getWalletProvider.getWalletProvider(walletConnector);
|
|
153
154
|
try {
|
|
154
155
|
setIsVerificationInProgress(true);
|
|
155
|
-
const Jwt = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth);
|
|
156
|
+
const { Jwt, verifyArgs } = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth);
|
|
156
157
|
const decodedJwt = decodeJwt.decodeJwt(Jwt);
|
|
157
158
|
if (decodedJwt === undefined)
|
|
158
159
|
throw new utils.DynamicError('Invalid token!');
|
|
160
|
+
try {
|
|
161
|
+
(_a = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onSignedMessage) === null || _a === void 0 ? void 0 : _a.call(eventsCallbacks, {
|
|
162
|
+
messageToSign: verifyArgs.messageToSign,
|
|
163
|
+
signedMessage: verifyArgs.signedMessage,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
catch (_b) {
|
|
167
|
+
logger.logger.warn('Error calling onSignedMessage callback');
|
|
168
|
+
}
|
|
159
169
|
const user = yield createUserProfile.createUserProfile(decodedJwt);
|
|
160
170
|
const isKycRequired = decodedJwt.missingFields.length;
|
|
161
171
|
setOnboardingOnlyJwt(Jwt);
|
|
@@ -34,7 +34,7 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
|
|
|
34
34
|
const { setExistentAccountData } = useAccountExistsContext();
|
|
35
35
|
const { setView, goToInitialView } = useViewContext();
|
|
36
36
|
const { setErrorMessage, setError } = useErrorContext();
|
|
37
|
-
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, setAuthMode, removeConnectedWalletsInfo, setIsVerificationInProgress, } = useInternalDynamicContext();
|
|
37
|
+
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, setAuthMode, removeConnectedWalletsInfo, setIsVerificationInProgress, eventsCallbacks, } = useInternalDynamicContext();
|
|
38
38
|
// If the user is not already logged it means that we only need to verify
|
|
39
39
|
// We need this boolean for the part of the logic where we already persisted a new authToken,
|
|
40
40
|
// and need to distinguish between logic for verify or linking.
|
|
@@ -64,7 +64,7 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
|
|
|
64
64
|
if (Jwt === undefined)
|
|
65
65
|
throw new DynamicError('Could not obtain a valid JWT');
|
|
66
66
|
// TODO DYN-523: add verification here that the JWT is valid with the publicKey
|
|
67
|
-
return Jwt;
|
|
67
|
+
return { Jwt, verifyArgs };
|
|
68
68
|
});
|
|
69
69
|
// Overrides the stored primary wallet id when the
|
|
70
70
|
// user logs in for the first time.
|
|
@@ -145,13 +145,23 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
|
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
return ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
148
|
+
var _a;
|
|
148
149
|
const walletProvider = getWalletProvider(walletConnector);
|
|
149
150
|
try {
|
|
150
151
|
setIsVerificationInProgress(true);
|
|
151
|
-
const Jwt = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth);
|
|
152
|
+
const { Jwt, verifyArgs } = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth);
|
|
152
153
|
const decodedJwt = decodeJwt(Jwt);
|
|
153
154
|
if (decodedJwt === undefined)
|
|
154
155
|
throw new DynamicError('Invalid token!');
|
|
156
|
+
try {
|
|
157
|
+
(_a = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onSignedMessage) === null || _a === void 0 ? void 0 : _a.call(eventsCallbacks, {
|
|
158
|
+
messageToSign: verifyArgs.messageToSign,
|
|
159
|
+
signedMessage: verifyArgs.signedMessage,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
catch (_b) {
|
|
163
|
+
logger.warn('Error calling onSignedMessage callback');
|
|
164
|
+
}
|
|
155
165
|
const user = yield createUserProfile(decodedJwt);
|
|
156
166
|
const isKycRequired = decodedJwt.missingFields.length;
|
|
157
167
|
setOnboardingOnlyJwt(Jwt);
|
|
@@ -19,11 +19,6 @@ const useWalletConnectorEvent = (eventEmitters, eventName, handler) => {
|
|
|
19
19
|
/**
|
|
20
20
|
* Initialize the event listeners for the wallet connectors
|
|
21
21
|
* to ensure they were initialized before listening to events
|
|
22
|
-
*
|
|
23
|
-
* This will be removed when all wallets are migrated to
|
|
24
|
-
* use the event emitter "emit" method
|
|
25
|
-
*
|
|
26
|
-
* Ticket todo - QNTM-88
|
|
27
22
|
*/
|
|
28
23
|
eventEmittersArray.forEach((connector) => connector.initEventListener());
|
|
29
24
|
const uniqueEventEmitters = Array.from(new Set(eventEmittersArray));
|
|
@@ -15,11 +15,6 @@ const useWalletConnectorEvent = (eventEmitters, eventName, handler) => {
|
|
|
15
15
|
/**
|
|
16
16
|
* Initialize the event listeners for the wallet connectors
|
|
17
17
|
* to ensure they were initialized before listening to events
|
|
18
|
-
*
|
|
19
|
-
* This will be removed when all wallets are migrated to
|
|
20
|
-
* use the event emitter "emit" method
|
|
21
|
-
*
|
|
22
|
-
* Ticket todo - QNTM-88
|
|
23
18
|
*/
|
|
24
19
|
eventEmittersArray.forEach((connector) => connector.initEventListener());
|
|
25
20
|
const uniqueEventEmitters = Array.from(new Set(eventEmittersArray));
|
|
@@ -50,8 +50,6 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
50
50
|
* initialize the bridge between the old event listeners and the new event emitter.
|
|
51
51
|
* When the wallet connectors are migrated to the new event emitter, there will be no
|
|
52
52
|
* need to initialize or teardown event listeners, then we can remove this useEffect.
|
|
53
|
-
* @todo remove this useEffect
|
|
54
|
-
* Ticket todo - QNTM-88
|
|
55
53
|
*/
|
|
56
54
|
React.useEffect(() => walletsBasedOnAuthMode.forEach((wallet) => {
|
|
57
55
|
wallet.connector.initEventListener();
|
|
@@ -46,8 +46,6 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
46
46
|
* initialize the bridge between the old event listeners and the new event emitter.
|
|
47
47
|
* When the wallet connectors are migrated to the new event emitter, there will be no
|
|
48
48
|
* need to initialize or teardown event listeners, then we can remove this useEffect.
|
|
49
|
-
* @todo remove this useEffect
|
|
50
|
-
* Ticket todo - QNTM-88
|
|
51
49
|
*/
|
|
52
50
|
useEffect(() => walletsBasedOnAuthMode.forEach((wallet) => {
|
|
53
51
|
wallet.connector.initEventListener();
|
|
@@ -131,6 +131,13 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
131
131
|
}));
|
|
132
132
|
useWalletConnectorEvent.useWalletConnectorEvent(uniqueNonPrimaryWallets, 'disconnect', () => {
|
|
133
133
|
logger.logger.debug('secondary wallet disconnect');
|
|
134
|
+
// argent sends a disconnect event when the user adds a new account
|
|
135
|
+
if (authMode === 'connect-only' &&
|
|
136
|
+
secondaryWallets.length &&
|
|
137
|
+
secondaryWallets[0].connector.key === 'argentx') {
|
|
138
|
+
refreshConnectedWallet(secondaryWallets[0].id, secondaryWallets[0].connector);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
134
141
|
computeConnectedStateForWallets();
|
|
135
142
|
});
|
|
136
143
|
const handleAccountChangeWhenAwaitingAccountSwitch = React.useCallback((isPrimaryWallet, newAddress) => {
|
|
@@ -127,6 +127,13 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
127
127
|
}));
|
|
128
128
|
useWalletConnectorEvent(uniqueNonPrimaryWallets, 'disconnect', () => {
|
|
129
129
|
logger.debug('secondary wallet disconnect');
|
|
130
|
+
// argent sends a disconnect event when the user adds a new account
|
|
131
|
+
if (authMode === 'connect-only' &&
|
|
132
|
+
secondaryWallets.length &&
|
|
133
|
+
secondaryWallets[0].connector.key === 'argentx') {
|
|
134
|
+
refreshConnectedWallet(secondaryWallets[0].id, secondaryWallets[0].connector);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
130
137
|
computeConnectedStateForWallets();
|
|
131
138
|
});
|
|
132
139
|
const handleAccountChangeWhenAwaitingAccountSwitch = useCallback((isPrimaryWallet, newAddress) => {
|
|
@@ -49,6 +49,7 @@ require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
|
49
49
|
require('formik');
|
|
50
50
|
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
51
51
|
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
52
|
+
require('../../../components/OverlayCard/OverlayCard.context.cjs');
|
|
52
53
|
|
|
53
54
|
const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
54
55
|
const confirmationStateRef = React.useRef('enabled');
|
|
@@ -45,6 +45,7 @@ import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
|
45
45
|
import 'formik';
|
|
46
46
|
import '../../../components/InlineWidget/InlineWidget.js';
|
|
47
47
|
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
48
|
+
import '../../../components/OverlayCard/OverlayCard.context.js';
|
|
48
49
|
|
|
49
50
|
const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
50
51
|
const confirmationStateRef = useRef('enabled');
|
|
@@ -6,7 +6,7 @@ var React = require('react');
|
|
|
6
6
|
var data = require('../../../views/WalletList/data.cjs');
|
|
7
7
|
var verifyMagicIsSetup = require('./utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
8
8
|
|
|
9
|
-
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }) => {
|
|
9
|
+
const useWallets = ({ projectSettings, appLogoUrl, appName, deepLinkPreference, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }) => {
|
|
10
10
|
const wallets = React.useMemo(() => {
|
|
11
11
|
if (!projectSettings || !Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length)
|
|
12
12
|
return [];
|
|
@@ -14,6 +14,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
14
14
|
appLogoUrl,
|
|
15
15
|
appName,
|
|
16
16
|
customerApiProviders: projectSettings.providers || [],
|
|
17
|
+
deepLinkPreference,
|
|
17
18
|
flowNetwork,
|
|
18
19
|
networkConfigurations,
|
|
19
20
|
skipMemo: true,
|
|
@@ -26,6 +27,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
26
27
|
appLogoUrl,
|
|
27
28
|
appName,
|
|
28
29
|
customerApiProviders: projectSettings.providers || [],
|
|
30
|
+
deepLinkPreference,
|
|
29
31
|
flowNetwork,
|
|
30
32
|
networkConfigurations,
|
|
31
33
|
skipMemo: true,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ProjectSettings } from '@dynamic-labs/sdk-api';
|
|
2
2
|
import { NetworkConfigurationMap, WalletUiUtils } from '@dynamic-labs/types';
|
|
3
|
-
import { WalletConnector, WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { DeepLinkVariant, WalletConnector, WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
5
5
|
type Props = {
|
|
6
6
|
appLogoUrl?: string;
|
|
7
7
|
appName?: string;
|
|
8
|
+
deepLinkPreference?: DeepLinkVariant;
|
|
8
9
|
flowNetwork?: 'mainnet' | 'testnet';
|
|
9
10
|
networkConfigurations: NetworkConfigurationMap | undefined;
|
|
10
11
|
projectSettings: ProjectSettings | undefined;
|
|
@@ -13,7 +14,7 @@ type Props = {
|
|
|
13
14
|
walletConnectorsProp?: WalletConnectorsMethod[];
|
|
14
15
|
walletUiUtils: WalletUiUtils<WalletConnector>;
|
|
15
16
|
};
|
|
16
|
-
export declare const useWallets: ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }: Props) => {
|
|
17
|
+
export declare const useWallets: ({ projectSettings, appLogoUrl, appName, deepLinkPreference, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }: Props) => {
|
|
17
18
|
wallets: import("../../../shared").WalletOption[];
|
|
18
19
|
};
|
|
19
20
|
export {};
|
|
@@ -2,7 +2,7 @@ import { useMemo, useEffect } from 'react';
|
|
|
2
2
|
import { getInstalledWallets, getNotInstalledWallets } from '../../../views/WalletList/data.js';
|
|
3
3
|
import { verifyMagicIsSetup } from './utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
4
4
|
|
|
5
|
-
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }) => {
|
|
5
|
+
const useWallets = ({ projectSettings, appLogoUrl, appName, deepLinkPreference, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }) => {
|
|
6
6
|
const wallets = useMemo(() => {
|
|
7
7
|
if (!projectSettings || !Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length)
|
|
8
8
|
return [];
|
|
@@ -10,6 +10,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
10
10
|
appLogoUrl,
|
|
11
11
|
appName,
|
|
12
12
|
customerApiProviders: projectSettings.providers || [],
|
|
13
|
+
deepLinkPreference,
|
|
13
14
|
flowNetwork,
|
|
14
15
|
networkConfigurations,
|
|
15
16
|
skipMemo: true,
|
|
@@ -22,6 +23,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
22
23
|
appLogoUrl,
|
|
23
24
|
appName,
|
|
24
25
|
customerApiProviders: projectSettings.providers || [],
|
|
26
|
+
deepLinkPreference,
|
|
25
27
|
flowNetwork,
|
|
26
28
|
networkConfigurations,
|
|
27
29
|
skipMemo: true,
|