@dynamic-labs/sdk-react-core 0.17.4 → 0.17.5
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 +9 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +15 -6
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +15 -6
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +3 -3
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +3 -3
- package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.cjs +2 -2
- package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.js +2 -2
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +4 -2
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +5 -3
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +2 -2
- package/src/lib/views/EmailUpdate/EmailUpdate.js +2 -2
- package/src/lib/views/EmailVerification/EmailVerification.cjs +6 -5
- package/src/lib/views/EmailVerification/EmailVerification.js +6 -5
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +2 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +2 -2
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +2 -2
- package/src/lib/views/WalletUsedView/WalletUsedView.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
|
|
2
|
+
### [0.17.5](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.4...v0.17.5) (2023-06-15)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* don't remove project settings from ls if there's a connected wallet ([#2335](https://github.com/dynamic-labs/DynamicAuth/issues/2335)) ([a4d3f0e](https://github.com/dynamic-labs/DynamicAuth/commit/a4d3f0ef8667d0a67d489b05a7a46e5b401ed1a6))
|
|
8
|
+
* setting initial view when error in auth flow ([#2346](https://github.com/dynamic-labs/DynamicAuth/issues/2346)) ([35e0e47](https://github.com/dynamic-labs/DynamicAuth/commit/35e0e47a649f3a88f12126f539ec12167ce27486))
|
|
9
|
+
* **widget:** add fallback icon when oauth provider does not exist ([#2351](https://github.com/dynamic-labs/DynamicAuth/issues/2351)) ([af9f64f](https://github.com/dynamic-labs/DynamicAuth/commit/af9f64f4f4a287fff666109e19d969b351016b62)), closes [#2349](https://github.com/dynamic-labs/DynamicAuth/issues/2349)
|
|
10
|
+
|
|
2
11
|
### [0.17.4](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.3...v0.17.4) (2023-06-14)
|
|
3
12
|
|
|
4
13
|
### [0.17.3](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.2...v0.17.3) (2023-06-14)
|
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": "0.17.
|
|
3
|
+
"version": "0.17.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"formik": "2.2.9",
|
|
17
17
|
"qrcode": "1.5.1",
|
|
18
18
|
"ethers": "5.7.2",
|
|
19
|
-
"@dynamic-labs/logger": "0.17.
|
|
20
|
-
"@dynamic-labs/multi-wallet": "0.17.
|
|
21
|
-
"@dynamic-labs/rpc-providers": "0.17.
|
|
22
|
-
"@dynamic-labs/types": "0.17.
|
|
23
|
-
"@dynamic-labs/utils": "0.17.
|
|
24
|
-
"@dynamic-labs/wallet-book": "0.17.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "0.17.
|
|
19
|
+
"@dynamic-labs/logger": "0.17.5",
|
|
20
|
+
"@dynamic-labs/multi-wallet": "0.17.5",
|
|
21
|
+
"@dynamic-labs/rpc-providers": "0.17.5",
|
|
22
|
+
"@dynamic-labs/types": "0.17.5",
|
|
23
|
+
"@dynamic-labs/utils": "0.17.5",
|
|
24
|
+
"@dynamic-labs/wallet-book": "0.17.5",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "0.17.5"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"semver": "7.3.8"
|
|
@@ -7,7 +7,7 @@ var walletBook = require('@dynamic-labs/wallet-book');
|
|
|
7
7
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
8
|
var iconic = require('@dynamic-labs/iconic');
|
|
9
9
|
require('@dynamic-labs/sdk-api');
|
|
10
|
-
require('../../shared/logger.cjs');
|
|
10
|
+
var logger = require('../../shared/logger.cjs');
|
|
11
11
|
require('../../config/LSSuffix.cjs');
|
|
12
12
|
require('../../context/ViewContext/ViewContext.cjs');
|
|
13
13
|
require('react');
|
|
@@ -44,16 +44,25 @@ require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
|
44
44
|
var useGetSocialIcon = require('../../utils/hooks/useGetSocialIcon/useGetSocialIcon.cjs');
|
|
45
45
|
|
|
46
46
|
const getMagicEmailOrSocialIcon = ({ getSocialIcon, wallet, jwt, }) => {
|
|
47
|
-
let Icon = null;
|
|
48
47
|
if (walletConnectorCore.isEmailOTPWalletConnector(wallet.connector)) {
|
|
49
|
-
|
|
48
|
+
return iconic.SignInWithEmailIcon;
|
|
50
49
|
}
|
|
51
50
|
if (walletConnectorCore.isSocialWalletConnector(wallet.connector)) {
|
|
52
51
|
const socialAccountDataForWallet = getReferencedAccount.getReferencedAccount(jwt, wallet.id);
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
if (!socialAccountDataForWallet ||
|
|
53
|
+
!socialAccountDataForWallet.oauthProvider) {
|
|
54
|
+
return iconic.SignInWithEmailIcon;
|
|
55
|
+
}
|
|
56
|
+
const { oauthProvider } = socialAccountDataForWallet;
|
|
57
|
+
try {
|
|
58
|
+
const MagicSocialWalletIcon = getSocialIcon(oauthProvider);
|
|
59
|
+
return MagicSocialWalletIcon;
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
logger.logger.error(err);
|
|
63
|
+
}
|
|
55
64
|
}
|
|
56
|
-
return
|
|
65
|
+
return null;
|
|
57
66
|
};
|
|
58
67
|
const AuthProviderIcon = ({ jwt, iconSize = 64, showStatus, wallet, }) => {
|
|
59
68
|
const { primaryWallet, selectedWalletConnector } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -3,7 +3,7 @@ import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
|
3
3
|
import { isEmailOTPWalletConnector, isSocialWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { SignInWithEmailIcon } from '@dynamic-labs/iconic';
|
|
5
5
|
import '@dynamic-labs/sdk-api';
|
|
6
|
-
import '../../shared/logger.js';
|
|
6
|
+
import { logger } from '../../shared/logger.js';
|
|
7
7
|
import '../../config/LSSuffix.js';
|
|
8
8
|
import '../../context/ViewContext/ViewContext.js';
|
|
9
9
|
import 'react';
|
|
@@ -40,16 +40,25 @@ import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
|
40
40
|
import { useGetSocialIcon } from '../../utils/hooks/useGetSocialIcon/useGetSocialIcon.js';
|
|
41
41
|
|
|
42
42
|
const getMagicEmailOrSocialIcon = ({ getSocialIcon, wallet, jwt, }) => {
|
|
43
|
-
let Icon = null;
|
|
44
43
|
if (isEmailOTPWalletConnector(wallet.connector)) {
|
|
45
|
-
|
|
44
|
+
return SignInWithEmailIcon;
|
|
46
45
|
}
|
|
47
46
|
if (isSocialWalletConnector(wallet.connector)) {
|
|
48
47
|
const socialAccountDataForWallet = getReferencedAccount(jwt, wallet.id);
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
if (!socialAccountDataForWallet ||
|
|
49
|
+
!socialAccountDataForWallet.oauthProvider) {
|
|
50
|
+
return SignInWithEmailIcon;
|
|
51
|
+
}
|
|
52
|
+
const { oauthProvider } = socialAccountDataForWallet;
|
|
53
|
+
try {
|
|
54
|
+
const MagicSocialWalletIcon = getSocialIcon(oauthProvider);
|
|
55
|
+
return MagicSocialWalletIcon;
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
logger.error(err);
|
|
59
|
+
}
|
|
51
60
|
}
|
|
52
|
-
return
|
|
61
|
+
return null;
|
|
53
62
|
};
|
|
54
63
|
const AuthProviderIcon = ({ jwt, iconSize = 64, showStatus, wallet, }) => {
|
|
55
64
|
const { primaryWallet, selectedWalletConnector } = useInternalDynamicContext();
|
|
@@ -25,7 +25,7 @@ var useVerifyWallet = require('../../useVerifyWallet/useVerifyWallet.cjs');
|
|
|
25
25
|
var CaptchaContext = require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
26
26
|
|
|
27
27
|
const useConnectAndSign = () => {
|
|
28
|
-
const { setView } = ViewContext.useViewContext();
|
|
28
|
+
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
29
29
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
30
30
|
const { captchaToken } = CaptchaContext.useCaptchaContext();
|
|
31
31
|
const { authMode, connectWallet, consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, setShowAuthFlow, user, walletUiUtils, setCallback, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -73,7 +73,7 @@ const useConnectAndSign = () => {
|
|
|
73
73
|
}
|
|
74
74
|
catch (err) {
|
|
75
75
|
setErrorMessage((_b = err === null || err === void 0 ? void 0 : err.code) === null || _b === void 0 ? void 0 : _b.toString());
|
|
76
|
-
|
|
76
|
+
goToInitialView();
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
});
|
|
@@ -21,7 +21,7 @@ import { useVerifyWallet } from '../../useVerifyWallet/useVerifyWallet.js';
|
|
|
21
21
|
import { useCaptchaContext } from '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
22
22
|
|
|
23
23
|
const useConnectAndSign = () => {
|
|
24
|
-
const { setView } = useViewContext();
|
|
24
|
+
const { setView, goToInitialView } = useViewContext();
|
|
25
25
|
const { setErrorMessage } = useErrorContext();
|
|
26
26
|
const { captchaToken } = useCaptchaContext();
|
|
27
27
|
const { authMode, connectWallet, consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, setShowAuthFlow, user, walletUiUtils, setCallback, } = useInternalDynamicContext();
|
|
@@ -69,7 +69,7 @@ const useConnectAndSign = () => {
|
|
|
69
69
|
}
|
|
70
70
|
catch (err) {
|
|
71
71
|
setErrorMessage((_b = err === null || err === void 0 ? void 0 : err.code) === null || _b === void 0 ? void 0 : _b.toString());
|
|
72
|
-
|
|
72
|
+
goToInitialView();
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
});
|
|
@@ -25,7 +25,7 @@ require('../../../../shared/consts/index.cjs');
|
|
|
25
25
|
var CaptchaContext = require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
26
26
|
|
|
27
27
|
const useConnectAndSignSplitSteps = () => {
|
|
28
|
-
const { setView } = ViewContext.useViewContext();
|
|
28
|
+
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
29
29
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
30
30
|
const { captchaToken } = CaptchaContext.useCaptchaContext();
|
|
31
31
|
const { connectWallet, consumeNonce, displayTermsOfService, projectSettings, environmentId, setIsSingleWalletAccount, setShowAuthFlow, user, authMode, setCallback, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -60,7 +60,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
60
60
|
}
|
|
61
61
|
catch (err) {
|
|
62
62
|
setErrorMessage(err.toString());
|
|
63
|
-
|
|
63
|
+
goToInitialView();
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
});
|
|
@@ -77,7 +77,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
77
77
|
}
|
|
78
78
|
catch (err) {
|
|
79
79
|
setErrorMessage(err.toString());
|
|
80
|
-
|
|
80
|
+
goToInitialView();
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
@@ -21,7 +21,7 @@ import '../../../../shared/consts/index.js';
|
|
|
21
21
|
import { useCaptchaContext } from '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
22
22
|
|
|
23
23
|
const useConnectAndSignSplitSteps = () => {
|
|
24
|
-
const { setView } = useViewContext();
|
|
24
|
+
const { setView, goToInitialView } = useViewContext();
|
|
25
25
|
const { setErrorMessage } = useErrorContext();
|
|
26
26
|
const { captchaToken } = useCaptchaContext();
|
|
27
27
|
const { connectWallet, consumeNonce, displayTermsOfService, projectSettings, environmentId, setIsSingleWalletAccount, setShowAuthFlow, user, authMode, setCallback, } = useInternalDynamicContext();
|
|
@@ -56,7 +56,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
56
56
|
}
|
|
57
57
|
catch (err) {
|
|
58
58
|
setErrorMessage(err.toString());
|
|
59
|
-
|
|
59
|
+
goToInitialView();
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
});
|
|
@@ -73,7 +73,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
73
73
|
}
|
|
74
74
|
catch (err) {
|
|
75
75
|
setErrorMessage(err.toString());
|
|
76
|
-
|
|
76
|
+
goToInitialView();
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
});
|
package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.cjs
CHANGED
|
@@ -22,12 +22,12 @@ require('@dynamic-labs/sdk-api');
|
|
|
22
22
|
|
|
23
23
|
const useCreateUserProfileByJWTCallback = () => {
|
|
24
24
|
const { setUser, handleLogOut } = useInternalDynamicContext.useInternalDynamicContext();
|
|
25
|
-
const {
|
|
25
|
+
const { goToInitialView } = ViewContext.useViewContext();
|
|
26
26
|
const createUserProfileByJWT = React.useCallback((jwt) => {
|
|
27
27
|
const decodedJWT = decodeJwt.decodeJwt(jwt);
|
|
28
28
|
if (!decodedJWT) {
|
|
29
29
|
handleLogOut();
|
|
30
|
-
|
|
30
|
+
goToInitialView();
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
const userProfile = createUserProfile.createUserProfile(decodedJWT);
|
package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.js
CHANGED
|
@@ -18,12 +18,12 @@ import '@dynamic-labs/sdk-api';
|
|
|
18
18
|
|
|
19
19
|
const useCreateUserProfileByJWTCallback = () => {
|
|
20
20
|
const { setUser, handleLogOut } = useInternalDynamicContext();
|
|
21
|
-
const {
|
|
21
|
+
const { goToInitialView } = useViewContext();
|
|
22
22
|
const createUserProfileByJWT = useCallback((jwt) => {
|
|
23
23
|
const decodedJWT = decodeJwt(jwt);
|
|
24
24
|
if (!decodedJWT) {
|
|
25
25
|
handleLogOut();
|
|
26
|
-
|
|
26
|
+
goToInitialView();
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
const userProfile = createUserProfile(decodedJWT);
|
|
@@ -7,6 +7,7 @@ var utils = require('@dynamic-labs/utils');
|
|
|
7
7
|
var api = require('../../../data/api.cjs');
|
|
8
8
|
require('@dynamic-labs/sdk-api');
|
|
9
9
|
require('../../../shared/logger.cjs');
|
|
10
|
+
var getFromLS = require('../../../shared/utils/functions/storage/getFromLS.cjs');
|
|
10
11
|
require('../../../config/LSSuffix.cjs');
|
|
11
12
|
require('@dynamic-labs/iconic');
|
|
12
13
|
require('@dynamic-labs/wallet-connector-core');
|
|
@@ -32,10 +33,11 @@ const useFetchProjectSettings = ({ authToken, environmentId, maxRetries = 2, })
|
|
|
32
33
|
removeLsSettings();
|
|
33
34
|
}
|
|
34
35
|
React.useEffect(() => {
|
|
35
|
-
|
|
36
|
+
const connectedWalletData = getFromLS.getFromLS(localStorage.CONNECTED_WALLET_CONNECTOR_DATA);
|
|
37
|
+
if (!authToken && !connectedWalletData) {
|
|
36
38
|
removeLsSettings();
|
|
37
39
|
}
|
|
38
|
-
}, [authToken]);
|
|
40
|
+
}, [authToken, removeLsSettings]);
|
|
39
41
|
React.useEffect(() => {
|
|
40
42
|
if (!lsSettingsExists &&
|
|
41
43
|
!isLoading &&
|
|
@@ -3,12 +3,13 @@ import { DynamicError } from '@dynamic-labs/utils';
|
|
|
3
3
|
import { fetchProjectSettings } from '../../../data/api.js';
|
|
4
4
|
import '@dynamic-labs/sdk-api';
|
|
5
5
|
import '../../../shared/logger.js';
|
|
6
|
+
import { getFromLS } from '../../../shared/utils/functions/storage/getFromLS.js';
|
|
6
7
|
import '../../../config/LSSuffix.js';
|
|
7
8
|
import '@dynamic-labs/iconic';
|
|
8
9
|
import '@dynamic-labs/wallet-connector-core';
|
|
9
10
|
import 'react/jsx-runtime';
|
|
10
11
|
import '../../../context/ViewContext/ViewContext.js';
|
|
11
|
-
import { PROJECT_SETTINGS_STORAGE_KEY } from '../../constants/localStorage.js';
|
|
12
|
+
import { PROJECT_SETTINGS_STORAGE_KEY, CONNECTED_WALLET_CONNECTOR_DATA } from '../../constants/localStorage.js';
|
|
12
13
|
import '../../constants/colors.js';
|
|
13
14
|
import 'ethers';
|
|
14
15
|
import { useLocalStorage } from '../../../shared/utils/hooks/useLocalStorage/useLocalStorage.js';
|
|
@@ -28,10 +29,11 @@ const useFetchProjectSettings = ({ authToken, environmentId, maxRetries = 2, })
|
|
|
28
29
|
removeLsSettings();
|
|
29
30
|
}
|
|
30
31
|
useEffect(() => {
|
|
31
|
-
|
|
32
|
+
const connectedWalletData = getFromLS(CONNECTED_WALLET_CONNECTOR_DATA);
|
|
33
|
+
if (!authToken && !connectedWalletData) {
|
|
32
34
|
removeLsSettings();
|
|
33
35
|
}
|
|
34
|
-
}, [authToken]);
|
|
36
|
+
}, [authToken, removeLsSettings]);
|
|
35
37
|
useEffect(() => {
|
|
36
38
|
if (!lsSettingsExists &&
|
|
37
39
|
!isLoading &&
|
|
@@ -49,7 +49,7 @@ const EmailUpdate = () => {
|
|
|
49
49
|
const [updatedEmail, setUpdatedEmail] = React.useState('');
|
|
50
50
|
const { setError, setErrorMessage } = ErrorContext.useErrorContext();
|
|
51
51
|
const { loading, setLoading } = LoadingContext.useLoadingContext();
|
|
52
|
-
const { setView } = ViewContext.useViewContext();
|
|
52
|
+
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
53
53
|
const { email, setEmail, setVerificationUUID } = EmailVerificationContext.useEmailVerificationContext();
|
|
54
54
|
const { environmentId, handleLogOut, onboardingOnlyJwt } = useInternalDynamicContext.useInternalDynamicContext();
|
|
55
55
|
const handleBackClick = () => {
|
|
@@ -65,7 +65,7 @@ const EmailUpdate = () => {
|
|
|
65
65
|
const { emailVerification } = yield api.updateUserProfileFields(onboardingOnlyJwt, environmentId, { email: updatedEmail });
|
|
66
66
|
if (!emailVerification) {
|
|
67
67
|
yield handleLogOut();
|
|
68
|
-
|
|
68
|
+
goToInitialView();
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
setError(undefined);
|
|
@@ -45,7 +45,7 @@ const EmailUpdate = () => {
|
|
|
45
45
|
const [updatedEmail, setUpdatedEmail] = useState('');
|
|
46
46
|
const { setError, setErrorMessage } = useErrorContext();
|
|
47
47
|
const { loading, setLoading } = useLoadingContext();
|
|
48
|
-
const { setView } = useViewContext();
|
|
48
|
+
const { setView, goToInitialView } = useViewContext();
|
|
49
49
|
const { email, setEmail, setVerificationUUID } = useEmailVerificationContext();
|
|
50
50
|
const { environmentId, handleLogOut, onboardingOnlyJwt } = useInternalDynamicContext();
|
|
51
51
|
const handleBackClick = () => {
|
|
@@ -61,7 +61,7 @@ const EmailUpdate = () => {
|
|
|
61
61
|
const { emailVerification } = yield updateUserProfileFields(onboardingOnlyJwt, environmentId, { email: updatedEmail });
|
|
62
62
|
if (!emailVerification) {
|
|
63
63
|
yield handleLogOut();
|
|
64
|
-
|
|
64
|
+
goToInitialView();
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
setError(undefined);
|
|
@@ -76,7 +76,7 @@ const EmailVerification = () => {
|
|
|
76
76
|
setLoading(true);
|
|
77
77
|
if (!verificationUUID || (!authToken && !onboardingOnlyJwt)) {
|
|
78
78
|
yield handleLogOut();
|
|
79
|
-
|
|
79
|
+
goToInitialView();
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
try {
|
|
@@ -104,7 +104,7 @@ const EmailVerification = () => {
|
|
|
104
104
|
authToken,
|
|
105
105
|
onboardingOnlyJwt,
|
|
106
106
|
handleLogOut,
|
|
107
|
-
|
|
107
|
+
goToInitialView,
|
|
108
108
|
verifyEmail,
|
|
109
109
|
setShowAuthFlow,
|
|
110
110
|
setOnboardingOnlyJwt,
|
|
@@ -116,7 +116,7 @@ const EmailVerification = () => {
|
|
|
116
116
|
setLoading(true);
|
|
117
117
|
if (!verificationUUID) {
|
|
118
118
|
yield handleLogOut();
|
|
119
|
-
|
|
119
|
+
goToInitialView();
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
try {
|
|
@@ -127,7 +127,7 @@ const EmailVerification = () => {
|
|
|
127
127
|
});
|
|
128
128
|
if (!jwt) {
|
|
129
129
|
yield handleLogOut();
|
|
130
|
-
|
|
130
|
+
goToInitialView();
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
const decodedJwt = decodeJwt.decodeJwt(jwt);
|
|
@@ -160,10 +160,11 @@ const EmailVerification = () => {
|
|
|
160
160
|
setLoading,
|
|
161
161
|
verificationUUID,
|
|
162
162
|
handleLogOut,
|
|
163
|
-
|
|
163
|
+
goToInitialView,
|
|
164
164
|
environmentId,
|
|
165
165
|
setCallback,
|
|
166
166
|
setOnboardingOnlyJwt,
|
|
167
|
+
setView,
|
|
167
168
|
createUserProfileByJWT,
|
|
168
169
|
setShowAuthFlow,
|
|
169
170
|
setErrorMessage,
|
|
@@ -72,7 +72,7 @@ const EmailVerification = () => {
|
|
|
72
72
|
setLoading(true);
|
|
73
73
|
if (!verificationUUID || (!authToken && !onboardingOnlyJwt)) {
|
|
74
74
|
yield handleLogOut();
|
|
75
|
-
|
|
75
|
+
goToInitialView();
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
try {
|
|
@@ -100,7 +100,7 @@ const EmailVerification = () => {
|
|
|
100
100
|
authToken,
|
|
101
101
|
onboardingOnlyJwt,
|
|
102
102
|
handleLogOut,
|
|
103
|
-
|
|
103
|
+
goToInitialView,
|
|
104
104
|
verifyEmail,
|
|
105
105
|
setShowAuthFlow,
|
|
106
106
|
setOnboardingOnlyJwt,
|
|
@@ -112,7 +112,7 @@ const EmailVerification = () => {
|
|
|
112
112
|
setLoading(true);
|
|
113
113
|
if (!verificationUUID) {
|
|
114
114
|
yield handleLogOut();
|
|
115
|
-
|
|
115
|
+
goToInitialView();
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
try {
|
|
@@ -123,7 +123,7 @@ const EmailVerification = () => {
|
|
|
123
123
|
});
|
|
124
124
|
if (!jwt) {
|
|
125
125
|
yield handleLogOut();
|
|
126
|
-
|
|
126
|
+
goToInitialView();
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
129
|
const decodedJwt = decodeJwt(jwt);
|
|
@@ -156,10 +156,11 @@ const EmailVerification = () => {
|
|
|
156
156
|
setLoading,
|
|
157
157
|
verificationUUID,
|
|
158
158
|
handleLogOut,
|
|
159
|
-
|
|
159
|
+
goToInitialView,
|
|
160
160
|
environmentId,
|
|
161
161
|
setCallback,
|
|
162
162
|
setOnboardingOnlyJwt,
|
|
163
|
+
setView,
|
|
163
164
|
createUserProfileByJWT,
|
|
164
165
|
setShowAuthFlow,
|
|
165
166
|
setErrorMessage,
|
|
@@ -45,7 +45,7 @@ require('formik');
|
|
|
45
45
|
require('yup');
|
|
46
46
|
|
|
47
47
|
const WalletSignSpinnerView = () => {
|
|
48
|
-
const {
|
|
48
|
+
const { goToInitialView } = ViewContext.useViewContext();
|
|
49
49
|
const { setMultiWalletWidgetState, setSelectedWalletConnector, selectedWalletConnector: walletConnector, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
50
50
|
if (!walletConnector) {
|
|
51
51
|
return null;
|
|
@@ -53,7 +53,7 @@ const WalletSignSpinnerView = () => {
|
|
|
53
53
|
const { name } = walletConnector;
|
|
54
54
|
const iconSize = 80;
|
|
55
55
|
const handleClose = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
-
|
|
56
|
+
goToInitialView();
|
|
57
57
|
setMultiWalletWidgetState('idle');
|
|
58
58
|
setSelectedWalletConnector(null);
|
|
59
59
|
yield (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.endSession());
|
|
@@ -41,7 +41,7 @@ import 'formik';
|
|
|
41
41
|
import 'yup';
|
|
42
42
|
|
|
43
43
|
const WalletSignSpinnerView = () => {
|
|
44
|
-
const {
|
|
44
|
+
const { goToInitialView } = useViewContext();
|
|
45
45
|
const { setMultiWalletWidgetState, setSelectedWalletConnector, selectedWalletConnector: walletConnector, } = useInternalDynamicContext();
|
|
46
46
|
if (!walletConnector) {
|
|
47
47
|
return null;
|
|
@@ -49,7 +49,7 @@ const WalletSignSpinnerView = () => {
|
|
|
49
49
|
const { name } = walletConnector;
|
|
50
50
|
const iconSize = 80;
|
|
51
51
|
const handleClose = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
-
|
|
52
|
+
goToInitialView();
|
|
53
53
|
setMultiWalletWidgetState('idle');
|
|
54
54
|
setSelectedWalletConnector(null);
|
|
55
55
|
yield (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.endSession());
|
|
@@ -56,7 +56,7 @@ const WalletUsedView = () => {
|
|
|
56
56
|
const [walletAddress, setWalletAddress] = React.useState(undefined);
|
|
57
57
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
58
58
|
const { loading, setLoading } = LoadingContext.useLoadingContext();
|
|
59
|
-
const { setView } = ViewContext.useViewContext();
|
|
59
|
+
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
60
60
|
const { environmentId, displayTermsOfService, authToken, setCallback, setShowAuthFlow, setUser, appName, siweStatement, setPrimaryWalletId, primaryWallet, setMultiWalletWidgetState, connectWallet, selectedWalletConnector: walletConnector, isSingleWalletAccount, consumeNonce, handleLogOut, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
61
61
|
React.useEffect(() => {
|
|
62
62
|
const _fetchPublicAddress = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -90,7 +90,7 @@ const WalletUsedView = () => {
|
|
|
90
90
|
return;
|
|
91
91
|
const nonce = consumeNonce();
|
|
92
92
|
if (!nonce) {
|
|
93
|
-
|
|
93
|
+
goToInitialView();
|
|
94
94
|
setErrorMessage('missing-nonce');
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
@@ -52,7 +52,7 @@ const WalletUsedView = () => {
|
|
|
52
52
|
const [walletAddress, setWalletAddress] = useState(undefined);
|
|
53
53
|
const { setErrorMessage } = useErrorContext();
|
|
54
54
|
const { loading, setLoading } = useLoadingContext();
|
|
55
|
-
const { setView } = useViewContext();
|
|
55
|
+
const { setView, goToInitialView } = useViewContext();
|
|
56
56
|
const { environmentId, displayTermsOfService, authToken, setCallback, setShowAuthFlow, setUser, appName, siweStatement, setPrimaryWalletId, primaryWallet, setMultiWalletWidgetState, connectWallet, selectedWalletConnector: walletConnector, isSingleWalletAccount, consumeNonce, handleLogOut, } = useInternalDynamicContext();
|
|
57
57
|
useEffect(() => {
|
|
58
58
|
const _fetchPublicAddress = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -86,7 +86,7 @@ const WalletUsedView = () => {
|
|
|
86
86
|
return;
|
|
87
87
|
const nonce = consumeNonce();
|
|
88
88
|
if (!nonce) {
|
|
89
|
-
|
|
89
|
+
goToInitialView();
|
|
90
90
|
setErrorMessage('missing-nonce');
|
|
91
91
|
return;
|
|
92
92
|
}
|