@dynamic-labs/sdk-react-core 3.0.0-alpha.27 → 3.0.0-alpha.29

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
+ ## [3.0.0-alpha.29](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.28...v3.0.0-alpha.29) (2024-07-25)
3
+
4
+
5
+ ### Features
6
+
7
+ * add link to starknet snap companion app in network switch modal ([#6417](https://github.com/dynamic-labs/DynamicAuth/issues/6417)) ([132a3f8](https://github.com/dynamic-labs/DynamicAuth/commit/132a3f84af62930583f042f35e9616bc837ee49d))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * improve network switch ux for starknet snap on login ([#6376](https://github.com/dynamic-labs/DynamicAuth/issues/6376)) ([db4af65](https://github.com/dynamic-labs/DynamicAuth/commit/db4af6576dc164876750ad6e13f4624d8a11a1a3))
13
+
14
+ ## [3.0.0-alpha.28](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.27...v3.0.0-alpha.28) (2024-07-25)
15
+
2
16
  ## [3.0.0-alpha.27](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.26...v3.0.0-alpha.27) (2024-07-24)
3
17
 
4
18
 
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "3.0.0-alpha.27";
6
+ var version = "3.0.0-alpha.29";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.497",
9
9
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "3.0.0-alpha.27";
2
+ var version = "3.0.0-alpha.29";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.497",
5
5
  "@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": "3.0.0-alpha.27",
3
+ "version": "3.0.0-alpha.29",
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": "3.0.0-alpha.27",
21
- "@dynamic-labs/logger": "3.0.0-alpha.27",
22
- "@dynamic-labs/message-transport": "3.0.0-alpha.27",
23
- "@dynamic-labs/multi-wallet": "3.0.0-alpha.27",
24
- "@dynamic-labs/rpc-providers": "3.0.0-alpha.27",
25
- "@dynamic-labs/store": "3.0.0-alpha.27",
26
- "@dynamic-labs/types": "3.0.0-alpha.27",
27
- "@dynamic-labs/utils": "3.0.0-alpha.27",
28
- "@dynamic-labs/wallet-book": "3.0.0-alpha.27",
29
- "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.27",
20
+ "@dynamic-labs/iconic": "3.0.0-alpha.29",
21
+ "@dynamic-labs/logger": "3.0.0-alpha.29",
22
+ "@dynamic-labs/message-transport": "3.0.0-alpha.29",
23
+ "@dynamic-labs/multi-wallet": "3.0.0-alpha.29",
24
+ "@dynamic-labs/rpc-providers": "3.0.0-alpha.29",
25
+ "@dynamic-labs/store": "3.0.0-alpha.29",
26
+ "@dynamic-labs/types": "3.0.0-alpha.29",
27
+ "@dynamic-labs/utils": "3.0.0-alpha.29",
28
+ "@dynamic-labs/wallet-book": "3.0.0-alpha.29",
29
+ "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.29",
30
30
  "eventemitter3": "5.0.1"
31
31
  },
32
32
  "devDependencies": {
@@ -1045,6 +1045,9 @@ const translation = {
1045
1045
  * @description copy keys for network not supported view for manual switch
1046
1046
  * @default
1047
1047
  * {
1048
+ subtitle_network_defined_metamaskstarknet:
1049
+ 'To continue, please update the network in your wallet to {{network}} by visiting the Starknet Snap companion app',
1050
+ subtitle_network_defined_metamaskstarknet_companion_app: 'companion app',
1048
1051
  subtitle_network_defined: 'To continue, please update the network in your wallet to {{network}}',
1049
1052
  subtitle_no_network_defined: 'Your wallet does not support switching networks from this app. Switch networks directly in your wallet.',
1050
1053
  title: 'Update your Network',
@@ -1052,6 +1055,8 @@ const translation = {
1052
1055
  }
1053
1056
  */
1054
1057
  dyn_network_not_supported_manual_switch: {
1058
+ subtitle_network_defined_metamaskstarknet: 'To continue, please update the network in your wallet to {{network}} by visiting the Starknet Snap',
1059
+ subtitle_network_defined_metamaskstarknet_companion_app: 'companion app',
1055
1060
  subtitle_network_defined: 'To continue, please update the network in your wallet to {{network}}',
1056
1061
  subtitle_no_network_defined: 'Your wallet does not support switching networks from this app. Switch networks directly in your wallet.',
1057
1062
  title: 'Update your Network',
@@ -1041,6 +1041,9 @@ export declare const translation: {
1041
1041
  * @description copy keys for network not supported view for manual switch
1042
1042
  * @default
1043
1043
  * {
1044
+ subtitle_network_defined_metamaskstarknet:
1045
+ 'To continue, please update the network in your wallet to {{network}} by visiting the Starknet Snap companion app',
1046
+ subtitle_network_defined_metamaskstarknet_companion_app: 'companion app',
1044
1047
  subtitle_network_defined: 'To continue, please update the network in your wallet to {{network}}',
1045
1048
  subtitle_no_network_defined: 'Your wallet does not support switching networks from this app. Switch networks directly in your wallet.',
1046
1049
  title: 'Update your Network',
@@ -1048,6 +1051,8 @@ export declare const translation: {
1048
1051
  }
1049
1052
  */
1050
1053
  dyn_network_not_supported_manual_switch: {
1054
+ subtitle_network_defined_metamaskstarknet: string;
1055
+ subtitle_network_defined_metamaskstarknet_companion_app: string;
1051
1056
  subtitle_network_defined: string;
1052
1057
  subtitle_no_network_defined: string;
1053
1058
  title: string;
@@ -1041,6 +1041,9 @@ const translation = {
1041
1041
  * @description copy keys for network not supported view for manual switch
1042
1042
  * @default
1043
1043
  * {
1044
+ subtitle_network_defined_metamaskstarknet:
1045
+ 'To continue, please update the network in your wallet to {{network}} by visiting the Starknet Snap companion app',
1046
+ subtitle_network_defined_metamaskstarknet_companion_app: 'companion app',
1044
1047
  subtitle_network_defined: 'To continue, please update the network in your wallet to {{network}}',
1045
1048
  subtitle_no_network_defined: 'Your wallet does not support switching networks from this app. Switch networks directly in your wallet.',
1046
1049
  title: 'Update your Network',
@@ -1048,6 +1051,8 @@ const translation = {
1048
1051
  }
1049
1052
  */
1050
1053
  dyn_network_not_supported_manual_switch: {
1054
+ subtitle_network_defined_metamaskstarknet: 'To continue, please update the network in your wallet to {{network}} by visiting the Starknet Snap',
1055
+ subtitle_network_defined_metamaskstarknet_companion_app: 'companion app',
1051
1056
  subtitle_network_defined: 'To continue, please update the network in your wallet to {{network}}',
1052
1057
  subtitle_no_network_defined: 'Your wallet does not support switching networks from this app. Switch networks directly in your wallet.',
1053
1058
  title: 'Update your Network',
@@ -177,7 +177,7 @@ const useFields = () => {
177
177
  // - string can contain letters A-Z, a-z, numbers 0-9, or symbols $ ! # % ?
178
178
  // - string must be length 3 to 20
179
179
  // - string cannot contain consecutive symbols
180
- validation: yup.string().matches(/^(?!.*([$!#%?])\1)[A-Za-z0-9$!#%?]{3,20}$/, t('dyn_collect_user_data.fields.username.validation')),
180
+ validation: yup.string().matches(/^(?!.*([$!#%?])\1)[A-Za-z0-9$!#%?_-]{3,20}$/, t('dyn_collect_user_data.fields.username.validation')),
181
181
  },
182
182
  }), [selectedPhoneCountry, t]);
183
183
  return { fieldsConfig };
@@ -173,7 +173,7 @@ const useFields = () => {
173
173
  // - string can contain letters A-Z, a-z, numbers 0-9, or symbols $ ! # % ?
174
174
  // - string must be length 3 to 20
175
175
  // - string cannot contain consecutive symbols
176
- validation: string().matches(/^(?!.*([$!#%?])\1)[A-Za-z0-9$!#%?]{3,20}$/, t('dyn_collect_user_data.fields.username.validation')),
176
+ validation: string().matches(/^(?!.*([$!#%?])\1)[A-Za-z0-9$!#%?_-]{3,20}$/, t('dyn_collect_user_data.fields.username.validation')),
177
177
  },
178
178
  }), [selectedPhoneCountry, t]);
179
179
  return { fieldsConfig };
@@ -18,6 +18,7 @@ require('../../shared/logger.cjs');
18
18
  require('@dynamic-labs/iconic');
19
19
  require('@dynamic-labs/wallet-connector-core');
20
20
  require('../../context/ViewContext/ViewContext.cjs');
21
+ var externalLink = require('../../shared/assets/externalLink.cjs');
21
22
  require('../../utils/constants/colors.cjs');
22
23
  require('../../utils/constants/values.cjs');
23
24
  require('../../shared/utils/classes/storage/localStorage.cjs');
@@ -105,11 +106,27 @@ const NetworkNotSupportedSwitchManual = () => {
105
106
  width: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
106
107
  } }));
107
108
  const walletConnectorNetworks = getWalletConnectorNetworks.getWalletConnectorNetworks(walletConnector);
108
- 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: 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
109
- ? 'dyn_network_not_supported_manual_switch.subtitle_network_defined'
110
- : 'dyn_network_not_supported_manual_switch.subtitle_no_network_defined', children: walletConnectorNetworks.length
111
- ? t('dyn_network_not_supported_manual_switch.subtitle_network_defined', { network: walletConnectorNetworks[0].name })
112
- : t('dyn_network_not_supported_manual_switch.subtitle_no_network_defined') })] })] }));
109
+ const getSubtitleCopyKey = () => {
110
+ if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'metamaskstarknet') {
111
+ return 'dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet';
112
+ }
113
+ return walletConnectorNetworks.length
114
+ ? 'dyn_network_not_supported_manual_switch.subtitle_network_defined'
115
+ : 'dyn_network_not_supported_manual_switch.subtitle_no_network_defined';
116
+ };
117
+ const getSubtitle = () => {
118
+ if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'metamaskstarknet') {
119
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [t('dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet', {
120
+ network: walletConnectorNetworks[0].name,
121
+ }), 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' } })] })] }));
122
+ }
123
+ return walletConnectorNetworks.length
124
+ ? t('dyn_network_not_supported_manual_switch.subtitle_network_defined', {
125
+ network: walletConnectorNetworks[0].name,
126
+ })
127
+ : t('dyn_network_not_supported_manual_switch.subtitle_no_network_defined');
128
+ };
129
+ 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: 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() })] })] }));
113
130
  };
114
131
 
115
132
  exports.NetworkNotSupportedSwitchManual = NetworkNotSupportedSwitchManual;
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { WalletIcon } from '@dynamic-labs/wallet-book';
5
5
  import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
@@ -14,6 +14,7 @@ import '../../shared/logger.js';
14
14
  import '@dynamic-labs/iconic';
15
15
  import '@dynamic-labs/wallet-connector-core';
16
16
  import '../../context/ViewContext/ViewContext.js';
17
+ import { ReactComponent as SvgExternalLink } from '../../shared/assets/externalLink.js';
17
18
  import '../../utils/constants/colors.js';
18
19
  import '../../utils/constants/values.js';
19
20
  import '../../shared/utils/classes/storage/localStorage.js';
@@ -101,11 +102,27 @@ const NetworkNotSupportedSwitchManual = () => {
101
102
  width: pixelToRem(iconSize * iconRatio),
102
103
  } }));
103
104
  const walletConnectorNetworks = getWalletConnectorNetworks(walletConnector);
104
- 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: 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
105
- ? 'dyn_network_not_supported_manual_switch.subtitle_network_defined'
106
- : 'dyn_network_not_supported_manual_switch.subtitle_no_network_defined', children: walletConnectorNetworks.length
107
- ? t('dyn_network_not_supported_manual_switch.subtitle_network_defined', { network: walletConnectorNetworks[0].name })
108
- : t('dyn_network_not_supported_manual_switch.subtitle_no_network_defined') })] })] }));
105
+ const getSubtitleCopyKey = () => {
106
+ if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'metamaskstarknet') {
107
+ return 'dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet';
108
+ }
109
+ return walletConnectorNetworks.length
110
+ ? 'dyn_network_not_supported_manual_switch.subtitle_network_defined'
111
+ : 'dyn_network_not_supported_manual_switch.subtitle_no_network_defined';
112
+ };
113
+ const getSubtitle = () => {
114
+ if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'metamaskstarknet') {
115
+ return (jsxs(Fragment, { children: [t('dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet', {
116
+ network: walletConnectorNetworks[0].name,
117
+ }), 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' } })] })] }));
118
+ }
119
+ return walletConnectorNetworks.length
120
+ ? t('dyn_network_not_supported_manual_switch.subtitle_network_defined', {
121
+ network: walletConnectorNetworks[0].name,
122
+ })
123
+ : t('dyn_network_not_supported_manual_switch.subtitle_no_network_defined');
124
+ };
125
+ 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: 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() })] })] }));
109
126
  };
110
127
 
111
128
  export { NetworkNotSupportedSwitchManual };