@dynamic-labs/sdk-react-core 0.19.3 → 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -24
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +10 -10
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +2 -1
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +3 -2
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.cjs +3 -3
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.js +3 -3
- package/src/lib/context/CaptchaContext/CaptchaContext.cjs +27 -1
- package/src/lib/context/CaptchaContext/CaptchaContext.d.ts +14 -0
- package/src/lib/context/CaptchaContext/CaptchaContext.js +28 -3
- package/src/lib/context/DynamicContext/DynamicContext.cjs +11 -11
- package/src/lib/context/DynamicContext/DynamicContext.js +11 -11
- package/src/lib/context/DynamicContext/hooks/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.cjs +20 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.d.ts +10 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.js +16 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/types.d.ts +2 -3
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.d.ts +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +1 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +6 -4
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +6 -4
- package/src/lib/data/api.cjs +6 -3
- package/src/lib/data/api.d.ts +5 -3
- package/src/lib/data/api.js +6 -3
- package/src/lib/main.global.cjs +1 -1
- package/src/lib/main.global.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/hooks/authenticationHooks/helpers/showPendingConnectView.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +42 -26
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +42 -26
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +9 -3
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +9 -3
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +5 -2
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +5 -2
- package/src/lib/utils/hooks/index.d.ts +0 -1
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +4 -4
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +4 -4
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.cjs +39 -5
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.d.ts +1 -2
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.js +40 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +13 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +13 -1
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs +10 -1
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js +10 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +8 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +9 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +4 -3
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +5 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +4 -3
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +3 -1
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +3 -1
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.cjs +0 -1
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.js +0 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +15 -4
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +15 -4
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.cjs +9 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.d.ts +3 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.js +5 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs +36 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.d.ts +10 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js +29 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +4 -4
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +3 -2
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +4 -4
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +8 -7
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +8 -7
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +0 -1
- package/src/lib/utils/hooks/useWallets/useWallets.js +0 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +9 -41
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.d.ts +1 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +9 -41
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +1 -1
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +1 -1
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +38 -34
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +38 -34
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +20 -3
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +20 -3
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +17 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +17 -2
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +1 -1
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.cjs +15 -3
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.js +15 -3
- package/src/lib/views/PasskeyIntroView/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.cjs +1 -2
- package/src/lib/views/PasskeyIntroView/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.d.ts +1 -1
- package/src/lib/views/PasskeyIntroView/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.js +1 -2
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +16 -8
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +16 -8
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.cjs +5 -2
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.d.ts +2 -1
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.js +5 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +2 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.d.ts +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.d.ts +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js +2 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +6 -7
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +6 -7
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +4 -3
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +4 -3
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +3 -5
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +3 -5
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/PendingSignModal.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/PendingSignModal.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +2 -4
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +2 -4
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +3 -5
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +3 -5
- package/src/lib/utils/hooks/useMultiWalletFlag/index.d.ts +0 -1
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.cjs +0 -36
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.d.ts +0 -2
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.js +0 -31
|
@@ -5,21 +5,20 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var iconic = require('@dynamic-labs/iconic');
|
|
8
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
8
|
require('react');
|
|
10
9
|
var Typography = require('../../components/Typography/Typography.cjs');
|
|
11
10
|
require('@dynamic-labs/sdk-api');
|
|
12
11
|
require('../../shared/logger.cjs');
|
|
13
|
-
|
|
12
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
13
|
+
require('../../context/ViewContext/ViewContext.cjs');
|
|
14
14
|
require('@dynamic-labs/wallet-book');
|
|
15
15
|
require('../../utils/constants/colors.cjs');
|
|
16
16
|
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
17
17
|
require('viem');
|
|
18
18
|
require('@dynamic-labs/utils');
|
|
19
19
|
require('../../shared/consts/index.cjs');
|
|
20
|
-
|
|
20
|
+
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
21
21
|
require('@dynamic-labs/multi-wallet');
|
|
22
|
-
var requiresTwoStepAuthentication = require('../../utils/functions/requiresTwoStepAuthentication/requiresTwoStepAuthentication.cjs');
|
|
23
22
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
24
23
|
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
25
24
|
require('react-dom');
|
|
@@ -30,22 +29,21 @@ require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
|
30
29
|
require('../../config/ApiEndpoint.cjs');
|
|
31
30
|
require('@dynamic-labs/rpc-providers');
|
|
32
31
|
require('../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
33
|
-
|
|
32
|
+
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
33
|
+
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
34
|
+
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
34
35
|
require('react-i18next');
|
|
35
36
|
require('../../components/OverlayCard/OverlayCard.context.cjs');
|
|
36
37
|
require('../../context/FooterAnimationContext/index.cjs');
|
|
37
38
|
require('../../context/MockContext/MockContext.cjs');
|
|
38
39
|
require('../../context/QrCodeContext/QrCodeContext.cjs');
|
|
39
40
|
var PoweredByDynamic = require('../../components/PoweredByDynamic/PoweredByDynamic.cjs');
|
|
40
|
-
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
41
|
-
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
42
41
|
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
43
42
|
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
44
43
|
var CaptchaContext = require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
45
44
|
require('../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
46
45
|
require('qrcode');
|
|
47
46
|
require('../../context/LoadingContext/LoadingContext.cjs');
|
|
48
|
-
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
49
47
|
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
50
48
|
require('yup');
|
|
51
49
|
require('../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
|
|
@@ -62,40 +60,10 @@ require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
|
62
60
|
var Captcha = require('../../components/Captcha/Captcha.cjs');
|
|
63
61
|
|
|
64
62
|
const CaptchaVerifyUser = () => {
|
|
65
|
-
const {
|
|
66
|
-
const { setView } = ViewContext.useViewContext();
|
|
67
|
-
const { setCaptchaToken } = CaptchaContext.useCaptchaContext();
|
|
68
|
-
const verifyWallet = useVerifyWallet.useVerifyWallet({
|
|
69
|
-
consumeNonce,
|
|
70
|
-
displaySiweStatement,
|
|
71
|
-
environmentId,
|
|
72
|
-
projectSettings,
|
|
73
|
-
setIsSingleWalletAccount,
|
|
74
|
-
});
|
|
75
|
-
if (!walletConnector) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
63
|
+
const { captchaAuthState } = CaptchaContext.useCaptchaContext();
|
|
78
64
|
const handleSuccess = (captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (!walletConnectorCore.isEmbeddedConnector(walletConnector) ||
|
|
84
|
-
walletConnectorCore.isBloctoConnector(walletConnector)) {
|
|
85
|
-
setView('pending-signature');
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
walletUiUtils.disabledConfirmationOnce();
|
|
89
|
-
}
|
|
90
|
-
if (requiresTwoStepAuthentication.requiresTwoStepAuthentication(walletConnector)) {
|
|
91
|
-
setCaptchaToken(captchaToken);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
yield verifyWallet({
|
|
95
|
-
captchaToken,
|
|
96
|
-
publicWalletAddress,
|
|
97
|
-
walletConnector,
|
|
98
|
-
});
|
|
65
|
+
var _a;
|
|
66
|
+
yield ((_a = captchaAuthState === null || captchaAuthState === void 0 ? void 0 : captchaAuthState.onCaptchaSuccess) === null || _a === void 0 ? void 0 : _a.call(captchaAuthState, captchaToken));
|
|
99
67
|
});
|
|
100
68
|
return (jsxRuntime.jsxs("div", { className: 'captcha-verify-user__container', children: [jsxRuntime.jsx(iconic.CaptchaWaveIcon, { className: 'captcha-verify-user__icon' }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'captcha-verify-user__title', children: "Let\u2019s verify you\u2019re human" }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'captcha-verify-user__subtitle', children: "We need to quickly verify you\u2019re human before we proceed." }), jsxRuntime.jsx(Captcha.Captcha, { handleSuccess: handleSuccess }), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'captcha-verify-user__dynamic-logo' })] }));
|
|
101
69
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const CaptchaVerifyUser: () => JSX.Element
|
|
2
|
+
export declare const CaptchaVerifyUser: () => JSX.Element;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { CaptchaWaveIcon } from '@dynamic-labs/iconic';
|
|
4
|
-
import { isEmbeddedConnector, isBloctoConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
4
|
import 'react';
|
|
6
5
|
import { Typography } from '../../components/Typography/Typography.js';
|
|
7
6
|
import '@dynamic-labs/sdk-api';
|
|
8
7
|
import '../../shared/logger.js';
|
|
9
|
-
import
|
|
8
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
9
|
+
import '../../context/ViewContext/ViewContext.js';
|
|
10
10
|
import '@dynamic-labs/wallet-book';
|
|
11
11
|
import '../../utils/constants/colors.js';
|
|
12
12
|
import '../../shared/utils/classes/storage/localStorage.js';
|
|
13
13
|
import 'viem';
|
|
14
14
|
import '@dynamic-labs/utils';
|
|
15
15
|
import '../../shared/consts/index.js';
|
|
16
|
-
import
|
|
16
|
+
import '../../context/DynamicContext/DynamicContext.js';
|
|
17
17
|
import '@dynamic-labs/multi-wallet';
|
|
18
|
-
import { requiresTwoStepAuthentication } from '../../utils/functions/requiresTwoStepAuthentication/requiresTwoStepAuthentication.js';
|
|
19
18
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
20
19
|
import '../../context/ThemeContext/ThemeContext.js';
|
|
21
20
|
import 'react-dom';
|
|
@@ -26,22 +25,21 @@ import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
|
26
25
|
import '../../config/ApiEndpoint.js';
|
|
27
26
|
import '@dynamic-labs/rpc-providers';
|
|
28
27
|
import '../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
29
|
-
import
|
|
28
|
+
import '../../context/ErrorContext/ErrorContext.js';
|
|
29
|
+
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
30
|
+
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
30
31
|
import 'react-i18next';
|
|
31
32
|
import '../../components/OverlayCard/OverlayCard.context.js';
|
|
32
33
|
import '../../context/FooterAnimationContext/index.js';
|
|
33
34
|
import '../../context/MockContext/MockContext.js';
|
|
34
35
|
import '../../context/QrCodeContext/QrCodeContext.js';
|
|
35
36
|
import { PoweredByDynamic } from '../../components/PoweredByDynamic/PoweredByDynamic.js';
|
|
36
|
-
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
37
|
-
import '../../context/ErrorContext/ErrorContext.js';
|
|
38
37
|
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
39
38
|
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
40
39
|
import { useCaptchaContext } from '../../context/CaptchaContext/CaptchaContext.js';
|
|
41
40
|
import '../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
42
41
|
import 'qrcode';
|
|
43
42
|
import '../../context/LoadingContext/LoadingContext.js';
|
|
44
|
-
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
45
43
|
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
46
44
|
import 'yup';
|
|
47
45
|
import '../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
@@ -58,40 +56,10 @@ import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
|
58
56
|
import { Captcha } from '../../components/Captcha/Captcha.js';
|
|
59
57
|
|
|
60
58
|
const CaptchaVerifyUser = () => {
|
|
61
|
-
const {
|
|
62
|
-
const { setView } = useViewContext();
|
|
63
|
-
const { setCaptchaToken } = useCaptchaContext();
|
|
64
|
-
const verifyWallet = useVerifyWallet({
|
|
65
|
-
consumeNonce,
|
|
66
|
-
displaySiweStatement,
|
|
67
|
-
environmentId,
|
|
68
|
-
projectSettings,
|
|
69
|
-
setIsSingleWalletAccount,
|
|
70
|
-
});
|
|
71
|
-
if (!walletConnector) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
59
|
+
const { captchaAuthState } = useCaptchaContext();
|
|
74
60
|
const handleSuccess = (captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (!isEmbeddedConnector(walletConnector) ||
|
|
80
|
-
isBloctoConnector(walletConnector)) {
|
|
81
|
-
setView('pending-signature');
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
walletUiUtils.disabledConfirmationOnce();
|
|
85
|
-
}
|
|
86
|
-
if (requiresTwoStepAuthentication(walletConnector)) {
|
|
87
|
-
setCaptchaToken(captchaToken);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
yield verifyWallet({
|
|
91
|
-
captchaToken,
|
|
92
|
-
publicWalletAddress,
|
|
93
|
-
walletConnector,
|
|
94
|
-
});
|
|
61
|
+
var _a;
|
|
62
|
+
yield ((_a = captchaAuthState === null || captchaAuthState === void 0 ? void 0 : captchaAuthState.onCaptchaSuccess) === null || _a === void 0 ? void 0 : _a.call(captchaAuthState, captchaToken));
|
|
95
63
|
});
|
|
96
64
|
return (jsxs("div", { className: 'captcha-verify-user__container', children: [jsx(CaptchaWaveIcon, { className: 'captcha-verify-user__icon' }), jsx(Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'captcha-verify-user__title', children: "Let\u2019s verify you\u2019re human" }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'captcha-verify-user__subtitle', children: "We need to quickly verify you\u2019re human before we proceed." }), jsx(Captcha, { handleSuccess: handleSuccess }), jsx(PoweredByDynamic, { classNameRoot: 'captcha-verify-user__dynamic-logo' })] }));
|
|
97
65
|
};
|
|
@@ -120,7 +120,7 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
120
120
|
(enforcePolicies &&
|
|
121
121
|
(policiesConsentInnerComponentArray === null || policiesConsentInnerComponentArray === void 0 ? void 0 : policiesConsentInnerComponentArray.length) !==
|
|
122
122
|
((_a = values.policiesConsentArray) === null || _a === void 0 ? void 0 : _a.length));
|
|
123
|
-
return (jsxRuntime.jsx(formik.Form, { className: 'user-data-form__form', children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [children, jsxRuntime.jsx(index.UserDataFields, { fields: decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields, errors: errors, touched: touched, policiesConsentInnerComponentArray: policiesConsentInnerComponentArray }), jsxRuntime.jsx(Button.Button, { type: 'submit', loading: loading, disabled: isSubmitBtnDisabled, buttonVariant: 'primary', expanded: true, buttonPadding: '
|
|
123
|
+
return (jsxRuntime.jsx(formik.Form, { className: 'user-data-form__form', children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [children, jsxRuntime.jsx(index.UserDataFields, { fields: decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields, errors: errors, touched: touched, policiesConsentInnerComponentArray: policiesConsentInnerComponentArray }), jsxRuntime.jsx(Button.Button, { type: 'submit', loading: loading, disabled: isSubmitBtnDisabled, buttonVariant: 'primary', expanded: true, buttonPadding: 'login-screen-height', children: "Continue" })] }) }));
|
|
124
124
|
} }));
|
|
125
125
|
};
|
|
126
126
|
|
|
@@ -116,7 +116,7 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
116
116
|
(enforcePolicies &&
|
|
117
117
|
(policiesConsentInnerComponentArray === null || policiesConsentInnerComponentArray === void 0 ? void 0 : policiesConsentInnerComponentArray.length) !==
|
|
118
118
|
((_a = values.policiesConsentArray) === null || _a === void 0 ? void 0 : _a.length));
|
|
119
|
-
return (jsx(Form, { className: 'user-data-form__form', children: jsxs(Fragment, { children: [children, jsx(UserDataFields, { fields: decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields, errors: errors, touched: touched, policiesConsentInnerComponentArray: policiesConsentInnerComponentArray }), jsx(Button, { type: 'submit', loading: loading, disabled: isSubmitBtnDisabled, buttonVariant: 'primary', expanded: true, buttonPadding: '
|
|
119
|
+
return (jsx(Form, { className: 'user-data-form__form', children: jsxs(Fragment, { children: [children, jsx(UserDataFields, { fields: decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields, errors: errors, touched: touched, policiesConsentInnerComponentArray: policiesConsentInnerComponentArray }), jsx(Button, { type: 'submit', loading: loading, disabled: isSubmitBtnDisabled, buttonVariant: 'primary', expanded: true, buttonPadding: 'login-screen-height', children: "Continue" })] }) }));
|
|
120
120
|
} }));
|
|
121
121
|
};
|
|
122
122
|
|
|
@@ -7,10 +7,10 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var reactI18next = require('react-i18next');
|
|
9
9
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
10
|
-
|
|
10
|
+
require('@dynamic-labs/sdk-api');
|
|
11
11
|
var logger = require('../../../../shared/logger.cjs');
|
|
12
12
|
require('@dynamic-labs/iconic');
|
|
13
|
-
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
13
|
+
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
14
14
|
var arrowRightCircle = require('../../../../shared/assets/arrow-right-circle.cjs');
|
|
15
15
|
require('@dynamic-labs/wallet-book');
|
|
16
16
|
require('../../../../utils/constants/colors.cjs');
|
|
@@ -20,7 +20,6 @@ require('@dynamic-labs/utils');
|
|
|
20
20
|
require('../../../../shared/consts/index.cjs');
|
|
21
21
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
22
22
|
require('@dynamic-labs/multi-wallet');
|
|
23
|
-
var isTurnkeyEnabled = require('../../../../utils/functions/isTurnkeyEnabled/isTurnkeyEnabled.cjs');
|
|
24
23
|
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
25
24
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
26
25
|
var Input = require('../../../../components/Input/Input.cjs');
|
|
@@ -29,7 +28,7 @@ require('react-focus-lock');
|
|
|
29
28
|
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
30
29
|
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
31
30
|
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
32
|
-
|
|
31
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
33
32
|
require('@dynamic-labs/rpc-providers');
|
|
34
33
|
require('../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
35
34
|
var ErrorContext = require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
@@ -41,7 +40,7 @@ require('../../../../context/MockContext/MockContext.cjs');
|
|
|
41
40
|
require('../../../../context/QrCodeContext/QrCodeContext.cjs');
|
|
42
41
|
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
43
42
|
require('../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
44
|
-
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
43
|
+
var CaptchaContext = require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
45
44
|
require('../../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
46
45
|
require('qrcode');
|
|
47
46
|
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
@@ -65,14 +64,16 @@ const EMAIL_REGEX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
|
|
|
65
64
|
const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError, currentEmail, }) => {
|
|
66
65
|
var _a, _b, _c;
|
|
67
66
|
const { t } = reactI18next.useTranslation();
|
|
68
|
-
const {
|
|
67
|
+
const { wallets, projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
68
|
+
const { view, setView } = ViewContext.useViewContext();
|
|
69
69
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
70
|
+
const { engageCaptcha } = CaptchaContext.useCaptchaContext();
|
|
70
71
|
const [emailInput, setEmailInput] = React.useState(currentEmail !== null && currentEmail !== void 0 ? currentEmail : '');
|
|
71
72
|
const [invalidEmail, setInvalidEmail] = React.useState(false);
|
|
72
73
|
const emailWalletConnector = wallets
|
|
73
74
|
.map(({ walletConnector }) => walletConnector)
|
|
74
75
|
.find(walletConnectorCore.isEmailWalletConnector);
|
|
75
|
-
const {
|
|
76
|
+
const { handleEmailSubmitWithOptionalCaptcha, isEmailProviderLoading } = useEmailProvider.useEmailProvider({
|
|
76
77
|
emailWalletConnector,
|
|
77
78
|
});
|
|
78
79
|
const isLoading = React.useMemo(() => isEmailProviderLoading || isExternalLoading, [isEmailProviderLoading, isExternalLoading]);
|
|
@@ -80,10 +81,19 @@ const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError,
|
|
|
80
81
|
const { value } = event.currentTarget;
|
|
81
82
|
setEmailInput(value);
|
|
82
83
|
};
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
const handleEmailSubmitError = (error) => {
|
|
85
|
+
if (error.code === 'invalid_email_address') {
|
|
86
|
+
setInvalidEmail(true);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
setErrorMessage(error.code);
|
|
90
|
+
}
|
|
91
|
+
logger.logger.debug(error);
|
|
92
|
+
onSubmitError === null || onSubmitError === void 0 ? void 0 : onSubmitError();
|
|
93
|
+
};
|
|
85
94
|
const emailInputSuffixIcon = (jsxRuntime.jsx(IconButton.IconButton, { "data-testid": 'email_submit_button', type: 'submit', className: `icon-button${((_a = emailInput === null || emailInput === void 0 ? void 0 : emailInput.trim()) === null || _a === void 0 ? void 0 : _a.length) ? '--visible' : ''}`, disabled: isLoading, children: jsxRuntime.jsx(arrowRightCircle.ReactComponent, {}) }));
|
|
86
95
|
const handleSubmit = (e) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
96
|
+
var _d;
|
|
87
97
|
e.preventDefault();
|
|
88
98
|
if (!EMAIL_REGEX.test(emailInput)) {
|
|
89
99
|
setInvalidEmail(true);
|
|
@@ -91,40 +101,34 @@ const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError,
|
|
|
91
101
|
}
|
|
92
102
|
try {
|
|
93
103
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
// we are making sure that the wallet connect is not magic as to not show captcha
|
|
105
|
+
// until we have a request to our backend (useConnectAndSign)
|
|
106
|
+
if (((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security.hCaptcha) === null || _d === void 0 ? void 0 : _d.enabled) &&
|
|
107
|
+
(emailWalletConnector === null || emailWalletConnector === void 0 ? void 0 : emailWalletConnector.key) !== 'magicemailotp') {
|
|
108
|
+
engageCaptcha({
|
|
109
|
+
authMethod: 'email',
|
|
110
|
+
onCaptchaSuccess: (captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
111
|
+
try {
|
|
112
|
+
yield handleEmailSubmitWithOptionalCaptcha(emailInput, captchaToken);
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
setView(view);
|
|
116
|
+
handleEmailSubmitError(e);
|
|
117
|
+
}
|
|
118
|
+
}),
|
|
101
119
|
});
|
|
102
|
-
|
|
103
|
-
// For v0.20/v1 we need to remove emailOnly and leave Dynamic as the only one email provider
|
|
104
|
-
// Ticket: https://linear.app/dynamic-labs/issue/GVTY-213/remove-emailonly-as-a-provider-from-sdk
|
|
105
|
-
if (emailProvider === sdkApi.ProviderEnum.EmailOnly ||
|
|
106
|
-
emailProvider === sdkApi.ProviderEnum.Dynamic) {
|
|
107
|
-
yield handleEmailOnlyLoginSubmit(emailInput);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
120
|
+
return;
|
|
110
121
|
}
|
|
111
|
-
yield
|
|
122
|
+
yield handleEmailSubmitWithOptionalCaptcha(emailInput);
|
|
112
123
|
}
|
|
113
124
|
catch (error) {
|
|
114
|
-
|
|
115
|
-
setInvalidEmail(true);
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
setErrorMessage(error.code);
|
|
119
|
-
}
|
|
120
|
-
logger.logger.debug(error);
|
|
121
|
-
onSubmitError === null || onSubmitError === void 0 ? void 0 : onSubmitError();
|
|
125
|
+
handleEmailSubmitError(error);
|
|
122
126
|
}
|
|
123
127
|
});
|
|
124
128
|
// social sign in currently coupled to email... might be better to decouple
|
|
125
129
|
return (jsxRuntime.jsxs("form", { className: 'login-with-email-form', onSubmit: (e) => handleSubmit(e), children: [jsxRuntime.jsx(Input.Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, label: 'Enter your email', error: invalidEmail, message: invalidEmail && t('dyn_login.helper.email_form.invalid_email'), suffix: ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _b === void 0 ? void 0 : _b.emailSubmitButtonInsideInput)
|
|
126
130
|
? emailInputSuffixIcon
|
|
127
|
-
: null, disabled: isLoading }), !((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _c === void 0 ? void 0 : _c.emailSubmitButtonInsideInput) && (jsxRuntime.jsx(Button.Button, { dataTestId: 'email_submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading, buttonVariant: 'brand-primary', buttonPadding: 'login-screen-height', expanded: true, typographyProps: {
|
|
131
|
+
: null, disabled: isLoading, type: 'email' }), !((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _c === void 0 ? void 0 : _c.emailSubmitButtonInsideInput) && (jsxRuntime.jsx(Button.Button, { dataTestId: 'email_submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading, buttonVariant: 'brand-primary', buttonPadding: 'login-screen-height', expanded: true, typographyProps: {
|
|
128
132
|
color: 'inherit',
|
|
129
133
|
}, children: "Continue" }))] }));
|
|
130
134
|
};
|
|
@@ -3,10 +3,10 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useState, useMemo } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { isEmailWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import
|
|
6
|
+
import '@dynamic-labs/sdk-api';
|
|
7
7
|
import { logger } from '../../../../shared/logger.js';
|
|
8
8
|
import '@dynamic-labs/iconic';
|
|
9
|
-
import '../../../../context/ViewContext/ViewContext.js';
|
|
9
|
+
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
10
10
|
import { ReactComponent as SvgArrowRightCircle } from '../../../../shared/assets/arrow-right-circle.js';
|
|
11
11
|
import '@dynamic-labs/wallet-book';
|
|
12
12
|
import '../../../../utils/constants/colors.js';
|
|
@@ -16,7 +16,6 @@ import '@dynamic-labs/utils';
|
|
|
16
16
|
import '../../../../shared/consts/index.js';
|
|
17
17
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
18
18
|
import '@dynamic-labs/multi-wallet';
|
|
19
|
-
import { isTurnkeyEnabled } from '../../../../utils/functions/isTurnkeyEnabled/isTurnkeyEnabled.js';
|
|
20
19
|
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
21
20
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
22
21
|
import { Input } from '../../../../components/Input/Input.js';
|
|
@@ -25,7 +24,7 @@ import 'react-focus-lock';
|
|
|
25
24
|
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
26
25
|
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
27
26
|
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
28
|
-
import
|
|
27
|
+
import '../../../../config/ApiEndpoint.js';
|
|
29
28
|
import '@dynamic-labs/rpc-providers';
|
|
30
29
|
import '../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
31
30
|
import { useErrorContext } from '../../../../context/ErrorContext/ErrorContext.js';
|
|
@@ -37,7 +36,7 @@ import '../../../../context/MockContext/MockContext.js';
|
|
|
37
36
|
import '../../../../context/QrCodeContext/QrCodeContext.js';
|
|
38
37
|
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
39
38
|
import '../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
40
|
-
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
39
|
+
import { useCaptchaContext } from '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
41
40
|
import '../../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
42
41
|
import 'qrcode';
|
|
43
42
|
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
@@ -61,14 +60,16 @@ const EMAIL_REGEX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
|
|
|
61
60
|
const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError, currentEmail, }) => {
|
|
62
61
|
var _a, _b, _c;
|
|
63
62
|
const { t } = useTranslation();
|
|
64
|
-
const {
|
|
63
|
+
const { wallets, projectSettings } = useInternalDynamicContext();
|
|
64
|
+
const { view, setView } = useViewContext();
|
|
65
65
|
const { setErrorMessage } = useErrorContext();
|
|
66
|
+
const { engageCaptcha } = useCaptchaContext();
|
|
66
67
|
const [emailInput, setEmailInput] = useState(currentEmail !== null && currentEmail !== void 0 ? currentEmail : '');
|
|
67
68
|
const [invalidEmail, setInvalidEmail] = useState(false);
|
|
68
69
|
const emailWalletConnector = wallets
|
|
69
70
|
.map(({ walletConnector }) => walletConnector)
|
|
70
71
|
.find(isEmailWalletConnector);
|
|
71
|
-
const {
|
|
72
|
+
const { handleEmailSubmitWithOptionalCaptcha, isEmailProviderLoading } = useEmailProvider({
|
|
72
73
|
emailWalletConnector,
|
|
73
74
|
});
|
|
74
75
|
const isLoading = useMemo(() => isEmailProviderLoading || isExternalLoading, [isEmailProviderLoading, isExternalLoading]);
|
|
@@ -76,10 +77,19 @@ const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError,
|
|
|
76
77
|
const { value } = event.currentTarget;
|
|
77
78
|
setEmailInput(value);
|
|
78
79
|
};
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
const handleEmailSubmitError = (error) => {
|
|
81
|
+
if (error.code === 'invalid_email_address') {
|
|
82
|
+
setInvalidEmail(true);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
setErrorMessage(error.code);
|
|
86
|
+
}
|
|
87
|
+
logger.debug(error);
|
|
88
|
+
onSubmitError === null || onSubmitError === void 0 ? void 0 : onSubmitError();
|
|
89
|
+
};
|
|
81
90
|
const emailInputSuffixIcon = (jsx(IconButton, { "data-testid": 'email_submit_button', type: 'submit', className: `icon-button${((_a = emailInput === null || emailInput === void 0 ? void 0 : emailInput.trim()) === null || _a === void 0 ? void 0 : _a.length) ? '--visible' : ''}`, disabled: isLoading, children: jsx(SvgArrowRightCircle, {}) }));
|
|
82
91
|
const handleSubmit = (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
+
var _d;
|
|
83
93
|
e.preventDefault();
|
|
84
94
|
if (!EMAIL_REGEX.test(emailInput)) {
|
|
85
95
|
setInvalidEmail(true);
|
|
@@ -87,40 +97,34 @@ const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError,
|
|
|
87
97
|
}
|
|
88
98
|
try {
|
|
89
99
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
// we are making sure that the wallet connect is not magic as to not show captcha
|
|
101
|
+
// until we have a request to our backend (useConnectAndSign)
|
|
102
|
+
if (((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security.hCaptcha) === null || _d === void 0 ? void 0 : _d.enabled) &&
|
|
103
|
+
(emailWalletConnector === null || emailWalletConnector === void 0 ? void 0 : emailWalletConnector.key) !== 'magicemailotp') {
|
|
104
|
+
engageCaptcha({
|
|
105
|
+
authMethod: 'email',
|
|
106
|
+
onCaptchaSuccess: (captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
107
|
+
try {
|
|
108
|
+
yield handleEmailSubmitWithOptionalCaptcha(emailInput, captchaToken);
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
setView(view);
|
|
112
|
+
handleEmailSubmitError(e);
|
|
113
|
+
}
|
|
114
|
+
}),
|
|
97
115
|
});
|
|
98
|
-
|
|
99
|
-
// For v0.20/v1 we need to remove emailOnly and leave Dynamic as the only one email provider
|
|
100
|
-
// Ticket: https://linear.app/dynamic-labs/issue/GVTY-213/remove-emailonly-as-a-provider-from-sdk
|
|
101
|
-
if (emailProvider === ProviderEnum.EmailOnly ||
|
|
102
|
-
emailProvider === ProviderEnum.Dynamic) {
|
|
103
|
-
yield handleEmailOnlyLoginSubmit(emailInput);
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
116
|
+
return;
|
|
106
117
|
}
|
|
107
|
-
yield
|
|
118
|
+
yield handleEmailSubmitWithOptionalCaptcha(emailInput);
|
|
108
119
|
}
|
|
109
120
|
catch (error) {
|
|
110
|
-
|
|
111
|
-
setInvalidEmail(true);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
setErrorMessage(error.code);
|
|
115
|
-
}
|
|
116
|
-
logger.debug(error);
|
|
117
|
-
onSubmitError === null || onSubmitError === void 0 ? void 0 : onSubmitError();
|
|
121
|
+
handleEmailSubmitError(error);
|
|
118
122
|
}
|
|
119
123
|
});
|
|
120
124
|
// social sign in currently coupled to email... might be better to decouple
|
|
121
125
|
return (jsxs("form", { className: 'login-with-email-form', onSubmit: (e) => handleSubmit(e), children: [jsx(Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, label: 'Enter your email', error: invalidEmail, message: invalidEmail && t('dyn_login.helper.email_form.invalid_email'), suffix: ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _b === void 0 ? void 0 : _b.emailSubmitButtonInsideInput)
|
|
122
126
|
? emailInputSuffixIcon
|
|
123
|
-
: null, disabled: isLoading }), !((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _c === void 0 ? void 0 : _c.emailSubmitButtonInsideInput) && (jsx(Button, { dataTestId: 'email_submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading, buttonVariant: 'brand-primary', buttonPadding: 'login-screen-height', expanded: true, typographyProps: {
|
|
127
|
+
: null, disabled: isLoading, type: 'email' }), !((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _c === void 0 ? void 0 : _c.emailSubmitButtonInsideInput) && (jsx(Button, { dataTestId: 'email_submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading, buttonVariant: 'brand-primary', buttonPadding: 'login-screen-height', expanded: true, typographyProps: {
|
|
124
128
|
color: 'inherit',
|
|
125
129
|
}, children: "Continue" }))] }));
|
|
126
130
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _tslib = require('../../../../../../../_virtual/_tslib.cjs');
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
7
|
require('react');
|
|
7
8
|
require('@dynamic-labs/sdk-api');
|
|
@@ -38,7 +39,7 @@ require('../../../../../context/MockContext/MockContext.cjs');
|
|
|
38
39
|
require('../../../../../context/QrCodeContext/QrCodeContext.cjs');
|
|
39
40
|
require('../../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
40
41
|
require('../../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
41
|
-
require('../../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
42
|
+
var CaptchaContext = require('../../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
42
43
|
require('../../../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
43
44
|
require('qrcode');
|
|
44
45
|
require('../../../../../context/LoadingContext/LoadingContext.cjs');
|
|
@@ -60,9 +61,10 @@ var SocialSignIn = require('../../../../../components/SocialSignIn/SocialSignIn.
|
|
|
60
61
|
var SocialRedirectContext = require('../../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
61
62
|
|
|
62
63
|
const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLayout, }) => {
|
|
63
|
-
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
64
|
+
const { setShowAuthFlow, projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
64
65
|
const { setSocialProvider, socialProvider, enabledSocialProviders } = SocialRedirectContext.useSocialRedirectContext();
|
|
65
66
|
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
67
|
+
const { engageCaptcha } = CaptchaContext.useCaptchaContext();
|
|
66
68
|
const { isProcessing, connectSocialAccount } = useSocialAuth.useSocialAuth({
|
|
67
69
|
authMode: 'signin',
|
|
68
70
|
onError: () => {
|
|
@@ -74,11 +76,26 @@ const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLa
|
|
|
74
76
|
sessionTimeout: 10000,
|
|
75
77
|
});
|
|
76
78
|
const onSelectProvider = (provider) => {
|
|
79
|
+
var _a;
|
|
77
80
|
const providerEnum = getProviderEnumForSocialSignInProvider.getProviderEnumForSocialSignInProvider(provider);
|
|
78
81
|
setSocialProvider(provider);
|
|
82
|
+
if ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security.hCaptcha) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
83
|
+
engageCaptcha({
|
|
84
|
+
authMethod: 'social',
|
|
85
|
+
onCaptchaSuccess: (captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
setView('social-redirect-view');
|
|
87
|
+
setShowAuthFlow(true);
|
|
88
|
+
connectSocialAccount({
|
|
89
|
+
captchaToken,
|
|
90
|
+
provider: providerEnum,
|
|
91
|
+
});
|
|
92
|
+
}),
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
79
96
|
setView('social-redirect-view');
|
|
80
97
|
setShowAuthFlow(true);
|
|
81
|
-
connectSocialAccount(providerEnum);
|
|
98
|
+
connectSocialAccount({ provider: providerEnum });
|
|
82
99
|
};
|
|
83
100
|
return (jsxRuntime.jsx(SocialSignIn.SocialSignIn, { onSelectProvider: onSelectProvider, providers: enabledSocialProviders, selectedProvider: socialProvider, isLoading: isProcessing, testId: 'dynamic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay, collapsedLayout: collapsedLayout }));
|
|
84
101
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../../../../_virtual/_tslib.js';
|
|
1
2
|
import { jsx } from 'react/jsx-runtime';
|
|
2
3
|
import 'react';
|
|
3
4
|
import '@dynamic-labs/sdk-api';
|
|
@@ -34,7 +35,7 @@ import '../../../../../context/MockContext/MockContext.js';
|
|
|
34
35
|
import '../../../../../context/QrCodeContext/QrCodeContext.js';
|
|
35
36
|
import '../../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
36
37
|
import '../../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
37
|
-
import '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
38
|
+
import { useCaptchaContext } from '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
38
39
|
import '../../../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
39
40
|
import 'qrcode';
|
|
40
41
|
import '../../../../../context/LoadingContext/LoadingContext.js';
|
|
@@ -56,9 +57,10 @@ import { SocialSignIn } from '../../../../../components/SocialSignIn/SocialSignI
|
|
|
56
57
|
import { useSocialRedirectContext } from '../../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
57
58
|
|
|
58
59
|
const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLayout, }) => {
|
|
59
|
-
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
60
|
+
const { setShowAuthFlow, projectSettings } = useInternalDynamicContext();
|
|
60
61
|
const { setSocialProvider, socialProvider, enabledSocialProviders } = useSocialRedirectContext();
|
|
61
62
|
const { setView, goToInitialView } = useViewContext();
|
|
63
|
+
const { engageCaptcha } = useCaptchaContext();
|
|
62
64
|
const { isProcessing, connectSocialAccount } = useSocialAuth({
|
|
63
65
|
authMode: 'signin',
|
|
64
66
|
onError: () => {
|
|
@@ -70,11 +72,26 @@ const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLa
|
|
|
70
72
|
sessionTimeout: 10000,
|
|
71
73
|
});
|
|
72
74
|
const onSelectProvider = (provider) => {
|
|
75
|
+
var _a;
|
|
73
76
|
const providerEnum = getProviderEnumForSocialSignInProvider(provider);
|
|
74
77
|
setSocialProvider(provider);
|
|
78
|
+
if ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security.hCaptcha) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
79
|
+
engageCaptcha({
|
|
80
|
+
authMethod: 'social',
|
|
81
|
+
onCaptchaSuccess: (captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
|
+
setView('social-redirect-view');
|
|
83
|
+
setShowAuthFlow(true);
|
|
84
|
+
connectSocialAccount({
|
|
85
|
+
captchaToken,
|
|
86
|
+
provider: providerEnum,
|
|
87
|
+
});
|
|
88
|
+
}),
|
|
89
|
+
});
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
75
92
|
setView('social-redirect-view');
|
|
76
93
|
setShowAuthFlow(true);
|
|
77
|
-
connectSocialAccount(providerEnum);
|
|
94
|
+
connectSocialAccount({ provider: providerEnum });
|
|
78
95
|
};
|
|
79
96
|
return (jsx(SocialSignIn, { onSelectProvider: onSelectProvider, providers: enabledSocialProviders, selectedProvider: socialProvider, isLoading: isProcessing, testId: 'dynamic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay, collapsedLayout: collapsedLayout }));
|
|
80
97
|
};
|