@dynamic-labs/sdk-react-core 2.0.0-alpha.6 → 2.0.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 +21 -0
- package/package.cjs +4 -4
- package/package.js +4 -4
- package/package.json +16 -16
- package/src/index.cjs +3 -7
- package/src/index.d.ts +1 -2
- package/src/index.js +2 -2
- package/src/lib/components/Alert/Alert.cjs +1 -0
- package/src/lib/components/Alert/Alert.js +1 -0
- package/src/lib/components/Alert/Alert.types.d.ts +1 -1
- package/src/lib/components/ErrorContainer/ErrorContainer.cjs +1 -1
- package/src/lib/components/ErrorContainer/ErrorContainer.js +1 -1
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +4 -2
- package/src/lib/components/NetworkPicker/NetworkPicker.js +4 -2
- package/src/lib/components/ShadowDOM/ShadowDOM.cjs +2 -0
- package/src/lib/components/ShadowDOM/ShadowDOM.js +2 -1
- package/src/lib/components/SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.cjs +26 -10
- package/src/lib/components/SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.js +27 -11
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +16 -17
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +3 -4
- package/src/lib/context/DynamicContext/DynamicContext.js +17 -18
- package/src/lib/context/DynamicContext/helpers/helpers.cjs +10 -0
- package/src/lib/context/DynamicContext/helpers/helpers.d.ts +5 -0
- package/src/lib/context/DynamicContext/helpers/helpers.js +10 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/types.d.ts +0 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +1 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +1 -1
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.cjs +1 -0
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.d.ts +8 -7
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.js +1 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +14 -2
- package/src/lib/context/ErrorContext/ErrorContext.cjs +4 -0
- package/src/lib/context/ErrorContext/ErrorContext.d.ts +1 -0
- package/src/lib/context/ErrorContext/ErrorContext.js +4 -0
- package/src/lib/context/FundingContext/FundingContext.cjs +3 -1
- package/src/lib/context/FundingContext/FundingContext.js +3 -1
- package/src/lib/context/PasskeyContext/PasskeyContext.cjs +1 -0
- package/src/lib/context/PasskeyContext/PasskeyContext.js +1 -0
- package/src/lib/context/ViewContext/ViewContext.cjs +7 -0
- package/src/lib/context/ViewContext/ViewContext.js +7 -0
- package/src/lib/context/ViewContext/types/index.d.ts +5 -3
- package/src/lib/locale/en/translation.cjs +30 -16
- package/src/lib/locale/en/translation.d.ts +22 -8
- package/src/lib/locale/en/translation.js +30 -16
- package/src/lib/shared/types/localStorage.d.ts +1 -1
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.cjs +10 -28
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.d.ts +1 -5
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.js +10 -28
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/functions/mergeNetworks/index.d.ts +1 -0
- package/src/lib/utils/functions/mergeNetworks/mergeNetworks.cjs +26 -0
- package/src/lib/utils/functions/mergeNetworks/mergeNetworks.d.ts +13 -0
- package/src/lib/utils/functions/mergeNetworks/mergeNetworks.js +22 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +4 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +4 -2
- package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.cjs +1 -0
- package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js +1 -0
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.cjs +3 -13
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.d.ts +1 -2
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.js +3 -13
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +1 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +1 -1
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.cjs +1 -0
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.js +1 -0
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +33 -8
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +33 -8
- package/src/lib/utils/hooks/useEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +1 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +1 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +27 -5
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +27 -5
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.cjs +7 -6
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.d.ts +1 -1
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.js +7 -6
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.cjs +2 -6
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.js +2 -6
- package/src/lib/utils/hooks/useProcessNetworkConfigurations/useProcessNetworkConfigurations.cjs +20 -54
- package/src/lib/utils/hooks/useProcessNetworkConfigurations/useProcessNetworkConfigurations.d.ts +5 -3
- package/src/lib/utils/hooks/useProcessNetworkConfigurations/useProcessNetworkConfigurations.js +20 -54
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +38 -0
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.d.ts +2 -0
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +34 -0
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -0
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +8 -11
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +8 -11
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs +1 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js +1 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +1 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.cjs +4 -7
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.js +4 -7
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +1 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +1 -1
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.cjs +1 -1
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.js +1 -1
- package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.cjs +1 -1
- package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.js +1 -1
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +3 -8
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +3 -8
- package/src/lib/views/{CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs → CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.cjs} +5 -4
- package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.d.ts +13 -0
- package/src/lib/views/{CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js → CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.js} +5 -4
- package/src/lib/views/CollectUserDataViewNoWallet/index.d.ts +1 -0
- package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.cjs +17 -2
- package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.js +17 -2
- package/src/lib/views/CreatePasswordView/CreatePasswordView.cjs +12 -13
- package/src/lib/views/CreatePasswordView/CreatePasswordView.d.ts +2 -0
- package/src/lib/views/CreatePasswordView/CreatePasswordView.js +12 -13
- 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 -17
- package/src/lib/views/EmailVerification/EmailVerification.js +10 -17
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +40 -13
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.d.ts +2 -3
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +40 -13
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.d.ts +1 -1
- package/src/lib/views/EnterPasswordView/EnterPasswordView.cjs +8 -1
- package/src/lib/views/EnterPasswordView/EnterPasswordView.js +8 -1
- package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/usePhoneInputLogic/usePhoneInputLogic.cjs +1 -0
- package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/usePhoneInputLogic/usePhoneInputLogic.js +1 -0
- package/src/lib/views/LoginView/useLoginView/useLoginView.cjs +11 -5
- package/src/lib/views/LoginView/useLoginView/useLoginView.js +11 -5
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +1 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +1 -0
- package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.d.ts +2 -3
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.d.ts +2 -3
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.d.ts +2 -3
- package/src/lib/views/Passkey/RenamePasskeyView/RenamePasskeyView.cjs +1 -0
- package/src/lib/views/Passkey/RenamePasskeyView/RenamePasskeyView.js +1 -0
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.cjs +31 -7
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.js +31 -7
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -0
- package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -0
- package/src/lib/views/viewToComponentMap.cjs +4 -4
- package/src/lib/views/viewToComponentMap.d.ts +60 -2
- package/src/lib/views/viewToComponentMap.js +4 -4
- 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/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +6 -4
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +6 -4
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +5 -2
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +5 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.cjs +2 -14
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.js +2 -14
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.cjs +3 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.js +4 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +2 -14
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +2 -14
- package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.cjs +18 -9
- package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.js +18 -9
- package/src/lib/utils/functions/isSameWalletName/index.d.ts +0 -1
- package/src/lib/utils/functions/isSameWalletName/isSameWalletName.cjs +0 -9
- package/src/lib/utils/functions/isSameWalletName/isSameWalletName.d.ts +0 -1
- package/src/lib/utils/functions/isSameWalletName/isSameWalletName.js +0 -5
- package/src/lib/utils/hooks/useProcessNetworkConfigurations/utils/index.d.ts +0 -1
- package/src/lib/utils/hooks/useProcessNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/index.d.ts +0 -1
- package/src/lib/utils/hooks/useProcessNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.cjs +0 -16
- package/src/lib/utils/hooks/useProcessNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.d.ts +0 -2
- package/src/lib/utils/hooks/useProcessNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.js +0 -12
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.d.ts +0 -2
- package/src/lib/views/CollectUserDataViewLoginWithEmail/index.d.ts +0 -1
|
@@ -86,6 +86,7 @@ import '../WalletList/WalletList.js';
|
|
|
86
86
|
import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
87
87
|
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
88
88
|
import '@hcaptcha/react-hcaptcha';
|
|
89
|
+
import '../../config/ApiEndpoint.js';
|
|
89
90
|
import '../LoginView/sections/PhoneNumberSignInSection/usePhoneInputLogic/usePhoneInputLogic.js';
|
|
90
91
|
|
|
91
92
|
const SECONDS_TO_RETRY = 15;
|
|
@@ -149,14 +150,9 @@ const EmailVerification = () => {
|
|
|
149
150
|
setShowAuthFlow(false);
|
|
150
151
|
return;
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
yield createEmbeddedWallet();
|
|
156
|
-
}
|
|
157
|
-
catch (e) {
|
|
158
|
-
setShowAuthFlow(false, { emitCancelAuth: true });
|
|
159
|
-
}
|
|
153
|
+
// this function will check turnkey wallet enabled and create wallet if needed
|
|
154
|
+
// if not enabled, it will throw an error.
|
|
155
|
+
yield createEmbeddedWallet().catch(() => setShowAuthFlow(false));
|
|
160
156
|
}
|
|
161
157
|
catch (error) {
|
|
162
158
|
logger.debug(error);
|
|
@@ -212,7 +208,9 @@ const EmailVerification = () => {
|
|
|
212
208
|
if (decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields.length) {
|
|
213
209
|
setOnboardingOnlyJwt(jwt);
|
|
214
210
|
yield sleepToShowSuccessMessage();
|
|
215
|
-
setView('collect-user-data-login-
|
|
211
|
+
setView('collect-user-data-login-no-wallet', {
|
|
212
|
+
userIdentification: 'email',
|
|
213
|
+
});
|
|
216
214
|
return;
|
|
217
215
|
}
|
|
218
216
|
setCallback('authSuccess');
|
|
@@ -224,14 +222,9 @@ const EmailVerification = () => {
|
|
|
224
222
|
setShowAuthFlow(false);
|
|
225
223
|
return;
|
|
226
224
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
yield createEmbeddedWallet();
|
|
231
|
-
}
|
|
232
|
-
catch (e) {
|
|
233
|
-
setShowAuthFlow(false);
|
|
234
|
-
}
|
|
225
|
+
// this function will check turnkey wallet enabled and create wallet if needed
|
|
226
|
+
// if not enabled, it will throw an error.
|
|
227
|
+
yield createEmbeddedWallet().catch(() => setShowAuthFlow(false));
|
|
235
228
|
}
|
|
236
229
|
catch (error) {
|
|
237
230
|
if (error instanceof NoAccessError) {
|
|
@@ -7,12 +7,12 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var reactI18next = require('react-i18next');
|
|
9
9
|
var utils = require('@dynamic-labs/utils');
|
|
10
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
10
11
|
var getProperErrorMessage = require('../../../modals/SignMessageConfirmationModal/getProperErrorMessage.cjs');
|
|
11
12
|
var dynamicEvents = require('../../../events/dynamicEvents.cjs');
|
|
12
13
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
13
14
|
var decodeJwt = require('../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
14
15
|
require('@dynamic-labs/iconic');
|
|
15
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
16
16
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
17
17
|
var close = require('../../../shared/assets/close.cjs');
|
|
18
18
|
var exportEmbeddedHero = require('../../../shared/assets/export-embedded-hero.cjs');
|
|
@@ -33,7 +33,7 @@ require('@dynamic-labs/multi-wallet');
|
|
|
33
33
|
require('react-international-phone');
|
|
34
34
|
require('viem/chains');
|
|
35
35
|
var getEOAWallet = require('../../../utils/functions/getEOAWallet/getEOAWallet.cjs');
|
|
36
|
-
require('../../../config/ApiEndpoint.cjs');
|
|
36
|
+
var ApiEndpoint = require('../../../config/ApiEndpoint.cjs');
|
|
37
37
|
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
38
38
|
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
39
39
|
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
@@ -42,6 +42,7 @@ require('../../../context/WalletContext/WalletContext.cjs');
|
|
|
42
42
|
var usePromise = require('../../../utils/hooks/usePromise/usePromise.cjs');
|
|
43
43
|
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
44
44
|
var useMutation = require('../../../utils/hooks/useMutation/useMutation.cjs');
|
|
45
|
+
var useIsTurnkeyWallet = require('../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs');
|
|
45
46
|
require('@dynamic-labs/types');
|
|
46
47
|
require('yup');
|
|
47
48
|
require('../../../context/MockContext/MockContext.cjs');
|
|
@@ -51,7 +52,7 @@ require('@dynamic-labs/rpc-providers');
|
|
|
51
52
|
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
52
53
|
require('i18next');
|
|
53
54
|
var Typography = require('../../../components/Typography/Typography.cjs');
|
|
54
|
-
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
55
|
+
var ShadowDOM = require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
55
56
|
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
56
57
|
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
57
58
|
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
@@ -91,13 +92,17 @@ var constants = require('../constants.cjs');
|
|
|
91
92
|
require('../../LoginView/sections/PhoneNumberSignInSection/usePhoneInputLogic/usePhoneInputLogic.cjs');
|
|
92
93
|
|
|
93
94
|
const EmbeddedRevealView = ({ exportPrivateKey, }) => {
|
|
94
|
-
var _a, _b;
|
|
95
|
+
var _a, _b, _c;
|
|
95
96
|
const { authToken, primaryWallet, user, setShowAuthFlow, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
97
|
+
const { isTurnkeyWallet } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
98
|
+
const { shadowRoot } = ShadowDOM.useShadowDOMContext();
|
|
96
99
|
const [acknowledgement1, setAcknowledgement1] = React.useState(false);
|
|
100
|
+
const [hasRevealedCoinbaseMpcKey, setHasRevealedCoinbaseMpcKey] = React.useState(false);
|
|
97
101
|
const iframeContainerRef = React.useRef(null);
|
|
98
102
|
const decodedJwt = decodeJwt.decodeJwt(authToken);
|
|
99
103
|
const walletProperties = (_b = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
|
|
100
104
|
const isTurnkeyHDWallet = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyHDWalletId;
|
|
105
|
+
const isCoinbaseMpcWallet = primaryWallet && walletConnectorCore.isCoinbaseMpcWalletConnector(primaryWallet.connector);
|
|
101
106
|
const wallet = getEOAWallet.getEOAWallet(primaryWallet, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
102
107
|
// eslint-disable-next-line arrow-body-style
|
|
103
108
|
React.useEffect(() => {
|
|
@@ -124,18 +129,35 @@ const EmbeddedRevealView = ({ exportPrivateKey, }) => {
|
|
|
124
129
|
});
|
|
125
130
|
const { mutate: handleExportWallet, isLoading, error, data, } = useMutation.useMutation(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
126
131
|
const wallet = getEOAWallet.getEOAWallet(primaryWallet, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
if (isCoinbaseMpcWallet) {
|
|
133
|
+
return primaryWallet.connector.exportWalletKeys();
|
|
134
|
+
}
|
|
135
|
+
if (isTurnkeyWallet) {
|
|
136
|
+
return turnkeyExport.exportCredential({
|
|
137
|
+
address: exportPrivateKey ? wallet === null || wallet === void 0 ? void 0 : wallet.address : undefined,
|
|
138
|
+
authToken,
|
|
139
|
+
environmentId,
|
|
140
|
+
userEmail: user === null || user === void 0 ? void 0 : user.email,
|
|
141
|
+
wallet,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return undefined;
|
|
134
145
|
}), {
|
|
135
146
|
onFailure: (err) => {
|
|
136
147
|
logger.logger.error('Failed to export', err);
|
|
137
148
|
dynamicEvents.dynamicEvents.emit('embeddedWalletRevealFailed', err);
|
|
138
149
|
},
|
|
150
|
+
onSuccess: (data) => {
|
|
151
|
+
var _a, _b;
|
|
152
|
+
if (isCoinbaseMpcWallet && data && (data === null || data === void 0 ? void 0 : data.length)) {
|
|
153
|
+
const iframe = shadowRoot === null || shadowRoot === void 0 ? void 0 : shadowRoot.getElementById('coinbase-waas-key-export');
|
|
154
|
+
(_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
155
|
+
key: (_b = data[0]) === null || _b === void 0 ? void 0 : _b.ecKeyPrivate,
|
|
156
|
+
type: 'export_key',
|
|
157
|
+
}, '*');
|
|
158
|
+
setHasRevealedCoinbaseMpcKey(true);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
139
161
|
});
|
|
140
162
|
const errorText = React.useMemo(() => {
|
|
141
163
|
if (!error) {
|
|
@@ -158,7 +180,7 @@ const EmbeddedRevealView = ({ exportPrivateKey, }) => {
|
|
|
158
180
|
: 'height: 100px');
|
|
159
181
|
}
|
|
160
182
|
}, [iframeContainerRef, data, isTurnkeyHDWallet, exportPrivateKey]);
|
|
161
|
-
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { onClick: () => setShowAuthFlow(false
|
|
183
|
+
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { onClick: () => setShowAuthFlow(false), type: 'button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
162
184
|
const hasInjectedCredential = !isLoading && data && !error;
|
|
163
185
|
const credentialTitle = !isTurnkeyHDWallet || exportPrivateKey
|
|
164
186
|
? t('dyn_embedded_reveal.private_key_title')
|
|
@@ -166,7 +188,12 @@ const EmbeddedRevealView = ({ exportPrivateKey, }) => {
|
|
|
166
188
|
const title = hasInjectedCredential
|
|
167
189
|
? credentialTitle
|
|
168
190
|
: t('dyn_embedded_reveal.agreement_title');
|
|
169
|
-
|
|
191
|
+
// this element needs to be on the DOM before the reveal occurs
|
|
192
|
+
// so we can inject the key into it once it's fetched from coinbase.
|
|
193
|
+
const coinbaseWaasKeyExportIframe = (jsxRuntime.jsx("iframe", { src: (_c = ApiEndpoint === null || ApiEndpoint === void 0 ? void 0 : ApiEndpoint.getBaseUrl()) === null || _c === void 0 ? void 0 : _c.replace('api/v0', 'coinbase-waas-key-export.html'), id: 'coinbase-waas-key-export', title: 'Coinbase WaaS key export', height: hasRevealedCoinbaseMpcKey ? '100%' : 0, width: hasRevealedCoinbaseMpcKey ? '100%' : 0, style: {
|
|
194
|
+
borderRadius: '0.75rem',
|
|
195
|
+
}, allow: 'clipboard-write' }));
|
|
196
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, children: jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', children: title }) }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view', children: jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body', children: [contentHeader, isCoinbaseMpcWallet && coinbaseWaasKeyExportIframe, isTurnkeyWallet ? (jsxRuntime.jsx("div", { id: constants.iframeContainerId, style: { display: data ? 'block' : 'none' }, ref: iframeContainerRef })) : null, hasInjectedCredential ? (jsxRuntime.jsx(Button.Button, { buttonPadding: 'large', buttonVariant: 'brand-primary', onClick: () => setShowAuthFlow(false), loading: isLoading, copykey: 'dyn_embedded_reveal.done_button_label', typographyProps: {
|
|
170
197
|
color: 'inherit',
|
|
171
198
|
}, children: t('dyn_embedded_reveal.done_button_label') })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__description', children: jsxRuntime.jsx(Badge.Badge, { text: t('dyn_embedded_reveal.badge_label'), className: 'embedded-reveal-view__body__badge' }) }), errorText && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: errorText }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card', children: [jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsxRuntime.jsx(walletV2.ReactComponent, {}) }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_embedded_reveal.statement_1.title', children: t('dyn_embedded_reveal.statement_1.title') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', weight: 'regular', copykey: 'dyn_embedded_reveal.statement_1.description', children: t('dyn_embedded_reveal.statement_1.description') })] })] }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsxRuntime.jsx(eyeOffIcon.ReactComponent, {}) }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_embedded_reveal.statement_2.title', children: t('dyn_embedded_reveal.statement_2.title') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', weight: 'regular', copykey: 'dyn_embedded_reveal.statement_2.description', children: t('dyn_embedded_reveal.statement_2.description', {
|
|
172
199
|
credential_type: credentialTitle === null || credentialTitle === void 0 ? void 0 : credentialTitle.toLowerCase(),
|
|
@@ -3,12 +3,12 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
|
+
import { isCoinbaseMpcWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
6
7
|
import { getProperErrorMessage } from '../../../modals/SignMessageConfirmationModal/getProperErrorMessage.js';
|
|
7
8
|
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
8
9
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
9
10
|
import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
10
11
|
import '@dynamic-labs/iconic';
|
|
11
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
12
12
|
import '../../../context/ViewContext/ViewContext.js';
|
|
13
13
|
import { ReactComponent as SvgClose } from '../../../shared/assets/close.js';
|
|
14
14
|
import { ReactComponent as SvgExportEmbeddedHero } from '../../../shared/assets/export-embedded-hero.js';
|
|
@@ -29,7 +29,7 @@ import '@dynamic-labs/multi-wallet';
|
|
|
29
29
|
import 'react-international-phone';
|
|
30
30
|
import 'viem/chains';
|
|
31
31
|
import { getEOAWallet } from '../../../utils/functions/getEOAWallet/getEOAWallet.js';
|
|
32
|
-
import '../../../config/ApiEndpoint.js';
|
|
32
|
+
import ApiEndpoint from '../../../config/ApiEndpoint.js';
|
|
33
33
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
34
34
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
35
35
|
import '../../../context/VerificationContext/VerificationContext.js';
|
|
@@ -38,6 +38,7 @@ import '../../../context/WalletContext/WalletContext.js';
|
|
|
38
38
|
import { usePromise } from '../../../utils/hooks/usePromise/usePromise.js';
|
|
39
39
|
import '../../../context/ThemeContext/ThemeContext.js';
|
|
40
40
|
import { useMutation } from '../../../utils/hooks/useMutation/useMutation.js';
|
|
41
|
+
import { useIsTurnkeyWallet } from '../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js';
|
|
41
42
|
import '@dynamic-labs/types';
|
|
42
43
|
import 'yup';
|
|
43
44
|
import '../../../context/MockContext/MockContext.js';
|
|
@@ -47,7 +48,7 @@ import '@dynamic-labs/rpc-providers';
|
|
|
47
48
|
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
48
49
|
import 'i18next';
|
|
49
50
|
import { Typography } from '../../../components/Typography/Typography.js';
|
|
50
|
-
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
51
|
+
import { useShadowDOMContext } from '../../../components/ShadowDOM/ShadowDOM.js';
|
|
51
52
|
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
52
53
|
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
53
54
|
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
@@ -87,13 +88,17 @@ import { iframeContainerId, iframeElementId } from '../constants.js';
|
|
|
87
88
|
import '../../LoginView/sections/PhoneNumberSignInSection/usePhoneInputLogic/usePhoneInputLogic.js';
|
|
88
89
|
|
|
89
90
|
const EmbeddedRevealView = ({ exportPrivateKey, }) => {
|
|
90
|
-
var _a, _b;
|
|
91
|
+
var _a, _b, _c;
|
|
91
92
|
const { authToken, primaryWallet, user, setShowAuthFlow, environmentId } = useInternalDynamicContext();
|
|
93
|
+
const { isTurnkeyWallet } = useIsTurnkeyWallet();
|
|
94
|
+
const { shadowRoot } = useShadowDOMContext();
|
|
92
95
|
const [acknowledgement1, setAcknowledgement1] = useState(false);
|
|
96
|
+
const [hasRevealedCoinbaseMpcKey, setHasRevealedCoinbaseMpcKey] = useState(false);
|
|
93
97
|
const iframeContainerRef = useRef(null);
|
|
94
98
|
const decodedJwt = decodeJwt(authToken);
|
|
95
99
|
const walletProperties = (_b = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
|
|
96
100
|
const isTurnkeyHDWallet = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyHDWalletId;
|
|
101
|
+
const isCoinbaseMpcWallet = primaryWallet && isCoinbaseMpcWalletConnector(primaryWallet.connector);
|
|
97
102
|
const wallet = getEOAWallet(primaryWallet, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
98
103
|
// eslint-disable-next-line arrow-body-style
|
|
99
104
|
useEffect(() => {
|
|
@@ -120,18 +125,35 @@ const EmbeddedRevealView = ({ exportPrivateKey, }) => {
|
|
|
120
125
|
});
|
|
121
126
|
const { mutate: handleExportWallet, isLoading, error, data, } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
122
127
|
const wallet = getEOAWallet(primaryWallet, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
if (isCoinbaseMpcWallet) {
|
|
129
|
+
return primaryWallet.connector.exportWalletKeys();
|
|
130
|
+
}
|
|
131
|
+
if (isTurnkeyWallet) {
|
|
132
|
+
return exportCredential({
|
|
133
|
+
address: exportPrivateKey ? wallet === null || wallet === void 0 ? void 0 : wallet.address : undefined,
|
|
134
|
+
authToken,
|
|
135
|
+
environmentId,
|
|
136
|
+
userEmail: user === null || user === void 0 ? void 0 : user.email,
|
|
137
|
+
wallet,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return undefined;
|
|
130
141
|
}), {
|
|
131
142
|
onFailure: (err) => {
|
|
132
143
|
logger.error('Failed to export', err);
|
|
133
144
|
dynamicEvents.emit('embeddedWalletRevealFailed', err);
|
|
134
145
|
},
|
|
146
|
+
onSuccess: (data) => {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
if (isCoinbaseMpcWallet && data && (data === null || data === void 0 ? void 0 : data.length)) {
|
|
149
|
+
const iframe = shadowRoot === null || shadowRoot === void 0 ? void 0 : shadowRoot.getElementById('coinbase-waas-key-export');
|
|
150
|
+
(_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
151
|
+
key: (_b = data[0]) === null || _b === void 0 ? void 0 : _b.ecKeyPrivate,
|
|
152
|
+
type: 'export_key',
|
|
153
|
+
}, '*');
|
|
154
|
+
setHasRevealedCoinbaseMpcKey(true);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
135
157
|
});
|
|
136
158
|
const errorText = useMemo(() => {
|
|
137
159
|
if (!error) {
|
|
@@ -154,7 +176,7 @@ const EmbeddedRevealView = ({ exportPrivateKey, }) => {
|
|
|
154
176
|
: 'height: 100px');
|
|
155
177
|
}
|
|
156
178
|
}, [iframeContainerRef, data, isTurnkeyHDWallet, exportPrivateKey]);
|
|
157
|
-
const closeButton = (jsx(IconButton, { onClick: () => setShowAuthFlow(false
|
|
179
|
+
const closeButton = (jsx(IconButton, { onClick: () => setShowAuthFlow(false), type: 'button', children: jsx(SvgClose, {}) }));
|
|
158
180
|
const hasInjectedCredential = !isLoading && data && !error;
|
|
159
181
|
const credentialTitle = !isTurnkeyHDWallet || exportPrivateKey
|
|
160
182
|
? t('dyn_embedded_reveal.private_key_title')
|
|
@@ -162,7 +184,12 @@ const EmbeddedRevealView = ({ exportPrivateKey, }) => {
|
|
|
162
184
|
const title = hasInjectedCredential
|
|
163
185
|
? credentialTitle
|
|
164
186
|
: t('dyn_embedded_reveal.agreement_title');
|
|
165
|
-
|
|
187
|
+
// this element needs to be on the DOM before the reveal occurs
|
|
188
|
+
// so we can inject the key into it once it's fetched from coinbase.
|
|
189
|
+
const coinbaseWaasKeyExportIframe = (jsx("iframe", { src: (_c = ApiEndpoint === null || ApiEndpoint === void 0 ? void 0 : ApiEndpoint.getBaseUrl()) === null || _c === void 0 ? void 0 : _c.replace('api/v0', 'coinbase-waas-key-export.html'), id: 'coinbase-waas-key-export', title: 'Coinbase WaaS key export', height: hasRevealedCoinbaseMpcKey ? '100%' : 0, width: hasRevealedCoinbaseMpcKey ? '100%' : 0, style: {
|
|
190
|
+
borderRadius: '0.75rem',
|
|
191
|
+
}, allow: 'clipboard-write' }));
|
|
192
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, children: jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', children: title }) }), jsx("div", { className: 'embedded-reveal-view', children: jsxs("div", { className: 'embedded-reveal-view__body', children: [contentHeader, isCoinbaseMpcWallet && coinbaseWaasKeyExportIframe, isTurnkeyWallet ? (jsx("div", { id: iframeContainerId, style: { display: data ? 'block' : 'none' }, ref: iframeContainerRef })) : null, hasInjectedCredential ? (jsx(Button, { buttonPadding: 'large', buttonVariant: 'brand-primary', onClick: () => setShowAuthFlow(false), loading: isLoading, copykey: 'dyn_embedded_reveal.done_button_label', typographyProps: {
|
|
166
193
|
color: 'inherit',
|
|
167
194
|
}, children: t('dyn_embedded_reveal.done_button_label') })) : (jsxs(Fragment, { children: [jsx("div", { className: 'embedded-reveal-view__body__description', children: jsx(Badge, { text: t('dyn_embedded_reveal.badge_label'), className: 'embedded-reveal-view__body__badge' }) }), errorText && jsx(ErrorContainer, { children: errorText }), jsxs("div", { className: 'embedded-reveal-view__body__card', children: [jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsx(SvgWalletV2, {}) }), jsxs("div", { children: [jsx(Typography, { variant: 'body_normal', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_embedded_reveal.statement_1.title', children: t('dyn_embedded_reveal.statement_1.title') }), jsx(Typography, { variant: 'body_small', color: 'secondary', weight: 'regular', copykey: 'dyn_embedded_reveal.statement_1.description', children: t('dyn_embedded_reveal.statement_1.description') })] })] }), jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsx(SvgEyeOffIcon, {}) }), jsxs("div", { children: [jsx(Typography, { variant: 'body_normal', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_embedded_reveal.statement_2.title', children: t('dyn_embedded_reveal.statement_2.title') }), jsx(Typography, { variant: 'body_small', color: 'secondary', weight: 'regular', copykey: 'dyn_embedded_reveal.statement_2.description', children: t('dyn_embedded_reveal.statement_2.description', {
|
|
168
195
|
credential_type: credentialTitle === null || credentialTitle === void 0 ? void 0 : credentialTitle.toLowerCase(),
|
|
@@ -15,7 +15,7 @@ export declare const exportCredential: ({ authToken, userEmail, wallet, environm
|
|
|
15
15
|
wallet: Wallet | null;
|
|
16
16
|
environmentId: string;
|
|
17
17
|
address?: string | undefined;
|
|
18
|
-
}) => Promise<
|
|
18
|
+
}) => Promise<boolean>;
|
|
19
19
|
export declare const cleanupExport: ({ wallet }: {
|
|
20
20
|
wallet: Wallet | null;
|
|
21
21
|
}) => Promise<void>;
|
|
@@ -95,10 +95,17 @@ const EnterPasswordView = ({ mutation, onSuccess, onError, closeView = true, })
|
|
|
95
95
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(password);
|
|
96
96
|
},
|
|
97
97
|
});
|
|
98
|
+
const onClose = () => {
|
|
99
|
+
if (onError) {
|
|
100
|
+
onError === null || onError === void 0 ? void 0 : onError(t('dyn_enter_password.error.invalid_password'));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
setShowAuthFlow(false);
|
|
104
|
+
};
|
|
98
105
|
const errorMessage = hasError
|
|
99
106
|
? t('dyn_enter_password.error.invalid_password')
|
|
100
107
|
: undefined;
|
|
101
|
-
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { onClick:
|
|
108
|
+
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { onClick: onClose, type: 'button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
102
109
|
const inputSuffix = (jsxRuntime.jsx(ToggleVisibilityButton.ToggleVisibilityButton, { initialState: inputType === 'password', onClick: (hidden) => setInputType(hidden ? 'password' : 'text'), className: 'enter-password-view__password-input__suffix-icon' }));
|
|
103
110
|
const onPasswordInputChange = (e) => {
|
|
104
111
|
const newPassword = e.target.value;
|
|
@@ -91,10 +91,17 @@ const EnterPasswordView = ({ mutation, onSuccess, onError, closeView = true, })
|
|
|
91
91
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(password);
|
|
92
92
|
},
|
|
93
93
|
});
|
|
94
|
+
const onClose = () => {
|
|
95
|
+
if (onError) {
|
|
96
|
+
onError === null || onError === void 0 ? void 0 : onError(t('dyn_enter_password.error.invalid_password'));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
setShowAuthFlow(false);
|
|
100
|
+
};
|
|
94
101
|
const errorMessage = hasError
|
|
95
102
|
? t('dyn_enter_password.error.invalid_password')
|
|
96
103
|
: undefined;
|
|
97
|
-
const closeButton = (jsx(IconButton, { onClick:
|
|
104
|
+
const closeButton = (jsx(IconButton, { onClick: onClose, type: 'button', children: jsx(SvgClose, {}) }));
|
|
98
105
|
const inputSuffix = (jsx(ToggleVisibilityButton, { initialState: inputType === 'password', onClick: (hidden) => setInputType(hidden ? 'password' : 'text'), className: 'enter-password-view__password-input__suffix-icon' }));
|
|
99
106
|
const onPasswordInputChange = (e) => {
|
|
100
107
|
const newPassword = e.target.value;
|
|
@@ -65,6 +65,7 @@ require('../../../../../widgets/DynamicBridgeWidget/views/WalletsView/components
|
|
|
65
65
|
require('i18next');
|
|
66
66
|
require('@hcaptcha/react-hcaptcha');
|
|
67
67
|
require('../../../../../context/LoadingContext/LoadingContext.cjs');
|
|
68
|
+
require('../../../../../config/ApiEndpoint.cjs');
|
|
68
69
|
require('../../../../../context/FooterAnimationContext/index.cjs');
|
|
69
70
|
require('../../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
70
71
|
require('../../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
@@ -61,6 +61,7 @@ import '../../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/
|
|
|
61
61
|
import 'i18next';
|
|
62
62
|
import '@hcaptcha/react-hcaptcha';
|
|
63
63
|
import '../../../../../context/LoadingContext/LoadingContext.js';
|
|
64
|
+
import '../../../../../config/ApiEndpoint.js';
|
|
64
65
|
import '../../../../../context/FooterAnimationContext/index.js';
|
|
65
66
|
import '../../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
66
67
|
import '../../../../../context/PasskeyContext/PasskeyContext.js';
|
|
@@ -86,6 +86,7 @@ const useLoginView = () => {
|
|
|
86
86
|
const { enabledSocialProviders } = SocialRedirectContext.useSocialRedirectContext();
|
|
87
87
|
const hasSocialProvidersEnabled = Boolean(enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length);
|
|
88
88
|
const hasEmailProviderEnabled = isEmailProviderEnabled.isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
89
|
+
const hasPhoneProviderEnabled = isPhoneNumberProviderEnabled.isPhoneNumberProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
89
90
|
/** Takes from wallets only those that can be selected in the wallet list by the user.
|
|
90
91
|
* Should filter out embedded wallets
|
|
91
92
|
* WHY: when we decide whether to show wallets or not, we need to know how many wallets
|
|
@@ -100,13 +101,17 @@ const useLoginView = () => {
|
|
|
100
101
|
if (!projectSettings) {
|
|
101
102
|
return false;
|
|
102
103
|
}
|
|
103
|
-
//
|
|
104
|
-
if (!loginWithEmail &&
|
|
104
|
+
// When no other methods are enabled we can safely assume it's wallet only
|
|
105
|
+
if (!loginWithEmail &&
|
|
106
|
+
!hasPhoneProviderEnabled &&
|
|
107
|
+
!hasSocialProvidersEnabled) {
|
|
105
108
|
return true;
|
|
106
109
|
}
|
|
107
110
|
// backwards compatibility for those that didn't set up login view sections
|
|
108
111
|
if (!((_a = loginView === null || loginView === void 0 ? void 0 : loginView.sections) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
109
|
-
return !hasEmailProviderEnabled &&
|
|
112
|
+
return (!hasEmailProviderEnabled &&
|
|
113
|
+
!hasPhoneProviderEnabled &&
|
|
114
|
+
!hasSocialProvidersEnabled);
|
|
110
115
|
}
|
|
111
116
|
return (loginView.sections.length === 1 && loginView.sections[0].type === 'wallet');
|
|
112
117
|
}, [
|
|
@@ -114,6 +119,7 @@ const useLoginView = () => {
|
|
|
114
119
|
projectSettings,
|
|
115
120
|
loginWithEmail,
|
|
116
121
|
hasSocialProvidersEnabled,
|
|
122
|
+
hasPhoneProviderEnabled,
|
|
117
123
|
hasEmailProviderEnabled,
|
|
118
124
|
]);
|
|
119
125
|
// TODO: https://linear.app/dynamic-labs/issue/GVTY-212/rethink-or-implement-toolkit-template-for-email-wallet-order
|
|
@@ -154,7 +160,7 @@ const useLoginView = () => {
|
|
|
154
160
|
? 0
|
|
155
161
|
: NUMBER_OF_WALLETS,
|
|
156
162
|
showEmail: hasEmailProviderEnabled,
|
|
157
|
-
showPhone:
|
|
163
|
+
showPhone: hasPhoneProviderEnabled,
|
|
158
164
|
showSocial: Boolean(enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length),
|
|
159
165
|
// is email only is set in the project settings when the "Email (Web2) only" is toggled on in the dashboard
|
|
160
166
|
showWallets: Boolean(selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length) &&
|
|
@@ -185,9 +191,9 @@ const useLoginView = () => {
|
|
|
185
191
|
enabledSocialProviders,
|
|
186
192
|
filterLoginViewSections,
|
|
187
193
|
hasEmailProviderEnabled,
|
|
194
|
+
hasPhoneProviderEnabled,
|
|
188
195
|
loginView === null || loginView === void 0 ? void 0 : loginView.sections,
|
|
189
196
|
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal,
|
|
190
|
-
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers,
|
|
191
197
|
selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length,
|
|
192
198
|
t,
|
|
193
199
|
]);
|
|
@@ -82,6 +82,7 @@ const useLoginView = () => {
|
|
|
82
82
|
const { enabledSocialProviders } = useSocialRedirectContext();
|
|
83
83
|
const hasSocialProvidersEnabled = Boolean(enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length);
|
|
84
84
|
const hasEmailProviderEnabled = isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
85
|
+
const hasPhoneProviderEnabled = isPhoneNumberProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
85
86
|
/** Takes from wallets only those that can be selected in the wallet list by the user.
|
|
86
87
|
* Should filter out embedded wallets
|
|
87
88
|
* WHY: when we decide whether to show wallets or not, we need to know how many wallets
|
|
@@ -96,13 +97,17 @@ const useLoginView = () => {
|
|
|
96
97
|
if (!projectSettings) {
|
|
97
98
|
return false;
|
|
98
99
|
}
|
|
99
|
-
//
|
|
100
|
-
if (!loginWithEmail &&
|
|
100
|
+
// When no other methods are enabled we can safely assume it's wallet only
|
|
101
|
+
if (!loginWithEmail &&
|
|
102
|
+
!hasPhoneProviderEnabled &&
|
|
103
|
+
!hasSocialProvidersEnabled) {
|
|
101
104
|
return true;
|
|
102
105
|
}
|
|
103
106
|
// backwards compatibility for those that didn't set up login view sections
|
|
104
107
|
if (!((_a = loginView === null || loginView === void 0 ? void 0 : loginView.sections) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
105
|
-
return !hasEmailProviderEnabled &&
|
|
108
|
+
return (!hasEmailProviderEnabled &&
|
|
109
|
+
!hasPhoneProviderEnabled &&
|
|
110
|
+
!hasSocialProvidersEnabled);
|
|
106
111
|
}
|
|
107
112
|
return (loginView.sections.length === 1 && loginView.sections[0].type === 'wallet');
|
|
108
113
|
}, [
|
|
@@ -110,6 +115,7 @@ const useLoginView = () => {
|
|
|
110
115
|
projectSettings,
|
|
111
116
|
loginWithEmail,
|
|
112
117
|
hasSocialProvidersEnabled,
|
|
118
|
+
hasPhoneProviderEnabled,
|
|
113
119
|
hasEmailProviderEnabled,
|
|
114
120
|
]);
|
|
115
121
|
// TODO: https://linear.app/dynamic-labs/issue/GVTY-212/rethink-or-implement-toolkit-template-for-email-wallet-order
|
|
@@ -150,7 +156,7 @@ const useLoginView = () => {
|
|
|
150
156
|
? 0
|
|
151
157
|
: NUMBER_OF_WALLETS,
|
|
152
158
|
showEmail: hasEmailProviderEnabled,
|
|
153
|
-
showPhone:
|
|
159
|
+
showPhone: hasPhoneProviderEnabled,
|
|
154
160
|
showSocial: Boolean(enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length),
|
|
155
161
|
// is email only is set in the project settings when the "Email (Web2) only" is toggled on in the dashboard
|
|
156
162
|
showWallets: Boolean(selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length) &&
|
|
@@ -181,9 +187,9 @@ const useLoginView = () => {
|
|
|
181
187
|
enabledSocialProviders,
|
|
182
188
|
filterLoginViewSections,
|
|
183
189
|
hasEmailProviderEnabled,
|
|
190
|
+
hasPhoneProviderEnabled,
|
|
184
191
|
loginView === null || loginView === void 0 ? void 0 : loginView.sections,
|
|
185
192
|
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal,
|
|
186
|
-
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers,
|
|
187
193
|
selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length,
|
|
188
194
|
t,
|
|
189
195
|
]);
|
|
@@ -80,6 +80,7 @@ require('../WalletList/WalletList.cjs');
|
|
|
80
80
|
require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
81
81
|
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
82
82
|
require('@hcaptcha/react-hcaptcha');
|
|
83
|
+
require('../../config/ApiEndpoint.cjs');
|
|
83
84
|
require('../LoginView/sections/PhoneNumberSignInSection/usePhoneInputLogic/usePhoneInputLogic.cjs');
|
|
84
85
|
|
|
85
86
|
const MergeUserAccountsView = () => {
|
|
@@ -76,6 +76,7 @@ import '../WalletList/WalletList.js';
|
|
|
76
76
|
import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
77
77
|
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
78
78
|
import '@hcaptcha/react-hcaptcha';
|
|
79
|
+
import '../../config/ApiEndpoint.js';
|
|
79
80
|
import '../LoginView/sections/PhoneNumberSignInSection/usePhoneInputLogic/usePhoneInputLogic.js';
|
|
80
81
|
|
|
81
82
|
const MergeUserAccountsView = () => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { EmbeddedWalletCurrentAction } from '../../../shared';
|
|
3
|
-
|
|
3
|
+
export type EmbeddedAuthChoiceProps = {
|
|
4
4
|
currentAction?: EmbeddedWalletCurrentAction;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
6
|
export declare const EmbeddedAuthChoice: FC<EmbeddedAuthChoiceProps>;
|
|
7
|
-
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { AuthenticatorType } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { EmbeddedWalletCurrentAction } from '../../../../shared';
|
|
4
|
-
|
|
4
|
+
export type PasskeyBundleValidationProps = {
|
|
5
5
|
authenticatorType: AuthenticatorType;
|
|
6
6
|
currentAction?: EmbeddedWalletCurrentAction;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare const PasskeyBundleRecovery: FC<PasskeyBundleValidationProps>;
|
|
9
|
-
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { AuthenticatorType } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
-
|
|
3
|
+
export type PasskeyInitRecoveryProps = {
|
|
4
4
|
authenticatorType: AuthenticatorType;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
6
|
export declare const PasskeyInitRecovery: FC<PasskeyInitRecoveryProps>;
|
|
7
|
-
export {};
|
|
@@ -77,6 +77,7 @@ require('../../WalletList/WalletList.cjs');
|
|
|
77
77
|
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
78
78
|
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
79
79
|
require('@hcaptcha/react-hcaptcha');
|
|
80
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
80
81
|
require('../../LoginView/sections/PhoneNumberSignInSection/usePhoneInputLogic/usePhoneInputLogic.cjs');
|
|
81
82
|
|
|
82
83
|
const RenamePasskeyView = () => {
|
|
@@ -73,6 +73,7 @@ import '../../WalletList/WalletList.js';
|
|
|
73
73
|
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
74
74
|
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
75
75
|
import '@hcaptcha/react-hcaptcha';
|
|
76
|
+
import '../../../config/ApiEndpoint.js';
|
|
76
77
|
import '../../LoginView/sections/PhoneNumberSignInSection/usePhoneInputLogic/usePhoneInputLogic.js';
|
|
77
78
|
|
|
78
79
|
const RenamePasskeyView = () => {
|