@dynamic-labs/sdk-react-core 4.36.0 → 4.36.1
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 +6 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
- package/src/lib/client/extension/projectSettings/getProjectSettings/getProjectSettings.d.ts +2 -1
- package/src/lib/client/extension/projectSettings/useProjectSettings/useProjectSettings.d.ts +2 -1
- package/src/lib/client/extension/projectSettings/useRefetchProjectSettings/useRefetchProjectSettings.d.ts +2 -1
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +3 -1
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +3 -1
- package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectData/getDynamicRedirectData.d.ts +1 -0
- package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectDataFromUrl/getDynamicRedirectDataFromUrl.cjs +2 -1
- package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectDataFromUrl/getDynamicRedirectDataFromUrl.d.ts +1 -0
- package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectDataFromUrl/getDynamicRedirectDataFromUrl.js +2 -1
- package/src/lib/data/api/oauth/oauth.cjs +2 -1
- package/src/lib/data/api/oauth/oauth.d.ts +1 -1
- package/src/lib/data/api/oauth/oauth.js +2 -1
- package/src/lib/locale/en/translation.cjs +2 -0
- package/src/lib/locale/en/translation.d.ts +2 -0
- package/src/lib/locale/en/translation.js +2 -0
- package/src/lib/utils/constants/authViewLayoutChecks.cjs +1 -0
- package/src/lib/utils/constants/authViewLayoutChecks.js +1 -0
- package/src/lib/utils/constants/index.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.cjs +3 -0
- package/src/lib/utils/constants/localStorage.d.ts +4 -0
- package/src/lib/utils/constants/localStorage.js +3 -1
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.cjs +47 -0
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.d.ts +26 -0
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.js +41 -0
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.cjs +5 -3
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.js +5 -3
- package/src/lib/utils/functions/socialStorage/socialStorage.d.ts +2 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +5 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +4 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +5 -2
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +7 -0
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +7 -0
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +37 -5
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.d.ts +6 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +37 -5
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +68 -101
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.d.ts +7 -1
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +69 -102
- package/src/lib/views/viewToComponentMap.d.ts +3 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +3 -1
|
@@ -203,7 +203,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
203
203
|
verifyFunction: () => apiCall(),
|
|
204
204
|
});
|
|
205
205
|
}), [handleError, initAuth$1, onSettled]);
|
|
206
|
-
const completeConnection = useCallback((_b) => __awaiter(void 0, [_b], void 0, function* ({ authMode, provider, state, authCode, captchaToken, verifier, telegramAuthToken, forceCreateUser = false, }) {
|
|
206
|
+
const completeConnection = useCallback((_b) => __awaiter(void 0, [_b], void 0, function* ({ authMode, provider, state, authCode, captchaToken, verifier, telegramAuthToken, forceCreateUser = false, ssoProviderId, }) {
|
|
207
207
|
try {
|
|
208
208
|
let sessionPublicKey = undefined;
|
|
209
209
|
tracing.logEvent('oauth', 'completeConnection', tracing.formatObject({
|
|
@@ -241,6 +241,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
241
241
|
code: authCode,
|
|
242
242
|
codeVerifier: verifier,
|
|
243
243
|
sessionPublicKey,
|
|
244
|
+
ssoProviderId,
|
|
244
245
|
state,
|
|
245
246
|
});
|
|
246
247
|
yield signInAccount(provider, apiCall);
|
|
@@ -367,7 +368,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
367
368
|
shouldRegisterSessionKeysOnSignin,
|
|
368
369
|
signInAccount,
|
|
369
370
|
]);
|
|
370
|
-
const connectSocialAccount = useCallback((_d) => __awaiter(void 0, [_d], void 0, function* ({ authMode, provider, validator, captchaToken, isHeadlessSocialSignIn, payingWithDynamic, triggerFundFromExchangeOnSuccess, redirectUrl, telegramAuthToken, showWidgetAfterConnection, }) {
|
|
371
|
+
const connectSocialAccount = useCallback((_d) => __awaiter(void 0, [_d], void 0, function* ({ authMode, provider, validator, captchaToken, isHeadlessSocialSignIn, payingWithDynamic, triggerFundFromExchangeOnSuccess, redirectUrl, telegramAuthToken, showWidgetAfterConnection, ssoProviderId, }) {
|
|
371
372
|
var _e, _f;
|
|
372
373
|
clearError();
|
|
373
374
|
setIsProcessing(true);
|
|
@@ -400,6 +401,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
400
401
|
setSocialStorageFor(provider, {
|
|
401
402
|
captchaToken,
|
|
402
403
|
codeVerifier: usingPkce ? verifier : undefined,
|
|
404
|
+
dynamicOauthSsoProviderId: ssoProviderId,
|
|
403
405
|
isHeadlessSocialSignIn,
|
|
404
406
|
mode: authMode,
|
|
405
407
|
payingWithDynamic,
|
|
@@ -447,6 +449,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
447
449
|
authMode,
|
|
448
450
|
captchaToken,
|
|
449
451
|
provider,
|
|
452
|
+
ssoProviderId,
|
|
450
453
|
state,
|
|
451
454
|
telegramAuthToken,
|
|
452
455
|
verifier,
|
|
@@ -93,6 +93,7 @@ require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cj
|
|
|
93
93
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
94
94
|
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
95
95
|
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
96
|
+
var useWalletDelegation = require('../useWalletDelegation/useWalletDelegation.cjs');
|
|
96
97
|
require('../../../store/state/sendBalances.cjs');
|
|
97
98
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
98
99
|
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
@@ -208,6 +209,7 @@ const useSyncDynamicWaas = () => {
|
|
|
208
209
|
const validateWalletCreation = useWalletCreationValidation();
|
|
209
210
|
const { mutate: createWallets, isLoading: isCreatingWallets } = useWalletCreation();
|
|
210
211
|
const { mutate: processSettings, isLoading: isProcessingSettings } = useWalletSettingsProcessor();
|
|
212
|
+
const { initDelegationProcess, shouldPromptWalletDelegation } = useWalletDelegation.useWalletDelegation();
|
|
211
213
|
const triggeredCreate = React.useRef(false);
|
|
212
214
|
const triggeredSettingsProcessing = React.useRef(false);
|
|
213
215
|
useDynamicEvents.useInternalDynamicEvents('logout', () => {
|
|
@@ -264,6 +266,11 @@ const useSyncDynamicWaas = () => {
|
|
|
264
266
|
handleWalletCreation();
|
|
265
267
|
}
|
|
266
268
|
}, [shouldCreateWallets, handleWalletCreation]);
|
|
269
|
+
React.useEffect(() => {
|
|
270
|
+
if (shouldPromptWalletDelegation()) {
|
|
271
|
+
initDelegationProcess();
|
|
272
|
+
}
|
|
273
|
+
}, [shouldPromptWalletDelegation, initDelegationProcess]);
|
|
267
274
|
};
|
|
268
275
|
|
|
269
276
|
exports.useSyncDynamicWaas = useSyncDynamicWaas;
|
|
@@ -89,6 +89,7 @@ import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js'
|
|
|
89
89
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
90
90
|
import '../../../context/OnrampContext/OnrampContext.js';
|
|
91
91
|
import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
|
|
92
|
+
import { useWalletDelegation } from '../useWalletDelegation/useWalletDelegation.js';
|
|
92
93
|
import '../../../store/state/sendBalances.js';
|
|
93
94
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
94
95
|
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
@@ -204,6 +205,7 @@ const useSyncDynamicWaas = () => {
|
|
|
204
205
|
const validateWalletCreation = useWalletCreationValidation();
|
|
205
206
|
const { mutate: createWallets, isLoading: isCreatingWallets } = useWalletCreation();
|
|
206
207
|
const { mutate: processSettings, isLoading: isProcessingSettings } = useWalletSettingsProcessor();
|
|
208
|
+
const { initDelegationProcess, shouldPromptWalletDelegation } = useWalletDelegation();
|
|
207
209
|
const triggeredCreate = useRef(false);
|
|
208
210
|
const triggeredSettingsProcessing = useRef(false);
|
|
209
211
|
useInternalDynamicEvents('logout', () => {
|
|
@@ -260,6 +262,11 @@ const useSyncDynamicWaas = () => {
|
|
|
260
262
|
handleWalletCreation();
|
|
261
263
|
}
|
|
262
264
|
}, [shouldCreateWallets, handleWalletCreation]);
|
|
265
|
+
useEffect(() => {
|
|
266
|
+
if (shouldPromptWalletDelegation()) {
|
|
267
|
+
initDelegationProcess();
|
|
268
|
+
}
|
|
269
|
+
}, [shouldPromptWalletDelegation, initDelegationProcess]);
|
|
263
270
|
};
|
|
264
271
|
|
|
265
272
|
export { useSyncDynamicWaas };
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var React = require('react');
|
|
8
|
+
var utils = require('@dynamic-labs/utils');
|
|
8
9
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
9
10
|
require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
10
11
|
require('@dynamic-labs/iconic');
|
|
@@ -13,7 +14,7 @@ require('react/jsx-runtime');
|
|
|
13
14
|
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
14
15
|
require('../../../shared/logger.cjs');
|
|
15
16
|
require('@dynamic-labs/wallet-book');
|
|
16
|
-
require('
|
|
17
|
+
var localStorage = require('../../constants/localStorage.cjs');
|
|
17
18
|
require('../../constants/colors.cjs');
|
|
18
19
|
require('../../constants/values.cjs');
|
|
19
20
|
require('@dynamic-labs/sdk-api-core');
|
|
@@ -29,13 +30,14 @@ require('@dynamic-labs-sdk/client/core');
|
|
|
29
30
|
require('../../../client/client.cjs');
|
|
30
31
|
require('@dynamic-labs-sdk/client');
|
|
31
32
|
require('../../../config/ApiEndpoint.cjs');
|
|
33
|
+
var useProjectSettings = require('../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
|
|
32
34
|
require('../../../locale/locale.cjs');
|
|
33
35
|
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
34
36
|
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
35
37
|
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
36
38
|
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
37
39
|
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
38
|
-
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
40
|
+
var UserWalletsContext = require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
39
41
|
require('../../../store/state/authMode/authMode.cjs');
|
|
40
42
|
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
41
43
|
require('react-dom');
|
|
@@ -104,9 +106,35 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
104
106
|
|
|
105
107
|
// Hook to trigger wallet delegation modal
|
|
106
108
|
const useWalletDelegation = () => {
|
|
109
|
+
var _a, _b, _c;
|
|
107
110
|
const { primaryWallet, user, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
111
|
+
const { userWallets } = UserWalletsContext.useInternalUserWallets();
|
|
108
112
|
const { pushView } = ViewContext.useViewContext();
|
|
109
|
-
const
|
|
113
|
+
const projectSettings = useProjectSettings.useProjectSettings();
|
|
114
|
+
const waasSettings = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.waas;
|
|
115
|
+
const delegatedAccessEnabled = (_a = waasSettings === null || waasSettings === void 0 ? void 0 : waasSettings.delegatedAccess) === null || _a === void 0 ? void 0 : _a.enabled;
|
|
116
|
+
const promptUsersOnSignIn = (_b = waasSettings === null || waasSettings === void 0 ? void 0 : waasSettings.delegatedAccess) === null || _b === void 0 ? void 0 : _b.promptUsersOnSignIn;
|
|
117
|
+
const requiresDelegation = (_c = waasSettings === null || waasSettings === void 0 ? void 0 : waasSettings.delegatedAccess) === null || _c === void 0 ? void 0 : _c.requiresDelegation;
|
|
118
|
+
const shouldPromptWalletDelegation = React.useCallback(() => {
|
|
119
|
+
var _a, _b;
|
|
120
|
+
if (!delegatedAccessEnabled || !promptUsersOnSignIn) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
// If the prompt was dismissed, do not show again until logout
|
|
124
|
+
// Unified state first, then legacy dismissed flag
|
|
125
|
+
const state = utils.StorageService.getItem(localStorage.DELEGATION_STATE);
|
|
126
|
+
const dismissed = state === null || state === void 0 ? void 0 : state.dismissed;
|
|
127
|
+
if (dismissed) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
const userId = (user === null || user === void 0 ? void 0 : user.userId) || 'anonymous';
|
|
131
|
+
const deniedForUser = new Set(((_a = state === null || state === void 0 ? void 0 : state.denied) === null || _a === void 0 ? void 0 : _a[userId]) || []);
|
|
132
|
+
const completedForUser = new Set(((_b = state === null || state === void 0 ? void 0 : state.completed) === null || _b === void 0 ? void 0 : _b[userId]) || []);
|
|
133
|
+
const waasWallets = userWallets.filter((wallet) => wallet.connector.key.startsWith('dynamicwaas'));
|
|
134
|
+
const hasUndeniedWaasWallet = waasWallets.some((wallet) => !deniedForUser.has(wallet.id) && !completedForUser.has(wallet.id));
|
|
135
|
+
return hasUndeniedWaasWallet;
|
|
136
|
+
}, [user === null || user === void 0 ? void 0 : user.userId, userWallets, delegatedAccessEnabled, promptUsersOnSignIn]);
|
|
137
|
+
const initDelegationProcess = React.useCallback((options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
110
138
|
if (!primaryWallet) {
|
|
111
139
|
throw new Error('No primary wallet');
|
|
112
140
|
}
|
|
@@ -118,8 +146,10 @@ const useWalletDelegation = () => {
|
|
|
118
146
|
ignoreIfIsEmbeddedWidget: false,
|
|
119
147
|
performMultiWalletChecks: false,
|
|
120
148
|
});
|
|
121
|
-
// Push the wallet delegation view
|
|
122
|
-
pushView('wallet-delegation-view', {
|
|
149
|
+
// Push the wallet delegation view with optional wallets override
|
|
150
|
+
pushView('wallet-delegation-view', {
|
|
151
|
+
wallets: options === null || options === void 0 ? void 0 : options.wallets,
|
|
152
|
+
});
|
|
123
153
|
return new Promise((resolve, reject) => {
|
|
124
154
|
dynamicEvents.dynamicEvents.once('embeddedWalletDelegationCompleted', () => resolve());
|
|
125
155
|
dynamicEvents.dynamicEvents.once('embeddedWalletDelegationFailed', (error) => reject(error));
|
|
@@ -127,6 +157,8 @@ const useWalletDelegation = () => {
|
|
|
127
157
|
}), [primaryWallet, setShowAuthFlow, pushView, user]);
|
|
128
158
|
return {
|
|
129
159
|
initDelegationProcess,
|
|
160
|
+
requiresDelegation,
|
|
161
|
+
shouldPromptWalletDelegation,
|
|
130
162
|
};
|
|
131
163
|
};
|
|
132
164
|
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { Wallet } from '../../../shared';
|
|
1
2
|
export declare const useWalletDelegation: () => {
|
|
2
|
-
readonly initDelegationProcess: (
|
|
3
|
+
readonly initDelegationProcess: (options?: {
|
|
4
|
+
wallets?: Wallet[];
|
|
5
|
+
}) => Promise<void>;
|
|
6
|
+
readonly requiresDelegation: boolean | undefined;
|
|
7
|
+
readonly shouldPromptWalletDelegation: () => boolean;
|
|
3
8
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
|
+
import { StorageService } from '@dynamic-labs/utils';
|
|
4
5
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
5
6
|
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
6
7
|
import '@dynamic-labs/iconic';
|
|
@@ -9,7 +10,7 @@ import 'react/jsx-runtime';
|
|
|
9
10
|
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
10
11
|
import '../../../shared/logger.js';
|
|
11
12
|
import '@dynamic-labs/wallet-book';
|
|
12
|
-
import '
|
|
13
|
+
import { DELEGATION_STATE } from '../../constants/localStorage.js';
|
|
13
14
|
import '../../constants/colors.js';
|
|
14
15
|
import '../../constants/values.js';
|
|
15
16
|
import '@dynamic-labs/sdk-api-core';
|
|
@@ -25,13 +26,14 @@ import '@dynamic-labs-sdk/client/core';
|
|
|
25
26
|
import '../../../client/client.js';
|
|
26
27
|
import '@dynamic-labs-sdk/client';
|
|
27
28
|
import '../../../config/ApiEndpoint.js';
|
|
29
|
+
import { useProjectSettings } from '../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
|
|
28
30
|
import '../../../locale/locale.js';
|
|
29
31
|
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
30
32
|
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
31
33
|
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
32
34
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
33
35
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
34
|
-
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
36
|
+
import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
35
37
|
import '../../../store/state/authMode/authMode.js';
|
|
36
38
|
import '../../../context/VerificationContext/VerificationContext.js';
|
|
37
39
|
import 'react-dom';
|
|
@@ -100,9 +102,35 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
100
102
|
|
|
101
103
|
// Hook to trigger wallet delegation modal
|
|
102
104
|
const useWalletDelegation = () => {
|
|
105
|
+
var _a, _b, _c;
|
|
103
106
|
const { primaryWallet, user, setShowAuthFlow } = useInternalDynamicContext();
|
|
107
|
+
const { userWallets } = useInternalUserWallets();
|
|
104
108
|
const { pushView } = useViewContext();
|
|
105
|
-
const
|
|
109
|
+
const projectSettings = useProjectSettings();
|
|
110
|
+
const waasSettings = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.waas;
|
|
111
|
+
const delegatedAccessEnabled = (_a = waasSettings === null || waasSettings === void 0 ? void 0 : waasSettings.delegatedAccess) === null || _a === void 0 ? void 0 : _a.enabled;
|
|
112
|
+
const promptUsersOnSignIn = (_b = waasSettings === null || waasSettings === void 0 ? void 0 : waasSettings.delegatedAccess) === null || _b === void 0 ? void 0 : _b.promptUsersOnSignIn;
|
|
113
|
+
const requiresDelegation = (_c = waasSettings === null || waasSettings === void 0 ? void 0 : waasSettings.delegatedAccess) === null || _c === void 0 ? void 0 : _c.requiresDelegation;
|
|
114
|
+
const shouldPromptWalletDelegation = useCallback(() => {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
if (!delegatedAccessEnabled || !promptUsersOnSignIn) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
// If the prompt was dismissed, do not show again until logout
|
|
120
|
+
// Unified state first, then legacy dismissed flag
|
|
121
|
+
const state = StorageService.getItem(DELEGATION_STATE);
|
|
122
|
+
const dismissed = state === null || state === void 0 ? void 0 : state.dismissed;
|
|
123
|
+
if (dismissed) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
const userId = (user === null || user === void 0 ? void 0 : user.userId) || 'anonymous';
|
|
127
|
+
const deniedForUser = new Set(((_a = state === null || state === void 0 ? void 0 : state.denied) === null || _a === void 0 ? void 0 : _a[userId]) || []);
|
|
128
|
+
const completedForUser = new Set(((_b = state === null || state === void 0 ? void 0 : state.completed) === null || _b === void 0 ? void 0 : _b[userId]) || []);
|
|
129
|
+
const waasWallets = userWallets.filter((wallet) => wallet.connector.key.startsWith('dynamicwaas'));
|
|
130
|
+
const hasUndeniedWaasWallet = waasWallets.some((wallet) => !deniedForUser.has(wallet.id) && !completedForUser.has(wallet.id));
|
|
131
|
+
return hasUndeniedWaasWallet;
|
|
132
|
+
}, [user === null || user === void 0 ? void 0 : user.userId, userWallets, delegatedAccessEnabled, promptUsersOnSignIn]);
|
|
133
|
+
const initDelegationProcess = useCallback((options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
106
134
|
if (!primaryWallet) {
|
|
107
135
|
throw new Error('No primary wallet');
|
|
108
136
|
}
|
|
@@ -114,8 +142,10 @@ const useWalletDelegation = () => {
|
|
|
114
142
|
ignoreIfIsEmbeddedWidget: false,
|
|
115
143
|
performMultiWalletChecks: false,
|
|
116
144
|
});
|
|
117
|
-
// Push the wallet delegation view
|
|
118
|
-
pushView('wallet-delegation-view', {
|
|
145
|
+
// Push the wallet delegation view with optional wallets override
|
|
146
|
+
pushView('wallet-delegation-view', {
|
|
147
|
+
wallets: options === null || options === void 0 ? void 0 : options.wallets,
|
|
148
|
+
});
|
|
119
149
|
return new Promise((resolve, reject) => {
|
|
120
150
|
dynamicEvents.once('embeddedWalletDelegationCompleted', () => resolve());
|
|
121
151
|
dynamicEvents.once('embeddedWalletDelegationFailed', (error) => reject(error));
|
|
@@ -123,6 +153,8 @@ const useWalletDelegation = () => {
|
|
|
123
153
|
}), [primaryWallet, setShowAuthFlow, pushView, user]);
|
|
124
154
|
return {
|
|
125
155
|
initDelegationProcess,
|
|
156
|
+
requiresDelegation,
|
|
157
|
+
shouldPromptWalletDelegation,
|
|
126
158
|
};
|
|
127
159
|
};
|
|
128
160
|
|
|
@@ -14,114 +14,45 @@ var IconButton = require('../../../components/IconButton/IconButton.cjs');
|
|
|
14
14
|
var ModalHeader = require('../../../components/ModalHeader/ModalHeader.cjs');
|
|
15
15
|
var Typography = require('../../../components/Typography/Typography.cjs');
|
|
16
16
|
var TypographyButton = require('../../../components/TypographyButton/TypographyButton.cjs');
|
|
17
|
-
require('../../../context/DynamicContext/
|
|
18
|
-
require('../../../
|
|
19
|
-
require('
|
|
20
|
-
require('
|
|
17
|
+
var useDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
|
|
18
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
19
|
+
var dynamicEvents = require('../../../events/dynamicEvents.cjs');
|
|
20
|
+
var getProperErrorMessage = require('../../../modals/SignMessageConfirmationModal/getProperErrorMessage.cjs');
|
|
21
21
|
var check = require('../../../shared/assets/check.cjs');
|
|
22
22
|
var close = require('../../../shared/assets/close.cjs');
|
|
23
23
|
var switchHorizontal = require('../../../shared/assets/switch-horizontal.cjs');
|
|
24
|
+
require('@dynamic-labs/iconic');
|
|
24
25
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
25
26
|
var logger = require('../../../shared/logger.cjs');
|
|
26
|
-
require('@dynamic-labs/wallet-book');
|
|
27
|
-
require('../../../utils/constants/colors.cjs');
|
|
28
|
-
require('../../../utils/constants/values.cjs');
|
|
29
|
-
require('@dynamic-labs/sdk-api-core');
|
|
30
|
-
require('../../../shared/consts/index.cjs');
|
|
31
|
-
var dynamicEvents = require('../../../events/dynamicEvents.cjs');
|
|
32
|
-
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
33
|
-
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
34
|
-
require('@dynamic-labs/multi-wallet');
|
|
35
|
-
require('react-international-phone');
|
|
36
|
-
require('../../../store/state/nonce/nonce.cjs');
|
|
37
|
-
require('@dynamic-labs-sdk/client/core');
|
|
38
|
-
require('../../../client/client.cjs');
|
|
39
|
-
require('@dynamic-labs-sdk/client');
|
|
40
|
-
require('../../../config/ApiEndpoint.cjs');
|
|
41
|
-
require('../../../locale/locale.cjs');
|
|
42
|
-
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
43
|
-
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
44
|
-
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
45
|
-
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
46
|
-
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
47
|
-
var UserWalletsContext = require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
48
|
-
require('../../../store/state/authMode/authMode.cjs');
|
|
49
|
-
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
50
|
-
require('react-dom');
|
|
51
|
-
require('../../../utils/functions/compareChains/compareChains.cjs');
|
|
52
|
-
require('../../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
53
|
-
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
54
|
-
require('../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
55
27
|
var useMutation = require('../../../utils/hooks/useMutation/useMutation.cjs');
|
|
56
|
-
require('bs58');
|
|
57
|
-
require('@dynamic-labs/types');
|
|
58
|
-
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
59
|
-
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
60
|
-
require('../../../context/WalletContext/WalletContext.cjs');
|
|
61
|
-
require('../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
62
|
-
require('yup');
|
|
63
|
-
require('../../../context/MockContext/MockContext.cjs');
|
|
64
|
-
require('../../CollectUserDataView/useFields.cjs');
|
|
65
|
-
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
66
|
-
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
67
|
-
require('@dynamic-labs/rpc-providers');
|
|
68
|
-
require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
69
|
-
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
70
|
-
require('../../../components/Alert/Alert.cjs');
|
|
71
|
-
var WalletIconWithNetwork = require('../../../widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.cjs');
|
|
72
|
-
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
73
|
-
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
74
|
-
require('../../../components/Input/Input.cjs');
|
|
75
|
-
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
76
|
-
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
77
|
-
require('../../../components/OverlayCard/OverlayCard.cjs');
|
|
78
|
-
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
79
|
-
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
80
|
-
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
81
|
-
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
82
|
-
require('../../../components/Popper/Popper/Popper.cjs');
|
|
83
|
-
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
84
|
-
require('react-focus-lock');
|
|
85
|
-
require('qrcode');
|
|
86
|
-
require('formik');
|
|
87
|
-
require('../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
88
|
-
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
89
|
-
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
90
|
-
require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
91
|
-
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
92
|
-
require('@hcaptcha/react-hcaptcha');
|
|
93
|
-
var getProperErrorMessage = require('../../../modals/SignMessageConfirmationModal/getProperErrorMessage.cjs');
|
|
94
|
-
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
95
|
-
require('../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
96
|
-
require('../../ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
97
|
-
require('../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
98
|
-
require('../../../context/FooterAnimationContext/index.cjs');
|
|
99
|
-
require('../../MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
100
|
-
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
101
|
-
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
102
|
-
var useDynamicWaas = require('../../../utils/hooks/useDynamicWaas/useDynamicWaas.cjs');
|
|
103
28
|
var settingsUtils = require('../../../store/utils/settingsUtils/settingsUtils.cjs');
|
|
104
|
-
require('../../../
|
|
105
|
-
require('../../../
|
|
106
|
-
require('../../../components/
|
|
107
|
-
require('../../../
|
|
108
|
-
require('
|
|
109
|
-
require('../../../
|
|
110
|
-
require('
|
|
111
|
-
require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
112
|
-
require('../../../store/state/tokenBalances.cjs');
|
|
113
|
-
require('../../../store/state/multichainBalances.cjs');
|
|
114
|
-
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
115
|
-
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
29
|
+
var UserWalletsContext = require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
30
|
+
var useDynamicWaas = require('../../../utils/hooks/useDynamicWaas/useDynamicWaas.cjs');
|
|
31
|
+
var WalletIconWithNetwork = require('../../../widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.cjs');
|
|
32
|
+
var useWalletDelegation = require('../../../utils/hooks/useWalletDelegation/useWalletDelegation.cjs');
|
|
33
|
+
var localStorage = require('../../../utils/constants/localStorage.cjs');
|
|
34
|
+
require('../../../utils/constants/colors.cjs');
|
|
35
|
+
require('../../../utils/constants/values.cjs');
|
|
116
36
|
|
|
117
|
-
const WalletDelegationView = () => {
|
|
118
|
-
const {
|
|
37
|
+
const WalletDelegationView = ({ wallets, }) => {
|
|
38
|
+
const { setShowAuthFlow, handleLogOut } = useInternalDynamicContext.useInternalDynamicContext();
|
|
39
|
+
const { user } = useDynamicContext.useDynamicContext();
|
|
119
40
|
const appName = settingsUtils.useAppName();
|
|
120
41
|
const { userWallets } = UserWalletsContext.useInternalUserWallets();
|
|
121
42
|
const { delegateKeyShares } = useDynamicWaas.useDynamicWaas();
|
|
43
|
+
const { requiresDelegation } = useWalletDelegation.useWalletDelegation();
|
|
122
44
|
const [selectedWallets, setSelectedWallets] = React.useState(new Set());
|
|
123
|
-
// Get waas wallets that are not yet delegated
|
|
124
|
-
const waasWallets =
|
|
45
|
+
// Get waas wallets that are not yet delegated or use provided wallets override
|
|
46
|
+
const waasWallets = React.useMemo(() => {
|
|
47
|
+
const items = wallets && wallets.length > 0
|
|
48
|
+
? wallets
|
|
49
|
+
: userWallets.filter((wallet) => wallet.connector.key.startsWith('dynamicwaas'));
|
|
50
|
+
const state = utils.StorageService.getItem(localStorage.DELEGATION_STATE) || { completed: {}, denied: {}, dismissed: false };
|
|
51
|
+
const userId = (user === null || user === void 0 ? void 0 : user.userId) || 'anonymous';
|
|
52
|
+
const deniedForUser = new Set(state.denied[userId] || []);
|
|
53
|
+
const completedForUser = new Set(state.completed[userId] || []);
|
|
54
|
+
return items.filter((wallet) => !deniedForUser.has(wallet.id) && !completedForUser.has(wallet.id));
|
|
55
|
+
}, [userWallets, wallets, user === null || user === void 0 ? void 0 : user.userId]);
|
|
125
56
|
const handleWalletToggle = (walletId, event) => {
|
|
126
57
|
// Prevent event propagation if called from checkbox
|
|
127
58
|
if (event) {
|
|
@@ -144,6 +75,15 @@ const WalletDelegationView = () => {
|
|
|
144
75
|
const handleDeselectAll = () => {
|
|
145
76
|
setSelectedWallets(new Set());
|
|
146
77
|
};
|
|
78
|
+
const persistDeniedWallets = () => {
|
|
79
|
+
const state = utils.StorageService.getItem(localStorage.DELEGATION_STATE) || { completed: {}, denied: {}, dismissed: false };
|
|
80
|
+
const userId = (user === null || user === void 0 ? void 0 : user.userId) || 'anonymous';
|
|
81
|
+
const existingForUser = new Set(state.denied[userId] || []);
|
|
82
|
+
selectedWallets.forEach((walletId) => existingForUser.add(walletId));
|
|
83
|
+
state.denied[userId] = Array.from(existingForUser);
|
|
84
|
+
utils.StorageService.setItem(localStorage.DELEGATION_STATE, state);
|
|
85
|
+
// No legacy mirrors; unified state only
|
|
86
|
+
};
|
|
147
87
|
const { mutate: handleDelegateWallets, isLoading, error, data: isSuccess, } = useMutation.useMutation(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
148
88
|
if (selectedWallets.size === 0) {
|
|
149
89
|
throw new utils.DynamicError('No wallets selected for delegation');
|
|
@@ -166,6 +106,14 @@ const WalletDelegationView = () => {
|
|
|
166
106
|
}));
|
|
167
107
|
// Wait for all delegations to complete
|
|
168
108
|
yield Promise.all(delegationPromises);
|
|
109
|
+
// Persist completed delegations (unified state + legacy)
|
|
110
|
+
const state = utils.StorageService.getItem(localStorage.DELEGATION_STATE) || { completed: {}, denied: {}, dismissed: false };
|
|
111
|
+
const userId = (user === null || user === void 0 ? void 0 : user.userId) || 'anonymous';
|
|
112
|
+
const existingForUser = new Set(state.completed[userId] || []);
|
|
113
|
+
selectedWalletObjects.forEach((wallet) => existingForUser.add(wallet.id));
|
|
114
|
+
state.completed[userId] = Array.from(existingForUser);
|
|
115
|
+
utils.StorageService.setItem(localStorage.DELEGATION_STATE, state);
|
|
116
|
+
// No legacy mirrors; unified state only
|
|
169
117
|
// Emit overall success event
|
|
170
118
|
dynamicEvents.dynamicEvents.emit('embeddedWalletDelegationCompleted', selectedWalletObjects[0]);
|
|
171
119
|
return true;
|
|
@@ -207,13 +155,20 @@ const WalletDelegationView = () => {
|
|
|
207
155
|
// Error state content
|
|
208
156
|
const errorContent = (jsxRuntime.jsx("div", { className: 'embedded-delegated-view__body__description', children: jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__approval-section', children: [jsxRuntime.jsx("div", { className: 'embedded-delegated-view__error-icon', children: jsxRuntime.jsx(close.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', color: 'primary', className: 'embedded-delegated-view__approval-title', children: t('dyn_wallet_delegation.something_went_wrong') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', className: 'embedded-delegated-view__approval-description', children: t('dyn_wallet_delegation.delegation_timeout_message') })] }) }));
|
|
209
157
|
// Initial state content
|
|
210
|
-
const initialContent = (jsxRuntime.jsx("div", { className: 'embedded-delegated-view__body__description', children: jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__approval-section', children: [jsxRuntime.jsx("div", { className: 'embedded-delegated-view__approval-icon', children: jsxRuntime.jsx(switchHorizontal.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', color: 'primary', className: 'embedded-delegated-view__approval-title', copykey: 'dyn_wallet_delegation.approval_required', children:
|
|
158
|
+
const initialContent = (jsxRuntime.jsx("div", { className: 'embedded-delegated-view__body__description', children: jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__approval-section', children: [jsxRuntime.jsx("div", { className: 'embedded-delegated-view__approval-icon', children: jsxRuntime.jsx(switchHorizontal.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', color: 'primary', className: 'embedded-delegated-view__approval-title', copykey: 'dyn_wallet_delegation.approval_required', children: requiresDelegation
|
|
159
|
+
? t('dyn_wallet_delegation.approval_required')
|
|
160
|
+
: t('dyn_wallet_delegation.approval_requested') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', className: 'embedded-delegated-view__approval-description', copykey: 'dyn_wallet_delegation.approval_description', children: t('dyn_wallet_delegation.approval_description', {
|
|
211
161
|
appName,
|
|
212
162
|
}) })] }) }));
|
|
213
163
|
const displayWaasWallets = () => (jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__wallet-selection', children: [jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__wallet-selection__header', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', children: t('dyn_wallet_delegation.select_wallets') }), jsxRuntime.jsx("button", { onClick: selectedWallets.size === waasWallets.length
|
|
214
164
|
? handleDeselectAll
|
|
215
165
|
: handleSelectAll, className: 'embedded-delegated-view__wallet-selection__deselect-all', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: getSelectButtonText() }) })] }), jsxRuntime.jsx("div", { className: 'embedded-delegated-view__wallet-list', children: waasWallets === null || waasWallets === void 0 ? void 0 : waasWallets.map((wallet) => (jsxRuntime.jsx("div", { className: 'embedded-delegated-view__wallet-item', children: jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__wallet-item__content', onClick: () => handleWalletToggle(wallet.id), style: { cursor: 'pointer' }, children: [jsxRuntime.jsx("div", { className: 'embedded-delegated-view__wallet-item__icon', children: jsxRuntime.jsx(WalletIconWithNetwork.WalletIconWithNetwork, { walletKey: wallet.key, Icon: null, iconUrl: wallet.connector.metadata.icon, chainName: wallet.chain, iconSize: 24, showNetwork: true }) }), jsxRuntime.jsx("div", { className: 'embedded-delegated-view__wallet-item__info', children: jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', weight: 'medium', children: [wallet.address.slice(0, 6), "...", wallet.address.slice(-4)] }) }), jsxRuntime.jsx("div", { className: 'embedded-delegated-view__wallet-item__checkbox', children: jsxRuntime.jsx(Checkbox.Checkbox, { checked: selectedWallets.has(wallet.id), onChange: () => { }, value: wallet.id }) })] }) }, wallet.id))) })] }));
|
|
216
166
|
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { onClick: () => {
|
|
167
|
+
// Mark prompt as dismissed until logout (unified state + legacy)
|
|
168
|
+
const state = utils.StorageService.getItem(localStorage.DELEGATION_STATE) || { completed: {}, denied: {}, dismissed: false };
|
|
169
|
+
state.dismissed = true;
|
|
170
|
+
utils.StorageService.setItem(localStorage.DELEGATION_STATE, state);
|
|
171
|
+
// No legacy mirror; unified state only
|
|
217
172
|
setShowAuthFlow(false);
|
|
218
173
|
}, type: 'button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
219
174
|
// Determine which content to show based on state
|
|
@@ -250,16 +205,28 @@ const WalletDelegationView = () => {
|
|
|
250
205
|
}
|
|
251
206
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
252
207
|
color: 'inherit',
|
|
253
|
-
}, onClick: () => handleDelegateWallets(), loading: isLoading, disabled: selectedWallets.size === 0, dataTestId: 'embedded-delegation-button', copykey: 'dyn_wallet_delegation.approve_button', style: { width: '100%' }, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.approve_button') }), !isLoading && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
208
|
+
}, onClick: () => handleDelegateWallets(), loading: isLoading, disabled: selectedWallets.size === 0, dataTestId: 'embedded-delegation-button', copykey: 'dyn_wallet_delegation.approve_button', style: { width: '100%' }, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.approve_button') }), !isLoading && !requiresDelegation && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
209
|
+
color: 'primary',
|
|
210
|
+
weight: 'bold',
|
|
211
|
+
}, onClick: () => {
|
|
212
|
+
persistDeniedWallets();
|
|
213
|
+
setShowAuthFlow(false);
|
|
214
|
+
}, dataTestId: 'embedded-delegation-deny-button', copykey: 'dyn_wallet_delegation.deny_button', style: {
|
|
215
|
+
backgroundColor: 'white',
|
|
216
|
+
border: '1px solid var(--dynamic-base-4)',
|
|
217
|
+
width: '100%',
|
|
218
|
+
}, className: 'embedded-delegated-view__body__button embedded-delegated-view__body__deny-button', expanded: true, children: t('dyn_wallet_delegation.deny_button') })), !isLoading && requiresDelegation && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
254
219
|
color: 'primary',
|
|
255
220
|
weight: 'bold',
|
|
256
|
-
}, onClick: () =>
|
|
221
|
+
}, onClick: () => {
|
|
222
|
+
handleLogOut();
|
|
223
|
+
}, dataTestId: 'embedded-delegation-logout-button', copykey: 'dyn_wallet_delegation.logout_button', style: {
|
|
257
224
|
backgroundColor: 'white',
|
|
258
225
|
border: '1px solid var(--dynamic-base-4)',
|
|
259
226
|
width: '100%',
|
|
260
|
-
}, className: 'embedded-delegated-view__body__button embedded-delegated-
|
|
227
|
+
}, className: 'embedded-delegated-view__body__button embedded-delegated-view__body__logout-button', expanded: true, children: t('dyn_wallet_delegation.logout_button') }))] }));
|
|
261
228
|
};
|
|
262
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: closeButton }), jsxRuntime.jsx("div", { className: 'embedded-delegated-view', children: jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__body', children: [getContentHeader(), errorText && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: errorText }), !isLoading && !isSuccess && !error && (jsxRuntime.jsx("div", { className: 'embedded-delegated-view__body__card', children: displayWaasWallets() })), jsxRuntime.jsx("div", { className: 'embedded-delegated-view__body__button_section', children: getButtons() })] }) })] }));
|
|
229
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: !requiresDelegation ? closeButton : undefined }), jsxRuntime.jsx("div", { className: 'embedded-delegated-view', children: jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__body', children: [getContentHeader(), errorText && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: errorText }), !isLoading && !isSuccess && !error && (jsxRuntime.jsx("div", { className: 'embedded-delegated-view__body__card', children: displayWaasWallets() })), jsxRuntime.jsx("div", { className: 'embedded-delegated-view__body__button_section', children: getButtons() })] }) })] }));
|
|
263
230
|
};
|
|
264
231
|
|
|
265
232
|
exports.WalletDelegationView = WalletDelegationView;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
|
|
2
|
+
import { Wallet } from '../../../shared';
|
|
3
|
+
type WalletDelegationViewProps = {
|
|
4
|
+
/** Optional list of wallets to display instead of default WAAS wallets */
|
|
5
|
+
wallets?: Wallet[];
|
|
6
|
+
};
|
|
7
|
+
export declare const WalletDelegationView: FC<WalletDelegationViewProps>;
|
|
8
|
+
export {};
|