@dynamic-labs/sdk-react-core 2.3.6 → 2.3.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 +15 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +2 -2
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +2 -2
- package/src/lib/components/HardwareWalletToggle/HardwareWalletToggle.cjs +1 -1
- package/src/lib/components/HardwareWalletToggle/HardwareWalletToggle.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +13 -6
- package/src/lib/context/DynamicContext/DynamicContext.js +13 -6
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/types.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +1 -0
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +1 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +2 -1
- package/src/lib/locale/en/translation.cjs +5 -0
- package/src/lib/locale/en/translation.d.ts +5 -0
- package/src/lib/locale/en/translation.js +5 -0
- package/src/lib/store/hooks/useUser/useUser.cjs +3 -3
- package/src/lib/store/hooks/useUser/useUser.d.ts +2 -2
- package/src/lib/store/hooks/useUser/useUser.js +3 -3
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +1 -1
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.cjs +3 -3
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.js +3 -3
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useMfa/useMfa.cjs +2 -2
- package/src/lib/utils/hooks/useMfa/useMfa.js +2 -2
- package/src/lib/utils/hooks/useResetCookieLocalStorage/index.d.ts +1 -0
- package/src/lib/utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.cjs +133 -0
- package/src/lib/utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.d.ts +8 -0
- package/src/lib/utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.js +129 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +1 -1
- package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.cjs +7 -7
- package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.js +7 -7
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs +3 -3
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js +3 -3
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +4 -4
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +4 -4
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +3 -3
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +3 -3
- package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.cjs +3 -3
- package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.js +3 -3
- package/src/lib/views/EmailVerification/EmailVerification.cjs +4 -4
- package/src/lib/views/EmailVerification/EmailVerification.js +4 -4
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +22 -5
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +23 -6
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +2 -2
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +2 -2
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.cjs +3 -3
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.js +3 -3
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
9
|
+
var logger = require('../../../shared/logger.cjs');
|
|
10
|
+
require('@dynamic-labs/iconic');
|
|
11
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
12
|
+
require('react/jsx-runtime');
|
|
13
|
+
require('../../../context/ViewContext/ViewContext.cjs');
|
|
14
|
+
require('@dynamic-labs/wallet-book');
|
|
15
|
+
require('../../constants/colors.cjs');
|
|
16
|
+
require('../../constants/values.cjs');
|
|
17
|
+
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
18
|
+
require('@dynamic-labs/logger');
|
|
19
|
+
require('@dynamic-labs/utils');
|
|
20
|
+
require('../../../shared/consts/index.cjs');
|
|
21
|
+
require('@dynamic-labs/multi-wallet');
|
|
22
|
+
require('react-international-phone');
|
|
23
|
+
require('viem');
|
|
24
|
+
require('viem/chains');
|
|
25
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
26
|
+
var userActions = require('../../../store/actions/userActions/userActions.cjs');
|
|
27
|
+
require('../../../locale/locale.cjs');
|
|
28
|
+
var user = require('../../../data/api/user/user.cjs');
|
|
29
|
+
var isCookieEnabled = require('../../functions/isCookieEnabled/isCookieEnabled.cjs');
|
|
30
|
+
require('@dynamic-labs/store');
|
|
31
|
+
require('../../../events/dynamicEvents.cjs');
|
|
32
|
+
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
33
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
34
|
+
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
35
|
+
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
36
|
+
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
37
|
+
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
38
|
+
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
39
|
+
require('react-dom');
|
|
40
|
+
require('../../../context/WalletContext/WalletContext.cjs');
|
|
41
|
+
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
42
|
+
require('../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
43
|
+
require('@dynamic-labs/types');
|
|
44
|
+
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
45
|
+
require('yup');
|
|
46
|
+
require('../../../context/MockContext/MockContext.cjs');
|
|
47
|
+
require('../../../views/CollectUserDataView/useFields.cjs');
|
|
48
|
+
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
49
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
50
|
+
require('@dynamic-labs/rpc-providers');
|
|
51
|
+
require('react-i18next');
|
|
52
|
+
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
53
|
+
require('../../../components/Alert/Alert.cjs');
|
|
54
|
+
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
55
|
+
require('../../../components/IconButton/IconButton.cjs');
|
|
56
|
+
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
57
|
+
require('../../../components/Input/Input.cjs');
|
|
58
|
+
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
59
|
+
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
60
|
+
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
61
|
+
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
62
|
+
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
63
|
+
require('../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
64
|
+
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
65
|
+
require('../../../components/Popper/Popper/Popper.cjs');
|
|
66
|
+
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
67
|
+
require('react-focus-lock');
|
|
68
|
+
require('qrcode');
|
|
69
|
+
require('formik');
|
|
70
|
+
require('../../../views/WalletList/WalletList.cjs');
|
|
71
|
+
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
72
|
+
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
73
|
+
require('@hcaptcha/react-hcaptcha');
|
|
74
|
+
require('../../../context/FooterAnimationContext/index.cjs');
|
|
75
|
+
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
76
|
+
require('../../../context/MfaSettingsContext/MfaSettingsContext.cjs');
|
|
77
|
+
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
78
|
+
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
79
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
80
|
+
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
81
|
+
require('../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
82
|
+
require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
83
|
+
|
|
84
|
+
const useResetCookieLocalStorage = ({ environmentId, projectSettings, setPrimaryWalletId, }) => {
|
|
85
|
+
const didRefreshUserRef = React.useRef(false);
|
|
86
|
+
const user$1 = userActions.getUser();
|
|
87
|
+
/**
|
|
88
|
+
* run this effect every time the user or project settings change
|
|
89
|
+
* but not when the process was already done.
|
|
90
|
+
*/
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
/**
|
|
93
|
+
* this method is called on refresh of DynamicContext and attempts to refresh local storage
|
|
94
|
+
* when cookies are enabled for the environment.
|
|
95
|
+
* the use case here is when an end user logs in to sub1.example.com and navigates to sub2.example.com.
|
|
96
|
+
* if they are signed in to sub1.example.com with a cookie for `.example.com`, but the LS is specific
|
|
97
|
+
* to sub1, then navigating to sub2 will mean they are not automatically signed in.
|
|
98
|
+
* this method attempts to fetch the user from the backend using the cookie (if aavailable), and if successful,
|
|
99
|
+
* this will ensure local storage is properly set with the user.
|
|
100
|
+
*
|
|
101
|
+
* this will also attempt to set the primaryWalletId, if the last verified credential is a wallet
|
|
102
|
+
* the user might have signed in with a wallet in the other subdomain, but the primary wallet
|
|
103
|
+
* in local storage does not carry over to other subdomains (LS is subdomain-specific),
|
|
104
|
+
* so attempt to set it here.
|
|
105
|
+
*/
|
|
106
|
+
const maybeInitUserRefresh = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
107
|
+
if (!user$1 && isCookieEnabled.isCookieEnabled()) {
|
|
108
|
+
// Disable all next calls to this method
|
|
109
|
+
didRefreshUserRef.current = true;
|
|
110
|
+
try {
|
|
111
|
+
const user$1 = yield user.refreshUserJwt({ environmentId });
|
|
112
|
+
/**
|
|
113
|
+
* attempt to set primary wallet in this subdomain because LS does not
|
|
114
|
+
* carry over between different subdomains, even if the cookie does
|
|
115
|
+
*/
|
|
116
|
+
const lastVerifiedWallet = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials.find((vc) => vc.format === sdkApiCore.JwtVerifiedCredentialFormatEnum.Blockchain &&
|
|
117
|
+
vc.id === user$1.lastVerifiedCredentialId);
|
|
118
|
+
if (lastVerifiedWallet)
|
|
119
|
+
setPrimaryWalletId(lastVerifiedWallet.id);
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
logger.logger.debug('Ignore failed refreshUserJwt in useResetCookieLocalStorage');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
// Ensure this effect only runs once
|
|
127
|
+
if (didRefreshUserRef.current)
|
|
128
|
+
return;
|
|
129
|
+
maybeInitUserRefresh();
|
|
130
|
+
}, [user$1, projectSettings]);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
exports.useResetCookieLocalStorage = useResetCookieLocalStorage;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ProjectSettings } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
type Props = {
|
|
3
|
+
environmentId: string;
|
|
4
|
+
projectSettings: ProjectSettings | undefined;
|
|
5
|
+
setPrimaryWalletId(walletId: string): void;
|
|
6
|
+
};
|
|
7
|
+
export declare const useResetCookieLocalStorage: ({ environmentId, projectSettings, setPrimaryWalletId, }: Props) => void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useRef, useEffect } from 'react';
|
|
4
|
+
import { JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
|
+
import { logger } from '../../../shared/logger.js';
|
|
6
|
+
import '@dynamic-labs/iconic';
|
|
7
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
8
|
+
import 'react/jsx-runtime';
|
|
9
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
10
|
+
import '@dynamic-labs/wallet-book';
|
|
11
|
+
import '../../constants/colors.js';
|
|
12
|
+
import '../../constants/values.js';
|
|
13
|
+
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
14
|
+
import '@dynamic-labs/logger';
|
|
15
|
+
import '@dynamic-labs/utils';
|
|
16
|
+
import '../../../shared/consts/index.js';
|
|
17
|
+
import '@dynamic-labs/multi-wallet';
|
|
18
|
+
import 'react-international-phone';
|
|
19
|
+
import 'viem';
|
|
20
|
+
import 'viem/chains';
|
|
21
|
+
import '../../../config/ApiEndpoint.js';
|
|
22
|
+
import { getUser } from '../../../store/actions/userActions/userActions.js';
|
|
23
|
+
import '../../../locale/locale.js';
|
|
24
|
+
import { refreshUserJwt } from '../../../data/api/user/user.js';
|
|
25
|
+
import { isCookieEnabled } from '../../functions/isCookieEnabled/isCookieEnabled.js';
|
|
26
|
+
import '@dynamic-labs/store';
|
|
27
|
+
import '../../../events/dynamicEvents.js';
|
|
28
|
+
import '../../../context/DynamicContext/DynamicContext.js';
|
|
29
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
30
|
+
import '../../../context/ErrorContext/ErrorContext.js';
|
|
31
|
+
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
32
|
+
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
33
|
+
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
34
|
+
import '../../../context/VerificationContext/VerificationContext.js';
|
|
35
|
+
import 'react-dom';
|
|
36
|
+
import '../../../context/WalletContext/WalletContext.js';
|
|
37
|
+
import '../../../context/ThemeContext/ThemeContext.js';
|
|
38
|
+
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
39
|
+
import '@dynamic-labs/types';
|
|
40
|
+
import '../../../context/LoadingContext/LoadingContext.js';
|
|
41
|
+
import 'yup';
|
|
42
|
+
import '../../../context/MockContext/MockContext.js';
|
|
43
|
+
import '../../../views/CollectUserDataView/useFields.js';
|
|
44
|
+
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
45
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
46
|
+
import '@dynamic-labs/rpc-providers';
|
|
47
|
+
import 'react-i18next';
|
|
48
|
+
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
49
|
+
import '../../../components/Alert/Alert.js';
|
|
50
|
+
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
51
|
+
import '../../../components/IconButton/IconButton.js';
|
|
52
|
+
import '../../../components/InlineWidget/InlineWidget.js';
|
|
53
|
+
import '../../../components/Input/Input.js';
|
|
54
|
+
import '../../../components/IsBrowser/IsBrowser.js';
|
|
55
|
+
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
56
|
+
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
57
|
+
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
58
|
+
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
59
|
+
import '../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
60
|
+
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
61
|
+
import '../../../components/Popper/Popper/Popper.js';
|
|
62
|
+
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
63
|
+
import 'react-focus-lock';
|
|
64
|
+
import 'qrcode';
|
|
65
|
+
import 'formik';
|
|
66
|
+
import '../../../views/WalletList/WalletList.js';
|
|
67
|
+
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
68
|
+
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
69
|
+
import '@hcaptcha/react-hcaptcha';
|
|
70
|
+
import '../../../context/FooterAnimationContext/index.js';
|
|
71
|
+
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
72
|
+
import '../../../context/MfaSettingsContext/MfaSettingsContext.js';
|
|
73
|
+
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
74
|
+
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
75
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
76
|
+
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
77
|
+
import '../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
78
|
+
import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
79
|
+
|
|
80
|
+
const useResetCookieLocalStorage = ({ environmentId, projectSettings, setPrimaryWalletId, }) => {
|
|
81
|
+
const didRefreshUserRef = useRef(false);
|
|
82
|
+
const user = getUser();
|
|
83
|
+
/**
|
|
84
|
+
* run this effect every time the user or project settings change
|
|
85
|
+
* but not when the process was already done.
|
|
86
|
+
*/
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
/**
|
|
89
|
+
* this method is called on refresh of DynamicContext and attempts to refresh local storage
|
|
90
|
+
* when cookies are enabled for the environment.
|
|
91
|
+
* the use case here is when an end user logs in to sub1.example.com and navigates to sub2.example.com.
|
|
92
|
+
* if they are signed in to sub1.example.com with a cookie for `.example.com`, but the LS is specific
|
|
93
|
+
* to sub1, then navigating to sub2 will mean they are not automatically signed in.
|
|
94
|
+
* this method attempts to fetch the user from the backend using the cookie (if aavailable), and if successful,
|
|
95
|
+
* this will ensure local storage is properly set with the user.
|
|
96
|
+
*
|
|
97
|
+
* this will also attempt to set the primaryWalletId, if the last verified credential is a wallet
|
|
98
|
+
* the user might have signed in with a wallet in the other subdomain, but the primary wallet
|
|
99
|
+
* in local storage does not carry over to other subdomains (LS is subdomain-specific),
|
|
100
|
+
* so attempt to set it here.
|
|
101
|
+
*/
|
|
102
|
+
const maybeInitUserRefresh = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
103
|
+
if (!user && isCookieEnabled()) {
|
|
104
|
+
// Disable all next calls to this method
|
|
105
|
+
didRefreshUserRef.current = true;
|
|
106
|
+
try {
|
|
107
|
+
const user = yield refreshUserJwt({ environmentId });
|
|
108
|
+
/**
|
|
109
|
+
* attempt to set primary wallet in this subdomain because LS does not
|
|
110
|
+
* carry over between different subdomains, even if the cookie does
|
|
111
|
+
*/
|
|
112
|
+
const lastVerifiedWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => vc.format === JwtVerifiedCredentialFormatEnum.Blockchain &&
|
|
113
|
+
vc.id === user.lastVerifiedCredentialId);
|
|
114
|
+
if (lastVerifiedWallet)
|
|
115
|
+
setPrimaryWalletId(lastVerifiedWallet.id);
|
|
116
|
+
}
|
|
117
|
+
catch (e) {
|
|
118
|
+
logger.debug('Ignore failed refreshUserJwt in useResetCookieLocalStorage');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
// Ensure this effect only runs once
|
|
123
|
+
if (didRefreshUserRef.current)
|
|
124
|
+
return;
|
|
125
|
+
maybeInitUserRefresh();
|
|
126
|
+
}, [user, projectSettings]);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export { useResetCookieLocalStorage };
|
|
@@ -216,7 +216,7 @@ const useSocialAuth = ({ sessionTimeout, onSettled, onError, onFarcasterUrl, })
|
|
|
216
216
|
if (provider === sdkApiCore.ProviderEnum.Farcaster)
|
|
217
217
|
return connectWithFarcaster(authMode, { captchaToken });
|
|
218
218
|
const authWindow = window.open('', '_blank', 'width=500,height=600');
|
|
219
|
-
const state = randomString.randomString(
|
|
219
|
+
const state = randomString.randomString(32);
|
|
220
220
|
const verifier = randomString.randomString(43);
|
|
221
221
|
const clearListeners = () => {
|
|
222
222
|
window.removeEventListener('message', handleAuthWindowMessage);
|
|
@@ -212,7 +212,7 @@ const useSocialAuth = ({ sessionTimeout, onSettled, onError, onFarcasterUrl, })
|
|
|
212
212
|
if (provider === ProviderEnum.Farcaster)
|
|
213
213
|
return connectWithFarcaster(authMode, { captchaToken });
|
|
214
214
|
const authWindow = window.open('', '_blank', 'width=500,height=600');
|
|
215
|
-
const state = randomString(
|
|
215
|
+
const state = randomString(32);
|
|
216
216
|
const verifier = randomString(43);
|
|
217
217
|
const clearListeners = () => {
|
|
218
218
|
window.removeEventListener('message', handleAuthWindowMessage);
|
|
@@ -83,7 +83,7 @@ require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCa
|
|
|
83
83
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
84
84
|
|
|
85
85
|
const useSyncOnboardingFlow = () => {
|
|
86
|
-
const { setShowAuthFlow,
|
|
86
|
+
const { setShowAuthFlow, userWithMissingInfo, handlers, headless, sdkHasLoaded, setSelectedWalletConnectorKey, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
87
87
|
const { setView } = ViewContext.useViewContext();
|
|
88
88
|
const { updateUser } = useUserUpdateRequest.useUserUpdateRequestInternal({
|
|
89
89
|
validationSchemaStripUnknown: false,
|
|
@@ -103,12 +103,12 @@ const useSyncOnboardingFlow = () => {
|
|
|
103
103
|
const handleHeadlessOnboarding = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
104
104
|
var _b;
|
|
105
105
|
if (!(handlers === null || handlers === void 0 ? void 0 : handlers.handleUserOnboarding) ||
|
|
106
|
-
!((_b =
|
|
106
|
+
!((_b = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.missingFields) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
triggeredOnboarding.current = true;
|
|
110
110
|
try {
|
|
111
|
-
const missingFieldsRequestInput =
|
|
111
|
+
const missingFieldsRequestInput = userWithMissingInfo.missingFields.map((field) => ({
|
|
112
112
|
isCustom: field.type === 'custom',
|
|
113
113
|
key: field.name,
|
|
114
114
|
label: field.label,
|
|
@@ -116,7 +116,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
116
116
|
}));
|
|
117
117
|
const onboardingResponse = yield handlers.handleUserOnboarding(missingFieldsRequestInput);
|
|
118
118
|
const userFields = {};
|
|
119
|
-
const customFields = Object.assign({},
|
|
119
|
+
const customFields = Object.assign({}, userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.metadata);
|
|
120
120
|
onboardingResponse.forEach((field) => {
|
|
121
121
|
if (field.isCustom) {
|
|
122
122
|
customFields[field.key] = field.value;
|
|
@@ -137,7 +137,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
137
137
|
const handleOnboarding = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
138
138
|
triggeredOnboarding.current = true;
|
|
139
139
|
setShowAuthFlow(true);
|
|
140
|
-
const lastVerifiedCredential =
|
|
140
|
+
const lastVerifiedCredential = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.verifiedCredentials.find((vc) => vc.id === (userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.lastVerifiedCredentialId));
|
|
141
141
|
if (lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.walletName) {
|
|
142
142
|
setSelectedWalletConnectorKey(lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.walletName);
|
|
143
143
|
}
|
|
@@ -160,7 +160,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
160
160
|
});
|
|
161
161
|
if (!sdkHasLoaded ||
|
|
162
162
|
triggeredOnboarding.current ||
|
|
163
|
-
!((_a =
|
|
163
|
+
!((_a = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.missingFields) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
if (handlers === null || handlers === void 0 ? void 0 : handlers.handleUserOnboarding) {
|
|
@@ -175,7 +175,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
175
175
|
return;
|
|
176
176
|
}, [
|
|
177
177
|
sdkHasLoaded,
|
|
178
|
-
|
|
178
|
+
userWithMissingInfo,
|
|
179
179
|
handlers,
|
|
180
180
|
completeAuth,
|
|
181
181
|
updateUser,
|
|
@@ -79,7 +79,7 @@ import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCar
|
|
|
79
79
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
80
80
|
|
|
81
81
|
const useSyncOnboardingFlow = () => {
|
|
82
|
-
const { setShowAuthFlow,
|
|
82
|
+
const { setShowAuthFlow, userWithMissingInfo, handlers, headless, sdkHasLoaded, setSelectedWalletConnectorKey, } = useInternalDynamicContext();
|
|
83
83
|
const { setView } = useViewContext();
|
|
84
84
|
const { updateUser } = useUserUpdateRequestInternal({
|
|
85
85
|
validationSchemaStripUnknown: false,
|
|
@@ -99,12 +99,12 @@ const useSyncOnboardingFlow = () => {
|
|
|
99
99
|
const handleHeadlessOnboarding = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
100
|
var _b;
|
|
101
101
|
if (!(handlers === null || handlers === void 0 ? void 0 : handlers.handleUserOnboarding) ||
|
|
102
|
-
!((_b =
|
|
102
|
+
!((_b = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.missingFields) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
triggeredOnboarding.current = true;
|
|
106
106
|
try {
|
|
107
|
-
const missingFieldsRequestInput =
|
|
107
|
+
const missingFieldsRequestInput = userWithMissingInfo.missingFields.map((field) => ({
|
|
108
108
|
isCustom: field.type === 'custom',
|
|
109
109
|
key: field.name,
|
|
110
110
|
label: field.label,
|
|
@@ -112,7 +112,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
112
112
|
}));
|
|
113
113
|
const onboardingResponse = yield handlers.handleUserOnboarding(missingFieldsRequestInput);
|
|
114
114
|
const userFields = {};
|
|
115
|
-
const customFields = Object.assign({},
|
|
115
|
+
const customFields = Object.assign({}, userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.metadata);
|
|
116
116
|
onboardingResponse.forEach((field) => {
|
|
117
117
|
if (field.isCustom) {
|
|
118
118
|
customFields[field.key] = field.value;
|
|
@@ -133,7 +133,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
133
133
|
const handleOnboarding = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
134
134
|
triggeredOnboarding.current = true;
|
|
135
135
|
setShowAuthFlow(true);
|
|
136
|
-
const lastVerifiedCredential =
|
|
136
|
+
const lastVerifiedCredential = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.verifiedCredentials.find((vc) => vc.id === (userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.lastVerifiedCredentialId));
|
|
137
137
|
if (lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.walletName) {
|
|
138
138
|
setSelectedWalletConnectorKey(lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.walletName);
|
|
139
139
|
}
|
|
@@ -156,7 +156,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
156
156
|
});
|
|
157
157
|
if (!sdkHasLoaded ||
|
|
158
158
|
triggeredOnboarding.current ||
|
|
159
|
-
!((_a =
|
|
159
|
+
!((_a = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.missingFields) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
162
|
if (handlers === null || handlers === void 0 ? void 0 : handlers.handleUserOnboarding) {
|
|
@@ -171,7 +171,7 @@ const useSyncOnboardingFlow = () => {
|
|
|
171
171
|
return;
|
|
172
172
|
}, [
|
|
173
173
|
sdkHasLoaded,
|
|
174
|
-
|
|
174
|
+
userWithMissingInfo,
|
|
175
175
|
handlers,
|
|
176
176
|
completeAuth,
|
|
177
177
|
updateUser,
|
|
@@ -82,7 +82,7 @@ require('../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/Passke
|
|
|
82
82
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
83
83
|
|
|
84
84
|
const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
85
|
-
const { environmentId,
|
|
85
|
+
const { environmentId, userWithMissingInfo, setCallback } = useInternalDynamicContext.useInternalDynamicContext();
|
|
86
86
|
const { setRetryData } = VerificationContext.useVerification();
|
|
87
87
|
const { selectedPhoneCountry } = FieldsStateContext.useFieldsState();
|
|
88
88
|
const handleVerificationRequired = useHandleVerificationRequired.useHandleVerificationRequired();
|
|
@@ -93,7 +93,7 @@ const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
|
93
93
|
let { metadata } = userFields;
|
|
94
94
|
// when a user has already logged in but a custom field was added to env, in order to not clear the old fields
|
|
95
95
|
metadata = metadata
|
|
96
|
-
? Object.assign(Object.assign({},
|
|
96
|
+
? Object.assign(Object.assign({}, userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.metadata), metadata) : userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.metadata;
|
|
97
97
|
// we dont add user.metadata from edit profile because it is already in the metadata request for updateUser
|
|
98
98
|
const validatedUserFields = yield userFieldsSchema.userFieldsSchema.validate(userFields, {
|
|
99
99
|
stripUnknown: validationSchemaStripUnknown,
|
|
@@ -126,7 +126,7 @@ const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
|
126
126
|
updateUserProfileResponse,
|
|
127
127
|
};
|
|
128
128
|
}), [
|
|
129
|
-
|
|
129
|
+
userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.metadata,
|
|
130
130
|
validationSchemaStripUnknown,
|
|
131
131
|
selectedPhoneCountry,
|
|
132
132
|
setRetryData,
|
|
@@ -78,7 +78,7 @@ import '../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/Passkey
|
|
|
78
78
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
79
79
|
|
|
80
80
|
const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
81
|
-
const { environmentId,
|
|
81
|
+
const { environmentId, userWithMissingInfo, setCallback } = useInternalDynamicContext();
|
|
82
82
|
const { setRetryData } = useVerification();
|
|
83
83
|
const { selectedPhoneCountry } = useFieldsState();
|
|
84
84
|
const handleVerificationRequired = useHandleVerificationRequired();
|
|
@@ -89,7 +89,7 @@ const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
|
89
89
|
let { metadata } = userFields;
|
|
90
90
|
// when a user has already logged in but a custom field was added to env, in order to not clear the old fields
|
|
91
91
|
metadata = metadata
|
|
92
|
-
? Object.assign(Object.assign({},
|
|
92
|
+
? Object.assign(Object.assign({}, userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.metadata), metadata) : userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.metadata;
|
|
93
93
|
// we dont add user.metadata from edit profile because it is already in the metadata request for updateUser
|
|
94
94
|
const validatedUserFields = yield userFieldsSchema.validate(userFields, {
|
|
95
95
|
stripUnknown: validationSchemaStripUnknown,
|
|
@@ -122,7 +122,7 @@ const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
|
122
122
|
updateUserProfileResponse,
|
|
123
123
|
};
|
|
124
124
|
}), [
|
|
125
|
-
|
|
125
|
+
userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.metadata,
|
|
126
126
|
validationSchemaStripUnknown,
|
|
127
127
|
selectedPhoneCountry,
|
|
128
128
|
setRetryData,
|
|
@@ -93,19 +93,19 @@ require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
|
93
93
|
|
|
94
94
|
const CollectUserDataView = () => {
|
|
95
95
|
var _a;
|
|
96
|
-
const { appName, projectSettings, network, selectedWalletConnector: walletConnector, handleLogOut, onboardingImageUrl,
|
|
96
|
+
const { appName, projectSettings, network, selectedWalletConnector: walletConnector, handleLogOut, onboardingImageUrl, userWithMissingInfo, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
97
97
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = React.useState(false);
|
|
98
98
|
const nameService = useFetchNameService.useFetchNameService();
|
|
99
99
|
const { t } = reactI18next.useTranslation();
|
|
100
|
-
if (!walletConnector || !
|
|
100
|
+
if (!walletConnector || !userWithMissingInfo) {
|
|
101
101
|
return null;
|
|
102
102
|
}
|
|
103
103
|
const evmNetworks = walletConnector.evmNetworks || [];
|
|
104
104
|
const _isSupportedNetwork = !network || isSupportedNetwork.isSupportedNetwork({ network, walletConnector });
|
|
105
|
-
const walletAddress = (_a =
|
|
105
|
+
const walletAddress = (_a = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.verifiedCredentials.find((verifiedCredential) => verifiedCredential.id === userWithMissingInfo.lastVerifiedCredentialId)) === null || _a === void 0 ? void 0 : _a.address;
|
|
106
106
|
return (jsxRuntime.jsxs("div", { className: 'collect-user-data', "data-testid": 'collect-user-data-view', children: [jsxRuntime.jsxs("div", { className: 'collect-user-data__network-container', children: [jsxRuntime.jsxs("div", { className: 'collect-user-data__img-container', children: [(nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsxRuntime.jsx("img", { src: nameService.avatar, alt: '', className: 'collect-user-data__img collect-user-data__img--rounded' })) : (jsxRuntime.jsx(AuthProviderIcon.AuthProviderIcon, { iconSize: 28 })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', className: 'collect-user-data__wallet-address', children: (nameService === null || nameService === void 0 ? void 0 : nameService.name) || shortenWalletAddress.shortenWalletAddress(walletAddress, 3, 3) })] }), jsxRuntime.jsx(NetworkPicker.NetworkPicker, { currentNetwork: network, evmNetworks: evmNetworks, connector: walletConnector, showNetworkName: true, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, buttonClassName: 'collect-user-data__network-picker-button', mainClassName: 'collect-user-data__network-picker' })] }), onboardingImageUrl && (jsxRuntime.jsx("img", { className: 'collect-user-data__main-img', src: onboardingImageUrl, alt: 'onboarding' })), !_isSupportedNetwork && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { withIcon: false, className: 'collect-user-data__error--not-supported', copykey: 'dyn_collect_user_data.not_supported_network.error_message', children: t('dyn_collect_user_data.not_supported_network.error_message') })), jsxRuntime.jsxs("div", { className: classNames.classNames('collect-user-data__form', {
|
|
107
107
|
'collect-user-data__form--error': !_isSupportedNetwork,
|
|
108
|
-
}), children: [jsxRuntime.jsx("div", { className: 'collect-user-data__success-icon', children: jsxRuntime.jsx(Icon.Icon, { color: 'text-primary', size: 'large', children: jsxRuntime.jsx(checkConnection.ReactComponent, {}) }) }), jsxRuntime.jsx(OnboardingUserDataForm.OnboardingUserDataForm, { disableSubmit: !_isSupportedNetwork, userProfile:
|
|
108
|
+
}), children: [jsxRuntime.jsx("div", { className: 'collect-user-data__success-icon', children: jsxRuntime.jsx(Icon.Icon, { color: 'text-primary', size: 'large', children: jsxRuntime.jsx(checkConnection.ReactComponent, {}) }) }), jsxRuntime.jsx(OnboardingUserDataForm.OnboardingUserDataForm, { disableSubmit: !_isSupportedNetwork, userProfile: userWithMissingInfo, children: !_isSupportedNetwork ? (jsxRuntime.jsxs("div", { className: 'collect-user-data__welcome-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'collect-user-data__welcome-title', copykey: 'dyn_collect_user_data.not_supported_network.title', children: t('dyn_collect_user_data.not_supported_network.title') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_collect_user_data.not_supported_network.description', children: t('dyn_collect_user_data.not_supported_network.description') })] })) : (jsxRuntime.jsxs("div", { className: 'collect-user-data__welcome-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'collect-user-data__welcome-title', copykey: 'dyn_collect_user_data.greeting', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeHeader) ||
|
|
109
109
|
t('dyn_collect_user_data.greeting', { appName }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_collect_user_data.description', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeMessage) ||
|
|
110
110
|
t('dyn_collect_user_data.description') })] })) }), jsxRuntime.jsx(TextButton.TextButton, { className: 'collect-user-data__log-out', onClick: handleLogOut, copykey: 'dyn_collect_user_data.log_out_button', children: t('dyn_collect_user_data.log_out_button') })] })] }));
|
|
111
111
|
};
|
|
@@ -89,19 +89,19 @@ import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
|
89
89
|
|
|
90
90
|
const CollectUserDataView = () => {
|
|
91
91
|
var _a;
|
|
92
|
-
const { appName, projectSettings, network, selectedWalletConnector: walletConnector, handleLogOut, onboardingImageUrl,
|
|
92
|
+
const { appName, projectSettings, network, selectedWalletConnector: walletConnector, handleLogOut, onboardingImageUrl, userWithMissingInfo, } = useInternalDynamicContext();
|
|
93
93
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = useState(false);
|
|
94
94
|
const nameService = useFetchNameService();
|
|
95
95
|
const { t } = useTranslation();
|
|
96
|
-
if (!walletConnector || !
|
|
96
|
+
if (!walletConnector || !userWithMissingInfo) {
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
99
99
|
const evmNetworks = walletConnector.evmNetworks || [];
|
|
100
100
|
const _isSupportedNetwork = !network || isSupportedNetwork({ network, walletConnector });
|
|
101
|
-
const walletAddress = (_a =
|
|
101
|
+
const walletAddress = (_a = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.verifiedCredentials.find((verifiedCredential) => verifiedCredential.id === userWithMissingInfo.lastVerifiedCredentialId)) === null || _a === void 0 ? void 0 : _a.address;
|
|
102
102
|
return (jsxs("div", { className: 'collect-user-data', "data-testid": 'collect-user-data-view', children: [jsxs("div", { className: 'collect-user-data__network-container', children: [jsxs("div", { className: 'collect-user-data__img-container', children: [(nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsx("img", { src: nameService.avatar, alt: '', className: 'collect-user-data__img collect-user-data__img--rounded' })) : (jsx(AuthProviderIcon, { iconSize: 28 })), jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', className: 'collect-user-data__wallet-address', children: (nameService === null || nameService === void 0 ? void 0 : nameService.name) || shortenWalletAddress(walletAddress, 3, 3) })] }), jsx(NetworkPicker, { currentNetwork: network, evmNetworks: evmNetworks, connector: walletConnector, showNetworkName: true, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, buttonClassName: 'collect-user-data__network-picker-button', mainClassName: 'collect-user-data__network-picker' })] }), onboardingImageUrl && (jsx("img", { className: 'collect-user-data__main-img', src: onboardingImageUrl, alt: 'onboarding' })), !_isSupportedNetwork && (jsx(ErrorContainer, { withIcon: false, className: 'collect-user-data__error--not-supported', copykey: 'dyn_collect_user_data.not_supported_network.error_message', children: t('dyn_collect_user_data.not_supported_network.error_message') })), jsxs("div", { className: classNames('collect-user-data__form', {
|
|
103
103
|
'collect-user-data__form--error': !_isSupportedNetwork,
|
|
104
|
-
}), children: [jsx("div", { className: 'collect-user-data__success-icon', children: jsx(Icon, { color: 'text-primary', size: 'large', children: jsx(SvgCheckConnection, {}) }) }), jsx(OnboardingUserDataForm, { disableSubmit: !_isSupportedNetwork, userProfile:
|
|
104
|
+
}), children: [jsx("div", { className: 'collect-user-data__success-icon', children: jsx(Icon, { color: 'text-primary', size: 'large', children: jsx(SvgCheckConnection, {}) }) }), jsx(OnboardingUserDataForm, { disableSubmit: !_isSupportedNetwork, userProfile: userWithMissingInfo, children: !_isSupportedNetwork ? (jsxs("div", { className: 'collect-user-data__welcome-container', children: [jsx(Typography, { variant: 'title', color: 'primary', className: 'collect-user-data__welcome-title', copykey: 'dyn_collect_user_data.not_supported_network.title', children: t('dyn_collect_user_data.not_supported_network.title') }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_collect_user_data.not_supported_network.description', children: t('dyn_collect_user_data.not_supported_network.description') })] })) : (jsxs("div", { className: 'collect-user-data__welcome-container', children: [jsx(Typography, { variant: 'title', color: 'primary', className: 'collect-user-data__welcome-title', copykey: 'dyn_collect_user_data.greeting', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeHeader) ||
|
|
105
105
|
t('dyn_collect_user_data.greeting', { appName }) }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_collect_user_data.description', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeMessage) ||
|
|
106
106
|
t('dyn_collect_user_data.description') })] })) }), jsx(TextButton, { className: 'collect-user-data__log-out', onClick: handleLogOut, copykey: 'dyn_collect_user_data.log_out_button', children: t('dyn_collect_user_data.log_out_button') })] })] }));
|
|
107
107
|
};
|
|
@@ -85,7 +85,7 @@ require('@hcaptcha/react-hcaptcha');
|
|
|
85
85
|
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
86
86
|
|
|
87
87
|
const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
88
|
-
const { policiesConsentInnerComponent,
|
|
88
|
+
const { policiesConsentInnerComponent, userWithMissingInfo } = useInternalDynamicContext.useInternalDynamicContext();
|
|
89
89
|
const { error } = ErrorContext.useErrorContext();
|
|
90
90
|
const { completeAuth } = useUserAuth.useUserAuth({});
|
|
91
91
|
const { updateUser } = useUserUpdateRequest.useUserUpdateRequestInternal({
|
|
@@ -97,7 +97,7 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
97
97
|
});
|
|
98
98
|
}), [completeAuth, updateUser]);
|
|
99
99
|
const { fetch: loading, formikInitialValues, formikValidationSchema, enforcePolicies, onFormSubmit, } = useUserDataForm.useUserDataForm({
|
|
100
|
-
fields: (
|
|
100
|
+
fields: (userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.missingFields) || [],
|
|
101
101
|
onSubmit,
|
|
102
102
|
userProfile,
|
|
103
103
|
});
|
|
@@ -110,7 +110,7 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
110
110
|
(enforcePolicies &&
|
|
111
111
|
(policiesConsentInnerComponentArray === null || policiesConsentInnerComponentArray === void 0 ? void 0 : policiesConsentInnerComponentArray.length) !==
|
|
112
112
|
((_a = values.policiesConsentArray) === null || _a === void 0 ? void 0 : _a.length));
|
|
113
|
-
return (jsxRuntime.jsx(formik.Form, { className: 'user-data-form__form', children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [children, error && (jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', className: 'user-data-form__error', children: error })), jsxRuntime.jsx(UserDataFields.UserDataFields, { fields:
|
|
113
|
+
return (jsxRuntime.jsx(formik.Form, { className: 'user-data-form__form', children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [children, error && (jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', className: 'user-data-form__error', children: error })), jsxRuntime.jsx(UserDataFields.UserDataFields, { fields: userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.missingFields, errors: errors, touched: touched, policiesConsentInnerComponentArray: policiesConsentInnerComponentArray }), jsxRuntime.jsx(TypographyButton.TypographyButton, { type: 'submit', loading: loading, disabled: isSubmitBtnDisabled, buttonVariant: 'primary', expanded: true, buttonPadding: 'login-screen-height', children: "Continue" })] }) }));
|
|
114
114
|
} }));
|
|
115
115
|
};
|
|
116
116
|
|
|
@@ -81,7 +81,7 @@ import '@hcaptcha/react-hcaptcha';
|
|
|
81
81
|
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
82
82
|
|
|
83
83
|
const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
84
|
-
const { policiesConsentInnerComponent,
|
|
84
|
+
const { policiesConsentInnerComponent, userWithMissingInfo } = useInternalDynamicContext();
|
|
85
85
|
const { error } = useErrorContext();
|
|
86
86
|
const { completeAuth } = useUserAuth({});
|
|
87
87
|
const { updateUser } = useUserUpdateRequestInternal({
|
|
@@ -93,7 +93,7 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
93
93
|
});
|
|
94
94
|
}), [completeAuth, updateUser]);
|
|
95
95
|
const { fetch: loading, formikInitialValues, formikValidationSchema, enforcePolicies, onFormSubmit, } = useUserDataForm({
|
|
96
|
-
fields: (
|
|
96
|
+
fields: (userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.missingFields) || [],
|
|
97
97
|
onSubmit,
|
|
98
98
|
userProfile,
|
|
99
99
|
});
|
|
@@ -106,7 +106,7 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
106
106
|
(enforcePolicies &&
|
|
107
107
|
(policiesConsentInnerComponentArray === null || policiesConsentInnerComponentArray === void 0 ? void 0 : policiesConsentInnerComponentArray.length) !==
|
|
108
108
|
((_a = values.policiesConsentArray) === null || _a === void 0 ? void 0 : _a.length));
|
|
109
|
-
return (jsx(Form, { className: 'user-data-form__form', children: jsxs(Fragment, { children: [children, error && (jsx(Alert, { icon: 'error', variant: 'error', className: 'user-data-form__error', children: error })), jsx(UserDataFields, { fields:
|
|
109
|
+
return (jsx(Form, { className: 'user-data-form__form', children: jsxs(Fragment, { children: [children, error && (jsx(Alert, { icon: 'error', variant: 'error', className: 'user-data-form__error', children: error })), jsx(UserDataFields, { fields: userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.missingFields, errors: errors, touched: touched, policiesConsentInnerComponentArray: policiesConsentInnerComponentArray }), jsx(TypographyButton, { type: 'submit', loading: loading, disabled: isSubmitBtnDisabled, buttonVariant: 'primary', expanded: true, buttonPadding: 'login-screen-height', children: "Continue" })] }) }));
|
|
110
110
|
} }));
|
|
111
111
|
};
|
|
112
112
|
|