@dynamic-labs/sdk-react-core 0.16.7 → 0.16.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +4 -4
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs +19 -17
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.d.ts +6 -8
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js +19 -17
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +24 -26
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +24 -26
- package/src/lib/views/CollectUserDataView/UserDataForm/UserDataForm.cjs +4 -2
- package/src/lib/views/CollectUserDataView/UserDataForm/UserDataForm.js +4 -2
- package/src/lib/views/EmailVerification/EmailVerification.cjs +2 -0
- package/src/lib/views/EmailVerification/EmailVerification.js +2 -0
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +3 -10
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +3 -10
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +5 -10
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +5 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
### [0.16.8](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.7...v0.16.8) (2023-04-25)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* trigger onAuthSuccess on additional flows ([#1953](https://github.com/dynamic-labs/DynamicAuth/issues/1953)) ([#1954](https://github.com/dynamic-labs/DynamicAuth/issues/1954)) ([ddabbdb](https://github.com/dynamic-labs/DynamicAuth/commit/ddabbdb1a5fc3b9a7edafae76b73062c6845c609))
|
|
8
|
+
|
|
2
9
|
### [0.16.7](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.6...v0.16.7) (2023-04-24)
|
|
3
10
|
|
|
4
11
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"formik": "^2.2.9",
|
|
18
18
|
"qrcode": "1.5.1",
|
|
19
19
|
"ethers": "^5.7.2",
|
|
20
|
-
"@dynamic-labs/logger": "0.16.
|
|
21
|
-
"@dynamic-labs/multi-wallet": "0.16.
|
|
22
|
-
"@dynamic-labs/wallet-connector-core": "0.16.
|
|
20
|
+
"@dynamic-labs/logger": "0.16.8",
|
|
21
|
+
"@dynamic-labs/multi-wallet": "0.16.8",
|
|
22
|
+
"@dynamic-labs/wallet-connector-core": "0.16.8"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"semver": "^7.3.8"
|
|
@@ -32,7 +32,23 @@ const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
|
|
|
32
32
|
const { verifyEmail: verifyEmailFn } = useEmailVerificationRequest.useEmailVerificationRequest();
|
|
33
33
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
|
|
34
34
|
const updateUser = React.useCallback((userFields, userEnvironmentId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
-
|
|
35
|
+
const handleEmailVerification = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
setEmail((_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.email);
|
|
38
|
+
setVerificationUUID((_b = updateUserProfileResponse.emailVerification) === null || _b === void 0 ? void 0 : _b.verificationUUID);
|
|
39
|
+
// DYN-2046 - Customers have the opportunity to programmatically use our email verification and profile editing.
|
|
40
|
+
// VerifyEmailFN was scoped to bypass the problem with memoization of the state at the beginning of Promise.
|
|
41
|
+
// setEmail and setVerificationUUID in the above lines will are not visible in this promise.
|
|
42
|
+
const scopedVerifyEmailFn = (verificationToken) => {
|
|
43
|
+
var _a;
|
|
44
|
+
return verifyEmailFn(verificationToken, (_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.verificationUUID);
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
isEmailVerificationRequired: _isEmailVerificationRequired,
|
|
48
|
+
updateUserProfileResponse,
|
|
49
|
+
verifyEmailFn: scopedVerifyEmailFn,
|
|
50
|
+
};
|
|
51
|
+
});
|
|
36
52
|
const validatedUserFields = yield userFieldsSchema.validate(userFields, {
|
|
37
53
|
stripUnknown: validationSchemaStripUnknown,
|
|
38
54
|
});
|
|
@@ -42,25 +58,11 @@ const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
|
|
|
42
58
|
// If email verification is not needed then we can update the user profile immediately.
|
|
43
59
|
updateUserProfileByJWT(updateUserProfileResponse.jwt);
|
|
44
60
|
return {
|
|
45
|
-
isEmailVerificationRequired:
|
|
61
|
+
isEmailVerificationRequired: false,
|
|
46
62
|
updateUserProfileResponse,
|
|
47
63
|
};
|
|
48
64
|
}
|
|
49
|
-
|
|
50
|
-
setEmail((_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.email);
|
|
51
|
-
setVerificationUUID((_b = updateUserProfileResponse.emailVerification) === null || _b === void 0 ? void 0 : _b.verificationUUID);
|
|
52
|
-
// DYN-2046 - Customers have the opportunity to programmatically use our email verification and profile editing.
|
|
53
|
-
// VerifyEmailFN was scoped to bypass the problem with memoization of the state at the beginning of Promise.
|
|
54
|
-
// setEmail and setVerificationUUID in the above lines will are not visible in this promise.
|
|
55
|
-
const scopedVerifyEmailFn = (verificationToken) => {
|
|
56
|
-
var _a;
|
|
57
|
-
return verifyEmailFn(verificationToken, (_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.verificationUUID);
|
|
58
|
-
};
|
|
59
|
-
return {
|
|
60
|
-
isEmailVerificationRequired: _isEmailVerificationRequired,
|
|
61
|
-
updateUserProfileResponse,
|
|
62
|
-
verifyEmailFn: scopedVerifyEmailFn,
|
|
63
|
-
};
|
|
65
|
+
return handleEmailVerification();
|
|
64
66
|
}), [
|
|
65
67
|
environmentId,
|
|
66
68
|
jwtToken,
|
|
@@ -4,23 +4,21 @@ export declare const useUserUpdateRequestInternal: ({ validationSchemaStripUnkno
|
|
|
4
4
|
validationSchemaStripUnknown: boolean;
|
|
5
5
|
}) => {
|
|
6
6
|
updateUser: (userFields: UpdateUserFieldsArg, userEnvironmentId?: string) => Promise<{
|
|
7
|
-
isEmailVerificationRequired:
|
|
7
|
+
isEmailVerificationRequired: boolean;
|
|
8
8
|
updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
|
|
9
|
-
verifyEmailFn
|
|
9
|
+
verifyEmailFn: (verificationToken: string) => Promise<import("@dynamic-labs/sdk-api").UpdateSelfResponse>;
|
|
10
10
|
} | {
|
|
11
|
-
isEmailVerificationRequired:
|
|
11
|
+
isEmailVerificationRequired: boolean;
|
|
12
12
|
updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
|
|
13
|
-
verifyEmailFn: (verificationToken: string) => Promise<import("@dynamic-labs/sdk-api").UpdateSelfResponse>;
|
|
14
13
|
}>;
|
|
15
14
|
};
|
|
16
15
|
export declare const useUserUpdateRequest: () => {
|
|
17
16
|
updateUser: (userFields: UpdateUserFieldsArg, userEnvironmentId?: string) => Promise<{
|
|
18
|
-
isEmailVerificationRequired:
|
|
17
|
+
isEmailVerificationRequired: boolean;
|
|
19
18
|
updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
|
|
20
|
-
verifyEmailFn
|
|
19
|
+
verifyEmailFn: (verificationToken: string) => Promise<import("@dynamic-labs/sdk-api").UpdateSelfResponse>;
|
|
21
20
|
} | {
|
|
22
|
-
isEmailVerificationRequired:
|
|
21
|
+
isEmailVerificationRequired: boolean;
|
|
23
22
|
updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
|
|
24
|
-
verifyEmailFn: (verificationToken: string) => Promise<import("@dynamic-labs/sdk-api").UpdateSelfResponse>;
|
|
25
23
|
}>;
|
|
26
24
|
};
|
|
@@ -28,7 +28,23 @@ const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
|
|
|
28
28
|
const { verifyEmail: verifyEmailFn } = useEmailVerificationRequest();
|
|
29
29
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
30
30
|
const updateUser = useCallback((userFields, userEnvironmentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
-
|
|
31
|
+
const handleEmailVerification = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
setEmail((_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.email);
|
|
34
|
+
setVerificationUUID((_b = updateUserProfileResponse.emailVerification) === null || _b === void 0 ? void 0 : _b.verificationUUID);
|
|
35
|
+
// DYN-2046 - Customers have the opportunity to programmatically use our email verification and profile editing.
|
|
36
|
+
// VerifyEmailFN was scoped to bypass the problem with memoization of the state at the beginning of Promise.
|
|
37
|
+
// setEmail and setVerificationUUID in the above lines will are not visible in this promise.
|
|
38
|
+
const scopedVerifyEmailFn = (verificationToken) => {
|
|
39
|
+
var _a;
|
|
40
|
+
return verifyEmailFn(verificationToken, (_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.verificationUUID);
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
isEmailVerificationRequired: _isEmailVerificationRequired,
|
|
44
|
+
updateUserProfileResponse,
|
|
45
|
+
verifyEmailFn: scopedVerifyEmailFn,
|
|
46
|
+
};
|
|
47
|
+
});
|
|
32
48
|
const validatedUserFields = yield userFieldsSchema.validate(userFields, {
|
|
33
49
|
stripUnknown: validationSchemaStripUnknown,
|
|
34
50
|
});
|
|
@@ -38,25 +54,11 @@ const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
|
|
|
38
54
|
// If email verification is not needed then we can update the user profile immediately.
|
|
39
55
|
updateUserProfileByJWT(updateUserProfileResponse.jwt);
|
|
40
56
|
return {
|
|
41
|
-
isEmailVerificationRequired:
|
|
57
|
+
isEmailVerificationRequired: false,
|
|
42
58
|
updateUserProfileResponse,
|
|
43
59
|
};
|
|
44
60
|
}
|
|
45
|
-
|
|
46
|
-
setEmail((_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.email);
|
|
47
|
-
setVerificationUUID((_b = updateUserProfileResponse.emailVerification) === null || _b === void 0 ? void 0 : _b.verificationUUID);
|
|
48
|
-
// DYN-2046 - Customers have the opportunity to programmatically use our email verification and profile editing.
|
|
49
|
-
// VerifyEmailFN was scoped to bypass the problem with memoization of the state at the beginning of Promise.
|
|
50
|
-
// setEmail and setVerificationUUID in the above lines will are not visible in this promise.
|
|
51
|
-
const scopedVerifyEmailFn = (verificationToken) => {
|
|
52
|
-
var _a;
|
|
53
|
-
return verifyEmailFn(verificationToken, (_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.verificationUUID);
|
|
54
|
-
};
|
|
55
|
-
return {
|
|
56
|
-
isEmailVerificationRequired: _isEmailVerificationRequired,
|
|
57
|
-
updateUserProfileResponse,
|
|
58
|
-
verifyEmailFn: scopedVerifyEmailFn,
|
|
59
|
-
};
|
|
61
|
+
return handleEmailVerification();
|
|
60
62
|
}), [
|
|
61
63
|
environmentId,
|
|
62
64
|
jwtToken,
|
|
@@ -29,7 +29,7 @@ require('../../../shared/consts/index.cjs');
|
|
|
29
29
|
// This logic is used to both verify or link a wallet
|
|
30
30
|
// Since we are re-using the different screens to authenticate or link the wallet.
|
|
31
31
|
// This logic is the best place to determine whether we should verify or verify and link.
|
|
32
|
-
const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId,
|
|
32
|
+
const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, setIsSingleWalletAccount, }) => {
|
|
33
33
|
const { setView } = ViewContext.useViewContext();
|
|
34
34
|
const { setErrorMessage, setError } = ErrorContext.useErrorContext();
|
|
35
35
|
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, loginWithEmail, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -58,20 +58,20 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
58
58
|
else {
|
|
59
59
|
Jwt = yield api.linkWallet(environmentId, verifyArgs, authToken);
|
|
60
60
|
}
|
|
61
|
-
if (Jwt === undefined)
|
|
61
|
+
if (Jwt === undefined) {
|
|
62
62
|
throw new multiWallet.DynamicError('Could not obtain a valid JWT');
|
|
63
|
-
|
|
63
|
+
}
|
|
64
64
|
return Jwt;
|
|
65
65
|
});
|
|
66
66
|
// Overrides the stored primary wallet id when the
|
|
67
67
|
// user logs in for the first time.
|
|
68
68
|
// Or when the user is linking an additional
|
|
69
69
|
// account on the same wallet as the primary wallet.
|
|
70
|
-
const updatePrimaryWalletId = (walletConnector,
|
|
71
|
-
const newSelectedCredentialWallet =
|
|
70
|
+
const updatePrimaryWalletId = (walletConnector, decodedJwt) => {
|
|
71
|
+
const newSelectedCredentialWallet = decodedJwt.verifiedCredentials.find((cred) => cred.id === decodedJwt.lastVerifiedCredentialId &&
|
|
72
72
|
cred.format === 'blockchain');
|
|
73
73
|
if (newSelectedCredentialWallet) {
|
|
74
|
-
const currentPrimaryWallet =
|
|
74
|
+
const currentPrimaryWallet = decodedJwt.verifiedCredentials.find((a) => a.id === primaryWalletId);
|
|
75
75
|
if (verifyOnly ||
|
|
76
76
|
primaryWalletId === undefined ||
|
|
77
77
|
(multiWalletWidgetState === 'awaiting_signature' &&
|
|
@@ -129,31 +129,18 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
129
129
|
const decodedJwt = decodeJwt.decodeJwt(Jwt);
|
|
130
130
|
if (decodedJwt === undefined)
|
|
131
131
|
throw new multiWallet.DynamicError('Invalid token!');
|
|
132
|
-
const user = yield createUserProfile.createUserProfile(decodedJwt);
|
|
133
|
-
const isKycRequired = decodedJwt.missingFields.length;
|
|
134
|
-
setOnboardingOnlyJwt(Jwt);
|
|
135
132
|
setToLS.setToLS(localStorage.LAST_USED_WALLET, walletConnector.name);
|
|
136
|
-
updatePrimaryWalletId(walletConnector,
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
!_isSupportedNetwork &&
|
|
141
|
-
!isKycRequired) {
|
|
142
|
-
const _isProgrammableNetworkSwitchSupported = isProgrammableNetworkSwitchSupported.isProgrammableNetworkSwitchSupported(walletConnector);
|
|
143
|
-
if (_isProgrammableNetworkSwitchSupported) {
|
|
144
|
-
return setView('network-not-supported');
|
|
145
|
-
}
|
|
146
|
-
return setView('network-not-supported-manual');
|
|
147
|
-
}
|
|
148
|
-
// TODO: how can projectSettings be undefined?
|
|
149
|
-
if (verifyOnly && projectSettings && isKycRequired) {
|
|
133
|
+
updatePrimaryWalletId(walletConnector, decodedJwt);
|
|
134
|
+
const isKycRequired = decodedJwt.missingFields.length;
|
|
135
|
+
if (verifyOnly && isKycRequired) {
|
|
136
|
+
setOnboardingOnlyJwt(Jwt);
|
|
150
137
|
setShowAuthFlow(true);
|
|
151
|
-
|
|
138
|
+
setView('collect-user-data');
|
|
139
|
+
return;
|
|
152
140
|
}
|
|
141
|
+
const user = yield createUserProfile.createUserProfile(decodedJwt);
|
|
153
142
|
index.storeAuthToken(Jwt);
|
|
154
|
-
setOnboardingOnlyJwt(undefined);
|
|
155
143
|
setUser(user); // The user should only be set if no KYC is needed.
|
|
156
|
-
setShowAuthFlow(false);
|
|
157
144
|
/* istanbul ignore else */
|
|
158
145
|
if (verifyOnly) {
|
|
159
146
|
setCallback('authSuccess');
|
|
@@ -161,6 +148,17 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
161
148
|
else {
|
|
162
149
|
setCallback('linkSuccess');
|
|
163
150
|
}
|
|
151
|
+
// Routes user to "Not Supported Network" screen if the user is not on the supported network
|
|
152
|
+
if (!_isSupportedNetwork) {
|
|
153
|
+
if (isProgrammableNetworkSwitchSupported.isProgrammableNetworkSwitchSupported(walletConnector)) {
|
|
154
|
+
setView('network-not-supported');
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
setView('network-not-supported-manual');
|
|
158
|
+
}
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
setShowAuthFlow(false);
|
|
164
162
|
}
|
|
165
163
|
catch (e) {
|
|
166
164
|
handleError(e, walletConnector);
|
|
@@ -5,5 +5,5 @@ type UseVerifyWalletArgs = VerifyProps & ProjectSettingsProps & {
|
|
|
5
5
|
displayTermsOfService: boolean;
|
|
6
6
|
setIsSingleWalletAccount: Dispatch<SetStateAction<boolean>>;
|
|
7
7
|
};
|
|
8
|
-
export declare const useVerifyWallet: ({ consumeNonce, displayTermsOfService, environmentId,
|
|
8
|
+
export declare const useVerifyWallet: ({ consumeNonce, displayTermsOfService, environmentId, setIsSingleWalletAccount, }: UseVerifyWalletArgs) => ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, }: VerifyCallbackArgs) => Promise<void>;
|
|
9
9
|
export {};
|
|
@@ -25,7 +25,7 @@ import '../../../shared/consts/index.js';
|
|
|
25
25
|
// This logic is used to both verify or link a wallet
|
|
26
26
|
// Since we are re-using the different screens to authenticate or link the wallet.
|
|
27
27
|
// This logic is the best place to determine whether we should verify or verify and link.
|
|
28
|
-
const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId,
|
|
28
|
+
const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, setIsSingleWalletAccount, }) => {
|
|
29
29
|
const { setView } = useViewContext();
|
|
30
30
|
const { setErrorMessage, setError } = useErrorContext();
|
|
31
31
|
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, loginWithEmail, } = useInternalDynamicContext();
|
|
@@ -54,20 +54,20 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
54
54
|
else {
|
|
55
55
|
Jwt = yield linkWallet(environmentId, verifyArgs, authToken);
|
|
56
56
|
}
|
|
57
|
-
if (Jwt === undefined)
|
|
57
|
+
if (Jwt === undefined) {
|
|
58
58
|
throw new DynamicError('Could not obtain a valid JWT');
|
|
59
|
-
|
|
59
|
+
}
|
|
60
60
|
return Jwt;
|
|
61
61
|
});
|
|
62
62
|
// Overrides the stored primary wallet id when the
|
|
63
63
|
// user logs in for the first time.
|
|
64
64
|
// Or when the user is linking an additional
|
|
65
65
|
// account on the same wallet as the primary wallet.
|
|
66
|
-
const updatePrimaryWalletId = (walletConnector,
|
|
67
|
-
const newSelectedCredentialWallet =
|
|
66
|
+
const updatePrimaryWalletId = (walletConnector, decodedJwt) => {
|
|
67
|
+
const newSelectedCredentialWallet = decodedJwt.verifiedCredentials.find((cred) => cred.id === decodedJwt.lastVerifiedCredentialId &&
|
|
68
68
|
cred.format === 'blockchain');
|
|
69
69
|
if (newSelectedCredentialWallet) {
|
|
70
|
-
const currentPrimaryWallet =
|
|
70
|
+
const currentPrimaryWallet = decodedJwt.verifiedCredentials.find((a) => a.id === primaryWalletId);
|
|
71
71
|
if (verifyOnly ||
|
|
72
72
|
primaryWalletId === undefined ||
|
|
73
73
|
(multiWalletWidgetState === 'awaiting_signature' &&
|
|
@@ -125,31 +125,18 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
125
125
|
const decodedJwt = decodeJwt(Jwt);
|
|
126
126
|
if (decodedJwt === undefined)
|
|
127
127
|
throw new DynamicError('Invalid token!');
|
|
128
|
-
const user = yield createUserProfile(decodedJwt);
|
|
129
|
-
const isKycRequired = decodedJwt.missingFields.length;
|
|
130
|
-
setOnboardingOnlyJwt(Jwt);
|
|
131
128
|
setToLS(LAST_USED_WALLET, walletConnector.name);
|
|
132
|
-
updatePrimaryWalletId(walletConnector,
|
|
133
|
-
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
!_isSupportedNetwork &&
|
|
137
|
-
!isKycRequired) {
|
|
138
|
-
const _isProgrammableNetworkSwitchSupported = isProgrammableNetworkSwitchSupported(walletConnector);
|
|
139
|
-
if (_isProgrammableNetworkSwitchSupported) {
|
|
140
|
-
return setView('network-not-supported');
|
|
141
|
-
}
|
|
142
|
-
return setView('network-not-supported-manual');
|
|
143
|
-
}
|
|
144
|
-
// TODO: how can projectSettings be undefined?
|
|
145
|
-
if (verifyOnly && projectSettings && isKycRequired) {
|
|
129
|
+
updatePrimaryWalletId(walletConnector, decodedJwt);
|
|
130
|
+
const isKycRequired = decodedJwt.missingFields.length;
|
|
131
|
+
if (verifyOnly && isKycRequired) {
|
|
132
|
+
setOnboardingOnlyJwt(Jwt);
|
|
146
133
|
setShowAuthFlow(true);
|
|
147
|
-
|
|
134
|
+
setView('collect-user-data');
|
|
135
|
+
return;
|
|
148
136
|
}
|
|
137
|
+
const user = yield createUserProfile(decodedJwt);
|
|
149
138
|
storeAuthToken(Jwt);
|
|
150
|
-
setOnboardingOnlyJwt(undefined);
|
|
151
139
|
setUser(user); // The user should only be set if no KYC is needed.
|
|
152
|
-
setShowAuthFlow(false);
|
|
153
140
|
/* istanbul ignore else */
|
|
154
141
|
if (verifyOnly) {
|
|
155
142
|
setCallback('authSuccess');
|
|
@@ -157,6 +144,17 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
157
144
|
else {
|
|
158
145
|
setCallback('linkSuccess');
|
|
159
146
|
}
|
|
147
|
+
// Routes user to "Not Supported Network" screen if the user is not on the supported network
|
|
148
|
+
if (!_isSupportedNetwork) {
|
|
149
|
+
if (isProgrammableNetworkSwitchSupported(walletConnector)) {
|
|
150
|
+
setView('network-not-supported');
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
setView('network-not-supported-manual');
|
|
154
|
+
}
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
setShowAuthFlow(false);
|
|
160
158
|
}
|
|
161
159
|
catch (e) {
|
|
162
160
|
handleError(e, walletConnector);
|
|
@@ -33,8 +33,9 @@ require('../../../components/IconButton/IconButton.cjs');
|
|
|
33
33
|
var index = require('../UserDataFields/index.cjs');
|
|
34
34
|
var useUserDataForm = require('../../../utils/hooks/useUserDataForm/useUserDataForm.cjs');
|
|
35
35
|
|
|
36
|
+
// TODO rename to OnboardingUserDataForm
|
|
36
37
|
const UserDataForm = ({ children, userProfile }) => {
|
|
37
|
-
const { policiesConsentInnerComponent, onboardingOnlyJwt, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
38
|
+
const { policiesConsentInnerComponent, onboardingOnlyJwt, setShowAuthFlow, setCallback, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
38
39
|
const { setView } = ViewContext.useViewContext();
|
|
39
40
|
const decodedJwt = decodeJwt.decodeJwt(onboardingOnlyJwt);
|
|
40
41
|
const { updateUser } = useUserUpdateRequest.useUserUpdateRequestInternal({
|
|
@@ -46,8 +47,9 @@ const UserDataForm = ({ children, userProfile }) => {
|
|
|
46
47
|
setView('verify-email');
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
50
|
+
setCallback('authSuccess');
|
|
49
51
|
setShowAuthFlow(false);
|
|
50
|
-
}), [setShowAuthFlow, setView, updateUser]);
|
|
52
|
+
}), [setCallback, setShowAuthFlow, setView, updateUser]);
|
|
51
53
|
const { fetch: loading, formikInitialValues, formikValidationSchema, enforcePolicies, onFormSubmit, } = useUserDataForm.useUserDataForm({
|
|
52
54
|
fields: (decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) || [],
|
|
53
55
|
onSubmit,
|
|
@@ -29,8 +29,9 @@ import '../../../components/IconButton/IconButton.js';
|
|
|
29
29
|
import { UserDataFields } from '../UserDataFields/index.js';
|
|
30
30
|
import { useUserDataForm } from '../../../utils/hooks/useUserDataForm/useUserDataForm.js';
|
|
31
31
|
|
|
32
|
+
// TODO rename to OnboardingUserDataForm
|
|
32
33
|
const UserDataForm = ({ children, userProfile }) => {
|
|
33
|
-
const { policiesConsentInnerComponent, onboardingOnlyJwt, setShowAuthFlow } = useInternalDynamicContext();
|
|
34
|
+
const { policiesConsentInnerComponent, onboardingOnlyJwt, setShowAuthFlow, setCallback, } = useInternalDynamicContext();
|
|
34
35
|
const { setView } = useViewContext();
|
|
35
36
|
const decodedJwt = decodeJwt(onboardingOnlyJwt);
|
|
36
37
|
const { updateUser } = useUserUpdateRequestInternal({
|
|
@@ -42,8 +43,9 @@ const UserDataForm = ({ children, userProfile }) => {
|
|
|
42
43
|
setView('verify-email');
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
46
|
+
setCallback('authSuccess');
|
|
45
47
|
setShowAuthFlow(false);
|
|
46
|
-
}), [setShowAuthFlow, setView, updateUser]);
|
|
48
|
+
}), [setCallback, setShowAuthFlow, setView, updateUser]);
|
|
47
49
|
const { fetch: loading, formikInitialValues, formikValidationSchema, enforcePolicies, onFormSubmit, } = useUserDataForm({
|
|
48
50
|
fields: (decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) || [],
|
|
49
51
|
onSubmit,
|
|
@@ -71,6 +71,7 @@ const EmailVerification = () => {
|
|
|
71
71
|
const { nextView } = yield verifyEmail(verificationToken, verificationUUID);
|
|
72
72
|
if (onboardingOnlyJwt) {
|
|
73
73
|
setOnboardingOnlyJwt(undefined);
|
|
74
|
+
setCallback('authSuccess');
|
|
74
75
|
}
|
|
75
76
|
setIsValidated(true);
|
|
76
77
|
if (nextView === 'verified-and-transferred') {
|
|
@@ -85,6 +86,7 @@ const EmailVerification = () => {
|
|
|
85
86
|
setLoading(false);
|
|
86
87
|
}
|
|
87
88
|
}), [
|
|
89
|
+
setCallback,
|
|
88
90
|
setError,
|
|
89
91
|
setLoading,
|
|
90
92
|
verificationUUID,
|
|
@@ -67,6 +67,7 @@ const EmailVerification = () => {
|
|
|
67
67
|
const { nextView } = yield verifyEmail(verificationToken, verificationUUID);
|
|
68
68
|
if (onboardingOnlyJwt) {
|
|
69
69
|
setOnboardingOnlyJwt(undefined);
|
|
70
|
+
setCallback('authSuccess');
|
|
70
71
|
}
|
|
71
72
|
setIsValidated(true);
|
|
72
73
|
if (nextView === 'verified-and-transferred') {
|
|
@@ -81,6 +82,7 @@ const EmailVerification = () => {
|
|
|
81
82
|
setLoading(false);
|
|
82
83
|
}
|
|
83
84
|
}), [
|
|
85
|
+
setCallback,
|
|
84
86
|
setError,
|
|
85
87
|
setLoading,
|
|
86
88
|
verificationUUID,
|
|
@@ -14,7 +14,6 @@ require('../../context/ViewContext/ViewContext.cjs');
|
|
|
14
14
|
require('../../utils/constants/colors.cjs');
|
|
15
15
|
require('../../shared/consts/index.cjs');
|
|
16
16
|
var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
17
|
-
var createUserProfile = require('../../utils/functions/createUserProfile/createUserProfile.cjs');
|
|
18
17
|
var isSupportedNetwork = require('../../utils/functions/isSupportedNetwork/isSupportedNetwork.cjs');
|
|
19
18
|
var pixelToRem = require('../../utils/functions/pixelToRem/pixelToRem.cjs');
|
|
20
19
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
@@ -36,26 +35,20 @@ require('../../components/IconButton/IconButton.cjs');
|
|
|
36
35
|
var ErrorContainer = require('../../components/ErrorContainer/ErrorContainer.cjs');
|
|
37
36
|
var NetworkPicker = require('../../components/NetworkPicker/NetworkPicker.cjs');
|
|
38
37
|
var UserAddress = require('../../components/UserAddress/UserAddress.cjs');
|
|
39
|
-
var useUpdateUserProfileByJWTCallback = require('../../utils/hooks/useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.cjs');
|
|
40
38
|
|
|
41
39
|
const NetworkNotSupported = () => {
|
|
42
40
|
var _a, _b;
|
|
43
|
-
const { handleLogOut,
|
|
44
|
-
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
|
|
41
|
+
const { handleLogOut, network, onboardingImageUrl, selectedWalletConnector: walletConnector, setShowAuthFlow, user, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
45
42
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = React.useState(false);
|
|
46
|
-
if (!
|
|
43
|
+
if (!walletConnector) {
|
|
47
44
|
return null;
|
|
48
45
|
}
|
|
49
46
|
const onSubmit = () => {
|
|
50
|
-
if (!onboardingOnlyJwt)
|
|
51
|
-
return;
|
|
52
|
-
updateUserProfileByJWT(onboardingOnlyJwt);
|
|
53
47
|
setShowAuthFlow(false);
|
|
54
48
|
};
|
|
55
|
-
const userProfile = createUserProfile.createUserProfile(decodedOnboardingOnlyToken);
|
|
56
49
|
const evmNetworks = walletConnector.evmNetworks || [];
|
|
57
50
|
const _isSupportedNetwork = isSupportedNetwork.isSupportedNetwork({ network, walletConnector });
|
|
58
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: 'network-not-supported', "data-testid": 'network-not-supported' }, { children: [onboardingImageUrl && (jsxRuntime.jsx("img", { className: 'network-not-supported__main-img', src: onboardingImageUrl, alt: 'onboarding' })), !_isSupportedNetwork && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, Object.assign({ withIcon: false, className: 'network-not-supported__error--not-supported' }, { children: "This network is not available, please update." }))), jsxRuntime.jsxs("div", Object.assign({ className: 'network-not-supported__content-container' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'network-not-supported__img-container' }, { children: ((_a =
|
|
51
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: 'network-not-supported', "data-testid": 'network-not-supported' }, { children: [onboardingImageUrl && (jsxRuntime.jsx("img", { className: 'network-not-supported__main-img', src: onboardingImageUrl, alt: 'onboarding' })), !_isSupportedNetwork && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, Object.assign({ withIcon: false, className: 'network-not-supported__error--not-supported' }, { children: "This network is not available, please update." }))), jsxRuntime.jsxs("div", Object.assign({ className: 'network-not-supported__content-container' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'network-not-supported__img-container' }, { children: ((_a = user === null || user === void 0 ? void 0 : user.ens) === null || _a === void 0 ? void 0 : _a.avatar) ? (jsxRuntime.jsx("div", Object.assign({ className: 'network-not-supported__network-container' }, { children: jsxRuntime.jsx("img", { src: (_b = user === null || user === void 0 ? void 0 : user.ens) === null || _b === void 0 ? void 0 : _b.avatar, alt: 'user ens avatar', className: 'network-not-supported__img' }) }))) : (jsxRuntime.jsx("div", Object.assign({ className: 'network-not-supported__network-container' }, { children: jsxRuntime.jsx(walletBook.WalletIcon, { walletName: walletConnector.name, style: { height: pixelToRem.pixelToRem(64), width: pixelToRem.pixelToRem(64) } }) }))) })), jsxRuntime.jsx(UserAddress.UserAddress, { userProfile: user }), jsxRuntime.jsx("div", Object.assign({ className: 'network-not-supported__network-container' }, { children: jsxRuntime.jsx(NetworkPicker.NetworkPicker, { evmNetworks: evmNetworks, connector: walletConnector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, showNetworkName: true, buttonClassName: 'network-not-supported__network-picker-button', mainClassName: 'network-not-supported__network-picker' }) })), jsxRuntime.jsxs("div", Object.assign({ className: 'network-not-supported__welcome-container' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'title', color: 'primary', className: 'network-not-supported__welcome-title' }, { children: "Update Network" })), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary' }, { children: "Your wallet is not connected to a supported network. Please update before continuing." })), jsxRuntime.jsx(Button.Button, Object.assign({ type: 'submit', buttonVariant: 'primary', expanded: true, buttonRounded: 'default', buttonPadding: 'large', disabled: !_isSupportedNetwork, onClick: onSubmit, buttonClassName: 'network-not-supported__continue' }, { children: "Continue" })), jsxRuntime.jsx(TextButton.TextButton, Object.assign({ className: 'network-not-supported__log-out', onClick: () => handleLogOut() }, { children: "Log out" }))] }))] }))] })));
|
|
59
52
|
};
|
|
60
53
|
|
|
61
54
|
exports.NetworkNotSupported = NetworkNotSupported;
|
|
@@ -10,7 +10,6 @@ import '../../context/ViewContext/ViewContext.js';
|
|
|
10
10
|
import '../../utils/constants/colors.js';
|
|
11
11
|
import '../../shared/consts/index.js';
|
|
12
12
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
|
|
13
|
-
import { createUserProfile } from '../../utils/functions/createUserProfile/createUserProfile.js';
|
|
14
13
|
import { isSupportedNetwork } from '../../utils/functions/isSupportedNetwork/isSupportedNetwork.js';
|
|
15
14
|
import { pixelToRem } from '../../utils/functions/pixelToRem/pixelToRem.js';
|
|
16
15
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
@@ -32,26 +31,20 @@ import '../../components/IconButton/IconButton.js';
|
|
|
32
31
|
import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.js';
|
|
33
32
|
import { NetworkPicker } from '../../components/NetworkPicker/NetworkPicker.js';
|
|
34
33
|
import { UserAddress } from '../../components/UserAddress/UserAddress.js';
|
|
35
|
-
import { useUpdateUserProfileByJWTCallback } from '../../utils/hooks/useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.js';
|
|
36
34
|
|
|
37
35
|
const NetworkNotSupported = () => {
|
|
38
36
|
var _a, _b;
|
|
39
|
-
const { handleLogOut,
|
|
40
|
-
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
37
|
+
const { handleLogOut, network, onboardingImageUrl, selectedWalletConnector: walletConnector, setShowAuthFlow, user, } = useInternalDynamicContext();
|
|
41
38
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = useState(false);
|
|
42
|
-
if (!
|
|
39
|
+
if (!walletConnector) {
|
|
43
40
|
return null;
|
|
44
41
|
}
|
|
45
42
|
const onSubmit = () => {
|
|
46
|
-
if (!onboardingOnlyJwt)
|
|
47
|
-
return;
|
|
48
|
-
updateUserProfileByJWT(onboardingOnlyJwt);
|
|
49
43
|
setShowAuthFlow(false);
|
|
50
44
|
};
|
|
51
|
-
const userProfile = createUserProfile(decodedOnboardingOnlyToken);
|
|
52
45
|
const evmNetworks = walletConnector.evmNetworks || [];
|
|
53
46
|
const _isSupportedNetwork = isSupportedNetwork({ network, walletConnector });
|
|
54
|
-
return (jsxs("div", Object.assign({ className: 'network-not-supported', "data-testid": 'network-not-supported' }, { children: [onboardingImageUrl && (jsx("img", { className: 'network-not-supported__main-img', src: onboardingImageUrl, alt: 'onboarding' })), !_isSupportedNetwork && (jsx(ErrorContainer, Object.assign({ withIcon: false, className: 'network-not-supported__error--not-supported' }, { children: "This network is not available, please update." }))), jsxs("div", Object.assign({ className: 'network-not-supported__content-container' }, { children: [jsx("div", Object.assign({ className: 'network-not-supported__img-container' }, { children: ((_a =
|
|
47
|
+
return (jsxs("div", Object.assign({ className: 'network-not-supported', "data-testid": 'network-not-supported' }, { children: [onboardingImageUrl && (jsx("img", { className: 'network-not-supported__main-img', src: onboardingImageUrl, alt: 'onboarding' })), !_isSupportedNetwork && (jsx(ErrorContainer, Object.assign({ withIcon: false, className: 'network-not-supported__error--not-supported' }, { children: "This network is not available, please update." }))), jsxs("div", Object.assign({ className: 'network-not-supported__content-container' }, { children: [jsx("div", Object.assign({ className: 'network-not-supported__img-container' }, { children: ((_a = user === null || user === void 0 ? void 0 : user.ens) === null || _a === void 0 ? void 0 : _a.avatar) ? (jsx("div", Object.assign({ className: 'network-not-supported__network-container' }, { children: jsx("img", { src: (_b = user === null || user === void 0 ? void 0 : user.ens) === null || _b === void 0 ? void 0 : _b.avatar, alt: 'user ens avatar', className: 'network-not-supported__img' }) }))) : (jsx("div", Object.assign({ className: 'network-not-supported__network-container' }, { children: jsx(WalletIcon, { walletName: walletConnector.name, style: { height: pixelToRem(64), width: pixelToRem(64) } }) }))) })), jsx(UserAddress, { userProfile: user }), jsx("div", Object.assign({ className: 'network-not-supported__network-container' }, { children: jsx(NetworkPicker, { evmNetworks: evmNetworks, connector: walletConnector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, showNetworkName: true, buttonClassName: 'network-not-supported__network-picker-button', mainClassName: 'network-not-supported__network-picker' }) })), jsxs("div", Object.assign({ className: 'network-not-supported__welcome-container' }, { children: [jsx(Typography, Object.assign({ variant: 'title', color: 'primary', className: 'network-not-supported__welcome-title' }, { children: "Update Network" })), jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary' }, { children: "Your wallet is not connected to a supported network. Please update before continuing." })), jsx(Button, Object.assign({ type: 'submit', buttonVariant: 'primary', expanded: true, buttonRounded: 'default', buttonPadding: 'large', disabled: !_isSupportedNetwork, onClick: onSubmit, buttonClassName: 'network-not-supported__continue' }, { children: "Continue" })), jsx(TextButton, Object.assign({ className: 'network-not-supported__log-out', onClick: () => handleLogOut() }, { children: "Log out" }))] }))] }))] })));
|
|
55
48
|
};
|
|
56
49
|
|
|
57
50
|
export { NetworkNotSupported };
|
|
@@ -31,14 +31,12 @@ require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
|
31
31
|
require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
32
32
|
require('../../components/IconButton/IconButton.cjs');
|
|
33
33
|
var IconWithSpinner = require('../../components/IconWithSpinner/IconWithSpinner.cjs');
|
|
34
|
-
var useUpdateUserProfileByJWTCallback = require('../../utils/hooks/useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.cjs');
|
|
35
34
|
|
|
36
35
|
// The component notifies the user about the required manual network change,
|
|
37
36
|
// as the wallet does not support programmatic network change.
|
|
38
37
|
const NetworkNotSupportedSwitchManual = () => {
|
|
39
38
|
var _a, _b;
|
|
40
|
-
const { user, network,
|
|
41
|
-
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
|
|
39
|
+
const { user, network, selectedWalletConnector: walletConnector, setShowAuthFlow, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
42
40
|
// Listen for network changes
|
|
43
41
|
React.useEffect(() => {
|
|
44
42
|
if (!walletConnector)
|
|
@@ -49,14 +47,11 @@ const NetworkNotSupportedSwitchManual = () => {
|
|
|
49
47
|
});
|
|
50
48
|
// User has changed network to supported network
|
|
51
49
|
if (_isSupportedNetwork) {
|
|
52
|
-
|
|
53
|
-
if (onboardingOnlyJwt) {
|
|
54
|
-
updateUserProfileByJWT(onboardingOnlyJwt);
|
|
55
|
-
setShowAuthFlow(false);
|
|
56
|
-
}
|
|
50
|
+
setShowAuthFlow(false);
|
|
57
51
|
}
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
},
|
|
53
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
|
+
[network, walletConnector]);
|
|
60
55
|
const iconSize = 80;
|
|
61
56
|
const icon = (jsxRuntime.jsx(walletBook.WalletIcon, { walletName: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.name, style: {
|
|
62
57
|
height: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
|
|
@@ -27,14 +27,12 @@ import '../../context/CaptchaContext/CaptchaContext.js';
|
|
|
27
27
|
import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
28
28
|
import '../../components/IconButton/IconButton.js';
|
|
29
29
|
import { IconWithSpinner, iconRatio } from '../../components/IconWithSpinner/IconWithSpinner.js';
|
|
30
|
-
import { useUpdateUserProfileByJWTCallback } from '../../utils/hooks/useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.js';
|
|
31
30
|
|
|
32
31
|
// The component notifies the user about the required manual network change,
|
|
33
32
|
// as the wallet does not support programmatic network change.
|
|
34
33
|
const NetworkNotSupportedSwitchManual = () => {
|
|
35
34
|
var _a, _b;
|
|
36
|
-
const { user, network,
|
|
37
|
-
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
35
|
+
const { user, network, selectedWalletConnector: walletConnector, setShowAuthFlow, } = useInternalDynamicContext();
|
|
38
36
|
// Listen for network changes
|
|
39
37
|
useEffect(() => {
|
|
40
38
|
if (!walletConnector)
|
|
@@ -45,14 +43,11 @@ const NetworkNotSupportedSwitchManual = () => {
|
|
|
45
43
|
});
|
|
46
44
|
// User has changed network to supported network
|
|
47
45
|
if (_isSupportedNetwork) {
|
|
48
|
-
|
|
49
|
-
if (onboardingOnlyJwt) {
|
|
50
|
-
updateUserProfileByJWT(onboardingOnlyJwt);
|
|
51
|
-
setShowAuthFlow(false);
|
|
52
|
-
}
|
|
46
|
+
setShowAuthFlow(false);
|
|
53
47
|
}
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
},
|
|
49
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
|
+
[network, walletConnector]);
|
|
56
51
|
const iconSize = 80;
|
|
57
52
|
const icon = (jsx(WalletIcon, { walletName: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.name, style: {
|
|
58
53
|
height: pixelToRem(iconSize * iconRatio),
|