@dynamic-labs/sdk-react-core 1.4.15 → 1.4.16
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 +7 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/locale/en/translation.cjs +5 -0
- package/src/lib/locale/en/translation.d.ts +5 -0
- package/src/lib/locale/en/translation.js +5 -0
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +22 -5
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +23 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
### [1.4.16](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.15...v1.4.16) (2024-07-25)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* improve network switch ux for metamask starknet snap ([#6376](https://github.com/dynamic-labs/DynamicAuth/issues/6376)) ([#6419](https://github.com/dynamic-labs/DynamicAuth/issues/6419)) ([4909806](https://github.com/dynamic-labs/DynamicAuth/commit/4909806ee5fa8a6a90d85f7e9c24b2bde6de5e75))
|
|
8
|
+
|
|
2
9
|
### [1.4.15](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.14...v1.4.15) (2024-07-17)
|
|
3
10
|
|
|
4
11
|
|
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": "1.4.
|
|
3
|
+
"version": "1.4.16",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"react-focus-lock": "2.9.2",
|
|
17
17
|
"react-i18next": "^13.2.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
|
-
"@dynamic-labs/ethereum": "1.4.
|
|
20
|
-
"@dynamic-labs/iconic": "1.4.
|
|
21
|
-
"@dynamic-labs/logger": "1.4.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "1.4.
|
|
23
|
-
"@dynamic-labs/rpc-providers": "1.4.
|
|
24
|
-
"@dynamic-labs/types": "1.4.
|
|
25
|
-
"@dynamic-labs/utils": "1.4.
|
|
26
|
-
"@dynamic-labs/viem-utils": "1.4.
|
|
27
|
-
"@dynamic-labs/wallet-book": "1.4.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "1.4.
|
|
19
|
+
"@dynamic-labs/ethereum": "1.4.16",
|
|
20
|
+
"@dynamic-labs/iconic": "1.4.16",
|
|
21
|
+
"@dynamic-labs/logger": "1.4.16",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "1.4.16",
|
|
23
|
+
"@dynamic-labs/rpc-providers": "1.4.16",
|
|
24
|
+
"@dynamic-labs/types": "1.4.16",
|
|
25
|
+
"@dynamic-labs/utils": "1.4.16",
|
|
26
|
+
"@dynamic-labs/viem-utils": "1.4.16",
|
|
27
|
+
"@dynamic-labs/wallet-book": "1.4.16",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "1.4.16",
|
|
29
29
|
"eventemitter3": "5.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -663,6 +663,9 @@ const translation = {
|
|
|
663
663
|
* @description copy keys for network not supported view for manual switch
|
|
664
664
|
* @default
|
|
665
665
|
* {
|
|
666
|
+
subtitle_network_defined_metamaskstarknet:
|
|
667
|
+
'To continue, please update the network in your wallet to {{network}} by visiting the Starknet Snap companion app',
|
|
668
|
+
subtitle_network_defined_metamaskstarknet_companion_app: 'companion app',
|
|
666
669
|
subtitle_network_defined: 'To continue, please update the network in your wallet to {{network}}',
|
|
667
670
|
subtitle_no_network_defined: 'Your wallet does not support switching networks from this app. Switch networks directly in your wallet.',
|
|
668
671
|
title: 'Update your Network',
|
|
@@ -670,6 +673,8 @@ const translation = {
|
|
|
670
673
|
}
|
|
671
674
|
*/
|
|
672
675
|
dyn_network_not_supported_manual_switch: {
|
|
676
|
+
subtitle_network_defined_metamaskstarknet: 'To continue, please update the network in your wallet to {{network}} by visiting the Starknet Snap',
|
|
677
|
+
subtitle_network_defined_metamaskstarknet_companion_app: 'companion app',
|
|
673
678
|
subtitle_network_defined: 'To continue, please update the network in your wallet to {{network}}',
|
|
674
679
|
subtitle_no_network_defined: 'Your wallet does not support switching networks from this app. Switch networks directly in your wallet.',
|
|
675
680
|
title: 'Update your Network',
|
|
@@ -658,6 +658,9 @@ export declare const translation: {
|
|
|
658
658
|
* @description copy keys for network not supported view for manual switch
|
|
659
659
|
* @default
|
|
660
660
|
* {
|
|
661
|
+
subtitle_network_defined_metamaskstarknet:
|
|
662
|
+
'To continue, please update the network in your wallet to {{network}} by visiting the Starknet Snap companion app',
|
|
663
|
+
subtitle_network_defined_metamaskstarknet_companion_app: 'companion app',
|
|
661
664
|
subtitle_network_defined: 'To continue, please update the network in your wallet to {{network}}',
|
|
662
665
|
subtitle_no_network_defined: 'Your wallet does not support switching networks from this app. Switch networks directly in your wallet.',
|
|
663
666
|
title: 'Update your Network',
|
|
@@ -665,6 +668,8 @@ export declare const translation: {
|
|
|
665
668
|
}
|
|
666
669
|
*/
|
|
667
670
|
dyn_network_not_supported_manual_switch: {
|
|
671
|
+
subtitle_network_defined_metamaskstarknet: string;
|
|
672
|
+
subtitle_network_defined_metamaskstarknet_companion_app: string;
|
|
668
673
|
subtitle_network_defined: string;
|
|
669
674
|
subtitle_no_network_defined: string;
|
|
670
675
|
title: string;
|
|
@@ -659,6 +659,9 @@ const translation = {
|
|
|
659
659
|
* @description copy keys for network not supported view for manual switch
|
|
660
660
|
* @default
|
|
661
661
|
* {
|
|
662
|
+
subtitle_network_defined_metamaskstarknet:
|
|
663
|
+
'To continue, please update the network in your wallet to {{network}} by visiting the Starknet Snap companion app',
|
|
664
|
+
subtitle_network_defined_metamaskstarknet_companion_app: 'companion app',
|
|
662
665
|
subtitle_network_defined: 'To continue, please update the network in your wallet to {{network}}',
|
|
663
666
|
subtitle_no_network_defined: 'Your wallet does not support switching networks from this app. Switch networks directly in your wallet.',
|
|
664
667
|
title: 'Update your Network',
|
|
@@ -666,6 +669,8 @@ const translation = {
|
|
|
666
669
|
}
|
|
667
670
|
*/
|
|
668
671
|
dyn_network_not_supported_manual_switch: {
|
|
672
|
+
subtitle_network_defined_metamaskstarknet: 'To continue, please update the network in your wallet to {{network}} by visiting the Starknet Snap',
|
|
673
|
+
subtitle_network_defined_metamaskstarknet_companion_app: 'companion app',
|
|
669
674
|
subtitle_network_defined: 'To continue, please update the network in your wallet to {{network}}',
|
|
670
675
|
subtitle_no_network_defined: 'Your wallet does not support switching networks from this app. Switch networks directly in your wallet.',
|
|
671
676
|
title: 'Update your Network',
|
|
@@ -15,6 +15,7 @@ require('../../shared/logger.cjs');
|
|
|
15
15
|
require('@dynamic-labs/iconic');
|
|
16
16
|
require('@dynamic-labs/wallet-connector-core');
|
|
17
17
|
require('../../context/ViewContext/ViewContext.cjs');
|
|
18
|
+
var externalLink = require('../../shared/assets/externalLink.cjs');
|
|
18
19
|
require('../../utils/constants/colors.cjs');
|
|
19
20
|
require('../../utils/constants/values.cjs');
|
|
20
21
|
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
@@ -89,11 +90,27 @@ const NetworkNotSupportedSwitchManual = () => {
|
|
|
89
90
|
width: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
|
|
90
91
|
} }));
|
|
91
92
|
const walletConnectorNetworks = getWalletConnectorNetworks.getWalletConnectorNetworks(walletConnector);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
const getSubtitleCopyKey = () => {
|
|
94
|
+
if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'metamaskstarknet') {
|
|
95
|
+
return 'dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet';
|
|
96
|
+
}
|
|
97
|
+
return walletConnectorNetworks.length
|
|
98
|
+
? 'dyn_network_not_supported_manual_switch.subtitle_network_defined'
|
|
99
|
+
: 'dyn_network_not_supported_manual_switch.subtitle_no_network_defined';
|
|
100
|
+
};
|
|
101
|
+
const getSubtitle = () => {
|
|
102
|
+
if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'metamaskstarknet') {
|
|
103
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [t('dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet', {
|
|
104
|
+
network: walletConnectorNetworks[0].name,
|
|
105
|
+
}), jsxRuntime.jsxs("a", { href: 'https://snaps.consensys.io/starknet', target: '_blank', rel: 'noreferrer', children: [' ', t('dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet_companion_app'), ' ', jsxRuntime.jsx(externalLink.ReactComponent, { style: { display: 'inline-block' } })] })] }));
|
|
106
|
+
}
|
|
107
|
+
return walletConnectorNetworks.length
|
|
108
|
+
? t('dyn_network_not_supported_manual_switch.subtitle_network_defined', {
|
|
109
|
+
network: walletConnectorNetworks[0].name,
|
|
110
|
+
})
|
|
111
|
+
: t('dyn_network_not_supported_manual_switch.subtitle_no_network_defined');
|
|
112
|
+
};
|
|
113
|
+
return (jsxRuntime.jsxs("div", { "data-testid": 'network-not-supported', className: 'network-not-supported-switch-manual', children: [jsxRuntime.jsx("div", { className: 'network-not-supported-switch-manual__img-container', children: ((_a = user === null || user === void 0 ? void 0 : user.ens) === null || _a === void 0 ? void 0 : _a.avatar) ? (jsxRuntime.jsx("div", { className: 'network-not-supported-switch-manual__network-container', children: jsxRuntime.jsx("img", { src: (_b = user === null || user === void 0 ? void 0 : user.ens) === null || _b === void 0 ? void 0 : _b.avatar, alt: 'user ens avatar', className: 'network-not-supported-switch-manual__img' }) })) : (jsxRuntime.jsx("div", { className: 'network-not-supported-switch-manual__network-container', children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: icon, iconSize: iconSize, isSpinning: true }) })) }), jsxRuntime.jsxs("div", { className: 'network-not-supported-switch-manual__content', children: [jsxRuntime.jsx(Typography.Typography, { className: 'network-not-supported-switch-manual__title', weight: 'medium', variant: 'title', color: 'primary', copykey: 'dyn_network_not_supported_manual_switch.title', children: t('dyn_network_not_supported_manual_switch.title') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: getSubtitleCopyKey(), children: getSubtitle() })] })] }));
|
|
97
114
|
};
|
|
98
115
|
|
|
99
116
|
exports.NetworkNotSupportedSwitchManual = NetworkNotSupportedSwitchManual;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
4
4
|
import 'react';
|
|
@@ -11,6 +11,7 @@ import '../../shared/logger.js';
|
|
|
11
11
|
import '@dynamic-labs/iconic';
|
|
12
12
|
import '@dynamic-labs/wallet-connector-core';
|
|
13
13
|
import '../../context/ViewContext/ViewContext.js';
|
|
14
|
+
import { ReactComponent as SvgExternalLink } from '../../shared/assets/externalLink.js';
|
|
14
15
|
import '../../utils/constants/colors.js';
|
|
15
16
|
import '../../utils/constants/values.js';
|
|
16
17
|
import '../../shared/utils/classes/storage/localStorage.js';
|
|
@@ -85,11 +86,27 @@ const NetworkNotSupportedSwitchManual = () => {
|
|
|
85
86
|
width: pixelToRem(iconSize * iconRatio),
|
|
86
87
|
} }));
|
|
87
88
|
const walletConnectorNetworks = getWalletConnectorNetworks(walletConnector);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
const getSubtitleCopyKey = () => {
|
|
90
|
+
if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'metamaskstarknet') {
|
|
91
|
+
return 'dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet';
|
|
92
|
+
}
|
|
93
|
+
return walletConnectorNetworks.length
|
|
94
|
+
? 'dyn_network_not_supported_manual_switch.subtitle_network_defined'
|
|
95
|
+
: 'dyn_network_not_supported_manual_switch.subtitle_no_network_defined';
|
|
96
|
+
};
|
|
97
|
+
const getSubtitle = () => {
|
|
98
|
+
if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'metamaskstarknet') {
|
|
99
|
+
return (jsxs(Fragment, { children: [t('dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet', {
|
|
100
|
+
network: walletConnectorNetworks[0].name,
|
|
101
|
+
}), jsxs("a", { href: 'https://snaps.consensys.io/starknet', target: '_blank', rel: 'noreferrer', children: [' ', t('dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet_companion_app'), ' ', jsx(SvgExternalLink, { style: { display: 'inline-block' } })] })] }));
|
|
102
|
+
}
|
|
103
|
+
return walletConnectorNetworks.length
|
|
104
|
+
? t('dyn_network_not_supported_manual_switch.subtitle_network_defined', {
|
|
105
|
+
network: walletConnectorNetworks[0].name,
|
|
106
|
+
})
|
|
107
|
+
: t('dyn_network_not_supported_manual_switch.subtitle_no_network_defined');
|
|
108
|
+
};
|
|
109
|
+
return (jsxs("div", { "data-testid": 'network-not-supported', className: 'network-not-supported-switch-manual', children: [jsx("div", { className: 'network-not-supported-switch-manual__img-container', children: ((_a = user === null || user === void 0 ? void 0 : user.ens) === null || _a === void 0 ? void 0 : _a.avatar) ? (jsx("div", { className: 'network-not-supported-switch-manual__network-container', children: jsx("img", { src: (_b = user === null || user === void 0 ? void 0 : user.ens) === null || _b === void 0 ? void 0 : _b.avatar, alt: 'user ens avatar', className: 'network-not-supported-switch-manual__img' }) })) : (jsx("div", { className: 'network-not-supported-switch-manual__network-container', children: jsx(IconWithSpinner, { Icon: icon, iconSize: iconSize, isSpinning: true }) })) }), jsxs("div", { className: 'network-not-supported-switch-manual__content', children: [jsx(Typography, { className: 'network-not-supported-switch-manual__title', weight: 'medium', variant: 'title', color: 'primary', copykey: 'dyn_network_not_supported_manual_switch.title', children: t('dyn_network_not_supported_manual_switch.title') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: getSubtitleCopyKey(), children: getSubtitle() })] })] }));
|
|
93
110
|
};
|
|
94
111
|
|
|
95
112
|
export { NetworkNotSupportedSwitchManual };
|