@dynamic-labs/sdk-react-core 3.0.0-alpha.59 → 3.0.0-alpha.60
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 +2 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.cjs +8 -0
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.js +8 -0
- package/src/lib/shared/types/dynamicHandlers.d.ts +0 -2
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.cjs +14 -0
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.js +14 -0
- package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.cjs +10 -0
- package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.js +10 -0
- package/src/lib/utils/hooks/usePromise/usePromise.cjs +1 -1
- package/src/lib/utils/hooks/usePromise/usePromise.js +1 -1
- package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.cjs +6 -7
- package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.d.ts +5 -1
- package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.js +6 -7
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +1 -1
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +1 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +1 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +1 -1
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +1 -1
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +1 -1
- package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.cjs +1 -1
- package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.js +1 -1
- package/src/lib/views/SyncWalletView/SyncWalletView.cjs +1 -1
- package/src/lib/views/SyncWalletView/SyncWalletView.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/GlobalWalletView/GlobalWalletView.cjs +43 -40
- package/src/lib/widgets/DynamicWidget/views/GlobalWalletView/GlobalWalletView.js +43 -40
package/CHANGELOG.md
CHANGED
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": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.60",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -17,16 +17,16 @@
|
|
|
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": "3.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/message-transport": "3.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "3.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "3.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/store": "3.0.0-alpha.
|
|
26
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
27
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/wallet-book": "3.0.0-alpha.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.
|
|
20
|
+
"@dynamic-labs/iconic": "3.0.0-alpha.60",
|
|
21
|
+
"@dynamic-labs/logger": "3.0.0-alpha.60",
|
|
22
|
+
"@dynamic-labs/message-transport": "3.0.0-alpha.60",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "3.0.0-alpha.60",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "3.0.0-alpha.60",
|
|
25
|
+
"@dynamic-labs/store": "3.0.0-alpha.60",
|
|
26
|
+
"@dynamic-labs/types": "3.0.0-alpha.60",
|
|
27
|
+
"@dynamic-labs/utils": "3.0.0-alpha.60",
|
|
28
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.60",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.60",
|
|
30
30
|
"eventemitter3": "5.0.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -17,6 +17,7 @@ require('../../../../utils/constants/values.cjs');
|
|
|
17
17
|
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
18
18
|
require('../../../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
19
19
|
require('../../../../store/state/loadingAndLifecycle.cjs');
|
|
20
|
+
var logVerboseTroubleshootingMessage = require('../../../../utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
20
21
|
require('@dynamic-labs/utils');
|
|
21
22
|
require('../../../../shared/consts/index.cjs');
|
|
22
23
|
var ErrorContext = require('../../../ErrorContext/ErrorContext.cjs');
|
|
@@ -33,6 +34,13 @@ const useShowAuthFlow = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, isMulti
|
|
|
33
34
|
const setShowAuthFlow = React.useCallback((value, options = {}) => {
|
|
34
35
|
var _a;
|
|
35
36
|
const { emitCancelAuth, ignoreIfIsEmbeddedWidget, initializeWalletConnect, performMultiWalletChecks, clearErrors, } = Object.assign({ clearErrors: true, emitCancelAuth: false, ignoreIfIsEmbeddedWidget: true, initializeWalletConnect: true, performMultiWalletChecks: false }, options);
|
|
37
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('setShowAuthFlow', {
|
|
38
|
+
clearErrors,
|
|
39
|
+
emitCancelAuth,
|
|
40
|
+
ignoreIfIsEmbeddedWidget,
|
|
41
|
+
initializeWalletConnect,
|
|
42
|
+
performMultiWalletChecks,
|
|
43
|
+
});
|
|
36
44
|
if (!showAuthFlow && value) {
|
|
37
45
|
dynamicEvents.dynamicEvents.emit('authFlowOpen');
|
|
38
46
|
}
|
|
@@ -13,6 +13,7 @@ import '../../../../utils/constants/values.js';
|
|
|
13
13
|
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
14
14
|
import '../../../../shared/utils/classes/storage/sessionStorage.js';
|
|
15
15
|
import '../../../../store/state/loadingAndLifecycle.js';
|
|
16
|
+
import { logVerboseTroubleshootingMessage } from '../../../../utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
16
17
|
import '@dynamic-labs/utils';
|
|
17
18
|
import '../../../../shared/consts/index.js';
|
|
18
19
|
import { useErrorContext } from '../../../ErrorContext/ErrorContext.js';
|
|
@@ -29,6 +30,13 @@ const useShowAuthFlow = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, isMulti
|
|
|
29
30
|
const setShowAuthFlow = useCallback((value, options = {}) => {
|
|
30
31
|
var _a;
|
|
31
32
|
const { emitCancelAuth, ignoreIfIsEmbeddedWidget, initializeWalletConnect, performMultiWalletChecks, clearErrors, } = Object.assign({ clearErrors: true, emitCancelAuth: false, ignoreIfIsEmbeddedWidget: true, initializeWalletConnect: true, performMultiWalletChecks: false }, options);
|
|
33
|
+
logVerboseTroubleshootingMessage('setShowAuthFlow', {
|
|
34
|
+
clearErrors,
|
|
35
|
+
emitCancelAuth,
|
|
36
|
+
ignoreIfIsEmbeddedWidget,
|
|
37
|
+
initializeWalletConnect,
|
|
38
|
+
performMultiWalletChecks,
|
|
39
|
+
});
|
|
32
40
|
if (!showAuthFlow && value) {
|
|
33
41
|
dynamicEvents.emit('authFlowOpen');
|
|
34
42
|
}
|
|
@@ -12,11 +12,9 @@ export type UserOnboardingFieldResponse = {
|
|
|
12
12
|
value: string;
|
|
13
13
|
isCustom: boolean;
|
|
14
14
|
};
|
|
15
|
-
export type HandleUserOnboarding = (missingFields: UserOnboardingFieldRequest[]) => Promise<UserOnboardingFieldResponse[]>;
|
|
16
15
|
export type DynamicHandlers = {
|
|
17
16
|
handleAuthenticatedUser?: (params: {
|
|
18
17
|
user: UserProfile;
|
|
19
18
|
}) => Promise<void>;
|
|
20
19
|
handleConnectedWallet?: HandleConnectedWallet;
|
|
21
|
-
handleUserOnboarding?: HandleUserOnboarding;
|
|
22
20
|
};
|
|
@@ -7,6 +7,7 @@ var React = require('react');
|
|
|
7
7
|
var loadingAndLifecycle = require('../../../../store/state/loadingAndLifecycle.cjs');
|
|
8
8
|
var logger = require('../../../logger.cjs');
|
|
9
9
|
var index = require('../../functions/lastAuthenticatedAccount/index.cjs');
|
|
10
|
+
var logVerboseTroubleshootingMessage = require('../../../../utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
10
11
|
|
|
11
12
|
const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWallet, user, walletBook, enableInstrumentation, appName, environmentId, }) => {
|
|
12
13
|
var _a, _b;
|
|
@@ -18,6 +19,19 @@ const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSe
|
|
|
18
19
|
if (hasLoaded.current)
|
|
19
20
|
return;
|
|
20
21
|
hasLoaded.current = true;
|
|
22
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('SDK finished loading', {
|
|
23
|
+
appName,
|
|
24
|
+
authMode,
|
|
25
|
+
connectedInfo,
|
|
26
|
+
connectedWallets,
|
|
27
|
+
enableInstrumentation,
|
|
28
|
+
environmentId,
|
|
29
|
+
primaryWallet,
|
|
30
|
+
projectSettings,
|
|
31
|
+
sessionValidation,
|
|
32
|
+
user,
|
|
33
|
+
walletBook,
|
|
34
|
+
});
|
|
21
35
|
// Calculate how long loading took and emit log
|
|
22
36
|
if (enableInstrumentation) {
|
|
23
37
|
const loadingTime = new Date().getTime() - loadingStart.current;
|
|
@@ -3,6 +3,7 @@ import { useRef } from 'react';
|
|
|
3
3
|
import { useLoadingAndLifecycle } from '../../../../store/state/loadingAndLifecycle.js';
|
|
4
4
|
import { logger } from '../../../logger.js';
|
|
5
5
|
import { lastAuthenticatedAccount } from '../../functions/lastAuthenticatedAccount/index.js';
|
|
6
|
+
import { logVerboseTroubleshootingMessage } from '../../../../utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
6
7
|
|
|
7
8
|
const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWallet, user, walletBook, enableInstrumentation, appName, environmentId, }) => {
|
|
8
9
|
var _a, _b;
|
|
@@ -14,6 +15,19 @@ const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSe
|
|
|
14
15
|
if (hasLoaded.current)
|
|
15
16
|
return;
|
|
16
17
|
hasLoaded.current = true;
|
|
18
|
+
logVerboseTroubleshootingMessage('SDK finished loading', {
|
|
19
|
+
appName,
|
|
20
|
+
authMode,
|
|
21
|
+
connectedInfo,
|
|
22
|
+
connectedWallets,
|
|
23
|
+
enableInstrumentation,
|
|
24
|
+
environmentId,
|
|
25
|
+
primaryWallet,
|
|
26
|
+
projectSettings,
|
|
27
|
+
sessionValidation,
|
|
28
|
+
user,
|
|
29
|
+
walletBook,
|
|
30
|
+
});
|
|
17
31
|
// Calculate how long loading took and emit log
|
|
18
32
|
if (enableInstrumentation) {
|
|
19
33
|
const loadingTime = new Date().getTime() - loadingStart.current;
|
|
@@ -17,6 +17,7 @@ require('../../constants/values.cjs');
|
|
|
17
17
|
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
18
18
|
require('../../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
19
19
|
require('../../../store/state/loadingAndLifecycle.cjs');
|
|
20
|
+
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
20
21
|
require('@dynamic-labs/utils');
|
|
21
22
|
require('../../../shared/consts/index.cjs');
|
|
22
23
|
require('../../../events/dynamicEvents.cjs');
|
|
@@ -116,6 +117,15 @@ const useIsLoggedIn = () => {
|
|
|
116
117
|
const shouldHaveTurnkeyWallet = isTurnkeyPregen &&
|
|
117
118
|
// if user doesn't have a branded wallet only
|
|
118
119
|
(!(userWalletsCredentials === null || userWalletsCredentials === void 0 ? void 0 : userWalletsCredentials.length) || hasEmbeddedWalletVerifiedCredential);
|
|
120
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('useIsLoggedIn', {
|
|
121
|
+
authMode,
|
|
122
|
+
eoaWallet,
|
|
123
|
+
isSessionKeyCompatible,
|
|
124
|
+
isTurnkeyProviderEnabled,
|
|
125
|
+
primaryWallet,
|
|
126
|
+
projectSettings,
|
|
127
|
+
user,
|
|
128
|
+
});
|
|
119
129
|
// if turnkey is enabled we need to check if the user that is logged/connected
|
|
120
130
|
// has a primaryWallet to not show the widget without secure
|
|
121
131
|
if (shouldHaveTurnkeyWallet) {
|
|
@@ -13,6 +13,7 @@ import '../../constants/values.js';
|
|
|
13
13
|
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
14
14
|
import '../../../shared/utils/classes/storage/sessionStorage.js';
|
|
15
15
|
import '../../../store/state/loadingAndLifecycle.js';
|
|
16
|
+
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
16
17
|
import '@dynamic-labs/utils';
|
|
17
18
|
import '../../../shared/consts/index.js';
|
|
18
19
|
import '../../../events/dynamicEvents.js';
|
|
@@ -112,6 +113,15 @@ const useIsLoggedIn = () => {
|
|
|
112
113
|
const shouldHaveTurnkeyWallet = isTurnkeyPregen &&
|
|
113
114
|
// if user doesn't have a branded wallet only
|
|
114
115
|
(!(userWalletsCredentials === null || userWalletsCredentials === void 0 ? void 0 : userWalletsCredentials.length) || hasEmbeddedWalletVerifiedCredential);
|
|
116
|
+
logVerboseTroubleshootingMessage('useIsLoggedIn', {
|
|
117
|
+
authMode,
|
|
118
|
+
eoaWallet,
|
|
119
|
+
isSessionKeyCompatible,
|
|
120
|
+
isTurnkeyProviderEnabled,
|
|
121
|
+
primaryWallet,
|
|
122
|
+
projectSettings,
|
|
123
|
+
user,
|
|
124
|
+
});
|
|
115
125
|
// if turnkey is enabled we need to check if the user that is logged/connected
|
|
116
126
|
// has a primaryWallet to not show the widget without secure
|
|
117
127
|
if (shouldHaveTurnkeyWallet) {
|
|
@@ -63,7 +63,7 @@ const usePromise = (fetcher, options) => {
|
|
|
63
63
|
const callTimestamp = new Date().getTime();
|
|
64
64
|
const diffFromLastCall = callTimestamp - lastCallTimestamp.current;
|
|
65
65
|
if (diffFromLastCall < 5) {
|
|
66
|
-
logger.logger.
|
|
66
|
+
logger.logger.debug('usePromise: Fetcher function was called too soon. Please make sure you are not calling the fetcher function inside a loop or a synchronous function.', deps);
|
|
67
67
|
}
|
|
68
68
|
lastCallTimestamp.current = callTimestamp;
|
|
69
69
|
if (!state.isLoading) {
|
|
@@ -59,7 +59,7 @@ const usePromise = (fetcher, options) => {
|
|
|
59
59
|
const callTimestamp = new Date().getTime();
|
|
60
60
|
const diffFromLastCall = callTimestamp - lastCallTimestamp.current;
|
|
61
61
|
if (diffFromLastCall < 5) {
|
|
62
|
-
logger.
|
|
62
|
+
logger.debug('usePromise: Fetcher function was called too soon. Please make sure you are not calling the fetcher function inside a loop or a synchronous function.', deps);
|
|
63
63
|
}
|
|
64
64
|
lastCallTimestamp.current = callTimestamp;
|
|
65
65
|
if (!state.isLoading) {
|
|
@@ -98,8 +98,8 @@ require('../../../context/ReinitializeContext/ReinitializeContextProvider.cjs');
|
|
|
98
98
|
require('../../../store/state/tokenBalances.cjs');
|
|
99
99
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
100
100
|
|
|
101
|
-
const useSyncOnboardingFlow = () => {
|
|
102
|
-
const { setShowAuthFlow, userWithMissingInfo,
|
|
101
|
+
const useSyncOnboardingFlow = ({ handler: headlessHandler, } = {}) => {
|
|
102
|
+
const { setShowAuthFlow, userWithMissingInfo, sdkHasLoaded, setSelectedWalletConnectorKey, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
103
103
|
const { setView } = ViewContext.useViewContext();
|
|
104
104
|
const { updateUser } = useUserUpdateRequest.useUserUpdateRequestInternal({
|
|
105
105
|
validationSchemaStripUnknown: false,
|
|
@@ -118,8 +118,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
118
118
|
var _a;
|
|
119
119
|
const handleHeadlessOnboarding = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
120
120
|
var _b;
|
|
121
|
-
if (!(
|
|
122
|
-
!((_b = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.missingFields) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
121
|
+
if (!headlessHandler || !((_b = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.missingFields) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
123
122
|
return;
|
|
124
123
|
}
|
|
125
124
|
triggeredOnboarding.current = true;
|
|
@@ -130,7 +129,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
130
129
|
label: field.label,
|
|
131
130
|
required: field.required,
|
|
132
131
|
}));
|
|
133
|
-
const onboardingResponse = yield
|
|
132
|
+
const onboardingResponse = yield headlessHandler(missingFieldsRequestInput);
|
|
134
133
|
const userFields = {};
|
|
135
134
|
const customFields = Object.assign({}, userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.metadata);
|
|
136
135
|
onboardingResponse.forEach((field) => {
|
|
@@ -180,7 +179,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
180
179
|
hasPendingMfaAction.hasPendingMfaAction(userWithMissingInfo)) {
|
|
181
180
|
return;
|
|
182
181
|
}
|
|
183
|
-
if (
|
|
182
|
+
if (headlessHandler) {
|
|
184
183
|
handleHeadlessOnboarding();
|
|
185
184
|
return;
|
|
186
185
|
}
|
|
@@ -189,7 +188,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
189
188
|
}, [
|
|
190
189
|
sdkHasLoaded,
|
|
191
190
|
userWithMissingInfo,
|
|
192
|
-
|
|
191
|
+
headlessHandler,
|
|
193
192
|
completeAuth,
|
|
194
193
|
updateUser,
|
|
195
194
|
setShowAuthFlow,
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { UserOnboardingFieldRequest, UserOnboardingFieldResponse } from '../../../shared';
|
|
2
|
+
export type HandleUserOnboarding = (missingFields: UserOnboardingFieldRequest[]) => Promise<UserOnboardingFieldResponse[]>;
|
|
3
|
+
export declare const useSyncOnboardingFlow: ({ handler: headlessHandler, }?: {
|
|
4
|
+
handler?: HandleUserOnboarding;
|
|
5
|
+
}) => void;
|
|
@@ -94,8 +94,8 @@ import '../../../context/ReinitializeContext/ReinitializeContextProvider.js';
|
|
|
94
94
|
import '../../../store/state/tokenBalances.js';
|
|
95
95
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
96
96
|
|
|
97
|
-
const useSyncOnboardingFlow = () => {
|
|
98
|
-
const { setShowAuthFlow, userWithMissingInfo,
|
|
97
|
+
const useSyncOnboardingFlow = ({ handler: headlessHandler, } = {}) => {
|
|
98
|
+
const { setShowAuthFlow, userWithMissingInfo, sdkHasLoaded, setSelectedWalletConnectorKey, } = useInternalDynamicContext();
|
|
99
99
|
const { setView } = useViewContext();
|
|
100
100
|
const { updateUser } = useUserUpdateRequestInternal({
|
|
101
101
|
validationSchemaStripUnknown: false,
|
|
@@ -114,8 +114,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
114
114
|
var _a;
|
|
115
115
|
const handleHeadlessOnboarding = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
116
|
var _b;
|
|
117
|
-
if (!(
|
|
118
|
-
!((_b = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.missingFields) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
117
|
+
if (!headlessHandler || !((_b = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.missingFields) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
119
118
|
return;
|
|
120
119
|
}
|
|
121
120
|
triggeredOnboarding.current = true;
|
|
@@ -126,7 +125,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
126
125
|
label: field.label,
|
|
127
126
|
required: field.required,
|
|
128
127
|
}));
|
|
129
|
-
const onboardingResponse = yield
|
|
128
|
+
const onboardingResponse = yield headlessHandler(missingFieldsRequestInput);
|
|
130
129
|
const userFields = {};
|
|
131
130
|
const customFields = Object.assign({}, userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.metadata);
|
|
132
131
|
onboardingResponse.forEach((field) => {
|
|
@@ -176,7 +175,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
176
175
|
hasPendingMfaAction(userWithMissingInfo)) {
|
|
177
176
|
return;
|
|
178
177
|
}
|
|
179
|
-
if (
|
|
178
|
+
if (headlessHandler) {
|
|
180
179
|
handleHeadlessOnboarding();
|
|
181
180
|
return;
|
|
182
181
|
}
|
|
@@ -185,7 +184,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
185
184
|
}, [
|
|
186
185
|
sdkHasLoaded,
|
|
187
186
|
userWithMissingInfo,
|
|
188
|
-
|
|
187
|
+
headlessHandler,
|
|
189
188
|
completeAuth,
|
|
190
189
|
updateUser,
|
|
191
190
|
setShowAuthFlow,
|
|
@@ -20,13 +20,13 @@ require('../../constants/colors.cjs');
|
|
|
20
20
|
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
21
21
|
require('../../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
22
22
|
require('../../../store/state/loadingAndLifecycle.cjs');
|
|
23
|
+
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
23
24
|
require('../../../shared/consts/index.cjs');
|
|
24
25
|
require('react-international-phone');
|
|
25
26
|
require('../../../config/ApiEndpoint.cjs');
|
|
26
27
|
require('../../../store/state/user/user.cjs');
|
|
27
28
|
require('../../../locale/locale.cjs');
|
|
28
29
|
require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
29
|
-
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
30
30
|
var createLinkedWalletsFromWalletOptions = require('./utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs');
|
|
31
31
|
var updateUserWalletsFromLinkedWallets = require('./utils/updateUserWalletsFromLinkedWallets/updateUserWalletsFromLinkedWallets.cjs');
|
|
32
32
|
|
|
@@ -16,13 +16,13 @@ import '../../constants/colors.js';
|
|
|
16
16
|
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
17
17
|
import '../../../shared/utils/classes/storage/sessionStorage.js';
|
|
18
18
|
import '../../../store/state/loadingAndLifecycle.js';
|
|
19
|
+
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
19
20
|
import '../../../shared/consts/index.js';
|
|
20
21
|
import 'react-international-phone';
|
|
21
22
|
import '../../../config/ApiEndpoint.js';
|
|
22
23
|
import '../../../store/state/user/user.js';
|
|
23
24
|
import '../../../locale/locale.js';
|
|
24
25
|
import '../../../store/state/projectSettings/projectSettings.js';
|
|
25
|
-
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
26
26
|
import { createLinkedWalletsFromWalletOptions } from './utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js';
|
|
27
27
|
import { updateUserWalletsFromLinkedWallets } from './utils/updateUserWalletsFromLinkedWallets/updateUserWalletsFromLinkedWallets.js';
|
|
28
28
|
|
|
@@ -17,6 +17,7 @@ require('../../constants/values.cjs');
|
|
|
17
17
|
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
18
18
|
require('../../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
19
19
|
require('../../../store/state/loadingAndLifecycle.cjs');
|
|
20
|
+
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
20
21
|
require('@dynamic-labs/utils');
|
|
21
22
|
require('../../../shared/consts/index.cjs');
|
|
22
23
|
var useDynamicEvents = require('../events/useDynamicEvents/useDynamicEvents.cjs');
|
|
@@ -27,7 +28,6 @@ require('../../../config/ApiEndpoint.cjs');
|
|
|
27
28
|
require('../../../store/state/user/user.cjs');
|
|
28
29
|
require('../../../locale/locale.cjs');
|
|
29
30
|
require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
30
|
-
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
31
31
|
var dynamicEvents = require('../../../events/dynamicEvents.cjs');
|
|
32
32
|
|
|
33
33
|
const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnectorKey, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, authMode, refreshConnectedWallet, detectNewWalletsForLinking, }) => {
|
|
@@ -13,6 +13,7 @@ import '../../constants/values.js';
|
|
|
13
13
|
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
14
14
|
import '../../../shared/utils/classes/storage/sessionStorage.js';
|
|
15
15
|
import '../../../store/state/loadingAndLifecycle.js';
|
|
16
|
+
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
16
17
|
import '@dynamic-labs/utils';
|
|
17
18
|
import '../../../shared/consts/index.js';
|
|
18
19
|
import { useInternalDynamicEvents } from '../events/useDynamicEvents/useDynamicEvents.js';
|
|
@@ -23,7 +24,6 @@ import '../../../config/ApiEndpoint.js';
|
|
|
23
24
|
import '../../../store/state/user/user.js';
|
|
24
25
|
import '../../../locale/locale.js';
|
|
25
26
|
import '../../../store/state/projectSettings/projectSettings.js';
|
|
26
|
-
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
27
27
|
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
28
28
|
|
|
29
29
|
const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnectorKey, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, authMode, refreshConnectedWallet, detectNewWalletsForLinking, }) => {
|
|
@@ -20,6 +20,7 @@ require('../../constants/values.cjs');
|
|
|
20
20
|
var localStorage = require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
21
21
|
require('../../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
22
22
|
require('../../../store/state/loadingAndLifecycle.cjs');
|
|
23
|
+
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
23
24
|
require('../../../shared/consts/index.cjs');
|
|
24
25
|
require('../../../events/dynamicEvents.cjs');
|
|
25
26
|
var useConnectAndSign = require('../authenticationHooks/useConnectAndSign/useConnectAndSign.cjs');
|
|
@@ -32,7 +33,6 @@ require('@dynamic-labs/multi-wallet');
|
|
|
32
33
|
require('react-international-phone');
|
|
33
34
|
var requiresTwoStepAuthentication = require('../../functions/requiresTwoStepAuthentication/requiresTwoStepAuthentication.cjs');
|
|
34
35
|
require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
35
|
-
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
36
36
|
require('../../../store/state/user/user.cjs');
|
|
37
37
|
require('../../../locale/locale.cjs');
|
|
38
38
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
@@ -16,6 +16,7 @@ import '../../constants/values.js';
|
|
|
16
16
|
import { LocalStorage } from '../../../shared/utils/classes/storage/localStorage.js';
|
|
17
17
|
import '../../../shared/utils/classes/storage/sessionStorage.js';
|
|
18
18
|
import '../../../store/state/loadingAndLifecycle.js';
|
|
19
|
+
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
19
20
|
import '../../../shared/consts/index.js';
|
|
20
21
|
import '../../../events/dynamicEvents.js';
|
|
21
22
|
import { useConnectAndSign } from '../authenticationHooks/useConnectAndSign/useConnectAndSign.js';
|
|
@@ -28,7 +29,6 @@ import '@dynamic-labs/multi-wallet';
|
|
|
28
29
|
import 'react-international-phone';
|
|
29
30
|
import { requiresTwoStepAuthentication } from '../../functions/requiresTwoStepAuthentication/requiresTwoStepAuthentication.js';
|
|
30
31
|
import '../../../store/state/projectSettings/projectSettings.js';
|
|
31
|
-
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
32
32
|
import '../../../store/state/user/user.js';
|
|
33
33
|
import '../../../locale/locale.js';
|
|
34
34
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
@@ -20,6 +20,7 @@ require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
|
20
20
|
require('../../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
21
21
|
var isWalletGroup = require('../../functions/walletListBuilder/utils/isWalletGroup/isWalletGroup.cjs');
|
|
22
22
|
require('../../../store/state/loadingAndLifecycle.cjs');
|
|
23
|
+
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
23
24
|
require('../../../shared/consts/index.cjs');
|
|
24
25
|
require('../../../events/dynamicEvents.cjs');
|
|
25
26
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
@@ -30,7 +31,6 @@ require('../../../config/ApiEndpoint.cjs');
|
|
|
30
31
|
require('../../../store/state/user/user.cjs');
|
|
31
32
|
require('../../../locale/locale.cjs');
|
|
32
33
|
require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
33
|
-
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
34
34
|
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
35
35
|
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
36
36
|
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
@@ -16,6 +16,7 @@ import '../../../shared/utils/classes/storage/localStorage.js';
|
|
|
16
16
|
import '../../../shared/utils/classes/storage/sessionStorage.js';
|
|
17
17
|
import { isWalletGroup } from '../../functions/walletListBuilder/utils/isWalletGroup/isWalletGroup.js';
|
|
18
18
|
import '../../../store/state/loadingAndLifecycle.js';
|
|
19
|
+
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
19
20
|
import '../../../shared/consts/index.js';
|
|
20
21
|
import '../../../events/dynamicEvents.js';
|
|
21
22
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
@@ -26,7 +27,6 @@ import '../../../config/ApiEndpoint.js';
|
|
|
26
27
|
import '../../../store/state/user/user.js';
|
|
27
28
|
import '../../../locale/locale.js';
|
|
28
29
|
import '../../../store/state/projectSettings/projectSettings.js';
|
|
29
|
-
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
30
30
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
31
31
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
32
32
|
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
@@ -21,6 +21,7 @@ require('../../utils/constants/values.cjs');
|
|
|
21
21
|
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
22
22
|
require('../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
23
23
|
require('../../store/state/loadingAndLifecycle.cjs');
|
|
24
|
+
var logVerboseTroubleshootingMessage = require('../../utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
24
25
|
require('../../shared/consts/index.cjs');
|
|
25
26
|
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
26
27
|
require('../../context/ErrorBoundary/ErrorBoundaryBase.cjs');
|
|
@@ -34,7 +35,6 @@ require('../../config/ApiEndpoint.cjs');
|
|
|
34
35
|
require('../../store/state/user/user.cjs');
|
|
35
36
|
require('../../locale/locale.cjs');
|
|
36
37
|
require('../../store/state/projectSettings/projectSettings.cjs');
|
|
37
|
-
var logVerboseTroubleshootingMessage = require('../../utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
38
38
|
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
39
39
|
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
40
40
|
require('../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
@@ -17,6 +17,7 @@ import '../../utils/constants/values.js';
|
|
|
17
17
|
import '../../shared/utils/classes/storage/localStorage.js';
|
|
18
18
|
import '../../shared/utils/classes/storage/sessionStorage.js';
|
|
19
19
|
import '../../store/state/loadingAndLifecycle.js';
|
|
20
|
+
import { logVerboseTroubleshootingMessage } from '../../utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
20
21
|
import '../../shared/consts/index.js';
|
|
21
22
|
import '../../context/DynamicContext/DynamicContext.js';
|
|
22
23
|
import '../../context/ErrorBoundary/ErrorBoundaryBase.js';
|
|
@@ -30,7 +31,6 @@ import '../../config/ApiEndpoint.js';
|
|
|
30
31
|
import '../../store/state/user/user.js';
|
|
31
32
|
import '../../locale/locale.js';
|
|
32
33
|
import '../../store/state/projectSettings/projectSettings.js';
|
|
33
|
-
import { logVerboseTroubleshootingMessage } from '../../utils/functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
34
34
|
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
35
35
|
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
36
36
|
import '../../context/UserWalletsContext/UserWalletsContext.js';
|
|
@@ -21,9 +21,9 @@ require('../../../../utils/constants/values.cjs');
|
|
|
21
21
|
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
22
22
|
require('../../../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
23
23
|
require('../../../../store/state/loadingAndLifecycle.cjs');
|
|
24
|
+
require('../../../../shared/consts/index.cjs');
|
|
24
25
|
require('@dynamic-labs/utils');
|
|
25
26
|
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
26
|
-
require('../../../../shared/consts/index.cjs');
|
|
27
27
|
require('../../../../events/dynamicEvents.cjs');
|
|
28
28
|
require('../../../../../../_virtual/_tslib.cjs');
|
|
29
29
|
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
@@ -17,9 +17,9 @@ import '../../../../utils/constants/values.js';
|
|
|
17
17
|
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
18
18
|
import '../../../../shared/utils/classes/storage/sessionStorage.js';
|
|
19
19
|
import '../../../../store/state/loadingAndLifecycle.js';
|
|
20
|
+
import '../../../../shared/consts/index.js';
|
|
20
21
|
import '@dynamic-labs/utils';
|
|
21
22
|
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
22
|
-
import '../../../../shared/consts/index.js';
|
|
23
23
|
import '../../../../events/dynamicEvents.js';
|
|
24
24
|
import '../../../../../../_virtual/_tslib.js';
|
|
25
25
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
@@ -127,6 +127,45 @@ const GlobalWalletView = () => {
|
|
|
127
127
|
goToInitialDynamicWidgetView();
|
|
128
128
|
}, timeout);
|
|
129
129
|
}, [goToInitialDynamicWidgetView]);
|
|
130
|
+
const popupConfirmView = () => {
|
|
131
|
+
const pendingPairing = globalWallet.getPendingPairing();
|
|
132
|
+
if (!pendingPairing)
|
|
133
|
+
throw new Error('No pending pairing');
|
|
134
|
+
const { name, url, icons } = pendingPairing.params.proposer.metadata;
|
|
135
|
+
setView('global-wallet-confirm', {
|
|
136
|
+
onCancel: () => {
|
|
137
|
+
setDynamicWidgetView('global-wallet');
|
|
138
|
+
setShowAuthFlow(false, {
|
|
139
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
140
|
+
performMultiWalletChecks: false,
|
|
141
|
+
});
|
|
142
|
+
setWalletConnectUri('');
|
|
143
|
+
},
|
|
144
|
+
onConfirm: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
145
|
+
try {
|
|
146
|
+
yield globalWallet.confirmPairing(true);
|
|
147
|
+
setDynamicWidgetView('global-wallet');
|
|
148
|
+
setShowAuthFlow(false, {
|
|
149
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
150
|
+
performMultiWalletChecks: false,
|
|
151
|
+
});
|
|
152
|
+
showBanner(t('global_wallet.banner.success', {
|
|
153
|
+
name: name !== null && name !== void 0 ? name : t('global_wallet.the_dapp'),
|
|
154
|
+
}), 'success');
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
showBanner(t('global_wallet.banner.warning', {
|
|
158
|
+
name: name !== null && name !== void 0 ? name : t('global_wallet.the_dapp'),
|
|
159
|
+
}), 'error');
|
|
160
|
+
}
|
|
161
|
+
}),
|
|
162
|
+
pairingInfo: { icons, name, url },
|
|
163
|
+
});
|
|
164
|
+
setShowAuthFlow(true, {
|
|
165
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
166
|
+
performMultiWalletChecks: false,
|
|
167
|
+
});
|
|
168
|
+
};
|
|
130
169
|
const handlePairing = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
131
170
|
if (!walletConnectUri.startsWith('wc:')) {
|
|
132
171
|
showBanner(t('global_wallet.banner.bad_input'), 'error');
|
|
@@ -134,44 +173,7 @@ const GlobalWalletView = () => {
|
|
|
134
173
|
}
|
|
135
174
|
try {
|
|
136
175
|
yield globalWallet.pairWithWC(walletConnectUri);
|
|
137
|
-
|
|
138
|
-
const pendingPairing = globalWallet.getPendingPairing();
|
|
139
|
-
if (!pendingPairing)
|
|
140
|
-
throw new Error('No pending pairing');
|
|
141
|
-
const { name, url, icons } = pendingPairing.params.proposer.metadata;
|
|
142
|
-
setView('global-wallet-confirm', {
|
|
143
|
-
onCancel: () => {
|
|
144
|
-
setDynamicWidgetView('global-wallet');
|
|
145
|
-
setShowAuthFlow(false, {
|
|
146
|
-
ignoreIfIsEmbeddedWidget: false,
|
|
147
|
-
performMultiWalletChecks: false,
|
|
148
|
-
});
|
|
149
|
-
setWalletConnectUri('');
|
|
150
|
-
},
|
|
151
|
-
onConfirm: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
152
|
-
try {
|
|
153
|
-
yield globalWallet.confirmPairing(true);
|
|
154
|
-
setDynamicWidgetView('global-wallet');
|
|
155
|
-
setShowAuthFlow(false, {
|
|
156
|
-
ignoreIfIsEmbeddedWidget: false,
|
|
157
|
-
performMultiWalletChecks: false,
|
|
158
|
-
});
|
|
159
|
-
showBanner(t('global_wallet.banner.success', {
|
|
160
|
-
name: name !== null && name !== void 0 ? name : t('global_wallet.the_dapp'),
|
|
161
|
-
}), 'success');
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
showBanner(t('global_wallet.banner.warning', {
|
|
165
|
-
name: name !== null && name !== void 0 ? name : t('global_wallet.the_dapp'),
|
|
166
|
-
}), 'error');
|
|
167
|
-
}
|
|
168
|
-
}),
|
|
169
|
-
pairingInfo: { icons, name, url },
|
|
170
|
-
});
|
|
171
|
-
setShowAuthFlow(true, {
|
|
172
|
-
ignoreIfIsEmbeddedWidget: false,
|
|
173
|
-
performMultiWalletChecks: false,
|
|
174
|
-
});
|
|
176
|
+
globalWallet.getWeb3Wallet().on('session_proposal', popupConfirmView);
|
|
175
177
|
}
|
|
176
178
|
catch (error) {
|
|
177
179
|
const errorMessage = String(error);
|
|
@@ -198,10 +200,11 @@ const GlobalWalletView = () => {
|
|
|
198
200
|
}
|
|
199
201
|
}, []);
|
|
200
202
|
React.useEffect(() => {
|
|
201
|
-
if (walletConnectUri.startsWith('wc:')) {
|
|
203
|
+
if (walletConnectUri.startsWith('wc:') && isScanned) {
|
|
202
204
|
handlePairing();
|
|
203
205
|
}
|
|
204
|
-
|
|
206
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
207
|
+
}, [walletConnectUri]);
|
|
205
208
|
const renderHeader = () => (jsxRuntime.jsxs("div", { className: 'header', children: [jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'title', weight: 'medium', color: 'primary', as: 'h1', copykey: 'global_wallet.connect_to_apps', children: t('global_wallet.connect_to_apps') }), utils.isMobile() && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: () => {
|
|
206
209
|
setView('global-wallet-info');
|
|
207
210
|
setShowAuthFlow(true, {
|
|
@@ -123,6 +123,45 @@ const GlobalWalletView = () => {
|
|
|
123
123
|
goToInitialDynamicWidgetView();
|
|
124
124
|
}, timeout);
|
|
125
125
|
}, [goToInitialDynamicWidgetView]);
|
|
126
|
+
const popupConfirmView = () => {
|
|
127
|
+
const pendingPairing = globalWallet.getPendingPairing();
|
|
128
|
+
if (!pendingPairing)
|
|
129
|
+
throw new Error('No pending pairing');
|
|
130
|
+
const { name, url, icons } = pendingPairing.params.proposer.metadata;
|
|
131
|
+
setView('global-wallet-confirm', {
|
|
132
|
+
onCancel: () => {
|
|
133
|
+
setDynamicWidgetView('global-wallet');
|
|
134
|
+
setShowAuthFlow(false, {
|
|
135
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
136
|
+
performMultiWalletChecks: false,
|
|
137
|
+
});
|
|
138
|
+
setWalletConnectUri('');
|
|
139
|
+
},
|
|
140
|
+
onConfirm: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
141
|
+
try {
|
|
142
|
+
yield globalWallet.confirmPairing(true);
|
|
143
|
+
setDynamicWidgetView('global-wallet');
|
|
144
|
+
setShowAuthFlow(false, {
|
|
145
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
146
|
+
performMultiWalletChecks: false,
|
|
147
|
+
});
|
|
148
|
+
showBanner(t('global_wallet.banner.success', {
|
|
149
|
+
name: name !== null && name !== void 0 ? name : t('global_wallet.the_dapp'),
|
|
150
|
+
}), 'success');
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
showBanner(t('global_wallet.banner.warning', {
|
|
154
|
+
name: name !== null && name !== void 0 ? name : t('global_wallet.the_dapp'),
|
|
155
|
+
}), 'error');
|
|
156
|
+
}
|
|
157
|
+
}),
|
|
158
|
+
pairingInfo: { icons, name, url },
|
|
159
|
+
});
|
|
160
|
+
setShowAuthFlow(true, {
|
|
161
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
162
|
+
performMultiWalletChecks: false,
|
|
163
|
+
});
|
|
164
|
+
};
|
|
126
165
|
const handlePairing = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
166
|
if (!walletConnectUri.startsWith('wc:')) {
|
|
128
167
|
showBanner(t('global_wallet.banner.bad_input'), 'error');
|
|
@@ -130,44 +169,7 @@ const GlobalWalletView = () => {
|
|
|
130
169
|
}
|
|
131
170
|
try {
|
|
132
171
|
yield globalWallet.pairWithWC(walletConnectUri);
|
|
133
|
-
|
|
134
|
-
const pendingPairing = globalWallet.getPendingPairing();
|
|
135
|
-
if (!pendingPairing)
|
|
136
|
-
throw new Error('No pending pairing');
|
|
137
|
-
const { name, url, icons } = pendingPairing.params.proposer.metadata;
|
|
138
|
-
setView('global-wallet-confirm', {
|
|
139
|
-
onCancel: () => {
|
|
140
|
-
setDynamicWidgetView('global-wallet');
|
|
141
|
-
setShowAuthFlow(false, {
|
|
142
|
-
ignoreIfIsEmbeddedWidget: false,
|
|
143
|
-
performMultiWalletChecks: false,
|
|
144
|
-
});
|
|
145
|
-
setWalletConnectUri('');
|
|
146
|
-
},
|
|
147
|
-
onConfirm: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
148
|
-
try {
|
|
149
|
-
yield globalWallet.confirmPairing(true);
|
|
150
|
-
setDynamicWidgetView('global-wallet');
|
|
151
|
-
setShowAuthFlow(false, {
|
|
152
|
-
ignoreIfIsEmbeddedWidget: false,
|
|
153
|
-
performMultiWalletChecks: false,
|
|
154
|
-
});
|
|
155
|
-
showBanner(t('global_wallet.banner.success', {
|
|
156
|
-
name: name !== null && name !== void 0 ? name : t('global_wallet.the_dapp'),
|
|
157
|
-
}), 'success');
|
|
158
|
-
}
|
|
159
|
-
catch (error) {
|
|
160
|
-
showBanner(t('global_wallet.banner.warning', {
|
|
161
|
-
name: name !== null && name !== void 0 ? name : t('global_wallet.the_dapp'),
|
|
162
|
-
}), 'error');
|
|
163
|
-
}
|
|
164
|
-
}),
|
|
165
|
-
pairingInfo: { icons, name, url },
|
|
166
|
-
});
|
|
167
|
-
setShowAuthFlow(true, {
|
|
168
|
-
ignoreIfIsEmbeddedWidget: false,
|
|
169
|
-
performMultiWalletChecks: false,
|
|
170
|
-
});
|
|
172
|
+
globalWallet.getWeb3Wallet().on('session_proposal', popupConfirmView);
|
|
171
173
|
}
|
|
172
174
|
catch (error) {
|
|
173
175
|
const errorMessage = String(error);
|
|
@@ -194,10 +196,11 @@ const GlobalWalletView = () => {
|
|
|
194
196
|
}
|
|
195
197
|
}, []);
|
|
196
198
|
useEffect(() => {
|
|
197
|
-
if (walletConnectUri.startsWith('wc:')) {
|
|
199
|
+
if (walletConnectUri.startsWith('wc:') && isScanned) {
|
|
198
200
|
handlePairing();
|
|
199
201
|
}
|
|
200
|
-
|
|
202
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
203
|
+
}, [walletConnectUri]);
|
|
201
204
|
const renderHeader = () => (jsxs("div", { className: 'header', children: [jsx(IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsx(SvgArrowLeft, {}) }), jsx(Typography, { variant: 'title', weight: 'medium', color: 'primary', as: 'h1', copykey: 'global_wallet.connect_to_apps', children: t('global_wallet.connect_to_apps') }), isMobile() && (jsx(IconButton, { type: 'button', onClick: () => {
|
|
202
205
|
setView('global-wallet-info');
|
|
203
206
|
setShowAuthFlow(true, {
|