@dynamic-labs/sdk-react-core 4.66.0 → 4.67.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/package.cjs +3 -3
  3. package/package.js +3 -3
  4. package/package.json +14 -14
  5. package/src/index.d.ts +1 -1
  6. package/src/lib/client/extension/functions/hasElevatedAccessToken/hasElevatedAccessToken.cjs +18 -0
  7. package/src/lib/client/extension/functions/hasElevatedAccessToken/hasElevatedAccessToken.d.ts +1 -0
  8. package/src/lib/client/extension/functions/hasElevatedAccessToken/hasElevatedAccessToken.js +14 -0
  9. package/src/lib/client/extension/functions/hasElevatedAccessToken/index.d.ts +1 -0
  10. package/src/lib/client/extension/index.d.ts +1 -0
  11. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.cjs +31 -11
  12. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.js +31 -11
  13. package/src/lib/context/DynamicContext/DynamicContext.cjs +20 -19
  14. package/src/lib/context/DynamicContext/DynamicContext.js +20 -19
  15. package/src/lib/context/DynamicContext/types/SettingsOverrides.d.ts +10 -0
  16. package/src/lib/shared/utils/functions/chain/getChainIcon.cjs +1 -0
  17. package/src/lib/shared/utils/functions/chain/getChainIcon.js +2 -1
  18. package/src/lib/styles/index.shadow.cjs +1 -1
  19. package/src/lib/styles/index.shadow.js +1 -1
  20. package/src/lib/utils/constants/values.cjs +2 -0
  21. package/src/lib/utils/constants/values.js +2 -0
  22. package/src/lib/utils/functions/compareChains/compareChains.cjs +1 -0
  23. package/src/lib/utils/functions/compareChains/compareChains.js +1 -0
  24. package/src/lib/utils/hooks/index.d.ts +1 -1
  25. package/src/lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.d.ts +2 -1
  26. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +2 -1
  27. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +2 -1
  28. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +2 -1
  29. package/src/lib/utils/hooks/useMfa/useMfa.cjs +6 -3
  30. package/src/lib/utils/hooks/useMfa/useMfa.d.ts +5 -3
  31. package/src/lib/utils/hooks/useMfa/useMfa.js +6 -3
  32. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs +7 -2
  33. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.d.ts +2 -1
  34. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js +7 -2
  35. package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.cjs +14 -185
  36. package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.d.ts +15 -3
  37. package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.js +14 -185
  38. package/src/lib/utils/hooks/useStepUpAuthentication/index.d.ts +1 -1
  39. package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.cjs +283 -33
  40. package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.d.ts +45 -15
  41. package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.js +279 -29
  42. package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.cjs +3 -2
  43. package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.js +3 -2
  44. package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.cjs +10 -6
  45. package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.js +11 -7
  46. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +10 -9
  47. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +10 -9
  48. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +4 -3
  49. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.d.ts +2 -0
  50. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +4 -3
  51. package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +3 -1
  52. package/src/lib/views/MfaVerificationView/MfaVerificationView.d.ts +3 -2
  53. package/src/lib/views/MfaVerificationView/MfaVerificationView.js +3 -1
  54. package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.cjs +2 -1
  55. package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.d.ts +3 -1
  56. package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.js +2 -1
  57. package/src/lib/views/SendBalanceView/SendBalanceView.cjs +1 -0
  58. package/src/lib/views/SendBalanceView/SendBalanceView.js +1 -0
  59. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +21 -1
  60. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +21 -1
  61. package/src/lib/views/WalletList/data.cjs +1 -0
  62. package/src/lib/views/WalletList/data.d.ts +1 -1
  63. package/src/lib/views/WalletList/data.js +1 -0
  64. package/src/lib/views/viewToComponentMap.d.ts +3 -2
@@ -241,15 +241,16 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
241
241
  }
242
242
  return baseClass;
243
243
  };
244
- const contentHeader = (jsxs("div", { children: [primaryWallet &&
245
- isSmartWallet(primaryWallet) &&
246
- !isLoading &&
247
- data &&
248
- !error && (jsxs("div", { className: 'embedded-reveal-view__zerodev-warning', children: [jsxs("div", { className: 'embedded-reveal-view__zerodev-warning__title-row', children: [jsx(SvgInfo, { className: 'embedded-reveal-view__zerodev-warning__icon' }), jsx(Typography, { variant: 'body_normal', weight: 'bold', copykey: 'dyn_embedded_reveal.aa_warning.title', children: t('dyn_embedded_reveal.aa_warning.title') })] }), jsxs(Typography, { variant: 'body_normal', weight: 'regular', copykey: 'dyn_embedded_reveal.aa_warning.subtitle', children: [t('dyn_embedded_reveal.aa_warning.subtitle'), jsx("button", { onClick: () => {
249
- setShowAuthFlow(false);
250
- setDynamicWidgetView('send-balance');
251
- }, className: 'embedded-reveal-view__zerodev-warning__link-button', children: jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'primary', className: 'underline', copykey: 'dyn_embedded_reveal.aa_warning.button', children: t('dyn_embedded_reveal.aa_warning.button') }) })] })] })), jsx("div", { className: 'embedded-reveal-view__body__description', children: !hasInjectedCredential && (jsx("div", { className: 'embedded-reveal-view__header', children: jsx("div", { className: 'embedded-reveal-view__header__hero', children: jsx(SvgExportEmbeddedHero, {}) }) })) })] }));
252
- return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: isPromptForExport ? null : 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: getBodyClassName(), children: [(!isWaasWallet ||
244
+ const isEip7702SmartWallet = Boolean(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id.endsWith('-zerodev'));
245
+ const isErc4337SmartWallet = Boolean(primaryWallet && isSmartWallet(primaryWallet)) &&
246
+ !isEip7702SmartWallet;
247
+ const shouldShowAaWarning = isErc4337SmartWallet && !isLoading && Boolean(data) && !error;
248
+ const aaWarning = shouldShowAaWarning && (jsxs("div", { className: 'embedded-reveal-view__zerodev-warning', children: [jsxs("div", { className: 'embedded-reveal-view__zerodev-warning__title-row', children: [jsx(SvgInfo, { className: 'embedded-reveal-view__zerodev-warning__icon' }), jsx(Typography, { variant: 'body_normal', weight: 'bold', copykey: 'dyn_embedded_reveal.aa_warning.title', children: t('dyn_embedded_reveal.aa_warning.title') })] }), jsxs(Typography, { variant: 'body_normal', weight: 'regular', copykey: 'dyn_embedded_reveal.aa_warning.subtitle', children: [t('dyn_embedded_reveal.aa_warning.subtitle'), jsx("button", { onClick: () => {
249
+ setShowAuthFlow(false);
250
+ setDynamicWidgetView('send-balance');
251
+ }, className: 'embedded-reveal-view__zerodev-warning__link-button', children: jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'primary', className: 'underline', copykey: 'dyn_embedded_reveal.aa_warning.button', children: t('dyn_embedded_reveal.aa_warning.button') }) })] })] }));
252
+ const contentHeader = (jsx("div", { children: jsx("div", { className: 'embedded-reveal-view__body__description', children: !hasInjectedCredential && (jsx("div", { className: 'embedded-reveal-view__header', children: jsx("div", { className: 'embedded-reveal-view__header__hero', children: jsx(SvgExportEmbeddedHero, {}) }) })) }) }));
253
+ return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: isPromptForExport ? null : 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: getBodyClassName(), children: [aaWarning, (!isWaasWallet ||
253
254
  !hasInjectedCredential ||
254
255
  title !== credentialTitle) &&
255
256
  contentHeader, (isTurnkeyWallet || isWaasWallet) && (jsx(EmbeddedWalletExport, { wallet: wallet, isTurnkeyWallet: isTurnkeyWallet, isWaasWallet: isWaasWallet, data: data, onIframeContainerRef: setIframeContainerRef, isVisible: !title.includes('Agree') })), hasInjectedCredential ? (jsxs(Fragment, { children: [jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', onClick: () => {
@@ -115,7 +115,7 @@ require('../../components/IsBrowser/IsBrowser.cjs');
115
115
  require('../../components/Popper/Popper/Popper.cjs');
116
116
  require('../../components/Popper/PopperContext/PopperContext.cjs');
117
117
 
118
- const MfaChooseDeviceView = ({ isInitialSetup = true, createMfaToken = false, }) => {
118
+ const MfaChooseDeviceView = ({ isInitialSetup = true, createMfaToken = false, requestedScopes, }) => {
119
119
  const { handleLogOut } = useDynamicContext.useDynamicContext();
120
120
  const { t } = reactI18next.useTranslation();
121
121
  const { pushView } = ViewContext.useViewContext();
@@ -139,14 +139,14 @@ const MfaChooseDeviceView = ({ isInitialSetup = true, createMfaToken = false, })
139
139
  singleUse: true,
140
140
  }
141
141
  : undefined;
142
- // we're calling authenticatePasskeyMFA here because we don't want
143
- // it to be called twice by the usePromise in the confirmPasskey view
144
142
  const authenticatePasskeyPromise = authenticatePasskeyMFA({
145
143
  createMfaToken: createMfaTokenOptions,
144
+ requestedScopes,
146
145
  });
147
146
  pushView('passkey-confirm', {
148
147
  authenticatePasskeyPromise,
149
148
  createMfaToken,
149
+ requestedScopes,
150
150
  });
151
151
  };
152
152
  const handleTotpClick = () => {
@@ -160,6 +160,7 @@ const MfaChooseDeviceView = ({ isInitialSetup = true, createMfaToken = false, })
160
160
  pushView('mfa-verification', {
161
161
  createMfaToken,
162
162
  isInitialSetup,
163
+ requestedScopes,
163
164
  showBackButton: true,
164
165
  type: sdkApiCore.MFADeviceType.Totp,
165
166
  });
@@ -1,6 +1,8 @@
1
1
  import { FC } from 'react';
2
+ import type { TokenScope } from '@dynamic-labs/sdk-api-core';
2
3
  export type MfaChooseDeviceViewProps = {
3
4
  isInitialSetup?: boolean;
4
5
  createMfaToken?: boolean;
6
+ requestedScopes?: TokenScope[];
5
7
  };
6
8
  export declare const MfaChooseDeviceView: FC<MfaChooseDeviceViewProps>;
@@ -111,7 +111,7 @@ import '../../components/IsBrowser/IsBrowser.js';
111
111
  import '../../components/Popper/Popper/Popper.js';
112
112
  import '../../components/Popper/PopperContext/PopperContext.js';
113
113
 
114
- const MfaChooseDeviceView = ({ isInitialSetup = true, createMfaToken = false, }) => {
114
+ const MfaChooseDeviceView = ({ isInitialSetup = true, createMfaToken = false, requestedScopes, }) => {
115
115
  const { handleLogOut } = useDynamicContext();
116
116
  const { t } = useTranslation();
117
117
  const { pushView } = useViewContext();
@@ -135,14 +135,14 @@ const MfaChooseDeviceView = ({ isInitialSetup = true, createMfaToken = false, })
135
135
  singleUse: true,
136
136
  }
137
137
  : undefined;
138
- // we're calling authenticatePasskeyMFA here because we don't want
139
- // it to be called twice by the usePromise in the confirmPasskey view
140
138
  const authenticatePasskeyPromise = authenticatePasskeyMFA({
141
139
  createMfaToken: createMfaTokenOptions,
140
+ requestedScopes,
142
141
  });
143
142
  pushView('passkey-confirm', {
144
143
  authenticatePasskeyPromise,
145
144
  createMfaToken,
145
+ requestedScopes,
146
146
  });
147
147
  };
148
148
  const handleTotpClick = () => {
@@ -156,6 +156,7 @@ const MfaChooseDeviceView = ({ isInitialSetup = true, createMfaToken = false, })
156
156
  pushView('mfa-verification', {
157
157
  createMfaToken,
158
158
  isInitialSetup,
159
+ requestedScopes,
159
160
  showBackButton: true,
160
161
  type: MFADeviceType.Totp,
161
162
  });
@@ -112,7 +112,7 @@ require('../../components/IsBrowser/IsBrowser.cjs');
112
112
  require('../../components/Popper/Popper/Popper.cjs');
113
113
  require('../../components/Popper/PopperContext/PopperContext.cjs');
114
114
 
115
- const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = false, createMfaToken = false, deviceId, }) => {
115
+ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = false, createMfaToken = false, deviceId, requestedScopes, }) => {
116
116
  const { t } = reactI18next.useTranslation();
117
117
  const { handleLogOut } = useDynamicContext.useDynamicContext();
118
118
  const { clearStackAndPush, pushView, goBack, canGoBack } = ViewContext.useViewContext();
@@ -130,6 +130,7 @@ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = fa
130
130
  code,
131
131
  createMfaToken: createMfaTokenOptions,
132
132
  deviceId,
133
+ requestedScopes,
133
134
  type,
134
135
  });
135
136
  }, {
@@ -164,6 +165,7 @@ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = fa
164
165
  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.jsxs("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', {
165
166
  createMfaToken,
166
167
  isInitialSetup,
168
+ requestedScopes,
167
169
  }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }), jsxRuntime.jsx(TextButton.TextButton, { onClick: handleLogOut, copykey: 'dyn_mfa.otp_verification_view.logout', children: t('dyn_mfa.otp_verification_view.logout') })] }))] }));
168
170
  };
169
171
 
@@ -1,10 +1,11 @@
1
1
  /// <reference types="react" />
2
- import { MFADeviceType } from '@dynamic-labs/sdk-api-core';
2
+ import { MFADeviceType, TokenScope } from '@dynamic-labs/sdk-api-core';
3
3
  export type MfaVerificationViewProps = {
4
4
  deviceId?: string;
5
5
  type?: MFADeviceType;
6
6
  isInitialSetup?: boolean;
7
7
  showBackButton?: boolean;
8
8
  createMfaToken?: boolean;
9
+ requestedScopes?: TokenScope[];
9
10
  };
10
- export declare const MfaVerificationView: ({ type, isInitialSetup, showBackButton, createMfaToken, deviceId, }: MfaVerificationViewProps) => JSX.Element;
11
+ export declare const MfaVerificationView: ({ type, isInitialSetup, showBackButton, createMfaToken, deviceId, requestedScopes, }: MfaVerificationViewProps) => JSX.Element;
@@ -108,7 +108,7 @@ import '../../components/IsBrowser/IsBrowser.js';
108
108
  import '../../components/Popper/Popper/Popper.js';
109
109
  import '../../components/Popper/PopperContext/PopperContext.js';
110
110
 
111
- const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = false, createMfaToken = false, deviceId, }) => {
111
+ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = false, createMfaToken = false, deviceId, requestedScopes, }) => {
112
112
  const { t } = useTranslation();
113
113
  const { handleLogOut } = useDynamicContext();
114
114
  const { clearStackAndPush, pushView, goBack, canGoBack } = useViewContext();
@@ -126,6 +126,7 @@ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = fa
126
126
  code,
127
127
  createMfaToken: createMfaTokenOptions,
128
128
  deviceId,
129
+ requestedScopes,
129
130
  type,
130
131
  });
131
132
  }, {
@@ -160,6 +161,7 @@ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = fa
160
161
  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 && (jsxs("div", { className: 'mfa-verification-view__choose-another-method', children: [jsx(TextButton, { className: 'mfa-verification-view__choose-another-method-button', onClick: () => pushView('mfa-choose-device', {
161
162
  createMfaToken,
162
163
  isInitialSetup,
164
+ requestedScopes,
163
165
  }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }), jsx(TextButton, { onClick: handleLogOut, copykey: 'dyn_mfa.otp_verification_view.logout', children: t('dyn_mfa.otp_verification_view.logout') })] }))] }));
164
166
  };
165
167
 
@@ -115,7 +115,7 @@ require('../../../components/IsBrowser/IsBrowser.cjs');
115
115
  require('../../../components/Popper/Popper/Popper.cjs');
116
116
  require('../../../components/Popper/PopperContext/PopperContext.cjs');
117
117
 
118
- const ConfirmPasskeyView = ({ createMfaToken = false, authenticatePasskeyPromise, }) => {
118
+ const ConfirmPasskeyView = ({ createMfaToken = false, authenticatePasskeyPromise, requestedScopes, }) => {
119
119
  const { t } = reactI18next.useTranslation();
120
120
  const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
121
121
  const { pushView } = ViewContext.useViewContext();
@@ -129,6 +129,7 @@ const ConfirmPasskeyView = ({ createMfaToken = false, authenticatePasskeyPromise
129
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
130
  createMfaToken,
131
131
  isInitialSetup: false,
132
+ requestedScopes,
132
133
  }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) })] }));
133
134
  };
134
135
 
@@ -1,7 +1,9 @@
1
1
  /// <reference types="react" />
2
+ import type { TokenScope } from '@dynamic-labs/sdk-api-core';
2
3
  type ConfirmPasskeyViewProps = {
3
4
  createMfaToken?: boolean;
4
5
  authenticatePasskeyPromise: Promise<string | undefined>;
6
+ requestedScopes?: TokenScope[];
5
7
  };
6
- export declare const ConfirmPasskeyView: ({ createMfaToken, authenticatePasskeyPromise, }: ConfirmPasskeyViewProps) => JSX.Element;
8
+ export declare const ConfirmPasskeyView: ({ createMfaToken, authenticatePasskeyPromise, requestedScopes, }: ConfirmPasskeyViewProps) => JSX.Element;
7
9
  export {};
@@ -111,7 +111,7 @@ import '../../../components/IsBrowser/IsBrowser.js';
111
111
  import '../../../components/Popper/Popper/Popper.js';
112
112
  import '../../../components/Popper/PopperContext/PopperContext.js';
113
113
 
114
- const ConfirmPasskeyView = ({ createMfaToken = false, authenticatePasskeyPromise, }) => {
114
+ const ConfirmPasskeyView = ({ createMfaToken = false, authenticatePasskeyPromise, requestedScopes, }) => {
115
115
  const { t } = useTranslation();
116
116
  const { setShowAuthFlow } = useInternalDynamicContext();
117
117
  const { pushView } = useViewContext();
@@ -125,6 +125,7 @@ const ConfirmPasskeyView = ({ createMfaToken = false, authenticatePasskeyPromise
125
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
126
  createMfaToken,
127
127
  isInitialSetup: false,
128
+ requestedScopes,
128
129
  }), copykey: 'dyn_mfa.otp_verification_view.choose_another_method', children: t('dyn_mfa.otp_verification_view.choose_another_method') }) })] }));
129
130
  };
130
131
 
@@ -128,6 +128,7 @@ const getTransactionValue = (transaction, isNativeToken) => {
128
128
  };
129
129
  const getSupportedChainName = (connectedChain) => {
130
130
  const supportedChains = {
131
+ ALEO: sdkApiCore.ChainEnum.Aleo,
131
132
  APTOS: sdkApiCore.ChainEnum.Aptos,
132
133
  BTC: sdkApiCore.ChainEnum.Btc,
133
134
  EVM: sdkApiCore.ChainEnum.Evm,
@@ -124,6 +124,7 @@ const getTransactionValue = (transaction, isNativeToken) => {
124
124
  };
125
125
  const getSupportedChainName = (connectedChain) => {
126
126
  const supportedChains = {
127
+ ALEO: ChainEnum.Aleo,
127
128
  APTOS: ChainEnum.Aptos,
128
129
  BTC: ChainEnum.Btc,
129
130
  EVM: ChainEnum.Evm,
@@ -151,6 +151,8 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
151
151
  status: SimulationStatus.LOADING,
152
152
  });
153
153
  const [recipient, setRecipient] = React.useState(undefined);
154
+ // Pre-submit validation error (e.g., Stellar account activation requirements)
155
+ const [preSubmitValidationError, setPreSubmitValidationError] = React.useState(undefined);
154
156
  const isFetchingSimulationRef = React.useRef(false);
155
157
  const fetchSimulationResult = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
156
158
  var _d, _e, _f, _g, _h, _j, _k;
@@ -278,6 +280,18 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
278
280
  }
279
281
  fetchSimulationResult();
280
282
  }, [fetchSimulationResult, primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, simulationState.status]);
283
+ // Check destination account for chains that require it (e.g., Stellar)
284
+ React.useEffect(() => {
285
+ const checkDestination = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
286
+ var _a;
287
+ if (transaction.checkDestinationAccount) {
288
+ yield transaction.checkDestinationAccount();
289
+ const error = (_a = transaction.getPreSubmitValidationError) === null || _a === void 0 ? void 0 : _a.call(transaction);
290
+ setPreSubmitValidationError(error);
291
+ }
292
+ });
293
+ checkDestination();
294
+ }, [transaction]);
281
295
  /**
282
296
  * Update transaction fee and trigger a react update
283
297
  * to reflect the new fee on the UI
@@ -348,6 +362,10 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
348
362
  const alert = React.useMemo(() => {
349
363
  if (errorMessage)
350
364
  return null;
365
+ // Check for pre-submit validation errors (e.g., Stellar account activation)
366
+ if (preSubmitValidationError) {
367
+ return (jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'current-color', "data-testid": 'presubmit_error_content', children: preSubmitValidationError }) }));
368
+ }
351
369
  // Check for gas sponsorship errors
352
370
  if (utils.TransactionGasCannotBeSponsoredError.isInstance(transactionError)) {
353
371
  return (jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', copykey: 'dyn_send_transaction.error_message.gas_not_sponsored', children: t('dyn_send_transaction.error_message.gas_not_sponsored') }));
@@ -389,6 +407,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
389
407
  transaction,
390
408
  isGasSponsored,
391
409
  hasInsufficientFunds,
410
+ preSubmitValidationError,
392
411
  t,
393
412
  currency === null || currency === void 0 ? void 0 : currency.symbol,
394
413
  ]);
@@ -413,7 +432,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
413
432
  alert,
414
433
  copykey,
415
434
  currentToken,
416
- disableSendButton: isBalanceLoading,
435
+ disableSendButton: isBalanceLoading || Boolean(preSubmitValidationError),
417
436
  displayPoweredByDynamicFooter,
418
437
  error: errorMessage,
419
438
  fetchTransactionFee,
@@ -462,6 +481,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
462
481
  simulationState.result,
463
482
  sendBalanceTransaction,
464
483
  fetchTransactionFee,
484
+ preSubmitValidationError,
465
485
  ]);
466
486
  return simulationState.status === SimulationStatus.LOADING ? null : (jsxRuntime.jsx(TransactionConfirmationPageLayout.TransactionConfirmationPageLayout, Object.assign({}, layoutProps)));
467
487
  };
@@ -143,6 +143,8 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
143
143
  status: SimulationStatus.LOADING,
144
144
  });
145
145
  const [recipient, setRecipient] = useState(undefined);
146
+ // Pre-submit validation error (e.g., Stellar account activation requirements)
147
+ const [preSubmitValidationError, setPreSubmitValidationError] = useState(undefined);
146
148
  const isFetchingSimulationRef = useRef(false);
147
149
  const fetchSimulationResult = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
148
150
  var _d, _e, _f, _g, _h, _j, _k;
@@ -270,6 +272,18 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
270
272
  }
271
273
  fetchSimulationResult();
272
274
  }, [fetchSimulationResult, primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, simulationState.status]);
275
+ // Check destination account for chains that require it (e.g., Stellar)
276
+ useEffect(() => {
277
+ const checkDestination = () => __awaiter(void 0, void 0, void 0, function* () {
278
+ var _a;
279
+ if (transaction.checkDestinationAccount) {
280
+ yield transaction.checkDestinationAccount();
281
+ const error = (_a = transaction.getPreSubmitValidationError) === null || _a === void 0 ? void 0 : _a.call(transaction);
282
+ setPreSubmitValidationError(error);
283
+ }
284
+ });
285
+ checkDestination();
286
+ }, [transaction]);
273
287
  /**
274
288
  * Update transaction fee and trigger a react update
275
289
  * to reflect the new fee on the UI
@@ -340,6 +354,10 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
340
354
  const alert = useMemo(() => {
341
355
  if (errorMessage)
342
356
  return null;
357
+ // Check for pre-submit validation errors (e.g., Stellar account activation)
358
+ if (preSubmitValidationError) {
359
+ return (jsx(Alert, { icon: 'error', variant: 'error', children: jsx(Typography, { variant: 'body_small', color: 'current-color', "data-testid": 'presubmit_error_content', children: preSubmitValidationError }) }));
360
+ }
343
361
  // Check for gas sponsorship errors
344
362
  if (TransactionGasCannotBeSponsoredError.isInstance(transactionError)) {
345
363
  return (jsx(Alert, { icon: 'error', variant: 'error', copykey: 'dyn_send_transaction.error_message.gas_not_sponsored', children: t('dyn_send_transaction.error_message.gas_not_sponsored') }));
@@ -381,6 +399,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
381
399
  transaction,
382
400
  isGasSponsored,
383
401
  hasInsufficientFunds,
402
+ preSubmitValidationError,
384
403
  t,
385
404
  currency === null || currency === void 0 ? void 0 : currency.symbol,
386
405
  ]);
@@ -405,7 +424,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
405
424
  alert,
406
425
  copykey,
407
426
  currentToken,
408
- disableSendButton: isBalanceLoading,
427
+ disableSendButton: isBalanceLoading || Boolean(preSubmitValidationError),
409
428
  displayPoweredByDynamicFooter,
410
429
  error: errorMessage,
411
430
  fetchTransactionFee,
@@ -454,6 +473,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
454
473
  simulationState.result,
455
474
  sendBalanceTransaction,
456
475
  fetchTransactionFee,
476
+ preSubmitValidationError,
457
477
  ]);
458
478
  return simulationState.status === SimulationStatus.LOADING ? null : (jsx(TransactionConfirmationPageLayout, Object.assign({}, layoutProps)));
459
479
  };
@@ -23,6 +23,7 @@ require('../../shared/consts/index.cjs');
23
23
  * getChainInfo differs from the one used in the wallet connectors
24
24
  */
25
25
  const chainInfoOverrides = {
26
+ aleo: 'ALEO',
26
27
  starknet: 'STARK',
27
28
  stellar: 'STELLAR',
28
29
  };
@@ -4,7 +4,7 @@ interface IChain {
4
4
  enabled: boolean;
5
5
  name: string;
6
6
  }
7
- export declare const getEnabledChains: (chains: IChain[]) => ("STARK" | "STELLAR" | "ALGO" | "APTOS" | "ATOM" | "BTC" | "COSMOS" | "ECLIPSE" | "ETH" | "EVM" | "FLOW" | "SOL" | "SPARK" | "SUI" | "TRON" | "TON")[];
7
+ export declare const getEnabledChains: (chains: IChain[]) => ("ALEO" | "STARK" | "STELLAR" | "ALGO" | "APTOS" | "ATOM" | "BTC" | "COSMOS" | "ECLIPSE" | "ETH" | "EVM" | "FLOW" | "SOL" | "SPARK" | "SUI" | "TRON" | "TON")[];
8
8
  type BaseGetSupportedWalletOpts = Omit<GetSupportedWalletsOpts, 'walletConnectProjectId' | 'chainRpcProviders'>;
9
9
  export declare const getWallets: (props: {
10
10
  getSupportedWalletOpts: BaseGetSupportedWalletOpts;
@@ -19,6 +19,7 @@ import '../../shared/consts/index.js';
19
19
  * getChainInfo differs from the one used in the wallet connectors
20
20
  */
21
21
  const chainInfoOverrides = {
22
+ aleo: 'ALEO',
22
23
  starknet: 'STARK',
23
24
  stellar: 'STELLAR',
24
25
  };
@@ -58,7 +58,7 @@ export declare const viewToComponentMap: {
58
58
  uri: string;
59
59
  secret: string;
60
60
  }) => JSX.Element;
61
- 'mfa-verification': ({ type, isInitialSetup, showBackButton, createMfaToken, deviceId, }: import("./MfaVerificationView").MfaVerificationViewProps) => JSX.Element;
61
+ 'mfa-verification': ({ type, isInitialSetup, showBackButton, createMfaToken, deviceId, requestedScopes, }: import("./MfaVerificationView").MfaVerificationViewProps) => JSX.Element;
62
62
  'mobile-wallet-redirect-view': import("react").FC<{
63
63
  onRetry: VoidFunction;
64
64
  connector?: import("dist/packages/wallet-connector-core/src").WalletConnector | undefined;
@@ -70,9 +70,10 @@ export declare const viewToComponentMap: {
70
70
  'network-not-supported-manual': import("react").FC;
71
71
  'no-access': () => JSX.Element;
72
72
  'no-qr-not-installed': () => JSX.Element | null;
73
- 'passkey-confirm': ({ createMfaToken, authenticatePasskeyPromise, }: {
73
+ 'passkey-confirm': ({ createMfaToken, authenticatePasskeyPromise, requestedScopes, }: {
74
74
  createMfaToken?: boolean | undefined;
75
75
  authenticatePasskeyPromise: Promise<string | undefined>;
76
+ requestedScopes?: import("@dynamic-labs/sdk-api-core").TokenScope[] | undefined;
76
77
  }) => JSX.Element;
77
78
  'passkey-intro': import("react").FC<{
78
79
  chains?: import("@dynamic-labs/sdk-api-core").EmbeddedWalletChainEnum[] | undefined;