@dynamic-labs/sdk-react-core 2.0.0-alpha.1 → 2.0.0-alpha.3

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
+ ## [2.0.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-02-13)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * allow any icon to be used in wallet list tabs ([#4678](https://github.com/dynamic-labs/DynamicAuth/issues/4678)) ([eb03603](https://github.com/dynamic-labs/DynamicAuth/commit/eb036031725a91cb28c144b3bdcb5b20b3314038))
8
+
9
+ ## [2.0.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-13)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * old iconic dependency version ([#4673](https://github.com/dynamic-labs/DynamicAuth/issues/4673)) ([4a5c448](https://github.com/dynamic-labs/DynamicAuth/commit/4a5c448c251540139f84514328d5f1d31808d75c))
15
+
2
16
  ## [2.0.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.0...v2.0.0-alpha.1) (2024-02-12)
3
17
 
4
18
 
package/package.cjs CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "2.0.0-alpha.1";
5
+ var version = "2.0.0-alpha.3";
6
6
  var dependencies = {
7
- "@dynamic-labs/iconic": "0.1.52",
8
7
  "@dynamic-labs/sdk-api": "0.0.363",
9
8
  "@hcaptcha/react-hcaptcha": "1.4.4",
10
9
  "country-list": "2.3.0",
package/package.js CHANGED
@@ -1,6 +1,5 @@
1
- var version = "2.0.0-alpha.1";
1
+ var version = "2.0.0-alpha.3";
2
2
  var dependencies = {
3
- "@dynamic-labs/iconic": "0.1.52",
4
3
  "@dynamic-labs/sdk-api": "0.0.363",
5
4
  "@hcaptcha/react-hcaptcha": "1.4.4",
6
5
  "country-list": "2.3.0",
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
7
7
  "directory": "packages/sdk-react-core"
8
8
  },
9
9
  "dependencies": {
10
- "@dynamic-labs/iconic": "0.1.52",
11
10
  "@dynamic-labs/sdk-api": "0.0.363",
12
11
  "@hcaptcha/react-hcaptcha": "1.4.4",
13
12
  "country-list": "2.3.0",
@@ -17,15 +16,16 @@
17
16
  "react-focus-lock": "2.9.2",
18
17
  "react-i18next": "^13.2.0",
19
18
  "yup": "0.32.11",
20
- "@dynamic-labs/ethereum": "2.0.0-alpha.1",
21
- "@dynamic-labs/logger": "2.0.0-alpha.1",
22
- "@dynamic-labs/multi-wallet": "2.0.0-alpha.1",
23
- "@dynamic-labs/rpc-providers": "2.0.0-alpha.1",
24
- "@dynamic-labs/types": "2.0.0-alpha.1",
25
- "@dynamic-labs/utils": "2.0.0-alpha.1",
26
- "@dynamic-labs/viem-utils": "2.0.0-alpha.1",
27
- "@dynamic-labs/wallet-book": "2.0.0-alpha.1",
28
- "@dynamic-labs/wallet-connector-core": "2.0.0-alpha.1",
19
+ "@dynamic-labs/ethereum": "2.0.0-alpha.3",
20
+ "@dynamic-labs/iconic": "2.0.0-alpha.3",
21
+ "@dynamic-labs/logger": "2.0.0-alpha.3",
22
+ "@dynamic-labs/multi-wallet": "2.0.0-alpha.3",
23
+ "@dynamic-labs/rpc-providers": "2.0.0-alpha.3",
24
+ "@dynamic-labs/types": "2.0.0-alpha.3",
25
+ "@dynamic-labs/utils": "2.0.0-alpha.3",
26
+ "@dynamic-labs/viem-utils": "2.0.0-alpha.3",
27
+ "@dynamic-labs/wallet-book": "2.0.0-alpha.3",
28
+ "@dynamic-labs/wallet-connector-core": "2.0.0-alpha.3",
29
29
  "eventemitter3": "5.0.1"
30
30
  },
31
31
  "devDependencies": {
@@ -1,4 +1,4 @@
1
- import { Dispatch, MutableRefObject, ReactNode, SetStateAction } from 'react';
1
+ import { Dispatch, MutableRefObject, ReactElement, ReactNode, SetStateAction } from 'react';
2
2
  import { DynamicJwt, NameServiceData, ProjectSettings, SdkView } from '@dynamic-labs/sdk-api';
3
3
  import { NetworkConfigurationMap, SocialProviderFilter, WalletUiUtils } from '@dynamic-labs/types';
4
4
  import { Chain, FetchPublicAddressOpts, WalletConnector } from '@dynamic-labs/wallet-connector-core';
@@ -18,7 +18,7 @@ export type WalletsFilter = (options: WalletOption[]) => WalletOption[];
18
18
  export type WalletListViewTabItem = {
19
19
  label: {
20
20
  text?: string;
21
- icon?: string;
21
+ icon?: string | ReactElement;
22
22
  };
23
23
  walletsFilter?: WalletsFilter;
24
24
  recommendedWallets?: RecommendedWallet[];
@@ -139,11 +139,6 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
139
139
  }
140
140
  const { address } = connectionResult;
141
141
  const walletNetwork = yield walletConnector.getNetwork();
142
- // When we switch networks on MM/walletconnect, it breaks the flow and doesn't always display the sign message
143
- // Since it the network doesn't matter for the sign, we don't need to force the user to switch to the supported
144
- // network at this stage and they can switch when doing a transaction
145
- // Note: not checking specifically for MM since user can choose walletconnect connector to use with MM
146
- const shouldForceSupportedNetwork = !walletConnector.isWalletConnect;
147
142
  const usesSupportedNetwork = isSupportedNetwork.isSupportedNetwork({
148
143
  network: walletNetwork,
149
144
  walletConnector,
@@ -152,9 +147,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
152
147
  if (!isProgrammableNetworkSwitchSupported.isProgrammableNetworkSwitchSupported(walletConnector)) {
153
148
  return setView('network-not-supported-manual');
154
149
  }
155
- if (shouldForceSupportedNetwork) {
156
- return setView('network-not-supported');
157
- }
150
+ return setView('network-not-supported');
158
151
  }
159
152
  if (isConnectOnly.isConnectOnly(user, authMode)) {
160
153
  localStorage.LocalStorage.setToLS(localStorage$1.LAST_USED_WALLET, walletConnector.key);
@@ -135,11 +135,6 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
135
135
  }
136
136
  const { address } = connectionResult;
137
137
  const walletNetwork = yield walletConnector.getNetwork();
138
- // When we switch networks on MM/walletconnect, it breaks the flow and doesn't always display the sign message
139
- // Since it the network doesn't matter for the sign, we don't need to force the user to switch to the supported
140
- // network at this stage and they can switch when doing a transaction
141
- // Note: not checking specifically for MM since user can choose walletconnect connector to use with MM
142
- const shouldForceSupportedNetwork = !walletConnector.isWalletConnect;
143
138
  const usesSupportedNetwork = isSupportedNetwork({
144
139
  network: walletNetwork,
145
140
  walletConnector,
@@ -148,9 +143,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
148
143
  if (!isProgrammableNetworkSwitchSupported(walletConnector)) {
149
144
  return setView('network-not-supported-manual');
150
145
  }
151
- if (shouldForceSupportedNetwork) {
152
- return setView('network-not-supported');
153
- }
146
+ return setView('network-not-supported');
154
147
  }
155
148
  if (isConnectOnly(user, authMode)) {
156
149
  LocalStorage.setToLS(LAST_USED_WALLET, walletConnector.key);
@@ -3,25 +3,24 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
+ var Icon = require('../../../components/Icon/Icon.cjs');
7
+ var classNames = require('../../../utils/functions/classNames/classNames.cjs');
8
+ require('react');
9
+ require('../../../events/dynamicEvents.cjs');
10
+ require('../../../../../_virtual/_tslib.cjs');
11
+ require('@dynamic-labs/utils');
12
+ require('../../../context/DynamicContext/DynamicContext.cjs');
6
13
  require('@dynamic-labs/sdk-api');
7
14
  require('../../../shared/logger.cjs');
8
- var getChainIcon = require('../../../shared/utils/functions/chain/getChainIcon.cjs');
15
+ require('@dynamic-labs/iconic');
9
16
  require('@dynamic-labs/wallet-connector-core');
17
+ require('../../../context/ViewContext/ViewContext.cjs');
10
18
  require('@dynamic-labs/wallet-book');
11
19
  require('../../../utils/constants/colors.cjs');
12
20
  require('../../../utils/constants/values.cjs');
13
21
  require('../../../shared/utils/classes/storage/localStorage.cjs');
14
22
  require('viem');
15
- require('react');
16
- require('@dynamic-labs/utils');
17
- require('@dynamic-labs/iconic');
18
- require('../../../context/ViewContext/ViewContext.cjs');
19
23
  require('../../../shared/consts/index.cjs');
20
- var Icon = require('../../../components/Icon/Icon.cjs');
21
- var classNames = require('../../../utils/functions/classNames/classNames.cjs');
22
- require('../../../events/dynamicEvents.cjs');
23
- require('../../../../../_virtual/_tslib.cjs');
24
- require('../../../context/DynamicContext/DynamicContext.cjs');
25
24
  require('../../../context/CaptchaContext/CaptchaContext.cjs');
26
25
  require('../../../context/ErrorContext/ErrorContext.cjs');
27
26
  require('@dynamic-labs/multi-wallet');
@@ -76,13 +75,13 @@ const WalletListGridTabs = ({ items, onSelect, value, }) => (jsxRuntime.jsx("div
76
75
  const selected = value === index;
77
76
  const { icon, text } = item.label;
78
77
  const key = `${text}-${icon}`;
79
- const ChainIcon = icon ? getChainIcon.getChainIcon(icon) : null;
78
+ const TabIcon = typeof icon === 'string' ? jsxRuntime.jsx("img", { src: icon, alt: text }) : icon;
80
79
  return (jsxRuntime.jsxs("button", { type: 'button', className: classNames.classNames('wallet-list-grid-tabs__button', {
81
80
  'wallet-list-grid-tabs__button--selected': selected,
82
81
  'wallet-list-grid-tabs__button--text': Boolean(text),
83
- }), tabIndex: -1, "aria-label": text !== null && text !== void 0 ? text : icon, onClick: () => onSelect(index), children: [ChainIcon && (jsxRuntime.jsx(Icon.Icon, { size: 'small', className: classNames.classNames({
82
+ }), tabIndex: -1, "aria-label": text, onClick: () => onSelect(index), children: [TabIcon && (jsxRuntime.jsx(Icon.Icon, { size: 'small', className: classNames.classNames({
84
83
  'wallet-list-grid-tabs__icon--selected': !selected,
85
- }), children: jsxRuntime.jsx(ChainIcon, {}) })), text && (jsxRuntime.jsx(Typography.Typography, { as: 'span', variant: 'body_small', weight: selected ? 'bold' : 'medium', color: selected ? 'primary' : 'secondary', children: text }))] }, key));
84
+ }), children: TabIcon })), text && (jsxRuntime.jsx(Typography.Typography, { as: 'span', variant: 'body_small', weight: selected ? 'bold' : 'medium', color: selected ? 'primary' : 'secondary', children: text }))] }, key));
86
85
  }) }));
87
86
 
88
87
  exports.WalletListGridTabs = WalletListGridTabs;
@@ -1,23 +1,22 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Icon } from '../../../components/Icon/Icon.js';
3
+ import { classNames } from '../../../utils/functions/classNames/classNames.js';
4
+ import 'react';
5
+ import '../../../events/dynamicEvents.js';
6
+ import '../../../../../_virtual/_tslib.js';
7
+ import '@dynamic-labs/utils';
8
+ import '../../../context/DynamicContext/DynamicContext.js';
2
9
  import '@dynamic-labs/sdk-api';
3
10
  import '../../../shared/logger.js';
4
- import { getChainIcon } from '../../../shared/utils/functions/chain/getChainIcon.js';
11
+ import '@dynamic-labs/iconic';
5
12
  import '@dynamic-labs/wallet-connector-core';
13
+ import '../../../context/ViewContext/ViewContext.js';
6
14
  import '@dynamic-labs/wallet-book';
7
15
  import '../../../utils/constants/colors.js';
8
16
  import '../../../utils/constants/values.js';
9
17
  import '../../../shared/utils/classes/storage/localStorage.js';
10
18
  import 'viem';
11
- import 'react';
12
- import '@dynamic-labs/utils';
13
- import '@dynamic-labs/iconic';
14
- import '../../../context/ViewContext/ViewContext.js';
15
19
  import '../../../shared/consts/index.js';
16
- import { Icon } from '../../../components/Icon/Icon.js';
17
- import { classNames } from '../../../utils/functions/classNames/classNames.js';
18
- import '../../../events/dynamicEvents.js';
19
- import '../../../../../_virtual/_tslib.js';
20
- import '../../../context/DynamicContext/DynamicContext.js';
21
20
  import '../../../context/CaptchaContext/CaptchaContext.js';
22
21
  import '../../../context/ErrorContext/ErrorContext.js';
23
22
  import '@dynamic-labs/multi-wallet';
@@ -72,13 +71,13 @@ const WalletListGridTabs = ({ items, onSelect, value, }) => (jsx("div", { classN
72
71
  const selected = value === index;
73
72
  const { icon, text } = item.label;
74
73
  const key = `${text}-${icon}`;
75
- const ChainIcon = icon ? getChainIcon(icon) : null;
74
+ const TabIcon = typeof icon === 'string' ? jsx("img", { src: icon, alt: text }) : icon;
76
75
  return (jsxs("button", { type: 'button', className: classNames('wallet-list-grid-tabs__button', {
77
76
  'wallet-list-grid-tabs__button--selected': selected,
78
77
  'wallet-list-grid-tabs__button--text': Boolean(text),
79
- }), tabIndex: -1, "aria-label": text !== null && text !== void 0 ? text : icon, onClick: () => onSelect(index), children: [ChainIcon && (jsx(Icon, { size: 'small', className: classNames({
78
+ }), tabIndex: -1, "aria-label": text, onClick: () => onSelect(index), children: [TabIcon && (jsx(Icon, { size: 'small', className: classNames({
80
79
  'wallet-list-grid-tabs__icon--selected': !selected,
81
- }), children: jsx(ChainIcon, {}) })), text && (jsx(Typography, { as: 'span', variant: 'body_small', weight: selected ? 'bold' : 'medium', color: selected ? 'primary' : 'secondary', children: text }))] }, key));
80
+ }), children: TabIcon })), text && (jsx(Typography, { as: 'span', variant: 'body_small', weight: selected ? 'bold' : 'medium', color: selected ? 'primary' : 'secondary', children: text }))] }, key));
82
81
  }) }));
83
82
 
84
83
  export { WalletListGridTabs };