@dynamic-labs/sdk-react-core 1.4.4 → 1.4.6

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,20 @@
1
1
 
2
+ ### [1.4.6](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.5...v1.4.6) (2024-04-09)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * coinbase improvements ([#5268](https://github.com/dynamic-labs/DynamicAuth/issues/5268)) ([#5273](https://github.com/dynamic-labs/DynamicAuth/issues/5273)) ([2d63dee](https://github.com/dynamic-labs/DynamicAuth/commit/2d63dee8679771d353b2ef4667a661c4a039a5c5))
8
+ * show qr code for metamask on desktop when not installed ([#5262](https://github.com/dynamic-labs/DynamicAuth/issues/5262)) ([#5263](https://github.com/dynamic-labs/DynamicAuth/issues/5263)) ([de8fdbe](https://github.com/dynamic-labs/DynamicAuth/commit/de8fdbeddf485d772f2d691d584fc3904dc5b5c9))
9
+
10
+ ### [1.4.5](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.4...v1.4.5) (2024-04-05)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * use in-app browser deeplink for metamask ([#5176](https://github.com/dynamic-labs/DynamicAuth/issues/5176)) ([#5203](https://github.com/dynamic-labs/DynamicAuth/issues/5203)) ([63951d8](https://github.com/dynamic-labs/DynamicAuth/commit/63951d8896ea073e595e4a1e92bfe22731b012f4))
16
+ * clear user wallets immediately on logout ([#5238](https://github.com/dynamic-labs/DynamicAuth/issues/5238)) ([13b55a7](https://github.com/dynamic-labs/DynamicAuth/commit/13b55a7070f6f159504bf05b503848cc2c5ed445)), closes [#5211](https://github.com/dynamic-labs/DynamicAuth/issues/5211)
17
+
2
18
  ### [1.4.4](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.3...v1.4.4) (2024-04-01)
3
19
 
4
20
 
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.4";
5
+ var version = "1.4.6";
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.4";
1
+ var version = "1.4.6";
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.4",
3
+ "version": "1.4.6",
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.4",
20
- "@dynamic-labs/iconic": "1.4.4",
21
- "@dynamic-labs/logger": "1.4.4",
22
- "@dynamic-labs/multi-wallet": "1.4.4",
23
- "@dynamic-labs/rpc-providers": "1.4.4",
24
- "@dynamic-labs/types": "1.4.4",
25
- "@dynamic-labs/utils": "1.4.4",
26
- "@dynamic-labs/viem-utils": "1.4.4",
27
- "@dynamic-labs/wallet-book": "1.4.4",
28
- "@dynamic-labs/wallet-connector-core": "1.4.4",
19
+ "@dynamic-labs/ethereum": "1.4.6",
20
+ "@dynamic-labs/iconic": "1.4.6",
21
+ "@dynamic-labs/logger": "1.4.6",
22
+ "@dynamic-labs/multi-wallet": "1.4.6",
23
+ "@dynamic-labs/rpc-providers": "1.4.6",
24
+ "@dynamic-labs/types": "1.4.6",
25
+ "@dynamic-labs/utils": "1.4.6",
26
+ "@dynamic-labs/viem-utils": "1.4.6",
27
+ "@dynamic-labs/wallet-book": "1.4.6",
28
+ "@dynamic-labs/wallet-connector-core": "1.4.6",
29
29
  "eventemitter3": "5.0.1"
30
30
  },
31
31
  "devDependencies": {
@@ -120,6 +120,7 @@ var useMultiWallet = require('./hooks/useMultiWallet/useMultiWallet.cjs');
120
120
  var useSetShowLinkNewWalletModal = require('./hooks/useSetShowLinkNewWalletModal/useSetShowLinkNewWalletModal.cjs');
121
121
  var useCustomerCallbacks = require('./useCustomerCallbacks/useCustomerCallbacks.cjs');
122
122
  var validators = require('./validators/validators.cjs');
123
+ var useParentDynamicContextGuard = require('./hooks/useParentDynamicContextGuard/useParentDynamicContextGuard.cjs');
123
124
 
124
125
  const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9';
125
126
  const EMPTY_INITIAL_USER = undefined;
@@ -707,7 +708,10 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale: locale
707
708
  }), children: [networkValidationMode === 'always' && jsxRuntime.jsx(UseNetworkValidation.UseNetworkValidation, {}), jsxRuntime.jsx(CaptchaContext.CaptchaContextProvider, { children: jsxRuntime.jsx(AccountExistsContext.AccountExistsContextProvider, { children: jsxRuntime.jsx(WalletContext.WalletContextProvider, { canSync: didConnectedStateLoad, children: jsxRuntime.jsx(PasskeyContext.PasskeyContextProvider, { children: jsxRuntime.jsx(EmailVerificationContext.EmailVerificationContextProvider, { children: jsxRuntime.jsx(DynamicWidgetContext.DynamicWidgetContextProvider, { children: jsxRuntime.jsx(DynamicBridgeWidgetContext.DynamicBridgeWidgetContextProvider, { children: jsxRuntime.jsx(FundingContext.FundingContextProvider, { children: jsxRuntime.jsx(AccessDeniedContext.AccessDeniedContextProvider, { children: jsxRuntime.jsx(SendBalanceContext.SendBalanceContextProvider, { children: jsxRuntime.jsx(WalletGroupContext.WalletGroupContextProvider, { children: jsxRuntime.jsx(UserFieldEditorContext.UserFieldEditorContextProvider, { children: jsxRuntime.jsx(ConnectWithEmailOtpProvider.ConnectWithEmailOtpProvider, { children: jsxRuntime.jsx(PhantomRedirectContext.PhantomRedirectContextProvider, { children: jsxRuntime.jsxs(SocialRedirectContext.SocialRedirectContextProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(Toolkit.Toolkit, {}), jsxRuntime.jsx(FundingWidget.FundingWidget, {}), jsxRuntime.jsx(SyncPasskeyFlow.SyncPasskeyFlow, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) }) }) }));
708
709
  };
709
710
  /** The context provider you need to have access too all of Dynamic's hooks */
710
- const DynamicContextProvider = (props) => (jsxRuntime.jsx(ErrorContext.ErrorContextProvider, { children: jsxRuntime.jsx(UserWalletsContext.UserWalletsProvider, { children: jsxRuntime.jsx(InnerDynamicContextProvider, Object.assign({}, props)) }) }));
711
+ const DynamicContextProvider = (props) => {
712
+ useParentDynamicContextGuard.useParentDynamicContextGuard();
713
+ return (jsxRuntime.jsx(ErrorContext.ErrorContextProvider, { children: jsxRuntime.jsx(UserWalletsContext.UserWalletsProvider, { children: jsxRuntime.jsx(InnerDynamicContextProvider, Object.assign({}, props)) }) }));
714
+ };
711
715
 
712
716
  exports.DynamicContext = DynamicContext;
713
717
  exports.DynamicContextProvider = DynamicContextProvider;
@@ -116,6 +116,7 @@ import { useMultiWallet } from './hooks/useMultiWallet/useMultiWallet.js';
116
116
  import { useSetShowLinkNewWalletModal } from './hooks/useSetShowLinkNewWalletModal/useSetShowLinkNewWalletModal.js';
117
117
  import { useCustomerCallbacks } from './useCustomerCallbacks/useCustomerCallbacks.js';
118
118
  import { validateAuthUser } from './validators/validators.js';
119
+ import { useParentDynamicContextGuard } from './hooks/useParentDynamicContextGuard/useParentDynamicContextGuard.js';
119
120
 
120
121
  const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9';
121
122
  const EMPTY_INITIAL_USER = undefined;
@@ -703,6 +704,9 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
703
704
  }), children: [networkValidationMode === 'always' && jsx(UseNetworkValidation, {}), jsx(CaptchaContextProvider, { children: jsx(AccountExistsContextProvider, { children: jsx(WalletContextProvider, { canSync: didConnectedStateLoad, children: jsx(PasskeyContextProvider, { children: jsx(EmailVerificationContextProvider, { children: jsx(DynamicWidgetContextProvider, { children: jsx(DynamicBridgeWidgetContextProvider, { children: jsx(FundingContextProvider, { children: jsx(AccessDeniedContextProvider, { children: jsx(SendBalanceContextProvider, { children: jsx(WalletGroupContextProvider, { children: jsx(UserFieldEditorContextProvider, { children: jsx(ConnectWithEmailOtpProvider, { children: jsx(PhantomRedirectContextProvider, { children: jsxs(SocialRedirectContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(Toolkit, {}), jsx(FundingWidget, {}), jsx(SyncPasskeyFlow, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) }) }) }));
704
705
  };
705
706
  /** The context provider you need to have access too all of Dynamic's hooks */
706
- const DynamicContextProvider = (props) => (jsx(ErrorContextProvider, { children: jsx(UserWalletsProvider, { children: jsx(InnerDynamicContextProvider, Object.assign({}, props)) }) }));
707
+ const DynamicContextProvider = (props) => {
708
+ useParentDynamicContextGuard();
709
+ return (jsx(ErrorContextProvider, { children: jsx(UserWalletsProvider, { children: jsx(InnerDynamicContextProvider, Object.assign({}, props)) }) }));
710
+ };
707
711
 
708
712
  export { DynamicContext, DynamicContextProvider, InnerDynamicContextProvider, PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID };
@@ -0,0 +1 @@
1
+ export { useParentDynamicContextGuard } from './useParentDynamicContextGuard';
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var DynamicContext = require('../../DynamicContext.cjs');
7
+
8
+ const useParentDynamicContextGuard = () => {
9
+ const context = React.useContext(DynamicContext.DynamicContext);
10
+ if (context) {
11
+ throw new Error('DynamicContextProvider should not be nested. Please wrap your application in a single DynamicContextProvider.');
12
+ }
13
+ };
14
+
15
+ exports.useParentDynamicContextGuard = useParentDynamicContextGuard;
@@ -0,0 +1 @@
1
+ export declare const useParentDynamicContextGuard: () => void;
@@ -0,0 +1,11 @@
1
+ import { useContext } from 'react';
2
+ import { DynamicContext } from '../../DynamicContext.js';
3
+
4
+ const useParentDynamicContextGuard = () => {
5
+ const context = useContext(DynamicContext);
6
+ if (context) {
7
+ throw new Error('DynamicContextProvider should not be nested. Please wrap your application in a single DynamicContextProvider.');
8
+ }
9
+ };
10
+
11
+ export { useParentDynamicContextGuard };
@@ -72,7 +72,10 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, walletConn
72
72
  const { setUserWallets } = UserWalletsContext.useInternalUserWallets();
73
73
  // Keep userWallets in sync whenever linkedWallets changes
74
74
  React.useEffect(() => {
75
- if (!didConnectedStateLoad.current)
75
+ // we don't want to set the user wallets until their connected states have been computed
76
+ // but that doesn't matter if the wallets list is empty, and if we return early when
77
+ // the wallets list is empty, we'll never set the user wallets correctly after logout
78
+ if (!didConnectedStateLoad.current && wallets.length)
76
79
  return;
77
80
  setUserWallets((userWallets) => updateUserWalletsFromLinkedWallets.updateUserWalletsFromLinkedWallets(userWallets, wallets));
78
81
  }, [didConnectedStateLoad, setUserWallets, wallets]);
@@ -68,7 +68,10 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, walletConn
68
68
  const { setUserWallets } = useInternalUserWallets();
69
69
  // Keep userWallets in sync whenever linkedWallets changes
70
70
  useEffect(() => {
71
- if (!didConnectedStateLoad.current)
71
+ // we don't want to set the user wallets until their connected states have been computed
72
+ // but that doesn't matter if the wallets list is empty, and if we return early when
73
+ // the wallets list is empty, we'll never set the user wallets correctly after logout
74
+ if (!didConnectedStateLoad.current && wallets.length)
72
75
  return;
73
76
  setUserWallets((userWallets) => updateUserWalletsFromLinkedWallets(userWallets, wallets));
74
77
  }, [didConnectedStateLoad, setUserWallets, wallets]);