@dynamic-labs/sdk-react-core 4.72.0 → 4.73.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.
- package/CHANGELOG.md +28 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/index.d.ts +1 -1
- package/src/lib/client/extension/hooks/useInitializeSdkClient/syncEvents/syncEvents.cjs +2 -2
- package/src/lib/client/extension/hooks/useInitializeSdkClient/syncEvents/syncEvents.js +2 -2
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +7 -5
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.d.ts +2 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +7 -5
- package/src/lib/context/ErrorContext/hooks/useErrorText/useErrorText.cjs +1 -0
- package/src/lib/context/ErrorContext/hooks/useErrorText/useErrorText.js +2 -1
- package/src/lib/data/api/utils.cjs +31 -4
- package/src/lib/data/api/utils.js +31 -4
- package/src/lib/events/auth.d.ts +2 -1
- package/src/lib/shared/assets/backupArrow.cjs +1 -1
- package/src/lib/shared/assets/backupArrow.js +1 -1
- package/src/lib/shared/assets/export-private-key.cjs +1 -2
- package/src/lib/shared/assets/export-private-key.js +1 -2
- package/src/lib/shared/assets/export-recovery-phrase.cjs +1 -2
- package/src/lib/shared/assets/export-recovery-phrase.js +1 -2
- package/src/lib/shared/assets/face-id.cjs +1 -1
- package/src/lib/shared/assets/face-id.js +1 -1
- package/src/lib/shared/assets/lock.cjs +1 -2
- package/src/lib/shared/assets/lock.js +1 -2
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.types.d.ts +5 -1
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpOtp.cjs +6 -10
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpOtp.d.ts +2 -2
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpOtp.js +6 -10
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpWallet.cjs +9 -3
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpWallet.js +9 -3
- package/src/lib/utils/hooks/useSyncDeviceRegistrationFlow/useSyncDeviceRegistrationFlow.cjs +3 -3
- package/src/lib/utils/hooks/useSyncDeviceRegistrationFlow/useSyncDeviceRegistrationFlow.js +3 -3
- package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.cjs +1 -1
- package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.d.ts +2 -1
- package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.js +1 -1
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +2 -2
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.d.ts +2 -1
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.cjs +2 -3
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.js +2 -3
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.cjs +2 -3
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.js +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.73.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.73.1...v4.73.2) (2026-03-31)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* use initial URL for device registration redirect detection ([#10821](https://github.com/dynamic-labs/dynamic-auth/issues/10821)) ([dbec178](https://github.com/dynamic-labs/dynamic-auth/commit/dbec178e0bad9a7e99c529b79cb0fbe0fd347904))
|
|
8
|
+
|
|
9
|
+
### [4.73.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.73.0...v4.73.1) (2026-03-30)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **tempo:** add isTempoWallet type guard and TempoWallet class ([#10814](https://github.com/dynamic-labs/dynamic-auth/issues/10814)) ([1f2ec94](https://github.com/dynamic-labs/dynamic-auth/commit/1f2ec949bcfd25b2c460e07214041d06b172f12d))
|
|
15
|
+
|
|
16
|
+
## [4.73.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.72.0...v4.73.0) (2026-03-30)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* allow passing credentialId at call time for step-up auth methods ([#10795](https://github.com/dynamic-labs/dynamic-auth/issues/10795)) ([9746667](https://github.com/dynamic-labs/dynamic-auth/commit/974666758ad8b01584cf30efbf2cb64dbde63986))
|
|
22
|
+
* **waas:** preserve WaaS key shares on session expiry using LogoutReason ([#10714](https://github.com/dynamic-labs/dynamic-auth/issues/10714)) ([26f40f7](https://github.com/dynamic-labs/dynamic-auth/commit/26f40f722302b8cf4cc035886d4408393a785283))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* override handlebars to >=4.7.9 (CVE-2026-33937) ([#10805](https://github.com/dynamic-labs/dynamic-auth/issues/10805)) ([7aa40b8](https://github.com/dynamic-labs/dynamic-auth/commit/7aa40b8472487694b438ae3a64b14524c9c726e4))
|
|
28
|
+
* use currentColor in settings icons for dark mode support ([#10811](https://github.com/dynamic-labs/dynamic-auth/issues/10811)) ([8653e97](https://github.com/dynamic-labs/dynamic-auth/commit/8653e97759f0ea5126258c1ced36ae26af3a405c)), closes [#383C48](https://github.com/dynamic-labs/dynamic-auth/issues/383C48) [#ABACB2](https://github.com/dynamic-labs/dynamic-auth/issues/ABACB2)
|
|
29
|
+
|
|
2
30
|
## [4.72.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.71.0...v4.72.0) (2026-03-26)
|
|
3
31
|
|
|
4
32
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.73.2",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.909",
|
|
6
6
|
"@dynamic-labs-sdk/client": "0.19.0",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"yup": "0.32.11",
|
|
17
17
|
"react-international-phone": "4.5.0",
|
|
18
18
|
"bs58": "5.0.0",
|
|
19
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
20
|
-
"@dynamic-labs/iconic": "4.
|
|
21
|
-
"@dynamic-labs/locale": "4.
|
|
22
|
-
"@dynamic-labs/logger": "4.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "4.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
25
|
-
"@dynamic-labs/store": "4.
|
|
26
|
-
"@dynamic-labs/types": "4.
|
|
27
|
-
"@dynamic-labs/utils": "4.
|
|
28
|
-
"@dynamic-labs/wallet-book": "4.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
19
|
+
"@dynamic-labs/assert-package-version": "4.73.2",
|
|
20
|
+
"@dynamic-labs/iconic": "4.73.2",
|
|
21
|
+
"@dynamic-labs/locale": "4.73.2",
|
|
22
|
+
"@dynamic-labs/logger": "4.73.2",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "4.73.2",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "4.73.2",
|
|
25
|
+
"@dynamic-labs/store": "4.73.2",
|
|
26
|
+
"@dynamic-labs/types": "4.73.2",
|
|
27
|
+
"@dynamic-labs/utils": "4.73.2",
|
|
28
|
+
"@dynamic-labs/wallet-book": "4.73.2",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "4.73.2",
|
|
30
30
|
"eventemitter3": "5.0.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
package/src/index.d.ts
CHANGED
|
@@ -104,7 +104,7 @@ export { getDefaultColor, getThemeConfig, themesData, } from './lib/context/Them
|
|
|
104
104
|
export type {
|
|
105
105
|
/** @deprecated */
|
|
106
106
|
ViewType, } from './lib/context/ViewContext';
|
|
107
|
-
export type { NotSupportedError, SandboxMaximumThresholdReachedError, NoAccessError, ChainalysisError, EmailAlreadyExistsError, UsernameAlreadyExistsError, SocialAccountAlreadyExistsError, WalletNotDeployedError, WalletUsedError, EmailVerificationError, AccountExistsError, InvalidPhoneNumberError, } from '@dynamic-labs/utils';
|
|
107
|
+
export type { NotSupportedError, SandboxMaximumThresholdReachedError, NoAccessError, ChainalysisError, EmailAlreadyExistsError, UsernameAlreadyExistsError, SocialAccountAlreadyExistsError, WalletNotDeployedError, WalletUsedError, EmailVerificationError, AccountExistsError, InvalidPhoneNumberError, RateLimitError, } from '@dynamic-labs/utils';
|
|
108
108
|
export type { WalletConnector, Chain, } from '@dynamic-labs/wallet-connector-core';
|
|
109
109
|
export type { EvmNetwork, PhoneData, OtpDestination, UserProfile,
|
|
110
110
|
/** @deprecated use AuthOptions instead */
|
|
@@ -21,8 +21,8 @@ const syncEvents = (client$1) => {
|
|
|
21
21
|
}, client$1);
|
|
22
22
|
client.onEvent({
|
|
23
23
|
event: 'logout',
|
|
24
|
-
listener: () => {
|
|
25
|
-
dynamicEvents.dynamicEvents.emit('logout');
|
|
24
|
+
listener: (metadata) => {
|
|
25
|
+
dynamicEvents.dynamicEvents.emit('logout', metadata);
|
|
26
26
|
},
|
|
27
27
|
}, client$1);
|
|
28
28
|
client.onEvent({
|
|
@@ -113,7 +113,7 @@ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
113
113
|
const useHandleLogout = (params) => {
|
|
114
114
|
const paramsRef = React.useRef(params);
|
|
115
115
|
paramsRef.current = params;
|
|
116
|
-
const logoutReactSdk = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
116
|
+
const logoutReactSdk = React.useCallback((reason) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
117
117
|
const p = paramsRef.current;
|
|
118
118
|
// We store which wallet connectors were active before logout
|
|
119
119
|
// to not have to worry about having the array change midway through
|
|
@@ -148,15 +148,17 @@ const useHandleLogout = (params) => {
|
|
|
148
148
|
primaryWalletId.resetPrimaryWalletId();
|
|
149
149
|
p.removeConnectedNameService();
|
|
150
150
|
p.removeSessionStorageSessionKeys();
|
|
151
|
-
yield Promise.all(activeConnectors.map((connector) => connector.endSession()));
|
|
151
|
+
yield Promise.all(activeConnectors.map((connector) => connector.endSession(reason)));
|
|
152
152
|
}), []);
|
|
153
|
-
const logout = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
153
|
+
const logout = React.useCallback((reason) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
154
154
|
yield client.logout();
|
|
155
|
-
yield logoutReactSdk();
|
|
155
|
+
yield logoutReactSdk(reason);
|
|
156
156
|
}), [logoutReactSdk]);
|
|
157
157
|
React.useEffect(() => client.onEvent({
|
|
158
158
|
event: 'logout',
|
|
159
|
-
listener: () =>
|
|
159
|
+
listener: (metadata) => {
|
|
160
|
+
logoutReactSdk(metadata === null || metadata === void 0 ? void 0 : metadata.reason);
|
|
161
|
+
},
|
|
160
162
|
}), [logoutReactSdk]);
|
|
161
163
|
/** Trigger a logout when the SDK failed to load data from storage */
|
|
162
164
|
React.useEffect(() => {
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { LogoutReason } from '@dynamic-labs-sdk/client';
|
|
1
2
|
import { UseHandleLogoutParams } from './types';
|
|
2
|
-
export declare const useHandleLogout: (params: UseHandleLogoutParams) => () => Promise<void>;
|
|
3
|
+
export declare const useHandleLogout: (params: UseHandleLogoutParams) => (reason?: LogoutReason) => Promise<void>;
|
|
@@ -109,7 +109,7 @@ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
109
109
|
const useHandleLogout = (params) => {
|
|
110
110
|
const paramsRef = useRef(params);
|
|
111
111
|
paramsRef.current = params;
|
|
112
|
-
const logoutReactSdk = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
|
+
const logoutReactSdk = useCallback((reason) => __awaiter(void 0, void 0, void 0, function* () {
|
|
113
113
|
const p = paramsRef.current;
|
|
114
114
|
// We store which wallet connectors were active before logout
|
|
115
115
|
// to not have to worry about having the array change midway through
|
|
@@ -144,15 +144,17 @@ const useHandleLogout = (params) => {
|
|
|
144
144
|
resetPrimaryWalletId();
|
|
145
145
|
p.removeConnectedNameService();
|
|
146
146
|
p.removeSessionStorageSessionKeys();
|
|
147
|
-
yield Promise.all(activeConnectors.map((connector) => connector.endSession()));
|
|
147
|
+
yield Promise.all(activeConnectors.map((connector) => connector.endSession(reason)));
|
|
148
148
|
}), []);
|
|
149
|
-
const logout$1 = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
149
|
+
const logout$1 = useCallback((reason) => __awaiter(void 0, void 0, void 0, function* () {
|
|
150
150
|
yield logout();
|
|
151
|
-
yield logoutReactSdk();
|
|
151
|
+
yield logoutReactSdk(reason);
|
|
152
152
|
}), [logoutReactSdk]);
|
|
153
153
|
useEffect(() => onEvent({
|
|
154
154
|
event: 'logout',
|
|
155
|
-
listener: () =>
|
|
155
|
+
listener: (metadata) => {
|
|
156
|
+
logoutReactSdk(metadata === null || metadata === void 0 ? void 0 : metadata.reason);
|
|
157
|
+
},
|
|
156
158
|
}), [logoutReactSdk]);
|
|
157
159
|
/** Trigger a logout when the SDK failed to load data from storage */
|
|
158
160
|
useEffect(() => {
|
|
@@ -21,6 +21,7 @@ const mapErrorCodeToTranslation = {
|
|
|
21
21
|
[utils.ErrorCode.MISSING_PUBLIC_ADDRESS]: 'dyn_error.missing_public_address',
|
|
22
22
|
[utils.ErrorCode.CONNECTION_PROPOSAL_EXPIRED]: 'dyn_error.connection_proposal_expired',
|
|
23
23
|
[utils.ErrorCode.SEI_NOT_ENABLED_IN_KEPLR_WALLET]: 'dyn_error.sei_not_enabled_in_keplr_wallet',
|
|
24
|
+
[utils.RATE_LIMIT_ERROR_CODE]: 'dyn_error.rate_limit_error',
|
|
24
25
|
};
|
|
25
26
|
/** A hook that listens to the error context and returns a translated value */
|
|
26
27
|
const useErrorText = () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { ErrorCode } from '@dynamic-labs/utils';
|
|
4
|
+
import { ErrorCode, RATE_LIMIT_ERROR_CODE } from '@dynamic-labs/utils';
|
|
5
5
|
import { useErrorContext } from '../../ErrorContext.js';
|
|
6
6
|
|
|
7
7
|
const mapErrorCodeToTranslation = {
|
|
@@ -17,6 +17,7 @@ const mapErrorCodeToTranslation = {
|
|
|
17
17
|
[ErrorCode.MISSING_PUBLIC_ADDRESS]: 'dyn_error.missing_public_address',
|
|
18
18
|
[ErrorCode.CONNECTION_PROPOSAL_EXPIRED]: 'dyn_error.connection_proposal_expired',
|
|
19
19
|
[ErrorCode.SEI_NOT_ENABLED_IN_KEPLR_WALLET]: 'dyn_error.sei_not_enabled_in_keplr_wallet',
|
|
20
|
+
[RATE_LIMIT_ERROR_CODE]: 'dyn_error.rate_limit_error',
|
|
20
21
|
};
|
|
21
22
|
/** A hook that listens to the error context and returns a translated value */
|
|
22
23
|
const useErrorText = () => {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var utils = require('@dynamic-labs/utils');
|
|
7
8
|
require('@dynamic-labs/iconic');
|
|
8
9
|
require('@dynamic-labs/wallet-connector-core');
|
|
9
10
|
require('react');
|
|
@@ -11,22 +12,48 @@ require('react/jsx-runtime');
|
|
|
11
12
|
require('../../context/ViewContext/ViewContext.cjs');
|
|
12
13
|
var logger = require('../../shared/logger.cjs');
|
|
13
14
|
require('@dynamic-labs/wallet-book');
|
|
14
|
-
require('@dynamic-labs/utils');
|
|
15
15
|
require('../../utils/constants/colors.cjs');
|
|
16
16
|
require('../../utils/constants/values.cjs');
|
|
17
17
|
require('@dynamic-labs/sdk-api-core');
|
|
18
18
|
require('../../shared/consts/index.cjs');
|
|
19
19
|
var api = require('./api.cjs');
|
|
20
20
|
|
|
21
|
+
const RATE_LIMIT_MESSAGE = 'Too many requests. Please try again later.';
|
|
22
|
+
const NETWORK_ERROR_MESSAGE = 'Request failed. You may be sending too many requests — please wait a moment and try again.';
|
|
21
23
|
const logResponseError = (e_1, message_1, ...args_1) => _tslib.__awaiter(void 0, [e_1, message_1, ...args_1], void 0, function* (e, message, logLevel = 'error') {
|
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
22
25
|
if (e instanceof Response) {
|
|
23
|
-
const
|
|
24
|
-
|
|
26
|
+
const requestId = (_b = (_a = e.headers) === null || _a === void 0 ? void 0 : _a.get('x-dyn-request-id')) !== null && _b !== void 0 ? _b : undefined;
|
|
27
|
+
const cfRay = (_d = (_c = e.headers) === null || _c === void 0 ? void 0 : _c.get('cf-ray')) !== null && _d !== void 0 ? _d : undefined;
|
|
28
|
+
let data;
|
|
29
|
+
try {
|
|
30
|
+
data = yield e.json();
|
|
31
|
+
}
|
|
32
|
+
catch (_h) {
|
|
33
|
+
data = {};
|
|
34
|
+
}
|
|
35
|
+
// Normalize 429 responses regardless of body content
|
|
36
|
+
if (e.status === 429) {
|
|
37
|
+
data.code = utils.RATE_LIMIT_ERROR_CODE;
|
|
38
|
+
data.error = (_e = data.error) !== null && _e !== void 0 ? _e : RATE_LIMIT_MESSAGE;
|
|
39
|
+
}
|
|
40
|
+
data.code = (_f = data.code) !== null && _f !== void 0 ? _f : utils.UNKNOWN_ERROR_CODE;
|
|
41
|
+
data.error = (_g = data.error) !== null && _g !== void 0 ? _g : `Request failed with status ${e.status}`;
|
|
42
|
+
logger.logger[logLevel](message, {
|
|
43
|
+
cfRay,
|
|
44
|
+
error: data.error,
|
|
45
|
+
requestId,
|
|
46
|
+
status: e.status,
|
|
47
|
+
});
|
|
25
48
|
return data;
|
|
26
49
|
}
|
|
27
|
-
|
|
50
|
+
if (e instanceof Error) {
|
|
28
51
|
logger.logger[logLevel](message, e);
|
|
29
52
|
}
|
|
53
|
+
return {
|
|
54
|
+
code: utils.UNKNOWN_ERROR_CODE,
|
|
55
|
+
error: NETWORK_ERROR_MESSAGE,
|
|
56
|
+
};
|
|
30
57
|
});
|
|
31
58
|
const getNonce = (environmentId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
32
59
|
try {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
3
|
+
import { RATE_LIMIT_ERROR_CODE, UNKNOWN_ERROR_CODE } from '@dynamic-labs/utils';
|
|
3
4
|
import '@dynamic-labs/iconic';
|
|
4
5
|
import '@dynamic-labs/wallet-connector-core';
|
|
5
6
|
import 'react';
|
|
@@ -7,22 +8,48 @@ import 'react/jsx-runtime';
|
|
|
7
8
|
import '../../context/ViewContext/ViewContext.js';
|
|
8
9
|
import { logger } from '../../shared/logger.js';
|
|
9
10
|
import '@dynamic-labs/wallet-book';
|
|
10
|
-
import '@dynamic-labs/utils';
|
|
11
11
|
import '../../utils/constants/colors.js';
|
|
12
12
|
import '../../utils/constants/values.js';
|
|
13
13
|
import '@dynamic-labs/sdk-api-core';
|
|
14
14
|
import '../../shared/consts/index.js';
|
|
15
15
|
import { sdkApi } from './api.js';
|
|
16
16
|
|
|
17
|
+
const RATE_LIMIT_MESSAGE = 'Too many requests. Please try again later.';
|
|
18
|
+
const NETWORK_ERROR_MESSAGE = 'Request failed. You may be sending too many requests — please wait a moment and try again.';
|
|
17
19
|
const logResponseError = (e_1, message_1, ...args_1) => __awaiter(void 0, [e_1, message_1, ...args_1], void 0, function* (e, message, logLevel = 'error') {
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
18
21
|
if (e instanceof Response) {
|
|
19
|
-
const
|
|
20
|
-
|
|
22
|
+
const requestId = (_b = (_a = e.headers) === null || _a === void 0 ? void 0 : _a.get('x-dyn-request-id')) !== null && _b !== void 0 ? _b : undefined;
|
|
23
|
+
const cfRay = (_d = (_c = e.headers) === null || _c === void 0 ? void 0 : _c.get('cf-ray')) !== null && _d !== void 0 ? _d : undefined;
|
|
24
|
+
let data;
|
|
25
|
+
try {
|
|
26
|
+
data = yield e.json();
|
|
27
|
+
}
|
|
28
|
+
catch (_h) {
|
|
29
|
+
data = {};
|
|
30
|
+
}
|
|
31
|
+
// Normalize 429 responses regardless of body content
|
|
32
|
+
if (e.status === 429) {
|
|
33
|
+
data.code = RATE_LIMIT_ERROR_CODE;
|
|
34
|
+
data.error = (_e = data.error) !== null && _e !== void 0 ? _e : RATE_LIMIT_MESSAGE;
|
|
35
|
+
}
|
|
36
|
+
data.code = (_f = data.code) !== null && _f !== void 0 ? _f : UNKNOWN_ERROR_CODE;
|
|
37
|
+
data.error = (_g = data.error) !== null && _g !== void 0 ? _g : `Request failed with status ${e.status}`;
|
|
38
|
+
logger[logLevel](message, {
|
|
39
|
+
cfRay,
|
|
40
|
+
error: data.error,
|
|
41
|
+
requestId,
|
|
42
|
+
status: e.status,
|
|
43
|
+
});
|
|
21
44
|
return data;
|
|
22
45
|
}
|
|
23
|
-
|
|
46
|
+
if (e instanceof Error) {
|
|
24
47
|
logger[logLevel](message, e);
|
|
25
48
|
}
|
|
49
|
+
return {
|
|
50
|
+
code: UNKNOWN_ERROR_CODE,
|
|
51
|
+
error: NETWORK_ERROR_MESSAGE,
|
|
52
|
+
};
|
|
26
53
|
});
|
|
27
54
|
const getNonce = (environmentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
55
|
try {
|
package/src/lib/events/auth.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LogoutEventMetadata } from '@dynamic-labs-sdk/client';
|
|
1
2
|
import { AuthEventPayload } from '@dynamic-labs/types';
|
|
2
3
|
export type AuthEvents = {
|
|
3
4
|
/**
|
|
@@ -12,7 +13,7 @@ export type AuthEvents = {
|
|
|
12
13
|
}) => void;
|
|
13
14
|
/** Informs an auth attempt initialized, and provides insight into which auth option it is */
|
|
14
15
|
authInit: (method: AuthEventPayload) => void;
|
|
15
|
-
logout: () => void;
|
|
16
|
+
logout: (metadata?: LogoutEventMetadata) => void;
|
|
16
17
|
/** This event is used to trigger logout to be called, DO NOT listen to it. Listen to "logout" instead */
|
|
17
18
|
triggerLogout: () => void;
|
|
18
19
|
/**
|
|
@@ -47,7 +47,7 @@ var SvgBackupArrow = function SvgBackupArrow(_ref) {
|
|
|
47
47
|
fillRule: "evenodd",
|
|
48
48
|
clipRule: "evenodd",
|
|
49
49
|
d: "M4.955 12.806a7.373 7.373 0 1 0 9.14-7.07l.35.358a.922.922 0 1 1-1.32 1.287l-1.82-1.866a.922.922 0 0 1 .015-1.303l1.866-1.82a.922.922 0 0 1 1.287 1.32l-.182.177a9.217 9.217 0 1 1-6.548 1.01.922.922 0 0 1 .918 1.598 7.37 7.37 0 0 0-3.706 6.31Z",
|
|
50
|
-
fill: "
|
|
50
|
+
fill: "currentColor"
|
|
51
51
|
})));
|
|
52
52
|
};
|
|
53
53
|
|
|
@@ -23,7 +23,7 @@ var SvgBackupArrow = function SvgBackupArrow(_ref) {
|
|
|
23
23
|
fillRule: "evenodd",
|
|
24
24
|
clipRule: "evenodd",
|
|
25
25
|
d: "M4.955 12.806a7.373 7.373 0 1 0 9.14-7.07l.35.358a.922.922 0 1 1-1.32 1.287l-1.82-1.866a.922.922 0 0 1 .015-1.303l1.866-1.82a.922.922 0 0 1 1.287 1.32l-.182.177a9.217 9.217 0 1 1-6.548 1.01.922.922 0 0 1 .918 1.598 7.37 7.37 0 0 0-3.706 6.31Z",
|
|
26
|
-
fill: "
|
|
26
|
+
fill: "currentColor"
|
|
27
27
|
})));
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -47,8 +47,7 @@ var SvgExportPrivateKey = function SvgExportPrivateKey(_ref) {
|
|
|
47
47
|
fillRule: "evenodd",
|
|
48
48
|
clipRule: "evenodd",
|
|
49
49
|
d: "M19.834 4.667a2.333 2.333 0 0 0-2.333-2.334H7a4.668 4.668 0 0 0-4.592 3.83 4.654 4.654 0 0 1 3.425-1.496h14ZM21 7a4.667 4.667 0 0 1 4.667 4.667V21A4.667 4.667 0 0 1 21 25.667H7A4.667 4.667 0 0 1 2.333 21v-9.333A4.667 4.667 0 0 1 7 7h14Zm-4.915 3.792a3.649 3.649 0 1 1 0 7.297 3.649 3.649 0 0 1 0-7.297Zm0 1.824a1.824 1.824 0 1 1 0 3.649 1.824 1.824 0 0 1 0-3.649Zm-3.16 5.115a4.565 4.565 0 0 1-.714-.924l-4.336 4.336 1.29 1.29 1.254-1.253 1.279 1.278 1.29-1.29-1.279-1.278 1.721-1.722a4.598 4.598 0 0 1-.505-.437Z",
|
|
50
|
-
fill: "
|
|
51
|
-
fillOpacity: 0.4
|
|
50
|
+
fill: "currentColor"
|
|
52
51
|
})));
|
|
53
52
|
};
|
|
54
53
|
|
|
@@ -23,8 +23,7 @@ var SvgExportPrivateKey = function SvgExportPrivateKey(_ref) {
|
|
|
23
23
|
fillRule: "evenodd",
|
|
24
24
|
clipRule: "evenodd",
|
|
25
25
|
d: "M19.834 4.667a2.333 2.333 0 0 0-2.333-2.334H7a4.668 4.668 0 0 0-4.592 3.83 4.654 4.654 0 0 1 3.425-1.496h14ZM21 7a4.667 4.667 0 0 1 4.667 4.667V21A4.667 4.667 0 0 1 21 25.667H7A4.667 4.667 0 0 1 2.333 21v-9.333A4.667 4.667 0 0 1 7 7h14Zm-4.915 3.792a3.649 3.649 0 1 1 0 7.297 3.649 3.649 0 0 1 0-7.297Zm0 1.824a1.824 1.824 0 1 1 0 3.649 1.824 1.824 0 0 1 0-3.649Zm-3.16 5.115a4.565 4.565 0 0 1-.714-.924l-4.336 4.336 1.29 1.29 1.254-1.253 1.279 1.278 1.29-1.29-1.279-1.278 1.721-1.722a4.598 4.598 0 0 1-.505-.437Z",
|
|
26
|
-
fill: "
|
|
27
|
-
fillOpacity: 0.4
|
|
26
|
+
fill: "currentColor"
|
|
28
27
|
})));
|
|
29
28
|
};
|
|
30
29
|
|
|
@@ -47,8 +47,7 @@ var SvgExportRecoveryPhrase = function SvgExportRecoveryPhrase(_ref) {
|
|
|
47
47
|
fillRule: "evenodd",
|
|
48
48
|
clipRule: "evenodd",
|
|
49
49
|
d: "M17.5 2.333a2.333 2.333 0 0 1 2.334 2.334h-14A4.654 4.654 0 0 0 2.41 6.164 4.668 4.668 0 0 1 7 2.334h10.5Zm8.167 9.334A4.667 4.667 0 0 0 21 7H7a4.667 4.667 0 0 0-4.667 4.667V21A4.667 4.667 0 0 0 7 25.667h14A4.667 4.667 0 0 0 25.667 21v-9.333Zm-16.8.933A.933.933 0 1 1 7 12.6a.933.933 0 0 1 1.867 0Zm2.426-.933a.933.933 0 1 0 0 1.866h8.214a.933.933 0 1 0 0-1.866h-8.214Zm-2.426 4.666a.933.933 0 1 1-1.867 0 .933.933 0 0 1 1.867 0Zm2.426-.933a.933.933 0 1 0 0 1.867h8.214a.933.933 0 0 0 0-1.867h-8.214Zm-2.426 4.667a.933.933 0 1 1-1.867 0 .933.933 0 0 1 1.867 0Zm2.24-.934a.933.933 0 0 0 0 1.867h8.213a.933.933 0 1 0 0-1.867h-8.213Z",
|
|
50
|
-
fill: "
|
|
51
|
-
fillOpacity: 0.4
|
|
50
|
+
fill: "currentColor"
|
|
52
51
|
})));
|
|
53
52
|
};
|
|
54
53
|
|
|
@@ -23,8 +23,7 @@ var SvgExportRecoveryPhrase = function SvgExportRecoveryPhrase(_ref) {
|
|
|
23
23
|
fillRule: "evenodd",
|
|
24
24
|
clipRule: "evenodd",
|
|
25
25
|
d: "M17.5 2.333a2.333 2.333 0 0 1 2.334 2.334h-14A4.654 4.654 0 0 0 2.41 6.164 4.668 4.668 0 0 1 7 2.334h10.5Zm8.167 9.334A4.667 4.667 0 0 0 21 7H7a4.667 4.667 0 0 0-4.667 4.667V21A4.667 4.667 0 0 0 7 25.667h14A4.667 4.667 0 0 0 25.667 21v-9.333Zm-16.8.933A.933.933 0 1 1 7 12.6a.933.933 0 0 1 1.867 0Zm2.426-.933a.933.933 0 1 0 0 1.866h8.214a.933.933 0 1 0 0-1.866h-8.214Zm-2.426 4.666a.933.933 0 1 1-1.867 0 .933.933 0 0 1 1.867 0Zm2.426-.933a.933.933 0 1 0 0 1.867h8.214a.933.933 0 0 0 0-1.867h-8.214Zm-2.426 4.667a.933.933 0 1 1-1.867 0 .933.933 0 0 1 1.867 0Zm2.24-.934a.933.933 0 0 0 0 1.867h8.213a.933.933 0 1 0 0-1.867h-8.213Z",
|
|
26
|
-
fill: "
|
|
27
|
-
fillOpacity: 0.4
|
|
26
|
+
fill: "currentColor"
|
|
28
27
|
})));
|
|
29
28
|
};
|
|
30
29
|
|
|
@@ -47,7 +47,7 @@ var SvgFaceId = function SvgFaceId(_ref) {
|
|
|
47
47
|
fillRule: "evenodd",
|
|
48
48
|
clipRule: "evenodd",
|
|
49
49
|
d: "M18.055 2.4A3.548 3.548 0 0 1 21.6 5.945v2.013a1.095 1.095 0 0 1-2.19 0V5.945c0-.747-.608-1.355-1.355-1.355h-2.012a1.095 1.095 0 1 1 0-2.19h2.012Zm-10.098 0a1.095 1.095 0 0 1 0 2.19H5.945c-.747 0-1.355.608-1.355 1.355v2.013a1.095 1.095 0 0 1-2.19 0V5.945A3.548 3.548 0 0 1 5.945 2.4h2.012Zm7.692 5.083c.6 0 1.086.486 1.086 1.086v1.347a1.086 1.086 0 1 1-2.172 0V8.57c0-.6.486-1.086 1.086-1.086Zm-4.121 0c.614 0 1.112.498 1.112 1.112v2.982h.008a1.113 1.113 0 0 1 0 2.226h-.386a1.849 1.849 0 0 1-1.847-1.848v-3.36c0-.614.498-1.112 1.113-1.112Zm-3.282 0c.6 0 1.086.486 1.086 1.086v1.347a1.086 1.086 0 0 1-2.172 0V8.57c0-.6.486-1.086 1.086-1.086Zm12.259 7.465c.605 0 1.095.49 1.095 1.095v2.012a3.548 3.548 0 0 1-3.545 3.545h-2.012a1.095 1.095 0 1 1 0-2.19h2.012c.747 0 1.355-.608 1.355-1.355v-2.012c0-.605.49-1.095 1.095-1.095Zm-17.01 0c.605 0 1.095.49 1.095 1.095v2.012c0 .747.608 1.355 1.355 1.355h2.012a1.095 1.095 0 0 1 0 2.19H5.945A3.548 3.548 0 0 1 2.4 18.055v-2.012c0-.605.49-1.095 1.095-1.095Zm5.365 1.337a.473.473 0 0 0 0 0l-.434.47a1.113 1.113 0 0 1 1.51-1.634c.563.52 1.296.806 2.064.806s1.5-.286 2.065-.807a1.113 1.113 0 0 1 1.51 1.634A5.255 5.255 0 0 1 12 18.153a5.255 5.255 0 0 1-3.574-1.397l.434-.47a4.615 4.615 0 0 1 0 0Zm5.947.28a4.694 4.694 0 0 1 0 0Z",
|
|
50
|
-
fill: "
|
|
50
|
+
fill: "currentColor"
|
|
51
51
|
})));
|
|
52
52
|
};
|
|
53
53
|
|
|
@@ -23,7 +23,7 @@ var SvgFaceId = function SvgFaceId(_ref) {
|
|
|
23
23
|
fillRule: "evenodd",
|
|
24
24
|
clipRule: "evenodd",
|
|
25
25
|
d: "M18.055 2.4A3.548 3.548 0 0 1 21.6 5.945v2.013a1.095 1.095 0 0 1-2.19 0V5.945c0-.747-.608-1.355-1.355-1.355h-2.012a1.095 1.095 0 1 1 0-2.19h2.012Zm-10.098 0a1.095 1.095 0 0 1 0 2.19H5.945c-.747 0-1.355.608-1.355 1.355v2.013a1.095 1.095 0 0 1-2.19 0V5.945A3.548 3.548 0 0 1 5.945 2.4h2.012Zm7.692 5.083c.6 0 1.086.486 1.086 1.086v1.347a1.086 1.086 0 1 1-2.172 0V8.57c0-.6.486-1.086 1.086-1.086Zm-4.121 0c.614 0 1.112.498 1.112 1.112v2.982h.008a1.113 1.113 0 0 1 0 2.226h-.386a1.849 1.849 0 0 1-1.847-1.848v-3.36c0-.614.498-1.112 1.113-1.112Zm-3.282 0c.6 0 1.086.486 1.086 1.086v1.347a1.086 1.086 0 0 1-2.172 0V8.57c0-.6.486-1.086 1.086-1.086Zm12.259 7.465c.605 0 1.095.49 1.095 1.095v2.012a3.548 3.548 0 0 1-3.545 3.545h-2.012a1.095 1.095 0 1 1 0-2.19h2.012c.747 0 1.355-.608 1.355-1.355v-2.012c0-.605.49-1.095 1.095-1.095Zm-17.01 0c.605 0 1.095.49 1.095 1.095v2.012c0 .747.608 1.355 1.355 1.355h2.012a1.095 1.095 0 0 1 0 2.19H5.945A3.548 3.548 0 0 1 2.4 18.055v-2.012c0-.605.49-1.095 1.095-1.095Zm5.365 1.337a.473.473 0 0 0 0 0l-.434.47a1.113 1.113 0 0 1 1.51-1.634c.563.52 1.296.806 2.064.806s1.5-.286 2.065-.807a1.113 1.113 0 0 1 1.51 1.634A5.255 5.255 0 0 1 12 18.153a5.255 5.255 0 0 1-3.574-1.397l.434-.47a4.615 4.615 0 0 1 0 0Zm5.947.28a4.694 4.694 0 0 1 0 0Z",
|
|
26
|
-
fill: "
|
|
26
|
+
fill: "currentColor"
|
|
27
27
|
})));
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -47,8 +47,7 @@ var SvgLock = function SvgLock(_ref) {
|
|
|
47
47
|
fillRule: "evenodd",
|
|
48
48
|
clipRule: "evenodd",
|
|
49
49
|
d: "M7 7a5 5 0 0 1 10 0v3h1a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-6a3 3 0 0 1 3-3h1V7Zm2 3h6V7a3 3 0 1 0-6 0v3Zm-3 2a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1H6Zm6 2a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0v-2a1 1 0 0 1 1-1Z",
|
|
50
|
-
fill: "
|
|
51
|
-
fillOpacity: 0.4
|
|
50
|
+
fill: "currentColor"
|
|
52
51
|
})));
|
|
53
52
|
};
|
|
54
53
|
|
|
@@ -23,8 +23,7 @@ var SvgLock = function SvgLock(_ref) {
|
|
|
23
23
|
fillRule: "evenodd",
|
|
24
24
|
clipRule: "evenodd",
|
|
25
25
|
d: "M7 7a5 5 0 0 1 10 0v3h1a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-6a3 3 0 0 1 3-3h1V7Zm2 3h6V7a3 3 0 1 0-6 0v3Zm-3 2a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1H6Zm6 2a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0v-2a1 1 0 0 1 1-1Z",
|
|
26
|
-
fill: "
|
|
27
|
-
fillOpacity: 0.4
|
|
26
|
+
fill: "currentColor"
|
|
28
27
|
})));
|
|
29
28
|
};
|
|
30
29
|
|
|
@@ -5,12 +5,16 @@ export type StepUpAuthenticationState = {
|
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
otpVerification: OTPVerification | null;
|
|
7
7
|
};
|
|
8
|
+
export type SendOtpParams = {
|
|
9
|
+
credentialId?: string;
|
|
10
|
+
};
|
|
8
11
|
export type VerifyOtpParams = {
|
|
9
12
|
requestedScopes?: TokenScope[];
|
|
10
13
|
verificationToken: string;
|
|
11
14
|
};
|
|
12
15
|
export type VerifyWalletParams = {
|
|
13
16
|
requestedScopes?: TokenScope[];
|
|
17
|
+
walletId?: string;
|
|
14
18
|
};
|
|
15
19
|
export type VerifyPasskeyMfaParams = {
|
|
16
20
|
requestedScopes?: TokenScope[];
|
|
@@ -53,7 +57,7 @@ export type UseStepUpAuthenticationReturn = {
|
|
|
53
57
|
promptReauthenticate: (props?: PromptReauthParams) => Promise<string | undefined>;
|
|
54
58
|
promptStepUpAuth: (props?: PromptStepUpAuthParams) => Promise<string | undefined>;
|
|
55
59
|
resetState: () => void;
|
|
56
|
-
sendOtp: () => Promise<OTPVerification | null>;
|
|
60
|
+
sendOtp: (params?: SendOtpParams) => Promise<OTPVerification | null>;
|
|
57
61
|
state: StepUpAuthenticationState;
|
|
58
62
|
verifyOtp: (params: VerifyOtpParams) => Promise<VerifyResponse | null>;
|
|
59
63
|
verifyPasskeyMfa: (params: VerifyPasskeyMfaParams) => Promise<VerifyResponse | null>;
|
|
@@ -68,13 +68,15 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
68
68
|
const user = useUser.useUser();
|
|
69
69
|
const { setError, setLoading, setSuccess } = stateActions;
|
|
70
70
|
const otpVerificationRef = React.useRef(null);
|
|
71
|
-
const sendOtp = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
const sendOtp = React.useCallback((params) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
+
var _a;
|
|
72
73
|
const credentials = user === null || user === void 0 ? void 0 : user.verifiedCredentials;
|
|
73
74
|
if (!(credentials === null || credentials === void 0 ? void 0 : credentials.length)) {
|
|
74
75
|
setError('No verified credentials found for the authenticated user');
|
|
75
76
|
return null;
|
|
76
77
|
}
|
|
77
|
-
const
|
|
78
|
+
const effectiveCredentialId = (_a = params === null || params === void 0 ? void 0 : params.credentialId) !== null && _a !== void 0 ? _a : credentialId;
|
|
79
|
+
const result = resolveTargetCredential(credentials, effectiveCredentialId);
|
|
78
80
|
if (typeof result === 'string') {
|
|
79
81
|
setError(result);
|
|
80
82
|
return null;
|
|
@@ -95,14 +97,8 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
95
97
|
setError(errorMessage);
|
|
96
98
|
return null;
|
|
97
99
|
}
|
|
98
|
-
}), [
|
|
99
|
-
|
|
100
|
-
setError,
|
|
101
|
-
setLoading,
|
|
102
|
-
setSuccess,
|
|
103
|
-
user === null || user === void 0 ? void 0 : user.verifiedCredentials,
|
|
104
|
-
]);
|
|
105
|
-
const verifyOtp = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ requestedScopes, verificationToken, }) {
|
|
100
|
+
}), [credentialId, setError, setLoading, setSuccess, user === null || user === void 0 ? void 0 : user.verifiedCredentials]);
|
|
101
|
+
const verifyOtp = React.useCallback((_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ requestedScopes, verificationToken, }) {
|
|
106
102
|
const otpVerification = otpVerificationRef.current;
|
|
107
103
|
if (!otpVerification) {
|
|
108
104
|
setError('OTP verification has not been initiated. Call sendOtp() first');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OTPVerification } from '@dynamic-labs-sdk/client';
|
|
2
2
|
import { VerifyResponse } from '@dynamic-labs/sdk-api-core';
|
|
3
|
-
import type { VerifyOtpParams } from './useStepUpAuthentication.types';
|
|
3
|
+
import type { SendOtpParams, VerifyOtpParams } from './useStepUpAuthentication.types';
|
|
4
4
|
import type { useStepUpState } from './useStepUpState';
|
|
5
5
|
type StepUpStateActions = ReturnType<typeof useStepUpState>;
|
|
6
6
|
type UseStepUpOtpParams = {
|
|
@@ -9,7 +9,7 @@ type UseStepUpOtpParams = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare const useStepUpOtp: ({ credentialId, stateActions, }: UseStepUpOtpParams) => {
|
|
11
11
|
resetOtpRef: () => void;
|
|
12
|
-
sendOtp: () => Promise<OTPVerification | null>;
|
|
12
|
+
sendOtp: (params?: SendOtpParams) => Promise<OTPVerification | null>;
|
|
13
13
|
verifyOtp: ({ requestedScopes, verificationToken, }: VerifyOtpParams) => Promise<VerifyResponse | null>;
|
|
14
14
|
};
|
|
15
15
|
export {};
|
|
@@ -64,13 +64,15 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
64
64
|
const user = useUser();
|
|
65
65
|
const { setError, setLoading, setSuccess } = stateActions;
|
|
66
66
|
const otpVerificationRef = useRef(null);
|
|
67
|
-
const sendOtp = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
+
const sendOtp = useCallback((params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
var _a;
|
|
68
69
|
const credentials = user === null || user === void 0 ? void 0 : user.verifiedCredentials;
|
|
69
70
|
if (!(credentials === null || credentials === void 0 ? void 0 : credentials.length)) {
|
|
70
71
|
setError('No verified credentials found for the authenticated user');
|
|
71
72
|
return null;
|
|
72
73
|
}
|
|
73
|
-
const
|
|
74
|
+
const effectiveCredentialId = (_a = params === null || params === void 0 ? void 0 : params.credentialId) !== null && _a !== void 0 ? _a : credentialId;
|
|
75
|
+
const result = resolveTargetCredential(credentials, effectiveCredentialId);
|
|
74
76
|
if (typeof result === 'string') {
|
|
75
77
|
setError(result);
|
|
76
78
|
return null;
|
|
@@ -91,14 +93,8 @@ const useStepUpOtp = ({ credentialId, stateActions, }) => {
|
|
|
91
93
|
setError(errorMessage);
|
|
92
94
|
return null;
|
|
93
95
|
}
|
|
94
|
-
}), [
|
|
95
|
-
|
|
96
|
-
setError,
|
|
97
|
-
setLoading,
|
|
98
|
-
setSuccess,
|
|
99
|
-
user === null || user === void 0 ? void 0 : user.verifiedCredentials,
|
|
100
|
-
]);
|
|
101
|
-
const verifyOtp = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ requestedScopes, verificationToken, }) {
|
|
96
|
+
}), [credentialId, setError, setLoading, setSuccess, user === null || user === void 0 ? void 0 : user.verifiedCredentials]);
|
|
97
|
+
const verifyOtp = useCallback((_b) => __awaiter(void 0, [_b], void 0, function* ({ requestedScopes, verificationToken, }) {
|
|
102
98
|
const otpVerification = otpVerificationRef.current;
|
|
103
99
|
if (!otpVerification) {
|
|
104
100
|
setError('OTP verification has not been initiated. Call sendOtp() first');
|
|
@@ -115,11 +115,17 @@ const useStepUpWallet = ({ credentialId, stateActions, }) => {
|
|
|
115
115
|
const connectAndSign = useConnectAndSign.useConnectAndSign();
|
|
116
116
|
const { userWallets } = UserWalletsContext.useInternalUserWallets();
|
|
117
117
|
const { setError, setLoading, setSuccess } = stateActions;
|
|
118
|
-
const verifyWallet = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ requestedScopes }) {
|
|
118
|
+
const verifyWallet = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ requestedScopes, walletId, }) {
|
|
119
119
|
setLoading();
|
|
120
|
-
const
|
|
120
|
+
const effectiveId = walletId !== null && walletId !== void 0 ? walletId : credentialId;
|
|
121
|
+
const wallet = effectiveId
|
|
122
|
+
? userWallets.find((w) => w.id === effectiveId)
|
|
123
|
+
: userWallets[0];
|
|
121
124
|
if (!wallet) {
|
|
122
|
-
|
|
125
|
+
const message = effectiveId
|
|
126
|
+
? `Wallet with id "${effectiveId}" not found`
|
|
127
|
+
: 'No connected wallets found for step-up authentication';
|
|
128
|
+
setError(message);
|
|
123
129
|
return;
|
|
124
130
|
}
|
|
125
131
|
const connector = wallet.connector;
|
|
@@ -6,6 +6,6 @@ type UseStepUpWalletParams = {
|
|
|
6
6
|
stateActions: StepUpStateActions;
|
|
7
7
|
};
|
|
8
8
|
export declare const useStepUpWallet: ({ credentialId, stateActions, }: UseStepUpWalletParams) => {
|
|
9
|
-
verifyWallet: ({ requestedScopes }: VerifyWalletParams) => Promise<void>;
|
|
9
|
+
verifyWallet: ({ requestedScopes, walletId, }: VerifyWalletParams) => Promise<void>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -111,11 +111,17 @@ const useStepUpWallet = ({ credentialId, stateActions, }) => {
|
|
|
111
111
|
const connectAndSign = useConnectAndSign();
|
|
112
112
|
const { userWallets } = useInternalUserWallets();
|
|
113
113
|
const { setError, setLoading, setSuccess } = stateActions;
|
|
114
|
-
const verifyWallet = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ requestedScopes }) {
|
|
114
|
+
const verifyWallet = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ requestedScopes, walletId, }) {
|
|
115
115
|
setLoading();
|
|
116
|
-
const
|
|
116
|
+
const effectiveId = walletId !== null && walletId !== void 0 ? walletId : credentialId;
|
|
117
|
+
const wallet = effectiveId
|
|
118
|
+
? userWallets.find((w) => w.id === effectiveId)
|
|
119
|
+
: userWallets[0];
|
|
117
120
|
if (!wallet) {
|
|
118
|
-
|
|
121
|
+
const message = effectiveId
|
|
122
|
+
? `Wallet with id "${effectiveId}" not found`
|
|
123
|
+
: 'No connected wallets found for step-up authentication';
|
|
124
|
+
setError(message);
|
|
119
125
|
return;
|
|
120
126
|
}
|
|
121
127
|
const connector = wallet.connector;
|
|
@@ -106,7 +106,7 @@ require('../../../widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotp
|
|
|
106
106
|
require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
107
107
|
require('../../../store/state/tokenBalances.cjs');
|
|
108
108
|
require('../../../store/state/multichainBalances.cjs');
|
|
109
|
-
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
109
|
+
var getInitialUrl = require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
110
110
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
111
111
|
|
|
112
112
|
/**
|
|
@@ -120,14 +120,14 @@ const useSyncDeviceRegistrationFlow = () => {
|
|
|
120
120
|
React.useEffect(() => {
|
|
121
121
|
let cancelled = false;
|
|
122
122
|
const syncDeviceRegistration = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
123
|
-
var _a;
|
|
123
|
+
var _a, _b;
|
|
124
124
|
if (!sdkHasLoaded || !userWithMissingInfo) {
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
if (!((_a = userWithMissingInfo.scope) === null || _a === void 0 ? void 0 : _a.includes('device:register'))) {
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
const url = window.location.href;
|
|
130
|
+
const url = ((_b = getInitialUrl.getInitialUrl()) === null || _b === void 0 ? void 0 : _b.href) || window.location.href;
|
|
131
131
|
// If the user arrived via the device registration email link,
|
|
132
132
|
// complete registration directly without showing the modal
|
|
133
133
|
if (client.detectDeviceRegistrationRedirect({ url })) {
|
|
@@ -102,7 +102,7 @@ import '../../../widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpM
|
|
|
102
102
|
import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
103
103
|
import '../../../store/state/tokenBalances.js';
|
|
104
104
|
import '../../../store/state/multichainBalances.js';
|
|
105
|
-
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
105
|
+
import { getInitialUrl } from '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
106
106
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
107
107
|
|
|
108
108
|
/**
|
|
@@ -116,14 +116,14 @@ const useSyncDeviceRegistrationFlow = () => {
|
|
|
116
116
|
useEffect(() => {
|
|
117
117
|
let cancelled = false;
|
|
118
118
|
const syncDeviceRegistration = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
119
|
-
var _a;
|
|
119
|
+
var _a, _b;
|
|
120
120
|
if (!sdkHasLoaded || !userWithMissingInfo) {
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
if (!((_a = userWithMissingInfo.scope) === null || _a === void 0 ? void 0 : _a.includes('device:register'))) {
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
|
-
const url = window.location.href;
|
|
126
|
+
const url = ((_b = getInitialUrl()) === null || _b === void 0 ? void 0 : _b.href) || window.location.href;
|
|
127
127
|
// If the user arrived via the device registration email link,
|
|
128
128
|
// complete registration directly without showing the modal
|
|
129
129
|
if (detectDeviceRegistrationRedirect({ url })) {
|
|
@@ -63,7 +63,7 @@ const handleWalletInfoOutOfSync = (_a) => _tslib.__awaiter(void 0, [_a], void 0,
|
|
|
63
63
|
connectedWallets,
|
|
64
64
|
primaryWalletId: primaryWalletId$1,
|
|
65
65
|
user,
|
|
66
|
-
});
|
|
66
|
+
}, isTokenExpired ? 'token-expired' : 'user-intent');
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
exports.handleWalletInfoOutOfSync = handleWalletInfoOutOfSync;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { LogoutReason } from '@dynamic-labs-sdk/client';
|
|
1
2
|
export type HandleWalletInfoOutOfSyncParams = {
|
|
2
|
-
logout: (reason: string, params: any) => Promise<void>;
|
|
3
|
+
logout: (reason: string, params: any, logoutReason?: LogoutReason) => Promise<void>;
|
|
3
4
|
};
|
|
4
5
|
/**
|
|
5
6
|
* Detects mismatch between wallet info.
|
|
@@ -41,9 +41,9 @@ const useValidateSession = ({ environmentId, handleLogOut }) => {
|
|
|
41
41
|
const initStatus = useInitStatus.useClientInitStatus();
|
|
42
42
|
const logout = React.useCallback(
|
|
43
43
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
-
(reason, params) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
44
|
+
(reason, params, logoutReason) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
45
45
|
logger.logger.info(`Logging out due to invalid session - Reason: ${reason}`, Object.assign({}, params));
|
|
46
|
-
return handleLogOut();
|
|
46
|
+
return handleLogOut(logoutReason);
|
|
47
47
|
}), [handleLogOut]);
|
|
48
48
|
const validateSession = React.useCallback((projectSettings) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
49
49
|
const params = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { LogoutReason } from '@dynamic-labs-sdk/client';
|
|
1
2
|
type Props = {
|
|
2
3
|
environmentId: string;
|
|
3
|
-
handleLogOut: () => Promise<void>;
|
|
4
|
+
handleLogOut: (reason?: LogoutReason) => Promise<void>;
|
|
4
5
|
};
|
|
5
6
|
export declare const useValidateSession: ({ environmentId, handleLogOut }: Props) => void;
|
|
6
7
|
export {};
|
|
@@ -37,9 +37,9 @@ const useValidateSession = ({ environmentId, handleLogOut }) => {
|
|
|
37
37
|
const initStatus = useClientInitStatus();
|
|
38
38
|
const logout = useCallback(
|
|
39
39
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
-
(reason, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
(reason, params, logoutReason) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
41
|
logger.info(`Logging out due to invalid session - Reason: ${reason}`, Object.assign({}, params));
|
|
42
|
-
return handleLogOut();
|
|
42
|
+
return handleLogOut(logoutReason);
|
|
43
43
|
}), [handleLogOut]);
|
|
44
44
|
const validateSession = useCallback((projectSettings) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
45
|
const params = {
|
|
@@ -50,7 +50,7 @@ require('../../../../../context/VerificationContext/VerificationContext.cjs');
|
|
|
50
50
|
require('react-dom');
|
|
51
51
|
require('../../../../../utils/functions/compareChains/compareChains.cjs');
|
|
52
52
|
require('../../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
53
|
-
|
|
53
|
+
require('../../../../../context/ThemeContext/ThemeContext.cjs');
|
|
54
54
|
var useSmartWallets = require('../../../../../utils/hooks/useSmartWallets/useSmartWallets.cjs');
|
|
55
55
|
require('../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
56
56
|
var usePasskeyRecovery = require('../../../../../utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs');
|
|
@@ -127,7 +127,6 @@ var useInternalDynamicContext = require('../../../../../context/DynamicContext/u
|
|
|
127
127
|
const EmbeddedWalletExportSection = () => {
|
|
128
128
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
129
129
|
const { t } = reactI18next.useTranslation();
|
|
130
|
-
const { theme } = ThemeContext.useThemeContext();
|
|
131
130
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
132
131
|
const { primaryWallet, user, projectSettings, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
133
132
|
const { pushView } = ViewContext.useViewContext();
|
|
@@ -221,7 +220,7 @@ const EmbeddedWalletExportSection = () => {
|
|
|
221
220
|
handleExportClick();
|
|
222
221
|
}, [handleExportClick]);
|
|
223
222
|
const handleExportWithPhraseClick = React.useCallback(() => handleExportClick(true), [handleExportClick]);
|
|
224
|
-
const exportIconClasses =
|
|
223
|
+
const exportIconClasses = 'settings-view__body__section__button__icon';
|
|
225
224
|
const backupOptions = (_k = (_j = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _j === void 0 ? void 0 : _j.waas) === null || _k === void 0 ? void 0 : _k.backupOptions;
|
|
226
225
|
const isCloudBackupEnabled = Boolean((backupOptions === null || backupOptions === void 0 ? void 0 : backupOptions.includes(sdkApiCore.WaasBackupOptionsEnum.GoogleDrive)) ||
|
|
227
226
|
(backupOptions === null || backupOptions === void 0 ? void 0 : backupOptions.includes(sdkApiCore.WaasBackupOptionsEnum.ICloud)));
|
|
@@ -46,7 +46,7 @@ import '../../../../../context/VerificationContext/VerificationContext.js';
|
|
|
46
46
|
import 'react-dom';
|
|
47
47
|
import '../../../../../utils/functions/compareChains/compareChains.js';
|
|
48
48
|
import '../../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
49
|
-
import
|
|
49
|
+
import '../../../../../context/ThemeContext/ThemeContext.js';
|
|
50
50
|
import { useSmartWallets } from '../../../../../utils/hooks/useSmartWallets/useSmartWallets.js';
|
|
51
51
|
import '../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
52
52
|
import { usePasskeyRecovery } from '../../../../../utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js';
|
|
@@ -123,7 +123,6 @@ import { useInternalDynamicContext } from '../../../../../context/DynamicContext
|
|
|
123
123
|
const EmbeddedWalletExportSection = () => {
|
|
124
124
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
125
125
|
const { t } = useTranslation();
|
|
126
|
-
const { theme } = useThemeContext();
|
|
127
126
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
128
127
|
const { primaryWallet, user, projectSettings, setShowAuthFlow } = useInternalDynamicContext();
|
|
129
128
|
const { pushView } = useViewContext();
|
|
@@ -217,7 +216,7 @@ const EmbeddedWalletExportSection = () => {
|
|
|
217
216
|
handleExportClick();
|
|
218
217
|
}, [handleExportClick]);
|
|
219
218
|
const handleExportWithPhraseClick = useCallback(() => handleExportClick(true), [handleExportClick]);
|
|
220
|
-
const exportIconClasses =
|
|
219
|
+
const exportIconClasses = 'settings-view__body__section__button__icon';
|
|
221
220
|
const backupOptions = (_k = (_j = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _j === void 0 ? void 0 : _j.waas) === null || _k === void 0 ? void 0 : _k.backupOptions;
|
|
222
221
|
const isCloudBackupEnabled = Boolean((backupOptions === null || backupOptions === void 0 ? void 0 : backupOptions.includes(WaasBackupOptionsEnum.GoogleDrive)) ||
|
|
223
222
|
(backupOptions === null || backupOptions === void 0 ? void 0 : backupOptions.includes(WaasBackupOptionsEnum.ICloud)));
|
|
@@ -49,7 +49,7 @@ require('../../../../context/VerificationContext/VerificationContext.cjs');
|
|
|
49
49
|
require('react-dom');
|
|
50
50
|
require('../../../../utils/functions/compareChains/compareChains.cjs');
|
|
51
51
|
require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
52
|
-
|
|
52
|
+
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
53
53
|
var useSmartWallets = require('../../../../utils/hooks/useSmartWallets/useSmartWallets.cjs');
|
|
54
54
|
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
55
55
|
var usePasskeyRecovery = require('../../../../utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs');
|
|
@@ -122,7 +122,6 @@ var useInternalDynamicContext = require('../../../../context/DynamicContext/useD
|
|
|
122
122
|
const ExportAndRecoveryView = () => {
|
|
123
123
|
var _a, _b;
|
|
124
124
|
const { t } = reactI18next.useTranslation();
|
|
125
|
-
const { theme } = ThemeContext.useThemeContext();
|
|
126
125
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
127
126
|
const { primaryWallet, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
128
127
|
const { pushView } = ViewContext.useViewContext();
|
|
@@ -163,7 +162,7 @@ const ExportAndRecoveryView = () => {
|
|
|
163
162
|
pushView('export-shares-view');
|
|
164
163
|
}
|
|
165
164
|
}, [isPasswordEncrypted, setDynamicWidgetView, setShowAuthFlow, pushView]);
|
|
166
|
-
const exportIconClasses =
|
|
165
|
+
const exportIconClasses = 'settings-view__body__section__button__icon';
|
|
167
166
|
const privateKeyButtonStartSlot = React.useMemo(() => (jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportPrivateKey.ReactComponent, { className: exportIconClasses }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_export_and_recovery.private_key', children: t('dyn_export_and_recovery.private_key') })] })), [exportIconClasses, t]);
|
|
168
167
|
const exportSharesButtonStartSlot = React.useMemo(() => (jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportRecoveryPhrase.ReactComponent, { className: exportIconClasses }), jsxRuntime.jsxs("div", { className: 'export-and-recovery-view__export-shares-label', children: [jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_export_and_recovery.export_shares', children: t('dyn_export_and_recovery.export_shares') }), jsxRuntime.jsx("span", { className: 'export-and-recovery-view__advanced-badge', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'inherit', weight: 'medium', copykey: 'dyn_export_and_recovery.advanced', children: t('dyn_export_and_recovery.advanced') }) })] })] })), [exportIconClasses, t]);
|
|
169
168
|
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
@@ -45,7 +45,7 @@ import '../../../../context/VerificationContext/VerificationContext.js';
|
|
|
45
45
|
import 'react-dom';
|
|
46
46
|
import '../../../../utils/functions/compareChains/compareChains.js';
|
|
47
47
|
import '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
48
|
-
import
|
|
48
|
+
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
49
49
|
import { useSmartWallets } from '../../../../utils/hooks/useSmartWallets/useSmartWallets.js';
|
|
50
50
|
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
51
51
|
import { usePasskeyRecovery } from '../../../../utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js';
|
|
@@ -118,7 +118,6 @@ import { useInternalDynamicContext } from '../../../../context/DynamicContext/us
|
|
|
118
118
|
const ExportAndRecoveryView = () => {
|
|
119
119
|
var _a, _b;
|
|
120
120
|
const { t } = useTranslation();
|
|
121
|
-
const { theme } = useThemeContext();
|
|
122
121
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
123
122
|
const { primaryWallet, setShowAuthFlow } = useInternalDynamicContext();
|
|
124
123
|
const { pushView } = useViewContext();
|
|
@@ -159,7 +158,7 @@ const ExportAndRecoveryView = () => {
|
|
|
159
158
|
pushView('export-shares-view');
|
|
160
159
|
}
|
|
161
160
|
}, [isPasswordEncrypted, setDynamicWidgetView, setShowAuthFlow, pushView]);
|
|
162
|
-
const exportIconClasses =
|
|
161
|
+
const exportIconClasses = 'settings-view__body__section__button__icon';
|
|
163
162
|
const privateKeyButtonStartSlot = useMemo(() => (jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportPrivateKey, { className: exportIconClasses }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_export_and_recovery.private_key', children: t('dyn_export_and_recovery.private_key') })] })), [exportIconClasses, t]);
|
|
164
163
|
const exportSharesButtonStartSlot = useMemo(() => (jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: exportIconClasses }), jsxs("div", { className: 'export-and-recovery-view__export-shares-label', children: [jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_export_and_recovery.export_shares', children: t('dyn_export_and_recovery.export_shares') }), jsx("span", { className: 'export-and-recovery-view__advanced-badge', children: jsx(Typography, { variant: 'body_small', color: 'inherit', weight: 'medium', copykey: 'dyn_export_and_recovery.advanced', children: t('dyn_export_and_recovery.advanced') }) })] })] })), [exportIconClasses, t]);
|
|
165
164
|
const backButton = (jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
|