@dynamic-labs/sdk-react-core 4.90.0 → 4.91.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.
- package/CHANGELOG.md +36 -0
- package/README.md +1 -52
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +13 -13
- package/src/lib/client/extension/functions/getSessionKeys/getSessionKeys.cjs +11 -0
- package/src/lib/client/extension/functions/getSessionKeys/getSessionKeys.js +7 -0
- package/src/lib/client/extension/functions/getSessionPublicKey/getSessionPublicKey.cjs +17 -0
- package/src/lib/client/extension/functions/getSessionPublicKey/getSessionPublicKey.d.ts +7 -0
- package/src/lib/client/extension/functions/getSessionPublicKey/getSessionPublicKey.js +13 -0
- package/src/lib/client/extension/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +9 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +10 -2
- package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.cjs +3 -0
- package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.js +3 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.cjs +12 -0
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.js +12 -0
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.cjs +7 -3
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.js +7 -3
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +16 -3
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +3 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +16 -3
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +8 -1
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.d.ts +1 -1
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +8 -1
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs +8 -0
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.js +8 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveMidnightWalletBalance/ActiveMidnightWalletBalance.cjs +59 -13
- package/src/lib/widgets/DynamicWidget/components/ActiveMidnightWalletBalance/ActiveMidnightWalletBalance.js +61 -15
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveMidnightWalletAddresses/ActiveMidnightWalletAddresses.cjs +40 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveMidnightWalletAddresses/ActiveMidnightWalletAddresses.d.ts +7 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveMidnightWalletAddresses/ActiveMidnightWalletAddresses.js +41 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +2 -0
- package/src/lib/widgets/DynamicWidget/views/DepositView/DepositView.cjs +18 -2
- package/src/lib/widgets/DynamicWidget/views/DepositView/DepositView.js +18 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,40 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.91.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.0...v4.91.1) (2026-06-24)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **aleo:** update sendBalance with individual and marketplace logic ([#11709](https://github.com/dynamic-labs/dynamic-auth/issues/11709)) ([f8dfc48](https://github.com/dynamic-labs/dynamic-auth/commit/f8dfc488ae607fbbbcc3432a3ef69f746f0b7df0))
|
|
8
|
+
* **sdk-react-core:** surface shielded address in Midnight deposit view ([#11698](https://github.com/dynamic-labs/dynamic-auth/issues/11698)) ([79c5402](https://github.com/dynamic-labs/dynamic-auth/commit/79c54029b1d8f722cf9f1d8b4c11977898442ac0))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* display actual error message for WaaS export failures instead of generic fallback ([#11498](https://github.com/dynamic-labs/dynamic-auth/issues/11498)) ([373c931](https://github.com/dynamic-labs/dynamic-auth/commit/373c931eb96c88e484c557ee8f2934660d028f97))
|
|
14
|
+
* **wallet-book:** guard replaceKey and remove stale override ([#11682](https://github.com/dynamic-labs/dynamic-auth/issues/11682)) ([13947d9](https://github.com/dynamic-labs/dynamic-auth/commit/13947d972ed1f8227712bfc01af9cc2be616a78a))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Performance Improvements
|
|
18
|
+
|
|
19
|
+
* **e2e:** prebuild Expo web bundle for RN e2e tests ([#11674](https://github.com/dynamic-labs/dynamic-auth/issues/11674)) ([16e002d](https://github.com/dynamic-labs/dynamic-auth/commit/16e002d59b2035e3f2c116879a78418a959da8bc))
|
|
20
|
+
|
|
21
|
+
## [4.91.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.90.0...v4.91.0) (2026-06-23)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* **midnight:** add WaaS layer to @dynamic-labs/midnight ([#11006](https://github.com/dynamic-labs/dynamic-auth/issues/11006)) ([01b9d16](https://github.com/dynamic-labs/dynamic-auth/commit/01b9d16d0ba92a141a9be546ca00cca4029894d5))
|
|
27
|
+
* **sdk-react-core:** widget support for Midnight multi-address display + export hiding ([#11008](https://github.com/dynamic-labs/dynamic-auth/issues/11008)) ([87320b4](https://github.com/dynamic-labs/dynamic-auth/commit/87320b4d6e286b88e17f144641346e16a27e9e71))
|
|
28
|
+
* **waas:** wire session public key through host backup ops for keyshare diagnostics [DYNT-1280] ([#11675](https://github.com/dynamic-labs/dynamic-auth/issues/11675)) ([4f7981c](https://github.com/dynamic-labs/dynamic-auth/commit/4f7981c009930469dec7b3dec93f20f99bbe5498))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* **ethereum-aa:** make ZeroDevConnector inert instead of throwing when ZeroDev config is absent ([#11610](https://github.com/dynamic-labs/dynamic-auth/issues/11610)) ([a3aab6a](https://github.com/dynamic-labs/dynamic-auth/commit/a3aab6a97e2e996f96b725f9336704b844f79603))
|
|
34
|
+
* **react-native-extension:** fall back to react-native-webview when embedded native module is unavailable ([#11683](https://github.com/dynamic-labs/dynamic-auth/issues/11683)) ([3f8d92c](https://github.com/dynamic-labs/dynamic-auth/commit/3f8d92ca0c327128b16e3355ab2f4e63d2c8e731))
|
|
35
|
+
* **sdk-react-core:** warn instead of throwing when ZeroDev connector is absent ([#11611](https://github.com/dynamic-labs/dynamic-auth/issues/11611)) ([5836252](https://github.com/dynamic-labs/dynamic-auth/commit/58362524e45205399c0fdc5b92414190d1929e0b))
|
|
36
|
+
* **waas-evm:** sign EOA transactions with the resolved chainId, not the connector default ([#11653](https://github.com/dynamic-labs/dynamic-auth/issues/11653)) ([e634098](https://github.com/dynamic-labs/dynamic-auth/commit/e634098f0f23f4c53f92a580db6f4aacbd6b1f92))
|
|
37
|
+
|
|
2
38
|
## [4.90.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.89.0...v4.90.0) (2026-06-19)
|
|
3
39
|
|
|
4
40
|
|
package/README.md
CHANGED
|
@@ -1,54 +1,3 @@
|
|
|
1
1
|
# Dynamic Labs' React SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Welcome to Dynamic! We're so excited that you're here!
|
|
6
|
-
|
|
7
|
-
## What is Dynamic?
|
|
8
|
-
|
|
9
|
-
Dynamic offers smart and beautiful login flows for crypto-native users, simple onboarding flows for everyone else, and powerful developer tools that go beyond authentication.
|
|
10
|
-
|
|
11
|
-
## Product walkthrough
|
|
12
|
-
|
|
13
|
-
Want a quick overview of some of the powerful features Dynamic offers? check out our product walkthrough video below.
|
|
14
|
-
|
|
15
|
-
<a href="https://www.youtube.com/watch?v=LKP-aJOTxfw
|
|
16
|
-
" target="_blank"><img src="https://user-images.githubusercontent.com/1596208/224676777-5f6ffad2-f2c3-4f49-bc4e-a8643da777cd.jpg"
|
|
17
|
-
alt="Product walkthrough video" width="1280" /></a>
|
|
18
|
-
|
|
19
|
-
## Getting started
|
|
20
|
-
|
|
21
|
-
Getting started with Dynamic is simple, and [you can read the full guide here](https://docs.dynamic.xyz/docs/getting-started-with-dynamic).
|
|
22
|
-
|
|
23
|
-
Here is a shoterned version of the getting started guide:
|
|
24
|
-
|
|
25
|
-
1. [Create your Dynamic account and grab an Environment ID](https://app.dynamic.xyz).
|
|
26
|
-
2. Install this npm package
|
|
27
|
-
3. Configure the SDK
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
import {
|
|
31
|
-
DynamicContextProvider,
|
|
32
|
-
DynamicWidget,
|
|
33
|
-
} from '@dynamic-labs/sdk-react-core';
|
|
34
|
-
|
|
35
|
-
const App = () => (
|
|
36
|
-
<DynamicContextProvider
|
|
37
|
-
settings={{
|
|
38
|
-
environmentId: 'ID',
|
|
39
|
-
}}
|
|
40
|
-
>
|
|
41
|
-
<DynamicWidget />
|
|
42
|
-
</DynamicContextProvider>
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
export default App;
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Feedback
|
|
49
|
-
|
|
50
|
-
Dynamic strives to help you build innovative experiences, meaning we're always adding new features. You can [Join our Slack community](https://www.dynamic.xyz/slack)., [follow us on twitter](https://twitter.com/dynamic_xyz) or check out our [change log](https://www.dynamic.xyz/changelog) to see the latest and greatest from us.
|
|
51
|
-
|
|
52
|
-
## Documentation
|
|
53
|
-
|
|
54
|
-
**Get started [here](https://docs.dynamic.xyz/docs).**
|
|
3
|
+
> **Use our new SDK:** This package is part of our legacy SDK. The recommended approach to implement Dynamic in React is to use our new JavaScript SDK together with our React hooks library. See the [React Quickstart guide](https://www.dynamic.xyz/docs/javascript/reference/react-quickstart) to get started.
|
package/package.cjs
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "4.
|
|
6
|
+
var version = "4.91.1";
|
|
7
7
|
var dependencies = {
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "0.0.1046",
|
|
9
9
|
"@dynamic-labs-sdk/client": "1.12.1",
|
|
10
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.0.
|
|
10
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.0.44",
|
|
11
11
|
"@dynamic-labs-wallet/forward-mpc-client": "0.12.0",
|
|
12
12
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
13
13
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
package/package.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "4.
|
|
2
|
+
var version = "4.91.1";
|
|
3
3
|
var dependencies = {
|
|
4
4
|
"@dynamic-labs/sdk-api-core": "0.0.1046",
|
|
5
5
|
"@dynamic-labs-sdk/client": "1.12.1",
|
|
6
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.0.
|
|
6
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.0.44",
|
|
7
7
|
"@dynamic-labs-wallet/forward-mpc-client": "0.12.0",
|
|
8
8
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
9
9
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.91.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.1046",
|
|
6
6
|
"@dynamic-labs-sdk/client": "1.12.1",
|
|
7
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.0.
|
|
7
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.0.44",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "0.12.0",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
10
10
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
"yup": "0.32.11",
|
|
18
18
|
"react-international-phone": "4.5.0",
|
|
19
19
|
"bs58": "5.0.0",
|
|
20
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
21
|
-
"@dynamic-labs/iconic": "4.
|
|
22
|
-
"@dynamic-labs/locale": "4.
|
|
23
|
-
"@dynamic-labs/logger": "4.
|
|
24
|
-
"@dynamic-labs/multi-wallet": "4.
|
|
25
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
26
|
-
"@dynamic-labs/store": "4.
|
|
27
|
-
"@dynamic-labs/types": "4.
|
|
28
|
-
"@dynamic-labs/utils": "4.
|
|
29
|
-
"@dynamic-labs/wallet-book": "4.
|
|
30
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
20
|
+
"@dynamic-labs/assert-package-version": "4.91.1",
|
|
21
|
+
"@dynamic-labs/iconic": "4.91.1",
|
|
22
|
+
"@dynamic-labs/locale": "4.91.1",
|
|
23
|
+
"@dynamic-labs/logger": "4.91.1",
|
|
24
|
+
"@dynamic-labs/multi-wallet": "4.91.1",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "4.91.1",
|
|
26
|
+
"@dynamic-labs/store": "4.91.1",
|
|
27
|
+
"@dynamic-labs/types": "4.91.1",
|
|
28
|
+
"@dynamic-labs/utils": "4.91.1",
|
|
29
|
+
"@dynamic-labs/wallet-book": "4.91.1",
|
|
30
|
+
"@dynamic-labs/wallet-connector-core": "4.91.1",
|
|
31
31
|
"eventemitter3": "5.0.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
7
|
+
var core = require('@dynamic-labs-sdk/client/core');
|
|
8
|
+
|
|
9
|
+
const getSessionKeys = () => core.getSessionKeys(client.getDefaultClient());
|
|
10
|
+
|
|
11
|
+
exports.getSessionKeys = getSessionKeys;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var getSessionKeys = require('../getSessionKeys/getSessionKeys.cjs');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the session public key the client signs session chaining nonces
|
|
11
|
+
* with. Forwarded to the keyshare service on backup so a signature failure can
|
|
12
|
+
* be logged against the JWT-embedded key. Nonce-free; undefined before a
|
|
13
|
+
* session key exists.
|
|
14
|
+
*/
|
|
15
|
+
const getSessionPublicKey = () => _tslib.__awaiter(void 0, void 0, void 0, function* () { var _a; return (_a = getSessionKeys.getSessionKeys()) === null || _a === void 0 ? void 0 : _a.publicKey; });
|
|
16
|
+
|
|
17
|
+
exports.getSessionPublicKey = getSessionPublicKey;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the session public key the client signs session chaining nonces
|
|
3
|
+
* with. Forwarded to the keyshare service on backup so a signature failure can
|
|
4
|
+
* be logged against the JWT-embedded key. Nonce-free; undefined before a
|
|
5
|
+
* session key exists.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getSessionPublicKey: () => Promise<string | undefined>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { getSessionKeys } from '../getSessionKeys/getSessionKeys.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Resolves the session public key the client signs session chaining nonces
|
|
7
|
+
* with. Forwarded to the keyshare service on backup so a signature failure can
|
|
8
|
+
* be logged against the JWT-embedded key. Nonce-free; undefined before a
|
|
9
|
+
* session key exists.
|
|
10
|
+
*/
|
|
11
|
+
const getSessionPublicKey = () => __awaiter(void 0, void 0, void 0, function* () { var _a; return (_a = getSessionKeys()) === null || _a === void 0 ? void 0 : _a.publicKey; });
|
|
12
|
+
|
|
13
|
+
export { getSessionPublicKey };
|
|
@@ -19,6 +19,7 @@ export { hasElevatedAccessToken } from './functions/hasElevatedAccessToken';
|
|
|
19
19
|
export { generateChainingSignature } from './functions/generateChainingSignature/generateChainingSignature';
|
|
20
20
|
export { generateSessionKeys } from './functions/generateSessionKeys/generateSessionKeys';
|
|
21
21
|
export { getSessionKeys } from './functions/getSessionKeys/getSessionKeys';
|
|
22
|
+
export { getSessionPublicKey } from './functions/getSessionPublicKey/getSessionPublicKey';
|
|
22
23
|
export { getClientSessionNonceHeaders } from './functions/getClientSessionNonceHeaders/getClientSessionNonceHeaders';
|
|
23
24
|
export { useInitStatus } from './initStatus/useInitStatus';
|
|
24
25
|
export { setUnverifiedWalletAccounts } from './unverifiedWalletAccounts/setUnverifiedWalletAccounts';
|
|
@@ -347,7 +347,12 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
347
347
|
//selected wallet to perform an action (become primary, unlink, etc)
|
|
348
348
|
const [selectedWalletWithAction, setSelectedWalletWithAction] = React.useState(null);
|
|
349
349
|
useSetWalletConnectorVerifiedCredentials.useSetWalletConnectorVerifiedCredentials(user !== null && user !== void 0 ? user : userWithMissingInfo, walletConnectorOptions);
|
|
350
|
-
|
|
350
|
+
// handleLogOutWithReason is created later in this component (via useHandleLogout),
|
|
351
|
+
// but useSetWalletConnectorFetchers needs a logout callback now. Bridge the two
|
|
352
|
+
// with a ref: the WaaS connector only invokes onUnauthorized at runtime (when
|
|
353
|
+
// the iframe reports a 401), by which point the ref is populated.
|
|
354
|
+
const handleLogOutWithReasonRef = React.useRef();
|
|
355
|
+
useSetWalletConnectorFetchers.useSetWalletConnectorFetchers(walletConnectorOptions, environmentId, projectSettings, () => { var _a; return (_a = handleLogOutWithReasonRef.current) === null || _a === void 0 ? void 0 : _a.call(handleLogOutWithReasonRef, 'session-refresh-unauthorized'); });
|
|
351
356
|
const { primaryWallet, showQrcodeModal, secondaryWallets, setPrimaryWallet, setShowQrcodeModal, wallets: linkedOrConnectedWallets, } = useWalletConnectors.useWalletConnectors({
|
|
352
357
|
canHaveMultipleWalletsConnected: multiWallet || isBridgeFlow,
|
|
353
358
|
connectedWallets,
|
|
@@ -403,6 +408,9 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
403
408
|
environmentId,
|
|
404
409
|
handleLogOutWithReason,
|
|
405
410
|
});
|
|
411
|
+
// Keep the ref current so the WaaS connector's onUnauthorized callback always
|
|
412
|
+
// calls the latest logout handler.
|
|
413
|
+
handleLogOutWithReasonRef.current = handleLogOutWithReason;
|
|
406
414
|
// For some reason, calling useNonce in useGlobalLoading causes errors
|
|
407
415
|
const nonce$1 = nonce.useNonce();
|
|
408
416
|
const sdkHasLoaded = useGlobalLoading.useGlobalLoading({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
import { createContext, useEffect, useState, useMemo, useCallback } from 'react';
|
|
4
|
+
import { createContext, useEffect, useState, useMemo, useRef, useCallback } from 'react';
|
|
5
5
|
import { I18nextProvider } from 'react-i18next';
|
|
6
6
|
import { getIconicSpriteUrl } from '@dynamic-labs/iconic';
|
|
7
7
|
import { Logger } from '@dynamic-labs/logger';
|
|
@@ -343,7 +343,12 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
343
343
|
//selected wallet to perform an action (become primary, unlink, etc)
|
|
344
344
|
const [selectedWalletWithAction, setSelectedWalletWithAction] = useState(null);
|
|
345
345
|
useSetWalletConnectorVerifiedCredentials(user !== null && user !== void 0 ? user : userWithMissingInfo, walletConnectorOptions);
|
|
346
|
-
|
|
346
|
+
// handleLogOutWithReason is created later in this component (via useHandleLogout),
|
|
347
|
+
// but useSetWalletConnectorFetchers needs a logout callback now. Bridge the two
|
|
348
|
+
// with a ref: the WaaS connector only invokes onUnauthorized at runtime (when
|
|
349
|
+
// the iframe reports a 401), by which point the ref is populated.
|
|
350
|
+
const handleLogOutWithReasonRef = useRef();
|
|
351
|
+
useSetWalletConnectorFetchers(walletConnectorOptions, environmentId, projectSettings, () => { var _a; return (_a = handleLogOutWithReasonRef.current) === null || _a === void 0 ? void 0 : _a.call(handleLogOutWithReasonRef, 'session-refresh-unauthorized'); });
|
|
347
352
|
const { primaryWallet, showQrcodeModal, secondaryWallets, setPrimaryWallet, setShowQrcodeModal, wallets: linkedOrConnectedWallets, } = useWalletConnectors({
|
|
348
353
|
canHaveMultipleWalletsConnected: multiWallet || isBridgeFlow,
|
|
349
354
|
connectedWallets,
|
|
@@ -399,6 +404,9 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
399
404
|
environmentId,
|
|
400
405
|
handleLogOutWithReason,
|
|
401
406
|
});
|
|
407
|
+
// Keep the ref current so the WaaS connector's onUnauthorized callback always
|
|
408
|
+
// calls the latest logout handler.
|
|
409
|
+
handleLogOutWithReasonRef.current = handleLogOutWithReason;
|
|
402
410
|
// For some reason, calling useNonce in useGlobalLoading causes errors
|
|
403
411
|
const nonce = useNonce();
|
|
404
412
|
const sdkHasLoaded = useGlobalLoading({
|
|
@@ -63,6 +63,9 @@ const getProperErrorMessage = (originalError, user) => {
|
|
|
63
63
|
reactNativePasskeyErrors[originalError.error]) {
|
|
64
64
|
return reactNativePasskeyErrors[originalError.error];
|
|
65
65
|
}
|
|
66
|
+
if (originalError instanceof Error && originalError.message) {
|
|
67
|
+
return originalError.message;
|
|
68
|
+
}
|
|
66
69
|
return 'Something went wrong';
|
|
67
70
|
};
|
|
68
71
|
|
|
@@ -59,6 +59,9 @@ const getProperErrorMessage = (originalError, user) => {
|
|
|
59
59
|
reactNativePasskeyErrors[originalError.error]) {
|
|
60
60
|
return reactNativePasskeyErrors[originalError.error];
|
|
61
61
|
}
|
|
62
|
+
if (originalError instanceof Error && originalError.message) {
|
|
63
|
+
return originalError.message;
|
|
64
|
+
}
|
|
62
65
|
return 'Something went wrong';
|
|
63
66
|
};
|
|
64
67
|
|