@dynamic-labs/sdk-react-core 4.9.4 → 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 +13 -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/types/IDynamicContext.d.ts +0 -3
- package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.cjs +3 -18
- package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.js +4 -19
- 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/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/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
|
}), [
|
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';
|
|
@@ -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;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { type MenuOption } from '../../../../../components/MenuList/DropdownMenu';
|
|
2
3
|
import { Wallet } from '../../../../../shared';
|
|
3
|
-
import { DotsMenuOption } from '../../DotsMenu';
|
|
4
4
|
type ActiveWalletAddressProps = {
|
|
5
5
|
wallet: Wallet | null;
|
|
6
6
|
nameServiceName?: string;
|
|
7
|
-
menuOption:
|
|
7
|
+
menuOption: MenuOption[];
|
|
8
8
|
fullWidth?: boolean;
|
|
9
9
|
isLoading?: boolean;
|
|
10
10
|
};
|
|
@@ -68,7 +68,7 @@ import 'react-focus-lock';
|
|
|
68
68
|
import '../../../context/DynamicWidgetContext.js';
|
|
69
69
|
import '../../../../../components/IconButton/IconButton.js';
|
|
70
70
|
import { Dropdown } from '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
71
|
-
import {
|
|
71
|
+
import { DropdownMenu } from '../../../../../components/MenuList/DropdownMenu/DropdownMenu.js';
|
|
72
72
|
import { BaseButton } from '../../../../../components/BaseButton/BaseButton.js';
|
|
73
73
|
import 'formik';
|
|
74
74
|
import '../../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
@@ -140,7 +140,7 @@ const ActiveWalletAddress = ({ wallet, nameServiceName, menuOption, fullWidth =
|
|
|
140
140
|
const menuIcon = useMemo(() => (jsx("div", { ref: iconRef, className: 'active-wallet-information__handle-icon', children: showAlert() ? (jsx(IconWithStatus, { Icon: () => jsx(SvgArrowDown, { width: 24, height: 24 }), variant: 'yellow' })) : (jsx(SvgArrowDown, { width: 24, height: 24 })) })), [showAlert]);
|
|
141
141
|
return (jsxs("div", { className: 'active-wallet-information__address-container', children: [jsxs(BaseButton, { onClick: handleMenuOpen, dataTestId: 'active-wallet-information-button', children: [jsxs("div", { className: 'active-wallet-information__handle-row', children: [jsx(Typography, { className: fullWidth
|
|
142
142
|
? 'active-wallet-information__handle--full-width'
|
|
143
|
-
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', "data-testid": 'header-text', children: header }), header && menuIcon] }), jsxs("div", { className: 'active-wallet-information__handle-row', children: [jsx(Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsx(Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress(address, 4, 4)) }), !header && menuIcon] })] }), jsx(Dropdown, { isOpen: showMenu, onClickOutside: handleMenuClose, onScroll: handleMenuClose, anchorRef: iconRef, anchorOrigin: 'bottom-right', transformOrigin: 'top-left', children: jsx(
|
|
143
|
+
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', "data-testid": 'header-text', children: header }), header && menuIcon] }), jsxs("div", { className: 'active-wallet-information__handle-row', children: [jsx(Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsx(Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress(address, 4, 4)) }), !header && menuIcon] })] }), jsx(Dropdown, { isOpen: showMenu, onClickOutside: handleMenuClose, onScroll: handleMenuClose, anchorRef: iconRef, anchorOrigin: 'bottom-right', transformOrigin: 'top-left', children: jsx(DropdownMenu, { options: menuOption, setShowMenu: setShowMenu }) })] }));
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
export { ActiveWalletAddress, getNameIfNoIcon };
|
|
@@ -8,7 +8,7 @@ var React = require('react');
|
|
|
8
8
|
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
9
9
|
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
10
10
|
var Dropdown = require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
11
|
-
var
|
|
11
|
+
var DropdownMenu = require('../../../../components/MenuList/DropdownMenu/DropdownMenu.cjs');
|
|
12
12
|
var threeDots = require('../../../../shared/assets/three-dots.cjs');
|
|
13
13
|
require('@dynamic-labs/iconic');
|
|
14
14
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
@@ -24,7 +24,7 @@ const DotsMenu = ({ options, buttonClassName, buttonClassNameWithOpenMenu, direc
|
|
|
24
24
|
const handleMenuClose = React.useCallback(() => {
|
|
25
25
|
setShowMenu(false);
|
|
26
26
|
}, [setShowMenu]);
|
|
27
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(IconButton.IconButton, { ref: dotsMenuRef, onClick: handleIconClick, "data-testid": 'dotsMenu', className: showMenu ? buttonClassNameWithOpenMenu : buttonClassName, children: iconOverride ? (iconOverride) : (jsxRuntime.jsx(Icon.Icon, { children: jsxRuntime.jsx(threeDots.ReactComponent, {}) })) }), jsxRuntime.jsx(Dropdown.Dropdown, { isOpen: showMenu, onClickOutside: handleMenuClose, onScroll: handleMenuClose, anchorRef: dotsMenuRef, anchorOrigin: direction === 'right' ? 'bottom-left' : 'top-right', transformOrigin: direction === 'right' ? 'top-left' : 'bottom-right', children: jsxRuntime.jsx(
|
|
27
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(IconButton.IconButton, { ref: dotsMenuRef, onClick: handleIconClick, "data-testid": 'dotsMenu', className: showMenu ? buttonClassNameWithOpenMenu : buttonClassName, children: iconOverride ? (iconOverride) : (jsxRuntime.jsx(Icon.Icon, { children: jsxRuntime.jsx(threeDots.ReactComponent, {}) })) }), jsxRuntime.jsx(Dropdown.Dropdown, { isOpen: showMenu, onClickOutside: handleMenuClose, onScroll: handleMenuClose, anchorRef: dotsMenuRef, anchorOrigin: direction === 'right' ? 'bottom-left' : 'top-right', transformOrigin: direction === 'right' ? 'top-left' : 'bottom-right', children: jsxRuntime.jsx(DropdownMenu.DropdownMenu, { options: options, setShowMenu: setShowMenu }) })] }));
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
exports.DotsMenu = DotsMenu;
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export type DotsMenuOption = {
|
|
4
|
-
Icon: ReactElement | null;
|
|
5
|
-
callback: VoidFunction;
|
|
6
|
-
text: string;
|
|
7
|
-
hide?: boolean;
|
|
8
|
-
fontColor?: TypographyColor;
|
|
9
|
-
fontWeight?: TypographyWeight;
|
|
10
|
-
endSlot?: ReactElement;
|
|
11
|
-
badge?: string;
|
|
12
|
-
};
|
|
2
|
+
import { type MenuOption } from '../../../../components/MenuList/DropdownMenu';
|
|
13
3
|
type Props = {
|
|
14
|
-
options:
|
|
4
|
+
options: MenuOption[];
|
|
15
5
|
direction?: 'right' | 'left';
|
|
16
6
|
buttonClassName?: string;
|
|
17
7
|
buttonClassNameWithOpenMenu?: string;
|
|
@@ -4,7 +4,7 @@ import { useRef, useState, useCallback } from 'react';
|
|
|
4
4
|
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
5
5
|
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
6
6
|
import { Dropdown } from '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
7
|
-
import {
|
|
7
|
+
import { DropdownMenu } from '../../../../components/MenuList/DropdownMenu/DropdownMenu.js';
|
|
8
8
|
import { ReactComponent as SvgThreeDots } from '../../../../shared/assets/three-dots.js';
|
|
9
9
|
import '@dynamic-labs/iconic';
|
|
10
10
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
@@ -20,7 +20,7 @@ const DotsMenu = ({ options, buttonClassName, buttonClassNameWithOpenMenu, direc
|
|
|
20
20
|
const handleMenuClose = useCallback(() => {
|
|
21
21
|
setShowMenu(false);
|
|
22
22
|
}, [setShowMenu]);
|
|
23
|
-
return (jsxs(Fragment, { children: [jsx(IconButton, { ref: dotsMenuRef, onClick: handleIconClick, "data-testid": 'dotsMenu', className: showMenu ? buttonClassNameWithOpenMenu : buttonClassName, children: iconOverride ? (iconOverride) : (jsx(Icon, { children: jsx(SvgThreeDots, {}) })) }), jsx(Dropdown, { isOpen: showMenu, onClickOutside: handleMenuClose, onScroll: handleMenuClose, anchorRef: dotsMenuRef, anchorOrigin: direction === 'right' ? 'bottom-left' : 'top-right', transformOrigin: direction === 'right' ? 'top-left' : 'bottom-right', children: jsx(
|
|
23
|
+
return (jsxs(Fragment, { children: [jsx(IconButton, { ref: dotsMenuRef, onClick: handleIconClick, "data-testid": 'dotsMenu', className: showMenu ? buttonClassNameWithOpenMenu : buttonClassName, children: iconOverride ? (iconOverride) : (jsx(Icon, { children: jsx(SvgThreeDots, {}) })) }), jsx(Dropdown, { isOpen: showMenu, onClickOutside: handleMenuClose, onScroll: handleMenuClose, anchorRef: dotsMenuRef, anchorOrigin: direction === 'right' ? 'bottom-left' : 'top-right', transformOrigin: direction === 'right' ? 'top-left' : 'bottom-right', children: jsx(DropdownMenu, { options: options, setShowMenu: setShowMenu }) })] }));
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export { DotsMenu };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Gets the enabled non-testnet networks for a wallet
|
|
8
|
-
* @param wallet User's wallet
|
|
9
|
-
* @returns Array of enabled non-testnet networks, or empty array if no wallet or networks
|
|
10
|
-
*/
|
|
11
|
-
const getEnabledNonTestnetNetworks = (wallet) => {
|
|
12
|
-
if (!wallet ||
|
|
13
|
-
!wallet.connector ||
|
|
14
|
-
typeof wallet.connector.getEnabledNetworks !== 'function') {
|
|
15
|
-
return [];
|
|
16
|
-
}
|
|
17
|
-
const networks = wallet.connector.getEnabledNetworks();
|
|
18
|
-
if (!networks || networks.length === 0) {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
return networks.filter((network) => !network.isTestnet);
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Formats a Coinbase onramp URL with wallet information
|
|
25
|
-
* @param url Base URL from Coinbase
|
|
26
|
-
* @param wallet User's wallet
|
|
27
|
-
* @returns Formatted URL with wallet information
|
|
28
|
-
*/
|
|
29
|
-
const formatCoinbaseOnrampUrl = (url, wallet) => {
|
|
30
|
-
const nonTestnetNetworks = getEnabledNonTestnetNetworks(wallet);
|
|
31
|
-
if (nonTestnetNetworks.length === 0 || !(wallet === null || wallet === void 0 ? void 0 : wallet.address)) {
|
|
32
|
-
return url;
|
|
33
|
-
}
|
|
34
|
-
const baseUrl = new URL(url);
|
|
35
|
-
const appId = baseUrl.searchParams.get('appId');
|
|
36
|
-
// If no appId is present, return the original URL
|
|
37
|
-
if (!appId) {
|
|
38
|
-
return url;
|
|
39
|
-
}
|
|
40
|
-
// Filter out networks with empty or undefined keys and remove duplicates
|
|
41
|
-
const uniqueNetworkKeys = Array.from(new Set(nonTestnetNetworks
|
|
42
|
-
.map((network) => network.key)
|
|
43
|
-
.filter((key) => Boolean(key))));
|
|
44
|
-
if (uniqueNetworkKeys.length === 0) {
|
|
45
|
-
return url;
|
|
46
|
-
}
|
|
47
|
-
// Construct the URL with the raw query parameters
|
|
48
|
-
const finalUrl = `${baseUrl.origin}${baseUrl.pathname}?appId=${appId}&addresses=${encodeURIComponent(JSON.stringify({
|
|
49
|
-
[wallet.address]: uniqueNetworkKeys,
|
|
50
|
-
}))}`;
|
|
51
|
-
return finalUrl;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
exports.formatCoinbaseOnrampUrl = formatCoinbaseOnrampUrl;
|
|
55
|
-
exports.getEnabledNonTestnetNetworks = getEnabledNonTestnetNetworks;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
-
import type { GenericNetwork } from '@dynamic-labs/types';
|
|
3
|
-
/**
|
|
4
|
-
* Gets the enabled non-testnet networks for a wallet
|
|
5
|
-
* @param wallet User's wallet
|
|
6
|
-
* @returns Array of enabled non-testnet networks, or empty array if no wallet or networks
|
|
7
|
-
*/
|
|
8
|
-
export declare const getEnabledNonTestnetNetworks: (wallet?: Wallet) => GenericNetwork[];
|
|
9
|
-
/**
|
|
10
|
-
* Formats a Coinbase onramp URL with wallet information
|
|
11
|
-
* @param url Base URL from Coinbase
|
|
12
|
-
* @param wallet User's wallet
|
|
13
|
-
* @returns Formatted URL with wallet information
|
|
14
|
-
*/
|
|
15
|
-
export declare const formatCoinbaseOnrampUrl: (url: string, wallet?: Wallet) => string;
|