@dynamic-labs/sdk-react-core 4.67.0 → 4.67.2

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 (47) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +12 -12
  5. package/src/index.d.ts +1 -1
  6. package/src/lib/client/extension/functions/getExpiresAt/getExpiresAt.cjs +10 -0
  7. package/src/lib/client/extension/functions/getExpiresAt/getExpiresAt.js +6 -0
  8. package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +1 -1
  9. package/src/lib/components/IconWithSpinner/IconWithSpinner.js +1 -1
  10. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.cjs +31 -11
  11. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.js +31 -11
  12. package/src/lib/shared/utils/functions/chain/getChainIcon.cjs +1 -0
  13. package/src/lib/shared/utils/functions/chain/getChainIcon.js +2 -1
  14. package/src/lib/styles/index.shadow.cjs +1 -1
  15. package/src/lib/styles/index.shadow.js +1 -1
  16. package/src/lib/utils/constants/values.cjs +5 -0
  17. package/src/lib/utils/constants/values.js +5 -0
  18. package/src/lib/utils/functions/compareChains/compareChains.cjs +6 -0
  19. package/src/lib/utils/functions/compareChains/compareChains.js +6 -0
  20. package/src/lib/utils/hooks/index.d.ts +1 -1
  21. package/src/lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.d.ts +2 -1
  22. package/src/lib/utils/hooks/useMfa/useMfa.cjs +6 -3
  23. package/src/lib/utils/hooks/useMfa/useMfa.d.ts +5 -3
  24. package/src/lib/utils/hooks/useMfa/useMfa.js +6 -3
  25. package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.cjs +14 -185
  26. package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.d.ts +15 -3
  27. package/src/lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.js +14 -185
  28. package/src/lib/utils/hooks/useStepUpAuthentication/index.d.ts +1 -1
  29. package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.cjs +195 -24
  30. package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.d.ts +10 -0
  31. package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.js +189 -18
  32. package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.cjs +18 -5
  33. package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.js +18 -5
  34. package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +9 -1
  35. package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +9 -1
  36. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +10 -9
  37. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +10 -9
  38. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +4 -3
  39. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.d.ts +2 -0
  40. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +4 -3
  41. package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +3 -1
  42. package/src/lib/views/MfaVerificationView/MfaVerificationView.d.ts +3 -2
  43. package/src/lib/views/MfaVerificationView/MfaVerificationView.js +3 -1
  44. package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.cjs +2 -1
  45. package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.d.ts +3 -1
  46. package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.js +2 -1
  47. package/src/lib/views/viewToComponentMap.d.ts +3 -2
@@ -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
 
@@ -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;