@dynamic-labs/sdk-react-core 4.9.3 → 4.9.5
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 +21 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/index.cjs +0 -2
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -1
- package/src/lib/components/MenuList/DropdownMenu/DropdownMenu.cjs +27 -0
- package/src/lib/components/MenuList/DropdownMenu/DropdownMenu.d.ts +2 -0
- package/src/lib/components/MenuList/DropdownMenu/DropdownMenu.js +23 -0
- package/src/lib/components/MenuList/DropdownMenu/DropdownMenu.types.d.ts +17 -0
- package/src/lib/components/MenuList/DropdownMenu/index.d.ts +2 -0
- package/src/lib/components/MenuList/index.d.ts +1 -0
- package/src/lib/components/NetworkPicker/components/NetworkDropdown/NetworkDropdown.cjs +4 -4
- package/src/lib/components/NetworkPicker/components/NetworkDropdown/NetworkDropdown.js +4 -4
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +1 -2
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +1 -2
- package/src/lib/context/DynamicContext/types/IDynamicContext.d.ts +0 -3
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +0 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +0 -2
- package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.cjs +3 -18
- package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.js +4 -19
- package/src/lib/events/auth.d.ts +0 -5
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/onrampProviders/index.cjs +6 -10
- package/src/lib/utils/functions/onrampProviders/index.d.ts +4 -7
- package/src/lib/utils/functions/onrampProviders/index.js +7 -10
- package/src/lib/utils/functions/openOnrampPopup.cjs +21 -8
- package/src/lib/utils/functions/openOnrampPopup.d.ts +1 -0
- package/src/lib/utils/functions/openOnrampPopup.js +21 -8
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.cjs +4 -1
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.js +4 -1
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +0 -6
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +0 -6
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +1 -1
- package/src/lib/views/LoginView/useLoginView/useLoginView.cjs +9 -15
- package/src/lib/views/LoginView/useLoginView/useLoginView.js +9 -15
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/ActionCard/ActionCard.cjs +1 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/ActionCard/ActionCard.js +1 -1
- package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +1 -1
- package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.js +1 -1
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +1 -1
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.js +1 -1
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +1 -1
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/TokenBalanceItem/TokenBalanceItem.cjs +3 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/TokenBalanceItem/TokenBalanceItem.js +3 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.d.ts +2 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.d.ts +2 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.d.ts +2 -12
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/index.d.ts +0 -1
- package/src/lib/utils/functions/onrampProviders/coinbase.cjs +0 -55
- package/src/lib/utils/functions/onrampProviders/coinbase.d.ts +0 -15
- package/src/lib/utils/functions/onrampProviders/coinbase.js +0 -50
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +0 -105
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.d.ts +0 -2
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +0 -101
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.types.d.ts +0 -7
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/index.d.ts +0 -1
|
@@ -3,22 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Registry of provider-specific URL formatters
|
|
10
|
-
*/
|
|
11
|
-
const providerUrlFormatters = {
|
|
12
|
-
coinbaseOnramp: coinbase.formatCoinbaseOnrampUrl,
|
|
13
|
-
};
|
|
14
8
|
/**
|
|
15
9
|
* Registry of provider display modes (iframe or popup)
|
|
10
|
+
*
|
|
11
|
+
* This mapping controls how each onramp provider is displayed in the UI.
|
|
12
|
+
* - 'popup': Opens in a new browser window/tab
|
|
13
|
+
* - 'iframe': Embedded directly in the current page
|
|
16
14
|
*/
|
|
17
15
|
const providerDisplayModes = {
|
|
18
|
-
|
|
16
|
+
[sdkApiCore.ProviderEnum.CoinbaseOnramp]: 'popup',
|
|
19
17
|
// Default for other providers is iframe
|
|
20
18
|
};
|
|
21
19
|
|
|
22
|
-
exports.formatCoinbaseOnrampUrl = coinbase.formatCoinbaseOnrampUrl;
|
|
23
20
|
exports.providerDisplayModes = providerDisplayModes;
|
|
24
|
-
exports.providerUrlFormatters = providerUrlFormatters;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import type { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
-
import { formatCoinbaseOnrampUrl } from './coinbase';
|
|
3
|
-
/**
|
|
4
|
-
* Registry of provider-specific URL formatters
|
|
5
|
-
*/
|
|
6
|
-
export declare const providerUrlFormatters: Record<string, (url: string, wallet: Wallet) => string>;
|
|
7
1
|
/**
|
|
8
2
|
* Registry of provider display modes (iframe or popup)
|
|
3
|
+
*
|
|
4
|
+
* This mapping controls how each onramp provider is displayed in the UI.
|
|
5
|
+
* - 'popup': Opens in a new browser window/tab
|
|
6
|
+
* - 'iframe': Embedded directly in the current page
|
|
9
7
|
*/
|
|
10
8
|
export declare const providerDisplayModes: Record<string, 'iframe' | 'popup'>;
|
|
11
|
-
export { formatCoinbaseOnrampUrl };
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import {
|
|
3
|
-
export { formatCoinbaseOnrampUrl } from './coinbase.js';
|
|
2
|
+
import { ProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
4
3
|
|
|
5
|
-
/**
|
|
6
|
-
* Registry of provider-specific URL formatters
|
|
7
|
-
*/
|
|
8
|
-
const providerUrlFormatters = {
|
|
9
|
-
coinbaseOnramp: formatCoinbaseOnrampUrl,
|
|
10
|
-
};
|
|
11
4
|
/**
|
|
12
5
|
* Registry of provider display modes (iframe or popup)
|
|
6
|
+
*
|
|
7
|
+
* This mapping controls how each onramp provider is displayed in the UI.
|
|
8
|
+
* - 'popup': Opens in a new browser window/tab
|
|
9
|
+
* - 'iframe': Embedded directly in the current page
|
|
13
10
|
*/
|
|
14
11
|
const providerDisplayModes = {
|
|
15
|
-
|
|
12
|
+
[ProviderEnum.CoinbaseOnramp]: 'popup',
|
|
16
13
|
// Default for other providers is iframe
|
|
17
14
|
};
|
|
18
15
|
|
|
19
|
-
export { providerDisplayModes
|
|
16
|
+
export { providerDisplayModes };
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
8
|
-
var index = require('./onrampProviders/index.cjs');
|
|
9
8
|
var openPopup = require('./openPopup/openPopup.cjs');
|
|
10
9
|
|
|
11
10
|
const ONRAMP_POPUP_CONFIG = {
|
|
@@ -19,16 +18,30 @@ const ONRAMP_POPUP_CONFIG = {
|
|
|
19
18
|
* @param setShowOnramp Callback to update the UI state when popup is closed
|
|
20
19
|
* @param provider The onramp provider ID
|
|
21
20
|
* @returns A promise that resolves when the popup is opened
|
|
21
|
+
* @throws Error if there are issues with URL, wallet compatibility, etc.
|
|
22
22
|
*/
|
|
23
23
|
const openOnrampPopup = (url_1, wallet_1, setShowOnramp_1, ...args_1) => _tslib.__awaiter(void 0, [url_1, wallet_1, setShowOnramp_1, ...args_1], void 0, function* (url, wallet, setShowOnramp, provider = sdkApiCore.OnrampProviders.CoinbaseOnramp) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
//
|
|
24
|
+
try {
|
|
25
|
+
// Safety check: don't open popup with empty URL
|
|
26
|
+
if (!url) {
|
|
27
|
+
throw new Error('Cannot open onramp popup: Empty URL');
|
|
28
|
+
}
|
|
29
|
+
// Open the popup - errors will propagate to the caller
|
|
30
|
+
yield openPopup.openPopup(url, ONRAMP_POPUP_CONFIG.width, ONRAMP_POPUP_CONFIG.height, () => {
|
|
31
|
+
// When the popup is closed (by user or programmatically), update the UI
|
|
32
|
+
setShowOnramp(false);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
// Always set showOnramp to false on any error
|
|
30
37
|
setShowOnramp(false);
|
|
31
|
-
|
|
38
|
+
// Re-throw any error
|
|
39
|
+
if (error instanceof Error) {
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
// For non-Error objects, wrap in a generic Error
|
|
43
|
+
throw new Error('Error opening onramp popup');
|
|
44
|
+
}
|
|
32
45
|
});
|
|
33
46
|
|
|
34
47
|
exports.ONRAMP_POPUP_CONFIG = ONRAMP_POPUP_CONFIG;
|
|
@@ -11,5 +11,6 @@ export declare const ONRAMP_POPUP_CONFIG: {
|
|
|
11
11
|
* @param setShowOnramp Callback to update the UI state when popup is closed
|
|
12
12
|
* @param provider The onramp provider ID
|
|
13
13
|
* @returns A promise that resolves when the popup is opened
|
|
14
|
+
* @throws Error if there are issues with URL, wallet compatibility, etc.
|
|
14
15
|
*/
|
|
15
16
|
export declare const openOnrampPopup: (url: string, wallet: Wallet | undefined, setShowOnramp: (show: boolean) => void, provider?: OnrampProviders) => Promise<void>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
3
3
|
import { OnrampProviders } from '@dynamic-labs/sdk-api-core';
|
|
4
|
-
import { providerUrlFormatters } from './onrampProviders/index.js';
|
|
5
4
|
import { openPopup } from './openPopup/openPopup.js';
|
|
6
5
|
|
|
7
6
|
const ONRAMP_POPUP_CONFIG = {
|
|
@@ -15,16 +14,30 @@ const ONRAMP_POPUP_CONFIG = {
|
|
|
15
14
|
* @param setShowOnramp Callback to update the UI state when popup is closed
|
|
16
15
|
* @param provider The onramp provider ID
|
|
17
16
|
* @returns A promise that resolves when the popup is opened
|
|
17
|
+
* @throws Error if there are issues with URL, wallet compatibility, etc.
|
|
18
18
|
*/
|
|
19
19
|
const openOnrampPopup = (url_1, wallet_1, setShowOnramp_1, ...args_1) => __awaiter(void 0, [url_1, wallet_1, setShowOnramp_1, ...args_1], void 0, function* (url, wallet, setShowOnramp, provider = OnrampProviders.CoinbaseOnramp) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
//
|
|
20
|
+
try {
|
|
21
|
+
// Safety check: don't open popup with empty URL
|
|
22
|
+
if (!url) {
|
|
23
|
+
throw new Error('Cannot open onramp popup: Empty URL');
|
|
24
|
+
}
|
|
25
|
+
// Open the popup - errors will propagate to the caller
|
|
26
|
+
yield openPopup(url, ONRAMP_POPUP_CONFIG.width, ONRAMP_POPUP_CONFIG.height, () => {
|
|
27
|
+
// When the popup is closed (by user or programmatically), update the UI
|
|
28
|
+
setShowOnramp(false);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
// Always set showOnramp to false on any error
|
|
26
33
|
setShowOnramp(false);
|
|
27
|
-
|
|
34
|
+
// Re-throw any error
|
|
35
|
+
if (error instanceof Error) {
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
// For non-Error objects, wrap in a generic Error
|
|
39
|
+
throw new Error('Error opening onramp popup');
|
|
40
|
+
}
|
|
28
41
|
});
|
|
29
42
|
|
|
30
43
|
export { ONRAMP_POPUP_CONFIG, openOnrampPopup };
|
|
@@ -160,7 +160,10 @@ const useTokenBalances = ({ accountAddress, networkId, chainName = sdkApiCore.Ch
|
|
|
160
160
|
tokenBalances.setTokenBalanceVariable('error', errorMessage);
|
|
161
161
|
}
|
|
162
162
|
finally {
|
|
163
|
-
|
|
163
|
+
// remove tokens with 0 balance. This should only be required
|
|
164
|
+
// for native tokens as they are returned in the response even if the balance is 0
|
|
165
|
+
const filteredResponse = response === null || response === void 0 ? void 0 : response.filter((token) => token.balance !== 0);
|
|
166
|
+
tokenBalances.setTokenBalanceVariable('tokenBalances', filteredResponse);
|
|
164
167
|
tokenBalances.setTokenBalanceVariable('isLoading', false);
|
|
165
168
|
}
|
|
166
169
|
}), [
|
|
@@ -156,7 +156,10 @@ const useTokenBalances = ({ accountAddress, networkId, chainName = ChainEnum.Evm
|
|
|
156
156
|
setTokenBalanceVariable('error', errorMessage);
|
|
157
157
|
}
|
|
158
158
|
finally {
|
|
159
|
-
|
|
159
|
+
// remove tokens with 0 balance. This should only be required
|
|
160
|
+
// for native tokens as they are returned in the response even if the balance is 0
|
|
161
|
+
const filteredResponse = response === null || response === void 0 ? void 0 : response.filter((token) => token.balance !== 0);
|
|
162
|
+
setTokenBalanceVariable('tokenBalances', filteredResponse);
|
|
160
163
|
setTokenBalanceVariable('isLoading', false);
|
|
161
164
|
}
|
|
162
165
|
}), [
|
|
@@ -7,7 +7,6 @@ var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var logger = require('../../../shared/logger.cjs');
|
|
9
9
|
var loadingAndLifecycle = require('../../../store/state/loadingAndLifecycle.cjs');
|
|
10
|
-
var useDynamicEvents = require('../events/useDynamicEvents/useDynamicEvents.cjs');
|
|
11
10
|
var projectSettings = require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
12
11
|
var handleStoreAndEnvironmentMismatch = require('./handleStoreAndEnvironmentMismatch/handleStoreAndEnvironmentMismatch.cjs');
|
|
13
12
|
var handleUserDataOutOfSync = require('./handleUserDataOutOfSync/handleUserDataOutOfSync.cjs');
|
|
@@ -42,11 +41,6 @@ const useValidateSession = ({ environmentId, handleLogOut }) => {
|
|
|
42
41
|
didRunRef.current = true;
|
|
43
42
|
validateSession(projectSettings$1);
|
|
44
43
|
}, [validateSession, projectSettings$1]);
|
|
45
|
-
useDynamicEvents.useInternalDynamicEvents('triggerSessionValidation', () => {
|
|
46
|
-
if (!projectSettings$1)
|
|
47
|
-
return;
|
|
48
|
-
validateSession(projectSettings$1);
|
|
49
|
-
});
|
|
50
44
|
};
|
|
51
45
|
|
|
52
46
|
exports.useValidateSession = useValidateSession;
|
|
@@ -3,7 +3,6 @@ import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { useRef, useCallback, useEffect } from 'react';
|
|
4
4
|
import { logger } from '../../../shared/logger.js';
|
|
5
5
|
import { setLoadingAndLifecycle } from '../../../store/state/loadingAndLifecycle.js';
|
|
6
|
-
import { useInternalDynamicEvents } from '../events/useDynamicEvents/useDynamicEvents.js';
|
|
7
6
|
import { useProjectSettings } from '../../../store/state/projectSettings/projectSettings.js';
|
|
8
7
|
import { handleStoreAndEnvironmentMismatch } from './handleStoreAndEnvironmentMismatch/handleStoreAndEnvironmentMismatch.js';
|
|
9
8
|
import { handleUserDataOutOfSync } from './handleUserDataOutOfSync/handleUserDataOutOfSync.js';
|
|
@@ -38,11 +37,6 @@ const useValidateSession = ({ environmentId, handleLogOut }) => {
|
|
|
38
37
|
didRunRef.current = true;
|
|
39
38
|
validateSession(projectSettings);
|
|
40
39
|
}, [validateSession, projectSettings]);
|
|
41
|
-
useInternalDynamicEvents('triggerSessionValidation', () => {
|
|
42
|
-
if (!projectSettings)
|
|
43
|
-
return;
|
|
44
|
-
validateSession(projectSettings);
|
|
45
|
-
});
|
|
46
40
|
};
|
|
47
41
|
|
|
48
42
|
export { useValidateSession };
|
package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs
CHANGED
|
@@ -71,6 +71,7 @@ var ListTile = require('../../../../../components/ListTile/ListTile.cjs');
|
|
|
71
71
|
require('../../../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
72
72
|
require('../../../../../components/IconButton/IconButton.cjs');
|
|
73
73
|
require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
74
|
+
var Badge = require('../../../../../components/Badge/Badge.cjs');
|
|
74
75
|
require('formik');
|
|
75
76
|
require('../../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
76
77
|
require('../../../../../store/state/sendBalances.cjs');
|
|
@@ -88,7 +89,6 @@ require('../../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs'
|
|
|
88
89
|
require('../../../../../context/ConnectWithOtpContext/constants.cjs');
|
|
89
90
|
require('../../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
90
91
|
require('@hcaptcha/react-hcaptcha');
|
|
91
|
-
var Badge = require('../../../../../components/Badge/Badge.cjs');
|
|
92
92
|
require('../../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
93
93
|
require('../../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
94
94
|
require('../../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js
CHANGED
|
@@ -67,6 +67,7 @@ import { ListTile } from '../../../../../components/ListTile/ListTile.js';
|
|
|
67
67
|
import '../../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
68
68
|
import '../../../../../components/IconButton/IconButton.js';
|
|
69
69
|
import '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
70
|
+
import { Badge } from '../../../../../components/Badge/Badge.js';
|
|
70
71
|
import 'formik';
|
|
71
72
|
import '../../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
72
73
|
import '../../../../../store/state/sendBalances.js';
|
|
@@ -84,7 +85,6 @@ import '../../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
|
84
85
|
import '../../../../../context/ConnectWithOtpContext/constants.js';
|
|
85
86
|
import '../../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
86
87
|
import '@hcaptcha/react-hcaptcha';
|
|
87
|
-
import { Badge } from '../../../../../components/Badge/Badge.js';
|
|
88
88
|
import '../../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
89
89
|
import '../../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
90
90
|
import '../../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
@@ -74,6 +74,7 @@ require('react-focus-lock');
|
|
|
74
74
|
require('qrcode');
|
|
75
75
|
require('formik');
|
|
76
76
|
require('../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
77
|
+
var useWalletList = require('../../../utils/hooks/useWalletList/useWalletList.cjs');
|
|
77
78
|
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
78
79
|
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
79
80
|
require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
@@ -103,21 +104,15 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
103
104
|
const NUMBER_OF_WALLETS = 3;
|
|
104
105
|
const useLoginView = () => {
|
|
105
106
|
const loginView = useViewSettings.useViewSettings(sdkApiCore.SdkViewType.Login);
|
|
106
|
-
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail,
|
|
107
|
+
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, walletsFilter, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
107
108
|
const { t } = reactI18next.useTranslation();
|
|
108
109
|
const { enabledSocialProviders } = SocialRedirectContext.useSocialRedirectContext();
|
|
110
|
+
const { numberOfWallets } = useWalletList.useWalletList({
|
|
111
|
+
viewWalletsFilter: walletsFilter,
|
|
112
|
+
});
|
|
109
113
|
const hasSocialProvidersEnabled = Boolean(enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length);
|
|
110
114
|
const hasEmailProviderEnabled = isEmailProviderEnabled.isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
111
115
|
const hasPhoneProviderEnabled = isPhoneNumberProviderEnabled.isPhoneNumberProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
112
|
-
/** Takes from wallets only those that can be selected in the wallet list by the user.
|
|
113
|
-
* Should filter out embedded wallets
|
|
114
|
-
* WHY: when we decide whether to show wallets or not, we need to know how many wallets
|
|
115
|
-
* will actually be rendered. It would be especially bad to only have for ex "turnkey" in
|
|
116
|
-
* wallets and then display an empty wallet list (since turnkey doesn't render)
|
|
117
|
-
*/
|
|
118
|
-
const selectableWallets = (walletsFilter
|
|
119
|
-
? walletsFilter(walletConnectorOptions)
|
|
120
|
-
: walletConnectorOptions).filter(({ key }) => key !== 'turnkey');
|
|
121
116
|
const isWalletOnly = React.useMemo(() => {
|
|
122
117
|
var _a;
|
|
123
118
|
if (!projectSettings) {
|
|
@@ -158,11 +153,11 @@ const useLoginView = () => {
|
|
|
158
153
|
sections.find((section) => section.type === 'wallet')) {
|
|
159
154
|
logger.logger.error('Failed to render WalletSignInSection - no chains enabled');
|
|
160
155
|
}
|
|
161
|
-
if (
|
|
156
|
+
if (numberOfWallets > 0) {
|
|
162
157
|
return sections;
|
|
163
158
|
}
|
|
164
159
|
return sections.filter((section) => section.type !== 'wallet');
|
|
165
|
-
}, [
|
|
160
|
+
}, [numberOfWallets, projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.chains]);
|
|
166
161
|
/**
|
|
167
162
|
* returns the login view sections to be displayed in order from projectSettings?.sdk?.views
|
|
168
163
|
* and has backwards compatibility with project settings design.modal props
|
|
@@ -185,8 +180,7 @@ const useLoginView = () => {
|
|
|
185
180
|
showPhone: hasPhoneProviderEnabled,
|
|
186
181
|
showSocial: Boolean(enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length),
|
|
187
182
|
// is email only is set in the project settings when the "Email (Web2) only" is toggled on in the dashboard
|
|
188
|
-
showWallets:
|
|
189
|
-
!((_f = (_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _e === void 0 ? void 0 : _e.modal) === null || _f === void 0 ? void 0 : _f.emailOnly),
|
|
183
|
+
showWallets: numberOfWallets > 0 && !((_f = (_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _e === void 0 ? void 0 : _e.modal) === null || _f === void 0 ? void 0 : _f.emailOnly),
|
|
190
184
|
socialAboveEmail,
|
|
191
185
|
splitEmailAndSocial,
|
|
192
186
|
web3Layout: authorizationViewDisplayOrder === 'web3',
|
|
@@ -216,7 +210,7 @@ const useLoginView = () => {
|
|
|
216
210
|
hasPhoneProviderEnabled,
|
|
217
211
|
loginView === null || loginView === void 0 ? void 0 : loginView.sections,
|
|
218
212
|
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal,
|
|
219
|
-
|
|
213
|
+
numberOfWallets,
|
|
220
214
|
t,
|
|
221
215
|
]);
|
|
222
216
|
return {
|
|
@@ -70,6 +70,7 @@ import 'react-focus-lock';
|
|
|
70
70
|
import 'qrcode';
|
|
71
71
|
import 'formik';
|
|
72
72
|
import '../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
73
|
+
import { useWalletList } from '../../../utils/hooks/useWalletList/useWalletList.js';
|
|
73
74
|
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
74
75
|
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
75
76
|
import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
@@ -99,21 +100,15 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
99
100
|
const NUMBER_OF_WALLETS = 3;
|
|
100
101
|
const useLoginView = () => {
|
|
101
102
|
const loginView = useViewSettings(SdkViewType.Login);
|
|
102
|
-
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail,
|
|
103
|
+
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, walletsFilter, } = useInternalDynamicContext();
|
|
103
104
|
const { t } = useTranslation();
|
|
104
105
|
const { enabledSocialProviders } = useSocialRedirectContext();
|
|
106
|
+
const { numberOfWallets } = useWalletList({
|
|
107
|
+
viewWalletsFilter: walletsFilter,
|
|
108
|
+
});
|
|
105
109
|
const hasSocialProvidersEnabled = Boolean(enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length);
|
|
106
110
|
const hasEmailProviderEnabled = isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
107
111
|
const hasPhoneProviderEnabled = isPhoneNumberProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
108
|
-
/** Takes from wallets only those that can be selected in the wallet list by the user.
|
|
109
|
-
* Should filter out embedded wallets
|
|
110
|
-
* WHY: when we decide whether to show wallets or not, we need to know how many wallets
|
|
111
|
-
* will actually be rendered. It would be especially bad to only have for ex "turnkey" in
|
|
112
|
-
* wallets and then display an empty wallet list (since turnkey doesn't render)
|
|
113
|
-
*/
|
|
114
|
-
const selectableWallets = (walletsFilter
|
|
115
|
-
? walletsFilter(walletConnectorOptions)
|
|
116
|
-
: walletConnectorOptions).filter(({ key }) => key !== 'turnkey');
|
|
117
112
|
const isWalletOnly = useMemo(() => {
|
|
118
113
|
var _a;
|
|
119
114
|
if (!projectSettings) {
|
|
@@ -154,11 +149,11 @@ const useLoginView = () => {
|
|
|
154
149
|
sections.find((section) => section.type === 'wallet')) {
|
|
155
150
|
logger.error('Failed to render WalletSignInSection - no chains enabled');
|
|
156
151
|
}
|
|
157
|
-
if (
|
|
152
|
+
if (numberOfWallets > 0) {
|
|
158
153
|
return sections;
|
|
159
154
|
}
|
|
160
155
|
return sections.filter((section) => section.type !== 'wallet');
|
|
161
|
-
}, [
|
|
156
|
+
}, [numberOfWallets, projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.chains]);
|
|
162
157
|
/**
|
|
163
158
|
* returns the login view sections to be displayed in order from projectSettings?.sdk?.views
|
|
164
159
|
* and has backwards compatibility with project settings design.modal props
|
|
@@ -181,8 +176,7 @@ const useLoginView = () => {
|
|
|
181
176
|
showPhone: hasPhoneProviderEnabled,
|
|
182
177
|
showSocial: Boolean(enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length),
|
|
183
178
|
// is email only is set in the project settings when the "Email (Web2) only" is toggled on in the dashboard
|
|
184
|
-
showWallets:
|
|
185
|
-
!((_f = (_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _e === void 0 ? void 0 : _e.modal) === null || _f === void 0 ? void 0 : _f.emailOnly),
|
|
179
|
+
showWallets: numberOfWallets > 0 && !((_f = (_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _e === void 0 ? void 0 : _e.modal) === null || _f === void 0 ? void 0 : _f.emailOnly),
|
|
186
180
|
socialAboveEmail,
|
|
187
181
|
splitEmailAndSocial,
|
|
188
182
|
web3Layout: authorizationViewDisplayOrder === 'web3',
|
|
@@ -212,7 +206,7 @@ const useLoginView = () => {
|
|
|
212
206
|
hasPhoneProviderEnabled,
|
|
213
207
|
loginView === null || loginView === void 0 ? void 0 : loginView.sections,
|
|
214
208
|
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal,
|
|
215
|
-
|
|
209
|
+
numberOfWallets,
|
|
216
210
|
t,
|
|
217
211
|
]);
|
|
218
212
|
return {
|
|
@@ -71,6 +71,7 @@ var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
|
71
71
|
require('../../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
72
72
|
require('../../../../components/IconButton/IconButton.cjs');
|
|
73
73
|
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
74
|
+
var Badge = require('../../../../components/Badge/Badge.cjs');
|
|
74
75
|
var spinner = require('../../../../components/Spinner/spinner.cjs');
|
|
75
76
|
require('formik');
|
|
76
77
|
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
@@ -89,7 +90,6 @@ require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
|
89
90
|
require('../../../../context/ConnectWithOtpContext/constants.cjs');
|
|
90
91
|
require('../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
91
92
|
require('@hcaptcha/react-hcaptcha');
|
|
92
|
-
var Badge = require('../../../../components/Badge/Badge.cjs');
|
|
93
93
|
require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
94
94
|
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
95
95
|
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
@@ -67,6 +67,7 @@ import { Icon } from '../../../../components/Icon/Icon.js';
|
|
|
67
67
|
import '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
68
68
|
import '../../../../components/IconButton/IconButton.js';
|
|
69
69
|
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
70
|
+
import { Badge } from '../../../../components/Badge/Badge.js';
|
|
70
71
|
import { Spinner } from '../../../../components/Spinner/spinner.js';
|
|
71
72
|
import 'formik';
|
|
72
73
|
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
@@ -85,7 +86,6 @@ import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
|
85
86
|
import '../../../../context/ConnectWithOtpContext/constants.js';
|
|
86
87
|
import '../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
87
88
|
import '@hcaptcha/react-hcaptcha';
|
|
88
|
-
import { Badge } from '../../../../components/Badge/Badge.js';
|
|
89
89
|
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
90
90
|
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
91
91
|
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs
CHANGED
|
@@ -75,6 +75,7 @@ var ListTile = require('../../../../components/ListTile/ListTile.cjs');
|
|
|
75
75
|
require('../../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
76
76
|
require('../../../../components/IconButton/IconButton.cjs');
|
|
77
77
|
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
78
|
+
var Badge = require('../../../../components/Badge/Badge.cjs');
|
|
78
79
|
require('formik');
|
|
79
80
|
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
80
81
|
require('../../../../store/state/sendBalances.cjs');
|
|
@@ -92,7 +93,6 @@ require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
|
92
93
|
require('../../../../context/ConnectWithOtpContext/constants.cjs');
|
|
93
94
|
require('../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
94
95
|
require('@hcaptcha/react-hcaptcha');
|
|
95
|
-
var Badge = require('../../../../components/Badge/Badge.cjs');
|
|
96
96
|
require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
97
97
|
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
98
98
|
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.js
CHANGED
|
@@ -71,6 +71,7 @@ import { ListTile } from '../../../../components/ListTile/ListTile.js';
|
|
|
71
71
|
import '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
72
72
|
import '../../../../components/IconButton/IconButton.js';
|
|
73
73
|
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
74
|
+
import { Badge } from '../../../../components/Badge/Badge.js';
|
|
74
75
|
import 'formik';
|
|
75
76
|
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
76
77
|
import '../../../../store/state/sendBalances.js';
|
|
@@ -88,7 +89,6 @@ import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
|
88
89
|
import '../../../../context/ConnectWithOtpContext/constants.js';
|
|
89
90
|
import '../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
90
91
|
import '@hcaptcha/react-hcaptcha';
|
|
91
|
-
import { Badge } from '../../../../components/Badge/Badge.js';
|
|
92
92
|
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
93
93
|
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
94
94
|
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
@@ -75,6 +75,7 @@ var ListTile = require('../../../../components/ListTile/ListTile.cjs');
|
|
|
75
75
|
require('../../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
76
76
|
require('../../../../components/IconButton/IconButton.cjs');
|
|
77
77
|
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
78
|
+
var Badge = require('../../../../components/Badge/Badge.cjs');
|
|
78
79
|
require('formik');
|
|
79
80
|
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
80
81
|
require('../../../../store/state/sendBalances.cjs');
|
|
@@ -92,7 +93,6 @@ require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
|
92
93
|
require('../../../../context/ConnectWithOtpContext/constants.cjs');
|
|
93
94
|
require('../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
94
95
|
require('@hcaptcha/react-hcaptcha');
|
|
95
|
-
var Badge = require('../../../../components/Badge/Badge.cjs');
|
|
96
96
|
require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
97
97
|
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
98
98
|
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
@@ -71,6 +71,7 @@ import { ListTile } from '../../../../components/ListTile/ListTile.js';
|
|
|
71
71
|
import '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
72
72
|
import '../../../../components/IconButton/IconButton.js';
|
|
73
73
|
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
74
|
+
import { Badge } from '../../../../components/Badge/Badge.js';
|
|
74
75
|
import 'formik';
|
|
75
76
|
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
76
77
|
import '../../../../store/state/sendBalances.js';
|
|
@@ -88,7 +89,6 @@ import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
|
88
89
|
import '../../../../context/ConnectWithOtpContext/constants.js';
|
|
89
90
|
import '../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
90
91
|
import '@hcaptcha/react-hcaptcha';
|
|
91
|
-
import { Badge } from '../../../../components/Badge/Badge.js';
|
|
92
92
|
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
93
93
|
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
94
94
|
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
@@ -75,6 +75,7 @@ var ListTile = require('../../../components/ListTile/ListTile.cjs');
|
|
|
75
75
|
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
76
76
|
require('../../../components/IconButton/IconButton.cjs');
|
|
77
77
|
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
78
|
+
var Badge = require('../../../components/Badge/Badge.cjs');
|
|
78
79
|
require('formik');
|
|
79
80
|
require('../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
80
81
|
require('../../../store/state/sendBalances.cjs');
|
|
@@ -92,7 +93,6 @@ require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
|
92
93
|
require('../../../context/ConnectWithOtpContext/constants.cjs');
|
|
93
94
|
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
94
95
|
require('@hcaptcha/react-hcaptcha');
|
|
95
|
-
var Badge = require('../../../components/Badge/Badge.cjs');
|
|
96
96
|
require('../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
97
97
|
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
98
98
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
@@ -71,6 +71,7 @@ import { ListTile } from '../../../components/ListTile/ListTile.js';
|
|
|
71
71
|
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
72
72
|
import '../../../components/IconButton/IconButton.js';
|
|
73
73
|
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
74
|
+
import { Badge } from '../../../components/Badge/Badge.js';
|
|
74
75
|
import 'formik';
|
|
75
76
|
import '../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
76
77
|
import '../../../store/state/sendBalances.js';
|
|
@@ -88,7 +89,6 @@ import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
|
88
89
|
import '../../../context/ConnectWithOtpContext/constants.js';
|
|
89
90
|
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
90
91
|
import '@hcaptcha/react-hcaptcha';
|
|
91
|
-
import { Badge } from '../../../components/Badge/Badge.js';
|
|
92
92
|
import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
93
93
|
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
94
94
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
@@ -104,6 +104,9 @@ const currencyFormatter = new Intl.NumberFormat('en-US', {
|
|
|
104
104
|
const TokenBalanceItem = ({ tokenBalance, }) => {
|
|
105
105
|
const { showFiat } = useInternalDynamicContext.useInternalDynamicContext();
|
|
106
106
|
const roundToSixDecimal = (value) => {
|
|
107
|
+
if (value === 0) {
|
|
108
|
+
return '0';
|
|
109
|
+
}
|
|
107
110
|
const rounded = Math.round(value * 1e6) / 1e6; // 10^6 is 1000000
|
|
108
111
|
return rounded === 0 ? '<0.000001' : rounded;
|
|
109
112
|
};
|
|
@@ -100,6 +100,9 @@ const currencyFormatter = new Intl.NumberFormat('en-US', {
|
|
|
100
100
|
const TokenBalanceItem = ({ tokenBalance, }) => {
|
|
101
101
|
const { showFiat } = useInternalDynamicContext();
|
|
102
102
|
const roundToSixDecimal = (value) => {
|
|
103
|
+
if (value === 0) {
|
|
104
|
+
return '0';
|
|
105
|
+
}
|
|
103
106
|
const rounded = Math.round(value * 1e6) / 1e6; // 10^6 is 1000000
|
|
104
107
|
return rounded === 0 ? '<0.000001' : rounded;
|
|
105
108
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { MenuOption } from '../../../../../components';
|
|
2
3
|
import { Wallet } from '../../../../../shared';
|
|
3
|
-
import { DotsMenuOption } from '../../DotsMenu';
|
|
4
4
|
type Props = {
|
|
5
|
-
menuOption:
|
|
5
|
+
menuOption: MenuOption[];
|
|
6
6
|
wallet?: Wallet;
|
|
7
7
|
};
|
|
8
8
|
export declare const ActiveBitcoinWalletAddresses: ({ menuOption, wallet }: Props) => JSX.Element;
|
|
@@ -72,7 +72,7 @@ require('react-focus-lock');
|
|
|
72
72
|
require('../../../context/DynamicWidgetContext.cjs');
|
|
73
73
|
require('../../../../../components/IconButton/IconButton.cjs');
|
|
74
74
|
var Dropdown = require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
75
|
-
var
|
|
75
|
+
var DropdownMenu = require('../../../../../components/MenuList/DropdownMenu/DropdownMenu.cjs');
|
|
76
76
|
var BaseButton = require('../../../../../components/BaseButton/BaseButton.cjs');
|
|
77
77
|
require('formik');
|
|
78
78
|
require('../../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
@@ -144,7 +144,7 @@ const ActiveWalletAddress = ({ wallet, nameServiceName, menuOption, fullWidth =
|
|
|
144
144
|
const menuIcon = React.useMemo(() => (jsxRuntime.jsx("div", { ref: iconRef, className: 'active-wallet-information__handle-icon', children: showAlert() ? (jsxRuntime.jsx(IconWithStatus.IconWithStatus, { Icon: () => jsxRuntime.jsx(arrowDown.ReactComponent, { width: 24, height: 24 }), variant: 'yellow' })) : (jsxRuntime.jsx(arrowDown.ReactComponent, { width: 24, height: 24 })) })), [showAlert]);
|
|
145
145
|
return (jsxRuntime.jsxs("div", { className: 'active-wallet-information__address-container', children: [jsxRuntime.jsxs(BaseButton.BaseButton, { onClick: handleMenuOpen, dataTestId: 'active-wallet-information-button', children: [jsxRuntime.jsxs("div", { className: 'active-wallet-information__handle-row', children: [jsxRuntime.jsx(Typography.Typography, { className: fullWidth
|
|
146
146
|
? 'active-wallet-information__handle--full-width'
|
|
147
|
-
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', "data-testid": 'header-text', children: header }), header && menuIcon] }), jsxRuntime.jsxs("div", { className: 'active-wallet-information__handle-row', children: [jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress.shortenWalletAddress(address, 4, 4)) }), !header && menuIcon] })] }), jsxRuntime.jsx(Dropdown.Dropdown, { isOpen: showMenu, onClickOutside: handleMenuClose, onScroll: handleMenuClose, anchorRef: iconRef, anchorOrigin: 'bottom-right', transformOrigin: 'top-left', children: jsxRuntime.jsx(
|
|
147
|
+
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', "data-testid": 'header-text', children: header }), header && menuIcon] }), jsxRuntime.jsxs("div", { className: 'active-wallet-information__handle-row', children: [jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress.shortenWalletAddress(address, 4, 4)) }), !header && menuIcon] })] }), jsxRuntime.jsx(Dropdown.Dropdown, { isOpen: showMenu, onClickOutside: handleMenuClose, onScroll: handleMenuClose, anchorRef: iconRef, anchorOrigin: 'bottom-right', transformOrigin: 'top-left', children: jsxRuntime.jsx(DropdownMenu.DropdownMenu, { options: menuOption, setShowMenu: setShowMenu }) })] }));
|
|
148
148
|
};
|
|
149
149
|
|
|
150
150
|
exports.ActiveWalletAddress = ActiveWalletAddress;
|