@dynamic-labs/sdk-react-core 4.73.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 +14 -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/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/utils/hooks/useSyncDeviceRegistrationFlow/useSyncDeviceRegistrationFlow.cjs +3 -3
- package/src/lib/utils/hooks/useSyncDeviceRegistrationFlow/useSyncDeviceRegistrationFlow.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
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
|
+
|
|
2
16
|
## [4.73.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.72.0...v4.73.0) (2026-03-30)
|
|
3
17
|
|
|
4
18
|
|
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.73.
|
|
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.73.
|
|
20
|
-
"@dynamic-labs/iconic": "4.73.
|
|
21
|
-
"@dynamic-labs/locale": "4.73.
|
|
22
|
-
"@dynamic-labs/logger": "4.73.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "4.73.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "4.73.
|
|
25
|
-
"@dynamic-labs/store": "4.73.
|
|
26
|
-
"@dynamic-labs/types": "4.73.
|
|
27
|
-
"@dynamic-labs/utils": "4.73.
|
|
28
|
-
"@dynamic-labs/wallet-book": "4.73.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "4.73.
|
|
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,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 {
|
|
@@ -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 })) {
|