@dynamic-labs/sdk-react-core 1.4.14 → 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 CHANGED
@@ -1,4 +1,18 @@
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
+
9
+ ### [1.4.15](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.14...v1.4.15) (2024-07-17)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * re-establish connection to metamask starknet snap on page reload ([#6362](https://github.com/dynamic-labs/DynamicAuth/issues/6362)) ([176bd0e](https://github.com/dynamic-labs/DynamicAuth/commit/176bd0e096a523731e815b1e32961509db1e05d2))
15
+
2
16
  ### [1.4.14](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.13...v1.4.14) (2024-07-11)
3
17
 
4
18
  ### [1.4.13](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.12...v1.4.13) (2024-06-05)
package/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "1.4.14";
5
+ var version = "1.4.16";
6
6
  var dependencies = {
7
7
  "@dynamic-labs/sdk-api": "0.0.387",
8
8
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "1.4.14";
1
+ var version = "1.4.16";
2
2
  var dependencies = {
3
3
  "@dynamic-labs/sdk-api": "0.0.387",
4
4
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "1.4.14",
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.14",
20
- "@dynamic-labs/iconic": "1.4.14",
21
- "@dynamic-labs/logger": "1.4.14",
22
- "@dynamic-labs/multi-wallet": "1.4.14",
23
- "@dynamic-labs/rpc-providers": "1.4.14",
24
- "@dynamic-labs/types": "1.4.14",
25
- "@dynamic-labs/utils": "1.4.14",
26
- "@dynamic-labs/viem-utils": "1.4.14",
27
- "@dynamic-labs/wallet-book": "1.4.14",
28
- "@dynamic-labs/wallet-connector-core": "1.4.14",
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',
@@ -0,0 +1,2 @@
1
+ import { GetCalculatedOffsetUtil } from './getCalculatedOffset.types';
2
+ export declare const getCalculatedOffset: GetCalculatedOffsetUtil;
@@ -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
- 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: walletConnectorNetworks.length
93
- ? 'dyn_network_not_supported_manual_switch.subtitle_network_defined'
94
- : 'dyn_network_not_supported_manual_switch.subtitle_no_network_defined', children: walletConnectorNetworks.length
95
- ? t('dyn_network_not_supported_manual_switch.subtitle_network_defined', { network: walletConnectorNetworks[0].name })
96
- : t('dyn_network_not_supported_manual_switch.subtitle_no_network_defined') })] })] }));
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
- 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: walletConnectorNetworks.length
89
- ? 'dyn_network_not_supported_manual_switch.subtitle_network_defined'
90
- : 'dyn_network_not_supported_manual_switch.subtitle_no_network_defined', children: walletConnectorNetworks.length
91
- ? t('dyn_network_not_supported_manual_switch.subtitle_network_defined', { network: walletConnectorNetworks[0].name })
92
- : t('dyn_network_not_supported_manual_switch.subtitle_no_network_defined') })] })] }));
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 };