@dynamic-labs/sdk-react-core 4.103.0 → 4.104.0
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 +16 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +14 -14
- package/src/lib/components/NeedHelpSection/NeedHelpSection.cjs +3 -4
- package/src/lib/components/NeedHelpSection/NeedHelpSection.d.ts +4 -1
- package/src/lib/components/NeedHelpSection/NeedHelpSection.js +3 -4
- package/src/lib/shared/types/embeddedWallets.d.ts +2 -0
- package/src/lib/store/utils/settingsUtils/settingsUtils.cjs +21 -2
- package/src/lib/store/utils/settingsUtils/settingsUtils.js +21 -2
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +10 -6
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +10 -6
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.cjs +28 -7
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.d.ts +1 -0
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.js +30 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.104.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.103.0...v4.104.0) (2026-11-03)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **sdk-react-core:** offer passkey recovery when export fails in upgrade flow [v4] ([#12641](https://github.com/dynamic-labs/dynamic-auth/issues/12641)) ([916829f](https://github.com/dynamic-labs/dynamic-auth/commit/916829f1eaf9f6cae7d8c0b5069512fceafa15a4))
|
|
8
|
+
* **webview:** forward policiesConsentLabels manifest field to SDK settings [v4] ([#12608](https://github.com/dynamic-labs/dynamic-auth/issues/12608)) ([b9ef167](https://github.com/dynamic-labs/dynamic-auth/commit/b9ef1676576eea8452c7149308492aea578b6c91))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **iconic:** add Zerion wallet icon [v4] ([#12651](https://github.com/dynamic-labs/dynamic-auth/issues/12651)) ([f5257ee](https://github.com/dynamic-labs/dynamic-auth/commit/f5257ee28fc7e8d46657957f59c13503e7eccce8))
|
|
14
|
+
* **react-native:** serialize WalletConnect native storage values as JSON strings ([#12682](https://github.com/dynamic-labs/dynamic-auth/issues/12682)) ([df2795a](https://github.com/dynamic-labs/dynamic-auth/commit/df2795aa432a94e429859082468b89705226dc70))
|
|
15
|
+
* **sdk-react-core:** default wallet return redirectUrl to current page [v4] ([#12660](https://github.com/dynamic-labs/dynamic-auth/issues/12660)) ([29b8f38](https://github.com/dynamic-labs/dynamic-auth/commit/29b8f380858ef65c52187aeb50123a287eb7b4ec))
|
|
16
|
+
* **waas-svm:** keep the blockhash of a transaction another key already signed ([#12678](https://github.com/dynamic-labs/dynamic-auth/issues/12678)) ([549553c](https://github.com/dynamic-labs/dynamic-auth/commit/549553c1275b3cc3995e183966a32a5f6ae63534)), closes [#12676](https://github.com/dynamic-labs/dynamic-auth/issues/12676)
|
|
17
|
+
|
|
2
18
|
## [4.103.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.102.0...v4.103.0) (2026-10-27)
|
|
3
19
|
|
|
4
20
|
|
package/package.cjs
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "4.
|
|
6
|
+
var version = "4.104.0";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.
|
|
9
|
-
"@dynamic-labs-sdk/client": "1.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.142.0",
|
|
9
|
+
"@dynamic-labs-sdk/client": "1.48.0",
|
|
10
10
|
"@dynamic-labs-wallet/browser-wallet-client": "1.1.43",
|
|
11
11
|
"@dynamic-labs-wallet/forward-mpc-client": "2.0.2",
|
|
12
12
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
package/package.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "4.
|
|
2
|
+
var version = "4.104.0";
|
|
3
3
|
var dependencies = {
|
|
4
|
-
"@dynamic-labs/sdk-api-core": "0.
|
|
5
|
-
"@dynamic-labs-sdk/client": "1.
|
|
4
|
+
"@dynamic-labs/sdk-api-core": "0.142.0",
|
|
5
|
+
"@dynamic-labs-sdk/client": "1.48.0",
|
|
6
6
|
"@dynamic-labs-wallet/browser-wallet-client": "1.1.43",
|
|
7
7
|
"@dynamic-labs-wallet/forward-mpc-client": "2.0.2",
|
|
8
8
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.104.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@dynamic-labs/sdk-api-core": "0.
|
|
6
|
-
"@dynamic-labs-sdk/client": "1.
|
|
5
|
+
"@dynamic-labs/sdk-api-core": "0.142.0",
|
|
6
|
+
"@dynamic-labs-sdk/client": "1.48.0",
|
|
7
7
|
"@dynamic-labs-wallet/browser-wallet-client": "1.1.43",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "2.0.2",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
"react-i18next": "13.5.0",
|
|
19
19
|
"react-international-phone": "4.5.0",
|
|
20
20
|
"yup": "0.32.11",
|
|
21
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
22
|
-
"@dynamic-labs/iconic": "4.
|
|
23
|
-
"@dynamic-labs/locale": "4.
|
|
24
|
-
"@dynamic-labs/logger": "4.
|
|
25
|
-
"@dynamic-labs/multi-wallet": "4.
|
|
26
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
27
|
-
"@dynamic-labs/store": "4.
|
|
28
|
-
"@dynamic-labs/types": "4.
|
|
29
|
-
"@dynamic-labs/utils": "4.
|
|
30
|
-
"@dynamic-labs/wallet-book": "4.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
21
|
+
"@dynamic-labs/assert-package-version": "4.104.0",
|
|
22
|
+
"@dynamic-labs/iconic": "4.104.0",
|
|
23
|
+
"@dynamic-labs/locale": "4.104.0",
|
|
24
|
+
"@dynamic-labs/logger": "4.104.0",
|
|
25
|
+
"@dynamic-labs/multi-wallet": "4.104.0",
|
|
26
|
+
"@dynamic-labs/rpc-providers": "4.104.0",
|
|
27
|
+
"@dynamic-labs/store": "4.104.0",
|
|
28
|
+
"@dynamic-labs/types": "4.104.0",
|
|
29
|
+
"@dynamic-labs/utils": "4.104.0",
|
|
30
|
+
"@dynamic-labs/wallet-book": "4.104.0",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "4.104.0",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -15,7 +15,7 @@ var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
|
|
|
15
15
|
require('../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
|
|
16
16
|
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
17
17
|
|
|
18
|
-
const NeedHelpSection = ({ isRecoveryFlow = false, isExport = false, walletCredential, }) => {
|
|
18
|
+
const NeedHelpSection = ({ isRecoveryFlow = false, isExport = false, walletCredential, goBack, wallet, }) => {
|
|
19
19
|
var _a, _b, _c, _d, _e, _f;
|
|
20
20
|
const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
21
21
|
const { t } = reactI18next.useTranslation();
|
|
@@ -36,9 +36,8 @@ const NeedHelpSection = ({ isRecoveryFlow = false, isExport = false, walletCrede
|
|
|
36
36
|
return (jsxRuntime.jsx(TextButton.TextButton, { copykey: 'dyn_need_help_section.help_button', className: classNames.classNames('need-help-section__helper-link'), onClick: () => initPasskeyRecoveryProcess(undefined, {
|
|
37
37
|
settings: isExport
|
|
38
38
|
? {
|
|
39
|
-
goBack: () =>
|
|
40
|
-
|
|
41
|
-
},
|
|
39
|
+
goBack: goBack !== null && goBack !== void 0 ? goBack : (() => pushView('embedded-reveal-view')),
|
|
40
|
+
wallet,
|
|
42
41
|
}
|
|
43
42
|
: undefined,
|
|
44
43
|
type: 'helpSession',
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
|
|
3
|
+
import { Wallet, WalletConnectorCore } from '@dynamic-labs/wallet-connector-core';
|
|
3
4
|
type Props = {
|
|
4
5
|
isRecoveryFlow?: boolean;
|
|
5
6
|
isExport?: boolean;
|
|
6
7
|
walletCredential?: JwtVerifiedCredential;
|
|
8
|
+
goBack?: () => void;
|
|
9
|
+
wallet?: Wallet<WalletConnectorCore.WalletConnector>;
|
|
7
10
|
};
|
|
8
|
-
export declare const NeedHelpSection: ({ isRecoveryFlow, isExport, walletCredential, }: Props) => JSX.Element | null;
|
|
11
|
+
export declare const NeedHelpSection: ({ isRecoveryFlow, isExport, walletCredential, goBack, wallet, }: Props) => JSX.Element | null;
|
|
9
12
|
export {};
|
|
@@ -11,7 +11,7 @@ import { useViewContext } from '../../context/ViewContext/ViewContext.js';
|
|
|
11
11
|
import '../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
|
|
12
12
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
13
13
|
|
|
14
|
-
const NeedHelpSection = ({ isRecoveryFlow = false, isExport = false, walletCredential, }) => {
|
|
14
|
+
const NeedHelpSection = ({ isRecoveryFlow = false, isExport = false, walletCredential, goBack, wallet, }) => {
|
|
15
15
|
var _a, _b, _c, _d, _e, _f;
|
|
16
16
|
const { projectSettings } = useInternalDynamicContext();
|
|
17
17
|
const { t } = useTranslation();
|
|
@@ -32,9 +32,8 @@ const NeedHelpSection = ({ isRecoveryFlow = false, isExport = false, walletCrede
|
|
|
32
32
|
return (jsx(TextButton, { copykey: 'dyn_need_help_section.help_button', className: classNames('need-help-section__helper-link'), onClick: () => initPasskeyRecoveryProcess(undefined, {
|
|
33
33
|
settings: isExport
|
|
34
34
|
? {
|
|
35
|
-
goBack: () =>
|
|
36
|
-
|
|
37
|
-
},
|
|
35
|
+
goBack: goBack !== null && goBack !== void 0 ? goBack : (() => pushView('embedded-reveal-view')),
|
|
36
|
+
wallet,
|
|
38
37
|
}
|
|
39
38
|
: undefined,
|
|
40
39
|
type: 'helpSession',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
1
2
|
export type EmbeddedWalletSessionSettings = {
|
|
2
3
|
emailCode: string;
|
|
3
4
|
userId: string;
|
|
@@ -5,6 +6,7 @@ export type EmbeddedWalletSessionSettings = {
|
|
|
5
6
|
};
|
|
6
7
|
export type EmbeddedWalletCurrentActionSettings = {
|
|
7
8
|
goBack?: () => void;
|
|
9
|
+
wallet?: Wallet;
|
|
8
10
|
};
|
|
9
11
|
export type EmbeddedWalletCurrentAction = {
|
|
10
12
|
type: 'signMessage' | 'sendTransaction' | 'helpSession' | 'signTransaction' | 'reveal';
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var React = require('react');
|
|
6
7
|
require('@dynamic-labs-sdk/client/core');
|
|
7
8
|
require('@dynamic-labs/sdk-api-core');
|
|
8
|
-
require('react');
|
|
9
9
|
require('eventemitter3');
|
|
10
10
|
require('@dynamic-labs/utils');
|
|
11
11
|
require('@dynamic-labs-sdk/client');
|
|
@@ -16,6 +16,7 @@ require('react/jsx-runtime');
|
|
|
16
16
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
17
17
|
require('../../../shared/logger.cjs');
|
|
18
18
|
require('@dynamic-labs/wallet-book');
|
|
19
|
+
var isSSR = require('../../../shared/utils/functions/isSSR/isSSR.cjs');
|
|
19
20
|
require('../../../utils/constants/colors.cjs');
|
|
20
21
|
require('../../../utils/constants/values.cjs');
|
|
21
22
|
require('../../../shared/consts/index.cjs');
|
|
@@ -39,7 +40,25 @@ const useDynamicSettingsValue = (projectSettingName, dynamicSettingName) => {
|
|
|
39
40
|
return ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general[projectSettingName]) !== null && _a !== void 0 ? _a : dynamicSettings[dynamicSettingName]);
|
|
40
41
|
};
|
|
41
42
|
const useAppName = () => useDynamicSettingsValue('displayName', 'appName');
|
|
42
|
-
|
|
43
|
+
// Mobile wallets that connect via deeplink (e.g. Backpack over WalletConnect)
|
|
44
|
+
// return the user through the redirect metadata/deeplink param built from this
|
|
45
|
+
// value. With no explicit redirectUrl there is nothing to return through, so
|
|
46
|
+
// the wallet falls back to opening the dapp in the system browser. Defaulting
|
|
47
|
+
// to the current page keeps the return inside the dapp. `||` is intentional:
|
|
48
|
+
// an empty redirectUrl is meaningless to wallets and should fall back too. The
|
|
49
|
+
// fallback strips query and fragment so ambient credentials in the URL (e.g.
|
|
50
|
+
// auth tokens) are never handed to the wallet as return metadata. The fallback
|
|
51
|
+
// is captured once via a lazy useState initializer rather than derived on every
|
|
52
|
+
// render: client-side navigation changes the pathname, and redirectUrl feeds
|
|
53
|
+
// the walletConnectorOptions memo — a changing value would rebuild every
|
|
54
|
+
// wallet connector mid-session and drop imperatively-set providers (e.g. the
|
|
55
|
+
// waas password provider).
|
|
56
|
+
const useRedirectUrl = () => {
|
|
57
|
+
const [locationFallback] = React.useState(() => isSSR.isSSR()
|
|
58
|
+
? undefined
|
|
59
|
+
: `${window.location.origin}${window.location.pathname}`);
|
|
60
|
+
return dynamicContextProps.useDynamicSettings().redirectUrl || locationFallback;
|
|
61
|
+
};
|
|
43
62
|
|
|
44
63
|
exports.useAppName = useAppName;
|
|
45
64
|
exports.useRedirectUrl = useRedirectUrl;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import '@dynamic-labs-sdk/client/core';
|
|
3
4
|
import '@dynamic-labs/sdk-api-core';
|
|
4
|
-
import 'react';
|
|
5
5
|
import 'eventemitter3';
|
|
6
6
|
import '@dynamic-labs/utils';
|
|
7
7
|
import '@dynamic-labs-sdk/client';
|
|
@@ -12,6 +12,7 @@ import 'react/jsx-runtime';
|
|
|
12
12
|
import '../../../context/ViewContext/ViewContext.js';
|
|
13
13
|
import '../../../shared/logger.js';
|
|
14
14
|
import '@dynamic-labs/wallet-book';
|
|
15
|
+
import { isSSR } from '../../../shared/utils/functions/isSSR/isSSR.js';
|
|
15
16
|
import '../../../utils/constants/colors.js';
|
|
16
17
|
import '../../../utils/constants/values.js';
|
|
17
18
|
import '../../../shared/consts/index.js';
|
|
@@ -35,6 +36,24 @@ const useDynamicSettingsValue = (projectSettingName, dynamicSettingName) => {
|
|
|
35
36
|
return ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general[projectSettingName]) !== null && _a !== void 0 ? _a : dynamicSettings[dynamicSettingName]);
|
|
36
37
|
};
|
|
37
38
|
const useAppName = () => useDynamicSettingsValue('displayName', 'appName');
|
|
38
|
-
|
|
39
|
+
// Mobile wallets that connect via deeplink (e.g. Backpack over WalletConnect)
|
|
40
|
+
// return the user through the redirect metadata/deeplink param built from this
|
|
41
|
+
// value. With no explicit redirectUrl there is nothing to return through, so
|
|
42
|
+
// the wallet falls back to opening the dapp in the system browser. Defaulting
|
|
43
|
+
// to the current page keeps the return inside the dapp. `||` is intentional:
|
|
44
|
+
// an empty redirectUrl is meaningless to wallets and should fall back too. The
|
|
45
|
+
// fallback strips query and fragment so ambient credentials in the URL (e.g.
|
|
46
|
+
// auth tokens) are never handed to the wallet as return metadata. The fallback
|
|
47
|
+
// is captured once via a lazy useState initializer rather than derived on every
|
|
48
|
+
// render: client-side navigation changes the pathname, and redirectUrl feeds
|
|
49
|
+
// the walletConnectorOptions memo — a changing value would rebuild every
|
|
50
|
+
// wallet connector mid-session and drop imperatively-set providers (e.g. the
|
|
51
|
+
// waas password provider).
|
|
52
|
+
const useRedirectUrl = () => {
|
|
53
|
+
const [locationFallback] = useState(() => isSSR()
|
|
54
|
+
? undefined
|
|
55
|
+
: `${window.location.origin}${window.location.pathname}`);
|
|
56
|
+
return useDynamicSettings().redirectUrl || locationFallback;
|
|
57
|
+
};
|
|
39
58
|
|
|
40
59
|
export { useAppName, useRedirectUrl };
|
|
@@ -99,7 +99,10 @@ const usePasskeyRecovery = () => {
|
|
|
99
99
|
return true;
|
|
100
100
|
}), [wallet, isTurnkeyWalletWithoutAuthenticator, isSessionRestored]);
|
|
101
101
|
const initPasskeyRecoveryProcess = React.useCallback((authenticatorType, currentAction) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
102
|
-
var _f;
|
|
102
|
+
var _f, _g, _h;
|
|
103
|
+
// Recovery can target a non-primary wallet (e.g. a later wallet in the
|
|
104
|
+
// upgrade flow); fall back to the primary wallet.
|
|
105
|
+
const recoveryWallet = (_g = (_f = currentAction === null || currentAction === void 0 ? void 0 : currentAction.settings) === null || _f === void 0 ? void 0 : _f.wallet) !== null && _g !== void 0 ? _g : wallet;
|
|
103
106
|
const validateRecoveryRequest = () => {
|
|
104
107
|
if (!user$1) {
|
|
105
108
|
throw new Error(errors.USER_NOT_LOGGED_IN);
|
|
@@ -110,25 +113,26 @@ const usePasskeyRecovery = () => {
|
|
|
110
113
|
if (!hasEmbeddedWallet.hasEmbeddedWallet(user$1)) {
|
|
111
114
|
throw new Error('Dynamic embedded wallet not found');
|
|
112
115
|
}
|
|
113
|
-
if (
|
|
116
|
+
if (recoveryWallet &&
|
|
117
|
+
!walletConnectorCore.isPasskeyWalletConnector(recoveryWallet.connector)) {
|
|
114
118
|
throw new Error('Dynamic embedded wallet not found.');
|
|
115
119
|
}
|
|
116
120
|
};
|
|
117
121
|
validateRecoveryRequest();
|
|
118
|
-
const turnkeyRecoveryHandler = (
|
|
122
|
+
const turnkeyRecoveryHandler = (recoveryWallet === null || recoveryWallet === void 0 ? void 0 : recoveryWallet.connector).getAuthenticatorHandler();
|
|
119
123
|
// email auth - session is still up, so create passkey authenticator usign the same session
|
|
120
124
|
if (authenticatorType === 'passkey' &&
|
|
121
125
|
turnkeyRecoveryHandler.isSessionActive()) {
|
|
122
126
|
yield passkeyRecovery.addNewPasskeyAuthenticator({
|
|
123
127
|
environmentId,
|
|
124
128
|
user: user$1,
|
|
125
|
-
wallet:
|
|
129
|
+
wallet: recoveryWallet,
|
|
126
130
|
});
|
|
127
131
|
setShowAuthFlow(false);
|
|
128
132
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
129
|
-
return
|
|
133
|
+
return recoveryWallet;
|
|
130
134
|
}
|
|
131
|
-
const supportedAuthenticators = getEnabledEmbeddedWalletsAuthenticators.getEnabledEmbeddedWalletsAuthenticators((
|
|
135
|
+
const supportedAuthenticators = getEnabledEmbeddedWalletsAuthenticators.getEnabledEmbeddedWalletsAuthenticators((_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _h === void 0 ? void 0 : _h.supportedSecurityMethods);
|
|
132
136
|
const supportedAuthenticatorMethods = supportedAuthenticators
|
|
133
137
|
? Object.keys(supportedAuthenticators)
|
|
134
138
|
: [];
|
|
@@ -95,7 +95,10 @@ const usePasskeyRecovery = () => {
|
|
|
95
95
|
return true;
|
|
96
96
|
}), [wallet, isTurnkeyWalletWithoutAuthenticator, isSessionRestored]);
|
|
97
97
|
const initPasskeyRecoveryProcess = useCallback((authenticatorType, currentAction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
-
var _f;
|
|
98
|
+
var _f, _g, _h;
|
|
99
|
+
// Recovery can target a non-primary wallet (e.g. a later wallet in the
|
|
100
|
+
// upgrade flow); fall back to the primary wallet.
|
|
101
|
+
const recoveryWallet = (_g = (_f = currentAction === null || currentAction === void 0 ? void 0 : currentAction.settings) === null || _f === void 0 ? void 0 : _f.wallet) !== null && _g !== void 0 ? _g : wallet;
|
|
99
102
|
const validateRecoveryRequest = () => {
|
|
100
103
|
if (!user) {
|
|
101
104
|
throw new Error(USER_NOT_LOGGED_IN);
|
|
@@ -106,25 +109,26 @@ const usePasskeyRecovery = () => {
|
|
|
106
109
|
if (!hasEmbeddedWallet(user)) {
|
|
107
110
|
throw new Error('Dynamic embedded wallet not found');
|
|
108
111
|
}
|
|
109
|
-
if (
|
|
112
|
+
if (recoveryWallet &&
|
|
113
|
+
!isPasskeyWalletConnector(recoveryWallet.connector)) {
|
|
110
114
|
throw new Error('Dynamic embedded wallet not found.');
|
|
111
115
|
}
|
|
112
116
|
};
|
|
113
117
|
validateRecoveryRequest();
|
|
114
|
-
const turnkeyRecoveryHandler = (
|
|
118
|
+
const turnkeyRecoveryHandler = (recoveryWallet === null || recoveryWallet === void 0 ? void 0 : recoveryWallet.connector).getAuthenticatorHandler();
|
|
115
119
|
// email auth - session is still up, so create passkey authenticator usign the same session
|
|
116
120
|
if (authenticatorType === 'passkey' &&
|
|
117
121
|
turnkeyRecoveryHandler.isSessionActive()) {
|
|
118
122
|
yield addNewPasskeyAuthenticator({
|
|
119
123
|
environmentId,
|
|
120
124
|
user,
|
|
121
|
-
wallet:
|
|
125
|
+
wallet: recoveryWallet,
|
|
122
126
|
});
|
|
123
127
|
setShowAuthFlow(false);
|
|
124
128
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
125
|
-
return
|
|
129
|
+
return recoveryWallet;
|
|
126
130
|
}
|
|
127
|
-
const supportedAuthenticators = getEnabledEmbeddedWalletsAuthenticators((
|
|
131
|
+
const supportedAuthenticators = getEnabledEmbeddedWalletsAuthenticators((_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _h === void 0 ? void 0 : _h.supportedSecurityMethods);
|
|
128
132
|
const supportedAuthenticatorMethods = supportedAuthenticators
|
|
129
133
|
? Object.keys(supportedAuthenticators)
|
|
130
134
|
: [];
|
|
@@ -78,6 +78,7 @@ var ErrorContainer = require('../../components/ErrorContainer/ErrorContainer.cjs
|
|
|
78
78
|
require('../../components/IconButton/IconButton.cjs');
|
|
79
79
|
var ModalHeader = require('../../components/ModalHeader/ModalHeader.cjs');
|
|
80
80
|
var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
|
|
81
|
+
var getProperErrorMessage = require('../../modals/SignMessageConfirmationModal/getProperErrorMessage.cjs');
|
|
81
82
|
var useDynamicWaas = require('../../utils/hooks/useDynamicWaas/useDynamicWaas.cjs');
|
|
82
83
|
var useRefreshAuth = require('../../utils/hooks/useRefreshAuth/useRefreshAuth.cjs');
|
|
83
84
|
require('../../utils/hooks/useWalletDelegation/DelegationError.cjs');
|
|
@@ -104,6 +105,7 @@ require('../../widgets/DynamicWidget/views/ManagePasskeysMfaWidgetView/ManagePas
|
|
|
104
105
|
require('../../widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpMfaWidgetView.cjs');
|
|
105
106
|
require('../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
106
107
|
var Textarea = require('../../components/Textarea/Textarea.cjs');
|
|
108
|
+
var NeedHelpSection = require('../../components/NeedHelpSection/NeedHelpSection.cjs');
|
|
107
109
|
require('@hcaptcha/react-hcaptcha');
|
|
108
110
|
require('@marsidev/react-turnstile');
|
|
109
111
|
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
@@ -124,19 +126,20 @@ require('../../components/IsBrowser/IsBrowser.cjs');
|
|
|
124
126
|
require('../../components/Popper/Popper/Popper.cjs');
|
|
125
127
|
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
126
128
|
|
|
127
|
-
const WalletUpgradeFlowView = ({ wallets, method, onComplete, onCancel, }) => {
|
|
128
|
-
var _a;
|
|
129
|
+
const WalletUpgradeFlowView = ({ wallets, method, startIndex = 0, onComplete, onCancel, }) => {
|
|
130
|
+
var _a, _b;
|
|
129
131
|
const { setShowAuthFlow, user, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
130
132
|
const { upgradeToDynamicWaas } = useDynamicWaas.useDynamicWaas();
|
|
131
133
|
const { t } = reactI18next.useTranslation();
|
|
132
134
|
const { pushView } = ViewContext.useViewContext();
|
|
133
|
-
const [currentWalletIndex, setCurrentWalletIndex] = React.useState(
|
|
135
|
+
const [currentWalletIndex, setCurrentWalletIndex] = React.useState(startIndex);
|
|
134
136
|
const [privateKeyInput, setPrivateKeyInput] = React.useState('');
|
|
135
137
|
const [iframeContainerRef, setIframeContainerRef] = React.useState(null);
|
|
136
138
|
const isLastWallet = currentWalletIndex === wallets.length - 1;
|
|
137
139
|
const completedSteps = currentWalletIndex;
|
|
138
140
|
const totalSteps = wallets.length;
|
|
139
141
|
const refresh = useRefreshAuth.useRefreshAuth();
|
|
142
|
+
const walletCredential = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find((cred) => { var _a; return cred.address === ((_a = wallets[currentWalletIndex]) === null || _a === void 0 ? void 0 : _a.address); });
|
|
140
143
|
// Check if current wallet is a WaaS wallet based on its properties
|
|
141
144
|
const isWaasWallet = Boolean(user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => { var _a; return (_a = vc.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('dynamicwaas'); }));
|
|
142
145
|
const onExportReady = (isReady, wallet) => {
|
|
@@ -159,6 +162,22 @@ const WalletUpgradeFlowView = ({ wallets, method, onComplete, onCancel, }) => {
|
|
|
159
162
|
dynamicEvents.dynamicEvents.emit('embeddedWalletRevealFailed', err);
|
|
160
163
|
},
|
|
161
164
|
});
|
|
165
|
+
// Map the raw export failure (e.g. a rejected WebAuthn ceremony) to the
|
|
166
|
+
// same user-facing copy the main widget export view shows.
|
|
167
|
+
const exportErrorText = React.useMemo(() => {
|
|
168
|
+
if (!exportError) {
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
return getProperErrorMessage.getProperErrorMessage(exportError, user);
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
if (e instanceof utils.AccessBlockedError) {
|
|
176
|
+
pushView('access-blocked');
|
|
177
|
+
}
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
}, [exportError, pushView, user]);
|
|
162
181
|
// Track successful export for emitting event on unmount
|
|
163
182
|
const revealedWalletRef = React.useRef(null);
|
|
164
183
|
React.useEffect(() => {
|
|
@@ -216,11 +235,13 @@ const WalletUpgradeFlowView = ({ wallets, method, onComplete, onCancel, }) => {
|
|
|
216
235
|
? 'wallet-upgrade-flow-view__step--completed'
|
|
217
236
|
: ''} ${index === currentWalletIndex
|
|
218
237
|
? 'wallet-upgrade-flow-view__step--current'
|
|
219
|
-
: ''}`, children: [jsxRuntime.jsx("div", { className: 'wallet-upgrade-flow-view__step-indicator', children: index < completedSteps ? (jsxRuntime.jsx("div", { className: 'wallet-upgrade-flow-view__step-check', children: "\u2713" })) : (jsxRuntime.jsx("div", { className: 'wallet-upgrade-flow-view__step-number', children: index + 1 })) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: index <= currentWalletIndex ? 'primary' : 'secondary', className: 'wallet-upgrade-flow-view__step-title', children: getStepTitle(index) })] }), index < totalSteps - 1 && (jsxRuntime.jsx("div", { className: 'wallet-upgrade-flow-view__step-separator' }))] }, index))) }) })) }), jsxRuntime.jsxs("div", { className: 'wallet-upgrade-flow-view__content', children: [exportError && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { className: 'wallet-upgrade-flow-view__error', children:
|
|
220
|
-
? exportError.message
|
|
221
|
-
: t('dyn_wallet_upgrade_flow.export_failed') })), upgradeError && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { className: 'wallet-upgrade-flow-view__error', children: upgradeError instanceof Error
|
|
238
|
+
: ''}`, children: [jsxRuntime.jsx("div", { className: 'wallet-upgrade-flow-view__step-indicator', children: index < completedSteps ? (jsxRuntime.jsx("div", { className: 'wallet-upgrade-flow-view__step-check', children: "\u2713" })) : (jsxRuntime.jsx("div", { className: 'wallet-upgrade-flow-view__step-number', children: index + 1 })) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: index <= currentWalletIndex ? 'primary' : 'secondary', className: 'wallet-upgrade-flow-view__step-title', children: getStepTitle(index) })] }), index < totalSteps - 1 && (jsxRuntime.jsx("div", { className: 'wallet-upgrade-flow-view__step-separator' }))] }, index))) }) })) }), jsxRuntime.jsxs("div", { className: 'wallet-upgrade-flow-view__content', children: [exportError && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { className: 'wallet-upgrade-flow-view__error', children: exportErrorText !== null && exportErrorText !== void 0 ? exportErrorText : t('dyn_wallet_upgrade_flow.export_failed') })), upgradeError && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { className: 'wallet-upgrade-flow-view__error', children: upgradeError instanceof Error
|
|
222
239
|
? upgradeError.message
|
|
223
|
-
: t('dyn_wallet_upgrade_flow.upgrade_failed') })), jsxRuntime.jsxs("div", { className: 'wallet-upgrade-flow-view__title-section', children: [jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', children: t('dyn_wallet_upgrade_flow.title') }), jsxRuntime.jsx(Typography.Typography, { color: 'secondary', className: 'wallet-upgrade-flow-view__subtitle', children: t('dyn_wallet_upgrade_flow.copy_private_key_subtitle') })] }), jsxRuntime.jsxs("div", { className: 'wallet-upgrade-flow-view__export-section', children: [jsxRuntime.jsx(Typography.Typography, { color: 'primary', variant: 'body_normal', weight: 'bold', className: 'wallet-upgrade-flow-view__section-title', children: t('dyn_wallet_upgrade_flow.copy_private_key_title') }), jsxRuntime.jsx(EmbeddedWalletExport.EmbeddedWalletExport, { wallet: wallets[currentWalletIndex], isTurnkeyWallet: true, isWaasWallet: isWaasWallet, data: exportData, onIframeContainerRef: setIframeContainerRef, onExportReady: onExportReady }, `wallet-export-${currentWalletIndex}-${(
|
|
240
|
+
: t('dyn_wallet_upgrade_flow.upgrade_failed') })), jsxRuntime.jsxs("div", { className: 'wallet-upgrade-flow-view__title-section', children: [jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', children: t('dyn_wallet_upgrade_flow.title') }), jsxRuntime.jsx(Typography.Typography, { color: 'secondary', className: 'wallet-upgrade-flow-view__subtitle', children: t('dyn_wallet_upgrade_flow.copy_private_key_subtitle') })] }), jsxRuntime.jsxs("div", { className: 'wallet-upgrade-flow-view__export-section', children: [jsxRuntime.jsx(Typography.Typography, { color: 'primary', variant: 'body_normal', weight: 'bold', className: 'wallet-upgrade-flow-view__section-title', children: t('dyn_wallet_upgrade_flow.copy_private_key_title') }), jsxRuntime.jsx(EmbeddedWalletExport.EmbeddedWalletExport, { wallet: wallets[currentWalletIndex], isTurnkeyWallet: true, isWaasWallet: isWaasWallet, data: exportData, onIframeContainerRef: setIframeContainerRef, onExportReady: onExportReady }, `wallet-export-${currentWalletIndex}-${(_b = wallets[currentWalletIndex]) === null || _b === void 0 ? void 0 : _b.id}`)] }), jsxRuntime.jsx("div", { className: 'wallet-upgrade-flow-view__input-section', children: jsxRuntime.jsxs("div", { className: 'wallet-upgrade-flow-view__input-container', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', weight: 'bold', color: 'primary', copykey: 'dyn_embedded_reveal.step_2_title', children: [jsxRuntime.jsx("span", { className: 'wallet-upgrade-flow__step-description', children: t('dyn_wallet_upgrade_flow.step_2_upgrade_description') }), ' '] }), jsxRuntime.jsx(Textarea.Textarea, { id: 'paste-private-key-input', value: privateKeyInput, onChange: (e) => setPrivateKeyInput(e.target.value), variant: 'regular', className: 'wallet-upgrade-flow__paste-input', label: '' })] }) }), exportError && (jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, { isExport: true, walletCredential: walletCredential, wallet: wallets[currentWalletIndex], goBack: () => pushView('wallet-upgrade-flow-view', {
|
|
241
|
+
method,
|
|
242
|
+
startIndex: currentWalletIndex,
|
|
243
|
+
wallets,
|
|
244
|
+
}) }))] }), jsxRuntime.jsxs("div", { className: 'wallet-upgrade-flow-view__actions', children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'brand-primary', onClick: () => handleUpgradeWallet(), disabled: !privateKeyInput.trim() || isUpgrading, loading: isUpgrading, copykey: 'dyn_wallet_upgrade_flow.upgrade_button', typographyProps: {
|
|
224
245
|
color: 'inherit',
|
|
225
246
|
}, expanded: true, children: t('dyn_wallet_upgrade_flow.upgrade_wallet') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'tertiary', onClick: handleClose, disabled: isUpgrading, children: t('dyn_wallet_upgrade_flow.cancel') })] })] }));
|
|
226
247
|
};
|
|
@@ -3,6 +3,7 @@ import { Wallet, WalletConnectorCore } from '@dynamic-labs/wallet-connector-core
|
|
|
3
3
|
export interface WalletUpgradeFlowViewProps {
|
|
4
4
|
wallets: Wallet<WalletConnectorCore.WalletConnector>[];
|
|
5
5
|
method: 'new' | 'existing';
|
|
6
|
+
startIndex?: number;
|
|
6
7
|
onComplete?: () => void;
|
|
7
8
|
onCancel?: () => void;
|
|
8
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
-
import { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import { useState, useMemo, useRef, useEffect } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
|
+
import { AccessBlockedError, DynamicError } from '@dynamic-labs/utils';
|
|
7
7
|
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
8
8
|
import '@dynamic-labs/iconic';
|
|
9
9
|
import { useViewContext } from '../../context/ViewContext/ViewContext.js';
|
|
@@ -74,6 +74,7 @@ import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.j
|
|
|
74
74
|
import '../../components/IconButton/IconButton.js';
|
|
75
75
|
import { ModalHeader } from '../../components/ModalHeader/ModalHeader.js';
|
|
76
76
|
import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
|
|
77
|
+
import { getProperErrorMessage } from '../../modals/SignMessageConfirmationModal/getProperErrorMessage.js';
|
|
77
78
|
import { useDynamicWaas } from '../../utils/hooks/useDynamicWaas/useDynamicWaas.js';
|
|
78
79
|
import { useRefreshAuth } from '../../utils/hooks/useRefreshAuth/useRefreshAuth.js';
|
|
79
80
|
import '../../utils/hooks/useWalletDelegation/DelegationError.js';
|
|
@@ -100,6 +101,7 @@ import '../../widgets/DynamicWidget/views/ManagePasskeysMfaWidgetView/ManagePass
|
|
|
100
101
|
import '../../widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpMfaWidgetView.js';
|
|
101
102
|
import '../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
102
103
|
import { Textarea } from '../../components/Textarea/Textarea.js';
|
|
104
|
+
import { NeedHelpSection } from '../../components/NeedHelpSection/NeedHelpSection.js';
|
|
103
105
|
import '@hcaptcha/react-hcaptcha';
|
|
104
106
|
import '@marsidev/react-turnstile';
|
|
105
107
|
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
@@ -120,19 +122,20 @@ import '../../components/IsBrowser/IsBrowser.js';
|
|
|
120
122
|
import '../../components/Popper/Popper/Popper.js';
|
|
121
123
|
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
122
124
|
|
|
123
|
-
const WalletUpgradeFlowView = ({ wallets, method, onComplete, onCancel, }) => {
|
|
124
|
-
var _a;
|
|
125
|
+
const WalletUpgradeFlowView = ({ wallets, method, startIndex = 0, onComplete, onCancel, }) => {
|
|
126
|
+
var _a, _b;
|
|
125
127
|
const { setShowAuthFlow, user, environmentId } = useInternalDynamicContext();
|
|
126
128
|
const { upgradeToDynamicWaas } = useDynamicWaas();
|
|
127
129
|
const { t } = useTranslation();
|
|
128
130
|
const { pushView } = useViewContext();
|
|
129
|
-
const [currentWalletIndex, setCurrentWalletIndex] = useState(
|
|
131
|
+
const [currentWalletIndex, setCurrentWalletIndex] = useState(startIndex);
|
|
130
132
|
const [privateKeyInput, setPrivateKeyInput] = useState('');
|
|
131
133
|
const [iframeContainerRef, setIframeContainerRef] = useState(null);
|
|
132
134
|
const isLastWallet = currentWalletIndex === wallets.length - 1;
|
|
133
135
|
const completedSteps = currentWalletIndex;
|
|
134
136
|
const totalSteps = wallets.length;
|
|
135
137
|
const refresh = useRefreshAuth();
|
|
138
|
+
const walletCredential = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find((cred) => { var _a; return cred.address === ((_a = wallets[currentWalletIndex]) === null || _a === void 0 ? void 0 : _a.address); });
|
|
136
139
|
// Check if current wallet is a WaaS wallet based on its properties
|
|
137
140
|
const isWaasWallet = Boolean(user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => { var _a; return (_a = vc.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('dynamicwaas'); }));
|
|
138
141
|
const onExportReady = (isReady, wallet) => {
|
|
@@ -155,6 +158,22 @@ const WalletUpgradeFlowView = ({ wallets, method, onComplete, onCancel, }) => {
|
|
|
155
158
|
dynamicEvents.emit('embeddedWalletRevealFailed', err);
|
|
156
159
|
},
|
|
157
160
|
});
|
|
161
|
+
// Map the raw export failure (e.g. a rejected WebAuthn ceremony) to the
|
|
162
|
+
// same user-facing copy the main widget export view shows.
|
|
163
|
+
const exportErrorText = useMemo(() => {
|
|
164
|
+
if (!exportError) {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
return getProperErrorMessage(exportError, user);
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
if (e instanceof AccessBlockedError) {
|
|
172
|
+
pushView('access-blocked');
|
|
173
|
+
}
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
}, [exportError, pushView, user]);
|
|
158
177
|
// Track successful export for emitting event on unmount
|
|
159
178
|
const revealedWalletRef = useRef(null);
|
|
160
179
|
useEffect(() => {
|
|
@@ -212,11 +231,13 @@ const WalletUpgradeFlowView = ({ wallets, method, onComplete, onCancel, }) => {
|
|
|
212
231
|
? 'wallet-upgrade-flow-view__step--completed'
|
|
213
232
|
: ''} ${index === currentWalletIndex
|
|
214
233
|
? 'wallet-upgrade-flow-view__step--current'
|
|
215
|
-
: ''}`, children: [jsx("div", { className: 'wallet-upgrade-flow-view__step-indicator', children: index < completedSteps ? (jsx("div", { className: 'wallet-upgrade-flow-view__step-check', children: "\u2713" })) : (jsx("div", { className: 'wallet-upgrade-flow-view__step-number', children: index + 1 })) }), jsx(Typography, { variant: 'body_small', color: index <= currentWalletIndex ? 'primary' : 'secondary', className: 'wallet-upgrade-flow-view__step-title', children: getStepTitle(index) })] }), index < totalSteps - 1 && (jsx("div", { className: 'wallet-upgrade-flow-view__step-separator' }))] }, index))) }) })) }), jsxs("div", { className: 'wallet-upgrade-flow-view__content', children: [exportError && (jsx(ErrorContainer, { className: 'wallet-upgrade-flow-view__error', children:
|
|
216
|
-
? exportError.message
|
|
217
|
-
: t('dyn_wallet_upgrade_flow.export_failed') })), upgradeError && (jsx(ErrorContainer, { className: 'wallet-upgrade-flow-view__error', children: upgradeError instanceof Error
|
|
234
|
+
: ''}`, children: [jsx("div", { className: 'wallet-upgrade-flow-view__step-indicator', children: index < completedSteps ? (jsx("div", { className: 'wallet-upgrade-flow-view__step-check', children: "\u2713" })) : (jsx("div", { className: 'wallet-upgrade-flow-view__step-number', children: index + 1 })) }), jsx(Typography, { variant: 'body_small', color: index <= currentWalletIndex ? 'primary' : 'secondary', className: 'wallet-upgrade-flow-view__step-title', children: getStepTitle(index) })] }), index < totalSteps - 1 && (jsx("div", { className: 'wallet-upgrade-flow-view__step-separator' }))] }, index))) }) })) }), jsxs("div", { className: 'wallet-upgrade-flow-view__content', children: [exportError && (jsx(ErrorContainer, { className: 'wallet-upgrade-flow-view__error', children: exportErrorText !== null && exportErrorText !== void 0 ? exportErrorText : t('dyn_wallet_upgrade_flow.export_failed') })), upgradeError && (jsx(ErrorContainer, { className: 'wallet-upgrade-flow-view__error', children: upgradeError instanceof Error
|
|
218
235
|
? upgradeError.message
|
|
219
|
-
: t('dyn_wallet_upgrade_flow.upgrade_failed') })), jsxs("div", { className: 'wallet-upgrade-flow-view__title-section', children: [jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', children: t('dyn_wallet_upgrade_flow.title') }), jsx(Typography, { color: 'secondary', className: 'wallet-upgrade-flow-view__subtitle', children: t('dyn_wallet_upgrade_flow.copy_private_key_subtitle') })] }), jsxs("div", { className: 'wallet-upgrade-flow-view__export-section', children: [jsx(Typography, { color: 'primary', variant: 'body_normal', weight: 'bold', className: 'wallet-upgrade-flow-view__section-title', children: t('dyn_wallet_upgrade_flow.copy_private_key_title') }), jsx(EmbeddedWalletExport, { wallet: wallets[currentWalletIndex], isTurnkeyWallet: true, isWaasWallet: isWaasWallet, data: exportData, onIframeContainerRef: setIframeContainerRef, onExportReady: onExportReady }, `wallet-export-${currentWalletIndex}-${(
|
|
236
|
+
: t('dyn_wallet_upgrade_flow.upgrade_failed') })), jsxs("div", { className: 'wallet-upgrade-flow-view__title-section', children: [jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', children: t('dyn_wallet_upgrade_flow.title') }), jsx(Typography, { color: 'secondary', className: 'wallet-upgrade-flow-view__subtitle', children: t('dyn_wallet_upgrade_flow.copy_private_key_subtitle') })] }), jsxs("div", { className: 'wallet-upgrade-flow-view__export-section', children: [jsx(Typography, { color: 'primary', variant: 'body_normal', weight: 'bold', className: 'wallet-upgrade-flow-view__section-title', children: t('dyn_wallet_upgrade_flow.copy_private_key_title') }), jsx(EmbeddedWalletExport, { wallet: wallets[currentWalletIndex], isTurnkeyWallet: true, isWaasWallet: isWaasWallet, data: exportData, onIframeContainerRef: setIframeContainerRef, onExportReady: onExportReady }, `wallet-export-${currentWalletIndex}-${(_b = wallets[currentWalletIndex]) === null || _b === void 0 ? void 0 : _b.id}`)] }), jsx("div", { className: 'wallet-upgrade-flow-view__input-section', children: jsxs("div", { className: 'wallet-upgrade-flow-view__input-container', children: [jsxs(Typography, { variant: 'body_normal', weight: 'bold', color: 'primary', copykey: 'dyn_embedded_reveal.step_2_title', children: [jsx("span", { className: 'wallet-upgrade-flow__step-description', children: t('dyn_wallet_upgrade_flow.step_2_upgrade_description') }), ' '] }), jsx(Textarea, { id: 'paste-private-key-input', value: privateKeyInput, onChange: (e) => setPrivateKeyInput(e.target.value), variant: 'regular', className: 'wallet-upgrade-flow__paste-input', label: '' })] }) }), exportError && (jsx(NeedHelpSection, { isExport: true, walletCredential: walletCredential, wallet: wallets[currentWalletIndex], goBack: () => pushView('wallet-upgrade-flow-view', {
|
|
237
|
+
method,
|
|
238
|
+
startIndex: currentWalletIndex,
|
|
239
|
+
wallets,
|
|
240
|
+
}) }))] }), jsxs("div", { className: 'wallet-upgrade-flow-view__actions', children: [jsx(TypographyButton, { buttonVariant: 'brand-primary', onClick: () => handleUpgradeWallet(), disabled: !privateKeyInput.trim() || isUpgrading, loading: isUpgrading, copykey: 'dyn_wallet_upgrade_flow.upgrade_button', typographyProps: {
|
|
220
241
|
color: 'inherit',
|
|
221
242
|
}, expanded: true, children: t('dyn_wallet_upgrade_flow.upgrade_wallet') }), jsx(TypographyButton, { buttonVariant: 'tertiary', onClick: handleClose, disabled: isUpgrading, children: t('dyn_wallet_upgrade_flow.cancel') })] })] }));
|
|
222
243
|
};
|