@dynamic-labs/sdk-react-core 4.18.5 → 4.18.6
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 +14 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/index.cjs +2 -1
- package/src/index.js +2 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +7 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +8 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +1 -0
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +2 -1
- package/src/lib/context/OnrampContext/OnrampContext.cjs +30 -24
- package/src/lib/context/OnrampContext/OnrampContext.d.ts +1 -1
- package/src/lib/context/OnrampContext/OnrampContext.js +30 -24
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +8 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +9 -1
- package/src/lib/locale/en/translation.cjs +1 -1
- package/src/lib/locale/en/translation.js +1 -1
- package/src/lib/store/state/user/user.cjs +0 -7
- package/src/lib/store/state/user/user.js +0 -7
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.cjs +3 -0
- package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.js +3 -0
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +30 -3
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +31 -4
- package/src/lib/utils/hooks/useGlobalLoading/useGlobalLoading.cjs +7 -0
- package/src/lib/utils/hooks/useGlobalLoading/useGlobalLoading.js +7 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +8 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +9 -1
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +98 -14
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +98 -14
- package/src/lib/views/EmbeddedReveal/utils/waasExport/index.d.ts +1 -0
- package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.cjs +53 -0
- package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.d.ts +11 -0
- package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.js +48 -0
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.cjs +3 -2
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.js +3 -2
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +5 -2
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +5 -2
|
@@ -54,6 +54,9 @@ const getOauthLoginUrl = (providers, providerType) => {
|
|
|
54
54
|
delete baseProps.client_id;
|
|
55
55
|
baseProps.client_key = provider.clientId;
|
|
56
56
|
}
|
|
57
|
+
if (providerType === sdkApiCore.ProviderEnum.Google) {
|
|
58
|
+
baseProps.access_type = 'offline';
|
|
59
|
+
}
|
|
57
60
|
if (provider.scopes) {
|
|
58
61
|
baseProps.scope = provider.scopes;
|
|
59
62
|
}
|
|
@@ -50,6 +50,9 @@ const getOauthLoginUrl = (providers, providerType) => {
|
|
|
50
50
|
delete baseProps.client_id;
|
|
51
51
|
baseProps.client_key = provider.clientId;
|
|
52
52
|
}
|
|
53
|
+
if (providerType === ProviderEnum.Google) {
|
|
54
|
+
baseProps.access_type = 'offline';
|
|
55
|
+
}
|
|
53
56
|
if (provider.scopes) {
|
|
54
57
|
baseProps.scope = provider.scopes;
|
|
55
58
|
}
|
|
@@ -45,6 +45,10 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
45
45
|
const decodedSessionKeys = sessionKeysSS
|
|
46
46
|
? JSON.parse(Buffer.from(sessionKeysSS, 'base64').toString())
|
|
47
47
|
: undefined;
|
|
48
|
+
utils.tracing.logEvent('session-key', 'registerEmbeddedWalletSessionKey', utils.tracing.formatObject({
|
|
49
|
+
hasDecodedSessionKeys: Boolean(decodedSessionKeys),
|
|
50
|
+
publicKey: decodedSessionKeys === null || decodedSessionKeys === void 0 ? void 0 : decodedSessionKeys.publicKey,
|
|
51
|
+
}));
|
|
48
52
|
if (!decodedSessionKeys) {
|
|
49
53
|
walletConnectorCore.logger.warn('Could not find session keys. Re-authentication is required to create new session keys.');
|
|
50
54
|
dynamicEvents.dynamicEvents.emit('triggerLogout');
|
|
@@ -53,12 +57,20 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
53
57
|
if (!user$1) {
|
|
54
58
|
throw new Error('User not found');
|
|
55
59
|
}
|
|
56
|
-
|
|
60
|
+
const isSessionKeyValid = decodedSessionKeys.expirationDate &&
|
|
57
61
|
new Date() <= new Date(decodedSessionKeys.expirationDate) &&
|
|
58
|
-
!ignoreRestore
|
|
62
|
+
!ignoreRestore;
|
|
63
|
+
utils.tracing.logEvent('session-key', 'isSessionKeyValid', utils.tracing.formatObject({
|
|
64
|
+
isSessionKeyValid: Boolean(isSessionKeyValid),
|
|
65
|
+
}));
|
|
66
|
+
if (isSessionKeyValid) {
|
|
59
67
|
// scenario 3
|
|
60
68
|
return decodedSessionKeys;
|
|
61
69
|
}
|
|
70
|
+
utils.tracing.logEvent('session-key', 'decodedSessionKeys', utils.tracing.formatObject({
|
|
71
|
+
publicKey: decodedSessionKeys.publicKey,
|
|
72
|
+
registered: decodedSessionKeys.registered,
|
|
73
|
+
}));
|
|
62
74
|
let publicKey;
|
|
63
75
|
let privateKey;
|
|
64
76
|
let privateKeyJwk;
|
|
@@ -74,6 +86,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
74
86
|
privateKey = nextPrivateKey;
|
|
75
87
|
privateKeyJwk = nextPrivateKeyJwk;
|
|
76
88
|
prevSessionKeySignature = yield utils$1.p256Sign(decodedSessionKeys.privateKeyJwk, user$1.sessionId);
|
|
89
|
+
utils.tracing.logEvent('session-key', 'Loaded prevSessionKeySignature', utils.tracing.formatObject({ nextPublicKey, prevSessionKeySignature }));
|
|
77
90
|
}
|
|
78
91
|
let resp;
|
|
79
92
|
const primaryWalletId$1 = primaryWalletId.getPrimaryWalletId();
|
|
@@ -99,12 +112,19 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
99
112
|
throw error;
|
|
100
113
|
}
|
|
101
114
|
const expirationDate = new Date(resp.expiresAt * 1000);
|
|
115
|
+
utils.tracing.logEvent('session-key', 'Created new session key', utils.tracing.formatObject({
|
|
116
|
+
expirationDate,
|
|
117
|
+
publicKey,
|
|
118
|
+
}));
|
|
102
119
|
utils.StorageService.setItem(localStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS, toEncodedFormat(publicKey, privateKey, privateKeyJwk, true, expirationDate), localStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
|
|
103
120
|
return { expirationDate, privateKey, publicKey };
|
|
104
121
|
});
|
|
105
122
|
const generateSessionKey = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
106
123
|
const { private: privateKey, public: publicKey, privateJwk, } = yield utils$1.p256Keygen();
|
|
107
124
|
// convert to base64 and store the session keys in session storage
|
|
125
|
+
utils.tracing.logEvent('session-key', 'Generated new session key', utils.tracing.formatObject({
|
|
126
|
+
publicKey,
|
|
127
|
+
}));
|
|
108
128
|
utils.StorageService.setItem(localStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS, toEncodedFormat(publicKey, privateKey, privateJwk, false), localStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
|
|
109
129
|
return { privateKey, privateKeyJwk: privateJwk, publicKey };
|
|
110
130
|
});
|
|
@@ -114,8 +134,12 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
114
134
|
? JSON.parse(Buffer.from(sessionKeysSS, 'base64').toString())
|
|
115
135
|
: undefined;
|
|
116
136
|
if (!(decodedSessionKeys === null || decodedSessionKeys === void 0 ? void 0 : decodedSessionKeys.publicKey)) {
|
|
137
|
+
utils.tracing.logEvent('session-key', 'getSessionPublicKey', 'Could not find session keys.');
|
|
117
138
|
throw new Error('Could not find session keys.');
|
|
118
139
|
}
|
|
140
|
+
utils.tracing.logEvent('session-key', 'getSessionPublicKey', utils.tracing.formatObject({
|
|
141
|
+
publicKey: decodedSessionKeys === null || decodedSessionKeys === void 0 ? void 0 : decodedSessionKeys.publicKey,
|
|
142
|
+
}));
|
|
119
143
|
return decodedSessionKeys === null || decodedSessionKeys === void 0 ? void 0 : decodedSessionKeys.publicKey;
|
|
120
144
|
};
|
|
121
145
|
// this is a temporary fix to ensure that session keys are registered on signin for all wallets
|
|
@@ -133,7 +157,10 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
133
157
|
const sessionKeysString = JSON.stringify(sessionKeys);
|
|
134
158
|
return Buffer.from(sessionKeysString).toString('base64');
|
|
135
159
|
};
|
|
136
|
-
const removeSessionKey = React.useCallback(() =>
|
|
160
|
+
const removeSessionKey = React.useCallback(() => {
|
|
161
|
+
utils.tracing.logEvent('session-key', 'removeSessionKey');
|
|
162
|
+
utils.StorageService.removeItem(localStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS, localStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
|
|
163
|
+
}, []);
|
|
137
164
|
return {
|
|
138
165
|
generateSessionKey,
|
|
139
166
|
getSessionPublicKey,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
|
-
import { StorageService, InvalidEmbeddedWalletSessionKeyError } from '@dynamic-labs/utils';
|
|
4
|
+
import { tracing, StorageService, InvalidEmbeddedWalletSessionKeyError } from '@dynamic-labs/utils';
|
|
5
5
|
import { logger } from '@dynamic-labs/wallet-connector-core';
|
|
6
6
|
import { SECURE_ENCLAVE_WALLET_SESSION_KEYS, SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS } from '../../constants/localStorage.js';
|
|
7
7
|
import { p256Sign, p256Keygen } from '../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/utils.js';
|
|
@@ -41,6 +41,10 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
41
41
|
const decodedSessionKeys = sessionKeysSS
|
|
42
42
|
? JSON.parse(Buffer.from(sessionKeysSS, 'base64').toString())
|
|
43
43
|
: undefined;
|
|
44
|
+
tracing.logEvent('session-key', 'registerEmbeddedWalletSessionKey', tracing.formatObject({
|
|
45
|
+
hasDecodedSessionKeys: Boolean(decodedSessionKeys),
|
|
46
|
+
publicKey: decodedSessionKeys === null || decodedSessionKeys === void 0 ? void 0 : decodedSessionKeys.publicKey,
|
|
47
|
+
}));
|
|
44
48
|
if (!decodedSessionKeys) {
|
|
45
49
|
logger.warn('Could not find session keys. Re-authentication is required to create new session keys.');
|
|
46
50
|
dynamicEvents.emit('triggerLogout');
|
|
@@ -49,12 +53,20 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
49
53
|
if (!user) {
|
|
50
54
|
throw new Error('User not found');
|
|
51
55
|
}
|
|
52
|
-
|
|
56
|
+
const isSessionKeyValid = decodedSessionKeys.expirationDate &&
|
|
53
57
|
new Date() <= new Date(decodedSessionKeys.expirationDate) &&
|
|
54
|
-
!ignoreRestore
|
|
58
|
+
!ignoreRestore;
|
|
59
|
+
tracing.logEvent('session-key', 'isSessionKeyValid', tracing.formatObject({
|
|
60
|
+
isSessionKeyValid: Boolean(isSessionKeyValid),
|
|
61
|
+
}));
|
|
62
|
+
if (isSessionKeyValid) {
|
|
55
63
|
// scenario 3
|
|
56
64
|
return decodedSessionKeys;
|
|
57
65
|
}
|
|
66
|
+
tracing.logEvent('session-key', 'decodedSessionKeys', tracing.formatObject({
|
|
67
|
+
publicKey: decodedSessionKeys.publicKey,
|
|
68
|
+
registered: decodedSessionKeys.registered,
|
|
69
|
+
}));
|
|
58
70
|
let publicKey;
|
|
59
71
|
let privateKey;
|
|
60
72
|
let privateKeyJwk;
|
|
@@ -70,6 +82,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
70
82
|
privateKey = nextPrivateKey;
|
|
71
83
|
privateKeyJwk = nextPrivateKeyJwk;
|
|
72
84
|
prevSessionKeySignature = yield p256Sign(decodedSessionKeys.privateKeyJwk, user.sessionId);
|
|
85
|
+
tracing.logEvent('session-key', 'Loaded prevSessionKeySignature', tracing.formatObject({ nextPublicKey, prevSessionKeySignature }));
|
|
73
86
|
}
|
|
74
87
|
let resp;
|
|
75
88
|
const primaryWalletId = getPrimaryWalletId();
|
|
@@ -95,12 +108,19 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
95
108
|
throw error;
|
|
96
109
|
}
|
|
97
110
|
const expirationDate = new Date(resp.expiresAt * 1000);
|
|
111
|
+
tracing.logEvent('session-key', 'Created new session key', tracing.formatObject({
|
|
112
|
+
expirationDate,
|
|
113
|
+
publicKey,
|
|
114
|
+
}));
|
|
98
115
|
StorageService.setItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS, toEncodedFormat(publicKey, privateKey, privateKeyJwk, true, expirationDate), SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
|
|
99
116
|
return { expirationDate, privateKey, publicKey };
|
|
100
117
|
});
|
|
101
118
|
const generateSessionKey = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
102
119
|
const { private: privateKey, public: publicKey, privateJwk, } = yield p256Keygen();
|
|
103
120
|
// convert to base64 and store the session keys in session storage
|
|
121
|
+
tracing.logEvent('session-key', 'Generated new session key', tracing.formatObject({
|
|
122
|
+
publicKey,
|
|
123
|
+
}));
|
|
104
124
|
StorageService.setItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS, toEncodedFormat(publicKey, privateKey, privateJwk, false), SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
|
|
105
125
|
return { privateKey, privateKeyJwk: privateJwk, publicKey };
|
|
106
126
|
});
|
|
@@ -110,8 +130,12 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
110
130
|
? JSON.parse(Buffer.from(sessionKeysSS, 'base64').toString())
|
|
111
131
|
: undefined;
|
|
112
132
|
if (!(decodedSessionKeys === null || decodedSessionKeys === void 0 ? void 0 : decodedSessionKeys.publicKey)) {
|
|
133
|
+
tracing.logEvent('session-key', 'getSessionPublicKey', 'Could not find session keys.');
|
|
113
134
|
throw new Error('Could not find session keys.');
|
|
114
135
|
}
|
|
136
|
+
tracing.logEvent('session-key', 'getSessionPublicKey', tracing.formatObject({
|
|
137
|
+
publicKey: decodedSessionKeys === null || decodedSessionKeys === void 0 ? void 0 : decodedSessionKeys.publicKey,
|
|
138
|
+
}));
|
|
115
139
|
return decodedSessionKeys === null || decodedSessionKeys === void 0 ? void 0 : decodedSessionKeys.publicKey;
|
|
116
140
|
};
|
|
117
141
|
// this is a temporary fix to ensure that session keys are registered on signin for all wallets
|
|
@@ -129,7 +153,10 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
129
153
|
const sessionKeysString = JSON.stringify(sessionKeys);
|
|
130
154
|
return Buffer.from(sessionKeysString).toString('base64');
|
|
131
155
|
};
|
|
132
|
-
const removeSessionKey = useCallback(() =>
|
|
156
|
+
const removeSessionKey = useCallback(() => {
|
|
157
|
+
tracing.logEvent('session-key', 'removeSessionKey');
|
|
158
|
+
StorageService.removeItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS, SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
|
|
159
|
+
}, []);
|
|
133
160
|
return {
|
|
134
161
|
generateSessionKey,
|
|
135
162
|
getSessionPublicKey,
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
8
|
+
var utils = require('@dynamic-labs/utils');
|
|
8
9
|
var logger = require('../../../shared/logger.cjs');
|
|
9
10
|
var index = require('../../../shared/utils/functions/lastAuthenticatedAccount/index.cjs');
|
|
10
11
|
var shouldFetchNonce = require('../../../shared/utils/functions/shouldFetchNonce/shouldFetchNonce.cjs');
|
|
@@ -16,6 +17,11 @@ const useGlobalLoading = ({ connectedInfo, connectedWallets, projectSettings, pr
|
|
|
16
17
|
// Once we declare the SDK as loaded, we do not ever want to flip back to false
|
|
17
18
|
const hasLoaded = React.useRef(false);
|
|
18
19
|
const loadingStart = React.useRef(new Date().getTime());
|
|
20
|
+
const didTraceSdkMountedRef = React.useRef(false);
|
|
21
|
+
if (!didTraceSdkMountedRef.current) {
|
|
22
|
+
didTraceSdkMountedRef.current = true;
|
|
23
|
+
utils.tracing.logEvent('sdk-react-core.initialization', 'sdk-mounted');
|
|
24
|
+
}
|
|
19
25
|
const { sessionValidation } = loadingAndLifecycle.useLoadingAndLifecycle();
|
|
20
26
|
const authMode$1 = authMode.useAuthMode();
|
|
21
27
|
const isFetchingNonce = React.useMemo(() => shouldFetchNonce.shouldFetchNonce({
|
|
@@ -31,6 +37,7 @@ const useGlobalLoading = ({ connectedInfo, connectedWallets, projectSettings, pr
|
|
|
31
37
|
primaryWallet,
|
|
32
38
|
user,
|
|
33
39
|
});
|
|
40
|
+
utils.tracing.logEvent('sdk-react-core.initialization', 'sdk-loaded');
|
|
34
41
|
// Calculate how long loading took and emit log
|
|
35
42
|
if (enableInstrumentation) {
|
|
36
43
|
const loadingTime = new Date().getTime() - loadingStart.current;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { useRef, useMemo } from 'react';
|
|
3
3
|
import { isWalletBookPopulated } from '@dynamic-labs/wallet-book';
|
|
4
|
+
import { tracing } from '@dynamic-labs/utils';
|
|
4
5
|
import { logger } from '../../../shared/logger.js';
|
|
5
6
|
import { lastAuthenticatedAccount } from '../../../shared/utils/functions/lastAuthenticatedAccount/index.js';
|
|
6
7
|
import { shouldFetchNonce } from '../../../shared/utils/functions/shouldFetchNonce/shouldFetchNonce.js';
|
|
@@ -12,6 +13,11 @@ const useGlobalLoading = ({ connectedInfo, connectedWallets, projectSettings, pr
|
|
|
12
13
|
// Once we declare the SDK as loaded, we do not ever want to flip back to false
|
|
13
14
|
const hasLoaded = useRef(false);
|
|
14
15
|
const loadingStart = useRef(new Date().getTime());
|
|
16
|
+
const didTraceSdkMountedRef = useRef(false);
|
|
17
|
+
if (!didTraceSdkMountedRef.current) {
|
|
18
|
+
didTraceSdkMountedRef.current = true;
|
|
19
|
+
tracing.logEvent('sdk-react-core.initialization', 'sdk-mounted');
|
|
20
|
+
}
|
|
15
21
|
const { sessionValidation } = useLoadingAndLifecycle();
|
|
16
22
|
const authMode = useAuthMode();
|
|
17
23
|
const isFetchingNonce = useMemo(() => shouldFetchNonce({
|
|
@@ -27,6 +33,7 @@ const useGlobalLoading = ({ connectedInfo, connectedWallets, projectSettings, pr
|
|
|
27
33
|
primaryWallet,
|
|
28
34
|
user,
|
|
29
35
|
});
|
|
36
|
+
tracing.logEvent('sdk-react-core.initialization', 'sdk-loaded');
|
|
30
37
|
// Calculate how long loading took and emit log
|
|
31
38
|
if (enableInstrumentation) {
|
|
32
39
|
const loadingTime = new Date().getTime() - loadingStart.current;
|
|
@@ -203,9 +203,17 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
203
203
|
const completeConnection = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ authMode, provider, state, authCode, captchaToken, verifier, telegramAuthToken, forceCreateUser = false, }) {
|
|
204
204
|
try {
|
|
205
205
|
let sessionPublicKey = undefined;
|
|
206
|
+
utils.tracing.logEvent('oauth', 'completeConnection', utils.tracing.formatObject({
|
|
207
|
+
authMode,
|
|
208
|
+
provider,
|
|
209
|
+
shouldRegisterSessionKeysOnSignin: shouldRegisterSessionKeysOnSignin(),
|
|
210
|
+
}));
|
|
206
211
|
if (shouldRegisterSessionKeysOnSignin()) {
|
|
207
212
|
const keypair = yield generateSessionKey();
|
|
208
213
|
sessionPublicKey = keypair.publicKey;
|
|
214
|
+
utils.tracing.logEvent('oauth', 'completeConnection key generated', utils.tracing.formatObject({
|
|
215
|
+
sessionPublicKey,
|
|
216
|
+
}));
|
|
209
217
|
}
|
|
210
218
|
if (authMode === 'signin') {
|
|
211
219
|
if (provider === sdkApiCore.ProviderEnum.Telegram && telegramAuthToken) {
|
|
@@ -3,7 +3,7 @@ import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { useMemo, useState, useCallback } from 'react';
|
|
4
4
|
import { ProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import { SocialOAuthErrorCode } from '@dynamic-labs/types';
|
|
6
|
-
import { SocialAccountAlreadyExistsError, PlatformService, isMobile, Oauth2Service } from '@dynamic-labs/utils';
|
|
6
|
+
import { SocialAccountAlreadyExistsError, tracing, PlatformService, isMobile, Oauth2Service } from '@dynamic-labs/utils';
|
|
7
7
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
8
8
|
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
9
9
|
import { logger } from '../../../shared/logger.js';
|
|
@@ -199,9 +199,17 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
199
199
|
const completeConnection = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ authMode, provider, state, authCode, captchaToken, verifier, telegramAuthToken, forceCreateUser = false, }) {
|
|
200
200
|
try {
|
|
201
201
|
let sessionPublicKey = undefined;
|
|
202
|
+
tracing.logEvent('oauth', 'completeConnection', tracing.formatObject({
|
|
203
|
+
authMode,
|
|
204
|
+
provider,
|
|
205
|
+
shouldRegisterSessionKeysOnSignin: shouldRegisterSessionKeysOnSignin(),
|
|
206
|
+
}));
|
|
202
207
|
if (shouldRegisterSessionKeysOnSignin()) {
|
|
203
208
|
const keypair = yield generateSessionKey();
|
|
204
209
|
sessionPublicKey = keypair.publicKey;
|
|
210
|
+
tracing.logEvent('oauth', 'completeConnection key generated', tracing.formatObject({
|
|
211
|
+
sessionPublicKey,
|
|
212
|
+
}));
|
|
205
213
|
}
|
|
206
214
|
if (authMode === 'signin') {
|
|
207
215
|
if (provider === ProviderEnum.Telegram && telegramAuthToken) {
|
|
@@ -101,6 +101,7 @@ require('@hcaptcha/react-hcaptcha');
|
|
|
101
101
|
var getProperErrorMessage = require('../../../modals/SignMessageConfirmationModal/getProperErrorMessage.cjs');
|
|
102
102
|
var DynamicWidgetContext = require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
103
103
|
var constants = require('../constants.cjs');
|
|
104
|
+
var waasExport = require('../utils/waasExport/waasExport.cjs');
|
|
104
105
|
require('../../../context/FooterAnimationContext/index.cjs');
|
|
105
106
|
require('../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
106
107
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
@@ -123,6 +124,8 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
123
124
|
const { primaryWallet, user, setShowAuthFlow, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
124
125
|
const { handleAcknowledgeExportPrompt } = useSyncEmbeddedWalletFlow.useSyncEmbeddedWalletFlow();
|
|
125
126
|
const { isTurnkeyWallet } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
127
|
+
//should use useIsWaasWallet hook
|
|
128
|
+
const isWaasWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => { var _a; return (_a = vc.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('dynamicwaas'); });
|
|
126
129
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
127
130
|
const { pushView } = ViewContext.useViewContext();
|
|
128
131
|
const { getEOAWallet, isSmartWallet } = useSmartWallets.useSmartWallets();
|
|
@@ -131,10 +134,17 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
131
134
|
if (!primaryWallet) {
|
|
132
135
|
throw new utils.DynamicError('No primary wallet found', errors.INVALID_WALLET_DATA);
|
|
133
136
|
}
|
|
134
|
-
|
|
137
|
+
let primaryTurnkeyWalletId;
|
|
138
|
+
try {
|
|
139
|
+
primaryTurnkeyWalletId = getPrimaryTurnkeyWalletId.getPrimaryTurnkeyWalletId(primaryWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
// waas wallet
|
|
143
|
+
}
|
|
135
144
|
const walletProperties = (_b = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === primaryTurnkeyWalletId)) === null || _b === void 0 ? void 0 : _b.walletProperties;
|
|
136
145
|
const isTurnkeyHDWallet = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyHDWalletId;
|
|
137
146
|
const wallet = (_c = (primaryWallet && getEOAWallet(primaryWallet))) !== null && _c !== void 0 ? _c : primaryWallet;
|
|
147
|
+
const [showSkeleton, setShowSkeleton] = React.useState(false);
|
|
138
148
|
// eslint-disable-next-line arrow-body-style
|
|
139
149
|
React.useEffect(() => {
|
|
140
150
|
return () => {
|
|
@@ -143,6 +153,11 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
143
153
|
wallet: wallet,
|
|
144
154
|
});
|
|
145
155
|
}
|
|
156
|
+
if (isWaasWallet) {
|
|
157
|
+
waasExport.cleanupExport({
|
|
158
|
+
wallet: wallet,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
146
161
|
};
|
|
147
162
|
// only run once on unmount
|
|
148
163
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -157,11 +172,14 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
157
172
|
if (walletConnectorCore.isSessionKeyCompatibleWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)) {
|
|
158
173
|
yield ((_e = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _e === void 0 ? void 0 : _e.createOrRestoreSession());
|
|
159
174
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
175
|
+
if (isTurnkeyWallet) {
|
|
176
|
+
return turnkeyExport.initExport({
|
|
177
|
+
iframeContainer: iframeContainerElement,
|
|
178
|
+
iframeElementId: constants.iframeElementId,
|
|
179
|
+
wallet: wallet,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return;
|
|
165
183
|
}));
|
|
166
184
|
const { mutate: handleExportWallet, isLoading, error, data, } = useMutation.useMutation(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
167
185
|
var _f, _g, _h;
|
|
@@ -191,6 +209,19 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
191
209
|
});
|
|
192
210
|
}
|
|
193
211
|
}
|
|
212
|
+
if (isWaasWallet) {
|
|
213
|
+
try {
|
|
214
|
+
return yield waasExport.exportWaasCredential({
|
|
215
|
+
address: exportPrivateKey ? wallet === null || wallet === void 0 ? void 0 : wallet.address : undefined,
|
|
216
|
+
iframeContainer: iframeContainerRef.current,
|
|
217
|
+
user,
|
|
218
|
+
wallet: wallet,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
catch (_k) {
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
194
225
|
return undefined;
|
|
195
226
|
}), {
|
|
196
227
|
onFailure: (err) => {
|
|
@@ -223,18 +254,38 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
223
254
|
!error && (jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__zerodev-warning', children: [jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__zerodev-warning__title-row', children: [jsxRuntime.jsx(info.ReactComponent, { className: 'embedded-reveal-view__zerodev-warning__icon' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', copykey: 'dyn_embedded_reveal.aa_warning.title', children: t('dyn_embedded_reveal.aa_warning.title') })] }), jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', weight: 'regular', copykey: 'dyn_embedded_reveal.aa_warning.subtitle', children: [t('dyn_embedded_reveal.aa_warning.subtitle'), jsxRuntime.jsx("button", { onClick: () => {
|
|
224
255
|
setShowAuthFlow(false);
|
|
225
256
|
setDynamicWidgetView('send-balance');
|
|
226
|
-
}, className: 'embedded-reveal-view__zerodev-warning__link-button', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'primary', className: 'underline', copykey: 'dyn_embedded_reveal.aa_warning.button', children: t('dyn_embedded_reveal.aa_warning.button') }) })] })] })), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__description', children: !isLoading && data && !error
|
|
257
|
+
}, className: 'embedded-reveal-view__zerodev-warning__link-button', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'primary', className: 'underline', copykey: 'dyn_embedded_reveal.aa_warning.button', children: t('dyn_embedded_reveal.aa_warning.button') }) })] })] })), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__description', children: !(!isLoading && data && !error) && (jsxRuntime.jsx("div", { className: 'embedded-reveal-view__header', children: jsxRuntime.jsx("div", { className: 'embedded-reveal-view__header__hero', children: jsxRuntime.jsx(exportEmbeddedHero.ReactComponent, {}) }) })) })] }));
|
|
227
258
|
React.useEffect(() => {
|
|
228
259
|
var _a;
|
|
229
260
|
if (((_a = iframeContainerRef === null || iframeContainerRef === void 0 ? void 0 : iframeContainerRef.current) === null || _a === void 0 ? void 0 : _a.children) && data) {
|
|
230
261
|
// eslint-disable-next-line prefer-destructuring
|
|
231
262
|
const iframeElement = iframeContainerRef.current.children[0];
|
|
232
263
|
iframeElement === null || iframeElement === void 0 ? void 0 : iframeElement.setAttribute('style', !isTurnkeyHDWallet || exportPrivateKey
|
|
233
|
-
? 'height:
|
|
234
|
-
: 'height:
|
|
264
|
+
? 'height: 88px; min-height: 88px; width: 100%; border: none; background: transparent; overflow: visible;'
|
|
265
|
+
: 'height: 120px; min-height: 120px; width: 100%; border: none; background: transparent; overflow: visible;');
|
|
266
|
+
}
|
|
267
|
+
}, [
|
|
268
|
+
iframeContainerRef,
|
|
269
|
+
data,
|
|
270
|
+
isTurnkeyHDWallet,
|
|
271
|
+
isWaasWallet,
|
|
272
|
+
exportPrivateKey,
|
|
273
|
+
]);
|
|
274
|
+
React.useEffect(() => {
|
|
275
|
+
if (data) {
|
|
276
|
+
// Show skeleton first
|
|
277
|
+
setShowSkeleton(true);
|
|
278
|
+
// After a delay, hide skeleton and show the iframe
|
|
279
|
+
const timer = setTimeout(() => {
|
|
280
|
+
setShowSkeleton(false);
|
|
281
|
+
}, 2000);
|
|
282
|
+
return () => clearTimeout(timer);
|
|
235
283
|
}
|
|
236
|
-
|
|
237
|
-
|
|
284
|
+
return;
|
|
285
|
+
}, [data]);
|
|
286
|
+
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { onClick: () => {
|
|
287
|
+
setShowAuthFlow(false);
|
|
288
|
+
}, type: 'button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
238
289
|
const hasInjectedCredential = !isLoading && data && !error;
|
|
239
290
|
const credentialTitle = !isTurnkeyHDWallet || exportPrivateKey
|
|
240
291
|
? t('dyn_embedded_reveal.private_key_title')
|
|
@@ -252,15 +303,48 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
252
303
|
const handleClickUnlink = () => {
|
|
253
304
|
pushView('embedded-delete-view');
|
|
254
305
|
};
|
|
255
|
-
|
|
306
|
+
// Extract nested ternaries into separate functions for clarity
|
|
307
|
+
const getBodyClassName = () => {
|
|
308
|
+
const baseClass = 'embedded-reveal-view__body';
|
|
309
|
+
if (isWaasWallet && hasInjectedCredential && title === credentialTitle) {
|
|
310
|
+
return `${baseClass} ${baseClass}--waas-credentials`;
|
|
311
|
+
}
|
|
312
|
+
return baseClass;
|
|
313
|
+
};
|
|
314
|
+
const getCredentialContainerClassName = () => {
|
|
315
|
+
const baseClass = 'embedded-reveal-view__body__credential-container';
|
|
316
|
+
if (title !== credentialTitle) {
|
|
317
|
+
return `${baseClass} ${baseClass}--hidden`;
|
|
318
|
+
}
|
|
319
|
+
if (isWaasWallet) {
|
|
320
|
+
return `${baseClass} ${baseClass}--waas`;
|
|
321
|
+
}
|
|
322
|
+
return baseClass;
|
|
323
|
+
};
|
|
324
|
+
const getIframeContainerClassName = () => {
|
|
325
|
+
const baseClass = 'embedded-reveal-view__body__iframe-container';
|
|
326
|
+
if (!data) {
|
|
327
|
+
return `${baseClass} ${baseClass}--hidden`;
|
|
328
|
+
}
|
|
329
|
+
if (showSkeleton) {
|
|
330
|
+
return `${baseClass} ${baseClass}--invisible`;
|
|
331
|
+
}
|
|
332
|
+
return baseClass;
|
|
333
|
+
};
|
|
334
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: isPromptForExport ? null : closeButton, children: jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', children: title }) }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view', children: jsxRuntime.jsxs("div", { className: getBodyClassName(), children: [(!isWaasWallet ||
|
|
335
|
+
!hasInjectedCredential ||
|
|
336
|
+
title !== credentialTitle) &&
|
|
337
|
+
contentHeader, isTurnkeyWallet || isWaasWallet ? (jsxRuntime.jsxs("div", { className: getCredentialContainerClassName(), children: [jsxRuntime.jsx("div", { id: constants.iframeContainerId, className: getIframeContainerClassName(), ref: iframeContainerRef }), showSkeleton && data && (jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__skeleton-container', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__skeleton-line', "data-testid": 'private-key-skeleton' }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__skeleton-line' }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__skeleton-line' }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__skeleton-line embedded-reveal-view__body__skeleton-line--short' })] }))] })) : null, hasInjectedCredential ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', onClick: () => {
|
|
338
|
+
setShowAuthFlow(false);
|
|
339
|
+
}, loading: isLoading, copykey: 'dyn_embedded_reveal.done_button_label', typographyProps: {
|
|
256
340
|
color: 'inherit',
|
|
257
341
|
}, children: t('dyn_embedded_reveal.done_button_label') }), !exportPrivateKey && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'embedded-reveal-view__body__unlink_button', buttonVariant: 'tertiary', buttonPadding: 'none', copykey: 'dyn_embedded_reveal.unlink', onClick: handleClickUnlink, typographyProps: {
|
|
258
342
|
color: 'secondary',
|
|
259
343
|
variant: 'button_tertiary',
|
|
260
|
-
}, children: t('dyn_embedded_reveal.unlink') }))] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__description', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__badge-container', children: jsxRuntime.jsx(Badge.Badge, { text: t('dyn_embedded_reveal.badge_label'), className: 'embedded-reveal-view__body__badge' }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'regular', copykey: 'dyn_embedded_reveal.prompt_for_export_description', children: t('dyn_embedded_reveal.prompt_for_export_description') })] }), errorText && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: errorText }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card', children: [jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsxRuntime.jsx(walletV2.ReactComponent, { height: 16, width: 16 }) }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement__text', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.title', children: [t('dyn_embedded_reveal.statement_1.title'), ":"] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.description', children: t('dyn_embedded_reveal.statement_1.description') })] })] }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsxRuntime.jsx(eyeOffIcon.ReactComponent, { height: 16, width: 16 }) }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__statement__text', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_2.title', children: t('dyn_embedded_reveal.statement_2.title') }) })] })] }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__confirm_card', children: jsxRuntime.jsxs("button", { className: 'embedded-reveal-view__body__card__acknowledgement', onClick: () => setAcknowledgement1(!acknowledgement1), children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Checkbox.Checkbox, { checked: acknowledgement1, onChange: () => setAcknowledgement1(!acknowledgement1), className: 'embedded-reveal-view__body__card__statement__checkbox', id: 'embedded-reveal-checkbox-1' }) }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_embedded_reveal.checkbox_label', children: t('dyn_embedded_reveal.checkbox_label') }) })] }) }), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, { isExport: true }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__button_section', children: [isPromptForExport && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: '
|
|
344
|
+
}, children: t('dyn_embedded_reveal.unlink') }))] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__description', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__badge-container', children: jsxRuntime.jsx(Badge.Badge, { text: t('dyn_embedded_reveal.badge_label'), className: 'embedded-reveal-view__body__badge' }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'regular', copykey: 'dyn_embedded_reveal.prompt_for_export_description', children: t('dyn_embedded_reveal.prompt_for_export_description') })] }), errorText && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: errorText }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card', children: [jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsxRuntime.jsx(walletV2.ReactComponent, { height: 16, width: 16 }) }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement__text', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.title', children: [t('dyn_embedded_reveal.statement_1.title'), ":"] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.description', children: t('dyn_embedded_reveal.statement_1.description') })] })] }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsxRuntime.jsx(eyeOffIcon.ReactComponent, { height: 16, width: 16 }) }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__card__statement__text', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_2.title', children: t('dyn_embedded_reveal.statement_2.title') }) })] })] }), jsxRuntime.jsx("div", { className: 'embedded-reveal-view__body__confirm_card', children: jsxRuntime.jsxs("button", { className: 'embedded-reveal-view__body__card__acknowledgement', onClick: () => setAcknowledgement1(!acknowledgement1), children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Checkbox.Checkbox, { checked: acknowledgement1, onChange: () => setAcknowledgement1(!acknowledgement1), className: 'embedded-reveal-view__body__card__statement__checkbox', id: 'embedded-reveal-checkbox-1' }) }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_embedded_reveal.checkbox_label', children: t('dyn_embedded_reveal.checkbox_label') }) })] }) }), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, { isExport: true }), jsxRuntime.jsxs("div", { className: 'embedded-reveal-view__body__button_section', children: [isPromptForExport && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'primary', onClick: () => {
|
|
261
345
|
handleAcknowledgeExportPrompt();
|
|
262
346
|
setShowAuthFlow(false);
|
|
263
|
-
}, dataTestId: 'embedded-reveal-button', copykey: 'dyn_embedded_reveal.skip_button_label', expanded: true, buttonClassName: 'embedded-reveal-view__body__button', children: t('dyn_embedded_reveal.skip_button_label') })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: '
|
|
347
|
+
}, dataTestId: 'embedded-reveal-button', copykey: 'dyn_embedded_reveal.skip_button_label', expanded: true, buttonClassName: 'embedded-reveal-view__body__button', children: t('dyn_embedded_reveal.skip_button_label') })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
264
348
|
color: 'inherit',
|
|
265
349
|
}, onClick: () => handleExportWallet(), disabled: !acknowledgement1 || exportLoading, loading: isLoading, dataTestId: 'embedded-reveal-button', copykey: 'dyn_embedded_reveal.reveal_button_label', style: { width: '100%' }, className: 'embedded-reveal-view__body__button', expanded: true, children: isPromptForExport
|
|
266
350
|
? t('dyn_embedded_reveal.backup_button_label')
|