@dynamic-labs/sdk-react-core 0.18.0-RC.18 → 0.18.0-RC.19

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.
Files changed (25) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +8 -8
  5. package/src/lib/context/DynamicContext/DynamicContext.cjs +10 -8
  6. package/src/lib/context/DynamicContext/DynamicContext.js +11 -9
  7. package/src/lib/context/DynamicContext/helpers.cjs +2 -2
  8. package/src/lib/context/DynamicContext/helpers.d.ts +2 -2
  9. package/src/lib/context/DynamicContext/helpers.js +2 -2
  10. package/src/lib/context/DynamicContext/types/index.d.ts +2 -2
  11. package/src/lib/context/DynamicContext/useDynamicContext.cjs +2 -2
  12. package/src/lib/context/DynamicContext/useDynamicContext.d.ts +1 -1
  13. package/src/lib/context/DynamicContext/useDynamicContext.js +2 -2
  14. package/src/lib/utils/constants/localStorage.cjs +3 -1
  15. package/src/lib/utils/constants/localStorage.d.ts +1 -0
  16. package/src/lib/utils/constants/localStorage.js +3 -2
  17. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -2
  18. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -2
  19. package/src/lib/utils/hooks/useHandleWalletsToConnect/useHandleWalletsToConnect.cjs +4 -4
  20. package/src/lib/utils/hooks/useHandleWalletsToConnect/useHandleWalletsToConnect.js +4 -4
  21. package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs +5 -5
  22. package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.d.ts +8 -8
  23. package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js +5 -5
  24. package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +7 -6
  25. package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +7 -6
package/CHANGELOG.md CHANGED
@@ -1,4 +1,24 @@
1
1
 
2
+ ## [0.18.0-RC.19](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.18...v0.18.0-RC.19) (2023-07-25)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * it updates the variable name isUserConnected to isFullyConnected
8
+ to better reflect its purpose in the codebase. user should be reserved for fully authenticated entities
9
+
10
+ ### Features
11
+
12
+ * Update WalletConnect wallet registry ([#2744](https://github.com/dynamic-labs/DynamicAuth/issues/2744)) ([46285ad](https://github.com/dynamic-labs/DynamicAuth/commit/46285adc77d12cdfe43d0ce1296308f4905fbfb5))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * missing field handling on email verification ([#2740](https://github.com/dynamic-labs/DynamicAuth/issues/2740)) ([3a42804](https://github.com/dynamic-labs/DynamicAuth/commit/3a428049a1f56a263135d636a335e597b3195b51))
18
+
19
+
20
+ * rename isUserConnected to isFullyConnected ([#2739](https://github.com/dynamic-labs/DynamicAuth/issues/2739)) ([951780b](https://github.com/dynamic-labs/DynamicAuth/commit/951780be79acdc5191ffb8a6a525a2701832a2ad))
21
+
2
22
  ## [0.18.0-RC.18](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.17...v0.18.0-RC.18) (2023-07-24)
3
23
 
4
24
  ### Bug Fixes
package/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "0.18.0-RC.18";
5
+ var version = "0.18.0-RC.19";
6
6
  var dependencies = {
7
7
  "react-focus-lock": "2.9.2",
8
8
  "@dynamic-labs/iconic": "0.1.23",
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "0.18.0-RC.18";
1
+ var version = "0.18.0-RC.19";
2
2
  var dependencies = {
3
3
  "react-focus-lock": "2.9.2",
4
4
  "@dynamic-labs/iconic": "0.1.23",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "0.18.0-RC.18",
3
+ "version": "0.18.0-RC.19",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -16,13 +16,13 @@
16
16
  "formik": "2.2.9",
17
17
  "qrcode": "1.5.1",
18
18
  "ethers": "5.7.2",
19
- "@dynamic-labs/logger": "0.18.0-RC.18",
20
- "@dynamic-labs/multi-wallet": "0.18.0-RC.18",
21
- "@dynamic-labs/rpc-providers": "0.18.0-RC.18",
22
- "@dynamic-labs/types": "0.18.0-RC.18",
23
- "@dynamic-labs/utils": "0.18.0-RC.18",
24
- "@dynamic-labs/wallet-book": "0.18.0-RC.18",
25
- "@dynamic-labs/wallet-connector-core": "0.18.0-RC.18"
19
+ "@dynamic-labs/logger": "0.18.0-RC.19",
20
+ "@dynamic-labs/multi-wallet": "0.18.0-RC.19",
21
+ "@dynamic-labs/rpc-providers": "0.18.0-RC.19",
22
+ "@dynamic-labs/types": "0.18.0-RC.19",
23
+ "@dynamic-labs/utils": "0.18.0-RC.19",
24
+ "@dynamic-labs/wallet-book": "0.18.0-RC.19",
25
+ "@dynamic-labs/wallet-connector-core": "0.18.0-RC.19"
26
26
  },
27
27
  "devDependencies": {
28
28
  "semver": "7.3.8"
@@ -116,7 +116,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
116
116
  const [bridgeChainToConnect, setBridgeChainToConnect] = React.useState(undefined);
117
117
  const [onboardingOnlyJwt, setOnboardingOnlyJwt] = React.useState(undefined);
118
118
  const [showAuthFlow, setShowAuthFlow] = React.useState(false);
119
- const [isUserConnected, setConnectedUser, removeConnectedUser] = useLocalStorage.useLocalStorage('connected_user', false);
119
+ // state to track the full connectivity status of the individual's wallets.
120
+ // Set to true once the predetermined number of wallets is connected.
121
+ const [isFullyConnected, setIsFullyConnected, removeIsFullyConnected] = useLocalStorage.useLocalStorage(localStorage$1.IS_FULLY_CONNECTED, false);
120
122
  const [walletsToConnectByChain, setWalletsToConnectByChain] = React.useState(walletsByChain);
121
123
  // Allows clients to control widget flow without need to click on AccountControl
122
124
  const [showDynamicUserProfile, setShowDynamicUserProfile] = React.useState(false);
@@ -277,7 +279,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
277
279
  handleRemoveLsNetworks();
278
280
  setOnboardingOnlyJwt(undefined);
279
281
  removeConnectedWalletsInfo();
280
- removeConnectedUser();
282
+ removeIsFullyConnected();
281
283
  clearPrimaryWalletId();
282
284
  removeConnectedNameService();
283
285
  (_k = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onLogout) === null || _k === void 0 ? void 0 : _k.call(eventsCallbacks, user);
@@ -292,7 +294,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
292
294
  removeAuthTokenAndUser,
293
295
  handleRemoveLsNetworks,
294
296
  removeConnectedWalletsInfo,
295
- removeConnectedUser,
297
+ removeIsFullyConnected,
296
298
  clearPrimaryWalletId,
297
299
  removeConnectedNameService,
298
300
  eventsCallbacks,
@@ -438,9 +440,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
438
440
  : handleUnlinkWallet,
439
441
  isAuthenticated,
440
442
  isBridgeFlow,
443
+ isFullyConnected,
441
444
  isProjectSettingsLoading,
442
445
  isSingleWalletAccount,
443
- isUserConnected,
444
446
  linkedWallets,
445
447
  loadingNetwork,
446
448
  loginWithEmail,
@@ -469,8 +471,8 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
469
471
  setAuthorizationViewDisplayOrder,
470
472
  setBridgeChainToConnect,
471
473
  setCallback,
472
- setConnectedUser,
473
474
  setDesktopUri,
475
+ setIsFullyConnected,
474
476
  setIsSingleWalletAccount,
475
477
  setLogInWithEmail,
476
478
  setMultiWallet,
@@ -550,7 +552,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
550
552
  isBridgeFlow,
551
553
  isProjectSettingsLoading,
552
554
  isSingleWalletAccount,
553
- isUserConnected,
555
+ isFullyConnected,
554
556
  primaryWallet,
555
557
  secondaryWallets,
556
558
  ongoingVerifications,
@@ -578,7 +580,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
578
580
  setAuthMode,
579
581
  setAuthorizationViewDisplayOrder,
580
582
  setCallback,
581
- setConnectedUser,
583
+ setIsFullyConnected,
582
584
  setLogInWithEmail,
583
585
  setMultiWallet,
584
586
  setMultiWalletWidgetState,
@@ -657,7 +659,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
657
659
  return (jsxRuntime.jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsxRuntime.jsx(walletBook.WalletBookContextProvider, Object.assign({ walletBook: walletBook$1 }, { children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, Object.assign({ customerTheme: parseTheme.parseTheme(theme, ((_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _h === void 0 ? void 0 : _h.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design }, { children: jsxRuntime.jsx(LoadingContext.LoadingContextProvider, { children: jsxRuntime.jsx(ViewContext.ViewContextProvider, Object.assign({ initialView: helpers.getInitialView({
658
660
  connectedWallets,
659
661
  isBridgeFlow,
660
- isUserConnected,
662
+ isFullyConnected,
661
663
  loginWithEmail,
662
664
  }) }, { children: jsxRuntime.jsx(WalletContext.WalletContextProvider, Object.assign({ canSync: didConnectedStateLoad }, { children: jsxRuntime.jsx(QrCodeContext.QrCodeContextProvider, { children: jsxRuntime.jsx(EmailVerificationContext.EmailVerificationContextProvider, { children: jsxRuntime.jsx(ErrorContext.ErrorContextProvider, { children: jsxRuntime.jsx(DynamicWidgetContext.DynamicWidgetContextProvider, { children: jsxRuntime.jsx(DynamicBridgeWidgetContext.DynamicBridgeWidgetContextProvider, { children: jsxRuntime.jsx(CaptchaContext.CaptchaContextProvider, { children: jsxRuntime.jsx(FundingContext.FundingContextProvider, { children: jsxRuntime.jsx(AccessDeniedContext.AccessDeniedContextProvider, { children: jsxRuntime.jsx(SendBalanceContext.SendBalanceContextProvider, { children: jsxRuntime.jsxs(WalletGroupContext.WalletGroupContextProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(Toolkit.Toolkit, {}), jsxRuntime.jsx(FundingWidget.FundingWidget, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) })) })) }) })) })) })));
663
665
  };
@@ -10,7 +10,7 @@ import { Toolkit } from '../../components/Toolkit/Toolkit.js';
10
10
  import { decodeJwt } from '../../shared/utils/functions/decodeJwt/decodeJwt.js';
11
11
  import { ViewContextProvider } from '../ViewContext/ViewContext.js';
12
12
  import { logger } from '../../shared/logger.js';
13
- import { AUTH_TOKEN, AUTH_USER, AUTH_MODE, WALLET_PICKER_SEARCH_KEY } from '../../utils/constants/localStorage.js';
13
+ import { IS_FULLY_CONNECTED, AUTH_TOKEN, AUTH_USER, AUTH_MODE, WALLET_PICKER_SEARCH_KEY } from '../../utils/constants/localStorage.js';
14
14
  import '../../utils/constants/colors.js';
15
15
  import { DEFAULT_NUMBER_OF_WALLETS_TO_SHOW } from '../../utils/constants/values.js';
16
16
  import { LocalStorage } from '../../shared/utils/classes/storage/localStorage.js';
@@ -112,7 +112,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
112
112
  const [bridgeChainToConnect, setBridgeChainToConnect] = useState(undefined);
113
113
  const [onboardingOnlyJwt, setOnboardingOnlyJwt] = useState(undefined);
114
114
  const [showAuthFlow, setShowAuthFlow] = useState(false);
115
- const [isUserConnected, setConnectedUser, removeConnectedUser] = useLocalStorage('connected_user', false);
115
+ // state to track the full connectivity status of the individual's wallets.
116
+ // Set to true once the predetermined number of wallets is connected.
117
+ const [isFullyConnected, setIsFullyConnected, removeIsFullyConnected] = useLocalStorage(IS_FULLY_CONNECTED, false);
116
118
  const [walletsToConnectByChain, setWalletsToConnectByChain] = useState(walletsByChain);
117
119
  // Allows clients to control widget flow without need to click on AccountControl
118
120
  const [showDynamicUserProfile, setShowDynamicUserProfile] = useState(false);
@@ -273,7 +275,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
273
275
  handleRemoveLsNetworks();
274
276
  setOnboardingOnlyJwt(undefined);
275
277
  removeConnectedWalletsInfo();
276
- removeConnectedUser();
278
+ removeIsFullyConnected();
277
279
  clearPrimaryWalletId();
278
280
  removeConnectedNameService();
279
281
  (_k = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onLogout) === null || _k === void 0 ? void 0 : _k.call(eventsCallbacks, user);
@@ -288,7 +290,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
288
290
  removeAuthTokenAndUser,
289
291
  handleRemoveLsNetworks,
290
292
  removeConnectedWalletsInfo,
291
- removeConnectedUser,
293
+ removeIsFullyConnected,
292
294
  clearPrimaryWalletId,
293
295
  removeConnectedNameService,
294
296
  eventsCallbacks,
@@ -434,9 +436,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
434
436
  : handleUnlinkWallet,
435
437
  isAuthenticated,
436
438
  isBridgeFlow,
439
+ isFullyConnected,
437
440
  isProjectSettingsLoading,
438
441
  isSingleWalletAccount,
439
- isUserConnected,
440
442
  linkedWallets,
441
443
  loadingNetwork,
442
444
  loginWithEmail,
@@ -465,8 +467,8 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
465
467
  setAuthorizationViewDisplayOrder,
466
468
  setBridgeChainToConnect,
467
469
  setCallback,
468
- setConnectedUser,
469
470
  setDesktopUri,
471
+ setIsFullyConnected,
470
472
  setIsSingleWalletAccount,
471
473
  setLogInWithEmail,
472
474
  setMultiWallet,
@@ -546,7 +548,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
546
548
  isBridgeFlow,
547
549
  isProjectSettingsLoading,
548
550
  isSingleWalletAccount,
549
- isUserConnected,
551
+ isFullyConnected,
550
552
  primaryWallet,
551
553
  secondaryWallets,
552
554
  ongoingVerifications,
@@ -574,7 +576,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
574
576
  setAuthMode,
575
577
  setAuthorizationViewDisplayOrder,
576
578
  setCallback,
577
- setConnectedUser,
579
+ setIsFullyConnected,
578
580
  setLogInWithEmail,
579
581
  setMultiWallet,
580
582
  setMultiWalletWidgetState,
@@ -653,7 +655,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
653
655
  return (jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsx(WalletBookContextProvider, Object.assign({ walletBook: walletBook }, { children: jsx(ThemeContextProvider, Object.assign({ customerTheme: parseTheme(theme, ((_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _h === void 0 ? void 0 : _h.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design }, { children: jsx(LoadingContextProvider, { children: jsx(ViewContextProvider, Object.assign({ initialView: getInitialView({
654
656
  connectedWallets,
655
657
  isBridgeFlow,
656
- isUserConnected,
658
+ isFullyConnected,
657
659
  loginWithEmail,
658
660
  }) }, { children: jsx(WalletContextProvider, Object.assign({ canSync: didConnectedStateLoad }, { children: jsx(QrCodeContextProvider, { children: jsx(EmailVerificationContextProvider, { children: jsx(ErrorContextProvider, { children: jsx(DynamicWidgetContextProvider, { children: jsx(DynamicBridgeWidgetContextProvider, { children: jsx(CaptchaContextProvider, { children: jsx(FundingContextProvider, { children: jsx(AccessDeniedContextProvider, { children: jsx(SendBalanceContextProvider, { children: jsxs(WalletGroupContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(Toolkit, {}), jsx(FundingWidget, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) })) })) }) })) })) })));
659
661
  };
@@ -54,11 +54,11 @@ const initExpirationTime = (logout) => {
54
54
  const expiryTimeout = Math.min(expirationTimeInMs, 2147483647);
55
55
  logoutTimer = setTimeout(logout, expiryTimeout);
56
56
  };
57
- const getInitialView = ({ connectedWallets, loginWithEmail, isBridgeFlow, isUserConnected, }) => {
57
+ const getInitialView = ({ connectedWallets, loginWithEmail, isBridgeFlow, isFullyConnected, }) => {
58
58
  if (loginWithEmail) {
59
59
  return 'login-with-email-or-wallet';
60
60
  }
61
- if (isUserConnected) {
61
+ if (isFullyConnected) {
62
62
  return 'wallet-list';
63
63
  }
64
64
  if (isBridgeFlow && !connectedWallets.length) {
@@ -2,9 +2,9 @@ import { Wallet } from '../../shared';
2
2
  import { ViewType } from '../ViewContext';
3
3
  export declare const isAuthTokenExpired: (token: string) => boolean;
4
4
  export declare const initExpirationTime: (logout: VoidFunction) => void;
5
- export declare const getInitialView: ({ connectedWallets, loginWithEmail, isBridgeFlow, isUserConnected, }: {
5
+ export declare const getInitialView: ({ connectedWallets, loginWithEmail, isBridgeFlow, isFullyConnected, }: {
6
6
  connectedWallets: Wallet[];
7
7
  loginWithEmail: boolean;
8
8
  isBridgeFlow: boolean;
9
- isUserConnected: boolean;
9
+ isFullyConnected: boolean;
10
10
  }) => ViewType;
@@ -50,11 +50,11 @@ const initExpirationTime = (logout) => {
50
50
  const expiryTimeout = Math.min(expirationTimeInMs, 2147483647);
51
51
  logoutTimer = setTimeout(logout, expiryTimeout);
52
52
  };
53
- const getInitialView = ({ connectedWallets, loginWithEmail, isBridgeFlow, isUserConnected, }) => {
53
+ const getInitialView = ({ connectedWallets, loginWithEmail, isBridgeFlow, isFullyConnected, }) => {
54
54
  if (loginWithEmail) {
55
55
  return 'login-with-email-or-wallet';
56
56
  }
57
- if (isUserConnected) {
57
+ if (isFullyConnected) {
58
58
  return 'wallet-list';
59
59
  }
60
60
  if (isBridgeFlow && !connectedWallets.length) {
@@ -43,8 +43,8 @@ export interface IDynamicContext {
43
43
  connectedWallet: Wallet | null;
44
44
  connectedWallets: Wallet[];
45
45
  linkedWallets: Wallet[];
46
- isUserConnected: boolean;
47
- setConnectedUser: (value: boolean | ((val: boolean) => boolean)) => void;
46
+ isFullyConnected: boolean;
47
+ setIsFullyConnected: (value: boolean | ((val: boolean) => boolean)) => void;
48
48
  consumeNonce: () => string | undefined;
49
49
  cssOverrides?: string | JSX.Element;
50
50
  customPrivacyPolicy?: ReactNode;
@@ -11,7 +11,7 @@ const useDynamicContext = () => {
11
11
  if (context === undefined) {
12
12
  throw new Error('useDynamicContext must be used within a DynamicContextProvider');
13
13
  }
14
- const { accountSwitchState, authMode, authToken, awaitingSignatureState, connectedWallets, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, isUserConnected, linkedWallets, loadingNetwork, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, secondaryWallets, setLogInWithEmail, setMultiWalletWidgetState, setNetwork, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, ongoingVerifications, walletConnector, wallets, walletsByChain, walletsToConnectByChain, primaryWallet, } = context;
14
+ const { accountSwitchState, authMode, authToken, awaitingSignatureState, connectedWallets, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, isFullyConnected, linkedWallets, loadingNetwork, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, secondaryWallets, setLogInWithEmail, setMultiWalletWidgetState, setNetwork, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, ongoingVerifications, walletConnector, wallets, walletsByChain, walletsToConnectByChain, primaryWallet, } = context;
15
15
  return {
16
16
  accountSwitchState,
17
17
  authMode,
@@ -22,7 +22,7 @@ const useDynamicContext = () => {
22
22
  handleLogOut,
23
23
  handleUnlinkWallet,
24
24
  isAuthenticated,
25
- isUserConnected,
25
+ isFullyConnected,
26
26
  linkedWallets,
27
27
  loadingNetwork,
28
28
  loginWithEmail,
@@ -1,5 +1,5 @@
1
1
  import { IDynamicContext } from './types';
2
- export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'connectedWallets' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'isAuthenticated' | 'isUserConnected' | 'linkedWallets' | 'loadingNetwork' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'rpcProviders' | 'sdkHasLoaded' | 'secondaryWallets' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setNetwork' | 'setPrimaryWallet' | 'setShowAuthFlow' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'walletConnector' | 'wallets' | 'walletsByChain' | 'walletsToConnectByChain'> & {
2
+ export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'connectedWallets' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'isAuthenticated' | 'isFullyConnected' | 'linkedWallets' | 'loadingNetwork' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'rpcProviders' | 'sdkHasLoaded' | 'secondaryWallets' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setNetwork' | 'setPrimaryWallet' | 'setShowAuthFlow' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'walletConnector' | 'wallets' | 'walletsByChain' | 'walletsToConnectByChain'> & {
3
3
  ongoingVerifications: Pick<IDynamicContext['ongoingVerifications'], 'authVerification' | 'connectAndSignVerification'>;
4
4
  };
5
5
  export declare const useDynamicContext: () => UseDynamicContext;
@@ -7,7 +7,7 @@ const useDynamicContext = () => {
7
7
  if (context === undefined) {
8
8
  throw new Error('useDynamicContext must be used within a DynamicContextProvider');
9
9
  }
10
- const { accountSwitchState, authMode, authToken, awaitingSignatureState, connectedWallets, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, isUserConnected, linkedWallets, loadingNetwork, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, secondaryWallets, setLogInWithEmail, setMultiWalletWidgetState, setNetwork, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, ongoingVerifications, walletConnector, wallets, walletsByChain, walletsToConnectByChain, primaryWallet, } = context;
10
+ const { accountSwitchState, authMode, authToken, awaitingSignatureState, connectedWallets, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, isFullyConnected, linkedWallets, loadingNetwork, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, secondaryWallets, setLogInWithEmail, setMultiWalletWidgetState, setNetwork, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, ongoingVerifications, walletConnector, wallets, walletsByChain, walletsToConnectByChain, primaryWallet, } = context;
11
11
  return {
12
12
  accountSwitchState,
13
13
  authMode,
@@ -18,7 +18,7 @@ const useDynamicContext = () => {
18
18
  handleLogOut,
19
19
  handleUnlinkWallet,
20
20
  isAuthenticated,
21
- isUserConnected,
21
+ isFullyConnected,
22
22
  linkedWallets,
23
23
  loadingNetwork,
24
24
  loginWithEmail,
@@ -13,13 +13,15 @@ const WALLET_PICKER_SEARCH_KEY = 'dynamic_wallet_picker_search';
13
13
  const NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY = 'dynamic_newtoweb3_wallet_extension_installed';
14
14
  const CONNECTED_WALLETS_INFO = 'dynamic_connected_wallets';
15
15
  const AUTH_MODE = 'dynamic_auth_mode';
16
- const CONNECTED_WALLET_NAME_SERVICE = 'dynamic_connected_wallet_ns';
16
+ const CONNECTED_WALLET_NAME_SERVICE = 'dynamic_connected_wallet_ns';
17
+ const IS_FULLY_CONNECTED = 'dynamic_fully_connected';
17
18
 
18
19
  exports.AUTH_MODE = AUTH_MODE;
19
20
  exports.AUTH_TOKEN = AUTH_TOKEN;
20
21
  exports.AUTH_USER = AUTH_USER;
21
22
  exports.CONNECTED_WALLETS_INFO = CONNECTED_WALLETS_INFO;
22
23
  exports.CONNECTED_WALLET_NAME_SERVICE = CONNECTED_WALLET_NAME_SERVICE;
24
+ exports.IS_FULLY_CONNECTED = IS_FULLY_CONNECTED;
23
25
  exports.LAST_USED_WALLET = LAST_USED_WALLET;
24
26
  exports.NETWORKS_STORAGE_KEY = NETWORKS_STORAGE_KEY;
25
27
  exports.NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY = NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY;
@@ -11,3 +11,4 @@ export declare const NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY = "dynamic_newtoweb3_wa
11
11
  export declare const CONNECTED_WALLETS_INFO = "dynamic_connected_wallets";
12
12
  export declare const AUTH_MODE = "dynamic_auth_mode";
13
13
  export declare const CONNECTED_WALLET_NAME_SERVICE = "dynamic_connected_wallet_ns";
14
+ export declare const IS_FULLY_CONNECTED = "dynamic_fully_connected";
@@ -9,6 +9,7 @@ const WALLET_PICKER_SEARCH_KEY = 'dynamic_wallet_picker_search';
9
9
  const NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY = 'dynamic_newtoweb3_wallet_extension_installed';
10
10
  const CONNECTED_WALLETS_INFO = 'dynamic_connected_wallets';
11
11
  const AUTH_MODE = 'dynamic_auth_mode';
12
- const CONNECTED_WALLET_NAME_SERVICE = 'dynamic_connected_wallet_ns';
12
+ const CONNECTED_WALLET_NAME_SERVICE = 'dynamic_connected_wallet_ns';
13
+ const IS_FULLY_CONNECTED = 'dynamic_fully_connected';
13
14
 
14
- export { AUTH_MODE, AUTH_TOKEN, AUTH_USER, CONNECTED_WALLETS_INFO, CONNECTED_WALLET_NAME_SERVICE, LAST_USED_WALLET, NETWORKS_STORAGE_KEY, NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY, NONCE_STORAGE_KEY, PRIMARY_WALLET_ID, PROJECT_SETTINGS_STORAGE_KEY, WALLET_PICKER_SEARCH_KEY };
15
+ export { AUTH_MODE, AUTH_TOKEN, AUTH_USER, CONNECTED_WALLETS_INFO, CONNECTED_WALLET_NAME_SERVICE, IS_FULLY_CONNECTED, LAST_USED_WALLET, NETWORKS_STORAGE_KEY, NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY, NONCE_STORAGE_KEY, PRIMARY_WALLET_ID, PROJECT_SETTINGS_STORAGE_KEY, WALLET_PICKER_SEARCH_KEY };
@@ -32,7 +32,7 @@ const useConnectAndSign = () => {
32
32
  const { setView, goToInitialView } = ViewContext.useViewContext();
33
33
  const { setErrorMessage } = ErrorContext.useErrorContext();
34
34
  const { captchaToken } = CaptchaContext.useCaptchaContext();
35
- const { authMode, connectWallet, consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, user, walletUiUtils, setCallback, ongoingVerifications, isUserConnected, } = useInternalDynamicContext.useInternalDynamicContext();
35
+ const { authMode, connectWallet, consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, user, walletUiUtils, setCallback, ongoingVerifications, isFullyConnected, } = useInternalDynamicContext.useInternalDynamicContext();
36
36
  const { handleWalletsToConnect } = useHandleWalletsToConnect.useHandleWalletsToConnect();
37
37
  const verifyWallet = useVerifyWallet.useVerifyWallet({
38
38
  consumeNonce,
@@ -70,7 +70,7 @@ const useConnectAndSign = () => {
70
70
  if (isConnectOnly.isConnectOnly(user, authMode)) {
71
71
  localStorage.LocalStorage.setToLS(localStorage$1.LAST_USED_WALLET, walletConnector.name);
72
72
  handleWalletsToConnect();
73
- if (!isUserConnected) {
73
+ if (!isFullyConnected) {
74
74
  setCallback('connectSuccess');
75
75
  }
76
76
  return;
@@ -28,7 +28,7 @@ const useConnectAndSign = () => {
28
28
  const { setView, goToInitialView } = useViewContext();
29
29
  const { setErrorMessage } = useErrorContext();
30
30
  const { captchaToken } = useCaptchaContext();
31
- const { authMode, connectWallet, consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, user, walletUiUtils, setCallback, ongoingVerifications, isUserConnected, } = useInternalDynamicContext();
31
+ const { authMode, connectWallet, consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, user, walletUiUtils, setCallback, ongoingVerifications, isFullyConnected, } = useInternalDynamicContext();
32
32
  const { handleWalletsToConnect } = useHandleWalletsToConnect();
33
33
  const verifyWallet = useVerifyWallet({
34
34
  consumeNonce,
@@ -66,7 +66,7 @@ const useConnectAndSign = () => {
66
66
  if (isConnectOnly(user, authMode)) {
67
67
  LocalStorage.setToLS(LAST_USED_WALLET, walletConnector.name);
68
68
  handleWalletsToConnect();
69
- if (!isUserConnected) {
69
+ if (!isFullyConnected) {
70
70
  setCallback('connectSuccess');
71
71
  }
72
72
  return;
@@ -6,11 +6,11 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useInte
6
6
  var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
7
7
 
8
8
  const useHandleWalletsToConnect = () => {
9
- const { walletsToConnectByChain, setWalletsToConnectByChain, setShowAuthFlow, setConnectedUser, isUserConnected, } = useInternalDynamicContext.useInternalDynamicContext();
9
+ const { walletsToConnectByChain, setWalletsToConnectByChain, setShowAuthFlow, setIsFullyConnected, isFullyConnected, } = useInternalDynamicContext.useInternalDynamicContext();
10
10
  const { setView, goToInitialView } = ViewContext.useViewContext();
11
11
  const handleWalletsToConnect = () => {
12
12
  if (!walletsToConnectByChain) {
13
- setConnectedUser(true);
13
+ setIsFullyConnected(true);
14
14
  setShowAuthFlow(false);
15
15
  return;
16
16
  }
@@ -32,8 +32,8 @@ const useHandleWalletsToConnect = () => {
32
32
  setWalletsToConnectByChain(restOfTheWallets);
33
33
  const allWalletsConnected = restOfTheWallets.length === 0;
34
34
  if (allWalletsConnected) {
35
- if (!isUserConnected) {
36
- setConnectedUser(true);
35
+ if (!isFullyConnected) {
36
+ setIsFullyConnected(true);
37
37
  setView('bridge-summary');
38
38
  }
39
39
  else {
@@ -2,11 +2,11 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useIn
2
2
  import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
3
3
 
4
4
  const useHandleWalletsToConnect = () => {
5
- const { walletsToConnectByChain, setWalletsToConnectByChain, setShowAuthFlow, setConnectedUser, isUserConnected, } = useInternalDynamicContext();
5
+ const { walletsToConnectByChain, setWalletsToConnectByChain, setShowAuthFlow, setIsFullyConnected, isFullyConnected, } = useInternalDynamicContext();
6
6
  const { setView, goToInitialView } = useViewContext();
7
7
  const handleWalletsToConnect = () => {
8
8
  if (!walletsToConnectByChain) {
9
- setConnectedUser(true);
9
+ setIsFullyConnected(true);
10
10
  setShowAuthFlow(false);
11
11
  return;
12
12
  }
@@ -28,8 +28,8 @@ const useHandleWalletsToConnect = () => {
28
28
  setWalletsToConnectByChain(restOfTheWallets);
29
29
  const allWalletsConnected = restOfTheWallets.length === 0;
30
30
  if (allWalletsConnected) {
31
- if (!isUserConnected) {
32
- setConnectedUser(true);
31
+ if (!isFullyConnected) {
32
+ setIsFullyConnected(true);
33
33
  setView('bridge-summary');
34
34
  }
35
35
  else {
@@ -52,15 +52,15 @@ const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
52
52
  const updateUserProfileResponse = yield api.updateUserProfileFields(jwtToken, userEnvironmentId || environmentId, validatedUserFields);
53
53
  // check if decoded JWT still somehow has missing fields, we can't proceed if it does
54
54
  const decodedJwt = decodeJwt.decodeJwt(updateUserProfileResponse.jwt);
55
- const userProfileHasMissingFields = ((_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : []).length > 0;
55
+ const missingFields = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : [];
56
56
  const _isEmailVerificationRequired = isEmailVerificationRequired.isEmailVerificationRequired(updateUserProfileResponse);
57
57
  if (!_isEmailVerificationRequired) {
58
58
  // If email verification is not needed then we can update the user profile immediately.
59
59
  yield updateUserProfileByJWT(updateUserProfileResponse.jwt);
60
60
  return {
61
- isEmailVerificationRequired: _isEmailVerificationRequired,
61
+ isEmailVerificationRequired: false,
62
+ missingFields,
62
63
  updateUserProfileResponse,
63
- userProfileHasMissingFields,
64
64
  };
65
65
  }
66
66
  // We update EmailContext to use this information in the Email Verification view
@@ -74,9 +74,9 @@ const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
74
74
  return verifyEmailFn(verificationToken, (_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.verificationUUID);
75
75
  };
76
76
  return {
77
- isEmailVerificationRequired: _isEmailVerificationRequired,
77
+ isEmailVerificationRequired: true,
78
+ missingFields,
78
79
  updateUserProfileResponse,
79
- userProfileHasMissingFields,
80
80
  verifyEmailFn: scopedVerifyEmailFn,
81
81
  };
82
82
  }), [
@@ -4,27 +4,27 @@ export declare const useUserUpdateRequestInternal: ({ validationSchemaStripUnkno
4
4
  validationSchemaStripUnknown: boolean;
5
5
  }) => {
6
6
  updateUser: (userFields: UpdateUserFieldsArg, userEnvironmentId?: string) => Promise<{
7
- isEmailVerificationRequired: false;
7
+ isEmailVerificationRequired: boolean;
8
+ missingFields: import("@dynamic-labs/sdk-api").ProjectSettingsKyc[];
8
9
  updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
9
- userProfileHasMissingFields: boolean;
10
10
  verifyEmailFn?: undefined;
11
11
  } | {
12
- isEmailVerificationRequired: true;
12
+ isEmailVerificationRequired: boolean;
13
+ missingFields: import("@dynamic-labs/sdk-api").ProjectSettingsKyc[];
13
14
  updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
14
- userProfileHasMissingFields: boolean;
15
15
  verifyEmailFn: (verificationToken: string) => Promise<import("@dynamic-labs/sdk-api").UpdateSelfResponse>;
16
16
  }>;
17
17
  };
18
18
  export declare const useUserUpdateRequest: () => {
19
19
  updateUser: (userFields: UpdateUserFieldsArg, userEnvironmentId?: string) => Promise<{
20
- isEmailVerificationRequired: false;
20
+ isEmailVerificationRequired: boolean;
21
+ missingFields: import("@dynamic-labs/sdk-api").ProjectSettingsKyc[];
21
22
  updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
22
- userProfileHasMissingFields: boolean;
23
23
  verifyEmailFn?: undefined;
24
24
  } | {
25
- isEmailVerificationRequired: true;
25
+ isEmailVerificationRequired: boolean;
26
+ missingFields: import("@dynamic-labs/sdk-api").ProjectSettingsKyc[];
26
27
  updateUserProfileResponse: import("@dynamic-labs/sdk-api").UpdateSelfResponse;
27
- userProfileHasMissingFields: boolean;
28
28
  verifyEmailFn: (verificationToken: string) => Promise<import("@dynamic-labs/sdk-api").UpdateSelfResponse>;
29
29
  }>;
30
30
  };
@@ -48,15 +48,15 @@ const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
48
48
  const updateUserProfileResponse = yield updateUserProfileFields(jwtToken, userEnvironmentId || environmentId, validatedUserFields);
49
49
  // check if decoded JWT still somehow has missing fields, we can't proceed if it does
50
50
  const decodedJwt = decodeJwt(updateUserProfileResponse.jwt);
51
- const userProfileHasMissingFields = ((_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : []).length > 0;
51
+ const missingFields = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : [];
52
52
  const _isEmailVerificationRequired = isEmailVerificationRequired(updateUserProfileResponse);
53
53
  if (!_isEmailVerificationRequired) {
54
54
  // If email verification is not needed then we can update the user profile immediately.
55
55
  yield updateUserProfileByJWT(updateUserProfileResponse.jwt);
56
56
  return {
57
- isEmailVerificationRequired: _isEmailVerificationRequired,
57
+ isEmailVerificationRequired: false,
58
+ missingFields,
58
59
  updateUserProfileResponse,
59
- userProfileHasMissingFields,
60
60
  };
61
61
  }
62
62
  // We update EmailContext to use this information in the Email Verification view
@@ -70,9 +70,9 @@ const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
70
70
  return verifyEmailFn(verificationToken, (_a = updateUserProfileResponse.emailVerification) === null || _a === void 0 ? void 0 : _a.verificationUUID);
71
71
  };
72
72
  return {
73
- isEmailVerificationRequired: _isEmailVerificationRequired,
73
+ isEmailVerificationRequired: true,
74
+ missingFields,
74
75
  updateUserProfileResponse,
75
- userProfileHasMissingFields,
76
76
  verifyEmailFn: scopedVerifyEmailFn,
77
77
  };
78
78
  }), [
@@ -54,17 +54,18 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
54
54
  validationSchemaStripUnknown: false,
55
55
  });
56
56
  const onSubmit = React.useCallback((formValues) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
57
- const { isEmailVerificationRequired, userProfileHasMissingFields } = yield updateUser(formValues);
58
- if (userProfileHasMissingFields) {
57
+ const { isEmailVerificationRequired, missingFields } = yield updateUser(formValues);
58
+ if (isEmailVerificationRequired &&
59
+ missingFields.map((field) => field.name).toString() === 'email') {
60
+ setView('verify-email');
61
+ return;
62
+ }
63
+ else if (missingFields.length > 0) {
59
64
  // make sure we capture the fields that are required and still missing!
60
65
  // do not change the view, just use the current one
61
66
  setView(view);
62
67
  return;
63
68
  }
64
- if (isEmailVerificationRequired) {
65
- setView('verify-email');
66
- return;
67
- }
68
69
  setShowAuthFlow(false);
69
70
  setCallback('authSuccess');
70
71
  }), [setCallback, setShowAuthFlow, setView, updateUser]);
@@ -50,17 +50,18 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
50
50
  validationSchemaStripUnknown: false,
51
51
  });
52
52
  const onSubmit = useCallback((formValues) => __awaiter(void 0, void 0, void 0, function* () {
53
- const { isEmailVerificationRequired, userProfileHasMissingFields } = yield updateUser(formValues);
54
- if (userProfileHasMissingFields) {
53
+ const { isEmailVerificationRequired, missingFields } = yield updateUser(formValues);
54
+ if (isEmailVerificationRequired &&
55
+ missingFields.map((field) => field.name).toString() === 'email') {
56
+ setView('verify-email');
57
+ return;
58
+ }
59
+ else if (missingFields.length > 0) {
55
60
  // make sure we capture the fields that are required and still missing!
56
61
  // do not change the view, just use the current one
57
62
  setView(view);
58
63
  return;
59
64
  }
60
- if (isEmailVerificationRequired) {
61
- setView('verify-email');
62
- return;
63
- }
64
65
  setShowAuthFlow(false);
65
66
  setCallback('authSuccess');
66
67
  }), [setCallback, setShowAuthFlow, setView, updateUser]);