@dynamic-labs/sdk-react-core 0.17.0-RC.10 → 0.17.0-RC.11

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,11 @@
1
1
 
2
+ ## [0.17.0-RC.11](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.10...v0.17.0-RC.11) (2023-05-08)
3
+
4
+
5
+ ### Features
6
+
7
+ * add walletConnectors setting for supplying array of wallet connectors ([#2059](https://github.com/dynamic-labs/DynamicAuth/issues/2059)) ([ae65218](https://github.com/dynamic-labs/DynamicAuth/commit/ae652180b17a870f7bbf5f99c876f386e0de1af5))
8
+
2
9
  ## [0.17.0-RC.10](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.9...v0.17.0-RC.10) (2023-05-05)
3
10
 
4
11
  ## [0.17.0-RC.9](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.8...v0.17.0-RC.9) (2023-05-05)
package/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "0.17.0-RC.10";
5
+ var version = "0.17.0-RC.11";
6
6
  var dependencies = {
7
7
  "react-focus-lock": "^2.9.2",
8
8
  "@dynamic-labs/iconic": "^0.1.19",
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "0.17.0-RC.10";
1
+ var version = "0.17.0-RC.11";
2
2
  var dependencies = {
3
3
  "react-focus-lock": "^2.9.2",
4
4
  "@dynamic-labs/iconic": "^0.1.19",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "0.17.0-RC.10",
3
+ "version": "0.17.0-RC.11",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -17,12 +17,12 @@
17
17
  "formik": "^2.2.9",
18
18
  "qrcode": "1.5.1",
19
19
  "ethers": "^5.7.2",
20
- "@dynamic-labs/logger": "0.17.0-RC.10",
21
- "@dynamic-labs/multi-wallet": "0.17.0-RC.10",
22
- "@dynamic-labs/rpc-providers": "0.17.0-RC.10",
23
- "@dynamic-labs/types": "0.17.0-RC.10",
24
- "@dynamic-labs/utils": "0.17.0-RC.10",
25
- "@dynamic-labs/wallet-connector-core": "0.17.0-RC.10"
20
+ "@dynamic-labs/logger": "0.17.0-RC.11",
21
+ "@dynamic-labs/multi-wallet": "0.17.0-RC.11",
22
+ "@dynamic-labs/rpc-providers": "0.17.0-RC.11",
23
+ "@dynamic-labs/types": "0.17.0-RC.11",
24
+ "@dynamic-labs/utils": "0.17.0-RC.11",
25
+ "@dynamic-labs/wallet-connector-core": "0.17.0-RC.11"
26
26
  },
27
27
  "devDependencies": {
28
28
  "semver": "^7.3.8"
@@ -77,7 +77,7 @@ var useNameService = require('./hooks/useNameService/useNameService.cjs');
77
77
 
78
78
  const EMPTY_INITIAL_USER = undefined;
79
79
  const DynamicContext = React.createContext(undefined);
80
- const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, accessDeniedMessageSecondary, apiBaseUrl, appLogoUrl = 'https://demo.dynamic.xyz/assets/dynamic-logo.svg', appName = 'Dynamic Example', cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, initialAuthenticationMode = 'connect-and-sign', debugError = false, displayTermsOfService = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, eventsCallbacks, evmNetworks, walletsFilter, logLevel = 'WARN', multiWallet = false, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, }, children, theme, }) => {
80
+ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, accessDeniedMessageSecondary, apiBaseUrl, appLogoUrl = 'https://demo.dynamic.xyz/assets/dynamic-logo.svg', appName = 'Dynamic Example', cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, initialAuthenticationMode = 'connect-and-sign', debugError = false, displayTermsOfService = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, eventsCallbacks, evmNetworks, walletsFilter, logLevel = 'WARN', multiWallet = false, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, }, children, theme, }) => {
81
81
  var _a, _b, _c;
82
82
  logger.logger.setLogLevel(logLevel);
83
83
  walletConnectorCore.logger.setLogLevel(logLevel);
@@ -115,6 +115,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
115
115
  appName,
116
116
  networkConfigurations: serverNetworkConfigurations,
117
117
  projectSettings,
118
+ walletConnectorsProp,
118
119
  walletUiUtils,
119
120
  });
120
121
  const [authMode, setAuthMode] = useLocalStorage.useLocalStorage(localStorage$1.AUTH_MODE, initialAuthenticationMode);
@@ -1,5 +1,5 @@
1
1
  import { Dispatch, SetStateAction, ReactNode } from 'react';
2
- import { WalletConnector, FetchPublicAddressOpts } from '@dynamic-labs/wallet-connector-core';
2
+ import { WalletConnector, FetchPublicAddressOpts, WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
3
3
  import { DynamicJwt, NameServiceData, ProjectSettings } from '@dynamic-labs/sdk-api';
4
4
  import { LogLevel } from '@dynamic-labs/logger';
5
5
  import { EvmNetwork, NetworkConfigurationMap, WalletUiUtils } from '@dynamic-labs/types';
@@ -132,9 +132,10 @@ export interface DynamicContextProps {
132
132
  socialMediaUrl?: string;
133
133
  termsOfServiceUrl?: string;
134
134
  toolkitEnabled?: boolean;
135
+ walletConnectors?: WalletConnectorsMethod[];
135
136
  walletsFilter?: (options: WalletOption[]) => WalletOption[];
136
137
  };
137
138
  theme?: ThemeData | ThemeSetting;
138
139
  }
139
140
  export declare const DynamicContext: import("react").Context<IDynamicContext | undefined>;
140
- export declare const DynamicContextProvider: ({ settings: { accessDeniedMessagePrimary, accessDeniedMessageSecondary, apiBaseUrl, appLogoUrl, appName, cssOverrides, defaultNumberOfWalletsToShow, initialAuthenticationMode, debugError, displayTermsOfService, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly, environmentId, eventsCallbacks, evmNetworks, walletsFilter, logLevel, multiWallet, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled, }, children, theme, }: DynamicContextProps) => JSX.Element;
141
+ export declare const DynamicContextProvider: ({ settings: { accessDeniedMessagePrimary, accessDeniedMessageSecondary, apiBaseUrl, appLogoUrl, appName, cssOverrides, defaultNumberOfWalletsToShow, initialAuthenticationMode, debugError, displayTermsOfService, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly, environmentId, eventsCallbacks, evmNetworks, walletsFilter, logLevel, multiWallet, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled, walletConnectors: walletConnectorsProp, }, children, theme, }: DynamicContextProps) => JSX.Element;
@@ -73,7 +73,7 @@ import { useNameService } from './hooks/useNameService/useNameService.js';
73
73
 
74
74
  const EMPTY_INITIAL_USER = undefined;
75
75
  const DynamicContext = createContext(undefined);
76
- const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, accessDeniedMessageSecondary, apiBaseUrl, appLogoUrl = 'https://demo.dynamic.xyz/assets/dynamic-logo.svg', appName = 'Dynamic Example', cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, initialAuthenticationMode = 'connect-and-sign', debugError = false, displayTermsOfService = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, eventsCallbacks, evmNetworks, walletsFilter, logLevel = 'WARN', multiWallet = false, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, }, children, theme, }) => {
76
+ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, accessDeniedMessageSecondary, apiBaseUrl, appLogoUrl = 'https://demo.dynamic.xyz/assets/dynamic-logo.svg', appName = 'Dynamic Example', cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, initialAuthenticationMode = 'connect-and-sign', debugError = false, displayTermsOfService = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, eventsCallbacks, evmNetworks, walletsFilter, logLevel = 'WARN', multiWallet = false, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, }, children, theme, }) => {
77
77
  var _a, _b, _c;
78
78
  logger.setLogLevel(logLevel);
79
79
  logger$1.setLogLevel(logLevel);
@@ -111,6 +111,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
111
111
  appName,
112
112
  networkConfigurations: serverNetworkConfigurations,
113
113
  projectSettings,
114
+ walletConnectorsProp,
114
115
  walletUiUtils,
115
116
  });
116
117
  const [authMode, setAuthMode] = useLocalStorage(AUTH_MODE, initialAuthenticationMode);
@@ -6,7 +6,7 @@ var _tslib = require('../../../../../_virtual/_tslib.cjs');
6
6
  var React = require('react');
7
7
  var data = require('../../../views/WalletList/data.cjs');
8
8
 
9
- const useWallets = ({ projectSettings, appLogoUrl, appName, networkConfigurations, walletUiUtils, }) => {
9
+ const useWallets = ({ projectSettings, appLogoUrl, appName, networkConfigurations, walletUiUtils, walletConnectorsProp, }) => {
10
10
  const [wallets, setWallets] = React.useState([]);
11
11
  React.useEffect(() => {
12
12
  const getWalletList = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
@@ -17,6 +17,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, networkConfiguration
17
17
  customerApiProviders: projectSettings.providers || [],
18
18
  networkConfigurations,
19
19
  skipMemo: true,
20
+ walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
20
21
  walletUiUtils,
21
22
  });
22
23
  const notInstalledWallets = yield data.getNotInstalledWallets(projectSettings, {
@@ -25,14 +26,26 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, networkConfiguration
25
26
  customerApiProviders: projectSettings.providers || [],
26
27
  networkConfigurations,
27
28
  skipMemo: true,
29
+ walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
28
30
  walletUiUtils,
29
31
  });
30
- const unfilteredWallets = [...installedWallets, ...notInstalledWallets];
32
+ const unfilteredWallets = [
33
+ ...installedWallets,
34
+ ...notInstalledWallets,
35
+ ];
31
36
  setWallets(unfilteredWallets);
32
37
  }
33
38
  });
34
39
  getWalletList();
35
- }, [projectSettings, appLogoUrl, appName, networkConfigurations]);
40
+ },
41
+ // Cannot include walletUiUtils in the dependency array because it will cause an infinite loop
42
+ [
43
+ projectSettings,
44
+ appLogoUrl,
45
+ appName,
46
+ networkConfigurations,
47
+ walletConnectorsProp,
48
+ ]);
36
49
  return { wallets };
37
50
  };
38
51
 
@@ -1,14 +1,16 @@
1
1
  import { ProjectSettings } from '@dynamic-labs/sdk-api';
2
2
  import { NetworkConfigurationMap, WalletUiUtils } from '@dynamic-labs/types';
3
+ import { WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
3
4
  import { WalletOption } from '../../../shared';
4
5
  type Props = {
5
6
  appLogoUrl?: string;
6
7
  appName?: string;
7
8
  networkConfigurations: NetworkConfigurationMap | undefined;
8
9
  projectSettings: ProjectSettings | undefined;
10
+ walletConnectorsProp?: WalletConnectorsMethod[];
9
11
  walletUiUtils: WalletUiUtils;
10
12
  };
11
- export declare const useWallets: ({ projectSettings, appLogoUrl, appName, networkConfigurations, walletUiUtils, }: Props) => {
13
+ export declare const useWallets: ({ projectSettings, appLogoUrl, appName, networkConfigurations, walletUiUtils, walletConnectorsProp, }: Props) => {
12
14
  wallets: WalletOption[];
13
15
  };
14
16
  export {};
@@ -2,7 +2,7 @@ import { __awaiter } from '../../../../../_virtual/_tslib.js';
2
2
  import { useState, useEffect } from 'react';
3
3
  import { getInstalledWallets, getNotInstalledWallets } from '../../../views/WalletList/data.js';
4
4
 
5
- const useWallets = ({ projectSettings, appLogoUrl, appName, networkConfigurations, walletUiUtils, }) => {
5
+ const useWallets = ({ projectSettings, appLogoUrl, appName, networkConfigurations, walletUiUtils, walletConnectorsProp, }) => {
6
6
  const [wallets, setWallets] = useState([]);
7
7
  useEffect(() => {
8
8
  const getWalletList = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -13,6 +13,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, networkConfiguration
13
13
  customerApiProviders: projectSettings.providers || [],
14
14
  networkConfigurations,
15
15
  skipMemo: true,
16
+ walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
16
17
  walletUiUtils,
17
18
  });
18
19
  const notInstalledWallets = yield getNotInstalledWallets(projectSettings, {
@@ -21,14 +22,26 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, networkConfiguration
21
22
  customerApiProviders: projectSettings.providers || [],
22
23
  networkConfigurations,
23
24
  skipMemo: true,
25
+ walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
24
26
  walletUiUtils,
25
27
  });
26
- const unfilteredWallets = [...installedWallets, ...notInstalledWallets];
28
+ const unfilteredWallets = [
29
+ ...installedWallets,
30
+ ...notInstalledWallets,
31
+ ];
27
32
  setWallets(unfilteredWallets);
28
33
  }
29
34
  });
30
35
  getWalletList();
31
- }, [projectSettings, appLogoUrl, appName, networkConfigurations]);
36
+ },
37
+ // Cannot include walletUiUtils in the dependency array because it will cause an infinite loop
38
+ [
39
+ projectSettings,
40
+ appLogoUrl,
41
+ appName,
42
+ networkConfigurations,
43
+ walletConnectorsProp,
44
+ ]);
32
45
  return { wallets };
33
46
  };
34
47
 
@@ -68,7 +68,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
68
68
  };
69
69
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", Object.assign({ className: 'wallet-list__container' }, { children: [error && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: error }), !projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsxRuntime.jsx(Search.Search, { label: `Search through ${numberOfWallets} wallets...`, value: filterValue, onChange: ({ target: { value } }) => setFilterValue(value), onClickClear: () => setFilterValue('') }))), jsxRuntime.jsxs("div", Object.assign({ className: classNames.classNames('wallet-list__scroll-container', {
70
70
  'wallet-list__scroll-container--full-height': isSearchEnabled,
71
- }), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: walletsList.map((wallet) => (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, connectedWallets: connectedWallets, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: setFilterValue }, wallet.key))) })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(SearchInstead.SearchInstead, {}))] }))] })), noDefaultFooter && (jsxRuntime.jsx("div", { className: classNames.classNames('wallet-list__tiny-footer', {
71
+ }), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [walletsList.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: "Oops, no login methods have been configured." })), walletsList.map((wallet) => (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, connectedWallets: connectedWallets, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: setFilterValue }, wallet.key)))] })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(SearchInstead.SearchInstead, {}))] }))] })), noDefaultFooter && (jsxRuntime.jsx("div", { className: classNames.classNames('wallet-list__tiny-footer', {
72
72
  'wallet-list__tiny-footer--hidden': footerIsVisible,
73
73
  }), "data-testid": 'wallet-list-tiny-footer' }))] }));
74
74
  };
@@ -64,7 +64,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
64
64
  };
65
65
  return (jsxs(Fragment, { children: [jsxs("div", Object.assign({ className: 'wallet-list__container' }, { children: [error && jsx(ErrorContainer, { children: error }), !projectSettings ? (jsx(Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsx(Search, { label: `Search through ${numberOfWallets} wallets...`, value: filterValue, onChange: ({ target: { value } }) => setFilterValue(value), onClickClear: () => setFilterValue('') }))), jsxs("div", Object.assign({ className: classNames('wallet-list__scroll-container', {
66
66
  'wallet-list__scroll-container--full-height': isSearchEnabled,
67
- }), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsx(Fragment, { children: walletsList.map((wallet) => (jsx(WalletListItem, { wallet: wallet, connectedWallets: connectedWallets, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: setFilterValue }, wallet.key))) })), isSearchEnabled && !filterValue && projectSettings && (jsx(SearchInstead, {}))] }))] })), noDefaultFooter && (jsx("div", { className: classNames('wallet-list__tiny-footer', {
67
+ }), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxs(Fragment, { children: [walletsList.length === 0 && (jsx(ErrorContainer, { children: "Oops, no login methods have been configured." })), walletsList.map((wallet) => (jsx(WalletListItem, { wallet: wallet, connectedWallets: connectedWallets, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: setFilterValue }, wallet.key)))] })), isSearchEnabled && !filterValue && projectSettings && (jsx(SearchInstead, {}))] }))] })), noDefaultFooter && (jsx("div", { className: classNames('wallet-list__tiny-footer', {
68
68
  'wallet-list__tiny-footer--hidden': footerIsVisible,
69
69
  }), "data-testid": 'wallet-list-tiny-footer' }))] }));
70
70
  };