@dynamic-labs/sdk-react-core 1.1.0-alpha.20 → 1.1.0-alpha.21

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 (24) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +10 -10
  5. package/src/lib/context/DynamicContext/DynamicContext.cjs +2 -1
  6. package/src/lib/context/DynamicContext/DynamicContext.js +2 -1
  7. package/src/lib/context/PhantomRedirectContext/PhantomRedirectContext.cjs +40 -0
  8. package/src/lib/context/PhantomRedirectContext/PhantomRedirectContext.d.ts +10 -0
  9. package/src/lib/context/PhantomRedirectContext/PhantomRedirectContext.js +35 -0
  10. package/src/lib/context/PhantomRedirectContext/index.d.ts +1 -0
  11. package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +124 -0
  12. package/src/lib/context/PhantomRedirectContext/useResponseHandlers.d.ts +5 -0
  13. package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +120 -0
  14. package/src/lib/shared/types/index.d.ts +2 -0
  15. package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.cjs +18 -1
  16. package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.d.ts +10 -6
  17. package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.js +18 -1
  18. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +9 -3
  19. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.d.ts +1 -1
  20. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +9 -3
  21. package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +4 -4
  22. package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +4 -4
  23. package/src/lib/utils/functions/isPasskeyEnabled/isPasskeyEnabled.cjs +0 -22
  24. package/src/lib/utils/functions/isPasskeyEnabled/isPasskeyEnabled.js +0 -18
package/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
1
 
2
+ ## [1.1.0-alpha.21](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.20...v1.1.0-alpha.21) (2024-02-01)
3
+
4
+
5
+ ### Features
6
+
7
+ * add phantom redirect handling context ([#4479](https://github.com/dynamic-labs/DynamicAuth/issues/4479)) ([e0218ee](https://github.com/dynamic-labs/DynamicAuth/commit/e0218eec1a67787f5c0e7483d542a5f773e911ef))
8
+ * add signPsbt method to bitcoin wallet connectors ([dfdc0fe](https://github.com/dynamic-labs/DynamicAuth/commit/dfdc0fe0e6894c1307b286e89b43a4c58a8808f3))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * relax passkey feature detection check in sdk to avoid false nega… ([#4556](https://github.com/dynamic-labs/DynamicAuth/issues/4556)) ([4554f7d](https://github.com/dynamic-labs/DynamicAuth/commit/4554f7d7c5339859481cdecca95a9c07fae4ba5c))
14
+ * workaround braavos undefined selectedWallet on chainChange event ([#4552](https://github.com/dynamic-labs/DynamicAuth/issues/4552)) ([aa35df0](https://github.com/dynamic-labs/DynamicAuth/commit/aa35df0e894feafa0606aa1c87bd3d3879ebc594))
15
+
2
16
  ## [1.1.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.19...v1.1.0-alpha.20) (2024-01-31)
3
17
 
4
18
 
package/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "1.1.0-alpha.20";
5
+ var version = "1.1.0-alpha.21";
6
6
  var dependencies = {
7
7
  "@dynamic-labs/iconic": "0.1.50",
8
8
  "@dynamic-labs/sdk-api": "0.0.356",
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "1.1.0-alpha.20";
1
+ var version = "1.1.0-alpha.21";
2
2
  var dependencies = {
3
3
  "@dynamic-labs/iconic": "0.1.50",
4
4
  "@dynamic-labs/sdk-api": "0.0.356",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "1.1.0-alpha.20",
3
+ "version": "1.1.0-alpha.21",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -17,15 +17,15 @@
17
17
  "react-focus-lock": "2.9.2",
18
18
  "react-i18next": "^13.2.0",
19
19
  "yup": "0.32.11",
20
- "@dynamic-labs/ethereum": "1.1.0-alpha.20",
21
- "@dynamic-labs/logger": "1.1.0-alpha.20",
22
- "@dynamic-labs/multi-wallet": "1.1.0-alpha.20",
23
- "@dynamic-labs/rpc-providers": "1.1.0-alpha.20",
24
- "@dynamic-labs/types": "1.1.0-alpha.20",
25
- "@dynamic-labs/utils": "1.1.0-alpha.20",
26
- "@dynamic-labs/viem-utils": "1.1.0-alpha.20",
27
- "@dynamic-labs/wallet-book": "1.1.0-alpha.20",
28
- "@dynamic-labs/wallet-connector-core": "1.1.0-alpha.20",
20
+ "@dynamic-labs/ethereum": "1.1.0-alpha.21",
21
+ "@dynamic-labs/logger": "1.1.0-alpha.21",
22
+ "@dynamic-labs/multi-wallet": "1.1.0-alpha.21",
23
+ "@dynamic-labs/rpc-providers": "1.1.0-alpha.21",
24
+ "@dynamic-labs/types": "1.1.0-alpha.21",
25
+ "@dynamic-labs/utils": "1.1.0-alpha.21",
26
+ "@dynamic-labs/viem-utils": "1.1.0-alpha.21",
27
+ "@dynamic-labs/wallet-book": "1.1.0-alpha.21",
28
+ "@dynamic-labs/wallet-connector-core": "1.1.0-alpha.21",
29
29
  "eventemitter3": "5.0.1"
30
30
  },
31
31
  "devDependencies": {
@@ -102,6 +102,7 @@ var SendBalanceContext = require('../SendBalanceContext/SendBalanceContext.cjs')
102
102
  var UseNetworkValidation = require('../UseNetworkValidation/UseNetworkValidation.cjs');
103
103
  var UserWalletsContext = require('../UserWalletsContext/UserWalletsContext.cjs');
104
104
  var WalletContext = require('../WalletContext/WalletContext.cjs');
105
+ var PhantomRedirectContext = require('../PhantomRedirectContext/PhantomRedirectContext.cjs');
105
106
  var handleDisconnectWallet = require('./handleDisconnectWallet/handleDisconnectWallet.cjs');
106
107
  var helpers = require('./helpers/helpers.cjs');
107
108
  var useDisplayOrderState = require('./hooks/useDisplayOrderState/useDisplayOrderState.cjs');
@@ -695,7 +696,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale: locale
695
696
  isBridgeFlow,
696
697
  isFullyConnected,
697
698
  isMultiWalletEnabled: multiWallet,
698
- }), children: [enableForcedNetworkValidation && 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.jsxs(ConnectWithEmailOtpProvider.ConnectWithEmailOtpProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(Toolkit.Toolkit, {}), jsxRuntime.jsx(FundingWidget.FundingWidget, {}), jsxRuntime.jsx(SyncPasskeyFlow.SyncPasskeyFlow, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) }) }) }));
699
+ }), children: [enableForcedNetworkValidation && 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.jsxs(PhantomRedirectContext.PhantomRedirectContextProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(Toolkit.Toolkit, {}), jsxRuntime.jsx(FundingWidget.FundingWidget, {}), jsxRuntime.jsx(SyncPasskeyFlow.SyncPasskeyFlow, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) }) }) }));
699
700
  };
700
701
  /** The context provider you need to have access too all of Dynamic's hooks */
701
702
  const DynamicContextProvider = (props) => (jsxRuntime.jsx(ErrorContext.ErrorContextProvider, { children: jsxRuntime.jsx(UserWalletsContext.UserWalletsProvider, { children: jsxRuntime.jsx(InnerDynamicContextProvider, Object.assign({}, props)) }) }));
@@ -98,6 +98,7 @@ import { SendBalanceContextProvider } from '../SendBalanceContext/SendBalanceCon
98
98
  import { UseNetworkValidation } from '../UseNetworkValidation/UseNetworkValidation.js';
99
99
  import { UserWalletsProvider } from '../UserWalletsContext/UserWalletsContext.js';
100
100
  import { WalletContextProvider } from '../WalletContext/WalletContext.js';
101
+ import { PhantomRedirectContextProvider } from '../PhantomRedirectContext/PhantomRedirectContext.js';
101
102
  import { handleDisconnectWallet } from './handleDisconnectWallet/handleDisconnectWallet.js';
102
103
  import { initExpirationTime, getInitialView } from './helpers/helpers.js';
103
104
  import { useDisplayOrderState } from './hooks/useDisplayOrderState/useDisplayOrderState.js';
@@ -691,7 +692,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
691
692
  isBridgeFlow,
692
693
  isFullyConnected,
693
694
  isMultiWalletEnabled: multiWallet,
694
- }), children: [enableForcedNetworkValidation && 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: jsxs(ConnectWithEmailOtpProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(Toolkit, {}), jsx(FundingWidget, {}), jsx(SyncPasskeyFlow, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) }) }) }));
695
+ }), children: [enableForcedNetworkValidation && 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: jsxs(PhantomRedirectContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(Toolkit, {}), jsx(FundingWidget, {}), jsx(SyncPasskeyFlow, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) }) }) }));
695
696
  };
696
697
  /** The context provider you need to have access too all of Dynamic's hooks */
697
698
  const DynamicContextProvider = (props) => (jsx(ErrorContextProvider, { children: jsx(UserWalletsProvider, { children: jsx(InnerDynamicContextProvider, Object.assign({}, props)) }) }));
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var React = require('react');
7
+ var utils = require('@dynamic-labs/utils');
8
+ var useResponseHandlers = require('./useResponseHandlers.cjs');
9
+
10
+ const PhantomRedirectContext = React.createContext(undefined);
11
+ const PhantomRedirectContextProvider = ({ children, }) => {
12
+ const { phantomRedirectConnector, handleConnectResponse, handleUserResponse, } = useResponseHandlers.useResponseHandlers();
13
+ React.useEffect(() => {
14
+ if (!phantomRedirectConnector || !utils.isMobile()) {
15
+ return;
16
+ }
17
+ const params = new URLSearchParams(window.location.search);
18
+ if (params.has('error')) {
19
+ // implement error handling
20
+ return;
21
+ }
22
+ // handle response of connect method
23
+ if (params.has('phantom_encryption_public_key')) {
24
+ handleConnectResponse();
25
+ return;
26
+ }
27
+ // handle response of the following methods:
28
+ // signMessage, signTransaction, signAndSendTransaction or signAllTransactions
29
+ if (params.has('data')) {
30
+ handleUserResponse();
31
+ return;
32
+ }
33
+ }, [handleConnectResponse, handleUserResponse, phantomRedirectConnector]);
34
+ return (jsxRuntime.jsx(PhantomRedirectContext.Provider, { value: {
35
+ phantomRedirectConnector,
36
+ }, children: children }));
37
+ };
38
+
39
+ exports.PhantomRedirectContext = PhantomRedirectContext;
40
+ exports.PhantomRedirectContextProvider = PhantomRedirectContextProvider;
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { WalletConnector } from '../../..';
3
+ export type PhantomContextReturnType = {
4
+ phantomRedirectConnector: WalletConnector | undefined;
5
+ };
6
+ export declare const PhantomRedirectContext: import("react").Context<PhantomContextReturnType | undefined>;
7
+ export declare const PhantomRedirectContextProvider: ({ children, }: {
8
+ children: ReactNode;
9
+ }) => JSX.Element;
10
+ export declare const usePhantomRedirectContext: () => PhantomContextReturnType;
@@ -0,0 +1,35 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { createContext, useEffect } from 'react';
3
+ import { isMobile } from '@dynamic-labs/utils';
4
+ import { useResponseHandlers } from './useResponseHandlers.js';
5
+
6
+ const PhantomRedirectContext = createContext(undefined);
7
+ const PhantomRedirectContextProvider = ({ children, }) => {
8
+ const { phantomRedirectConnector, handleConnectResponse, handleUserResponse, } = useResponseHandlers();
9
+ useEffect(() => {
10
+ if (!phantomRedirectConnector || !isMobile()) {
11
+ return;
12
+ }
13
+ const params = new URLSearchParams(window.location.search);
14
+ if (params.has('error')) {
15
+ // implement error handling
16
+ return;
17
+ }
18
+ // handle response of connect method
19
+ if (params.has('phantom_encryption_public_key')) {
20
+ handleConnectResponse();
21
+ return;
22
+ }
23
+ // handle response of the following methods:
24
+ // signMessage, signTransaction, signAndSendTransaction or signAllTransactions
25
+ if (params.has('data')) {
26
+ handleUserResponse();
27
+ return;
28
+ }
29
+ }, [handleConnectResponse, handleUserResponse, phantomRedirectConnector]);
30
+ return (jsx(PhantomRedirectContext.Provider, { value: {
31
+ phantomRedirectConnector,
32
+ }, children: children }));
33
+ };
34
+
35
+ export { PhantomRedirectContext, PhantomRedirectContextProvider };
@@ -0,0 +1 @@
1
+ export * from './PhantomRedirectContext';
@@ -0,0 +1,124 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _tslib = require('../../../../_virtual/_tslib.cjs');
6
+ var React = require('react');
7
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
8
+ require('../../events/dynamicEvents.cjs');
9
+ require('@dynamic-labs/utils');
10
+ require('../DynamicContext/DynamicContext.cjs');
11
+ require('@dynamic-labs/sdk-api');
12
+ require('../../shared/logger.cjs');
13
+ require('@dynamic-labs/iconic');
14
+ require('react/jsx-runtime');
15
+ var ViewContext = require('../ViewContext/ViewContext.cjs');
16
+ require('@dynamic-labs/wallet-book');
17
+ require('../../utils/constants/colors.cjs');
18
+ require('../../utils/constants/values.cjs');
19
+ require('../../shared/utils/classes/storage/localStorage.cjs');
20
+ require('viem');
21
+ require('../../shared/consts/index.cjs');
22
+ var useInternalDynamicContext = require('../DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
23
+ var CaptchaContext = require('../CaptchaContext/CaptchaContext.cjs');
24
+ require('../ErrorContext/ErrorContext.cjs');
25
+ require('@dynamic-labs/multi-wallet');
26
+ require('viem/chains');
27
+ var useVerifyWallet = require('../../utils/hooks/useVerifyWallet/useVerifyWallet.cjs');
28
+ require('../../config/ApiEndpoint.cjs');
29
+ require('../EmailVerificationContext/EmailVerificationContext.cjs');
30
+ require('react-dom');
31
+ require('../ThemeContext/ThemeContext.cjs');
32
+ require('@dynamic-labs/types');
33
+ require('../AccountExistsContext/AccountExistsContext.cjs');
34
+ require('yup');
35
+ require('react-i18next');
36
+ require('../MockContext/MockContext.cjs');
37
+ require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
38
+ require('../UserFieldEditorContext/UserFieldEditorContext.cjs');
39
+ require('@dynamic-labs/rpc-providers');
40
+ require('../UserWalletsContext/UserWalletsContext.cjs');
41
+ require('../../components/Alert/Alert.cjs');
42
+ require('../../components/ShadowDOM/ShadowDOM.cjs');
43
+ require('../../components/IconButton/IconButton.cjs');
44
+ require('../../components/InlineWidget/InlineWidget.cjs');
45
+ require('../../components/MenuList/Dropdown/Dropdown.cjs');
46
+ require('../../components/Transition/ZoomTransition/ZoomTransition.cjs');
47
+ require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
48
+ require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
49
+ require('../../components/Popper/Popper/Popper.cjs');
50
+ require('../../components/Popper/PopperContext/PopperContext.cjs');
51
+ require('react-focus-lock');
52
+ require('formik');
53
+ require('i18next');
54
+ require('../../components/OverlayCard/OverlayCard.context.cjs');
55
+ require('../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
56
+ require('../../views/WalletList/WalletList.cjs');
57
+ require('../AccessDeniedContext/AccessDeniedContext.cjs');
58
+ require('qrcode');
59
+ require('@hcaptcha/react-hcaptcha');
60
+ require('../LoadingContext/LoadingContext.cjs');
61
+ require('../SocialRedirectContext/SocialRedirectContext.cjs');
62
+ require('../WalletGroupContext/WalletGroupContext.cjs');
63
+ require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
64
+ require('../FooterAnimationContext/index.cjs');
65
+ require('../PasskeyContext/PasskeyContext.cjs');
66
+ require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
67
+ require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
68
+ require('../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
69
+ require('@dynamic-labs/viem-utils');
70
+ require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
71
+
72
+ const useResponseHandlers = () => {
73
+ const { walletConnectorOptions, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, connectWallet, setShowAuthFlow, setSelectedWalletConnectorKey, } = useInternalDynamicContext.useInternalDynamicContext();
74
+ const { setView } = ViewContext.useViewContext();
75
+ const { getCaptchaToken } = CaptchaContext.useCaptchaContext();
76
+ const verifyWallet = useVerifyWallet.useVerifyWallet({
77
+ consumeNonce,
78
+ displaySiweStatement,
79
+ environmentId,
80
+ projectSettings,
81
+ setIsSingleWalletAccount,
82
+ });
83
+ const phantomRedirectConnector = walletConnectorOptions
84
+ .map(({ walletConnector }) => walletConnector)
85
+ .find(walletConnectorCore.isPhantomRedirectConnector);
86
+ const handleConnectResponse = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
87
+ if (!phantomRedirectConnector) {
88
+ return;
89
+ }
90
+ // this completes the connection step
91
+ yield phantomRedirectConnector.getSession();
92
+ yield connectWallet(phantomRedirectConnector);
93
+ setShowAuthFlow(true, { ignoreIfIsEmbeddedWidget: true });
94
+ setView('pending-signature');
95
+ setSelectedWalletConnectorKey('phantom');
96
+ }), [
97
+ connectWallet,
98
+ phantomRedirectConnector,
99
+ setSelectedWalletConnectorKey,
100
+ setShowAuthFlow,
101
+ setView,
102
+ ]);
103
+ const handleUserResponse = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
104
+ if (!phantomRedirectConnector) {
105
+ return;
106
+ }
107
+ const { signature, message } = phantomRedirectConnector.extractSignature();
108
+ const [address] = yield phantomRedirectConnector.getConnectedAccounts();
109
+ yield verifyWallet({
110
+ captchaToken: getCaptchaToken(),
111
+ messageToSignOverride: message,
112
+ publicWalletAddress: address,
113
+ signedMessageOverride: signature,
114
+ walletConnector: phantomRedirectConnector,
115
+ });
116
+ }), [getCaptchaToken, phantomRedirectConnector, verifyWallet]);
117
+ return {
118
+ handleConnectResponse,
119
+ handleUserResponse,
120
+ phantomRedirectConnector,
121
+ };
122
+ };
123
+
124
+ exports.useResponseHandlers = useResponseHandlers;
@@ -0,0 +1,5 @@
1
+ export declare const useResponseHandlers: () => {
2
+ handleConnectResponse: () => Promise<void>;
3
+ handleUserResponse: () => Promise<void>;
4
+ phantomRedirectConnector: import("@dynamic-labs/wallet-connector-core").IPhantomRedirectConnector | undefined;
5
+ };
@@ -0,0 +1,120 @@
1
+ import { __awaiter } from '../../../../_virtual/_tslib.js';
2
+ import { useCallback } from 'react';
3
+ import { isPhantomRedirectConnector } from '@dynamic-labs/wallet-connector-core';
4
+ import '../../events/dynamicEvents.js';
5
+ import '@dynamic-labs/utils';
6
+ import '../DynamicContext/DynamicContext.js';
7
+ import '@dynamic-labs/sdk-api';
8
+ import '../../shared/logger.js';
9
+ import '@dynamic-labs/iconic';
10
+ import 'react/jsx-runtime';
11
+ import { useViewContext } from '../ViewContext/ViewContext.js';
12
+ import '@dynamic-labs/wallet-book';
13
+ import '../../utils/constants/colors.js';
14
+ import '../../utils/constants/values.js';
15
+ import '../../shared/utils/classes/storage/localStorage.js';
16
+ import 'viem';
17
+ import '../../shared/consts/index.js';
18
+ import { useInternalDynamicContext } from '../DynamicContext/useDynamicContext/useInternalDynamicContext.js';
19
+ import { useCaptchaContext } from '../CaptchaContext/CaptchaContext.js';
20
+ import '../ErrorContext/ErrorContext.js';
21
+ import '@dynamic-labs/multi-wallet';
22
+ import 'viem/chains';
23
+ import { useVerifyWallet } from '../../utils/hooks/useVerifyWallet/useVerifyWallet.js';
24
+ import '../../config/ApiEndpoint.js';
25
+ import '../EmailVerificationContext/EmailVerificationContext.js';
26
+ import 'react-dom';
27
+ import '../ThemeContext/ThemeContext.js';
28
+ import '@dynamic-labs/types';
29
+ import '../AccountExistsContext/AccountExistsContext.js';
30
+ import 'yup';
31
+ import 'react-i18next';
32
+ import '../MockContext/MockContext.js';
33
+ import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
34
+ import '../UserFieldEditorContext/UserFieldEditorContext.js';
35
+ import '@dynamic-labs/rpc-providers';
36
+ import '../UserWalletsContext/UserWalletsContext.js';
37
+ import '../../components/Alert/Alert.js';
38
+ import '../../components/ShadowDOM/ShadowDOM.js';
39
+ import '../../components/IconButton/IconButton.js';
40
+ import '../../components/InlineWidget/InlineWidget.js';
41
+ import '../../components/MenuList/Dropdown/Dropdown.js';
42
+ import '../../components/Transition/ZoomTransition/ZoomTransition.js';
43
+ import '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
44
+ import '../../components/Transition/OpacityTransition/OpacityTransition.js';
45
+ import '../../components/Popper/Popper/Popper.js';
46
+ import '../../components/Popper/PopperContext/PopperContext.js';
47
+ import 'react-focus-lock';
48
+ import 'formik';
49
+ import 'i18next';
50
+ import '../../components/OverlayCard/OverlayCard.context.js';
51
+ import '../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
52
+ import '../../views/WalletList/WalletList.js';
53
+ import '../AccessDeniedContext/AccessDeniedContext.js';
54
+ import 'qrcode';
55
+ import '@hcaptcha/react-hcaptcha';
56
+ import '../LoadingContext/LoadingContext.js';
57
+ import '../SocialRedirectContext/SocialRedirectContext.js';
58
+ import '../WalletGroupContext/WalletGroupContext.js';
59
+ import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
60
+ import '../FooterAnimationContext/index.js';
61
+ import '../PasskeyContext/PasskeyContext.js';
62
+ import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
63
+ import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
64
+ import '../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
65
+ import '@dynamic-labs/viem-utils';
66
+ import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
67
+
68
+ const useResponseHandlers = () => {
69
+ const { walletConnectorOptions, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, connectWallet, setShowAuthFlow, setSelectedWalletConnectorKey, } = useInternalDynamicContext();
70
+ const { setView } = useViewContext();
71
+ const { getCaptchaToken } = useCaptchaContext();
72
+ const verifyWallet = useVerifyWallet({
73
+ consumeNonce,
74
+ displaySiweStatement,
75
+ environmentId,
76
+ projectSettings,
77
+ setIsSingleWalletAccount,
78
+ });
79
+ const phantomRedirectConnector = walletConnectorOptions
80
+ .map(({ walletConnector }) => walletConnector)
81
+ .find(isPhantomRedirectConnector);
82
+ const handleConnectResponse = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
83
+ if (!phantomRedirectConnector) {
84
+ return;
85
+ }
86
+ // this completes the connection step
87
+ yield phantomRedirectConnector.getSession();
88
+ yield connectWallet(phantomRedirectConnector);
89
+ setShowAuthFlow(true, { ignoreIfIsEmbeddedWidget: true });
90
+ setView('pending-signature');
91
+ setSelectedWalletConnectorKey('phantom');
92
+ }), [
93
+ connectWallet,
94
+ phantomRedirectConnector,
95
+ setSelectedWalletConnectorKey,
96
+ setShowAuthFlow,
97
+ setView,
98
+ ]);
99
+ const handleUserResponse = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
100
+ if (!phantomRedirectConnector) {
101
+ return;
102
+ }
103
+ const { signature, message } = phantomRedirectConnector.extractSignature();
104
+ const [address] = yield phantomRedirectConnector.getConnectedAccounts();
105
+ yield verifyWallet({
106
+ captchaToken: getCaptchaToken(),
107
+ messageToSignOverride: message,
108
+ publicWalletAddress: address,
109
+ signedMessageOverride: signature,
110
+ walletConnector: phantomRedirectConnector,
111
+ });
112
+ }), [getCaptchaToken, phantomRedirectConnector, verifyWallet]);
113
+ return {
114
+ handleConnectResponse,
115
+ handleUserResponse,
116
+ phantomRedirectConnector,
117
+ };
118
+ };
119
+
120
+ export { useResponseHandlers };
@@ -90,6 +90,8 @@ export interface VerifyCallbackArgs {
90
90
  oauth?: OauthProviderRequest;
91
91
  publicWalletAddress: string;
92
92
  walletConnector: WalletConnector;
93
+ signedMessageOverride?: string;
94
+ messageToSignOverride?: string;
93
95
  }
94
96
  export interface VerifyWalletProps {
95
97
  verifyWallet: ({ walletConnector, fetchPublicAddressOpts, }: VerifyCallbackArgs) => Promise<void>;
@@ -6,7 +6,7 @@ var _tslib = require('../../../../../_virtual/_tslib.cjs');
6
6
  var index = require('../generateMessages/index.cjs');
7
7
 
8
8
  // TODO - This function is doing too much we should split it up.
9
- const getVerifyArgs = ({ walletConnector, nonce, walletProvider, environmentId, displaySiweStatement, skipEmptyAccountCheck, siweStatement, publicWalletAddress, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
9
+ const getVerifyArgs = ({ walletConnector, nonce, walletProvider, environmentId, displaySiweStatement, skipEmptyAccountCheck, siweStatement, publicWalletAddress, signedMessageOverride, messageToSignOverride, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
10
10
  // WARNING - PLEASE READ!
11
11
  // DO NOT ADD ANY NEW ASYNC WORK WITH AWAIT!
12
12
  // Deep linking could break with too many blocking awaits
@@ -14,6 +14,23 @@ const getVerifyArgs = ({ walletConnector, nonce, walletProvider, environmentId,
14
14
  // This could manifest in users being directed to the app store
15
15
  // instead of the actual wallet app.
16
16
  const chain = walletConnector.connectedChain;
17
+ if (signedMessageOverride && messageToSignOverride) {
18
+ const [network, additionalWalletAddresses] = yield Promise.all([
19
+ walletConnector.getNetwork(),
20
+ walletConnector.getAdditionalAddresses(publicWalletAddress),
21
+ ]);
22
+ return {
23
+ additionalWalletAddresses,
24
+ chain,
25
+ messageToSign: messageToSignOverride,
26
+ network: String(network),
27
+ publicWalletAddress,
28
+ signedMessage: signedMessageOverride,
29
+ skipEmptyAccountCheck,
30
+ walletName: walletConnector.key,
31
+ walletProvider,
32
+ };
33
+ }
17
34
  // generate message to sign and then initiate signing step to prove ownership
18
35
  const { messageToSign, signedMessage } = yield index.generateMessages(publicWalletAddress, walletConnector, nonce, environmentId, displaySiweStatement, siweStatement);
19
36
  const [network, additionalWalletAddresses] = yield Promise.all([
@@ -1,4 +1,5 @@
1
1
  import { FetchPublicAddressOpts } from '@dynamic-labs/wallet-connector-core';
2
+ import { WalletAdditionalAddress } from '@dynamic-labs/sdk-api';
2
3
  import { WalletConnector } from '../../../..';
3
4
  import { WalletProvider } from '../../../shared';
4
5
  type Props = {
@@ -11,16 +12,19 @@ type Props = {
11
12
  skipEmptyAccountCheck?: boolean;
12
13
  walletConnector: WalletConnector;
13
14
  walletProvider: WalletProvider;
15
+ signedMessageOverride?: string;
16
+ messageToSignOverride?: string;
14
17
  };
15
- export declare const getVerifyArgs: ({ walletConnector, nonce, walletProvider, environmentId, displaySiweStatement, skipEmptyAccountCheck, siweStatement, publicWalletAddress, }: Props) => Promise<{
16
- additionalWalletAddresses: import("@dynamic-labs/sdk-api").WalletAdditionalAddress[] | undefined;
17
- chain: "ETH" | "FLOW" | "SOL" | "EVM" | "ALGO" | "STARK" | "ATOM" | "COSMOS" | "BTC";
18
+ type VerifyArgs = {
19
+ additionalWalletAddresses: WalletAdditionalAddress[] | undefined;
20
+ chain: string;
18
21
  messageToSign: string;
19
22
  network: string;
20
23
  publicWalletAddress: string;
21
24
  signedMessage: string;
22
- skipEmptyAccountCheck: boolean | undefined;
25
+ skipEmptyAccountCheck?: boolean;
23
26
  walletName: string;
24
- walletProvider: "browserExtension" | "custodialService" | "walletConnect" | "qrCode" | "deepLink" | "embeddedWallet" | "smartContractWallet";
25
- }>;
27
+ walletProvider: WalletProvider;
28
+ };
29
+ export declare const getVerifyArgs: ({ walletConnector, nonce, walletProvider, environmentId, displaySiweStatement, skipEmptyAccountCheck, siweStatement, publicWalletAddress, signedMessageOverride, messageToSignOverride, }: Props) => Promise<VerifyArgs>;
26
30
  export {};
@@ -2,7 +2,7 @@ import { __awaiter } from '../../../../../_virtual/_tslib.js';
2
2
  import { generateMessages } from '../generateMessages/index.js';
3
3
 
4
4
  // TODO - This function is doing too much we should split it up.
5
- const getVerifyArgs = ({ walletConnector, nonce, walletProvider, environmentId, displaySiweStatement, skipEmptyAccountCheck, siweStatement, publicWalletAddress, }) => __awaiter(void 0, void 0, void 0, function* () {
5
+ const getVerifyArgs = ({ walletConnector, nonce, walletProvider, environmentId, displaySiweStatement, skipEmptyAccountCheck, siweStatement, publicWalletAddress, signedMessageOverride, messageToSignOverride, }) => __awaiter(void 0, void 0, void 0, function* () {
6
6
  // WARNING - PLEASE READ!
7
7
  // DO NOT ADD ANY NEW ASYNC WORK WITH AWAIT!
8
8
  // Deep linking could break with too many blocking awaits
@@ -10,6 +10,23 @@ const getVerifyArgs = ({ walletConnector, nonce, walletProvider, environmentId,
10
10
  // This could manifest in users being directed to the app store
11
11
  // instead of the actual wallet app.
12
12
  const chain = walletConnector.connectedChain;
13
+ if (signedMessageOverride && messageToSignOverride) {
14
+ const [network, additionalWalletAddresses] = yield Promise.all([
15
+ walletConnector.getNetwork(),
16
+ walletConnector.getAdditionalAddresses(publicWalletAddress),
17
+ ]);
18
+ return {
19
+ additionalWalletAddresses,
20
+ chain,
21
+ messageToSign: messageToSignOverride,
22
+ network: String(network),
23
+ publicWalletAddress,
24
+ signedMessage: signedMessageOverride,
25
+ skipEmptyAccountCheck,
26
+ walletName: walletConnector.key,
27
+ walletProvider,
28
+ };
29
+ }
13
30
  // generate message to sign and then initiate signing step to prove ownership
14
31
  const { messageToSign, signedMessage } = yield generateMessages(publicWalletAddress, walletConnector, nonce, environmentId, displaySiweStatement, siweStatement);
15
32
  const [network, additionalWalletAddresses] = yield Promise.all([
@@ -89,7 +89,7 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
89
89
  // and need to distinguish between logic for verify or linking.
90
90
  const verifyOnly = !authToken;
91
91
  const shouldFallbackToConnectOnly = enableConnectOnlyFallback && (verifyOnly || !multiWalletEnabled);
92
- const generateJWT = (walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
92
+ const generateJWT = (walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, signedMessageOverride, messageToSignOverride) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
93
93
  let Jwt;
94
94
  const nonce = consumeNonce();
95
95
  if (nonce === undefined)
@@ -98,8 +98,10 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
98
98
  displaySiweStatement,
99
99
  environmentId,
100
100
  fetchPublicAddressOpts,
101
+ messageToSignOverride,
101
102
  nonce,
102
103
  publicWalletAddress,
104
+ signedMessageOverride,
103
105
  siweStatement: getSiweStatement.getSiweStatement({ appName, siweStatement }),
104
106
  walletConnector,
105
107
  walletProvider,
@@ -159,6 +161,10 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
159
161
  };
160
162
  const handleError = (e, walletConnector, address, oauth) => {
161
163
  var _a;
164
+ // see: PhantomRedirect#signMessage
165
+ if (e.message === 'ignore') {
166
+ return;
167
+ }
162
168
  if (e instanceof utils.WalletUsedError) {
163
169
  handleDisconnectWallet({ endSession: false, walletConnector });
164
170
  return handleWalletUsedError(e);
@@ -215,12 +221,12 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
215
221
  setErrorMessage(e.code);
216
222
  }
217
223
  };
218
- return ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
224
+ return ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, signedMessageOverride, messageToSignOverride, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
219
225
  var _a;
220
226
  const walletProvider = getWalletProvider.getWalletProvider(walletConnector);
221
227
  try {
222
228
  setIsVerificationInProgress(true);
223
- const { Jwt, verifyArgs } = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth);
229
+ const { Jwt, verifyArgs } = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, signedMessageOverride, messageToSignOverride);
224
230
  const decodedJwt = decodeJwt.decodeJwt(Jwt);
225
231
  if (decodedJwt === undefined)
226
232
  throw new utils.DynamicError('Invalid token!');
@@ -5,5 +5,5 @@ type UseVerifyWalletArgs = VerifyProps & ProjectSettingsProps & {
5
5
  displaySiweStatement: boolean;
6
6
  setIsSingleWalletAccount: Dispatch<SetStateAction<boolean>>;
7
7
  };
8
- export declare const useVerifyWallet: ({ consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, }: UseVerifyWalletArgs) => ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, }: VerifyCallbackArgs) => Promise<void>;
8
+ export declare const useVerifyWallet: ({ consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, }: UseVerifyWalletArgs) => ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, signedMessageOverride, messageToSignOverride, }: VerifyCallbackArgs) => Promise<void>;
9
9
  export {};
@@ -85,7 +85,7 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
85
85
  // and need to distinguish between logic for verify or linking.
86
86
  const verifyOnly = !authToken;
87
87
  const shouldFallbackToConnectOnly = enableConnectOnlyFallback && (verifyOnly || !multiWalletEnabled);
88
- const generateJWT = (walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth) => __awaiter(void 0, void 0, void 0, function* () {
88
+ const generateJWT = (walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, signedMessageOverride, messageToSignOverride) => __awaiter(void 0, void 0, void 0, function* () {
89
89
  let Jwt;
90
90
  const nonce = consumeNonce();
91
91
  if (nonce === undefined)
@@ -94,8 +94,10 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
94
94
  displaySiweStatement,
95
95
  environmentId,
96
96
  fetchPublicAddressOpts,
97
+ messageToSignOverride,
97
98
  nonce,
98
99
  publicWalletAddress,
100
+ signedMessageOverride,
99
101
  siweStatement: getSiweStatement({ appName, siweStatement }),
100
102
  walletConnector,
101
103
  walletProvider,
@@ -155,6 +157,10 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
155
157
  };
156
158
  const handleError = (e, walletConnector, address, oauth) => {
157
159
  var _a;
160
+ // see: PhantomRedirect#signMessage
161
+ if (e.message === 'ignore') {
162
+ return;
163
+ }
158
164
  if (e instanceof WalletUsedError) {
159
165
  handleDisconnectWallet({ endSession: false, walletConnector });
160
166
  return handleWalletUsedError(e);
@@ -211,12 +217,12 @@ const useVerifyWallet = ({ consumeNonce, displaySiweStatement, environmentId, pr
211
217
  setErrorMessage(e.code);
212
218
  }
213
219
  };
214
- return ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, }) => __awaiter(void 0, void 0, void 0, function* () {
220
+ return ({ walletConnector, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, signedMessageOverride, messageToSignOverride, }) => __awaiter(void 0, void 0, void 0, function* () {
215
221
  var _a;
216
222
  const walletProvider = getWalletProvider(walletConnector);
217
223
  try {
218
224
  setIsVerificationInProgress(true);
219
- const { Jwt, verifyArgs } = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth);
225
+ const { Jwt, verifyArgs } = yield generateJWT(walletConnector, walletProvider, fetchPublicAddressOpts, publicWalletAddress, captchaToken, oauth, signedMessageOverride, messageToSignOverride);
220
226
  const decodedJwt = decodeJwt(Jwt);
221
227
  if (decodedJwt === undefined)
222
228
  throw new DynamicError('Invalid token!');
@@ -28,7 +28,6 @@ require('../../../context/ErrorContext/ErrorContext.cjs');
28
28
  require('@dynamic-labs/multi-wallet');
29
29
  var getAuthToken = require('../../../utils/functions/getAuthToken/getAuthToken.cjs');
30
30
  require('@dynamic-labs/sdk-api');
31
- var isPasskeyEnabled = require('../../../utils/functions/isPasskeyEnabled/isPasskeyEnabled.cjs');
32
31
  require('viem/chains');
33
32
  require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
34
33
  require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
@@ -37,7 +36,6 @@ require('../../../context/EmailVerificationContext/EmailVerificationContext.cjs'
37
36
  require('react-dom');
38
37
  var useCreateDynamicEmbeddedWalletMutation = require('../../../utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs');
39
38
  require('../../../context/ThemeContext/ThemeContext.cjs');
40
- var usePromise = require('../../../utils/hooks/usePromise/usePromise.cjs');
41
39
  require('@dynamic-labs/types');
42
40
  require('yup');
43
41
  require('../../../context/MockContext/MockContext.cjs');
@@ -88,7 +86,9 @@ const PasskeyIntroView = () => {
88
86
  const { walletConnectorOptions, environmentId, handleLogOut, onboardingOnlyJwt, } = useInternalDynamicContext.useInternalDynamicContext();
89
87
  const { setIsFooterExpanded } = index.useFooterAnimationContext();
90
88
  const { t } = reactI18next.useTranslation();
91
- const { data: passkeyEnabled } = usePromise.usePromise(isPasskeyEnabled.isPasskeyEnabled);
89
+ // TODO(GVTY-1137): send a metric when we detect passkeys are not enabled by the browser/device
90
+ // we removed enforcing this check since we were getting false negatives
91
+ // const { data: passkeyEnabled } = usePromise(isPasskeyEnabled);
92
92
  // if passkey is not yet setup, but user logged in with email in a passkey env
93
93
  // it should be null to force user to setup passkey even after the a refresh
94
94
  React.useEffect(() => localStorage.LocalStorage.removeFromLS(localStorage$1.LAST_USED_WALLET), []);
@@ -118,7 +118,7 @@ const PasskeyIntroView = () => {
118
118
  return getProperErrorMessage.getProperErrorMessage(error);
119
119
  }, [error]);
120
120
  const infoIconButton = (jsxRuntime.jsx(Tooltip.Tooltip, { content: t('dyn_passkey_intro.helper.tooltip'), className: 'header__tooltip', copykey: 'dyn_passkey_intro.helper.tooltip', children: jsxRuntime.jsx(IconButton.IconButton, { type: 'button', "data-testid": 'info-button', onClick: () => setIsFooterExpanded((prev) => !prev), className: 'header__icon', children: jsxRuntime.jsx(questionMark.ReactComponent, {}) }) }, 'info-button'));
121
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: infoIconButton, children: jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', copykey: 'dyn_passkey_intro.title', children: t('dyn_passkey_intro.title') }) }), jsxRuntime.jsxs("div", { className: 'passkey-intro-view', children: [jsxRuntime.jsx("div", { className: 'passkey-intro-view__header', children: jsxRuntime.jsx(passkeyIntroIcon.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'passkey-intro-view__subtitle', copykey: 'dyn_passkey_intro.subtitle', children: t('dyn_passkey_intro.subtitle') }), passkeyEnabled === false && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { copykey: 'dyn_passkey_intro.disabled', children: t('dyn_passkey_intro.disabled') })), errorText && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: errorText }), jsxRuntime.jsxs("div", { className: 'passkey-intro-view__actions', children: [jsxRuntime.jsx(Button.Button, { buttonVariant: 'brand-primary', buttonPadding: 'large', onClick: handleCreateEmbeddedWallet, dataTestId: 'setup-passkey-button', loading: isLoading, disabled: isLoading || !passkeyEnabled, typographyProps: {
121
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: infoIconButton, children: jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', copykey: 'dyn_passkey_intro.title', children: t('dyn_passkey_intro.title') }) }), jsxRuntime.jsxs("div", { className: 'passkey-intro-view', children: [jsxRuntime.jsx("div", { className: 'passkey-intro-view__header', children: jsxRuntime.jsx(passkeyIntroIcon.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'passkey-intro-view__subtitle', copykey: 'dyn_passkey_intro.subtitle', children: t('dyn_passkey_intro.subtitle') }), errorText && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: errorText }), jsxRuntime.jsxs("div", { className: 'passkey-intro-view__actions', children: [jsxRuntime.jsx(Button.Button, { buttonVariant: 'brand-primary', buttonPadding: 'large', onClick: handleCreateEmbeddedWallet, dataTestId: 'setup-passkey-button', loading: isLoading, disabled: isLoading, typographyProps: {
122
122
  color: 'inherit',
123
123
  }, children: jsxRuntime.jsxs("div", { className: 'passkey-intro-view__inline-button', children: [jsxRuntime.jsx(PasskeyDeviceIcon.PasskeyDeviceIcon, {}), jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_passkey_intro.button', children: t('dyn_passkey_intro.button') })] }) }), jsxRuntime.jsx(TextButton.TextButton, { "data-testid": 'setup-passkey-logout-button', className: 'passkey-intro-view__log-out', onClick: handleLogOut, copykey: 'dyn_passkey_intro.button_logout', children: t('dyn_passkey_intro.button_logout') })] })] })] }));
124
124
  };
@@ -24,7 +24,6 @@ import '../../../context/ErrorContext/ErrorContext.js';
24
24
  import '@dynamic-labs/multi-wallet';
25
25
  import { getAuthToken } from '../../../utils/functions/getAuthToken/getAuthToken.js';
26
26
  import '@dynamic-labs/sdk-api';
27
- import { isPasskeyEnabled } from '../../../utils/functions/isPasskeyEnabled/isPasskeyEnabled.js';
28
27
  import 'viem/chains';
29
28
  import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
30
29
  import '../../../context/AccountExistsContext/AccountExistsContext.js';
@@ -33,7 +32,6 @@ import '../../../context/EmailVerificationContext/EmailVerificationContext.js';
33
32
  import 'react-dom';
34
33
  import { useCreateDynamicEmbeddedWalletMutation } from '../../../utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js';
35
34
  import '../../../context/ThemeContext/ThemeContext.js';
36
- import { usePromise } from '../../../utils/hooks/usePromise/usePromise.js';
37
35
  import '@dynamic-labs/types';
38
36
  import 'yup';
39
37
  import '../../../context/MockContext/MockContext.js';
@@ -84,7 +82,9 @@ const PasskeyIntroView = () => {
84
82
  const { walletConnectorOptions, environmentId, handleLogOut, onboardingOnlyJwt, } = useInternalDynamicContext();
85
83
  const { setIsFooterExpanded } = useFooterAnimationContext();
86
84
  const { t } = useTranslation();
87
- const { data: passkeyEnabled } = usePromise(isPasskeyEnabled);
85
+ // TODO(GVTY-1137): send a metric when we detect passkeys are not enabled by the browser/device
86
+ // we removed enforcing this check since we were getting false negatives
87
+ // const { data: passkeyEnabled } = usePromise(isPasskeyEnabled);
88
88
  // if passkey is not yet setup, but user logged in with email in a passkey env
89
89
  // it should be null to force user to setup passkey even after the a refresh
90
90
  useEffect(() => LocalStorage.removeFromLS(LAST_USED_WALLET), []);
@@ -114,7 +114,7 @@ const PasskeyIntroView = () => {
114
114
  return getProperErrorMessage(error);
115
115
  }, [error]);
116
116
  const infoIconButton = (jsx(Tooltip, { content: t('dyn_passkey_intro.helper.tooltip'), className: 'header__tooltip', copykey: 'dyn_passkey_intro.helper.tooltip', children: jsx(IconButton, { type: 'button', "data-testid": 'info-button', onClick: () => setIsFooterExpanded((prev) => !prev), className: 'header__icon', children: jsx(SvgQuestionMark, {}) }) }, 'info-button'));
117
- return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: infoIconButton, children: jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', copykey: 'dyn_passkey_intro.title', children: t('dyn_passkey_intro.title') }) }), jsxs("div", { className: 'passkey-intro-view', children: [jsx("div", { className: 'passkey-intro-view__header', children: jsx(SvgPasskeyIntroIcon, {}) }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'passkey-intro-view__subtitle', copykey: 'dyn_passkey_intro.subtitle', children: t('dyn_passkey_intro.subtitle') }), passkeyEnabled === false && (jsx(ErrorContainer, { copykey: 'dyn_passkey_intro.disabled', children: t('dyn_passkey_intro.disabled') })), errorText && jsx(ErrorContainer, { children: errorText }), jsxs("div", { className: 'passkey-intro-view__actions', children: [jsx(Button, { buttonVariant: 'brand-primary', buttonPadding: 'large', onClick: handleCreateEmbeddedWallet, dataTestId: 'setup-passkey-button', loading: isLoading, disabled: isLoading || !passkeyEnabled, typographyProps: {
117
+ return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: infoIconButton, children: jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', copykey: 'dyn_passkey_intro.title', children: t('dyn_passkey_intro.title') }) }), jsxs("div", { className: 'passkey-intro-view', children: [jsx("div", { className: 'passkey-intro-view__header', children: jsx(SvgPasskeyIntroIcon, {}) }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'passkey-intro-view__subtitle', copykey: 'dyn_passkey_intro.subtitle', children: t('dyn_passkey_intro.subtitle') }), errorText && jsx(ErrorContainer, { children: errorText }), jsxs("div", { className: 'passkey-intro-view__actions', children: [jsx(Button, { buttonVariant: 'brand-primary', buttonPadding: 'large', onClick: handleCreateEmbeddedWallet, dataTestId: 'setup-passkey-button', loading: isLoading, disabled: isLoading, typographyProps: {
118
118
  color: 'inherit',
119
119
  }, children: jsxs("div", { className: 'passkey-intro-view__inline-button', children: [jsx(PasskeyDeviceIcon, {}), jsx(Typography, { copykey: 'dyn_passkey_intro.button', children: t('dyn_passkey_intro.button') })] }) }), jsx(TextButton, { "data-testid": 'setup-passkey-logout-button', className: 'passkey-intro-view__log-out', onClick: handleLogOut, copykey: 'dyn_passkey_intro.button_logout', children: t('dyn_passkey_intro.button_logout') })] })] })] }));
120
120
  };
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _tslib = require('../../../../../_virtual/_tslib.cjs');
6
- var utils = require('@dynamic-labs/utils');
7
-
8
- const isUserVerifyingPlatformAuthenticatorAvailable = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
9
- var _a, _b;
10
- return (typeof ((_a = window === null || window === void 0 ? void 0 : window.PublicKeyCredential) === null || _a === void 0 ? void 0 : _a.isUserVerifyingPlatformAuthenticatorAvailable) === 'function' &&
11
- (yield ((_b = window === null || window === void 0 ? void 0 : window.PublicKeyCredential) === null || _b === void 0 ? void 0 : _b.isUserVerifyingPlatformAuthenticatorAvailable()))) ||
12
- false;
13
- });
14
- // we couldn't find a reliable if passkey is enabled on Windows, so we're just going to assume it is
15
- // isUserVerifyingPlatformAuthenticatorAvailable returns false, even when passkey works
16
- const isPasskeyEnabled = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
17
- return (yield isUserVerifyingPlatformAuthenticatorAvailable()) ||
18
- utils.isWindows() ||
19
- false;
20
- });
21
-
22
- exports.isPasskeyEnabled = isPasskeyEnabled;
@@ -1,18 +0,0 @@
1
- import { __awaiter } from '../../../../../_virtual/_tslib.js';
2
- import { isWindows } from '@dynamic-labs/utils';
3
-
4
- const isUserVerifyingPlatformAuthenticatorAvailable = () => __awaiter(void 0, void 0, void 0, function* () {
5
- var _a, _b;
6
- return (typeof ((_a = window === null || window === void 0 ? void 0 : window.PublicKeyCredential) === null || _a === void 0 ? void 0 : _a.isUserVerifyingPlatformAuthenticatorAvailable) === 'function' &&
7
- (yield ((_b = window === null || window === void 0 ? void 0 : window.PublicKeyCredential) === null || _b === void 0 ? void 0 : _b.isUserVerifyingPlatformAuthenticatorAvailable()))) ||
8
- false;
9
- });
10
- // we couldn't find a reliable if passkey is enabled on Windows, so we're just going to assume it is
11
- // isUserVerifyingPlatformAuthenticatorAvailable returns false, even when passkey works
12
- const isPasskeyEnabled = () => __awaiter(void 0, void 0, void 0, function* () {
13
- return (yield isUserVerifyingPlatformAuthenticatorAvailable()) ||
14
- isWindows() ||
15
- false;
16
- });
17
-
18
- export { isPasskeyEnabled };