@dynamic-labs/sdk-react-core 4.40.0 → 4.40.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 +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +1 -2
- package/src/lib/components/SendBalanceForm/SendBalanceForm.js +1 -2
- package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.cjs +5 -2
- package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.js +5 -2
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/findWalletOptionFor/findWalletOptionFor.cjs +8 -3
- package/src/lib/utils/functions/findWalletOptionFor/findWalletOptionFor.js +8 -3
- package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.cjs +4 -1
- package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.js +4 -1
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +14 -7
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +14 -7
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +7 -3
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +7 -3
- package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.cjs +6 -2
- package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.js +6 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +17 -85
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +17 -85
- package/src/lib/views/LoginView/useLoginView/useLoginView.cjs +11 -7
- package/src/lib/views/LoginView/useLoginView/useLoginView.js +11 -7
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +6 -6
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +6 -6
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/TokenBalanceItem/TokenBalanceItem.cjs +1 -8
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/TokenBalanceItem/TokenBalanceItem.js +1 -8
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { ProviderEnum, SignInProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
4
|
-
import '
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
4
|
+
import '../../../../utils/constants/values.js';
|
|
5
|
+
import '@dynamic-labs/utils';
|
|
6
|
+
import '../../../../../../_virtual/_tslib.js';
|
|
7
|
+
import '@dynamic-labs/multi-wallet';
|
|
8
|
+
import 'react-international-phone';
|
|
9
|
+
import '../../../../utils/constants/colors.js';
|
|
7
10
|
import '@dynamic-labs/iconic';
|
|
8
11
|
import '@dynamic-labs/wallet-connector-core';
|
|
12
|
+
import 'react';
|
|
9
13
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
10
14
|
import { logger } from '../../../../shared/logger.js';
|
|
11
15
|
import '@dynamic-labs/wallet-book';
|
|
12
|
-
import '@dynamic-labs/utils';
|
|
13
|
-
import '../../../../utils/constants/colors.js';
|
|
14
|
-
import '../../../../utils/constants/values.js';
|
|
15
16
|
import '../../../../shared/consts/index.js';
|
|
16
|
-
import '../../../../events/dynamicEvents.js';
|
|
17
|
-
import '../../../../../../_virtual/_tslib.js';
|
|
18
|
-
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
19
|
-
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
20
|
-
import '@dynamic-labs/multi-wallet';
|
|
21
|
-
import 'react-international-phone';
|
|
22
17
|
import { getSocialSignInProviderFromString } from '../../../../utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.js';
|
|
23
18
|
import '../../../../store/state/nonce/nonce.js';
|
|
24
19
|
import { isProviderEnabled } from '../../../../utils/functions/isProviderEnabled/isProviderEnabled.js';
|
|
@@ -26,86 +21,23 @@ import '@dynamic-labs-sdk/client/core';
|
|
|
26
21
|
import '../../../../client/client.js';
|
|
27
22
|
import '@dynamic-labs-sdk/client';
|
|
28
23
|
import '../../../../config/ApiEndpoint.js';
|
|
24
|
+
import '../../../../events/dynamicEvents.js';
|
|
25
|
+
import { useProjectSettings } from '../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
|
|
29
26
|
import '@dynamic-labs/locale';
|
|
30
27
|
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
31
28
|
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
32
29
|
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
33
|
-
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
34
|
-
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
35
|
-
import '../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
36
|
-
import '../../../../store/state/authMode/authMode.js';
|
|
37
|
-
import '../../../../context/VerificationContext/VerificationContext.js';
|
|
38
|
-
import 'react-dom';
|
|
39
|
-
import '../../../../utils/functions/compareChains/compareChains.js';
|
|
40
|
-
import '../../../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
41
|
-
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
42
|
-
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
43
|
-
import 'bs58';
|
|
44
|
-
import '@dynamic-labs/types';
|
|
45
|
-
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
46
|
-
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
47
|
-
import '../../../../context/WalletContext/WalletContext.js';
|
|
48
|
-
import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
49
|
-
import 'yup';
|
|
50
|
-
import '../../../../context/MockContext/MockContext.js';
|
|
51
|
-
import '../../../CollectUserDataView/useFields.js';
|
|
52
|
-
import '../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
53
|
-
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
54
|
-
import '@dynamic-labs/rpc-providers';
|
|
55
|
-
import '../../../../store/state/walletOptions/walletOptions.js';
|
|
56
|
-
import 'react-i18next';
|
|
57
|
-
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
58
|
-
import '../../../../components/Alert/Alert.js';
|
|
59
|
-
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
60
|
-
import '../../../../components/IconButton/IconButton.js';
|
|
61
|
-
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
62
|
-
import '../../../../components/Input/Input.js';
|
|
63
|
-
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
64
|
-
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
65
|
-
import '../../../../components/OverlayCard/OverlayCard.js';
|
|
66
|
-
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
67
|
-
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
68
|
-
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
69
|
-
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
70
|
-
import '../../../../components/Popper/Popper/Popper.js';
|
|
71
|
-
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
72
|
-
import 'react-focus-lock';
|
|
73
|
-
import 'qrcode';
|
|
74
|
-
import 'formik';
|
|
75
|
-
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
76
|
-
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
77
|
-
import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
78
|
-
import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
79
|
-
import '../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
80
|
-
import '@hcaptcha/react-hcaptcha';
|
|
81
|
-
import '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
82
|
-
import '../../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
83
|
-
import '../../../ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
84
|
-
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
85
|
-
import '../../../../context/FooterAnimationContext/index.js';
|
|
86
30
|
import { MagicSocialSignIn } from './MagicSocialSignIn/MagicSocialSignIn.js';
|
|
87
31
|
import { DynamicSocialSignIn } from './DynamicSocialSignIn/DynamicSocialSignIn.js';
|
|
88
|
-
import '../../../MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
89
|
-
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
90
|
-
import '../../../../context/OnrampContext/OnrampContext.js';
|
|
91
|
-
import '../../../../store/state/sendBalances.js';
|
|
92
|
-
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
93
|
-
import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
94
|
-
import '../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
95
|
-
import '../../../TransactionConfirmationView/TransactionConfirmationView.js';
|
|
96
|
-
import '../../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
97
|
-
import '../../../../../index.js';
|
|
98
|
-
import '../../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.js';
|
|
99
|
-
import '../../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
100
|
-
import '../../../../store/state/tokenBalances.js';
|
|
101
|
-
import '../../../../store/state/multichainBalances.js';
|
|
102
|
-
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
103
|
-
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
104
32
|
|
|
105
33
|
const SocialSignInSection = ({ sectionData, collapsedLayout, }) => {
|
|
106
34
|
var _a, _b, _c;
|
|
107
|
-
const
|
|
108
|
-
|
|
35
|
+
const projectSettings = useProjectSettings();
|
|
36
|
+
if (!projectSettings) {
|
|
37
|
+
logger.debug('Failed to render SocialSignInSection - no project settings');
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const providers = (_a = projectSettings.providers) !== null && _a !== void 0 ? _a : [];
|
|
109
41
|
const componentProps = {
|
|
110
42
|
collapsedLayout,
|
|
111
43
|
defaultProvider: getSocialSignInProviderFromString(sectionData.defaultItem),
|
|
@@ -113,11 +45,11 @@ const SocialSignInSection = ({ sectionData, collapsedLayout, }) => {
|
|
|
113
45
|
};
|
|
114
46
|
const isMagicEnabled = isProviderEnabled(providers, ProviderEnum.MagicLink);
|
|
115
47
|
if (isMagicEnabled &&
|
|
116
|
-
((_b = projectSettings
|
|
48
|
+
((_b = projectSettings.sdk.socialSignIn) === null || _b === void 0 ? void 0 : _b.signInProvider) ===
|
|
117
49
|
SignInProviderEnum.MagicLink) {
|
|
118
50
|
return jsx(MagicSocialSignIn, Object.assign({}, componentProps));
|
|
119
51
|
}
|
|
120
|
-
if (((_c = projectSettings
|
|
52
|
+
if (((_c = projectSettings.sdk.socialSignIn) === null || _c === void 0 ? void 0 : _c.signInProvider) ===
|
|
121
53
|
SignInProviderEnum.Dynamic) {
|
|
122
54
|
return jsx(DynamicSocialSignIn, Object.assign({}, componentProps));
|
|
123
55
|
}
|
|
@@ -31,6 +31,7 @@ require('@dynamic-labs-sdk/client/core');
|
|
|
31
31
|
require('../../../client/client.cjs');
|
|
32
32
|
require('@dynamic-labs-sdk/client');
|
|
33
33
|
require('../../../config/ApiEndpoint.cjs');
|
|
34
|
+
var useProjectSettings = require('../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
|
|
34
35
|
require('@dynamic-labs/locale');
|
|
35
36
|
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
36
37
|
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
@@ -112,7 +113,8 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
112
113
|
const NUMBER_OF_WALLETS = 3;
|
|
113
114
|
const useLoginView = () => {
|
|
114
115
|
const loginView = useViewSettings.useViewSettings(sdkApiCore.SdkViewType.Login);
|
|
115
|
-
const {
|
|
116
|
+
const { authorizationViewDisplayOrder, loginWithEmail, walletsFilter } = useInternalDynamicContext.useInternalDynamicContext();
|
|
117
|
+
const projectSettings = useProjectSettings.useProjectSettings();
|
|
116
118
|
const { t } = reactI18next.useTranslation();
|
|
117
119
|
const { enabledSocialProviders } = SocialRedirectContext.useSocialRedirectContext();
|
|
118
120
|
const { numberOfWallets } = useWalletList.useWalletList({
|
|
@@ -157,7 +159,8 @@ const useLoginView = () => {
|
|
|
157
159
|
var _a;
|
|
158
160
|
const hasEnabledNetwork = (chain) => { var _a; return (_a = chain.networks) === null || _a === void 0 ? void 0 : _a.some((network) => network.enabled); };
|
|
159
161
|
const hasEnabledChain = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.chains) === null || _a === void 0 ? void 0 : _a.some((chain) => chain.enabled && hasEnabledNetwork(chain));
|
|
160
|
-
if (
|
|
162
|
+
if (projectSettings &&
|
|
163
|
+
!hasEnabledChain &&
|
|
161
164
|
sections.find((section) => section.type === 'wallet')) {
|
|
162
165
|
logger.logger.error('Failed to render WalletSignInSection - no chains enabled');
|
|
163
166
|
}
|
|
@@ -165,7 +168,7 @@ const useLoginView = () => {
|
|
|
165
168
|
return sections;
|
|
166
169
|
}
|
|
167
170
|
return sections.filter((section) => section.type !== 'wallet');
|
|
168
|
-
}, [numberOfWallets, projectSettings
|
|
171
|
+
}, [numberOfWallets, projectSettings]);
|
|
169
172
|
/**
|
|
170
173
|
* returns the login view sections to be displayed in order from projectSettings?.sdk?.views
|
|
171
174
|
* and has backwards compatibility with project settings design.modal props
|
|
@@ -212,15 +215,16 @@ const useLoginView = () => {
|
|
|
212
215
|
}
|
|
213
216
|
return sections;
|
|
214
217
|
}, [
|
|
215
|
-
|
|
218
|
+
loginView === null || loginView === void 0 ? void 0 : loginView.sections,
|
|
219
|
+
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal,
|
|
216
220
|
enabledSocialProviders,
|
|
217
|
-
filterLoginViewSections,
|
|
218
221
|
hasEmailProviderEnabled,
|
|
222
|
+
hasPasskeyProviderEnabled,
|
|
219
223
|
hasPhoneProviderEnabled,
|
|
220
|
-
loginView === null || loginView === void 0 ? void 0 : loginView.sections,
|
|
221
|
-
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal,
|
|
222
224
|
numberOfWallets,
|
|
225
|
+
authorizationViewDisplayOrder,
|
|
223
226
|
t,
|
|
227
|
+
filterLoginViewSections,
|
|
224
228
|
]);
|
|
225
229
|
return {
|
|
226
230
|
isWalletOnly,
|
|
@@ -27,6 +27,7 @@ import '@dynamic-labs-sdk/client/core';
|
|
|
27
27
|
import '../../../client/client.js';
|
|
28
28
|
import '@dynamic-labs-sdk/client';
|
|
29
29
|
import '../../../config/ApiEndpoint.js';
|
|
30
|
+
import { useProjectSettings } from '../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
|
|
30
31
|
import '@dynamic-labs/locale';
|
|
31
32
|
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
32
33
|
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
@@ -108,7 +109,8 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
108
109
|
const NUMBER_OF_WALLETS = 3;
|
|
109
110
|
const useLoginView = () => {
|
|
110
111
|
const loginView = useViewSettings(SdkViewType.Login);
|
|
111
|
-
const {
|
|
112
|
+
const { authorizationViewDisplayOrder, loginWithEmail, walletsFilter } = useInternalDynamicContext();
|
|
113
|
+
const projectSettings = useProjectSettings();
|
|
112
114
|
const { t } = useTranslation();
|
|
113
115
|
const { enabledSocialProviders } = useSocialRedirectContext();
|
|
114
116
|
const { numberOfWallets } = useWalletList({
|
|
@@ -153,7 +155,8 @@ const useLoginView = () => {
|
|
|
153
155
|
var _a;
|
|
154
156
|
const hasEnabledNetwork = (chain) => { var _a; return (_a = chain.networks) === null || _a === void 0 ? void 0 : _a.some((network) => network.enabled); };
|
|
155
157
|
const hasEnabledChain = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.chains) === null || _a === void 0 ? void 0 : _a.some((chain) => chain.enabled && hasEnabledNetwork(chain));
|
|
156
|
-
if (
|
|
158
|
+
if (projectSettings &&
|
|
159
|
+
!hasEnabledChain &&
|
|
157
160
|
sections.find((section) => section.type === 'wallet')) {
|
|
158
161
|
logger.error('Failed to render WalletSignInSection - no chains enabled');
|
|
159
162
|
}
|
|
@@ -161,7 +164,7 @@ const useLoginView = () => {
|
|
|
161
164
|
return sections;
|
|
162
165
|
}
|
|
163
166
|
return sections.filter((section) => section.type !== 'wallet');
|
|
164
|
-
}, [numberOfWallets, projectSettings
|
|
167
|
+
}, [numberOfWallets, projectSettings]);
|
|
165
168
|
/**
|
|
166
169
|
* returns the login view sections to be displayed in order from projectSettings?.sdk?.views
|
|
167
170
|
* and has backwards compatibility with project settings design.modal props
|
|
@@ -208,15 +211,16 @@ const useLoginView = () => {
|
|
|
208
211
|
}
|
|
209
212
|
return sections;
|
|
210
213
|
}, [
|
|
211
|
-
|
|
214
|
+
loginView === null || loginView === void 0 ? void 0 : loginView.sections,
|
|
215
|
+
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal,
|
|
212
216
|
enabledSocialProviders,
|
|
213
|
-
filterLoginViewSections,
|
|
214
217
|
hasEmailProviderEnabled,
|
|
218
|
+
hasPasskeyProviderEnabled,
|
|
215
219
|
hasPhoneProviderEnabled,
|
|
216
|
-
loginView === null || loginView === void 0 ? void 0 : loginView.sections,
|
|
217
|
-
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal,
|
|
218
220
|
numberOfWallets,
|
|
221
|
+
authorizationViewDisplayOrder,
|
|
219
222
|
t,
|
|
223
|
+
filterLoginViewSections,
|
|
220
224
|
]);
|
|
221
225
|
return {
|
|
222
226
|
isWalletOnly,
|
|
@@ -239,7 +239,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
239
239
|
setShowEditView(false);
|
|
240
240
|
setAgreementChecked(false);
|
|
241
241
|
}, dataTestId: 'embedded-delegation-okay-button', copykey: 'dyn_wallet_delegation.learn_more_okay_button', style: {
|
|
242
|
-
backgroundColor: '
|
|
242
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
243
243
|
border: 'var(--px-to-rem-1) solid var(--dynamic-base-4)',
|
|
244
244
|
width: '100%',
|
|
245
245
|
}, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.learn_more_okay_button') }));
|
|
@@ -249,7 +249,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
249
249
|
color: 'primary',
|
|
250
250
|
weight: 'bold',
|
|
251
251
|
}, onClick: () => setShowAuthFlow(false), dataTestId: 'embedded-delegation-done-button', copykey: 'dyn_wallet_delegation.done_button', style: {
|
|
252
|
-
backgroundColor: '
|
|
252
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
253
253
|
border: 'var(--px-to-rem-1) solid var(--dynamic-base-4)',
|
|
254
254
|
width: '100%',
|
|
255
255
|
}, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.done_button') }));
|
|
@@ -259,7 +259,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
259
259
|
color: 'primary',
|
|
260
260
|
weight: 'bold',
|
|
261
261
|
}, onClick: () => handleDelegateWallets(), dataTestId: 'embedded-delegation-try-again-button', copykey: 'dyn_wallet_delegation.try_again_button', style: {
|
|
262
|
-
backgroundColor: '
|
|
262
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
263
263
|
border: 'var(--px-to-rem-1) solid var(--dynamic-base-4)',
|
|
264
264
|
width: '100%',
|
|
265
265
|
}, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.try_again_button') }));
|
|
@@ -274,7 +274,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
274
274
|
setAgreementChecked(false);
|
|
275
275
|
setShowLearnMoreView(false);
|
|
276
276
|
}, dataTestId: 'embedded-delegation-done-button', copykey: 'dyn_wallet_delegation.done_button', style: {
|
|
277
|
-
backgroundColor: '
|
|
277
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
278
278
|
border: 'var(--px-to-rem-1) solid var(--dynamic-base-4)',
|
|
279
279
|
width: '100%',
|
|
280
280
|
}, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.done_button') }));
|
|
@@ -285,7 +285,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
285
285
|
color: 'primary',
|
|
286
286
|
weight: 'bold',
|
|
287
287
|
}, onClick: () => handleDenySelectedWallets(), dataTestId: 'embedded-delegation-deny-button', copykey: 'dyn_wallet_delegation.deny_button', style: {
|
|
288
|
-
backgroundColor: '
|
|
288
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
289
289
|
border: 'var(--px-to-rem-1) solid var(--dynamic-base-4)',
|
|
290
290
|
width: '100%',
|
|
291
291
|
}, 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: {
|
|
@@ -294,7 +294,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
294
294
|
}, onClick: () => {
|
|
295
295
|
handleLogOut();
|
|
296
296
|
}, dataTestId: 'embedded-delegation-logout-button', copykey: 'dyn_wallet_delegation.logout_button', style: {
|
|
297
|
-
backgroundColor: '
|
|
297
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
298
298
|
border: 'var(--px-to-rem-1) solid var(--dynamic-base-4)',
|
|
299
299
|
width: '100%',
|
|
300
300
|
}, className: 'embedded-delegated-view__body__button embedded-delegated-view__body__logout-button', expanded: true, children: t('dyn_wallet_delegation.logout_button') }))] }));
|
|
@@ -235,7 +235,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
235
235
|
setShowEditView(false);
|
|
236
236
|
setAgreementChecked(false);
|
|
237
237
|
}, dataTestId: 'embedded-delegation-okay-button', copykey: 'dyn_wallet_delegation.learn_more_okay_button', style: {
|
|
238
|
-
backgroundColor: '
|
|
238
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
239
239
|
border: 'var(--px-to-rem-1) solid var(--dynamic-base-4)',
|
|
240
240
|
width: '100%',
|
|
241
241
|
}, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.learn_more_okay_button') }));
|
|
@@ -245,7 +245,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
245
245
|
color: 'primary',
|
|
246
246
|
weight: 'bold',
|
|
247
247
|
}, onClick: () => setShowAuthFlow(false), dataTestId: 'embedded-delegation-done-button', copykey: 'dyn_wallet_delegation.done_button', style: {
|
|
248
|
-
backgroundColor: '
|
|
248
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
249
249
|
border: 'var(--px-to-rem-1) solid var(--dynamic-base-4)',
|
|
250
250
|
width: '100%',
|
|
251
251
|
}, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.done_button') }));
|
|
@@ -255,7 +255,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
255
255
|
color: 'primary',
|
|
256
256
|
weight: 'bold',
|
|
257
257
|
}, onClick: () => handleDelegateWallets(), dataTestId: 'embedded-delegation-try-again-button', copykey: 'dyn_wallet_delegation.try_again_button', style: {
|
|
258
|
-
backgroundColor: '
|
|
258
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
259
259
|
border: 'var(--px-to-rem-1) solid var(--dynamic-base-4)',
|
|
260
260
|
width: '100%',
|
|
261
261
|
}, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.try_again_button') }));
|
|
@@ -270,7 +270,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
270
270
|
setAgreementChecked(false);
|
|
271
271
|
setShowLearnMoreView(false);
|
|
272
272
|
}, dataTestId: 'embedded-delegation-done-button', copykey: 'dyn_wallet_delegation.done_button', style: {
|
|
273
|
-
backgroundColor: '
|
|
273
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
274
274
|
border: 'var(--px-to-rem-1) solid var(--dynamic-base-4)',
|
|
275
275
|
width: '100%',
|
|
276
276
|
}, className: 'embedded-delegated-view__body__button', expanded: true, children: t('dyn_wallet_delegation.done_button') }));
|
|
@@ -281,7 +281,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
281
281
|
color: 'primary',
|
|
282
282
|
weight: 'bold',
|
|
283
283
|
}, onClick: () => handleDenySelectedWallets(), dataTestId: 'embedded-delegation-deny-button', copykey: 'dyn_wallet_delegation.deny_button', style: {
|
|
284
|
-
backgroundColor: '
|
|
284
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
285
285
|
border: 'var(--px-to-rem-1) solid var(--dynamic-base-4)',
|
|
286
286
|
width: '100%',
|
|
287
287
|
}, className: 'embedded-delegated-view__body__button embedded-delegated-view__body__deny-button', expanded: true, children: t('dyn_wallet_delegation.deny_button') })), !isLoading && requiresDelegation && (jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
@@ -290,7 +290,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
290
290
|
}, onClick: () => {
|
|
291
291
|
handleLogOut();
|
|
292
292
|
}, dataTestId: 'embedded-delegation-logout-button', copykey: 'dyn_wallet_delegation.logout_button', style: {
|
|
293
|
-
backgroundColor: '
|
|
293
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
294
294
|
border: 'var(--px-to-rem-1) solid var(--dynamic-base-4)',
|
|
295
295
|
width: '100%',
|
|
296
296
|
}, className: 'embedded-delegated-view__body__button embedded-delegated-view__body__logout-button', expanded: true, children: t('dyn_wallet_delegation.logout_button') }))] }));
|
|
@@ -110,13 +110,6 @@ const currencyFormatter = new Intl.NumberFormat('en-US', {
|
|
|
110
110
|
});
|
|
111
111
|
const TokenBalanceItem = ({ tokenBalance, }) => {
|
|
112
112
|
const { showFiat } = useInternalDynamicContext.useInternalDynamicContext();
|
|
113
|
-
const roundToSixDecimal = (value) => {
|
|
114
|
-
if (value === 0) {
|
|
115
|
-
return '0';
|
|
116
|
-
}
|
|
117
|
-
const rounded = Math.round(value * 1e6) / 1e6; // 10^6 is 1000000
|
|
118
|
-
return rounded === 0 ? '<0.000001' : rounded;
|
|
119
|
-
};
|
|
120
113
|
const formattedFiatValue = () => {
|
|
121
114
|
var _a;
|
|
122
115
|
if (tokenBalance.marketValue !== 0 && !tokenBalance.marketValue) {
|
|
@@ -126,7 +119,7 @@ const TokenBalanceItem = ({ tokenBalance, }) => {
|
|
|
126
119
|
? currencyFormatter.format(parseFloat((_a = tokenBalance.marketValue) === null || _a === void 0 ? void 0 : _a.toFixed(2)))
|
|
127
120
|
: '<$0.01';
|
|
128
121
|
};
|
|
129
|
-
return (jsxRuntime.jsxs("div", { className: 'token-balance-item', children: [jsxRuntime.jsxs("div", { className: 'token-balance-item__name', children: [tokenBalance.logoURI ? (jsxRuntime.jsx(Image.Image, { src: tokenBalance.logoURI, alt: tokenBalance.symbol, className: 'token-balance-item__icon', dataTestId: 'token-balance-item-icon' })) : (jsxRuntime.jsx("div", { className: 'token-balance-item__skeleton-icon', "data-testid": 'token-balance-item__skeleton-icon' })), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', className: 'token-balance-item__title', color: 'primary', children: tokenBalance.name }) })] }), jsxRuntime.jsxs("div", { className: 'flex', children: [showFiat ? (jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', color: 'primary', style: { textAlign: 'right' }, children: formattedFiatValue() })) : null, jsxRuntime.jsx("div", { className: 'token-balance-item__value', children: jsxRuntime.jsxs("div", { className: 'token-balance-item__value__balance', "data-testid": 'token-balance-item-balance', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', style: { marginRight: '2px' }, children:
|
|
122
|
+
return (jsxRuntime.jsxs("div", { className: 'token-balance-item', children: [jsxRuntime.jsxs("div", { className: 'token-balance-item__name', children: [tokenBalance.logoURI ? (jsxRuntime.jsx(Image.Image, { src: tokenBalance.logoURI, alt: tokenBalance.symbol, className: 'token-balance-item__icon', dataTestId: 'token-balance-item-icon' })) : (jsxRuntime.jsx("div", { className: 'token-balance-item__skeleton-icon', "data-testid": 'token-balance-item__skeleton-icon' })), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', className: 'token-balance-item__title', color: 'primary', children: tokenBalance.name }) })] }), jsxRuntime.jsxs("div", { className: 'flex', children: [showFiat ? (jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', color: 'primary', style: { textAlign: 'right' }, children: formattedFiatValue() })) : null, jsxRuntime.jsx("div", { className: 'token-balance-item__value', children: jsxRuntime.jsxs("div", { className: 'token-balance-item__value__balance', "data-testid": 'token-balance-item-balance', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', style: { marginRight: '2px' }, children: tokenBalance.balance }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: tokenBalance.symbol })] }) })] })] }, tokenBalance.address));
|
|
130
123
|
};
|
|
131
124
|
|
|
132
125
|
exports.TokenBalanceItem = TokenBalanceItem;
|
|
@@ -106,13 +106,6 @@ const currencyFormatter = new Intl.NumberFormat('en-US', {
|
|
|
106
106
|
});
|
|
107
107
|
const TokenBalanceItem = ({ tokenBalance, }) => {
|
|
108
108
|
const { showFiat } = useInternalDynamicContext();
|
|
109
|
-
const roundToSixDecimal = (value) => {
|
|
110
|
-
if (value === 0) {
|
|
111
|
-
return '0';
|
|
112
|
-
}
|
|
113
|
-
const rounded = Math.round(value * 1e6) / 1e6; // 10^6 is 1000000
|
|
114
|
-
return rounded === 0 ? '<0.000001' : rounded;
|
|
115
|
-
};
|
|
116
109
|
const formattedFiatValue = () => {
|
|
117
110
|
var _a;
|
|
118
111
|
if (tokenBalance.marketValue !== 0 && !tokenBalance.marketValue) {
|
|
@@ -122,7 +115,7 @@ const TokenBalanceItem = ({ tokenBalance, }) => {
|
|
|
122
115
|
? currencyFormatter.format(parseFloat((_a = tokenBalance.marketValue) === null || _a === void 0 ? void 0 : _a.toFixed(2)))
|
|
123
116
|
: '<$0.01';
|
|
124
117
|
};
|
|
125
|
-
return (jsxs("div", { className: 'token-balance-item', children: [jsxs("div", { className: 'token-balance-item__name', children: [tokenBalance.logoURI ? (jsx(Image, { src: tokenBalance.logoURI, alt: tokenBalance.symbol, className: 'token-balance-item__icon', dataTestId: 'token-balance-item-icon' })) : (jsx("div", { className: 'token-balance-item__skeleton-icon', "data-testid": 'token-balance-item__skeleton-icon' })), jsx("div", { children: jsx(Typography, { variant: 'body_small', className: 'token-balance-item__title', color: 'primary', children: tokenBalance.name }) })] }), jsxs("div", { className: 'flex', children: [showFiat ? (jsx(Typography, { variant: 'body_small', weight: 'bold', color: 'primary', style: { textAlign: 'right' }, children: formattedFiatValue() })) : null, jsx("div", { className: 'token-balance-item__value', children: jsxs("div", { className: 'token-balance-item__value__balance', "data-testid": 'token-balance-item-balance', children: [jsx(Typography, { variant: 'body_small', color: 'secondary', style: { marginRight: '2px' }, children:
|
|
118
|
+
return (jsxs("div", { className: 'token-balance-item', children: [jsxs("div", { className: 'token-balance-item__name', children: [tokenBalance.logoURI ? (jsx(Image, { src: tokenBalance.logoURI, alt: tokenBalance.symbol, className: 'token-balance-item__icon', dataTestId: 'token-balance-item-icon' })) : (jsx("div", { className: 'token-balance-item__skeleton-icon', "data-testid": 'token-balance-item__skeleton-icon' })), jsx("div", { children: jsx(Typography, { variant: 'body_small', className: 'token-balance-item__title', color: 'primary', children: tokenBalance.name }) })] }), jsxs("div", { className: 'flex', children: [showFiat ? (jsx(Typography, { variant: 'body_small', weight: 'bold', color: 'primary', style: { textAlign: 'right' }, children: formattedFiatValue() })) : null, jsx("div", { className: 'token-balance-item__value', children: jsxs("div", { className: 'token-balance-item__value__balance', "data-testid": 'token-balance-item-balance', children: [jsx(Typography, { variant: 'body_small', color: 'secondary', style: { marginRight: '2px' }, children: tokenBalance.balance }), jsx(Typography, { variant: 'body_small', color: 'secondary', children: tokenBalance.symbol })] }) })] })] }, tokenBalance.address));
|
|
126
119
|
};
|
|
127
120
|
|
|
128
121
|
export { TokenBalanceItem };
|