@dynamic-labs/sdk-react-core 4.79.2 → 4.80.0
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 +2 -2
- package/package.js +2 -2
- package/package.json +13 -13
- package/src/lib/Main.cjs +2 -2
- package/src/lib/Main.js +2 -2
- package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
- package/src/lib/components/LogoutButton/LogoutButton.cjs +2 -2
- package/src/lib/components/LogoutButton/LogoutButton.js +2 -2
- package/src/lib/context/DynamicContext/DynamicContext.cjs +6 -4
- package/src/lib/context/DynamicContext/DynamicContext.js +6 -4
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/types.d.ts +9 -0
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +25 -12
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.d.ts +5 -3
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +24 -11
- package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.cjs +3 -3
- package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.d.ts +3 -2
- package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.js +3 -3
- package/src/lib/context/DynamicContext/types/IDynamicContext.d.ts +2 -0
- package/src/lib/context/DynamicContext/types/IInternalDynamicContext.d.ts +8 -1
- package/src/lib/events/auth.d.ts +2 -1
- package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.cjs +2 -2
- package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.js +2 -2
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +1 -1
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +1 -1
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +3 -3
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +3 -3
- package/src/lib/utils/hooks/useValidateSession/handleStoreAndEnvironmentMismatch/handleStoreAndEnvironmentMismatch.cjs +1 -1
- package/src/lib/utils/hooks/useValidateSession/handleStoreAndEnvironmentMismatch/handleStoreAndEnvironmentMismatch.d.ts +2 -1
- package/src/lib/utils/hooks/useValidateSession/handleStoreAndEnvironmentMismatch/handleStoreAndEnvironmentMismatch.js +1 -1
- package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.cjs +3 -1
- package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.d.ts +2 -2
- package/src/lib/utils/hooks/useValidateSession/handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.js +3 -1
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +3 -3
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.d.ts +3 -3
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +3 -3
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +2 -2
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +3 -2
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +2 -2
- package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.cjs +5 -5
- package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.js +5 -5
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +2 -2
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +2 -2
- package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.cjs +2 -2
- package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.js +2 -2
- package/src/lib/views/DeviceRegistrationView/DeviceRegistrationView.cjs +2 -2
- package/src/lib/views/DeviceRegistrationView/DeviceRegistrationView.js +2 -2
- package/src/lib/views/EmailVerification/EmailVerification.cjs +2 -2
- package/src/lib/views/EmailVerification/EmailVerification.js +2 -2
- package/src/lib/views/EmbeddedDeleteView/EmbeddedDeleteView.cjs +2 -2
- package/src/lib/views/EmbeddedDeleteView/EmbeddedDeleteView.js +2 -2
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +7 -7
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +7 -7
- package/src/lib/views/MfaSecureDeviceView/MfaSecureDeviceView.cjs +7 -7
- package/src/lib/views/MfaSecureDeviceView/MfaSecureDeviceView.js +7 -7
- package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +5 -5
- package/src/lib/views/MfaVerificationView/MfaVerificationView.js +5 -5
- 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/SmsVerification.cjs +2 -2
- package/src/lib/views/SmsVerification/SmsVerification.js +2 -2
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +2 -2
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +2 -2
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +2 -2
- package/src/lib/views/WalletLockedView/WalletLockedView.js +2 -2
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +2 -2
- package/src/lib/views/WalletUsedView/WalletUsedView.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +2 -2
|
@@ -60,7 +60,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
60
60
|
// this can happen if the public key passed during initial registration
|
|
61
61
|
// does not match the root session public key that the backend expects
|
|
62
62
|
walletConnectorCore.logger.warn('Invalid embedded wallet session key. Re-authentication is required to create new session keys.');
|
|
63
|
-
dynamicEvents.dynamicEvents.emit('triggerLogout');
|
|
63
|
+
dynamicEvents.dynamicEvents.emit('triggerLogout', 'embedded-wallet-session-key-invalid');
|
|
64
64
|
}
|
|
65
65
|
walletConnectorCore.logger.error('Error registering session key', { error });
|
|
66
66
|
throw error;
|
|
@@ -56,7 +56,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
56
56
|
// this can happen if the public key passed during initial registration
|
|
57
57
|
// does not match the root session public key that the backend expects
|
|
58
58
|
logger.warn('Invalid embedded wallet session key. Re-authentication is required to create new session keys.');
|
|
59
|
-
dynamicEvents.emit('triggerLogout');
|
|
59
|
+
dynamicEvents.emit('triggerLogout', 'embedded-wallet-session-key-invalid');
|
|
60
60
|
}
|
|
61
61
|
logger.error('Error registering session key', { error });
|
|
62
62
|
throw error;
|
|
@@ -118,7 +118,7 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
118
118
|
|
|
119
119
|
const sleepToShowSuccessMessage = () => utils.sleep(1500);
|
|
120
120
|
const useUserAuth = ({ authMethod, }) => {
|
|
121
|
-
const {
|
|
121
|
+
const { handleLogOutWithReason, setShowAuthFlow, setCallback, setMultiWalletWidgetState, walletConnectorOptions, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
122
122
|
const { setDeniedOauthUsername, setDeniedOauthProvider } = AccessDeniedContext.useAccessDeniedContext();
|
|
123
123
|
const { view, pushView, clearStackAndPushInitialView } = ViewContext.useViewContext();
|
|
124
124
|
const { setLoading } = LoadingContext.useLoadingContext();
|
|
@@ -130,9 +130,9 @@ const useUserAuth = ({ authMethod, }) => {
|
|
|
130
130
|
const isVerifyResponse = (response) => response.user;
|
|
131
131
|
const cancelAuth = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
132
132
|
logger.logger.debug('cancelAuth', { authMethod });
|
|
133
|
-
yield
|
|
133
|
+
yield handleLogOutWithReason('auth-cancelled');
|
|
134
134
|
clearStackAndPushInitialView();
|
|
135
|
-
}), [authMethod, clearStackAndPushInitialView,
|
|
135
|
+
}), [authMethod, clearStackAndPushInitialView, handleLogOutWithReason]);
|
|
136
136
|
const handleAuthError = React.useCallback((error, { options = {}, onError, }) => {
|
|
137
137
|
var _a, _b;
|
|
138
138
|
instrumentAuthLoginFailed.instrumentAuthLoginFailed(error, {
|
|
@@ -114,7 +114,7 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
114
114
|
|
|
115
115
|
const sleepToShowSuccessMessage = () => sleep(1500);
|
|
116
116
|
const useUserAuth = ({ authMethod, }) => {
|
|
117
|
-
const {
|
|
117
|
+
const { handleLogOutWithReason, setShowAuthFlow, setCallback, setMultiWalletWidgetState, walletConnectorOptions, } = useInternalDynamicContext();
|
|
118
118
|
const { setDeniedOauthUsername, setDeniedOauthProvider } = useAccessDeniedContext();
|
|
119
119
|
const { view, pushView, clearStackAndPushInitialView } = useViewContext();
|
|
120
120
|
const { setLoading } = useLoadingContext();
|
|
@@ -126,9 +126,9 @@ const useUserAuth = ({ authMethod, }) => {
|
|
|
126
126
|
const isVerifyResponse = (response) => response.user;
|
|
127
127
|
const cancelAuth = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
128
128
|
logger.debug('cancelAuth', { authMethod });
|
|
129
|
-
yield
|
|
129
|
+
yield handleLogOutWithReason('auth-cancelled');
|
|
130
130
|
clearStackAndPushInitialView();
|
|
131
|
-
}), [authMethod, clearStackAndPushInitialView,
|
|
131
|
+
}), [authMethod, clearStackAndPushInitialView, handleLogOutWithReason]);
|
|
132
132
|
const handleAuthError = useCallback((error, { options = {}, onError, }) => {
|
|
133
133
|
var _a, _b;
|
|
134
134
|
instrumentAuthLoginFailed(error, {
|
|
@@ -17,7 +17,7 @@ const handleStoreAndEnvironmentMismatch = (_a) => _tslib.__awaiter(void 0, [_a],
|
|
|
17
17
|
yield logout('store and environment are out of sync', {
|
|
18
18
|
currentEnvId: environmentId,
|
|
19
19
|
storedEnvId: storeEnvId,
|
|
20
|
-
});
|
|
20
|
+
}, 'store-environment-mismatch');
|
|
21
21
|
dynamicContextProps.setEnvironmentId(environmentId);
|
|
22
22
|
});
|
|
23
23
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { SdkLogoutReason } from '../../../../context/DynamicContext/hooks/useHandleLogout';
|
|
1
2
|
export type HandleStoreAndEnvironmentMismatchParams = {
|
|
2
3
|
environmentId: string;
|
|
3
|
-
logout: (reason: string, params: any) => Promise<void>;
|
|
4
|
+
logout: (reason: string, params: any, logoutReason: SdkLogoutReason) => Promise<void>;
|
|
4
5
|
};
|
|
5
6
|
/**
|
|
6
7
|
* Detects envId mismtach with store.
|
|
@@ -13,7 +13,7 @@ const handleStoreAndEnvironmentMismatch = (_a) => __awaiter(void 0, [_a], void 0
|
|
|
13
13
|
yield logout('store and environment are out of sync', {
|
|
14
14
|
currentEnvId: environmentId,
|
|
15
15
|
storedEnvId: storeEnvId,
|
|
16
|
-
});
|
|
16
|
+
}, 'store-environment-mismatch');
|
|
17
17
|
setEnvironmentId(environmentId);
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -63,7 +63,9 @@ const handleWalletInfoOutOfSync = (_a) => _tslib.__awaiter(void 0, [_a], void 0,
|
|
|
63
63
|
connectedWallets,
|
|
64
64
|
primaryWalletId: primaryWalletId$1,
|
|
65
65
|
user,
|
|
66
|
-
}, isTokenExpired
|
|
66
|
+
}, isTokenExpired
|
|
67
|
+
? 'token-expired-validate-session'
|
|
68
|
+
: 'wallet-info-out-of-sync');
|
|
67
69
|
});
|
|
68
70
|
|
|
69
71
|
exports.handleWalletInfoOutOfSync = handleWalletInfoOutOfSync;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SdkLogoutReason } from '../../../../context/DynamicContext/hooks/useHandleLogout';
|
|
2
2
|
export type HandleWalletInfoOutOfSyncParams = {
|
|
3
|
-
logout: (reason: string, params: any, logoutReason
|
|
3
|
+
logout: (reason: string, params: any, logoutReason: SdkLogoutReason) => Promise<void>;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
6
|
* Detects mismatch between wallet info.
|
|
@@ -59,7 +59,9 @@ const handleWalletInfoOutOfSync = (_a) => __awaiter(void 0, [_a], void 0, functi
|
|
|
59
59
|
connectedWallets,
|
|
60
60
|
primaryWalletId,
|
|
61
61
|
user,
|
|
62
|
-
}, isTokenExpired
|
|
62
|
+
}, isTokenExpired
|
|
63
|
+
? 'token-expired-validate-session'
|
|
64
|
+
: 'wallet-info-out-of-sync');
|
|
63
65
|
});
|
|
64
66
|
|
|
65
67
|
export { handleWalletInfoOutOfSync };
|
|
@@ -35,7 +35,7 @@ var useProjectSettings = require('../../../client/extension/projectSettings/useP
|
|
|
35
35
|
var handleStoreAndEnvironmentMismatch = require('./handleStoreAndEnvironmentMismatch/handleStoreAndEnvironmentMismatch.cjs');
|
|
36
36
|
var handleWalletInfoOutOfSync = require('./handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.cjs');
|
|
37
37
|
|
|
38
|
-
const useValidateSession = ({ environmentId,
|
|
38
|
+
const useValidateSession = ({ environmentId, handleLogOutWithReason, }) => {
|
|
39
39
|
const didRunRef = React.useRef(false);
|
|
40
40
|
const projectSettings = useProjectSettings.useProjectSettings();
|
|
41
41
|
const initStatus = useInitStatus.useClientInitStatus();
|
|
@@ -43,8 +43,8 @@ const useValidateSession = ({ environmentId, handleLogOut }) => {
|
|
|
43
43
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
44
|
(reason, params, logoutReason) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
45
45
|
logger.logger.info(`Logging out due to invalid session - Reason: ${reason}`, Object.assign({}, params));
|
|
46
|
-
return
|
|
47
|
-
}), [
|
|
46
|
+
return handleLogOutWithReason(logoutReason);
|
|
47
|
+
}), [handleLogOutWithReason]);
|
|
48
48
|
const validateSession = React.useCallback((projectSettings) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
49
49
|
const params = {
|
|
50
50
|
environmentId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SdkLogoutReason } from '../../../context/DynamicContext/hooks/useHandleLogout';
|
|
2
2
|
type Props = {
|
|
3
3
|
environmentId: string;
|
|
4
|
-
|
|
4
|
+
handleLogOutWithReason: (reason: SdkLogoutReason) => Promise<void>;
|
|
5
5
|
};
|
|
6
|
-
export declare const useValidateSession: ({ environmentId,
|
|
6
|
+
export declare const useValidateSession: ({ environmentId, handleLogOutWithReason, }: Props) => void;
|
|
7
7
|
export {};
|
|
@@ -31,7 +31,7 @@ import { useProjectSettings } from '../../../client/extension/projectSettings/us
|
|
|
31
31
|
import { handleStoreAndEnvironmentMismatch } from './handleStoreAndEnvironmentMismatch/handleStoreAndEnvironmentMismatch.js';
|
|
32
32
|
import { handleWalletInfoOutOfSync } from './handleWalletInfoOutOfSync/handleWalletInfoOutOfSync.js';
|
|
33
33
|
|
|
34
|
-
const useValidateSession = ({ environmentId,
|
|
34
|
+
const useValidateSession = ({ environmentId, handleLogOutWithReason, }) => {
|
|
35
35
|
const didRunRef = useRef(false);
|
|
36
36
|
const projectSettings = useProjectSettings();
|
|
37
37
|
const initStatus = useClientInitStatus();
|
|
@@ -39,8 +39,8 @@ const useValidateSession = ({ environmentId, handleLogOut }) => {
|
|
|
39
39
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
40
|
(reason, params, logoutReason) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
41
|
logger.info(`Logging out due to invalid session - Reason: ${reason}`, Object.assign({}, params));
|
|
42
|
-
return
|
|
43
|
-
}), [
|
|
42
|
+
return handleLogOutWithReason(logoutReason);
|
|
43
|
+
}), [handleLogOutWithReason]);
|
|
44
44
|
const validateSession = useCallback((projectSettings) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
45
|
const params = {
|
|
46
46
|
environmentId,
|
|
@@ -34,7 +34,7 @@ require('@dynamic-labs/locale');
|
|
|
34
34
|
require('../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
35
35
|
var authMode = require('../../../store/state/authMode/authMode.cjs');
|
|
36
36
|
|
|
37
|
-
const useWalletEventListeners = ({ disconnectWallet,
|
|
37
|
+
const useWalletEventListeners = ({ disconnectWallet, handleLogOutWithReason, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnectorKey, setSelectedWalletWithAction, setMultiWalletWidgetState, user, refreshConnectedWallet, detectNewWalletsForLinking, }) => {
|
|
38
38
|
const handleAccountChangeWhenAwaitingAccountSwitch = React.useCallback((isPrimaryWallet, newAddress) => {
|
|
39
39
|
logger.logger.debug('handleAccountChangeWhenAwaitingAccountSwitch', {
|
|
40
40
|
isPrimaryWallet,
|
|
@@ -163,7 +163,7 @@ const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet,
|
|
|
163
163
|
logger.logger.debug('primary wallet disconnect');
|
|
164
164
|
const authMode$1 = authMode.getAuthMode();
|
|
165
165
|
if (authMode$1 === 'connect-only') {
|
|
166
|
-
|
|
166
|
+
handleLogOutWithReason('primary-wallet-disconnected');
|
|
167
167
|
}
|
|
168
168
|
});
|
|
169
169
|
useWalletConnectorEvent.useWalletConnectorEvent(uniqueNonPrimaryWallets, 'disconnect', (affectedConnector) => {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { UserProfile } from '@dynamic-labs/types';
|
|
2
2
|
import type { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { SdkLogoutReason } from '../../../context/DynamicContext/hooks/useHandleLogout';
|
|
3
4
|
import { IDynamicContext } from '../../../context/DynamicContext/types';
|
|
4
5
|
import { MultiWalletWidgetState, Wallet, WalletWithAction } from '../../../shared';
|
|
5
6
|
import { MultiWalletWidgetStateSetter } from '../multiWallet';
|
|
6
7
|
export type UseWalletEventListenersArgs = {
|
|
7
8
|
disconnectWallet: (walletId: string) => Promise<void>;
|
|
8
|
-
|
|
9
|
+
handleLogOutWithReason(reason: SdkLogoutReason): Promise<void>;
|
|
9
10
|
multiWallet: boolean;
|
|
10
11
|
multiWalletWidgetState: MultiWalletWidgetState;
|
|
11
12
|
primaryWallet: Wallet | null;
|
|
@@ -19,4 +20,4 @@ export type UseWalletEventListenersArgs = {
|
|
|
19
20
|
refreshConnectedWallet: (walletId: string, walletConnector: WalletConnector, shouldCallCallback?: boolean) => Promise<void>;
|
|
20
21
|
detectNewWalletsForLinking: boolean;
|
|
21
22
|
};
|
|
22
|
-
export declare const useWalletEventListeners: ({ disconnectWallet,
|
|
23
|
+
export declare const useWalletEventListeners: ({ disconnectWallet, handleLogOutWithReason, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnectorKey, setSelectedWalletWithAction, setMultiWalletWidgetState, user, refreshConnectedWallet, detectNewWalletsForLinking, }: UseWalletEventListenersArgs) => void;
|
|
@@ -30,7 +30,7 @@ import '@dynamic-labs/locale';
|
|
|
30
30
|
import '../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
31
31
|
import { getAuthMode } from '../../../store/state/authMode/authMode.js';
|
|
32
32
|
|
|
33
|
-
const useWalletEventListeners = ({ disconnectWallet,
|
|
33
|
+
const useWalletEventListeners = ({ disconnectWallet, handleLogOutWithReason, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnectorKey, setSelectedWalletWithAction, setMultiWalletWidgetState, user, refreshConnectedWallet, detectNewWalletsForLinking, }) => {
|
|
34
34
|
const handleAccountChangeWhenAwaitingAccountSwitch = useCallback((isPrimaryWallet, newAddress) => {
|
|
35
35
|
logger.debug('handleAccountChangeWhenAwaitingAccountSwitch', {
|
|
36
36
|
isPrimaryWallet,
|
|
@@ -159,7 +159,7 @@ const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet,
|
|
|
159
159
|
logger.debug('primary wallet disconnect');
|
|
160
160
|
const authMode = getAuthMode();
|
|
161
161
|
if (authMode === 'connect-only') {
|
|
162
|
-
|
|
162
|
+
handleLogOutWithReason('primary-wallet-disconnected');
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
165
|
useWalletConnectorEvent(uniqueNonPrimaryWallets, 'disconnect', (affectedConnector) => {
|
|
@@ -24,8 +24,10 @@ require('@dynamic-labs/sdk-api-core');
|
|
|
24
24
|
require('../../shared/consts/index.cjs');
|
|
25
25
|
require('../../components/Alert/Alert.cjs');
|
|
26
26
|
require('../../events/dynamicEvents.cjs');
|
|
27
|
-
var useDynamicContext = require('../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
|
|
28
27
|
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
28
|
+
require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
29
|
+
require('../../store/state/authMode/authMode.cjs');
|
|
30
|
+
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
29
31
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
30
32
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
31
33
|
require('@dynamic-labs/multi-wallet');
|
|
@@ -44,8 +46,6 @@ require('../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.c
|
|
|
44
46
|
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
45
47
|
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
46
48
|
require('../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
47
|
-
require('../../store/state/authMode/authMode.cjs');
|
|
48
|
-
require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
49
49
|
require('../../context/VerificationContext/VerificationContext.cjs');
|
|
50
50
|
require('react-dom');
|
|
51
51
|
require('../../utils/functions/compareChains/compareChains.cjs');
|
|
@@ -128,7 +128,7 @@ const BackupUnsuccessfulView = () => {
|
|
|
128
128
|
const supportEmail = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _a === void 0 ? void 0 : _a.supportEmail;
|
|
129
129
|
const supportUrls = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _b === void 0 ? void 0 : _b.supportUrls;
|
|
130
130
|
const hasContactInfo = Boolean(supportEmail || Object.keys(supportUrls || {}).length > 0);
|
|
131
|
-
const {
|
|
131
|
+
const { handleLogOutWithReason } = useInternalDynamicContext.useInternalDynamicContext();
|
|
132
132
|
const refreshPage = () => {
|
|
133
133
|
window.location.reload();
|
|
134
134
|
};
|
|
@@ -160,7 +160,7 @@ const BackupUnsuccessfulView = () => {
|
|
|
160
160
|
'button-group--with-help-section': hasContactInfo,
|
|
161
161
|
}), children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'logout-button', buttonVariant: 'tertiary', type: 'submit', onClick: () => {
|
|
162
162
|
logger.logger.error('BackupUnsuccessfulView: Could not backup wallet, logging out');
|
|
163
|
-
|
|
163
|
+
handleLogOutWithReason('backup-unsuccessful');
|
|
164
164
|
}, copykey: 'dyn_waas.backup_unsuccessful.log_out', typographyProps: {
|
|
165
165
|
color: 'inherit',
|
|
166
166
|
weight: 'medium',
|
|
@@ -20,8 +20,10 @@ import '@dynamic-labs/sdk-api-core';
|
|
|
20
20
|
import '../../shared/consts/index.js';
|
|
21
21
|
import '../../components/Alert/Alert.js';
|
|
22
22
|
import '../../events/dynamicEvents.js';
|
|
23
|
-
import { useDynamicContext } from '../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
|
|
24
23
|
import '../../context/DynamicContext/DynamicContext.js';
|
|
24
|
+
import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
25
|
+
import '../../store/state/authMode/authMode.js';
|
|
26
|
+
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
25
27
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
26
28
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
27
29
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -40,8 +42,6 @@ import '../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js
|
|
|
40
42
|
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
41
43
|
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
42
44
|
import '../../context/UserWalletsContext/UserWalletsContext.js';
|
|
43
|
-
import '../../store/state/authMode/authMode.js';
|
|
44
|
-
import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
45
45
|
import '../../context/VerificationContext/VerificationContext.js';
|
|
46
46
|
import 'react-dom';
|
|
47
47
|
import '../../utils/functions/compareChains/compareChains.js';
|
|
@@ -124,7 +124,7 @@ const BackupUnsuccessfulView = () => {
|
|
|
124
124
|
const supportEmail = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _a === void 0 ? void 0 : _a.supportEmail;
|
|
125
125
|
const supportUrls = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _b === void 0 ? void 0 : _b.supportUrls;
|
|
126
126
|
const hasContactInfo = Boolean(supportEmail || Object.keys(supportUrls || {}).length > 0);
|
|
127
|
-
const {
|
|
127
|
+
const { handleLogOutWithReason } = useInternalDynamicContext();
|
|
128
128
|
const refreshPage = () => {
|
|
129
129
|
window.location.reload();
|
|
130
130
|
};
|
|
@@ -156,7 +156,7 @@ const BackupUnsuccessfulView = () => {
|
|
|
156
156
|
'button-group--with-help-section': hasContactInfo,
|
|
157
157
|
}), children: jsx(TypographyButton, { buttonClassName: 'logout-button', buttonVariant: 'tertiary', type: 'submit', onClick: () => {
|
|
158
158
|
logger.error('BackupUnsuccessfulView: Could not backup wallet, logging out');
|
|
159
|
-
|
|
159
|
+
handleLogOutWithReason('backup-unsuccessful');
|
|
160
160
|
}, copykey: 'dyn_waas.backup_unsuccessful.log_out', typographyProps: {
|
|
161
161
|
color: 'inherit',
|
|
162
162
|
weight: 'medium',
|
|
@@ -124,7 +124,7 @@ require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
|
124
124
|
|
|
125
125
|
const CollectUserDataView = () => {
|
|
126
126
|
var _a;
|
|
127
|
-
const { appName, projectSettings, network, selectedWalletConnector: walletConnector,
|
|
127
|
+
const { appName, projectSettings, network, selectedWalletConnector: walletConnector, handleLogOutWithReason, onboardingImageUrl, userWithMissingInfo, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
128
128
|
const nameService = useFetchNameService.useFetchNameService();
|
|
129
129
|
const { t } = reactI18next.useTranslation();
|
|
130
130
|
if (!userWithMissingInfo) {
|
|
@@ -139,7 +139,7 @@ const CollectUserDataView = () => {
|
|
|
139
139
|
'collect-user-data__form--error': shouldDisplayWrongNetworkState,
|
|
140
140
|
}), 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: shouldDisplayWrongNetworkState, userProfile: userWithMissingInfo, children: shouldDisplayWrongNetworkState ? (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) ||
|
|
141
141
|
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) ||
|
|
142
|
-
t('dyn_collect_user_data.description') })] })) }), jsxRuntime.jsx(TextButton.TextButton, { className: 'collect-user-data__log-out', onClick:
|
|
142
|
+
t('dyn_collect_user_data.description') })] })) }), jsxRuntime.jsx(TextButton.TextButton, { className: 'collect-user-data__log-out', onClick: () => handleLogOutWithReason('user-data-collection-cancelled'), copykey: 'dyn_collect_user_data.log_out_button', children: t('dyn_collect_user_data.log_out_button') })] })] }));
|
|
143
143
|
};
|
|
144
144
|
|
|
145
145
|
exports.CollectUserDataView = CollectUserDataView;
|
|
@@ -120,7 +120,7 @@ import '../../components/Popper/PopperContext/PopperContext.js';
|
|
|
120
120
|
|
|
121
121
|
const CollectUserDataView = () => {
|
|
122
122
|
var _a;
|
|
123
|
-
const { appName, projectSettings, network, selectedWalletConnector: walletConnector,
|
|
123
|
+
const { appName, projectSettings, network, selectedWalletConnector: walletConnector, handleLogOutWithReason, onboardingImageUrl, userWithMissingInfo, } = useInternalDynamicContext();
|
|
124
124
|
const nameService = useFetchNameService();
|
|
125
125
|
const { t } = useTranslation();
|
|
126
126
|
if (!userWithMissingInfo) {
|
|
@@ -135,7 +135,7 @@ const CollectUserDataView = () => {
|
|
|
135
135
|
'collect-user-data__form--error': shouldDisplayWrongNetworkState,
|
|
136
136
|
}), children: [jsx("div", { className: 'collect-user-data__success-icon', children: jsx(Icon, { color: 'text-primary', size: 'large', children: jsx(SvgCheckConnection, {}) }) }), jsx(OnboardingUserDataForm, { disableSubmit: shouldDisplayWrongNetworkState, userProfile: userWithMissingInfo, children: shouldDisplayWrongNetworkState ? (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) ||
|
|
137
137
|
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) ||
|
|
138
|
-
t('dyn_collect_user_data.description') })] })) }), jsx(TextButton, { className: 'collect-user-data__log-out', onClick:
|
|
138
|
+
t('dyn_collect_user_data.description') })] })) }), jsx(TextButton, { className: 'collect-user-data__log-out', onClick: () => handleLogOutWithReason('user-data-collection-cancelled'), copykey: 'dyn_collect_user_data.log_out_button', children: t('dyn_collect_user_data.log_out_button') })] })] }));
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
export { CollectUserDataView };
|
|
@@ -119,14 +119,14 @@ require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
|
119
119
|
|
|
120
120
|
const CollectUserDataViewNoWallet = ({ userIdentification, userIdentificationOverride }) => {
|
|
121
121
|
var _a;
|
|
122
|
-
const { appName,
|
|
122
|
+
const { appName, handleLogOutWithReason, projectSettings, onboardingImageUrl, userWithMissingInfo, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
123
123
|
const { t } = reactI18next.useTranslation();
|
|
124
124
|
if (!userWithMissingInfo) {
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
127
127
|
return (jsxRuntime.jsxs("div", { className: 'collect-user-data-login-no-wallet', "data-testid": 'collect-user-data-login-no-wallet', children: [onboardingImageUrl && (jsxRuntime.jsx("img", { className: 'collect-user-data-login-no-wallet__main-img', src: onboardingImageUrl, alt: 'onboarding' })), jsxRuntime.jsxs("div", { className: 'collect-user-data-login-no-wallet__user-info-container', children: [jsxRuntime.jsx("div", { className: 'collect-user-data-login-no-wallet__icon-container', children: jsxRuntime.jsx(UserAvatar.UserAvatar, { user: userWithMissingInfo }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', className: 'collect-user-data-login-no-wallet__user-identification', children: (_a = userIdentificationOverride !== null && userIdentificationOverride !== void 0 ? userIdentificationOverride : userWithMissingInfo[userIdentification]) !== null && _a !== void 0 ? _a : getUserIdentifier.getUserIdentifier(userWithMissingInfo) })] }), jsxRuntime.jsxs("div", { className: 'collect-user-data-login-no-wallet__form', children: [jsxRuntime.jsx("div", { className: 'collect-user-data-login-no-wallet__success-icon', children: jsxRuntime.jsx(Icon.Icon, { color: 'text-primary', size: 'large', children: jsxRuntime.jsx(checkConnection.ReactComponent, {}) }) }), jsxRuntime.jsx(OnboardingUserDataForm.OnboardingUserDataForm, { userProfile: userWithMissingInfo, children: jsxRuntime.jsxs("div", { className: 'collect-user-data-login-no-wallet__welcome-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'collect-user-data-login-no-wallet__welcome-title', copykey: 'dyn_collect_user_data.greeting', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeHeader) ||
|
|
128
128
|
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) ||
|
|
129
|
-
t('dyn_collect_user_data.description') })] }) }), jsxRuntime.jsx(TextButton.TextButton, { className: 'collect-user-data-login-no-wallet__log-out', onClick:
|
|
129
|
+
t('dyn_collect_user_data.description') })] }) }), jsxRuntime.jsx(TextButton.TextButton, { className: 'collect-user-data-login-no-wallet__log-out', onClick: () => handleLogOutWithReason('user-data-collection-cancelled'), copykey: 'dyn_collect_user_data.log_out_button', children: t('dyn_collect_user_data.log_out_button') })] })] }));
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
exports.CollectUserDataViewNoWallet = CollectUserDataViewNoWallet;
|
|
@@ -115,14 +115,14 @@ import '../../components/Popper/PopperContext/PopperContext.js';
|
|
|
115
115
|
|
|
116
116
|
const CollectUserDataViewNoWallet = ({ userIdentification, userIdentificationOverride }) => {
|
|
117
117
|
var _a;
|
|
118
|
-
const { appName,
|
|
118
|
+
const { appName, handleLogOutWithReason, projectSettings, onboardingImageUrl, userWithMissingInfo, } = useInternalDynamicContext();
|
|
119
119
|
const { t } = useTranslation();
|
|
120
120
|
if (!userWithMissingInfo) {
|
|
121
121
|
return null;
|
|
122
122
|
}
|
|
123
123
|
return (jsxs("div", { className: 'collect-user-data-login-no-wallet', "data-testid": 'collect-user-data-login-no-wallet', children: [onboardingImageUrl && (jsx("img", { className: 'collect-user-data-login-no-wallet__main-img', src: onboardingImageUrl, alt: 'onboarding' })), jsxs("div", { className: 'collect-user-data-login-no-wallet__user-info-container', children: [jsx("div", { className: 'collect-user-data-login-no-wallet__icon-container', children: jsx(UserAvatar, { user: userWithMissingInfo }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', className: 'collect-user-data-login-no-wallet__user-identification', children: (_a = userIdentificationOverride !== null && userIdentificationOverride !== void 0 ? userIdentificationOverride : userWithMissingInfo[userIdentification]) !== null && _a !== void 0 ? _a : getUserIdentifier(userWithMissingInfo) })] }), jsxs("div", { className: 'collect-user-data-login-no-wallet__form', children: [jsx("div", { className: 'collect-user-data-login-no-wallet__success-icon', children: jsx(Icon, { color: 'text-primary', size: 'large', children: jsx(SvgCheckConnection, {}) }) }), jsx(OnboardingUserDataForm, { userProfile: userWithMissingInfo, children: jsxs("div", { className: 'collect-user-data-login-no-wallet__welcome-container', children: [jsx(Typography, { variant: 'title', color: 'primary', className: 'collect-user-data-login-no-wallet__welcome-title', copykey: 'dyn_collect_user_data.greeting', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeHeader) ||
|
|
124
124
|
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) ||
|
|
125
|
-
t('dyn_collect_user_data.description') })] }) }), jsx(TextButton, { className: 'collect-user-data-login-no-wallet__log-out', onClick:
|
|
125
|
+
t('dyn_collect_user_data.description') })] }) }), jsx(TextButton, { className: 'collect-user-data-login-no-wallet__log-out', onClick: () => handleLogOutWithReason('user-data-collection-cancelled'), copykey: 'dyn_collect_user_data.log_out_button', children: t('dyn_collect_user_data.log_out_button') })] })] }));
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
export { CollectUserDataViewNoWallet };
|
|
@@ -116,7 +116,7 @@ require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
|
116
116
|
|
|
117
117
|
const DeviceRegistrationView = () => {
|
|
118
118
|
const { t } = reactI18next.useTranslation();
|
|
119
|
-
const {
|
|
119
|
+
const { handleLogOutWithReason, setShowAuthFlow, clearStatesOnBackClick } = useInternalDynamicContext.useInternalDynamicContext();
|
|
120
120
|
const user = useUser.useUser();
|
|
121
121
|
const dynamicClient = client.useDynamicClient();
|
|
122
122
|
utils.assertDefined(user === null || user === void 0 ? void 0 : user.email, 'User email is not defined');
|
|
@@ -134,7 +134,7 @@ const DeviceRegistrationView = () => {
|
|
|
134
134
|
setShowAuthFlow(false);
|
|
135
135
|
},
|
|
136
136
|
}, dynamicClient), [dynamicClient, setShowAuthFlow, clearStatesOnBackClick]);
|
|
137
|
-
return (jsxRuntime.jsxs("div", { className: 'device-registration-view', "data-testid": 'device-registration-view', children: [jsxRuntime.jsx("div", { className: 'device-registration-view__icon', children: jsxRuntime.jsx(securityAlert.ReactComponent, { width: 55, height: 64 }) }), jsxRuntime.jsx(Typography.Typography, { weight: 'regular', variant: 'body_normal', color: 'secondary', copykey: 'dyn_device_registration.description', children: t('dyn_device_registration.description', { email: user.email }) }), jsxRuntime.jsx(TextButton.TextButton, { className: 'device-registration-view__logout-button', onClick:
|
|
137
|
+
return (jsxRuntime.jsxs("div", { className: 'device-registration-view', "data-testid": 'device-registration-view', children: [jsxRuntime.jsx("div", { className: 'device-registration-view__icon', children: jsxRuntime.jsx(securityAlert.ReactComponent, { width: 55, height: 64 }) }), jsxRuntime.jsx(Typography.Typography, { weight: 'regular', variant: 'body_normal', color: 'secondary', copykey: 'dyn_device_registration.description', children: t('dyn_device_registration.description', { email: user.email }) }), jsxRuntime.jsx(TextButton.TextButton, { className: 'device-registration-view__logout-button', onClick: () => handleLogOutWithReason('auth-cancelled'), copykey: 'dyn_device_registration.logout', children: t('dyn_device_registration.logout') })] }));
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
exports.DeviceRegistrationView = DeviceRegistrationView;
|
|
@@ -112,7 +112,7 @@ import '../../components/Popper/PopperContext/PopperContext.js';
|
|
|
112
112
|
|
|
113
113
|
const DeviceRegistrationView = () => {
|
|
114
114
|
const { t } = useTranslation();
|
|
115
|
-
const {
|
|
115
|
+
const { handleLogOutWithReason, setShowAuthFlow, clearStatesOnBackClick } = useInternalDynamicContext();
|
|
116
116
|
const user = useUser();
|
|
117
117
|
const dynamicClient = useDynamicClient();
|
|
118
118
|
assertDefined(user === null || user === void 0 ? void 0 : user.email, 'User email is not defined');
|
|
@@ -130,7 +130,7 @@ const DeviceRegistrationView = () => {
|
|
|
130
130
|
setShowAuthFlow(false);
|
|
131
131
|
},
|
|
132
132
|
}, dynamicClient), [dynamicClient, setShowAuthFlow, clearStatesOnBackClick]);
|
|
133
|
-
return (jsxs("div", { className: 'device-registration-view', "data-testid": 'device-registration-view', children: [jsx("div", { className: 'device-registration-view__icon', children: jsx(SvgSecurityAlert, { width: 55, height: 64 }) }), jsx(Typography, { weight: 'regular', variant: 'body_normal', color: 'secondary', copykey: 'dyn_device_registration.description', children: t('dyn_device_registration.description', { email: user.email }) }), jsx(TextButton, { className: 'device-registration-view__logout-button', onClick:
|
|
133
|
+
return (jsxs("div", { className: 'device-registration-view', "data-testid": 'device-registration-view', children: [jsx("div", { className: 'device-registration-view__icon', children: jsx(SvgSecurityAlert, { width: 55, height: 64 }) }), jsx(Typography, { weight: 'regular', variant: 'body_normal', color: 'secondary', copykey: 'dyn_device_registration.description', children: t('dyn_device_registration.description', { email: user.email }) }), jsx(TextButton, { className: 'device-registration-view__logout-button', onClick: () => handleLogOutWithReason('auth-cancelled'), copykey: 'dyn_device_registration.logout', children: t('dyn_device_registration.logout') })] }));
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
export { DeviceRegistrationView };
|
|
@@ -141,7 +141,7 @@ require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
|
141
141
|
const SECONDS_TO_RETRY = 15;
|
|
142
142
|
const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _showRetryButton = true, showTransferMessage: _showTransferMessage = false, }) => {
|
|
143
143
|
var _a, _b, _c, _d;
|
|
144
|
-
const { environmentId,
|
|
144
|
+
const { environmentId, handleLogOutWithReason, setShowAuthFlow, projectSettings, user, userWithMissingInfo, walletConnectorOptions, primaryWallet, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
145
145
|
const { pushView, clearStackAndPushInitialView } = ViewContext.useViewContext();
|
|
146
146
|
const { error, setError, setErrorMessage } = ErrorContext.useErrorContext();
|
|
147
147
|
const { loading, setLoading } = LoadingContext.useLoadingContext();
|
|
@@ -372,7 +372,7 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
|
|
|
372
372
|
}, []);
|
|
373
373
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [error && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { withIcon: false, className: 'email-verification__error-message', children: error })), jsxRuntime.jsxs("div", { className: classNames.classNames('email-verification__container', {
|
|
374
374
|
'email-verification__container--error': Boolean(error),
|
|
375
|
-
}), children: [showTransferMessage && (jsxRuntime.jsx("div", { className: 'email-verification__transfer-message', copykey: 'dyn_otp_verification.email.complete', children: t('dyn_otp_verification.email.complete') })), isValidated ? (jsxRuntime.jsx("div", { className: 'email-verification__icon-container', children: jsxRuntime.jsx(IconWithStatus.IconWithStatus, { containerClassName: 'email-verification__icon--verified', Icon: EmailIcon, iconSize: 64, InnerIcon: check.ReactComponent }) })) : (jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: EmailIcon, iconSize: 96, isSpinning: true, className: 'email-verification__icon-with-spinner' })), jsxRuntime.jsxs("div", { className: 'email-verification__copy-text-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_otp_verification.description', children: t('dyn_otp_verification.description') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', color: 'secondary', children: shortenEmail.shortenEmail(email$1) })] }), jsxRuntime.jsx(PinField.PinField, { initialValue: Array(6).fill(''), isLoading: loading, handleComplete: handleEmailVerification, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: () => setError(undefined) }), showRetryButton && (jsxRuntime.jsx(RetrySendVerificationCodeSection.RetrySendVerificationCodeSection, { className: 'email-verification__retry-container', retryHandler: handleRetry, secondsToRetry: SECONDS_TO_RETRY })), (user || userWithMissingInfo) && !isEmailRecoveryFlow && (jsxRuntime.jsx(TextButton.TextButton, { className: 'email-verification__log-out', onClick:
|
|
375
|
+
}), children: [showTransferMessage && (jsxRuntime.jsx("div", { className: 'email-verification__transfer-message', copykey: 'dyn_otp_verification.email.complete', children: t('dyn_otp_verification.email.complete') })), isValidated ? (jsxRuntime.jsx("div", { className: 'email-verification__icon-container', children: jsxRuntime.jsx(IconWithStatus.IconWithStatus, { containerClassName: 'email-verification__icon--verified', Icon: EmailIcon, iconSize: 64, InnerIcon: check.ReactComponent }) })) : (jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: EmailIcon, iconSize: 96, isSpinning: true, className: 'email-verification__icon-with-spinner' })), jsxRuntime.jsxs("div", { className: 'email-verification__copy-text-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_otp_verification.description', children: t('dyn_otp_verification.description') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', color: 'secondary', children: shortenEmail.shortenEmail(email$1) })] }), jsxRuntime.jsx(PinField.PinField, { initialValue: Array(6).fill(''), isLoading: loading, handleComplete: handleEmailVerification, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: () => setError(undefined) }), showRetryButton && (jsxRuntime.jsx(RetrySendVerificationCodeSection.RetrySendVerificationCodeSection, { className: 'email-verification__retry-container', retryHandler: handleRetry, secondsToRetry: SECONDS_TO_RETRY })), (user || userWithMissingInfo) && !isEmailRecoveryFlow && (jsxRuntime.jsx(TextButton.TextButton, { className: 'email-verification__log-out', onClick: () => handleLogOutWithReason('auth-cancelled'), copykey: 'dyn_otp_verification.log_out_button', children: t('dyn_otp_verification.log_out_button') }))] })] }));
|
|
376
376
|
};
|
|
377
377
|
|
|
378
378
|
exports.EmailVerification = EmailVerification;
|
|
@@ -137,7 +137,7 @@ import '../../components/Popper/PopperContext/PopperContext.js';
|
|
|
137
137
|
const SECONDS_TO_RETRY = 15;
|
|
138
138
|
const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _showRetryButton = true, showTransferMessage: _showTransferMessage = false, }) => {
|
|
139
139
|
var _a, _b, _c, _d;
|
|
140
|
-
const { environmentId,
|
|
140
|
+
const { environmentId, handleLogOutWithReason, setShowAuthFlow, projectSettings, user, userWithMissingInfo, walletConnectorOptions, primaryWallet, } = useInternalDynamicContext();
|
|
141
141
|
const { pushView, clearStackAndPushInitialView } = useViewContext();
|
|
142
142
|
const { error, setError, setErrorMessage } = useErrorContext();
|
|
143
143
|
const { loading, setLoading } = useLoadingContext();
|
|
@@ -368,7 +368,7 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
|
|
|
368
368
|
}, []);
|
|
369
369
|
return (jsxs(Fragment, { children: [error && (jsx(ErrorContainer, { withIcon: false, className: 'email-verification__error-message', children: error })), jsxs("div", { className: classNames('email-verification__container', {
|
|
370
370
|
'email-verification__container--error': Boolean(error),
|
|
371
|
-
}), children: [showTransferMessage && (jsx("div", { className: 'email-verification__transfer-message', copykey: 'dyn_otp_verification.email.complete', children: t('dyn_otp_verification.email.complete') })), isValidated ? (jsx("div", { className: 'email-verification__icon-container', children: jsx(IconWithStatus, { containerClassName: 'email-verification__icon--verified', Icon: EmailIcon, iconSize: 64, InnerIcon: SvgCheck }) })) : (jsx(IconWithSpinner, { Icon: EmailIcon, iconSize: 96, isSpinning: true, className: 'email-verification__icon-with-spinner' })), jsxs("div", { className: 'email-verification__copy-text-container', children: [jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_otp_verification.description', children: t('dyn_otp_verification.description') }), jsx(Typography, { variant: 'body_normal', weight: 'bold', color: 'secondary', children: shortenEmail(email) })] }), jsx(PinField, { initialValue: Array(6).fill(''), isLoading: loading, handleComplete: handleEmailVerification, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: () => setError(undefined) }), showRetryButton && (jsx(RetrySendVerificationCodeSection, { className: 'email-verification__retry-container', retryHandler: handleRetry, secondsToRetry: SECONDS_TO_RETRY })), (user || userWithMissingInfo) && !isEmailRecoveryFlow && (jsx(TextButton, { className: 'email-verification__log-out', onClick:
|
|
371
|
+
}), children: [showTransferMessage && (jsx("div", { className: 'email-verification__transfer-message', copykey: 'dyn_otp_verification.email.complete', children: t('dyn_otp_verification.email.complete') })), isValidated ? (jsx("div", { className: 'email-verification__icon-container', children: jsx(IconWithStatus, { containerClassName: 'email-verification__icon--verified', Icon: EmailIcon, iconSize: 64, InnerIcon: SvgCheck }) })) : (jsx(IconWithSpinner, { Icon: EmailIcon, iconSize: 96, isSpinning: true, className: 'email-verification__icon-with-spinner' })), jsxs("div", { className: 'email-verification__copy-text-container', children: [jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_otp_verification.description', children: t('dyn_otp_verification.description') }), jsx(Typography, { variant: 'body_normal', weight: 'bold', color: 'secondary', children: shortenEmail(email) })] }), jsx(PinField, { initialValue: Array(6).fill(''), isLoading: loading, handleComplete: handleEmailVerification, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: () => setError(undefined) }), showRetryButton && (jsx(RetrySendVerificationCodeSection, { className: 'email-verification__retry-container', retryHandler: handleRetry, secondsToRetry: SECONDS_TO_RETRY })), (user || userWithMissingInfo) && !isEmailRecoveryFlow && (jsx(TextButton, { className: 'email-verification__log-out', onClick: () => handleLogOutWithReason('auth-cancelled'), copykey: 'dyn_otp_verification.log_out_button', children: t('dyn_otp_verification.log_out_button') }))] })] }));
|
|
372
372
|
};
|
|
373
373
|
|
|
374
374
|
export { EmailVerification };
|
|
@@ -120,7 +120,7 @@ require('../../components/Popper/Popper/Popper.cjs');
|
|
|
120
120
|
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
121
121
|
|
|
122
122
|
const EmbeddedDeleteView = () => {
|
|
123
|
-
const { primaryWallet, setShowAuthFlow, environmentId,
|
|
123
|
+
const { primaryWallet, setShowAuthFlow, environmentId, handleLogOutWithReason, user, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
124
124
|
const [isAcknowledgementChecked, setIsAcknowledgementChecked] = React.useState(false);
|
|
125
125
|
const [error, setError] = React.useState(undefined);
|
|
126
126
|
const { t } = reactI18next.useTranslation();
|
|
@@ -162,7 +162,7 @@ const EmbeddedDeleteView = () => {
|
|
|
162
162
|
deleteEmbeddedWalletsRequest: signedDeleteWalletsRequest,
|
|
163
163
|
environmentId,
|
|
164
164
|
});
|
|
165
|
-
|
|
165
|
+
handleLogOutWithReason('user-deleted');
|
|
166
166
|
}
|
|
167
167
|
catch (error) {
|
|
168
168
|
setError(error);
|
|
@@ -116,7 +116,7 @@ import '../../components/Popper/Popper/Popper.js';
|
|
|
116
116
|
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
117
117
|
|
|
118
118
|
const EmbeddedDeleteView = () => {
|
|
119
|
-
const { primaryWallet, setShowAuthFlow, environmentId,
|
|
119
|
+
const { primaryWallet, setShowAuthFlow, environmentId, handleLogOutWithReason, user, } = useInternalDynamicContext();
|
|
120
120
|
const [isAcknowledgementChecked, setIsAcknowledgementChecked] = useState(false);
|
|
121
121
|
const [error, setError] = useState(undefined);
|
|
122
122
|
const { t } = useTranslation();
|
|
@@ -158,7 +158,7 @@ const EmbeddedDeleteView = () => {
|
|
|
158
158
|
deleteEmbeddedWalletsRequest: signedDeleteWalletsRequest,
|
|
159
159
|
environmentId,
|
|
160
160
|
});
|
|
161
|
-
|
|
161
|
+
handleLogOutWithReason('user-deleted');
|
|
162
162
|
}
|
|
163
163
|
catch (error) {
|
|
164
164
|
setError(error);
|