@dynamic-labs/sdk-react-core 4.0.0-alpha.1 → 4.0.0-alpha.2
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 +9 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/components/WalletInformationCard/WalletInformationCard.cjs +1 -1
- package/src/lib/components/WalletInformationCard/WalletInformationCard.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +5 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +5 -2
- package/src/lib/context/DynamicContext/types/DynamicContextProps.d.ts +1 -0
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.js +1 -1
- package/src/lib/utils/hooks/useEndUserWarning/useEndUserWarning.cjs +5 -3
- package/src/lib/utils/hooks/useEndUserWarning/useEndUserWarning.d.ts +2 -1
- package/src/lib/utils/hooks/useEndUserWarning/useEndUserWarning.js +5 -3
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.cjs +3 -3
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.d.ts +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.1...v4.0.0-alpha.2) (2024-09-18)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add iconVariant prop to DynamicBridgeWidget ([#6915](https://github.com/dynamic-labs/DynamicAuth/issues/6915)) ([8aa0f3d](https://github.com/dynamic-labs/DynamicAuth/commit/8aa0f3d8d8c41c7b5c4796106f611f208010cb6d))
|
|
8
|
+
* allow to create extra embedded wallets in react-native ([#6923](https://github.com/dynamic-labs/DynamicAuth/issues/6923)) ([ba22f7b](https://github.com/dynamic-labs/DynamicAuth/commit/ba22f7bcf41a444a4df0aff9b6aec257457e9402))
|
|
9
|
+
* **client:** add hide method for auth and userProfile ui modules ([#6928](https://github.com/dynamic-labs/DynamicAuth/issues/6928)) ([a11a4a5](https://github.com/dynamic-labs/DynamicAuth/commit/a11a4a5d6e25ce2a916ebd52f0b341020dc1a7e5))
|
|
10
|
+
|
|
2
11
|
## [4.0.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.0...v4.0.0-alpha.1) (2024-09-17)
|
|
3
12
|
|
|
4
13
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/iconic": "4.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/logger": "4.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/message-transport": "4.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "4.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "4.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/store": "4.0.0-alpha.
|
|
26
|
-
"@dynamic-labs/types": "4.0.0-alpha.
|
|
27
|
-
"@dynamic-labs/utils": "4.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/wallet-book": "4.0.0-alpha.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.
|
|
20
|
+
"@dynamic-labs/iconic": "4.0.0-alpha.2",
|
|
21
|
+
"@dynamic-labs/logger": "4.0.0-alpha.2",
|
|
22
|
+
"@dynamic-labs/message-transport": "4.0.0-alpha.2",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "4.0.0-alpha.2",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "4.0.0-alpha.2",
|
|
25
|
+
"@dynamic-labs/store": "4.0.0-alpha.2",
|
|
26
|
+
"@dynamic-labs/types": "4.0.0-alpha.2",
|
|
27
|
+
"@dynamic-labs/utils": "4.0.0-alpha.2",
|
|
28
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.2",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.2",
|
|
30
30
|
"eventemitter3": "5.0.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -24,7 +24,7 @@ var Icon = require('../Icon/Icon.cjs');
|
|
|
24
24
|
const WalletInformationCard = ({ address, ens, balance, icon, network, menu, }) => {
|
|
25
25
|
const { t } = reactI18next.useTranslation();
|
|
26
26
|
const details = React.useMemo(() => {
|
|
27
|
-
const shortenAddress = shortenWalletAddress.shortenWalletAddress(address
|
|
27
|
+
const shortenAddress = shortenWalletAddress.shortenWalletAddress(address);
|
|
28
28
|
if (ens) {
|
|
29
29
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography.Typography, { color: 'primary', variant: 'body_normal', truncate: true, children: ens }), jsxRuntime.jsx(Typography.Typography, { weight: 'regular', variant: 'body_small', color: 'secondary', children: shortenAddress })] }));
|
|
30
30
|
}
|
|
@@ -20,7 +20,7 @@ import { Icon } from '../Icon/Icon.js';
|
|
|
20
20
|
const WalletInformationCard = ({ address, ens, balance, icon, network, menu, }) => {
|
|
21
21
|
const { t } = useTranslation();
|
|
22
22
|
const details = useMemo(() => {
|
|
23
|
-
const shortenAddress = shortenWalletAddress(address
|
|
23
|
+
const shortenAddress = shortenWalletAddress(address);
|
|
24
24
|
if (ens) {
|
|
25
25
|
return (jsxs(Fragment, { children: [jsx(Typography, { color: 'primary', variant: 'body_normal', truncate: true, children: ens }), jsx(Typography, { weight: 'regular', variant: 'body_small', color: 'secondary', children: shortenAddress })] }));
|
|
26
26
|
}
|
|
@@ -144,7 +144,7 @@ const DynamicContext = React.createContext(undefined);
|
|
|
144
144
|
/** The context provider itself we only use internally */
|
|
145
145
|
const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, locale: locale$1, enableInstrumentation = false, }) => {
|
|
146
146
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
147
|
-
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, defaultPhoneInputIso2, apiBaseUrl, coinbaseWalletPreference, detectNewWalletsForLinking = false, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, walletsFilter, logLevel = 'WARN', mobileExperience, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, handlers, } = settings$1;
|
|
147
|
+
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, defaultPhoneInputIso2, apiBaseUrl, coinbaseWalletPreference, detectNewWalletsForLinking = false, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, walletsFilter, logLevel = 'WARN', mobileExperience, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, handlers, suppressEndUserConsoleWarning, } = settings$1;
|
|
148
148
|
/**
|
|
149
149
|
* initialize Storage
|
|
150
150
|
*/
|
|
@@ -210,7 +210,10 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
210
210
|
const { settings: projectSettings$1 } = projectSettings.useProjectSettings();
|
|
211
211
|
useSendDynamicProps.useSendDynamicProps({ environmentId, settings: settings$1 });
|
|
212
212
|
// Console warning for end user safety
|
|
213
|
-
useEndUserWarning.useEndUserWarning({
|
|
213
|
+
useEndUserWarning.useEndUserWarning({
|
|
214
|
+
projectSettings: projectSettings$1,
|
|
215
|
+
suppress: suppressEndUserConsoleWarning,
|
|
216
|
+
});
|
|
214
217
|
const multiWallet = useMultiWallet.useMultiWallet({
|
|
215
218
|
isBridgeFlow,
|
|
216
219
|
multiWalletOverride: (_d = settings$1.overrides) === null || _d === void 0 ? void 0 : _d.multiWallet,
|
|
@@ -140,7 +140,7 @@ const DynamicContext = createContext(undefined);
|
|
|
140
140
|
/** The context provider itself we only use internally */
|
|
141
141
|
const InnerDynamicContextProvider = ({ children, theme, settings, locale, enableInstrumentation = false, }) => {
|
|
142
142
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
143
|
-
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, defaultPhoneInputIso2, apiBaseUrl, coinbaseWalletPreference, detectNewWalletsForLinking = false, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, walletsFilter, logLevel = 'WARN', mobileExperience, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, handlers, } = settings;
|
|
143
|
+
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, defaultPhoneInputIso2, apiBaseUrl, coinbaseWalletPreference, detectNewWalletsForLinking = false, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, walletsFilter, logLevel = 'WARN', mobileExperience, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, handlers, suppressEndUserConsoleWarning, } = settings;
|
|
144
144
|
/**
|
|
145
145
|
* initialize Storage
|
|
146
146
|
*/
|
|
@@ -206,7 +206,10 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
206
206
|
const { settings: projectSettings } = useProjectSettings();
|
|
207
207
|
useSendDynamicProps({ environmentId, settings });
|
|
208
208
|
// Console warning for end user safety
|
|
209
|
-
useEndUserWarning({
|
|
209
|
+
useEndUserWarning({
|
|
210
|
+
projectSettings,
|
|
211
|
+
suppress: suppressEndUserConsoleWarning,
|
|
212
|
+
});
|
|
210
213
|
const multiWallet = useMultiWallet({
|
|
211
214
|
isBridgeFlow,
|
|
212
215
|
multiWalletOverride: (_d = settings.overrides) === null || _d === void 0 ? void 0 : _d.multiWallet,
|
|
@@ -84,6 +84,7 @@ export interface DynamicContextProps {
|
|
|
84
84
|
socialMediaLinkText?: string;
|
|
85
85
|
socialMediaUrl?: string;
|
|
86
86
|
socialProvidersFilter?: SocialProviderFilter;
|
|
87
|
+
suppressEndUserConsoleWarning?: boolean;
|
|
87
88
|
termsOfServiceUrl?: string;
|
|
88
89
|
toolkitEnabled?: boolean;
|
|
89
90
|
walletConnectors?: WalletConnectorsMethod[];
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var getWalletProvider = require('../../../functions/getWalletProvider/getWalletProvider.cjs');
|
|
8
8
|
|
|
9
|
-
const specialCareWallets = ['bloctoevm', 'perawallet'];
|
|
9
|
+
const specialCareWallets = ['bloctoevm', 'perawallet', 'metamaskstarknet'];
|
|
10
10
|
const showPendingConnectView = (walletConnector, setView) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
11
|
const walletProvider = getWalletProvider.getWalletProvider(walletConnector);
|
|
12
12
|
// We don't want to show the pending connect view for qrCode and walletConnect
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { getWalletProvider } from '../../../functions/getWalletProvider/getWalletProvider.js';
|
|
4
4
|
|
|
5
|
-
const specialCareWallets = ['bloctoevm', 'perawallet'];
|
|
5
|
+
const specialCareWallets = ['bloctoevm', 'perawallet', 'metamaskstarknet'];
|
|
6
6
|
const showPendingConnectView = (walletConnector, setView) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7
7
|
const walletProvider = getWalletProvider(walletConnector);
|
|
8
8
|
// We don't want to show the pending connect view for qrCode and walletConnect
|
|
@@ -18,10 +18,12 @@ require('../../../store/state/loadingAndLifecycle.cjs');
|
|
|
18
18
|
require('../../../shared/consts/index.cjs');
|
|
19
19
|
|
|
20
20
|
let didLog = false;
|
|
21
|
-
const useEndUserWarning = ({ projectSettings, }) => {
|
|
21
|
+
const useEndUserWarning = ({ suppress = false, projectSettings, }) => {
|
|
22
22
|
React.useEffect(() => {
|
|
23
23
|
var _a;
|
|
24
|
-
if (!
|
|
24
|
+
if (!suppress &&
|
|
25
|
+
!didLog &&
|
|
26
|
+
(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.environmentName) === sdkApiCore.EnvironmentEnum.Live) {
|
|
25
27
|
didLog = true;
|
|
26
28
|
logger.logger.info('%cWarning!', 'color: red; font-size: 32px;');
|
|
27
29
|
logger.logger.info('%cThis is a browser feature intended for developers. You are reading this message because you opened the browser console, a developer tool.\n\n%c1. Never share your tokens or sensitive information with anyone.\n2. Do not paste any code you do not fully understand.\n3. If someone instructed you to do this, it is likely a scam.\n\n%cInjecting code into your browser could result in loss of tokens or control of your account that cannot be recovered or protected.', 'font-size: 16px;', 'font-size: 12px;', 'color: red; font-size: 12px;');
|
|
@@ -31,7 +33,7 @@ const useEndUserWarning = ({ projectSettings, }) => {
|
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
-
}, [projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.environmentName]);
|
|
36
|
+
}, [projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.environmentName, suppress]);
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
exports.useEndUserWarning = useEndUserWarning;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ProjectSettings } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
export declare const resetEndUserWarning: () => void;
|
|
3
|
-
export declare const useEndUserWarning: ({ projectSettings, }: {
|
|
3
|
+
export declare const useEndUserWarning: ({ suppress, projectSettings, }: {
|
|
4
|
+
suppress?: boolean;
|
|
4
5
|
projectSettings?: ProjectSettings;
|
|
5
6
|
}) => void;
|
|
@@ -14,10 +14,12 @@ import '../../../store/state/loadingAndLifecycle.js';
|
|
|
14
14
|
import '../../../shared/consts/index.js';
|
|
15
15
|
|
|
16
16
|
let didLog = false;
|
|
17
|
-
const useEndUserWarning = ({ projectSettings, }) => {
|
|
17
|
+
const useEndUserWarning = ({ suppress = false, projectSettings, }) => {
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
var _a;
|
|
20
|
-
if (!
|
|
20
|
+
if (!suppress &&
|
|
21
|
+
!didLog &&
|
|
22
|
+
(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.environmentName) === EnvironmentEnum.Live) {
|
|
21
23
|
didLog = true;
|
|
22
24
|
logger.info('%cWarning!', 'color: red; font-size: 32px;');
|
|
23
25
|
logger.info('%cThis is a browser feature intended for developers. You are reading this message because you opened the browser console, a developer tool.\n\n%c1. Never share your tokens or sensitive information with anyone.\n2. Do not paste any code you do not fully understand.\n3. If someone instructed you to do this, it is likely a scam.\n\n%cInjecting code into your browser could result in loss of tokens or control of your account that cannot be recovered or protected.', 'font-size: 16px;', 'font-size: 12px;', 'color: red; font-size: 12px;');
|
|
@@ -27,7 +29,7 @@ const useEndUserWarning = ({ projectSettings, }) => {
|
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
-
}, [projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.environmentName]);
|
|
32
|
+
}, [projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.environmentName, suppress]);
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
export { useEndUserWarning };
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var reactI18next = require('react-i18next');
|
|
9
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
9
10
|
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
10
11
|
require('../../components/Alert/Alert.cjs');
|
|
11
12
|
require('../../events/dynamicEvents.cjs');
|
|
@@ -16,7 +17,6 @@ require('@dynamic-labs/sdk-api-core');
|
|
|
16
17
|
require('../../shared/logger.cjs');
|
|
17
18
|
var getChainIcon = require('../../shared/utils/functions/chain/getChainIcon.cjs');
|
|
18
19
|
require('@dynamic-labs/wallet-connector-core');
|
|
19
|
-
require('@dynamic-labs/wallet-book');
|
|
20
20
|
var shortenWalletAddress = require('../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
21
21
|
require('../../utils/constants/colors.cjs');
|
|
22
22
|
require('../../utils/constants/values.cjs');
|
|
@@ -96,7 +96,7 @@ var InlineWidgetButton = require('../../components/InlineWidget/components/Inlin
|
|
|
96
96
|
var InlineWidget = require('../../components/InlineWidget/InlineWidget.cjs');
|
|
97
97
|
require('qrcode');
|
|
98
98
|
|
|
99
|
-
const DynamicBridgeWidget = ({ className, variant = 'modal', }) => {
|
|
99
|
+
const DynamicBridgeWidget = ({ className, variant = 'modal', iconVariant = 'chain', }) => {
|
|
100
100
|
const { showAuthFlow, setShowBridgeWidget, bridgeChains, setShowAuthFlow, connectedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
101
101
|
const { widgetRef, inlineControlsRef } = DynamicBridgeWidgetContext.useDynamicBridgeWidgetContext();
|
|
102
102
|
const { t } = reactI18next.useTranslation();
|
|
@@ -114,7 +114,7 @@ const DynamicBridgeWidget = ({ className, variant = 'modal', }) => {
|
|
|
114
114
|
const ChainIcon = getChainIcon.getChainIcon(chain);
|
|
115
115
|
const connectedChainWallets = connectedWallets.filter(({ chain: connectedChain }) => connectedChain === chain);
|
|
116
116
|
if (connectedChainWallets.length > 0) {
|
|
117
|
-
return connectedChainWallets.map((wallet) => (jsxRuntime.jsx(InlineWidgetButton.InlineWidgetButton, { icon: jsxRuntime.jsx(ChainIcon, {}), onClick: () => setShowBridgeWidget(true), children: shortenWalletAddress.shortenWalletAddress(wallet.address
|
|
117
|
+
return connectedChainWallets.map((wallet) => (jsxRuntime.jsx(InlineWidgetButton.InlineWidgetButton, { icon: iconVariant === 'wallet' ? (jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: wallet.connector.key })) : (jsxRuntime.jsx(ChainIcon, {})), onClick: () => setShowBridgeWidget(true), children: shortenWalletAddress.shortenWalletAddress(wallet.address) }, wallet.id)));
|
|
118
118
|
}
|
|
119
119
|
return (jsxRuntime.jsx(InlineWidgetButton.InlineWidgetButton, { icon: jsxRuntime.jsx(ChainIcon, {}), onClick: () => setShowAuthFlow(true), copykey: 'dyn_bridge.widget.connect', children: t('dyn_bridge.widget.connect') }, chain));
|
|
120
120
|
}) }), jsxRuntime.jsx(DynamicBridgeUserProfile.DynamicBridgeUserProfile, { variant: variant })] }));
|
|
@@ -3,5 +3,6 @@ export type DynamicBridgeWidgetVariant = 'modal' | 'dropdown';
|
|
|
3
3
|
export type DynamicBridgeWidgetProps = {
|
|
4
4
|
className?: string;
|
|
5
5
|
variant?: DynamicBridgeWidgetVariant;
|
|
6
|
+
iconVariant?: 'wallet' | 'chain';
|
|
6
7
|
};
|
|
7
8
|
export declare const DynamicBridgeWidget: FC<DynamicBridgeWidgetProps>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
5
6
|
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
6
7
|
import '../../components/Alert/Alert.js';
|
|
7
8
|
import '../../events/dynamicEvents.js';
|
|
@@ -12,7 +13,6 @@ import '@dynamic-labs/sdk-api-core';
|
|
|
12
13
|
import '../../shared/logger.js';
|
|
13
14
|
import { getChainIcon } from '../../shared/utils/functions/chain/getChainIcon.js';
|
|
14
15
|
import '@dynamic-labs/wallet-connector-core';
|
|
15
|
-
import '@dynamic-labs/wallet-book';
|
|
16
16
|
import { shortenWalletAddress } from '../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
17
17
|
import '../../utils/constants/colors.js';
|
|
18
18
|
import '../../utils/constants/values.js';
|
|
@@ -92,7 +92,7 @@ import { InlineWidgetButton } from '../../components/InlineWidget/components/Inl
|
|
|
92
92
|
import { InlineWidget } from '../../components/InlineWidget/InlineWidget.js';
|
|
93
93
|
import 'qrcode';
|
|
94
94
|
|
|
95
|
-
const DynamicBridgeWidget = ({ className, variant = 'modal', }) => {
|
|
95
|
+
const DynamicBridgeWidget = ({ className, variant = 'modal', iconVariant = 'chain', }) => {
|
|
96
96
|
const { showAuthFlow, setShowBridgeWidget, bridgeChains, setShowAuthFlow, connectedWallets, } = useInternalDynamicContext();
|
|
97
97
|
const { widgetRef, inlineControlsRef } = useDynamicBridgeWidgetContext();
|
|
98
98
|
const { t } = useTranslation();
|
|
@@ -110,7 +110,7 @@ const DynamicBridgeWidget = ({ className, variant = 'modal', }) => {
|
|
|
110
110
|
const ChainIcon = getChainIcon(chain);
|
|
111
111
|
const connectedChainWallets = connectedWallets.filter(({ chain: connectedChain }) => connectedChain === chain);
|
|
112
112
|
if (connectedChainWallets.length > 0) {
|
|
113
|
-
return connectedChainWallets.map((wallet) => (jsx(InlineWidgetButton, { icon: jsx(ChainIcon, {}), onClick: () => setShowBridgeWidget(true), children: shortenWalletAddress(wallet.address
|
|
113
|
+
return connectedChainWallets.map((wallet) => (jsx(InlineWidgetButton, { icon: iconVariant === 'wallet' ? (jsx(WalletIcon, { walletKey: wallet.connector.key })) : (jsx(ChainIcon, {})), onClick: () => setShowBridgeWidget(true), children: shortenWalletAddress(wallet.address) }, wallet.id)));
|
|
114
114
|
}
|
|
115
115
|
return (jsx(InlineWidgetButton, { icon: jsx(ChainIcon, {}), onClick: () => setShowAuthFlow(true), copykey: 'dyn_bridge.widget.connect', children: t('dyn_bridge.widget.connect') }, chain));
|
|
116
116
|
}) }), jsx(DynamicBridgeUserProfile, { variant: variant })] }));
|