@dynamic-labs/sdk-react-core 2.2.9 → 2.2.10

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,12 @@
1
1
 
2
+ ### [2.2.10](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.9...v2.2.10) (2024-07-05)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * Allow user to close connect wallet modal to cancel making a wallet primary. ([#6251](https://github.com/dynamic-labs/DynamicAuth/issues/6251)) ([5a53fac](https://github.com/dynamic-labs/DynamicAuth/commit/5a53fac6e3e77de880e3fe5619b0c2be32fe5a92))
8
+ * Use white color in farcaster qr code when in dark mode to improve scanning. ([#6247](https://github.com/dynamic-labs/DynamicAuth/issues/6247)) ([1967bd7](https://github.com/dynamic-labs/DynamicAuth/commit/1967bd71423ae03c73fdce53adc41ad01f09a52e))
9
+
2
10
  ### [2.2.9](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.8...v2.2.9) (2024-07-04)
3
11
 
4
12
 
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "2.2.9";
6
+ var version = "2.2.10";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.460",
9
9
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "2.2.9";
2
+ var version = "2.2.10";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.460",
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": "2.2.9",
3
+ "version": "2.2.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -17,18 +17,18 @@
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": "2.2.9",
21
- "@dynamic-labs/logger": "2.2.9",
22
- "@dynamic-labs/multi-wallet": "2.2.9",
23
- "@dynamic-labs/rpc-provider-ethereum": "2.2.9",
24
- "@dynamic-labs/rpc-provider-solana": "2.2.9",
25
- "@dynamic-labs/rpc-providers": "2.2.9",
26
- "@dynamic-labs/store": "2.2.9",
27
- "@dynamic-labs/types": "2.2.9",
28
- "@dynamic-labs/utils": "2.2.9",
29
- "@dynamic-labs/viem-utils": "2.2.9",
30
- "@dynamic-labs/wallet-book": "2.2.9",
31
- "@dynamic-labs/wallet-connector-core": "2.2.9",
20
+ "@dynamic-labs/iconic": "2.2.10",
21
+ "@dynamic-labs/logger": "2.2.10",
22
+ "@dynamic-labs/multi-wallet": "2.2.10",
23
+ "@dynamic-labs/rpc-provider-ethereum": "2.2.10",
24
+ "@dynamic-labs/rpc-provider-solana": "2.2.10",
25
+ "@dynamic-labs/rpc-providers": "2.2.10",
26
+ "@dynamic-labs/store": "2.2.10",
27
+ "@dynamic-labs/types": "2.2.10",
28
+ "@dynamic-labs/utils": "2.2.10",
29
+ "@dynamic-labs/viem-utils": "2.2.10",
30
+ "@dynamic-labs/wallet-book": "2.2.10",
31
+ "@dynamic-labs/wallet-connector-core": "2.2.10",
32
32
  "eventemitter3": "5.0.1"
33
33
  },
34
34
  "devDependencies": {
@@ -184,7 +184,6 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
184
184
  network: currentWalletConnectorNetwork,
185
185
  });
186
186
  });
187
- const shouldSkipCreatingVisit = authMode === 'connect-only' && !enableVisitTrackingOnConnectOnly;
188
187
  const connectWallet = (walletConnector, getAddressOpts, options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
189
188
  const { applyHandleConnectedWallet = true } = options !== null && options !== void 0 ? options : {};
190
189
  const walletAddress = yield walletConnector.getAddress(getAddressOpts);
@@ -203,6 +202,23 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
203
202
  return;
204
203
  }
205
204
  }
205
+ const isWalletStored = connectedWalletsInfo.some(({ walletConnectorKey: storedWalletConnectorKey }) => storedWalletConnectorKey === walletConnector.key);
206
+ const walletChain = walletConnector.connectedChain;
207
+ const shouldCreateVisit = !isWalletStored &&
208
+ (authMode !== 'connect-only' || enableVisitTrackingOnConnectOnly);
209
+ if (shouldCreateVisit) {
210
+ // send information to backend to kick off background jobs
211
+ // so verify/sign on the next step could go by more quickly
212
+ // this is async work, but DO NOT AWAIT
213
+ session.createVisit({
214
+ authMode,
215
+ chain: walletChain || '',
216
+ environmentId,
217
+ publicWalletAddress: walletAddress,
218
+ walletName: walletConnector.key,
219
+ walletProvider: getWalletProvider.getWalletProvider(walletConnector),
220
+ });
221
+ }
206
222
  // On connect and sign, we don't want to add this wallet to userWallets
207
223
  // until it has been signed. Therefore, we don't add it to
208
224
  // the connectedWallets array because userWallets draws from it.
@@ -216,8 +232,6 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
216
232
  setPrimaryWalletId(walletId);
217
233
  }
218
234
  addedWalletsIds.current.push(walletId);
219
- const walletChain = walletConnector.connectedChain;
220
- const isWalletStored = connectedWalletsInfo.some(({ walletConnectorKey: storedWalletConnectorKey }) => storedWalletConnectorKey === walletConnector.key);
221
235
  if (isWalletStored) {
222
236
  yield updateConnectedWalletsList();
223
237
  }
@@ -229,19 +243,6 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
229
243
  walletConnectorKey: walletConnector.key,
230
244
  walletId,
231
245
  });
232
- if (!shouldSkipCreatingVisit) {
233
- // send information to backend to kick off background jobs
234
- // so verify/sign on the next step could go by more quickly
235
- // this is async work, but DO NOT AWAIT
236
- session.createVisit({
237
- authMode,
238
- chain: walletChain || '',
239
- environmentId,
240
- publicWalletAddress: walletAddress,
241
- walletName: walletConnector.key,
242
- walletProvider: getWalletProvider.getWalletProvider(walletConnector),
243
- });
244
- }
245
246
  }
246
247
  return { address: walletAddress, id: walletId };
247
248
  });
@@ -180,7 +180,6 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
180
180
  network: currentWalletConnectorNetwork,
181
181
  });
182
182
  });
183
- const shouldSkipCreatingVisit = authMode === 'connect-only' && !enableVisitTrackingOnConnectOnly;
184
183
  const connectWallet = (walletConnector, getAddressOpts, options) => __awaiter(void 0, void 0, void 0, function* () {
185
184
  const { applyHandleConnectedWallet = true } = options !== null && options !== void 0 ? options : {};
186
185
  const walletAddress = yield walletConnector.getAddress(getAddressOpts);
@@ -199,6 +198,23 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
199
198
  return;
200
199
  }
201
200
  }
201
+ const isWalletStored = connectedWalletsInfo.some(({ walletConnectorKey: storedWalletConnectorKey }) => storedWalletConnectorKey === walletConnector.key);
202
+ const walletChain = walletConnector.connectedChain;
203
+ const shouldCreateVisit = !isWalletStored &&
204
+ (authMode !== 'connect-only' || enableVisitTrackingOnConnectOnly);
205
+ if (shouldCreateVisit) {
206
+ // send information to backend to kick off background jobs
207
+ // so verify/sign on the next step could go by more quickly
208
+ // this is async work, but DO NOT AWAIT
209
+ createVisit({
210
+ authMode,
211
+ chain: walletChain || '',
212
+ environmentId,
213
+ publicWalletAddress: walletAddress,
214
+ walletName: walletConnector.key,
215
+ walletProvider: getWalletProvider(walletConnector),
216
+ });
217
+ }
202
218
  // On connect and sign, we don't want to add this wallet to userWallets
203
219
  // until it has been signed. Therefore, we don't add it to
204
220
  // the connectedWallets array because userWallets draws from it.
@@ -212,8 +228,6 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
212
228
  setPrimaryWalletId(walletId);
213
229
  }
214
230
  addedWalletsIds.current.push(walletId);
215
- const walletChain = walletConnector.connectedChain;
216
- const isWalletStored = connectedWalletsInfo.some(({ walletConnectorKey: storedWalletConnectorKey }) => storedWalletConnectorKey === walletConnector.key);
217
231
  if (isWalletStored) {
218
232
  yield updateConnectedWalletsList();
219
233
  }
@@ -225,19 +239,6 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
225
239
  walletConnectorKey: walletConnector.key,
226
240
  walletId,
227
241
  });
228
- if (!shouldSkipCreatingVisit) {
229
- // send information to backend to kick off background jobs
230
- // so verify/sign on the next step could go by more quickly
231
- // this is async work, but DO NOT AWAIT
232
- createVisit({
233
- authMode,
234
- chain: walletChain || '',
235
- environmentId,
236
- publicWalletAddress: walletAddress,
237
- walletName: walletConnector.key,
238
- walletProvider: getWalletProvider(walletConnector),
239
- });
240
- }
241
242
  }
242
243
  return { address: walletAddress, id: walletId };
243
244
  });
@@ -58,7 +58,7 @@ require('../../context/WalletGroupContext/WalletGroupContext.cjs');
58
58
  require('../../context/MfaSettingsContext/MfaSettingsContext.cjs');
59
59
  require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
60
60
  require('react-focus-lock');
61
- require('../../context/ThemeContext/ThemeContext.cjs');
61
+ var ThemeContext = require('../../context/ThemeContext/ThemeContext.cjs');
62
62
  require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
63
63
  require('../../components/IconButton/IconButton.cjs');
64
64
  require('../../components/MenuList/Dropdown/Dropdown.cjs');
@@ -80,9 +80,10 @@ require('@hcaptcha/react-hcaptcha');
80
80
  require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
81
81
 
82
82
  const FarcasterConnectView = ({ url }) => {
83
+ const { theme: { theme }, } = ThemeContext.useThemeContext();
83
84
  const iconThemeVariant = useIconThemeVariant.useIconThemeVariant();
84
85
  const icon = jsxRuntime.jsx(iconic.SocialIcon, { name: 'farcaster', variant: iconThemeVariant });
85
- return (jsxRuntime.jsx(QrCodeWrapper.QrCodeWrapper, { uri: url, accentColor: '#7b65c0', icon: icon, showCopyToClipboardButton: true }));
86
+ return (jsxRuntime.jsx(QrCodeWrapper.QrCodeWrapper, { uri: url, accentColor: iconThemeVariant === 'dark' ? theme.colors.textPrimary : '#7b65c0', icon: icon, showCopyToClipboardButton: true }));
86
87
  };
87
88
 
88
89
  exports.FarcasterConnectView = FarcasterConnectView;
@@ -54,7 +54,7 @@ import '../../context/WalletGroupContext/WalletGroupContext.js';
54
54
  import '../../context/MfaSettingsContext/MfaSettingsContext.js';
55
55
  import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
56
56
  import 'react-focus-lock';
57
- import '../../context/ThemeContext/ThemeContext.js';
57
+ import { useThemeContext } from '../../context/ThemeContext/ThemeContext.js';
58
58
  import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
59
59
  import '../../components/IconButton/IconButton.js';
60
60
  import '../../components/MenuList/Dropdown/Dropdown.js';
@@ -76,9 +76,10 @@ import '@hcaptcha/react-hcaptcha';
76
76
  import '../../context/IpConfigurationContext/IpConfigurationContext.js';
77
77
 
78
78
  const FarcasterConnectView = ({ url }) => {
79
+ const { theme: { theme }, } = useThemeContext();
79
80
  const iconThemeVariant = useIconThemeVariant();
80
81
  const icon = jsx(SocialIcon, { name: 'farcaster', variant: iconThemeVariant });
81
- return (jsx(QrCodeWrapper, { uri: url, accentColor: '#7b65c0', icon: icon, showCopyToClipboardButton: true }));
82
+ return (jsx(QrCodeWrapper, { uri: url, accentColor: iconThemeVariant === 'dark' ? theme.colors.textPrimary : '#7b65c0', icon: icon, showCopyToClipboardButton: true }));
82
83
  };
83
84
 
84
85
  export { FarcasterConnectView };
@@ -103,7 +103,7 @@ const PendingConnectionContent = () => {
103
103
  return (jsxRuntime.jsx(DefaultPromptModal.DefaultPromptLayout, { dataTestId: 'pending-connection-modal', icon: jsxRuntime.jsx(AuthProviderIcon.AuthProviderIcon // eslint-disable-line
104
104
  , { wallet: selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet }), title: title, children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', children: description }) }));
105
105
  };
106
- const PendingConnectionModal = () => (jsxRuntime.jsx(PromptModal.PromptModal, { onClose: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt, children: jsxRuntime.jsx(PendingConnectionContent, {}) }));
106
+ const PendingConnectionModal = () => (jsxRuntime.jsx(PromptModal.PromptModal, { onClose: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt(), children: jsxRuntime.jsx(PendingConnectionContent, {}) }));
107
107
  const PendingConnectionWidgetPortal = () => (jsxRuntime.jsx(WidgetPortal.WidgetPortal, { onClose: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt(), children: jsxRuntime.jsx(PendingConnectionContent, {}) }));
108
108
 
109
109
  exports.PendingConnectionModal = PendingConnectionModal;
@@ -99,7 +99,7 @@ const PendingConnectionContent = () => {
99
99
  return (jsx(DefaultPromptLayout, { dataTestId: 'pending-connection-modal', icon: jsx(AuthProviderIcon // eslint-disable-line
100
100
  , { wallet: selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet }), title: title, children: jsx(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', children: description }) }));
101
101
  };
102
- const PendingConnectionModal = () => (jsx(PromptModal, { onClose: useCloseMultiWalletPrompt, children: jsx(PendingConnectionContent, {}) }));
102
+ const PendingConnectionModal = () => (jsx(PromptModal, { onClose: useCloseMultiWalletPrompt(), children: jsx(PendingConnectionContent, {}) }));
103
103
  const PendingConnectionWidgetPortal = () => (jsx(WidgetPortal, { onClose: useCloseMultiWalletPrompt(), children: jsx(PendingConnectionContent, {}) }));
104
104
 
105
105
  export { PendingConnectionModal, PendingConnectionWidgetPortal };