@dynamic-labs/sdk-react-core 1.4.15 → 1.4.17
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 +14 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -0
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/types.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +1 -0
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +1 -0
- 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,18 @@
|
|
|
1
1
|
|
|
2
|
+
### [1.4.17](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.16...v1.4.17) (2024-07-25)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* improvements to metamask starknet snap network polling ([#6424](https://github.com/dynamic-labs/DynamicAuth/issues/6424)) ([#6425](https://github.com/dynamic-labs/DynamicAuth/issues/6425)) ([5b565c8](https://github.com/dynamic-labs/DynamicAuth/commit/5b565c8ef4bee0d7dc076ef30170039d22b678fd))
|
|
8
|
+
|
|
9
|
+
### [1.4.16](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.15...v1.4.16) (2024-07-25)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* 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))
|
|
15
|
+
|
|
2
16
|
### [1.4.15](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.14...v1.4.15) (2024-07-17)
|
|
3
17
|
|
|
4
18
|
|
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.17",
|
|
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.17",
|
|
20
|
+
"@dynamic-labs/iconic": "1.4.17",
|
|
21
|
+
"@dynamic-labs/logger": "1.4.17",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "1.4.17",
|
|
23
|
+
"@dynamic-labs/rpc-providers": "1.4.17",
|
|
24
|
+
"@dynamic-labs/types": "1.4.17",
|
|
25
|
+
"@dynamic-labs/utils": "1.4.17",
|
|
26
|
+
"@dynamic-labs/viem-utils": "1.4.17",
|
|
27
|
+
"@dynamic-labs/wallet-book": "1.4.17",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "1.4.17",
|
|
29
29
|
"eventemitter3": "5.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -310,6 +310,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale: locale
|
|
|
310
310
|
setMultiWalletWidgetState,
|
|
311
311
|
setOnboardingOnlyJwt,
|
|
312
312
|
setSdkHasLoaded,
|
|
313
|
+
setSelectedWalletConnectorKey,
|
|
313
314
|
setShowAuthFlow,
|
|
314
315
|
setShowBridgeWidget,
|
|
315
316
|
setShowDynamicUserProfile,
|
|
@@ -306,6 +306,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
306
306
|
setMultiWalletWidgetState,
|
|
307
307
|
setOnboardingOnlyJwt,
|
|
308
308
|
setSdkHasLoaded,
|
|
309
|
+
setSelectedWalletConnectorKey,
|
|
309
310
|
setShowAuthFlow,
|
|
310
311
|
setShowBridgeWidget,
|
|
311
312
|
setShowDynamicUserProfile,
|
|
@@ -9,6 +9,7 @@ export type UseHandleLogoutParams = {
|
|
|
9
9
|
setSdkHasLoaded: Dispatch<SetStateAction<boolean>>;
|
|
10
10
|
clearAllWalletConnectSessions: () => void;
|
|
11
11
|
bridgeChains: ChainsToConnect[] | undefined;
|
|
12
|
+
setSelectedWalletConnectorKey: Dispatch<SetStateAction<string | null>>;
|
|
12
13
|
setShowDynamicUserProfile: Dispatch<SetStateAction<boolean>>;
|
|
13
14
|
setShowBridgeWidget: Dispatch<SetStateAction<boolean>>;
|
|
14
15
|
user: UserProfile | undefined;
|
|
@@ -79,6 +79,7 @@ const useHandleLogout = (params) => {
|
|
|
79
79
|
const logout = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
80
80
|
const p = paramsRef.current;
|
|
81
81
|
p.setSdkHasLoaded(false);
|
|
82
|
+
p.setSelectedWalletConnectorKey(null);
|
|
82
83
|
p.clearAllWalletConnectSessions();
|
|
83
84
|
p.setShowDynamicUserProfile(false);
|
|
84
85
|
p.setShowBridgeWidget(false);
|
|
@@ -75,6 +75,7 @@ const useHandleLogout = (params) => {
|
|
|
75
75
|
const logout = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
76
76
|
const p = paramsRef.current;
|
|
77
77
|
p.setSdkHasLoaded(false);
|
|
78
|
+
p.setSelectedWalletConnectorKey(null);
|
|
78
79
|
p.clearAllWalletConnectSessions();
|
|
79
80
|
p.setShowDynamicUserProfile(false);
|
|
80
81
|
p.setShowBridgeWidget(false);
|
|
@@ -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 };
|