@dynamic-labs/sdk-react-core 0.18.0-RC.20 → 0.18.0-RC.21
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 +2 -2
- package/package.js +2 -2
- package/package.json +9 -9
- package/src/lib/context/DynamicContext/DynamicContext.cjs +19 -21
- package/src/lib/context/DynamicContext/DynamicContext.js +20 -22
- package/src/lib/context/DynamicContext/hooks/index.d.ts +4 -1
- package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.cjs +33 -0
- package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.js +29 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +13 -14
- package/src/lib/context/DynamicContext/useCustomerCallbacks/types.d.ts +2 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +4 -5
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.d.ts +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +4 -5
- package/src/lib/context/DynamicContext/useDynamicContext.cjs +2 -5
- package/src/lib/context/DynamicContext/useDynamicContext.d.ts +1 -3
- package/src/lib/context/DynamicContext/useDynamicContext.js +2 -5
- package/src/lib/utils/functions/createUserProfile/createUserProfile.cjs +9 -0
- package/src/lib/utils/functions/createUserProfile/createUserProfile.js +9 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +3 -3
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +3 -3
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +5 -5
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +5 -5
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.cjs +5 -5
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js +5 -5
- package/src/lib/utils/hooks/useConnectWithEmail/useConnectWithEmail.cjs +3 -3
- package/src/lib/utils/hooks/useConnectWithEmail/useConnectWithEmail.js +3 -3
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -2
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -2
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +2 -2
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +2 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/utils/disableAuthVerificationFlag/disableAuthVerificationFlag.cjs +0 -27
- package/src/lib/context/DynamicContext/useCustomerCallbacks/utils/disableAuthVerificationFlag/disableAuthVerificationFlag.d.ts +0 -3
- package/src/lib/context/DynamicContext/useCustomerCallbacks/utils/disableAuthVerificationFlag/disableAuthVerificationFlag.js +0 -23
- package/src/lib/context/DynamicContext/useCustomerCallbacks/utils/disableAuthVerificationFlag/index.d.ts +0 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/utils/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
package/package.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version = "0.18.0-RC.
|
|
5
|
+
var version = "0.18.0-RC.21";
|
|
6
6
|
var dependencies = {
|
|
7
7
|
"react-focus-lock": "2.9.2",
|
|
8
8
|
"@dynamic-labs/iconic": "0.1.23",
|
|
9
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
9
|
+
"@dynamic-labs/sdk-api": "0.0.248",
|
|
10
10
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
11
11
|
"country-list": "2.3.0",
|
|
12
12
|
yup: "0.32.11",
|
package/package.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var version = "0.18.0-RC.
|
|
1
|
+
var version = "0.18.0-RC.21";
|
|
2
2
|
var dependencies = {
|
|
3
3
|
"react-focus-lock": "2.9.2",
|
|
4
4
|
"@dynamic-labs/iconic": "0.1.23",
|
|
5
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
5
|
+
"@dynamic-labs/sdk-api": "0.0.248",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
7
7
|
"country-list": "2.3.0",
|
|
8
8
|
yup: "0.32.11",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "0.18.0-RC.
|
|
3
|
+
"version": "0.18.0-RC.21",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"react-focus-lock": "2.9.2",
|
|
11
11
|
"@dynamic-labs/iconic": "0.1.23",
|
|
12
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
12
|
+
"@dynamic-labs/sdk-api": "0.0.248",
|
|
13
13
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
14
14
|
"country-list": "2.3.0",
|
|
15
15
|
"yup": "0.32.11",
|
|
16
16
|
"formik": "2.2.9",
|
|
17
17
|
"qrcode": "1.5.1",
|
|
18
18
|
"ethers": "5.7.2",
|
|
19
|
-
"@dynamic-labs/logger": "0.18.0-RC.
|
|
20
|
-
"@dynamic-labs/multi-wallet": "0.18.0-RC.
|
|
21
|
-
"@dynamic-labs/rpc-providers": "0.18.0-RC.
|
|
22
|
-
"@dynamic-labs/types": "0.18.0-RC.
|
|
23
|
-
"@dynamic-labs/utils": "0.18.0-RC.
|
|
24
|
-
"@dynamic-labs/wallet-book": "0.18.0-RC.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "0.18.0-RC.
|
|
19
|
+
"@dynamic-labs/logger": "0.18.0-RC.21",
|
|
20
|
+
"@dynamic-labs/multi-wallet": "0.18.0-RC.21",
|
|
21
|
+
"@dynamic-labs/rpc-providers": "0.18.0-RC.21",
|
|
22
|
+
"@dynamic-labs/types": "0.18.0-RC.21",
|
|
23
|
+
"@dynamic-labs/utils": "0.18.0-RC.21",
|
|
24
|
+
"@dynamic-labs/wallet-book": "0.18.0-RC.21",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "0.18.0-RC.21"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"semver": "7.3.8"
|
|
@@ -86,10 +86,11 @@ var SendBalanceContext = require('../SendBalanceContext/SendBalanceContext.cjs')
|
|
|
86
86
|
var WalletContext = require('../WalletContext/WalletContext.cjs');
|
|
87
87
|
var WalletGroupContext = require('../WalletGroupContext/WalletGroupContext.cjs');
|
|
88
88
|
var helpers = require('./helpers.cjs');
|
|
89
|
-
var useEmailLoginState = require('./hooks/useEmailLoginState/useEmailLoginState.cjs');
|
|
90
89
|
var useDisplayOrderState = require('./hooks/useDisplayOrderState/useDisplayOrderState.cjs');
|
|
90
|
+
var useEmailLoginState = require('./hooks/useEmailLoginState/useEmailLoginState.cjs');
|
|
91
91
|
var useNameService = require('./hooks/useNameService/useNameService.cjs');
|
|
92
92
|
var useSetShowAuthFlowWithInit = require('./hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.cjs');
|
|
93
|
+
var useVerificationInProgress = require('./hooks/useVerificationInProgress/useVerificationInProgress.cjs');
|
|
93
94
|
var useCustomerCallbacks = require('./useCustomerCallbacks/useCustomerCallbacks.cjs');
|
|
94
95
|
var useCustomerAuthFlowCallbacks = require('./useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs');
|
|
95
96
|
var validators = require('./validators.cjs');
|
|
@@ -149,21 +150,10 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
149
150
|
}
|
|
150
151
|
// ensures that when user comes back to site and primary wallet is out of sync, we don't show widget popup
|
|
151
152
|
const [showWidgetStatePopup, setShowWidgetStatePopup] = React.useState(!multiWallet);
|
|
152
|
-
//
|
|
153
|
-
const [
|
|
154
|
-
//
|
|
155
|
-
|
|
156
|
-
const [ongoingAuthVerification, setOngoingAuthVerification] = React.useState(false);
|
|
157
|
-
const ongoingVerifications = React.useMemo(() => ({
|
|
158
|
-
authVerification: ongoingAuthVerification,
|
|
159
|
-
clearVerifications: () => {
|
|
160
|
-
setOngoingAuthVerification(false);
|
|
161
|
-
setOngoingClickAndSignVerification(false);
|
|
162
|
-
},
|
|
163
|
-
connectAndSignVerification: ongoingClickAndSignVerification,
|
|
164
|
-
setAuthVerification: setOngoingAuthVerification,
|
|
165
|
-
setConnectAndSignVerification: setOngoingClickAndSignVerification,
|
|
166
|
-
}), [ongoingAuthVerification, ongoingClickAndSignVerification]);
|
|
153
|
+
// Used inside useVerifyOnAwaitingSignature. Is legacy and should be removed asap
|
|
154
|
+
const [legacyIsVerifying, setLegacyIsVerifying] = React.useState(false);
|
|
155
|
+
// Set to true when a customer starts any auth verification process and set to false when it ends
|
|
156
|
+
const [isVerificationInProgress, setIsVerificationInProgress] = useVerificationInProgress.useVerificationInProgress();
|
|
167
157
|
const walletBook$1 = walletBook.useWalletBookCdn();
|
|
168
158
|
const { configurations: serverNetworkConfigurations, handleRemoveLsNetworks, } = useFetchNetworkConfigurations.useFetchNetworkConfigurations({
|
|
169
159
|
authToken: getAuthToken.getAuthToken(),
|
|
@@ -274,7 +264,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
274
264
|
}
|
|
275
265
|
yield ((_j = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector) === null || _j === void 0 ? void 0 : _j.endSession());
|
|
276
266
|
// Necessary when user logs out in user data collection view
|
|
277
|
-
|
|
267
|
+
// Dont require flag to be set though
|
|
268
|
+
setIsVerificationInProgress(false, false);
|
|
269
|
+
setLegacyIsVerifying(false);
|
|
278
270
|
setAuthMode(initialAuthenticationMode);
|
|
279
271
|
setShowAuthFlow(false);
|
|
280
272
|
setMultiWalletWidgetState('idle');
|
|
@@ -363,14 +355,16 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
363
355
|
},
|
|
364
356
|
handleLogOut,
|
|
365
357
|
isAuthenticated,
|
|
366
|
-
ongoingVerifications,
|
|
367
358
|
primaryWallet,
|
|
368
359
|
selectedWalletConnector,
|
|
360
|
+
setIsVerificationInProgress,
|
|
369
361
|
user,
|
|
370
362
|
});
|
|
371
363
|
const clearStatesOnBackClick = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
372
364
|
setDesktopUri('');
|
|
373
|
-
|
|
365
|
+
// Clear verification flag but dont require it to be set
|
|
366
|
+
setIsVerificationInProgress(false, false);
|
|
367
|
+
setLegacyIsVerifying(false);
|
|
374
368
|
if (!user) {
|
|
375
369
|
clearAllWalletConnectSessions();
|
|
376
370
|
}
|
|
@@ -447,6 +441,8 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
447
441
|
isFullyConnected,
|
|
448
442
|
isProjectSettingsLoading,
|
|
449
443
|
isSingleWalletAccount,
|
|
444
|
+
isVerificationInProgress,
|
|
445
|
+
legacyIsVerifying,
|
|
450
446
|
linkedWallets,
|
|
451
447
|
loadingNetwork,
|
|
452
448
|
loginWithEmail,
|
|
@@ -458,7 +454,6 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
458
454
|
notInTheListImageUrl: imageUserNotInAccessList || notInTheListImageUrl,
|
|
459
455
|
onboardingImageUrl: imageUserInAccessList || onboardingImageUrl,
|
|
460
456
|
onboardingOnlyJwt,
|
|
461
|
-
ongoingVerifications,
|
|
462
457
|
policiesConsentInnerComponent,
|
|
463
458
|
primaryWallet,
|
|
464
459
|
primaryWalletId,
|
|
@@ -478,6 +473,8 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
478
473
|
setDesktopUri,
|
|
479
474
|
setIsFullyConnected,
|
|
480
475
|
setIsSingleWalletAccount,
|
|
476
|
+
setIsVerificationInProgress,
|
|
477
|
+
setLegacyIsVerifying,
|
|
481
478
|
setLogInWithEmail,
|
|
482
479
|
setMultiWallet,
|
|
483
480
|
setMultiWalletWidgetState,
|
|
@@ -557,9 +554,10 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
557
554
|
isProjectSettingsLoading,
|
|
558
555
|
isSingleWalletAccount,
|
|
559
556
|
isFullyConnected,
|
|
557
|
+
isVerificationInProgress,
|
|
560
558
|
primaryWallet,
|
|
561
559
|
secondaryWallets,
|
|
562
|
-
|
|
560
|
+
legacyIsVerifying,
|
|
563
561
|
loadingNetwork,
|
|
564
562
|
loginWithEmail,
|
|
565
563
|
multiWallet,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { createContext, useState,
|
|
3
|
+
import { createContext, useState, useCallback, useEffect, useMemo } from 'react';
|
|
4
4
|
import { ICONIC_SPRITE_URL } from '@dynamic-labs/iconic';
|
|
5
5
|
import { MissingEnvironmentIdError } from '@dynamic-labs/utils';
|
|
6
6
|
import { useWalletBookCdn, getWalletBookCdnUrl, WalletBookContextProvider } from '@dynamic-labs/wallet-book';
|
|
@@ -82,10 +82,11 @@ import { SendBalanceContextProvider } from '../SendBalanceContext/SendBalanceCon
|
|
|
82
82
|
import { WalletContextProvider } from '../WalletContext/WalletContext.js';
|
|
83
83
|
import { WalletGroupContextProvider } from '../WalletGroupContext/WalletGroupContext.js';
|
|
84
84
|
import { initExpirationTime, getInitialView } from './helpers.js';
|
|
85
|
-
import { useEmailLoginState } from './hooks/useEmailLoginState/useEmailLoginState.js';
|
|
86
85
|
import { useDisplayOrderState } from './hooks/useDisplayOrderState/useDisplayOrderState.js';
|
|
86
|
+
import { useEmailLoginState } from './hooks/useEmailLoginState/useEmailLoginState.js';
|
|
87
87
|
import { useNameService } from './hooks/useNameService/useNameService.js';
|
|
88
88
|
import { useSetShowAuthFlowWithInit } from './hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.js';
|
|
89
|
+
import { useVerificationInProgress } from './hooks/useVerificationInProgress/useVerificationInProgress.js';
|
|
89
90
|
import { useCustomerCallbacks } from './useCustomerCallbacks/useCustomerCallbacks.js';
|
|
90
91
|
import { useCustomerAuthFlowCallbacks } from './useCustomerCallbacks/useCustomerAuthFlowCallbacks.js';
|
|
91
92
|
import { validateAuthUser } from './validators.js';
|
|
@@ -145,21 +146,10 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
145
146
|
}
|
|
146
147
|
// ensures that when user comes back to site and primary wallet is out of sync, we don't show widget popup
|
|
147
148
|
const [showWidgetStatePopup, setShowWidgetStatePopup] = useState(!multiWallet);
|
|
148
|
-
//
|
|
149
|
-
const [
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
const [ongoingAuthVerification, setOngoingAuthVerification] = useState(false);
|
|
153
|
-
const ongoingVerifications = useMemo(() => ({
|
|
154
|
-
authVerification: ongoingAuthVerification,
|
|
155
|
-
clearVerifications: () => {
|
|
156
|
-
setOngoingAuthVerification(false);
|
|
157
|
-
setOngoingClickAndSignVerification(false);
|
|
158
|
-
},
|
|
159
|
-
connectAndSignVerification: ongoingClickAndSignVerification,
|
|
160
|
-
setAuthVerification: setOngoingAuthVerification,
|
|
161
|
-
setConnectAndSignVerification: setOngoingClickAndSignVerification,
|
|
162
|
-
}), [ongoingAuthVerification, ongoingClickAndSignVerification]);
|
|
149
|
+
// Used inside useVerifyOnAwaitingSignature. Is legacy and should be removed asap
|
|
150
|
+
const [legacyIsVerifying, setLegacyIsVerifying] = useState(false);
|
|
151
|
+
// Set to true when a customer starts any auth verification process and set to false when it ends
|
|
152
|
+
const [isVerificationInProgress, setIsVerificationInProgress] = useVerificationInProgress();
|
|
163
153
|
const walletBook = useWalletBookCdn();
|
|
164
154
|
const { configurations: serverNetworkConfigurations, handleRemoveLsNetworks, } = useFetchNetworkConfigurations({
|
|
165
155
|
authToken: getAuthToken(),
|
|
@@ -270,7 +260,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
270
260
|
}
|
|
271
261
|
yield ((_j = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector) === null || _j === void 0 ? void 0 : _j.endSession());
|
|
272
262
|
// Necessary when user logs out in user data collection view
|
|
273
|
-
|
|
263
|
+
// Dont require flag to be set though
|
|
264
|
+
setIsVerificationInProgress(false, false);
|
|
265
|
+
setLegacyIsVerifying(false);
|
|
274
266
|
setAuthMode(initialAuthenticationMode);
|
|
275
267
|
setShowAuthFlow(false);
|
|
276
268
|
setMultiWalletWidgetState('idle');
|
|
@@ -359,14 +351,16 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
359
351
|
},
|
|
360
352
|
handleLogOut,
|
|
361
353
|
isAuthenticated,
|
|
362
|
-
ongoingVerifications,
|
|
363
354
|
primaryWallet,
|
|
364
355
|
selectedWalletConnector,
|
|
356
|
+
setIsVerificationInProgress,
|
|
365
357
|
user,
|
|
366
358
|
});
|
|
367
359
|
const clearStatesOnBackClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
368
360
|
setDesktopUri('');
|
|
369
|
-
|
|
361
|
+
// Clear verification flag but dont require it to be set
|
|
362
|
+
setIsVerificationInProgress(false, false);
|
|
363
|
+
setLegacyIsVerifying(false);
|
|
370
364
|
if (!user) {
|
|
371
365
|
clearAllWalletConnectSessions();
|
|
372
366
|
}
|
|
@@ -443,6 +437,8 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
443
437
|
isFullyConnected,
|
|
444
438
|
isProjectSettingsLoading,
|
|
445
439
|
isSingleWalletAccount,
|
|
440
|
+
isVerificationInProgress,
|
|
441
|
+
legacyIsVerifying,
|
|
446
442
|
linkedWallets,
|
|
447
443
|
loadingNetwork,
|
|
448
444
|
loginWithEmail,
|
|
@@ -454,7 +450,6 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
454
450
|
notInTheListImageUrl: imageUserNotInAccessList || notInTheListImageUrl,
|
|
455
451
|
onboardingImageUrl: imageUserInAccessList || onboardingImageUrl,
|
|
456
452
|
onboardingOnlyJwt,
|
|
457
|
-
ongoingVerifications,
|
|
458
453
|
policiesConsentInnerComponent,
|
|
459
454
|
primaryWallet,
|
|
460
455
|
primaryWalletId,
|
|
@@ -474,6 +469,8 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
474
469
|
setDesktopUri,
|
|
475
470
|
setIsFullyConnected,
|
|
476
471
|
setIsSingleWalletAccount,
|
|
472
|
+
setIsVerificationInProgress,
|
|
473
|
+
setLegacyIsVerifying,
|
|
477
474
|
setLogInWithEmail,
|
|
478
475
|
setMultiWallet,
|
|
479
476
|
setMultiWalletWidgetState,
|
|
@@ -553,9 +550,10 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
553
550
|
isProjectSettingsLoading,
|
|
554
551
|
isSingleWalletAccount,
|
|
555
552
|
isFullyConnected,
|
|
553
|
+
isVerificationInProgress,
|
|
556
554
|
primaryWallet,
|
|
557
555
|
secondaryWallets,
|
|
558
|
-
|
|
556
|
+
legacyIsVerifying,
|
|
559
557
|
loadingNetwork,
|
|
560
558
|
loginWithEmail,
|
|
561
559
|
multiWallet,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useVerificationInProgress';
|
package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.cjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
require('@dynamic-labs/sdk-api');
|
|
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('../../../ViewContext/ViewContext.cjs');
|
|
12
|
+
require('@dynamic-labs/wallet-book');
|
|
13
|
+
require('@dynamic-labs/utils');
|
|
14
|
+
require('../../../../utils/constants/colors.cjs');
|
|
15
|
+
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
16
|
+
require('ethers');
|
|
17
|
+
require('../../../../shared/consts/index.cjs');
|
|
18
|
+
|
|
19
|
+
const useVerificationInProgress = () => {
|
|
20
|
+
// Set to true when a customer starts any auth verification process and set to false when it ends
|
|
21
|
+
// pro tip: helps indicate whether onAuthModalClose was called as a result of a verification process or not
|
|
22
|
+
// because when modal is closed manually, the flag will be false at the moment of onAuthModalClose.
|
|
23
|
+
// If it was closed due to a verification process, it will be true.
|
|
24
|
+
const [isVerificationInProgress, _setIsVerificationInProgress] = React.useState(false);
|
|
25
|
+
const setIsVerificationInProgress = (newValue, checkWasSetOnDisable = true) => {
|
|
26
|
+
if (checkWasSetOnDisable && !newValue && !isVerificationInProgress)
|
|
27
|
+
logger.logger.debug('The "isVerificationInProgress" flag had not been previously enabled at the time of being disabled. Please ensure to set it to true whenever any kind of verification process is started');
|
|
28
|
+
_setIsVerificationInProgress(newValue);
|
|
29
|
+
};
|
|
30
|
+
return [isVerificationInProgress, setIsVerificationInProgress];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.useVerificationInProgress = useVerificationInProgress;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useVerificationInProgress: () => readonly [boolean, (newValue: boolean, checkWasSetOnDisable?: boolean | undefined) => void];
|
package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import '@dynamic-labs/sdk-api';
|
|
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 '../../../ViewContext/ViewContext.js';
|
|
8
|
+
import '@dynamic-labs/wallet-book';
|
|
9
|
+
import '@dynamic-labs/utils';
|
|
10
|
+
import '../../../../utils/constants/colors.js';
|
|
11
|
+
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
12
|
+
import 'ethers';
|
|
13
|
+
import '../../../../shared/consts/index.js';
|
|
14
|
+
|
|
15
|
+
const useVerificationInProgress = () => {
|
|
16
|
+
// Set to true when a customer starts any auth verification process and set to false when it ends
|
|
17
|
+
// pro tip: helps indicate whether onAuthModalClose was called as a result of a verification process or not
|
|
18
|
+
// because when modal is closed manually, the flag will be false at the moment of onAuthModalClose.
|
|
19
|
+
// If it was closed due to a verification process, it will be true.
|
|
20
|
+
const [isVerificationInProgress, _setIsVerificationInProgress] = useState(false);
|
|
21
|
+
const setIsVerificationInProgress = (newValue, checkWasSetOnDisable = true) => {
|
|
22
|
+
if (checkWasSetOnDisable && !newValue && !isVerificationInProgress)
|
|
23
|
+
logger.debug('The "isVerificationInProgress" flag had not been previously enabled at the time of being disabled. Please ensure to set it to true whenever any kind of verification process is started');
|
|
24
|
+
_setIsVerificationInProgress(newValue);
|
|
25
|
+
};
|
|
26
|
+
return [isVerificationInProgress, setIsVerificationInProgress];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { useVerificationInProgress };
|
|
@@ -8,16 +8,6 @@ import { MultiWalletWidgetStateSetter } from '../../../utils/hooks/multiWallet';
|
|
|
8
8
|
import { ThemeData, ThemeSetting } from '../../ThemeContext';
|
|
9
9
|
import { DisplayOrder, SetDisplayOrderPriority } from '../hooks';
|
|
10
10
|
import { Callback } from '../useCustomerCallbacks';
|
|
11
|
-
export type IOngoingVerifications = {
|
|
12
|
-
/** Clears all verification flags */
|
|
13
|
-
clearVerifications: () => void;
|
|
14
|
-
/** Whether a connect and sign verification process is ongoing */
|
|
15
|
-
connectAndSignVerification: boolean;
|
|
16
|
-
setConnectAndSignVerification: Dispatch<SetStateAction<boolean>>;
|
|
17
|
-
/** Whether any auth verification process is ongoing */
|
|
18
|
-
authVerification: boolean;
|
|
19
|
-
setAuthVerification: Dispatch<SetStateAction<boolean>>;
|
|
20
|
-
};
|
|
21
11
|
export type ChainsToConnect = {
|
|
22
12
|
chain: Chain;
|
|
23
13
|
numberOfWallets: number;
|
|
@@ -132,13 +122,22 @@ export interface IDynamicContext {
|
|
|
132
122
|
toolkitEnabled?: boolean;
|
|
133
123
|
user: UserProfile | undefined;
|
|
134
124
|
unlinkConnectedWallet: (walletId: string) => void;
|
|
135
|
-
/**
|
|
136
|
-
* An object that holds getters and setters for flags representing whether verification processes are ongoing
|
|
137
|
-
*/
|
|
138
|
-
ongoingVerifications: IOngoingVerifications;
|
|
139
125
|
walletConnector: WalletConnector | null;
|
|
140
126
|
walletUiUtils: WalletUiUtils;
|
|
141
127
|
wallets: WalletOption[];
|
|
142
128
|
walletsFilter?: (options: WalletOption[]) => WalletOption[];
|
|
143
129
|
removeConnectedWalletsInfo: () => void;
|
|
130
|
+
/** Whether any verifications are ongoing for the current user (ex. connect, sign and email login verifications) */
|
|
131
|
+
isVerificationInProgress: boolean;
|
|
132
|
+
/** State setter for isVerificationInProgress
|
|
133
|
+
* @param checkWasSetOnDisable when true, if newValue is false, logs a message if the flag wasn't set to true before
|
|
134
|
+
*/
|
|
135
|
+
setIsVerificationInProgress: (newValue: boolean, checkWasSetOnDisable?: boolean) => void;
|
|
136
|
+
/** Legacy boolean flag used in useVerifyOnAwaitingSignature. Used to be called "isVerifying".
|
|
137
|
+
* Was meant to prevent an effect from accidentally triggering again when it shouldn't.
|
|
138
|
+
* Should be removed asap.
|
|
139
|
+
*/
|
|
140
|
+
legacyIsVerifying: boolean;
|
|
141
|
+
/** Legacy setter for legacyIsVerifying */
|
|
142
|
+
setLegacyIsVerifying: Dispatch<SetStateAction<boolean>>;
|
|
144
143
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WalletConnector } from '../../../..';
|
|
2
2
|
import { AuthModeType, OnAuthSuccess, OnBeforeConnectSuccessConfirmation, OnConnectSuccess, OnUserProfileUpdate, UserProfile, Wallet } from '../../../shared/types';
|
|
3
|
-
import {
|
|
3
|
+
import { IDynamicContext } from '../types';
|
|
4
4
|
export type Callback = 'authSuccess' | 'linkSuccess' | 'userProfileUpdate' | 'connectSuccess' | 'onBeforeConnectSuccessConfirmation';
|
|
5
5
|
export type UseCustomerCallbacksArgs = {
|
|
6
6
|
authMode: AuthModeType;
|
|
@@ -16,5 +16,5 @@ export type UseCustomerCallbacksArgs = {
|
|
|
16
16
|
primaryWallet: Wallet | null;
|
|
17
17
|
selectedWalletConnector: WalletConnector | null;
|
|
18
18
|
user: UserProfile | undefined;
|
|
19
|
-
|
|
19
|
+
setIsVerificationInProgress: IDynamicContext['setIsVerificationInProgress'];
|
|
20
20
|
};
|
|
@@ -18,9 +18,8 @@ require('../../../shared/consts/index.cjs');
|
|
|
18
18
|
require('@dynamic-labs/multi-wallet');
|
|
19
19
|
var getAuthToken = require('../../../utils/functions/getAuthToken/getAuthToken.cjs');
|
|
20
20
|
var isConnectOnly = require('../../../utils/hooks/authenticationHooks/helpers/isConnectOnly.cjs');
|
|
21
|
-
var disableAuthVerificationFlag = require('./utils/disableAuthVerificationFlag/disableAuthVerificationFlag.cjs');
|
|
22
21
|
|
|
23
|
-
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUserProfileUpdate, onConnectSuccess, onBeforeConnectSuccessConfirmation, }, handleLogOut, primaryWallet, selectedWalletConnector, user, isAuthenticated, authMode,
|
|
22
|
+
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUserProfileUpdate, onConnectSuccess, onBeforeConnectSuccessConfirmation, }, handleLogOut, primaryWallet, selectedWalletConnector, user, isAuthenticated, authMode, setIsVerificationInProgress, }) => {
|
|
24
23
|
const [callbackQueue, setCallbackQueue] = React.useState([]);
|
|
25
24
|
const isConnectOnlyAndCallbackIsConnectSuccess = React.useCallback((next) => isConnectOnly.isConnectOnly(user, authMode) &&
|
|
26
25
|
Boolean(primaryWallet) &&
|
|
@@ -38,7 +37,7 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUse
|
|
|
38
37
|
updatedQueue.shift();
|
|
39
38
|
setCallbackQueue(updatedQueue);
|
|
40
39
|
try {
|
|
41
|
-
|
|
40
|
+
setIsVerificationInProgress(false);
|
|
42
41
|
onConnectSuccess === null || onConnectSuccess === void 0 ? void 0 : onConnectSuccess({
|
|
43
42
|
walletConnector: selectedWalletConnector,
|
|
44
43
|
});
|
|
@@ -67,7 +66,7 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUse
|
|
|
67
66
|
switch (next) {
|
|
68
67
|
case 'authSuccess': {
|
|
69
68
|
try {
|
|
70
|
-
|
|
69
|
+
setIsVerificationInProgress(false);
|
|
71
70
|
onAuthSuccess === null || onAuthSuccess === void 0 ? void 0 : onAuthSuccess({
|
|
72
71
|
authToken,
|
|
73
72
|
handleLogOut,
|
|
@@ -120,8 +119,8 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUse
|
|
|
120
119
|
user,
|
|
121
120
|
authMode,
|
|
122
121
|
isConnectOnlyAndCallbackIsConnectSuccess,
|
|
123
|
-
ongoingVerifications,
|
|
124
122
|
selectedWalletConnector,
|
|
123
|
+
setIsVerificationInProgress,
|
|
125
124
|
]);
|
|
126
125
|
const setCallback = (callback) => {
|
|
127
126
|
setCallbackQueue((prev) => [...prev, callback]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Callback, UseCustomerCallbacksArgs } from './types';
|
|
2
|
-
export declare const useCustomerCallbacks: ({ callbacks: { onAuthSuccess, onLinkSuccess, onUserProfileUpdate, onConnectSuccess, onBeforeConnectSuccessConfirmation, }, handleLogOut, primaryWallet, selectedWalletConnector, user, isAuthenticated, authMode,
|
|
2
|
+
export declare const useCustomerCallbacks: ({ callbacks: { onAuthSuccess, onLinkSuccess, onUserProfileUpdate, onConnectSuccess, onBeforeConnectSuccessConfirmation, }, handleLogOut, primaryWallet, selectedWalletConnector, user, isAuthenticated, authMode, setIsVerificationInProgress, }: UseCustomerCallbacksArgs) => {
|
|
3
3
|
setCallback: (callback: Callback) => void;
|
|
4
4
|
};
|
|
@@ -14,9 +14,8 @@ import '../../../shared/consts/index.js';
|
|
|
14
14
|
import '@dynamic-labs/multi-wallet';
|
|
15
15
|
import { getAuthToken } from '../../../utils/functions/getAuthToken/getAuthToken.js';
|
|
16
16
|
import { isConnectOnly } from '../../../utils/hooks/authenticationHooks/helpers/isConnectOnly.js';
|
|
17
|
-
import { disableAuthVerificationFlag } from './utils/disableAuthVerificationFlag/disableAuthVerificationFlag.js';
|
|
18
17
|
|
|
19
|
-
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUserProfileUpdate, onConnectSuccess, onBeforeConnectSuccessConfirmation, }, handleLogOut, primaryWallet, selectedWalletConnector, user, isAuthenticated, authMode,
|
|
18
|
+
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUserProfileUpdate, onConnectSuccess, onBeforeConnectSuccessConfirmation, }, handleLogOut, primaryWallet, selectedWalletConnector, user, isAuthenticated, authMode, setIsVerificationInProgress, }) => {
|
|
20
19
|
const [callbackQueue, setCallbackQueue] = useState([]);
|
|
21
20
|
const isConnectOnlyAndCallbackIsConnectSuccess = useCallback((next) => isConnectOnly(user, authMode) &&
|
|
22
21
|
Boolean(primaryWallet) &&
|
|
@@ -34,7 +33,7 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUse
|
|
|
34
33
|
updatedQueue.shift();
|
|
35
34
|
setCallbackQueue(updatedQueue);
|
|
36
35
|
try {
|
|
37
|
-
|
|
36
|
+
setIsVerificationInProgress(false);
|
|
38
37
|
onConnectSuccess === null || onConnectSuccess === void 0 ? void 0 : onConnectSuccess({
|
|
39
38
|
walletConnector: selectedWalletConnector,
|
|
40
39
|
});
|
|
@@ -63,7 +62,7 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUse
|
|
|
63
62
|
switch (next) {
|
|
64
63
|
case 'authSuccess': {
|
|
65
64
|
try {
|
|
66
|
-
|
|
65
|
+
setIsVerificationInProgress(false);
|
|
67
66
|
onAuthSuccess === null || onAuthSuccess === void 0 ? void 0 : onAuthSuccess({
|
|
68
67
|
authToken,
|
|
69
68
|
handleLogOut,
|
|
@@ -116,8 +115,8 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUse
|
|
|
116
115
|
user,
|
|
117
116
|
authMode,
|
|
118
117
|
isConnectOnlyAndCallbackIsConnectSuccess,
|
|
119
|
-
ongoingVerifications,
|
|
120
118
|
selectedWalletConnector,
|
|
119
|
+
setIsVerificationInProgress,
|
|
121
120
|
]);
|
|
122
121
|
const setCallback = (callback) => {
|
|
123
122
|
setCallbackQueue((prev) => [...prev, callback]);
|
|
@@ -11,7 +11,7 @@ const useDynamicContext = () => {
|
|
|
11
11
|
if (context === undefined) {
|
|
12
12
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
13
13
|
}
|
|
14
|
-
const { accountSwitchState, authMode, authToken, awaitingSignatureState, connectedWallets, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, isFullyConnected, linkedWallets, loadingNetwork, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, secondaryWallets, setLogInWithEmail, setMultiWalletWidgetState, setNetwork, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user,
|
|
14
|
+
const { accountSwitchState, authMode, authToken, awaitingSignatureState, connectedWallets, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, isFullyConnected, isVerificationInProgress, linkedWallets, loadingNetwork, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, secondaryWallets, setLogInWithEmail, setMultiWalletWidgetState, setNetwork, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, wallets, walletsByChain, walletsToConnectByChain, primaryWallet, } = context;
|
|
15
15
|
return {
|
|
16
16
|
accountSwitchState,
|
|
17
17
|
authMode,
|
|
@@ -23,16 +23,13 @@ const useDynamicContext = () => {
|
|
|
23
23
|
handleUnlinkWallet,
|
|
24
24
|
isAuthenticated,
|
|
25
25
|
isFullyConnected,
|
|
26
|
+
isVerificationInProgress,
|
|
26
27
|
linkedWallets,
|
|
27
28
|
loadingNetwork,
|
|
28
29
|
loginWithEmail,
|
|
29
30
|
multiWalletWidgetState,
|
|
30
31
|
network,
|
|
31
32
|
networkConfigurations,
|
|
32
|
-
ongoingVerifications: {
|
|
33
|
-
authVerification: ongoingVerifications.authVerification,
|
|
34
|
-
connectAndSignVerification: ongoingVerifications.connectAndSignVerification,
|
|
35
|
-
},
|
|
36
33
|
primaryWallet,
|
|
37
34
|
qrcodeUri,
|
|
38
35
|
rpcProviders,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { IDynamicContext } from './types';
|
|
2
|
-
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'connectedWallets' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'isAuthenticated' | 'isFullyConnected' | 'linkedWallets' | 'loadingNetwork' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'rpcProviders' | 'sdkHasLoaded' | 'secondaryWallets' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setNetwork' | 'setPrimaryWallet' | 'setShowAuthFlow' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'walletConnector' | 'wallets' | 'walletsByChain' | 'walletsToConnectByChain'
|
|
3
|
-
ongoingVerifications: Pick<IDynamicContext['ongoingVerifications'], 'authVerification' | 'connectAndSignVerification'>;
|
|
4
|
-
};
|
|
2
|
+
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'connectedWallets' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'isAuthenticated' | 'isFullyConnected' | 'isVerificationInProgress' | 'linkedWallets' | 'loadingNetwork' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'rpcProviders' | 'sdkHasLoaded' | 'secondaryWallets' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setNetwork' | 'setPrimaryWallet' | 'setShowAuthFlow' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'walletConnector' | 'wallets' | 'walletsByChain' | 'walletsToConnectByChain'>;
|
|
5
3
|
export declare const useDynamicContext: () => UseDynamicContext;
|
|
@@ -7,7 +7,7 @@ const useDynamicContext = () => {
|
|
|
7
7
|
if (context === undefined) {
|
|
8
8
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
9
9
|
}
|
|
10
|
-
const { accountSwitchState, authMode, authToken, awaitingSignatureState, connectedWallets, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, isFullyConnected, linkedWallets, loadingNetwork, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, secondaryWallets, setLogInWithEmail, setMultiWalletWidgetState, setNetwork, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user,
|
|
10
|
+
const { accountSwitchState, authMode, authToken, awaitingSignatureState, connectedWallets, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, isFullyConnected, isVerificationInProgress, linkedWallets, loadingNetwork, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, secondaryWallets, setLogInWithEmail, setMultiWalletWidgetState, setNetwork, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, wallets, walletsByChain, walletsToConnectByChain, primaryWallet, } = context;
|
|
11
11
|
return {
|
|
12
12
|
accountSwitchState,
|
|
13
13
|
authMode,
|
|
@@ -19,16 +19,13 @@ const useDynamicContext = () => {
|
|
|
19
19
|
handleUnlinkWallet,
|
|
20
20
|
isAuthenticated,
|
|
21
21
|
isFullyConnected,
|
|
22
|
+
isVerificationInProgress,
|
|
22
23
|
linkedWallets,
|
|
23
24
|
loadingNetwork,
|
|
24
25
|
loginWithEmail,
|
|
25
26
|
multiWalletWidgetState,
|
|
26
27
|
network,
|
|
27
28
|
networkConfigurations,
|
|
28
|
-
ongoingVerifications: {
|
|
29
|
-
authVerification: ongoingVerifications.authVerification,
|
|
30
|
-
connectAndSignVerification: ongoingVerifications.connectAndSignVerification,
|
|
31
|
-
},
|
|
32
29
|
primaryWallet,
|
|
33
30
|
qrcodeUri,
|
|
34
31
|
rpcProviders,
|
|
@@ -9,11 +9,20 @@ const createUserProfile = (decodedJwt) => {
|
|
|
9
9
|
const wallet = index.lastAuthenticatedAccount(decodedJwt);
|
|
10
10
|
const kyc = {
|
|
11
11
|
alias: decodedJwt.alias,
|
|
12
|
+
btcWallet: decodedJwt.btcWallet,
|
|
13
|
+
ckbWallet: decodedJwt.ckbWallet,
|
|
12
14
|
country: decodedJwt.country,
|
|
15
|
+
discordNotification: decodedJwt.discordNotification,
|
|
16
|
+
dogeWallet: decodedJwt.dogeWallet,
|
|
13
17
|
email: decodedJwt.email,
|
|
18
|
+
emailNotification: decodedJwt.emailNotification,
|
|
14
19
|
firstName: decodedJwt.givenName,
|
|
15
20
|
jobTitle: decodedJwt.jobTitle,
|
|
21
|
+
kasWallet: decodedJwt.kasWallet,
|
|
22
|
+
kdaWallet: decodedJwt.kdaWallet,
|
|
16
23
|
lastName: decodedJwt.familyName,
|
|
24
|
+
ltcWallet: decodedJwt.ltcWallet,
|
|
25
|
+
newsletterNotification: decodedJwt.newsletterNotification,
|
|
17
26
|
phoneNumber: decodedJwt.phoneNumber,
|
|
18
27
|
policiesConsent: decodedJwt.policiesConsent,
|
|
19
28
|
tShirtSize: decodedJwt.tShirtSize,
|
|
@@ -5,11 +5,20 @@ const createUserProfile = (decodedJwt) => {
|
|
|
5
5
|
const wallet = lastAuthenticatedAccount(decodedJwt);
|
|
6
6
|
const kyc = {
|
|
7
7
|
alias: decodedJwt.alias,
|
|
8
|
+
btcWallet: decodedJwt.btcWallet,
|
|
9
|
+
ckbWallet: decodedJwt.ckbWallet,
|
|
8
10
|
country: decodedJwt.country,
|
|
11
|
+
discordNotification: decodedJwt.discordNotification,
|
|
12
|
+
dogeWallet: decodedJwt.dogeWallet,
|
|
9
13
|
email: decodedJwt.email,
|
|
14
|
+
emailNotification: decodedJwt.emailNotification,
|
|
10
15
|
firstName: decodedJwt.givenName,
|
|
11
16
|
jobTitle: decodedJwt.jobTitle,
|
|
17
|
+
kasWallet: decodedJwt.kasWallet,
|
|
18
|
+
kdaWallet: decodedJwt.kdaWallet,
|
|
12
19
|
lastName: decodedJwt.familyName,
|
|
20
|
+
ltcWallet: decodedJwt.ltcWallet,
|
|
21
|
+
newsletterNotification: decodedJwt.newsletterNotification,
|
|
13
22
|
phoneNumber: decodedJwt.phoneNumber,
|
|
14
23
|
policiesConsent: decodedJwt.policiesConsent,
|
|
15
24
|
tShirtSize: decodedJwt.tShirtSize,
|
|
@@ -32,7 +32,7 @@ const useConnectAndSign = () => {
|
|
|
32
32
|
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
33
33
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
34
34
|
const { captchaToken } = CaptchaContext.useCaptchaContext();
|
|
35
|
-
const { authMode, connectWallet, consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, user, walletUiUtils, setCallback,
|
|
35
|
+
const { authMode, connectWallet, consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, user, walletUiUtils, setCallback, setIsVerificationInProgress, isFullyConnected, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
36
36
|
const { handleWalletsToConnect } = useHandleWalletsToConnect.useHandleWalletsToConnect();
|
|
37
37
|
const verifyWallet = useVerifyWallet.useVerifyWallet({
|
|
38
38
|
consumeNonce,
|
|
@@ -44,7 +44,7 @@ const useConnectAndSign = () => {
|
|
|
44
44
|
return ({ walletConnector, fetchPublicAddressOpts = undefined, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
45
45
|
var _a, _b;
|
|
46
46
|
// Raise verification ongoing flag
|
|
47
|
-
|
|
47
|
+
setIsVerificationInProgress(true);
|
|
48
48
|
try {
|
|
49
49
|
yield showPendingConnectView.showPendingConnectView(walletConnector, setView);
|
|
50
50
|
if (walletConnectorCore.isEmailWalletConnector(walletConnector)) {
|
|
@@ -101,7 +101,7 @@ const useConnectAndSign = () => {
|
|
|
101
101
|
setErrorMessage((_b = err === null || err === void 0 ? void 0 : err.code) === null || _b === void 0 ? void 0 : _b.toString());
|
|
102
102
|
goToInitialView();
|
|
103
103
|
// Since auth failed, lower flag
|
|
104
|
-
|
|
104
|
+
setIsVerificationInProgress(false);
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
});
|
|
@@ -28,7 +28,7 @@ const useConnectAndSign = () => {
|
|
|
28
28
|
const { setView, goToInitialView } = useViewContext();
|
|
29
29
|
const { setErrorMessage } = useErrorContext();
|
|
30
30
|
const { captchaToken } = useCaptchaContext();
|
|
31
|
-
const { authMode, connectWallet, consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, user, walletUiUtils, setCallback,
|
|
31
|
+
const { authMode, connectWallet, consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, user, walletUiUtils, setCallback, setIsVerificationInProgress, isFullyConnected, } = useInternalDynamicContext();
|
|
32
32
|
const { handleWalletsToConnect } = useHandleWalletsToConnect();
|
|
33
33
|
const verifyWallet = useVerifyWallet({
|
|
34
34
|
consumeNonce,
|
|
@@ -40,7 +40,7 @@ const useConnectAndSign = () => {
|
|
|
40
40
|
return ({ walletConnector, fetchPublicAddressOpts = undefined, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
41
|
var _a, _b;
|
|
42
42
|
// Raise verification ongoing flag
|
|
43
|
-
|
|
43
|
+
setIsVerificationInProgress(true);
|
|
44
44
|
try {
|
|
45
45
|
yield showPendingConnectView(walletConnector, setView);
|
|
46
46
|
if (isEmailWalletConnector(walletConnector)) {
|
|
@@ -97,7 +97,7 @@ const useConnectAndSign = () => {
|
|
|
97
97
|
setErrorMessage((_b = err === null || err === void 0 ? void 0 : err.code) === null || _b === void 0 ? void 0 : _b.toString());
|
|
98
98
|
goToInitialView();
|
|
99
99
|
// Since auth failed, lower flag
|
|
100
|
-
|
|
100
|
+
setIsVerificationInProgress(false);
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
});
|
|
@@ -29,7 +29,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
29
29
|
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
30
30
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
31
31
|
const { captchaToken } = CaptchaContext.useCaptchaContext();
|
|
32
|
-
const { connectWallet, consumeNonce, displayTermsOfService, projectSettings, environmentId, setIsSingleWalletAccount, setShowAuthFlow, user, authMode, setCallback,
|
|
32
|
+
const { connectWallet, consumeNonce, displayTermsOfService, projectSettings, environmentId, setIsSingleWalletAccount, setShowAuthFlow, user, authMode, setCallback, setIsVerificationInProgress, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
33
33
|
const { handleWalletsToConnect } = useHandleWalletsToConnect.useHandleWalletsToConnect();
|
|
34
34
|
const verifyWallet = useVerifyWallet.useVerifyWallet({
|
|
35
35
|
consumeNonce,
|
|
@@ -45,7 +45,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
45
45
|
const onlyConnectUser = ({ walletConnector, fetchPublicAddressOpts = undefined, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
46
46
|
var _a;
|
|
47
47
|
// Raise verification ongoing flag
|
|
48
|
-
|
|
48
|
+
setIsVerificationInProgress(true);
|
|
49
49
|
yield showPendingConnectView.showPendingConnectView(walletConnector, setView);
|
|
50
50
|
try {
|
|
51
51
|
yield connectWallet(walletConnector, fetchPublicAddressOpts);
|
|
@@ -66,7 +66,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
66
66
|
logger.logger.debug(err);
|
|
67
67
|
setErrorMessage(err.toString());
|
|
68
68
|
goToInitialView();
|
|
69
|
-
|
|
69
|
+
setIsVerificationInProgress(false);
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
});
|
|
@@ -74,7 +74,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
74
74
|
// This is because we already called it in onlyConnectUser and now we just want to sign
|
|
75
75
|
const signAlreadyConnectedUser = ({ walletConnector, fetchPublicAddressOpts = undefined, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
76
76
|
// Raise verification ongoing flag
|
|
77
|
-
|
|
77
|
+
setIsVerificationInProgress(true);
|
|
78
78
|
try {
|
|
79
79
|
const publicWalletAddress = yield connectWallet(walletConnector, fetchPublicAddressOpts);
|
|
80
80
|
if (!publicWalletAddress) {
|
|
@@ -90,7 +90,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
90
90
|
logger.logger.debug(err);
|
|
91
91
|
setErrorMessage(err.toString());
|
|
92
92
|
goToInitialView();
|
|
93
|
-
|
|
93
|
+
setIsVerificationInProgress(false);
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
});
|
|
@@ -25,7 +25,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
25
25
|
const { setView, goToInitialView } = useViewContext();
|
|
26
26
|
const { setErrorMessage } = useErrorContext();
|
|
27
27
|
const { captchaToken } = useCaptchaContext();
|
|
28
|
-
const { connectWallet, consumeNonce, displayTermsOfService, projectSettings, environmentId, setIsSingleWalletAccount, setShowAuthFlow, user, authMode, setCallback,
|
|
28
|
+
const { connectWallet, consumeNonce, displayTermsOfService, projectSettings, environmentId, setIsSingleWalletAccount, setShowAuthFlow, user, authMode, setCallback, setIsVerificationInProgress, } = useInternalDynamicContext();
|
|
29
29
|
const { handleWalletsToConnect } = useHandleWalletsToConnect();
|
|
30
30
|
const verifyWallet = useVerifyWallet({
|
|
31
31
|
consumeNonce,
|
|
@@ -41,7 +41,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
41
41
|
const onlyConnectUser = ({ walletConnector, fetchPublicAddressOpts = undefined, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
42
|
var _a;
|
|
43
43
|
// Raise verification ongoing flag
|
|
44
|
-
|
|
44
|
+
setIsVerificationInProgress(true);
|
|
45
45
|
yield showPendingConnectView(walletConnector, setView);
|
|
46
46
|
try {
|
|
47
47
|
yield connectWallet(walletConnector, fetchPublicAddressOpts);
|
|
@@ -62,7 +62,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
62
62
|
logger.debug(err);
|
|
63
63
|
setErrorMessage(err.toString());
|
|
64
64
|
goToInitialView();
|
|
65
|
-
|
|
65
|
+
setIsVerificationInProgress(false);
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
});
|
|
@@ -70,7 +70,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
70
70
|
// This is because we already called it in onlyConnectUser and now we just want to sign
|
|
71
71
|
const signAlreadyConnectedUser = ({ walletConnector, fetchPublicAddressOpts = undefined, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
72
|
// Raise verification ongoing flag
|
|
73
|
-
|
|
73
|
+
setIsVerificationInProgress(true);
|
|
74
74
|
try {
|
|
75
75
|
const publicWalletAddress = yield connectWallet(walletConnector, fetchPublicAddressOpts);
|
|
76
76
|
if (!publicWalletAddress) {
|
|
@@ -86,7 +86,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
86
86
|
logger.debug(err);
|
|
87
87
|
setErrorMessage(err.toString());
|
|
88
88
|
goToInitialView();
|
|
89
|
-
|
|
89
|
+
setIsVerificationInProgress(false);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
});
|
|
@@ -25,22 +25,22 @@ require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
|
25
25
|
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
26
26
|
|
|
27
27
|
const useVerifyOnAwaitingSignature = () => {
|
|
28
|
-
const { awaitingSignatureState, multiWalletWidgetState, setMultiWalletWidgetState,
|
|
28
|
+
const { awaitingSignatureState, multiWalletWidgetState, setMultiWalletWidgetState, legacyIsVerifying, setLegacyIsVerifying, selectedWalletConnector, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
29
29
|
const triggerConnectAndSign = useConnectAndSign.useConnectAndSign();
|
|
30
30
|
React.useEffect(() => {
|
|
31
|
-
if (!
|
|
31
|
+
if (!legacyIsVerifying &&
|
|
32
32
|
multiWalletWidgetState === 'awaiting_signature' &&
|
|
33
33
|
selectedWalletConnector &&
|
|
34
34
|
awaitingSignatureState === 'linking_new_wallet' &&
|
|
35
35
|
!requiresTwoStepAuthentication.requiresTwoStepAuthentication(selectedWalletConnector)) {
|
|
36
|
-
|
|
36
|
+
setLegacyIsVerifying(true);
|
|
37
37
|
triggerConnectAndSign({ walletConnector: selectedWalletConnector })
|
|
38
38
|
.catch((e) => {
|
|
39
39
|
logger.logger.error(e);
|
|
40
40
|
})
|
|
41
41
|
.finally(() => {
|
|
42
42
|
setMultiWalletWidgetState('idle');
|
|
43
|
-
|
|
43
|
+
setLegacyIsVerifying(false);
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
}, [
|
|
@@ -48,7 +48,7 @@ const useVerifyOnAwaitingSignature = () => {
|
|
|
48
48
|
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
49
49
|
multiWalletWidgetState,
|
|
50
50
|
setMultiWalletWidgetState,
|
|
51
|
-
|
|
51
|
+
legacyIsVerifying,
|
|
52
52
|
]);
|
|
53
53
|
};
|
|
54
54
|
|
package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js
CHANGED
|
@@ -21,22 +21,22 @@ import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
|
21
21
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
22
22
|
|
|
23
23
|
const useVerifyOnAwaitingSignature = () => {
|
|
24
|
-
const { awaitingSignatureState, multiWalletWidgetState, setMultiWalletWidgetState,
|
|
24
|
+
const { awaitingSignatureState, multiWalletWidgetState, setMultiWalletWidgetState, legacyIsVerifying, setLegacyIsVerifying, selectedWalletConnector, } = useInternalDynamicContext();
|
|
25
25
|
const triggerConnectAndSign = useConnectAndSign();
|
|
26
26
|
useEffect(() => {
|
|
27
|
-
if (!
|
|
27
|
+
if (!legacyIsVerifying &&
|
|
28
28
|
multiWalletWidgetState === 'awaiting_signature' &&
|
|
29
29
|
selectedWalletConnector &&
|
|
30
30
|
awaitingSignatureState === 'linking_new_wallet' &&
|
|
31
31
|
!requiresTwoStepAuthentication(selectedWalletConnector)) {
|
|
32
|
-
|
|
32
|
+
setLegacyIsVerifying(true);
|
|
33
33
|
triggerConnectAndSign({ walletConnector: selectedWalletConnector })
|
|
34
34
|
.catch((e) => {
|
|
35
35
|
logger.error(e);
|
|
36
36
|
})
|
|
37
37
|
.finally(() => {
|
|
38
38
|
setMultiWalletWidgetState('idle');
|
|
39
|
-
|
|
39
|
+
setLegacyIsVerifying(false);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
}, [
|
|
@@ -44,7 +44,7 @@ const useVerifyOnAwaitingSignature = () => {
|
|
|
44
44
|
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
45
45
|
multiWalletWidgetState,
|
|
46
46
|
setMultiWalletWidgetState,
|
|
47
|
-
|
|
47
|
+
legacyIsVerifying,
|
|
48
48
|
]);
|
|
49
49
|
};
|
|
50
50
|
|
|
@@ -22,12 +22,12 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useInte
|
|
|
22
22
|
const useConnectWithEmail = ({ emailWalletConnector, handleConnect, }) => {
|
|
23
23
|
const { error } = ErrorContext.useErrorContext();
|
|
24
24
|
const [loading, setLoading] = React.useState(false);
|
|
25
|
-
const {
|
|
25
|
+
const { setIsVerificationInProgress } = useInternalDynamicContext.useInternalDynamicContext();
|
|
26
26
|
const connectWithEmail = (email) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
27
27
|
if (!email || !emailWalletConnector || loading)
|
|
28
28
|
return;
|
|
29
29
|
// Indicate auth verification process start
|
|
30
|
-
|
|
30
|
+
setIsVerificationInProgress(true);
|
|
31
31
|
setLoading(true);
|
|
32
32
|
emailWalletConnector.setEmail(email);
|
|
33
33
|
try {
|
|
@@ -35,7 +35,7 @@ const useConnectWithEmail = ({ emailWalletConnector, handleConnect, }) => {
|
|
|
35
35
|
}
|
|
36
36
|
catch (e) {
|
|
37
37
|
logger.logger.error(e);
|
|
38
|
-
|
|
38
|
+
setIsVerificationInProgress(false);
|
|
39
39
|
setLoading(false);
|
|
40
40
|
}
|
|
41
41
|
});
|
|
@@ -18,12 +18,12 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useIn
|
|
|
18
18
|
const useConnectWithEmail = ({ emailWalletConnector, handleConnect, }) => {
|
|
19
19
|
const { error } = useErrorContext();
|
|
20
20
|
const [loading, setLoading] = useState(false);
|
|
21
|
-
const {
|
|
21
|
+
const { setIsVerificationInProgress } = useInternalDynamicContext();
|
|
22
22
|
const connectWithEmail = (email) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
23
|
if (!email || !emailWalletConnector || loading)
|
|
24
24
|
return;
|
|
25
25
|
// Indicate auth verification process start
|
|
26
|
-
|
|
26
|
+
setIsVerificationInProgress(true);
|
|
27
27
|
setLoading(true);
|
|
28
28
|
emailWalletConnector.setEmail(email);
|
|
29
29
|
try {
|
|
@@ -31,7 +31,7 @@ const useConnectWithEmail = ({ emailWalletConnector, handleConnect, }) => {
|
|
|
31
31
|
}
|
|
32
32
|
catch (e) {
|
|
33
33
|
logger.error(e);
|
|
34
|
-
|
|
34
|
+
setIsVerificationInProgress(false);
|
|
35
35
|
setLoading(false);
|
|
36
36
|
}
|
|
37
37
|
});
|
|
@@ -36,7 +36,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
36
36
|
const { setDeniedAddress, setDeniedOauthProvider } = AccessDeniedContext.useAccessDeniedContext();
|
|
37
37
|
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
38
38
|
const { setErrorMessage, setError } = ErrorContext.useErrorContext();
|
|
39
|
-
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, setAuthMode, removeConnectedWalletsInfo,
|
|
39
|
+
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, setAuthMode, removeConnectedWalletsInfo, setIsVerificationInProgress, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
40
40
|
// If the user is not already logged it means that we only need to verify
|
|
41
41
|
// We need this boolean for the part of the logic where we already persisted a new authToken,
|
|
42
42
|
// and need to distinguish between logic for verify or linking.
|
|
@@ -91,7 +91,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
91
91
|
const handleError = (e, walletConnector, address, oauth) => {
|
|
92
92
|
removeConnectedWalletsInfo();
|
|
93
93
|
// Ensure auth verification flag is taken down
|
|
94
|
-
|
|
94
|
+
setIsVerificationInProgress(false);
|
|
95
95
|
// This is a special case where the user is trying to link a wallet
|
|
96
96
|
// and the wallet is already linked and we don't want to kill the session.
|
|
97
97
|
if (e instanceof utils.WalletUsedError) {
|
|
@@ -32,7 +32,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
32
32
|
const { setDeniedAddress, setDeniedOauthProvider } = useAccessDeniedContext();
|
|
33
33
|
const { setView, goToInitialView } = useViewContext();
|
|
34
34
|
const { setErrorMessage, setError } = useErrorContext();
|
|
35
|
-
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, setAuthMode, removeConnectedWalletsInfo,
|
|
35
|
+
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, setAuthMode, removeConnectedWalletsInfo, setIsVerificationInProgress, } = useInternalDynamicContext();
|
|
36
36
|
// If the user is not already logged it means that we only need to verify
|
|
37
37
|
// We need this boolean for the part of the logic where we already persisted a new authToken,
|
|
38
38
|
// and need to distinguish between logic for verify or linking.
|
|
@@ -87,7 +87,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
87
87
|
const handleError = (e, walletConnector, address, oauth) => {
|
|
88
88
|
removeConnectedWalletsInfo();
|
|
89
89
|
// Ensure auth verification flag is taken down
|
|
90
|
-
|
|
90
|
+
setIsVerificationInProgress(false);
|
|
91
91
|
// This is a special case where the user is trying to link a wallet
|
|
92
92
|
// and the wallet is already linked and we don't want to kill the session.
|
|
93
93
|
if (e instanceof WalletUsedError) {
|
|
@@ -28,7 +28,7 @@ require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
|
28
28
|
var useConnectAndSignSplitSteps = require('../authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs');
|
|
29
29
|
|
|
30
30
|
const useWalletItemActions = () => {
|
|
31
|
-
const { setMultiWalletWidgetState, setShowAuthFlow, setSelectedWalletConnector, wallets, setQrcodeUri, setDesktopUri, user, linkedWallets,
|
|
31
|
+
const { setMultiWalletWidgetState, setShowAuthFlow, setSelectedWalletConnector, wallets, setQrcodeUri, setDesktopUri, user, linkedWallets, setLegacyIsVerifying, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
32
32
|
const { mockedSDK } = MockContext.useMockContext();
|
|
33
33
|
const { setError } = ErrorContext.useErrorContext();
|
|
34
34
|
const { setView } = ViewContext.useViewContext();
|
|
@@ -111,7 +111,7 @@ const useWalletItemActions = () => {
|
|
|
111
111
|
if (walletConnector.connectedChain === 'FLOW') {
|
|
112
112
|
yield walletConnector.endSession();
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
setLegacyIsVerifying(false);
|
|
115
115
|
if (isSelectedWalletAlreadyConnected.isSelectedWalletAlreadyConnected(linkedWallets, walletConnector, user) &&
|
|
116
116
|
walletConnector.connectedChain !== 'FLOW') {
|
|
117
117
|
// wallet is already connected
|
|
@@ -24,7 +24,7 @@ import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
|
24
24
|
import { useConnectAndSignSplitSteps } from '../authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js';
|
|
25
25
|
|
|
26
26
|
const useWalletItemActions = () => {
|
|
27
|
-
const { setMultiWalletWidgetState, setShowAuthFlow, setSelectedWalletConnector, wallets, setQrcodeUri, setDesktopUri, user, linkedWallets,
|
|
27
|
+
const { setMultiWalletWidgetState, setShowAuthFlow, setSelectedWalletConnector, wallets, setQrcodeUri, setDesktopUri, user, linkedWallets, setLegacyIsVerifying, } = useInternalDynamicContext();
|
|
28
28
|
const { mockedSDK } = useMockContext();
|
|
29
29
|
const { setError } = useErrorContext();
|
|
30
30
|
const { setView } = useViewContext();
|
|
@@ -107,7 +107,7 @@ const useWalletItemActions = () => {
|
|
|
107
107
|
if (walletConnector.connectedChain === 'FLOW') {
|
|
108
108
|
yield walletConnector.endSession();
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
setLegacyIsVerifying(false);
|
|
111
111
|
if (isSelectedWalletAlreadyConnected(linkedWallets, walletConnector, user) &&
|
|
112
112
|
walletConnector.connectedChain !== 'FLOW') {
|
|
113
113
|
// wallet is already connected
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
require('@dynamic-labs/sdk-api');
|
|
6
|
-
var logger = require('../../../../../shared/logger.cjs');
|
|
7
|
-
require('@dynamic-labs/iconic');
|
|
8
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
9
|
-
require('react/jsx-runtime');
|
|
10
|
-
require('../../../../ViewContext/ViewContext.cjs');
|
|
11
|
-
require('react');
|
|
12
|
-
require('@dynamic-labs/wallet-book');
|
|
13
|
-
require('@dynamic-labs/utils');
|
|
14
|
-
require('../../../../../utils/constants/colors.cjs');
|
|
15
|
-
require('../../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
16
|
-
require('ethers');
|
|
17
|
-
require('../../../../../shared/consts/index.cjs');
|
|
18
|
-
|
|
19
|
-
/** Sets the auth verification flag to false, but first ensures it was true in the first place. Logs error otherwise */
|
|
20
|
-
const disableAuthVerificationFlag = ({ authVerification, setAuthVerification, }) => {
|
|
21
|
-
if (authVerification)
|
|
22
|
-
setAuthVerification(false);
|
|
23
|
-
else
|
|
24
|
-
logger.logger.error('The "auth" flag, from ongoingVerifications, had not been previously raised at the time of being lowered. Please ensure to set it to true whenever any kind of auth verification process is started');
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
exports.disableAuthVerificationFlag = disableAuthVerificationFlag;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { IOngoingVerifications } from '../../../types';
|
|
2
|
-
/** Sets the auth verification flag to false, but first ensures it was true in the first place. Logs error otherwise */
|
|
3
|
-
export declare const disableAuthVerificationFlag: ({ authVerification, setAuthVerification, }: Pick<IOngoingVerifications, 'authVerification' | 'setAuthVerification'>) => void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import '@dynamic-labs/sdk-api';
|
|
2
|
-
import { logger } from '../../../../../shared/logger.js';
|
|
3
|
-
import '@dynamic-labs/iconic';
|
|
4
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
5
|
-
import 'react/jsx-runtime';
|
|
6
|
-
import '../../../../ViewContext/ViewContext.js';
|
|
7
|
-
import 'react';
|
|
8
|
-
import '@dynamic-labs/wallet-book';
|
|
9
|
-
import '@dynamic-labs/utils';
|
|
10
|
-
import '../../../../../utils/constants/colors.js';
|
|
11
|
-
import '../../../../../shared/utils/classes/storage/localStorage.js';
|
|
12
|
-
import 'ethers';
|
|
13
|
-
import '../../../../../shared/consts/index.js';
|
|
14
|
-
|
|
15
|
-
/** Sets the auth verification flag to false, but first ensures it was true in the first place. Logs error otherwise */
|
|
16
|
-
const disableAuthVerificationFlag = ({ authVerification, setAuthVerification, }) => {
|
|
17
|
-
if (authVerification)
|
|
18
|
-
setAuthVerification(false);
|
|
19
|
-
else
|
|
20
|
-
logger.error('The "auth" flag, from ongoingVerifications, had not been previously raised at the time of being lowered. Please ensure to set it to true whenever any kind of auth verification process is started');
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export { disableAuthVerificationFlag };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './disableAuthVerificationFlag';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './disableAuthVerificationFlag';
|