@dynamic-labs/sdk-react-core 2.2.1 → 2.2.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 +7 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +16 -6
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +16 -6
- package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +5 -1
- package/src/lib/shared/utils/functions/isUserLinkingWallet/isUserLinkingWallet.d.ts +2 -0
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/functions/isPhoneNumberProviderEnabled/index.d.ts +1 -0
- package/src/lib/utils/functions/logVerboseTroubleshootingMessage/index.d.ts +1 -0
- package/src/lib/utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs +27 -0
- package/src/lib/utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.d.ts +1 -0
- package/src/lib/utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js +23 -0
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +2 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +2 -2
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +6 -0
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
### [2.2.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.1...v2.2.2) (2024-06-18)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* make account change idemopotent ([#6062](https://github.com/dynamic-labs/DynamicAuth/issues/6062)) ([2308d32](https://github.com/dynamic-labs/DynamicAuth/commit/2308d32d18627f2673c8f4c9b5623a9c731e4752))
|
|
8
|
+
|
|
2
9
|
### [2.2.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.0...v2.2.1) (2024-06-17)
|
|
3
10
|
|
|
4
11
|
|
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": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/iconic": "2.2.
|
|
21
|
-
"@dynamic-labs/logger": "2.2.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "2.2.
|
|
23
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.2.
|
|
24
|
-
"@dynamic-labs/rpc-provider-solana": "2.2.
|
|
25
|
-
"@dynamic-labs/rpc-providers": "2.2.
|
|
26
|
-
"@dynamic-labs/store": "2.2.
|
|
27
|
-
"@dynamic-labs/types": "2.2.
|
|
28
|
-
"@dynamic-labs/utils": "2.2.
|
|
29
|
-
"@dynamic-labs/viem-utils": "2.2.
|
|
30
|
-
"@dynamic-labs/wallet-book": "2.2.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "2.2.
|
|
20
|
+
"@dynamic-labs/iconic": "2.2.2",
|
|
21
|
+
"@dynamic-labs/logger": "2.2.2",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "2.2.2",
|
|
23
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.2.2",
|
|
24
|
+
"@dynamic-labs/rpc-provider-solana": "2.2.2",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "2.2.2",
|
|
26
|
+
"@dynamic-labs/store": "2.2.2",
|
|
27
|
+
"@dynamic-labs/types": "2.2.2",
|
|
28
|
+
"@dynamic-labs/utils": "2.2.2",
|
|
29
|
+
"@dynamic-labs/viem-utils": "2.2.2",
|
|
30
|
+
"@dynamic-labs/wallet-book": "2.2.2",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "2.2.2",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs
CHANGED
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var useDynamicEvents = require('../../../../utils/hooks/events/useDynamicEvents/useDynamicEvents.cjs');
|
|
7
|
-
require('react');
|
|
8
|
-
require('../../../../../../_virtual/_tslib.cjs');
|
|
9
|
-
require('@dynamic-labs/utils');
|
|
10
|
-
require('../../DynamicContext.cjs');
|
|
11
6
|
require('@dynamic-labs/sdk-api-core');
|
|
12
|
-
require('../../../../shared/logger.cjs');
|
|
7
|
+
var logger = require('../../../../shared/logger.cjs');
|
|
13
8
|
require('@dynamic-labs/iconic');
|
|
14
9
|
require('@dynamic-labs/wallet-connector-core');
|
|
15
10
|
require('react/jsx-runtime');
|
|
16
11
|
require('../../../ViewContext/ViewContext.cjs');
|
|
12
|
+
require('react');
|
|
17
13
|
require('@dynamic-labs/wallet-book');
|
|
18
14
|
require('../../../../utils/constants/colors.cjs');
|
|
19
15
|
require('../../../../utils/constants/values.cjs');
|
|
20
16
|
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
17
|
+
require('@dynamic-labs/utils');
|
|
21
18
|
require('../../../../shared/consts/index.cjs');
|
|
19
|
+
var useDynamicEvents = require('../../../../utils/hooks/events/useDynamicEvents/useDynamicEvents.cjs');
|
|
20
|
+
require('../../../../../../_virtual/_tslib.cjs');
|
|
21
|
+
require('../../DynamicContext.cjs');
|
|
22
22
|
require('../../../CaptchaContext/CaptchaContext.cjs');
|
|
23
23
|
require('../../../ErrorContext/ErrorContext.cjs');
|
|
24
24
|
require('@dynamic-labs/multi-wallet');
|
|
@@ -105,14 +105,22 @@ const useTieCallbacksToEvents = ({ clientCallbacks, user, setHasLoggedOut, }) =>
|
|
|
105
105
|
useDynamicEvents.useInternalDynamicEvents('walletAdded', (wallet, userWallets) => {
|
|
106
106
|
var _a;
|
|
107
107
|
setHasLoggedOut(false);
|
|
108
|
+
logger.logger.debug('[walletAdded]', { userWallets, wallet });
|
|
108
109
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onWalletAdded) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, { userWallets, wallet });
|
|
109
110
|
});
|
|
110
111
|
useDynamicEvents.useInternalDynamicEvents('walletRemoved', (wallet, userWallets) => {
|
|
111
112
|
var _a;
|
|
113
|
+
logger.logger.debug('[walletRemoved]', { userWallets, wallet });
|
|
112
114
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onWalletRemoved) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, { userWallets, wallet });
|
|
113
115
|
});
|
|
114
116
|
useDynamicEvents.useInternalDynamicEvents('embeddedWalletCreated', (_wallet, jwtVerifiedCredential, authToken, user) => {
|
|
115
117
|
var _a;
|
|
118
|
+
logger.logger.debug('[embeddedWalletCreated]', {
|
|
119
|
+
_wallet,
|
|
120
|
+
authToken,
|
|
121
|
+
jwtVerifiedCredential,
|
|
122
|
+
user,
|
|
123
|
+
});
|
|
116
124
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onEmbeddedWalletCreated) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, jwtVerifiedCredential, authToken, user);
|
|
117
125
|
});
|
|
118
126
|
useDynamicEvents.useInternalDynamicEvents('logout', () => {
|
|
@@ -121,10 +129,12 @@ const useTieCallbacksToEvents = ({ clientCallbacks, user, setHasLoggedOut, }) =>
|
|
|
121
129
|
});
|
|
122
130
|
useDynamicEvents.useInternalDynamicEvents('authFailure', (data, reason) => {
|
|
123
131
|
var _a;
|
|
132
|
+
logger.logger.debug('[authFailure]', { data, reason });
|
|
124
133
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onAuthFailure) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, data, reason);
|
|
125
134
|
});
|
|
126
135
|
useDynamicEvents.useInternalDynamicEvents('authInit', (data) => {
|
|
127
136
|
var _a;
|
|
137
|
+
logger.logger.debug('[authInit]', { data });
|
|
128
138
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onAuthInit) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, data);
|
|
129
139
|
});
|
|
130
140
|
};
|
package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { useInternalDynamicEvents } from '../../../../utils/hooks/events/useDynamicEvents/useDynamicEvents.js';
|
|
3
|
-
import 'react';
|
|
4
|
-
import '../../../../../../_virtual/_tslib.js';
|
|
5
|
-
import '@dynamic-labs/utils';
|
|
6
|
-
import '../../DynamicContext.js';
|
|
7
2
|
import '@dynamic-labs/sdk-api-core';
|
|
8
|
-
import '../../../../shared/logger.js';
|
|
3
|
+
import { logger } from '../../../../shared/logger.js';
|
|
9
4
|
import '@dynamic-labs/iconic';
|
|
10
5
|
import '@dynamic-labs/wallet-connector-core';
|
|
11
6
|
import 'react/jsx-runtime';
|
|
12
7
|
import '../../../ViewContext/ViewContext.js';
|
|
8
|
+
import 'react';
|
|
13
9
|
import '@dynamic-labs/wallet-book';
|
|
14
10
|
import '../../../../utils/constants/colors.js';
|
|
15
11
|
import '../../../../utils/constants/values.js';
|
|
16
12
|
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
13
|
+
import '@dynamic-labs/utils';
|
|
17
14
|
import '../../../../shared/consts/index.js';
|
|
15
|
+
import { useInternalDynamicEvents } from '../../../../utils/hooks/events/useDynamicEvents/useDynamicEvents.js';
|
|
16
|
+
import '../../../../../../_virtual/_tslib.js';
|
|
17
|
+
import '../../DynamicContext.js';
|
|
18
18
|
import '../../../CaptchaContext/CaptchaContext.js';
|
|
19
19
|
import '../../../ErrorContext/ErrorContext.js';
|
|
20
20
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -101,14 +101,22 @@ const useTieCallbacksToEvents = ({ clientCallbacks, user, setHasLoggedOut, }) =>
|
|
|
101
101
|
useInternalDynamicEvents('walletAdded', (wallet, userWallets) => {
|
|
102
102
|
var _a;
|
|
103
103
|
setHasLoggedOut(false);
|
|
104
|
+
logger.debug('[walletAdded]', { userWallets, wallet });
|
|
104
105
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onWalletAdded) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, { userWallets, wallet });
|
|
105
106
|
});
|
|
106
107
|
useInternalDynamicEvents('walletRemoved', (wallet, userWallets) => {
|
|
107
108
|
var _a;
|
|
109
|
+
logger.debug('[walletRemoved]', { userWallets, wallet });
|
|
108
110
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onWalletRemoved) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, { userWallets, wallet });
|
|
109
111
|
});
|
|
110
112
|
useInternalDynamicEvents('embeddedWalletCreated', (_wallet, jwtVerifiedCredential, authToken, user) => {
|
|
111
113
|
var _a;
|
|
114
|
+
logger.debug('[embeddedWalletCreated]', {
|
|
115
|
+
_wallet,
|
|
116
|
+
authToken,
|
|
117
|
+
jwtVerifiedCredential,
|
|
118
|
+
user,
|
|
119
|
+
});
|
|
112
120
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onEmbeddedWalletCreated) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, jwtVerifiedCredential, authToken, user);
|
|
113
121
|
});
|
|
114
122
|
useInternalDynamicEvents('logout', () => {
|
|
@@ -117,10 +125,12 @@ const useTieCallbacksToEvents = ({ clientCallbacks, user, setHasLoggedOut, }) =>
|
|
|
117
125
|
});
|
|
118
126
|
useInternalDynamicEvents('authFailure', (data, reason) => {
|
|
119
127
|
var _a;
|
|
128
|
+
logger.debug('[authFailure]', { data, reason });
|
|
120
129
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onAuthFailure) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, data, reason);
|
|
121
130
|
});
|
|
122
131
|
useInternalDynamicEvents('authInit', (data) => {
|
|
123
132
|
var _a;
|
|
133
|
+
logger.debug('[authInit]', { data });
|
|
124
134
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onAuthInit) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, data);
|
|
125
135
|
});
|
|
126
136
|
};
|
|
@@ -31,8 +31,10 @@ export type DynamicEventsCallbacks = {
|
|
|
31
31
|
onAuthInit?: (data: AuthEventPayload) => void;
|
|
32
32
|
};
|
|
33
33
|
export type OnAuthSuccess = (params: {
|
|
34
|
+
/** @deprecated use getAuthToken instead */
|
|
34
35
|
authToken: string;
|
|
35
36
|
handleLogOut: () => Promise<void>;
|
|
37
|
+
/** @deprecated use getMinAuthToken instead */
|
|
36
38
|
minAuthToken: string;
|
|
37
39
|
isAuthenticated: boolean;
|
|
38
40
|
primaryWallet: Wallet | null;
|
|
@@ -58,4 +60,6 @@ destination: {
|
|
|
58
60
|
value: PhoneData;
|
|
59
61
|
}) => void;
|
|
60
62
|
export type OnUserProfileUpdate = (user: UserProfile) => void;
|
|
61
|
-
export type OnEmbeddedWalletCreated = (verifiedCredential: JwtVerifiedCredential | undefined,
|
|
63
|
+
export type OnEmbeddedWalletCreated = (verifiedCredential: JwtVerifiedCredential | undefined,
|
|
64
|
+
/** @deprecated use getAuthToken instead */
|
|
65
|
+
authToken: string | undefined, user: UserProfile | undefined) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './isPhoneNumberProviderEnabled';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './logVerboseTroubleshootingMessage';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
require('@dynamic-labs/sdk-api-core');
|
|
7
|
+
var logger = require('../../../shared/logger.cjs');
|
|
8
|
+
require('@dynamic-labs/iconic');
|
|
9
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
10
|
+
require('react/jsx-runtime');
|
|
11
|
+
require('../../../context/ViewContext/ViewContext.cjs');
|
|
12
|
+
require('react');
|
|
13
|
+
require('@dynamic-labs/wallet-book');
|
|
14
|
+
require('../../constants/colors.cjs');
|
|
15
|
+
require('../../constants/values.cjs');
|
|
16
|
+
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
17
|
+
require('@dynamic-labs/utils');
|
|
18
|
+
require('../../../shared/consts/index.cjs');
|
|
19
|
+
|
|
20
|
+
// use this in conjuction with dynamic_enableTroubleshootMode to see
|
|
21
|
+
// more verbose logging to help troubleshoot issues
|
|
22
|
+
// i.e: window.dynamic_enableTroubleshootMode = true
|
|
23
|
+
const logVerboseTroubleshootingMessage = (message, ...args) => {
|
|
24
|
+
logger.logger.log(-1, message, ...args);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.logVerboseTroubleshootingMessage = logVerboseTroubleshootingMessage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const logVerboseTroubleshootingMessage: (message: string | Error | unknown, ...args: any[]) => void;
|
package/src/lib/utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import '@dynamic-labs/sdk-api-core';
|
|
3
|
+
import { logger } from '../../../shared/logger.js';
|
|
4
|
+
import '@dynamic-labs/iconic';
|
|
5
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
8
|
+
import 'react';
|
|
9
|
+
import '@dynamic-labs/wallet-book';
|
|
10
|
+
import '../../constants/colors.js';
|
|
11
|
+
import '../../constants/values.js';
|
|
12
|
+
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
13
|
+
import '@dynamic-labs/utils';
|
|
14
|
+
import '../../../shared/consts/index.js';
|
|
15
|
+
|
|
16
|
+
// use this in conjuction with dynamic_enableTroubleshootMode to see
|
|
17
|
+
// more verbose logging to help troubleshoot issues
|
|
18
|
+
// i.e: window.dynamic_enableTroubleshootMode = true
|
|
19
|
+
const logVerboseTroubleshootingMessage = (message, ...args) => {
|
|
20
|
+
logger.log(-1, message, ...args);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { logVerboseTroubleshootingMessage };
|
|
@@ -107,7 +107,7 @@ const useSocialAccounts = ({ sessionTimeout } = {
|
|
|
107
107
|
}, [user === null || user === void 0 ? void 0 : user.verifiedCredentials]);
|
|
108
108
|
const checkValidOAuthLinking = React.useCallback((provider) => {
|
|
109
109
|
if (!isSocialKycEnabled.isSocialKycEnabled(projectSettings)) {
|
|
110
|
-
handleError(provider, types.SocialOAuthErrorCode.SOCIAL_LINKING_NOT_ENABLED, 'Social linking is not enabled on the dashboard', { raiseAuthFailure: false });
|
|
110
|
+
handleError(provider, types.SocialOAuthErrorCode.SOCIAL_LINKING_NOT_ENABLED, 'Social linking is not enabled in Information Capture on the dashboard', { raiseAuthFailure: false });
|
|
111
111
|
return false;
|
|
112
112
|
}
|
|
113
113
|
const verifiedCredential = verifiedOAuthCredentialsMap[provider];
|
|
@@ -118,7 +118,7 @@ const useSocialAccounts = ({ sessionTimeout } = {
|
|
|
118
118
|
const oauthProviders = index.getEnabledOAuthProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
119
119
|
const oauthProvider = oauthProviders.find((p) => p.provider === provider);
|
|
120
120
|
if (!oauthProvider) {
|
|
121
|
-
handleError(provider, types.SocialOAuthErrorCode.PROVIDER_NOT_ENABLED, `
|
|
121
|
+
handleError(provider, types.SocialOAuthErrorCode.PROVIDER_NOT_ENABLED, `Social linking provider is not enabled in Information Capture on the dashboard: ${provider}`, { raiseAuthFailure: false });
|
|
122
122
|
return false;
|
|
123
123
|
}
|
|
124
124
|
return true;
|
|
@@ -103,7 +103,7 @@ const useSocialAccounts = ({ sessionTimeout } = {
|
|
|
103
103
|
}, [user === null || user === void 0 ? void 0 : user.verifiedCredentials]);
|
|
104
104
|
const checkValidOAuthLinking = useCallback((provider) => {
|
|
105
105
|
if (!isSocialKycEnabled(projectSettings)) {
|
|
106
|
-
handleError(provider, SocialOAuthErrorCode.SOCIAL_LINKING_NOT_ENABLED, 'Social linking is not enabled on the dashboard', { raiseAuthFailure: false });
|
|
106
|
+
handleError(provider, SocialOAuthErrorCode.SOCIAL_LINKING_NOT_ENABLED, 'Social linking is not enabled in Information Capture on the dashboard', { raiseAuthFailure: false });
|
|
107
107
|
return false;
|
|
108
108
|
}
|
|
109
109
|
const verifiedCredential = verifiedOAuthCredentialsMap[provider];
|
|
@@ -114,7 +114,7 @@ const useSocialAccounts = ({ sessionTimeout } = {
|
|
|
114
114
|
const oauthProviders = getEnabledOAuthProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
115
115
|
const oauthProvider = oauthProviders.find((p) => p.provider === provider);
|
|
116
116
|
if (!oauthProvider) {
|
|
117
|
-
handleError(provider, SocialOAuthErrorCode.PROVIDER_NOT_ENABLED, `
|
|
117
|
+
handleError(provider, SocialOAuthErrorCode.PROVIDER_NOT_ENABLED, `Social linking provider is not enabled in Information Capture on the dashboard: ${provider}`, { raiseAuthFailure: false });
|
|
118
118
|
return false;
|
|
119
119
|
}
|
|
120
120
|
return true;
|
|
@@ -26,6 +26,7 @@ require('viem/chains');
|
|
|
26
26
|
require('../../../config/ApiEndpoint.cjs');
|
|
27
27
|
require('@dynamic-labs/store');
|
|
28
28
|
require('../../../locale/locale.cjs');
|
|
29
|
+
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
29
30
|
var useWalletsConnectionState = require('../useWalletsConnectionState/useWalletsConnectionState.cjs');
|
|
30
31
|
var reconnectSocialWallet = require('./reconnectSocialWallet.cjs');
|
|
31
32
|
var createLinkedWalletsFromWalletOptions = require('./utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs');
|
|
@@ -43,6 +44,7 @@ const useWalletConnectors = ({ authMode, connectedWallets, walletConnectorOption
|
|
|
43
44
|
walletConnectorOptions,
|
|
44
45
|
});
|
|
45
46
|
}, [user, primaryWalletId, walletConnectorOptions]);
|
|
47
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('linkedWallets', linkedWallets);
|
|
46
48
|
const walletsBasedOnAuthMode = React.useMemo(() => {
|
|
47
49
|
// Before signing the first message we are using connected wallets list
|
|
48
50
|
// This is because we want the first connected wallet to have events applied by useWalletEventListeners
|
|
@@ -62,6 +64,7 @@ const useWalletConnectors = ({ authMode, connectedWallets, walletConnectorOption
|
|
|
62
64
|
}
|
|
63
65
|
return connectedWallets !== null && connectedWallets !== void 0 ? connectedWallets : [];
|
|
64
66
|
}, [authMode, connectedWallets, linkedWallets, user]);
|
|
67
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('walletsBasedOnAuthMode', walletsBasedOnAuthMode);
|
|
65
68
|
/**
|
|
66
69
|
* This useEffect is temporary.
|
|
67
70
|
* While the wallet connectors don't use the event emitter, we need to manually
|
|
@@ -74,6 +77,8 @@ const useWalletConnectors = ({ authMode, connectedWallets, walletConnectorOption
|
|
|
74
77
|
}), [walletsBasedOnAuthMode]);
|
|
75
78
|
const { connectedWalletsMap, didConnectedStateLoad } = useWalletsConnectionState.useWalletsConnectionState(walletsBasedOnAuthMode);
|
|
76
79
|
const wallets = React.useMemo(() => walletsBasedOnAuthMode.map((wallet) => (Object.assign(Object.assign({}, wallet), { connected: Boolean(connectedWalletsMap[getWalletIdentifier.getWalletIdentifier(wallet)]) }))), [connectedWalletsMap, walletsBasedOnAuthMode]);
|
|
80
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('wallets', wallets);
|
|
81
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('didConnectedStateLoad', didConnectedStateLoad);
|
|
77
82
|
const { setUserWallets } = UserWalletsContext.useInternalUserWallets();
|
|
78
83
|
// Keep userWallets in sync whenever linkedWallets changes
|
|
79
84
|
React.useEffect(() => {
|
|
@@ -82,6 +87,7 @@ const useWalletConnectors = ({ authMode, connectedWallets, walletConnectorOption
|
|
|
82
87
|
// the wallets list is empty, we'll never set the user wallets correctly after logout
|
|
83
88
|
if (!didConnectedStateLoad.current && wallets.length)
|
|
84
89
|
return;
|
|
90
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('[useWalletConnectors] will call setUserWallets', wallets);
|
|
85
91
|
setUserWallets((userWallets) => updateUserWalletsFromLinkedWallets.updateUserWalletsFromLinkedWallets(userWallets, wallets));
|
|
86
92
|
}, [didConnectedStateLoad, setUserWallets, wallets]);
|
|
87
93
|
const primaryWallet = React.useMemo(() => { var _a; return (_a = wallets.find((wallet) => wallet.id === primaryWalletId)) !== null && _a !== void 0 ? _a : null; }, [primaryWalletId, wallets]);
|
|
@@ -22,6 +22,7 @@ import 'viem/chains';
|
|
|
22
22
|
import '../../../config/ApiEndpoint.js';
|
|
23
23
|
import '@dynamic-labs/store';
|
|
24
24
|
import '../../../locale/locale.js';
|
|
25
|
+
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
25
26
|
import { useWalletsConnectionState } from '../useWalletsConnectionState/useWalletsConnectionState.js';
|
|
26
27
|
import { reconnectSocialWallet } from './reconnectSocialWallet.js';
|
|
27
28
|
import { createLinkedWalletsFromWalletOptions } from './utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js';
|
|
@@ -39,6 +40,7 @@ const useWalletConnectors = ({ authMode, connectedWallets, walletConnectorOption
|
|
|
39
40
|
walletConnectorOptions,
|
|
40
41
|
});
|
|
41
42
|
}, [user, primaryWalletId, walletConnectorOptions]);
|
|
43
|
+
logVerboseTroubleshootingMessage('linkedWallets', linkedWallets);
|
|
42
44
|
const walletsBasedOnAuthMode = useMemo(() => {
|
|
43
45
|
// Before signing the first message we are using connected wallets list
|
|
44
46
|
// This is because we want the first connected wallet to have events applied by useWalletEventListeners
|
|
@@ -58,6 +60,7 @@ const useWalletConnectors = ({ authMode, connectedWallets, walletConnectorOption
|
|
|
58
60
|
}
|
|
59
61
|
return connectedWallets !== null && connectedWallets !== void 0 ? connectedWallets : [];
|
|
60
62
|
}, [authMode, connectedWallets, linkedWallets, user]);
|
|
63
|
+
logVerboseTroubleshootingMessage('walletsBasedOnAuthMode', walletsBasedOnAuthMode);
|
|
61
64
|
/**
|
|
62
65
|
* This useEffect is temporary.
|
|
63
66
|
* While the wallet connectors don't use the event emitter, we need to manually
|
|
@@ -70,6 +73,8 @@ const useWalletConnectors = ({ authMode, connectedWallets, walletConnectorOption
|
|
|
70
73
|
}), [walletsBasedOnAuthMode]);
|
|
71
74
|
const { connectedWalletsMap, didConnectedStateLoad } = useWalletsConnectionState(walletsBasedOnAuthMode);
|
|
72
75
|
const wallets = useMemo(() => walletsBasedOnAuthMode.map((wallet) => (Object.assign(Object.assign({}, wallet), { connected: Boolean(connectedWalletsMap[getWalletIdentifier(wallet)]) }))), [connectedWalletsMap, walletsBasedOnAuthMode]);
|
|
76
|
+
logVerboseTroubleshootingMessage('wallets', wallets);
|
|
77
|
+
logVerboseTroubleshootingMessage('didConnectedStateLoad', didConnectedStateLoad);
|
|
73
78
|
const { setUserWallets } = useInternalUserWallets();
|
|
74
79
|
// Keep userWallets in sync whenever linkedWallets changes
|
|
75
80
|
useEffect(() => {
|
|
@@ -78,6 +83,7 @@ const useWalletConnectors = ({ authMode, connectedWallets, walletConnectorOption
|
|
|
78
83
|
// the wallets list is empty, we'll never set the user wallets correctly after logout
|
|
79
84
|
if (!didConnectedStateLoad.current && wallets.length)
|
|
80
85
|
return;
|
|
86
|
+
logVerboseTroubleshootingMessage('[useWalletConnectors] will call setUserWallets', wallets);
|
|
81
87
|
setUserWallets((userWallets) => updateUserWalletsFromLinkedWallets(userWallets, wallets));
|
|
82
88
|
}, [didConnectedStateLoad, setUserWallets, wallets]);
|
|
83
89
|
const primaryWallet = useMemo(() => { var _a; return (_a = wallets.find((wallet) => wallet.id === primaryWalletId)) !== null && _a !== void 0 ? _a : null; }, [primaryWalletId, wallets]);
|