@dynamic-labs/sdk-react-core 4.25.4 → 4.25.6

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +11 -11
  5. package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.cjs +5 -8
  6. package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.js +6 -9
  7. package/src/lib/locale/en/translation.cjs +12 -0
  8. package/src/lib/locale/en/translation.d.ts +12 -0
  9. package/src/lib/locale/en/translation.js +12 -0
  10. package/src/lib/utils/hooks/useDynamicWaas/constants.cjs +2 -0
  11. package/src/lib/utils/hooks/useDynamicWaas/constants.d.ts +1 -0
  12. package/src/lib/utils/hooks/useDynamicWaas/constants.js +2 -1
  13. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +14 -2
  14. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +5 -2
  15. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +15 -3
  16. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +11 -6
  17. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +11 -6
  18. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +1 -1
  19. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +1 -1
  20. package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +80 -60
  21. package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.d.ts +1 -5
  22. package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +81 -61
  23. package/src/lib/utils/hooks/useGetMfaToken/index.d.ts +1 -0
  24. package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.cjs +68 -0
  25. package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.d.ts +26 -0
  26. package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.js +64 -0
  27. package/src/lib/utils/hooks/useMfa/useMfa.cjs +23 -12
  28. package/src/lib/utils/hooks/useMfa/useMfa.d.ts +3 -2
  29. package/src/lib/utils/hooks/useMfa/useMfa.js +23 -12
  30. package/src/lib/utils/hooks/useMfaModals/useMfaModals.cjs +7 -1
  31. package/src/lib/utils/hooks/useMfaModals/useMfaModals.js +7 -1
  32. package/src/lib/utils/hooks/usePromptMfaAuth/index.d.ts +1 -0
  33. package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.cjs +150 -0
  34. package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.d.ts +5 -0
  35. package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.js +146 -0
  36. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +3 -0
  37. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +3 -0
  38. package/src/lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.cjs +5 -13
  39. package/src/lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.js +5 -13
  40. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -2
  41. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -2
  42. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +6 -1
  43. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +6 -1
  44. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +5 -2
  45. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.d.ts +1 -0
  46. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +5 -2
  47. package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +18 -3
  48. package/src/lib/views/MfaVerificationView/MfaVerificationView.d.ts +2 -1
  49. package/src/lib/views/MfaVerificationView/MfaVerificationView.js +18 -3
  50. package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.cjs +15 -3
  51. package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.d.ts +5 -1
  52. package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.js +15 -3
  53. package/src/lib/views/Passkey/SetupPasskeyView/SetupPasskeyView.cjs +16 -4
  54. package/src/lib/views/Passkey/SetupPasskeyView/SetupPasskeyView.js +16 -4
  55. package/src/lib/views/viewToComponentMap.d.ts +4 -2
  56. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +7 -2
  57. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +8 -3
@@ -85,7 +85,6 @@ import '../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
85
85
  import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
86
86
  import '../../../context/FooterAnimationContext/index.js';
87
87
  import '../../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.js';
88
- import { useMfa } from '../useMfa/useMfa.js';
89
88
  import '../../../context/PasskeyContext/PasskeyContext.js';
90
89
  import '../../../store/state/sendBalances.js';
91
90
  import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
@@ -98,6 +97,7 @@ import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFun
98
97
  import '../../../../index.js';
99
98
  import '../../../store/state/tokenBalances.js';
100
99
  import '../../../store/state/multichainBalances.js';
100
+ import { usePromptMfaAuth } from '../usePromptMfaAuth/usePromptMfaAuth.js';
101
101
  import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
102
102
  import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
103
103
 
@@ -106,8 +106,8 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
106
106
  */
107
107
  const useSyncMfaFlow = ({ handler: headlessHandler, } = {}) => {
108
108
  const { setShowAuthFlow, userWithMissingInfo, sdkHasLoaded } = useInternalDynamicContext();
109
- const { pushView, clearStackAndPush } = useViewContext();
110
- const { getUserDevices } = useMfa();
109
+ const promptMfaAuth = usePromptMfaAuth();
110
+ const { clearStackAndPush } = useViewContext();
111
111
  // this is used to make sure we only trigger the effect once
112
112
  const triggered = useRef(false);
113
113
  useInternalDynamicEvents('logout', () => {
@@ -146,23 +146,15 @@ const useSyncMfaFlow = ({ handler: headlessHandler, } = {}) => {
146
146
  */
147
147
  setShowAuthFlow(true);
148
148
  if ((_a = userWithMissingInfo.scope) === null || _a === void 0 ? void 0 : _a.includes('requiresAdditionalAuth')) {
149
- getUserDevices().then((devices) => {
150
- if (devices.length === 0) {
151
- pushView('mfa-choose-device');
152
- }
153
- else {
154
- pushView('mfa-verification');
155
- }
156
- });
149
+ promptMfaAuth();
157
150
  }
158
151
  else {
159
152
  clearStackAndPush('mfa-display-backup-codes');
160
153
  }
161
154
  }, [
162
- getUserDevices,
155
+ promptMfaAuth,
163
156
  sdkHasLoaded,
164
157
  setShowAuthFlow,
165
- pushView,
166
158
  userWithMissingInfo,
167
159
  headlessHandler,
168
160
  clearStackAndPush,
@@ -141,12 +141,12 @@ const useVerifyWallet = ({ displaySiweStatement, environmentId, projectSettings,
141
141
  walletConnector,
142
142
  walletProvider,
143
143
  });
144
- if (shouldRegisterSessionKeysOnSignin()) {
144
+ if (shouldRegisterSessionKeysOnSignin() && verifyOnly) {
145
145
  const keypair = yield generateSessionKey();
146
146
  verifyArgs.sessionPublicKey = keypair.publicKey;
147
147
  }
148
148
  let verifyResponse;
149
- if (!user || !multiWalletEnabled) {
149
+ if (!user) {
150
150
  verifyResponse = wallets.verifyWallet(environmentId, Object.assign(Object.assign({}, verifyArgs), { captchaToken,
151
151
  oauth }));
152
152
  }
@@ -137,12 +137,12 @@ const useVerifyWallet = ({ displaySiweStatement, environmentId, projectSettings,
137
137
  walletConnector,
138
138
  walletProvider,
139
139
  });
140
- if (shouldRegisterSessionKeysOnSignin()) {
140
+ if (shouldRegisterSessionKeysOnSignin() && verifyOnly) {
141
141
  const keypair = yield generateSessionKey();
142
142
  verifyArgs.sessionPublicKey = keypair.publicKey;
143
143
  }
144
144
  let verifyResponse;
145
- if (!user || !multiWalletEnabled) {
145
+ if (!user) {
146
146
  verifyResponse = verifyWallet(environmentId, Object.assign(Object.assign({}, verifyArgs), { captchaToken,
147
147
  oauth }));
148
148
  }
@@ -199,13 +199,18 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
199
199
  wallet: wallet,
200
200
  });
201
201
  }
202
- catch (_j) {
202
+ catch (err) {
203
203
  if (walletConnectorCore.isSessionKeyCompatibleWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector) &&
204
204
  ((_f = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _f === void 0 ? void 0 : _f.removeSessionKeys)) {
205
205
  yield ((_g = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _g === void 0 ? void 0 : _g.removeSessionKeys());
206
206
  yield ((_h = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _h === void 0 ? void 0 : _h.createOrRestoreSession({
207
207
  ignoreRestore: true,
208
208
  }));
209
+ logger.logger.error('[TK - removeSessionKeys] failed to perform revealEmbeddedWalletKey activity', {
210
+ address: wallet === null || wallet === void 0 ? void 0 : wallet.address,
211
+ err,
212
+ userId: user === null || user === void 0 ? void 0 : user.userId,
213
+ });
209
214
  }
210
215
  return turnkeyExport.exportCredential({
211
216
  address: exportPrivateKey ? wallet === null || wallet === void 0 ? void 0 : wallet.address : undefined,
@@ -195,13 +195,18 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
195
195
  wallet: wallet,
196
196
  });
197
197
  }
198
- catch (_j) {
198
+ catch (err) {
199
199
  if (isSessionKeyCompatibleWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector) &&
200
200
  ((_f = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _f === void 0 ? void 0 : _f.removeSessionKeys)) {
201
201
  yield ((_g = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _g === void 0 ? void 0 : _g.removeSessionKeys());
202
202
  yield ((_h = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _h === void 0 ? void 0 : _h.createOrRestoreSession({
203
203
  ignoreRestore: true,
204
204
  }));
205
+ logger.error('[TK - removeSessionKeys] failed to perform revealEmbeddedWalletKey activity', {
206
+ address: wallet === null || wallet === void 0 ? void 0 : wallet.address,
207
+ err,
208
+ userId: user === null || user === void 0 ? void 0 : user.userId,
209
+ });
205
210
  }
206
211
  return exportCredential({
207
212
  address: exportPrivateKey ? wallet === null || wallet === void 0 ? void 0 : wallet.address : undefined,
@@ -108,7 +108,7 @@ require('../../components/IsBrowser/IsBrowser.cjs');
108
108
  require('../../components/Popper/Popper/Popper.cjs');
109
109
  require('../../components/Popper/PopperContext/PopperContext.cjs');
110
110
 
111
- const MfaChooseDeviceView = ({ isInitialSetup = true, }) => {
111
+ const MfaChooseDeviceView = ({ isInitialSetup = true, createMfaToken = false, }) => {
112
112
  const { handleLogOut } = useDynamicContext.useDynamicContext();
113
113
  const { t } = reactI18next.useTranslation();
114
114
  const { pushView } = ViewContext.useViewContext();
@@ -118,7 +118,9 @@ const MfaChooseDeviceView = ({ isInitialSetup = true, }) => {
118
118
  pushView('passkey-setup');
119
119
  return;
120
120
  }
121
- pushView('passkey-confirm');
121
+ pushView('passkey-confirm', {
122
+ createMfaToken,
123
+ });
122
124
  };
123
125
  const handleTotpClick = () => {
124
126
  if (isInitialSetup) {
@@ -129,6 +131,7 @@ const MfaChooseDeviceView = ({ isInitialSetup = true, }) => {
129
131
  return;
130
132
  }
131
133
  pushView('mfa-verification', {
134
+ createMfaToken,
132
135
  isInitialSetup,
133
136
  showBackButton: true,
134
137
  type: sdkApiCore.MFADeviceType.Totp,
@@ -1,5 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  export type MfaChooseDeviceViewProps = {
3
3
  isInitialSetup?: boolean;
4
+ createMfaToken?: boolean;
4
5
  };
5
6
  export declare const MfaChooseDeviceView: FC<MfaChooseDeviceViewProps>;
@@ -104,7 +104,7 @@ import '../../components/IsBrowser/IsBrowser.js';
104
104
  import '../../components/Popper/Popper/Popper.js';
105
105
  import '../../components/Popper/PopperContext/PopperContext.js';
106
106
 
107
- const MfaChooseDeviceView = ({ isInitialSetup = true, }) => {
107
+ const MfaChooseDeviceView = ({ isInitialSetup = true, createMfaToken = false, }) => {
108
108
  const { handleLogOut } = useDynamicContext();
109
109
  const { t } = useTranslation();
110
110
  const { pushView } = useViewContext();
@@ -114,7 +114,9 @@ const MfaChooseDeviceView = ({ isInitialSetup = true, }) => {
114
114
  pushView('passkey-setup');
115
115
  return;
116
116
  }
117
- pushView('passkey-confirm');
117
+ pushView('passkey-confirm', {
118
+ createMfaToken,
119
+ });
118
120
  };
119
121
  const handleTotpClick = () => {
120
122
  if (isInitialSetup) {
@@ -125,6 +127,7 @@ const MfaChooseDeviceView = ({ isInitialSetup = true, }) => {
125
127
  return;
126
128
  }
127
129
  pushView('mfa-verification', {
130
+ createMfaToken,
128
131
  isInitialSetup,
129
132
  showBackButton: true,
130
133
  type: MFADeviceType.Totp,
@@ -107,14 +107,26 @@ require('../../components/IsBrowser/IsBrowser.cjs');
107
107
  require('../../components/Popper/Popper/Popper.cjs');
108
108
  require('../../components/Popper/PopperContext/PopperContext.cjs');
109
109
 
110
- const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = false, deviceId, }) => {
110
+ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = false, createMfaToken = false, deviceId, }) => {
111
111
  const { t } = reactI18next.useTranslation();
112
112
  const { clearStackAndPush, pushView, goBack, canGoBack } = ViewContext.useViewContext();
113
113
  const { authenticateDevice } = useMfa.useMfa();
114
114
  const [code, setCode] = React.useState('');
115
115
  const [error, setError] = React.useState();
116
116
  const [isRateLimited, setIsRateLimited] = React.useState(false);
117
- const { data: mfaToken, isLoading } = usePromise.usePromise(() => authenticateDevice({ code, deviceId, type }), {
117
+ const { data: mfaToken, isLoading } = usePromise.usePromise(() => {
118
+ const createMfaTokenOptions = createMfaToken
119
+ ? {
120
+ singleUse: true,
121
+ }
122
+ : undefined;
123
+ return authenticateDevice({
124
+ code,
125
+ createMfaToken: createMfaTokenOptions,
126
+ deviceId,
127
+ type,
128
+ });
129
+ }, {
118
130
  deps: [code],
119
131
  enabled: (code === null || code === void 0 ? void 0 : code.length) === 6,
120
132
  initialData: undefined,
@@ -143,7 +155,10 @@ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = fa
143
155
  setCode(code);
144
156
  };
145
157
  const onClickBack = canGoBack && showBackButton ? goBack : undefined;
146
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(OTPVerificationView.OTPVerificationView, { MainIcon: passwordHero.ReactComponent, error: error, isLoading: isLoading, onPinComplete: onSubmit, isValid: Boolean(mfaToken), onPinChange: onCodeChange, description: t('dyn_mfa.otp_verification_view.body'), onClickBack: onClickBack, disabled: isRateLimited }), !isInitialSetup && (jsxRuntime.jsx("div", { className: 'mfa-verification-view__choose-another-method', children: jsxRuntime.jsx(TextButton.TextButton, { className: 'mfa-verification-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', { isInitialSetup }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) }))] }));
158
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(OTPVerificationView.OTPVerificationView, { MainIcon: passwordHero.ReactComponent, error: error, isLoading: isLoading, onPinComplete: onSubmit, isValid: Boolean(mfaToken), onPinChange: onCodeChange, description: t('dyn_mfa.otp_verification_view.body'), onClickBack: onClickBack, disabled: isRateLimited }), !isInitialSetup && (jsxRuntime.jsx("div", { className: 'mfa-verification-view__choose-another-method', children: jsxRuntime.jsx(TextButton.TextButton, { className: 'mfa-verification-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', {
159
+ createMfaToken,
160
+ isInitialSetup,
161
+ }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) }))] }));
147
162
  };
148
163
 
149
164
  exports.MfaVerificationView = MfaVerificationView;
@@ -5,5 +5,6 @@ export type MfaVerificationViewProps = {
5
5
  type?: MFADeviceType;
6
6
  isInitialSetup?: boolean;
7
7
  showBackButton?: boolean;
8
+ createMfaToken?: boolean;
8
9
  };
9
- export declare const MfaVerificationView: ({ type, isInitialSetup, showBackButton, deviceId, }: MfaVerificationViewProps) => JSX.Element;
10
+ export declare const MfaVerificationView: ({ type, isInitialSetup, showBackButton, createMfaToken, deviceId, }: MfaVerificationViewProps) => JSX.Element;
@@ -103,14 +103,26 @@ import '../../components/IsBrowser/IsBrowser.js';
103
103
  import '../../components/Popper/Popper/Popper.js';
104
104
  import '../../components/Popper/PopperContext/PopperContext.js';
105
105
 
106
- const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = false, deviceId, }) => {
106
+ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = false, createMfaToken = false, deviceId, }) => {
107
107
  const { t } = useTranslation();
108
108
  const { clearStackAndPush, pushView, goBack, canGoBack } = useViewContext();
109
109
  const { authenticateDevice } = useMfa();
110
110
  const [code, setCode] = useState('');
111
111
  const [error, setError] = useState();
112
112
  const [isRateLimited, setIsRateLimited] = useState(false);
113
- const { data: mfaToken, isLoading } = usePromise(() => authenticateDevice({ code, deviceId, type }), {
113
+ const { data: mfaToken, isLoading } = usePromise(() => {
114
+ const createMfaTokenOptions = createMfaToken
115
+ ? {
116
+ singleUse: true,
117
+ }
118
+ : undefined;
119
+ return authenticateDevice({
120
+ code,
121
+ createMfaToken: createMfaTokenOptions,
122
+ deviceId,
123
+ type,
124
+ });
125
+ }, {
114
126
  deps: [code],
115
127
  enabled: (code === null || code === void 0 ? void 0 : code.length) === 6,
116
128
  initialData: undefined,
@@ -139,7 +151,10 @@ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = fa
139
151
  setCode(code);
140
152
  };
141
153
  const onClickBack = canGoBack && showBackButton ? goBack : undefined;
142
- return (jsxs(Fragment, { children: [jsx(OTPVerificationView, { MainIcon: SvgPasswordHero, error: error, isLoading: isLoading, onPinComplete: onSubmit, isValid: Boolean(mfaToken), onPinChange: onCodeChange, description: t('dyn_mfa.otp_verification_view.body'), onClickBack: onClickBack, disabled: isRateLimited }), !isInitialSetup && (jsx("div", { className: 'mfa-verification-view__choose-another-method', children: jsx(TextButton, { className: 'mfa-verification-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', { isInitialSetup }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) }))] }));
154
+ return (jsxs(Fragment, { children: [jsx(OTPVerificationView, { MainIcon: SvgPasswordHero, error: error, isLoading: isLoading, onPinComplete: onSubmit, isValid: Boolean(mfaToken), onPinChange: onCodeChange, description: t('dyn_mfa.otp_verification_view.body'), onClickBack: onClickBack, disabled: isRateLimited }), !isInitialSetup && (jsx("div", { className: 'mfa-verification-view__choose-another-method', children: jsx(TextButton, { className: 'mfa-verification-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', {
155
+ createMfaToken,
156
+ isInitialSetup,
157
+ }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) }))] }));
143
158
  };
144
159
 
145
160
  export { MfaVerificationView };
@@ -111,13 +111,25 @@ require('../../../components/IsBrowser/IsBrowser.cjs');
111
111
  require('../../../components/Popper/Popper/Popper.cjs');
112
112
  require('../../../components/Popper/PopperContext/PopperContext.cjs');
113
113
 
114
- const ConfirmPasskeyView = () => {
114
+ const ConfirmPasskeyView = ({ createMfaToken = false, }) => {
115
115
  const { t } = reactI18next.useTranslation();
116
116
  const { pushView } = ViewContext.useViewContext();
117
117
  const authenticatePasskeyMFA = useAuthenticatePasskeyMFA.useAuthenticatePasskeyMFA();
118
- const { error, isLoading } = usePromise.usePromise(authenticatePasskeyMFA);
118
+ const { error, isLoading } = usePromise.usePromise(() => {
119
+ const createMfaTokenOptions = createMfaToken
120
+ ? {
121
+ singleUse: true,
122
+ }
123
+ : undefined;
124
+ return authenticatePasskeyMFA({
125
+ createMfaToken: createMfaTokenOptions,
126
+ });
127
+ });
119
128
  const errorMessage = useGetPasskeyErrorMessage.useGetPasskeyErrorMessage(error);
120
- return (jsxRuntime.jsxs("div", { className: classNames.classNames('confirm-passkey-view'), children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { alignContent: 'bottom', children: jsxRuntime.jsx("div", { className: 'confirm-passkey-view__header', children: jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'confirm-passkey-view__title', copykey: 'dyn_mfa.confirm_passkey_view.title', children: t('dyn_mfa.confirm_passkey_view.title') }) }) }), jsxRuntime.jsx(ModalHeaderBanner.ModalHeaderBanner, { type: 'error', messageKey: errorMessage, className: 'confirm-passkey-view__header-banner' }), jsxRuntime.jsxs("div", { className: classNames.classNames('confirm-passkey-view__content'), children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: fingerprint.ReactComponent, iconSize: 96, isSpinning: isLoading, treatAsFunctionComponent: true }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: classNames.classNames('confirm-passkey-view__description'), copykey: 'dyn_mfa.confirm_passkey_view.description', children: t('dyn_mfa.confirm_passkey_view.description') })] }), jsxRuntime.jsx("div", { className: 'confirm-passkey-view__choose-another-method', children: jsxRuntime.jsx(TextButton.TextButton, { className: 'confirm-passkey-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', { isInitialSetup: false }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) })] }));
129
+ return (jsxRuntime.jsxs("div", { className: classNames.classNames('confirm-passkey-view'), children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { alignContent: 'bottom', children: jsxRuntime.jsx("div", { className: 'confirm-passkey-view__header', children: jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'confirm-passkey-view__title', copykey: 'dyn_mfa.confirm_passkey_view.title', children: t('dyn_mfa.confirm_passkey_view.title') }) }) }), jsxRuntime.jsx(ModalHeaderBanner.ModalHeaderBanner, { type: 'error', messageKey: errorMessage, className: 'confirm-passkey-view__header-banner' }), jsxRuntime.jsxs("div", { className: classNames.classNames('confirm-passkey-view__content'), children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: fingerprint.ReactComponent, iconSize: 96, isSpinning: isLoading, treatAsFunctionComponent: true }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: classNames.classNames('confirm-passkey-view__description'), copykey: 'dyn_mfa.confirm_passkey_view.description', children: t('dyn_mfa.confirm_passkey_view.description') })] }), jsxRuntime.jsx("div", { className: 'confirm-passkey-view__choose-another-method', children: jsxRuntime.jsx(TextButton.TextButton, { className: 'confirm-passkey-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', {
130
+ createMfaToken,
131
+ isInitialSetup: false,
132
+ }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) })] }));
121
133
  };
122
134
 
123
135
  exports.ConfirmPasskeyView = ConfirmPasskeyView;
@@ -1,2 +1,6 @@
1
1
  /// <reference types="react" />
2
- export declare const ConfirmPasskeyView: () => JSX.Element;
2
+ type ConfirmPasskeyViewProps = {
3
+ createMfaToken?: boolean;
4
+ };
5
+ export declare const ConfirmPasskeyView: ({ createMfaToken, }: ConfirmPasskeyViewProps) => JSX.Element;
6
+ export {};
@@ -107,13 +107,25 @@ import '../../../components/IsBrowser/IsBrowser.js';
107
107
  import '../../../components/Popper/Popper/Popper.js';
108
108
  import '../../../components/Popper/PopperContext/PopperContext.js';
109
109
 
110
- const ConfirmPasskeyView = () => {
110
+ const ConfirmPasskeyView = ({ createMfaToken = false, }) => {
111
111
  const { t } = useTranslation();
112
112
  const { pushView } = useViewContext();
113
113
  const authenticatePasskeyMFA = useAuthenticatePasskeyMFA();
114
- const { error, isLoading } = usePromise(authenticatePasskeyMFA);
114
+ const { error, isLoading } = usePromise(() => {
115
+ const createMfaTokenOptions = createMfaToken
116
+ ? {
117
+ singleUse: true,
118
+ }
119
+ : undefined;
120
+ return authenticatePasskeyMFA({
121
+ createMfaToken: createMfaTokenOptions,
122
+ });
123
+ });
115
124
  const errorMessage = useGetPasskeyErrorMessage(error);
116
- return (jsxs("div", { className: classNames('confirm-passkey-view'), children: [jsx(ModalHeader, { alignContent: 'bottom', children: jsx("div", { className: 'confirm-passkey-view__header', children: jsx(Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'confirm-passkey-view__title', copykey: 'dyn_mfa.confirm_passkey_view.title', children: t('dyn_mfa.confirm_passkey_view.title') }) }) }), jsx(ModalHeaderBanner, { type: 'error', messageKey: errorMessage, className: 'confirm-passkey-view__header-banner' }), jsxs("div", { className: classNames('confirm-passkey-view__content'), children: [jsx(IconWithSpinner, { Icon: SvgFingerprint, iconSize: 96, isSpinning: isLoading, treatAsFunctionComponent: true }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: classNames('confirm-passkey-view__description'), copykey: 'dyn_mfa.confirm_passkey_view.description', children: t('dyn_mfa.confirm_passkey_view.description') })] }), jsx("div", { className: 'confirm-passkey-view__choose-another-method', children: jsx(TextButton, { className: 'confirm-passkey-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', { isInitialSetup: false }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) })] }));
125
+ return (jsxs("div", { className: classNames('confirm-passkey-view'), children: [jsx(ModalHeader, { alignContent: 'bottom', children: jsx("div", { className: 'confirm-passkey-view__header', children: jsx(Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'confirm-passkey-view__title', copykey: 'dyn_mfa.confirm_passkey_view.title', children: t('dyn_mfa.confirm_passkey_view.title') }) }) }), jsx(ModalHeaderBanner, { type: 'error', messageKey: errorMessage, className: 'confirm-passkey-view__header-banner' }), jsxs("div", { className: classNames('confirm-passkey-view__content'), children: [jsx(IconWithSpinner, { Icon: SvgFingerprint, iconSize: 96, isSpinning: isLoading, treatAsFunctionComponent: true }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: classNames('confirm-passkey-view__description'), copykey: 'dyn_mfa.confirm_passkey_view.description', children: t('dyn_mfa.confirm_passkey_view.description') })] }), jsx("div", { className: 'confirm-passkey-view__choose-another-method', children: jsx(TextButton, { className: 'confirm-passkey-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', {
126
+ createMfaToken,
127
+ isInitialSetup: false,
128
+ }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) })] }));
117
129
  };
118
130
 
119
131
  export { ConfirmPasskeyView };
@@ -3,8 +3,10 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
+ var _tslib = require('../../../../../_virtual/_tslib.cjs');
6
7
  var jsxRuntime = require('react/jsx-runtime');
7
8
  var reactI18next = require('react-i18next');
9
+ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
8
10
  var classNames = require('../../../utils/functions/classNames/classNames.cjs');
9
11
  require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
10
12
  require('react');
@@ -12,8 +14,6 @@ var arrowLeft = require('../../../shared/assets/arrow-left.cjs');
12
14
  var fingerprint = require('../../../shared/assets/fingerprint.cjs');
13
15
  require('@dynamic-labs/iconic');
14
16
  var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
15
- require('../../../../../_virtual/_tslib.cjs');
16
- require('@dynamic-labs/sdk-api-core');
17
17
  require('../../../shared/logger.cjs');
18
18
  require('@dynamic-labs/wallet-connector-core');
19
19
  require('@dynamic-labs/wallet-book');
@@ -26,6 +26,7 @@ require('../../../events/dynamicEvents.cjs');
26
26
  require('../../../context/DynamicContext/DynamicContext.cjs');
27
27
  require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
28
28
  require('../../../store/state/authMode/authMode.cjs');
29
+ var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
29
30
  require('../../../context/CaptchaContext/CaptchaContext.cjs');
30
31
  require('../../../context/ErrorContext/ErrorContext.cjs');
31
32
  require('@dynamic-labs/multi-wallet');
@@ -114,9 +115,20 @@ require('../../../components/Popper/PopperContext/PopperContext.cjs');
114
115
 
115
116
  const SetupPasskeyView = () => {
116
117
  const { t } = reactI18next.useTranslation();
117
- const { pushView, goBack, canGoBack } = ViewContext.useViewContext();
118
+ const { clearStackAndPush, pushView, goBack, canGoBack } = ViewContext.useViewContext();
119
+ const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
118
120
  const registerPasskey = useRegisterPasskey.useRegisterPasskey();
119
- const { error, isLoading } = usePromise.usePromise(registerPasskey);
121
+ const { error, isLoading } = usePromise.usePromise(registerPasskey, {
122
+ initialData: undefined,
123
+ onResolve: (verifyResponse) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
124
+ if ((verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.user.mfaBackupCodeAcknowledgement) ===
125
+ sdkApiCore.MfaBackupCodeAcknowledgement.Pending) {
126
+ clearStackAndPush('mfa-display-backup-codes');
127
+ return;
128
+ }
129
+ setShowAuthFlow(false);
130
+ }),
131
+ });
120
132
  const errorMessage = useGetPasskeyErrorMessage.useGetPasskeyErrorMessage(error);
121
133
  const backButton = canGoBack && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: goBack, "data-testid": 'back-button', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
122
134
  return (jsxRuntime.jsxs("div", { className: classNames.classNames('setup-passkey-view'), children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { alignContent: 'bottom', leading: backButton, children: jsxRuntime.jsx("div", { className: 'setup-passkey-view__header', children: jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'setup-passkey-view__title', copykey: 'dyn_mfa.setup_passkey_view.title', children: t('dyn_mfa.setup_passkey_view.title') }) }) }), jsxRuntime.jsx(ModalHeaderBanner.ModalHeaderBanner, { type: 'error', messageKey: errorMessage, className: 'setup-passkey-view__header-banner' }), jsxRuntime.jsxs("div", { className: classNames.classNames('setup-passkey-view__content'), children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: fingerprint.ReactComponent, iconSize: 96, isSpinning: isLoading, treatAsFunctionComponent: true }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: classNames.classNames('setup-passkey-view__description'), copykey: 'dyn_mfa.setup_passkey_view.description', children: t('dyn_mfa.setup_passkey_view.description') })] }), jsxRuntime.jsx("div", { className: 'setup-passkey-view__choose-another-method', children: jsxRuntime.jsx(TextButton.TextButton, { className: 'setup-passkey-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', { isInitialSetup: true }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) })] }));
@@ -1,6 +1,8 @@
1
1
  'use client'
2
+ import { __awaiter } from '../../../../../_virtual/_tslib.js';
2
3
  import { jsx, jsxs } from 'react/jsx-runtime';
3
4
  import { useTranslation } from 'react-i18next';
5
+ import { MfaBackupCodeAcknowledgement } from '@dynamic-labs/sdk-api-core';
4
6
  import { classNames } from '../../../utils/functions/classNames/classNames.js';
5
7
  import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
6
8
  import 'react';
@@ -8,8 +10,6 @@ import { ReactComponent as SvgArrowLeft } from '../../../shared/assets/arrow-lef
8
10
  import { ReactComponent as SvgFingerprint } from '../../../shared/assets/fingerprint.js';
9
11
  import '@dynamic-labs/iconic';
10
12
  import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
11
- import '../../../../../_virtual/_tslib.js';
12
- import '@dynamic-labs/sdk-api-core';
13
13
  import '../../../shared/logger.js';
14
14
  import '@dynamic-labs/wallet-connector-core';
15
15
  import '@dynamic-labs/wallet-book';
@@ -22,6 +22,7 @@ import '../../../events/dynamicEvents.js';
22
22
  import '../../../context/DynamicContext/DynamicContext.js';
23
23
  import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
24
24
  import '../../../store/state/authMode/authMode.js';
25
+ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
25
26
  import '../../../context/CaptchaContext/CaptchaContext.js';
26
27
  import '../../../context/ErrorContext/ErrorContext.js';
27
28
  import '@dynamic-labs/multi-wallet';
@@ -110,9 +111,20 @@ import '../../../components/Popper/PopperContext/PopperContext.js';
110
111
 
111
112
  const SetupPasskeyView = () => {
112
113
  const { t } = useTranslation();
113
- const { pushView, goBack, canGoBack } = useViewContext();
114
+ const { clearStackAndPush, pushView, goBack, canGoBack } = useViewContext();
115
+ const { setShowAuthFlow } = useInternalDynamicContext();
114
116
  const registerPasskey = useRegisterPasskey();
115
- const { error, isLoading } = usePromise(registerPasskey);
117
+ const { error, isLoading } = usePromise(registerPasskey, {
118
+ initialData: undefined,
119
+ onResolve: (verifyResponse) => __awaiter(void 0, void 0, void 0, function* () {
120
+ if ((verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.user.mfaBackupCodeAcknowledgement) ===
121
+ MfaBackupCodeAcknowledgement.Pending) {
122
+ clearStackAndPush('mfa-display-backup-codes');
123
+ return;
124
+ }
125
+ setShowAuthFlow(false);
126
+ }),
127
+ });
116
128
  const errorMessage = useGetPasskeyErrorMessage(error);
117
129
  const backButton = canGoBack && (jsx(IconButton, { type: 'button', onClick: goBack, "data-testid": 'back-button', children: jsx(SvgArrowLeft, {}) }));
118
130
  return (jsxs("div", { className: classNames('setup-passkey-view'), children: [jsx(ModalHeader, { alignContent: 'bottom', leading: backButton, children: jsx("div", { className: 'setup-passkey-view__header', children: jsx(Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'setup-passkey-view__title', copykey: 'dyn_mfa.setup_passkey_view.title', children: t('dyn_mfa.setup_passkey_view.title') }) }) }), jsx(ModalHeaderBanner, { type: 'error', messageKey: errorMessage, className: 'setup-passkey-view__header-banner' }), jsxs("div", { className: classNames('setup-passkey-view__content'), children: [jsx(IconWithSpinner, { Icon: SvgFingerprint, iconSize: 96, isSpinning: isLoading, treatAsFunctionComponent: true }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: classNames('setup-passkey-view__description'), copykey: 'dyn_mfa.setup_passkey_view.description', children: t('dyn_mfa.setup_passkey_view.description') })] }), jsx("div", { className: 'setup-passkey-view__choose-another-method', children: jsx(TextButton, { className: 'setup-passkey-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', { isInitialSetup: true }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) })] }));
@@ -56,7 +56,7 @@ export declare const viewToComponentMap: {
56
56
  uri: string;
57
57
  secret: string;
58
58
  }) => JSX.Element;
59
- 'mfa-verification': ({ type, isInitialSetup, showBackButton, deviceId, }: import("./MfaVerificationView").MfaVerificationViewProps) => JSX.Element;
59
+ 'mfa-verification': ({ type, isInitialSetup, showBackButton, createMfaToken, deviceId, }: import("./MfaVerificationView").MfaVerificationViewProps) => JSX.Element;
60
60
  'mobile-wallet-redirect-view': import("react").FC<{
61
61
  onRetry: VoidFunction;
62
62
  connector?: import("dist/packages/wallet-connector-core/src").WalletConnector | undefined;
@@ -68,7 +68,9 @@ export declare const viewToComponentMap: {
68
68
  'network-not-supported-manual': import("react").FC;
69
69
  'no-access': () => JSX.Element;
70
70
  'no-qr-not-installed': () => JSX.Element | null;
71
- 'passkey-confirm': () => JSX.Element;
71
+ 'passkey-confirm': ({ createMfaToken, }: {
72
+ createMfaToken?: boolean | undefined;
73
+ }) => JSX.Element;
72
74
  'passkey-intro': import("react").FC<{
73
75
  chains?: import("@dynamic-labs/sdk-api-core").EmbeddedWalletChainEnum[] | undefined;
74
76
  }>;
@@ -4,10 +4,10 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
+ var reactI18next = require('react-i18next');
7
8
  var walletBook = require('@dynamic-labs/wallet-book');
8
9
  require('@dynamic-labs/utils');
9
10
  require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
10
- require('react-i18next');
11
11
  require('react');
12
12
  require('@dynamic-labs/iconic');
13
13
  require('../../../../context/ViewContext/ViewContext.cjs');
@@ -109,7 +109,12 @@ require('react-focus-lock');
109
109
 
110
110
  const PendingAccountSwitchToLinkContent = () => {
111
111
  const { selectedWalletConnector } = useInternalDynamicContext.useInternalDynamicContext();
112
- return (jsxRuntime.jsx(DefaultPromptModal.DefaultPromptLayout, { dataTestId: 'pending-account-switch', icon: jsxRuntime.jsx(walletBook.WalletIcon, { icon: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.metadata.icon, walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key }), title: `Wallet is already linked, switch wallet in ${selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name}`, children: jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', children: ["To link a new wallet, open", ' ', jsxRuntime.jsx(Typography.Typography, { as: 'span', weight: 'medium', color: 'primary', children: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name }), ' ', "and switch to the account you want to link."] }) }));
112
+ const { t } = reactI18next.useTranslation();
113
+ return (jsxRuntime.jsx(DefaultPromptModal.DefaultPromptLayout, { dataTestId: 'pending-account-switch', icon: jsxRuntime.jsx(walletBook.WalletIcon, { icon: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.metadata.icon, walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key }), title: t('dyn_pending_account_switch_to_link.title', {
114
+ walletName: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
115
+ }), children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', copykey: 'dyn_pending_account_switch_to_link.description', children: t('dyn_pending_account_switch_to_link.description', {
116
+ walletName: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
117
+ }) }) }));
113
118
  };
114
119
  const PendingAccountSwitchToLinkWidgetPortal = () => (jsxRuntime.jsx(WidgetPortal.WidgetPortal, { onClose: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt(), children: jsxRuntime.jsx(PendingAccountSwitchToLinkContent, {}) }));
115
120
  const PendingAccountSwitchToLinkModal = () => (jsxRuntime.jsx(PromptModal.PromptModal, { onClose: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt(), children: jsxRuntime.jsx(PendingAccountSwitchToLinkContent, {}) }));
@@ -1,9 +1,9 @@
1
1
  'use client'
2
- import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useTranslation } from 'react-i18next';
3
4
  import { WalletIcon } from '@dynamic-labs/wallet-book';
4
5
  import '@dynamic-labs/utils';
5
6
  import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
6
- import 'react-i18next';
7
7
  import 'react';
8
8
  import '@dynamic-labs/iconic';
9
9
  import '../../../../context/ViewContext/ViewContext.js';
@@ -105,7 +105,12 @@ import 'react-focus-lock';
105
105
 
106
106
  const PendingAccountSwitchToLinkContent = () => {
107
107
  const { selectedWalletConnector } = useInternalDynamicContext();
108
- return (jsx(DefaultPromptLayout, { dataTestId: 'pending-account-switch', icon: jsx(WalletIcon, { icon: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.metadata.icon, walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key }), title: `Wallet is already linked, switch wallet in ${selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name}`, children: jsxs(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', children: ["To link a new wallet, open", ' ', jsx(Typography, { as: 'span', weight: 'medium', color: 'primary', children: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name }), ' ', "and switch to the account you want to link."] }) }));
108
+ const { t } = useTranslation();
109
+ return (jsx(DefaultPromptLayout, { dataTestId: 'pending-account-switch', icon: jsx(WalletIcon, { icon: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.metadata.icon, walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key }), title: t('dyn_pending_account_switch_to_link.title', {
110
+ walletName: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
111
+ }), children: jsx(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', copykey: 'dyn_pending_account_switch_to_link.description', children: t('dyn_pending_account_switch_to_link.description', {
112
+ walletName: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
113
+ }) }) }));
109
114
  };
110
115
  const PendingAccountSwitchToLinkWidgetPortal = () => (jsx(WidgetPortal, { onClose: useCloseMultiWalletPrompt(), children: jsx(PendingAccountSwitchToLinkContent, {}) }));
111
116
  const PendingAccountSwitchToLinkModal = () => (jsx(PromptModal, { onClose: useCloseMultiWalletPrompt(), children: jsx(PendingAccountSwitchToLinkContent, {}) }));