@dynamic-labs/sdk-react-core 3.0.0-alpha.16 → 3.0.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -0
- package/src/lib/Main.cjs +1 -1
- package/src/lib/Main.js +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +13 -2
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.d.ts +2 -0
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +13 -2
- package/src/lib/context/DynamicContext/DynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +2 -1
- package/src/lib/modals/CreatePasswordModal/CreatePasswordModal.cjs +1 -1
- package/src/lib/modals/CreatePasswordModal/CreatePasswordModal.js +1 -1
- package/src/lib/modals/EnterPasswordModal/EnterPasswordModal.cjs +1 -1
- package/src/lib/modals/EnterPasswordModal/EnterPasswordModal.js +1 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +16 -6
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +16 -6
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.types.d.ts +1 -0
- package/src/lib/modals/SyncWalletPromptModal/SyncWalletPromptModal.cjs +1 -1
- package/src/lib/modals/SyncWalletPromptModal/SyncWalletPromptModal.js +1 -1
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +2 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +2 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.types.d.ts +1 -0
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.cjs +9 -9
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.d.ts +2 -1
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.js +9 -9
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSelectWalletOption/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSelectWalletOption/useSelectWalletOption.cjs +128 -0
- package/src/lib/utils/hooks/useSelectWalletOption/useSelectWalletOption.d.ts +3 -0
- package/src/lib/utils/hooks/useSelectWalletOption/useSelectWalletOption.js +124 -0
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +22 -15
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +22 -15
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +2 -2
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.18](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.17...v3.0.0-alpha.18) (2024-07-12)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* hide confirmation ui triggers passkey creation ([#6322](https://github.com/dynamic-labs/DynamicAuth/issues/6322)) ([c66f282](https://github.com/dynamic-labs/DynamicAuth/commit/c66f282cf8d64f19d7f5a7355aaaec980afbe245))
|
|
8
|
+
|
|
9
|
+
## [3.0.0-alpha.17](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.16...v3.0.0-alpha.17) (2024-07-11)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add new hook to select wallet option to connect ([#6301](https://github.com/dynamic-labs/DynamicAuth/issues/6301)) ([833d71d](https://github.com/dynamic-labs/DynamicAuth/commit/833d71de164c57bfa22898c3425641a83a12e135))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* refresh session keys correctly for solana embedded wallets ([#6309](https://github.com/dynamic-labs/DynamicAuth/issues/6309)) ([4b28e8a](https://github.com/dynamic-labs/DynamicAuth/commit/4b28e8ae231567754b6cfd07a7d41e86f1c73daa))
|
|
20
|
+
|
|
2
21
|
## [3.0.0-alpha.16](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.15...v3.0.0-alpha.16) (2024-07-11)
|
|
3
22
|
|
|
4
23
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.18",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/iconic": "3.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "3.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/rpc-providers": "3.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/store": "3.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
26
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
27
|
-
"@dynamic-labs/wallet-book": "3.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.
|
|
20
|
+
"@dynamic-labs/iconic": "3.0.0-alpha.18",
|
|
21
|
+
"@dynamic-labs/logger": "3.0.0-alpha.18",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "3.0.0-alpha.18",
|
|
23
|
+
"@dynamic-labs/rpc-providers": "3.0.0-alpha.18",
|
|
24
|
+
"@dynamic-labs/store": "3.0.0-alpha.18",
|
|
25
|
+
"@dynamic-labs/types": "3.0.0-alpha.18",
|
|
26
|
+
"@dynamic-labs/utils": "3.0.0-alpha.18",
|
|
27
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.18",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.18",
|
|
29
29
|
"eventemitter3": "5.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
package/src/index.cjs
CHANGED
|
@@ -148,6 +148,7 @@ var useDynamicModals = require('./lib/utils/hooks/useDynamicModals/useDynamicMod
|
|
|
148
148
|
var useMfa = require('./lib/utils/hooks/useMfa/useMfa.cjs');
|
|
149
149
|
var useTokenBalances = require('./lib/utils/hooks/useTokenBalances/useTokenBalances.cjs');
|
|
150
150
|
var useRefreshUser = require('./lib/utils/hooks/useRefreshUser/useRefreshUser.cjs');
|
|
151
|
+
var useSelectWalletOption = require('./lib/utils/hooks/useSelectWalletOption/useSelectWalletOption.cjs');
|
|
151
152
|
var DynamicConnectButton = require('./lib/components/DynamicConnectButton/DynamicConnectButton.cjs');
|
|
152
153
|
require('./lib/components/InlineWidget/InlineWidget.cjs');
|
|
153
154
|
var IsBrowser = require('./lib/components/IsBrowser/IsBrowser.cjs');
|
|
@@ -256,5 +257,6 @@ exports.useDynamicModals = useDynamicModals.useDynamicModals;
|
|
|
256
257
|
exports.useMfa = useMfa.useMfa;
|
|
257
258
|
exports.useTokenBalances = useTokenBalances.useTokenBalances;
|
|
258
259
|
exports.useRefreshUser = useRefreshUser.useRefreshUser;
|
|
260
|
+
exports.useSelectWalletOption = useSelectWalletOption.useSelectWalletOption;
|
|
259
261
|
exports.DynamicConnectButton = DynamicConnectButton.DynamicConnectButton;
|
|
260
262
|
exports.IsBrowser = IsBrowser.IsBrowser;
|
package/src/index.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ export { FilterAndSortWallets, FilterBridgeChainsName, FilterChain, FilterWallet
|
|
|
107
107
|
export {
|
|
108
108
|
/** @deprecated */
|
|
109
109
|
DynamicWidgetContextProvider, } from './lib/widgets/DynamicWidget/context';
|
|
110
|
-
export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, } from './lib/utils/hooks';
|
|
110
|
+
export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, useSelectWalletOption, } from './lib/utils/hooks';
|
|
111
111
|
export { useUserUpdateRequest, useWalletConnectorEvent, } from './lib/utils/hooks';
|
|
112
112
|
export { type VerifyOtp, useOtpVerificationRequest, } from './lib/utils/hooks/authenticationHooks/';
|
|
113
113
|
export type { UpdateUserFieldsArg } from './lib/utils/hooks/';
|
package/src/index.js
CHANGED
|
@@ -144,6 +144,7 @@ export { useDynamicModals } from './lib/utils/hooks/useDynamicModals/useDynamicM
|
|
|
144
144
|
export { useMfa } from './lib/utils/hooks/useMfa/useMfa.js';
|
|
145
145
|
export { useTokenBalances } from './lib/utils/hooks/useTokenBalances/useTokenBalances.js';
|
|
146
146
|
export { useRefreshUser } from './lib/utils/hooks/useRefreshUser/useRefreshUser.js';
|
|
147
|
+
export { useSelectWalletOption } from './lib/utils/hooks/useSelectWalletOption/useSelectWalletOption.js';
|
|
147
148
|
export { DynamicConnectButton } from './lib/components/DynamicConnectButton/DynamicConnectButton.js';
|
|
148
149
|
import './lib/components/InlineWidget/InlineWidget.js';
|
|
149
150
|
export { IsBrowser } from './lib/components/IsBrowser/IsBrowser.js';
|
package/src/lib/Main.cjs
CHANGED
|
@@ -75,13 +75,13 @@ require('formik');
|
|
|
75
75
|
var DynamicAuthModal = require('./modals/DynamicAuthModal/DynamicAuthModal.cjs');
|
|
76
76
|
require('./views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
77
77
|
require('./context/MfaSettingsContext/MfaSettingsContext.cjs');
|
|
78
|
+
require('./context/WalletGroupContext/WalletGroupContext.cjs');
|
|
78
79
|
var useInternalDynamicContext = require('./context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
79
80
|
require('./widgets/DynamicBridgeWidget/context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.cjs');
|
|
80
81
|
require('./widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
81
82
|
require('./widgets/DynamicWidget/components/DynamicWidgetCard/DynamicWidgetCard.cjs');
|
|
82
83
|
var index = require('./context/FooterAnimationContext/index.cjs');
|
|
83
84
|
var SocialRedirectContext = require('./context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
84
|
-
require('./context/WalletGroupContext/WalletGroupContext.cjs');
|
|
85
85
|
require('./widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
86
86
|
require('./widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
87
87
|
require('./context/WidgetRegistry/WidgetRegistryContextProvider.cjs');
|
package/src/lib/Main.js
CHANGED
|
@@ -71,13 +71,13 @@ import 'formik';
|
|
|
71
71
|
import { DynamicAuthModal } from './modals/DynamicAuthModal/DynamicAuthModal.js';
|
|
72
72
|
import './views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
73
73
|
import './context/MfaSettingsContext/MfaSettingsContext.js';
|
|
74
|
+
import './context/WalletGroupContext/WalletGroupContext.js';
|
|
74
75
|
import { useInternalDynamicContext } from './context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
75
76
|
import './widgets/DynamicBridgeWidget/context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.js';
|
|
76
77
|
import './widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
77
78
|
import './widgets/DynamicWidget/components/DynamicWidgetCard/DynamicWidgetCard.js';
|
|
78
79
|
import { FooterAnimationContextProvider } from './context/FooterAnimationContext/index.js';
|
|
79
80
|
import { useSocialRedirectContext } from './context/SocialRedirectContext/SocialRedirectContext.js';
|
|
80
|
-
import './context/WalletGroupContext/WalletGroupContext.js';
|
|
81
81
|
import './widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
82
82
|
import './widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
83
83
|
import './context/WidgetRegistry/WidgetRegistryContextProvider.js';
|
package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs
CHANGED
|
@@ -23,6 +23,7 @@ require('../../utils/constants/colors.cjs');
|
|
|
23
23
|
require('../../utils/constants/values.cjs');
|
|
24
24
|
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
25
25
|
require('../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
26
|
+
var useEffectOnce = require('../../shared/utils/hooks/useEffectOnce/useEffectOnce.cjs');
|
|
26
27
|
require('@dynamic-labs/utils');
|
|
27
28
|
require('../../shared/consts/index.cjs');
|
|
28
29
|
var IconButton = require('../IconButton/IconButton.cjs');
|
|
@@ -102,13 +103,23 @@ require('../../context/ConnectWithOtpContext/constants.cjs');
|
|
|
102
103
|
require('../../context/ReinitializeContext/ReinitializeContextProvider.cjs');
|
|
103
104
|
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
104
105
|
|
|
105
|
-
const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBack, copykey, title, error, appOrigin, appLogoUrl, appName, onClickSend, disableSendButton, displayPoweredByDynamicFooter = false, alert, children, }) => {
|
|
106
|
+
const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBack, copykey, title, error, appOrigin, appLogoUrl, appName, onClickSend, disableSendButton, displayPoweredByDynamicFooter = false, alert, children, hideModal, onSuccess, }) => {
|
|
106
107
|
const { t } = reactI18next.useTranslation();
|
|
107
108
|
const { isTurnkeyWallet } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
108
109
|
const { setShowAuthFlow, walletConnector } = useInternalDynamicContext.useInternalDynamicContext();
|
|
109
110
|
const { setView } = ViewContext.useViewContext();
|
|
110
111
|
const { userNeedsCrossDomainPasskey } = PasskeyContext.usePasskeyContext();
|
|
111
112
|
const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery.usePasskeyRecovery();
|
|
113
|
+
const handleRecovery = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
+
if (yield shouldInitRecovery())
|
|
115
|
+
yield initPasskeyRecoveryProcess('email', 'sendTransaction');
|
|
116
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess('callHandlerOutsideModal');
|
|
117
|
+
});
|
|
118
|
+
useEffectOnce.useEffectOnce(() => {
|
|
119
|
+
if (hideModal) {
|
|
120
|
+
handleRecovery();
|
|
121
|
+
}
|
|
122
|
+
});
|
|
112
123
|
const closeButton = onClickClose && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickClose, "data-testid": 'close', disabled: isLoading, children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
113
124
|
const backButton = onClickBack && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
114
125
|
const handleSubmitWithChecks = (e) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -134,7 +145,7 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
|
|
|
134
145
|
}
|
|
135
146
|
onClickSend(e);
|
|
136
147
|
});
|
|
137
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: (props) => (jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(signCircle.ReactComponent, Object.assign({}, props)) })), iconSize: 64, isSpinning: true }) }), jsxRuntime.jsx(PasskeyCreatedSuccessBanner.PasskeyCreatedSuccessBanner, {}), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__body', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'transaction-confirmation__title', copykey: copykey, children: title }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: error && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__error', children: jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__content', children: [jsxRuntime.jsx("div", { className: 'transaction-confirmation__app-origin-tile', children: jsxRuntime.jsx(AppOriginTile.AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }) }), jsxRuntime.jsx("div", { className: 'transaction-confirmation__rows', children: children })] }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: alert && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__warning', children: alert })) }), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__actions', children: [onClickClose && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'secondary', onClick: onClickClose, expanded: true, buttonPadding: 'large', disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'primary', buttonPadding: 'large', onClick: handleSubmitWithChecks, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.confirm_button', children: t('dyn_send_transaction.confirmation.confirm_button') })] }), displayPoweredByDynamicFooter && (jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' }))] })] }));
|
|
148
|
+
return hideModal ? null : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: (props) => (jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(signCircle.ReactComponent, Object.assign({}, props)) })), iconSize: 64, isSpinning: true }) }), jsxRuntime.jsx(PasskeyCreatedSuccessBanner.PasskeyCreatedSuccessBanner, {}), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__body', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'transaction-confirmation__title', copykey: copykey, children: title }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: error && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__error', children: jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__content', children: [jsxRuntime.jsx("div", { className: 'transaction-confirmation__app-origin-tile', children: jsxRuntime.jsx(AppOriginTile.AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }) }), jsxRuntime.jsx("div", { className: 'transaction-confirmation__rows', children: children })] }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: alert && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__warning', children: alert })) }), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__actions', children: [onClickClose && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'secondary', onClick: onClickClose, expanded: true, buttonPadding: 'large', disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'primary', buttonPadding: 'large', onClick: handleSubmitWithChecks, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.confirm_button', children: t('dyn_send_transaction.confirmation.confirm_button') })] }), displayPoweredByDynamicFooter && (jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' }))] })] }));
|
|
138
149
|
};
|
|
139
150
|
|
|
140
151
|
exports.TransactionConfirmationPageLayout = TransactionConfirmationPageLayout;
|
package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.d.ts
CHANGED
|
@@ -11,8 +11,10 @@ type TransactionConfirmationPageLayoutProps = {
|
|
|
11
11
|
onClickBack?: MouseEventHandler<HTMLButtonElement>;
|
|
12
12
|
onClickClose?: MouseEventHandler<HTMLButtonElement>;
|
|
13
13
|
onClickSend: MouseEventHandler<HTMLButtonElement>;
|
|
14
|
+
onSuccess: ((transactionResponse: string) => void) | undefined;
|
|
14
15
|
title?: ReactNode;
|
|
15
16
|
alert?: ReactNode;
|
|
17
|
+
hideModal?: boolean;
|
|
16
18
|
} & CopyKey;
|
|
17
19
|
export declare const TransactionConfirmationPageLayout: FC<PropsWithChildren<TransactionConfirmationPageLayoutProps>>;
|
|
18
20
|
export {};
|
package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js
CHANGED
|
@@ -19,6 +19,7 @@ import '../../utils/constants/colors.js';
|
|
|
19
19
|
import '../../utils/constants/values.js';
|
|
20
20
|
import '../../shared/utils/classes/storage/localStorage.js';
|
|
21
21
|
import '../../shared/utils/classes/storage/sessionStorage.js';
|
|
22
|
+
import { useEffectOnce } from '../../shared/utils/hooks/useEffectOnce/useEffectOnce.js';
|
|
22
23
|
import '@dynamic-labs/utils';
|
|
23
24
|
import '../../shared/consts/index.js';
|
|
24
25
|
import { IconButton } from '../IconButton/IconButton.js';
|
|
@@ -98,13 +99,23 @@ import '../../context/ConnectWithOtpContext/constants.js';
|
|
|
98
99
|
import '../../context/ReinitializeContext/ReinitializeContextProvider.js';
|
|
99
100
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
100
101
|
|
|
101
|
-
const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBack, copykey, title, error, appOrigin, appLogoUrl, appName, onClickSend, disableSendButton, displayPoweredByDynamicFooter = false, alert, children, }) => {
|
|
102
|
+
const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBack, copykey, title, error, appOrigin, appLogoUrl, appName, onClickSend, disableSendButton, displayPoweredByDynamicFooter = false, alert, children, hideModal, onSuccess, }) => {
|
|
102
103
|
const { t } = useTranslation();
|
|
103
104
|
const { isTurnkeyWallet } = useIsTurnkeyWallet();
|
|
104
105
|
const { setShowAuthFlow, walletConnector } = useInternalDynamicContext();
|
|
105
106
|
const { setView } = useViewContext();
|
|
106
107
|
const { userNeedsCrossDomainPasskey } = usePasskeyContext();
|
|
107
108
|
const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery();
|
|
109
|
+
const handleRecovery = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
|
+
if (yield shouldInitRecovery())
|
|
111
|
+
yield initPasskeyRecoveryProcess('email', 'sendTransaction');
|
|
112
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess('callHandlerOutsideModal');
|
|
113
|
+
});
|
|
114
|
+
useEffectOnce(() => {
|
|
115
|
+
if (hideModal) {
|
|
116
|
+
handleRecovery();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
108
119
|
const closeButton = onClickClose && (jsx(IconButton, { type: 'button', onClick: onClickClose, "data-testid": 'close', disabled: isLoading, children: jsx(SvgClose, {}) }));
|
|
109
120
|
const backButton = onClickBack && (jsx(IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
110
121
|
const handleSubmitWithChecks = (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -130,7 +141,7 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
|
|
|
130
141
|
}
|
|
131
142
|
onClickSend(e);
|
|
132
143
|
});
|
|
133
|
-
return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsx(IconWithSpinner, { Icon: (props) => (jsx(Icon, { color: 'brand-primary', children: jsx(SvgSignCircle, Object.assign({}, props)) })), iconSize: 64, isSpinning: true }) }), jsx(PasskeyCreatedSuccessBanner, {}), jsxs("div", { className: 'transaction-confirmation__body', children: [jsx(Typography, { variant: 'title', color: 'primary', className: 'transaction-confirmation__title', copykey: copykey, children: title }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: error && (jsx("div", { className: 'transaction-confirmation__error', children: jsx(Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsxs("div", { className: 'transaction-confirmation__content', children: [jsx("div", { className: 'transaction-confirmation__app-origin-tile', children: jsx(AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }) }), jsx("div", { className: 'transaction-confirmation__rows', children: children })] }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: alert && (jsx("div", { className: 'transaction-confirmation__warning', children: alert })) }), jsxs("div", { className: 'transaction-confirmation__actions', children: [onClickClose && (jsx(TypographyButton, { buttonVariant: 'secondary', onClick: onClickClose, expanded: true, buttonPadding: 'large', disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsx(TypographyButton, { buttonVariant: 'primary', buttonPadding: 'large', onClick: handleSubmitWithChecks, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.confirm_button', children: t('dyn_send_transaction.confirmation.confirm_button') })] }), displayPoweredByDynamicFooter && (jsx(PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' }))] })] }));
|
|
144
|
+
return hideModal ? null : (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsx(IconWithSpinner, { Icon: (props) => (jsx(Icon, { color: 'brand-primary', children: jsx(SvgSignCircle, Object.assign({}, props)) })), iconSize: 64, isSpinning: true }) }), jsx(PasskeyCreatedSuccessBanner, {}), jsxs("div", { className: 'transaction-confirmation__body', children: [jsx(Typography, { variant: 'title', color: 'primary', className: 'transaction-confirmation__title', copykey: copykey, children: title }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: error && (jsx("div", { className: 'transaction-confirmation__error', children: jsx(Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsxs("div", { className: 'transaction-confirmation__content', children: [jsx("div", { className: 'transaction-confirmation__app-origin-tile', children: jsx(AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }) }), jsx("div", { className: 'transaction-confirmation__rows', children: children })] }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: alert && (jsx("div", { className: 'transaction-confirmation__warning', children: alert })) }), jsxs("div", { className: 'transaction-confirmation__actions', children: [onClickClose && (jsx(TypographyButton, { buttonVariant: 'secondary', onClick: onClickClose, expanded: true, buttonPadding: 'large', disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsx(TypographyButton, { buttonVariant: 'primary', buttonPadding: 'large', onClick: handleSubmitWithChecks, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.confirm_button', children: t('dyn_send_transaction.confirmation.confirm_button') })] }), displayPoweredByDynamicFooter && (jsx(PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' }))] })] }));
|
|
134
145
|
};
|
|
135
146
|
|
|
136
147
|
export { TransactionConfirmationPageLayout };
|
|
@@ -68,6 +68,7 @@ var useWalletConnectorNetwork = require('../../utils/hooks/useWalletConnectorNet
|
|
|
68
68
|
var useSetWalletConnectorFetchers = require('../../utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs');
|
|
69
69
|
var useSendDynamicProps = require('../../utils/hooks/useSendDynamicProps/useSendDynamicProps.cjs');
|
|
70
70
|
var MfaSettingsContext = require('../MfaSettingsContext/MfaSettingsContext.cjs');
|
|
71
|
+
var WalletGroupContext = require('../WalletGroupContext/WalletGroupContext.cjs');
|
|
71
72
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
72
73
|
require('../../components/IconButton/IconButton.cjs');
|
|
73
74
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
@@ -89,7 +90,6 @@ var SocialRedirectContext = require('../SocialRedirectContext/SocialRedirectCont
|
|
|
89
90
|
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
90
91
|
require('@hcaptcha/react-hcaptcha');
|
|
91
92
|
require('../FooterAnimationContext/index.cjs');
|
|
92
|
-
var WalletGroupContext = require('../WalletGroupContext/WalletGroupContext.cjs');
|
|
93
93
|
var IpConfigurationContext = require('../IpConfigurationContext/IpConfigurationContext.cjs');
|
|
94
94
|
var PasskeyContext = require('../PasskeyContext/PasskeyContext.cjs');
|
|
95
95
|
var SyncAuthFlow = require('../../components/SyncAuthFlow/SyncAuthFlow.cjs');
|
|
@@ -311,6 +311,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
311
311
|
connectedInfo: connectedWalletsInfo[0],
|
|
312
312
|
connectedWallets,
|
|
313
313
|
enableInstrumentation,
|
|
314
|
+
environmentId,
|
|
314
315
|
primaryWallet,
|
|
315
316
|
projectSettings,
|
|
316
317
|
user: user !== null && user !== void 0 ? user : unauthenticatedUser,
|
|
@@ -64,6 +64,7 @@ import { useWalletConnectorNetwork } from '../../utils/hooks/useWalletConnectorN
|
|
|
64
64
|
import { useSetWalletConnectorFetchers } from '../../utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js';
|
|
65
65
|
import { useSendDynamicProps } from '../../utils/hooks/useSendDynamicProps/useSendDynamicProps.js';
|
|
66
66
|
import { MfaSettingsContextProvider } from '../MfaSettingsContext/MfaSettingsContext.js';
|
|
67
|
+
import { WalletGroupContextProvider } from '../WalletGroupContext/WalletGroupContext.js';
|
|
67
68
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
68
69
|
import '../../components/IconButton/IconButton.js';
|
|
69
70
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
@@ -85,7 +86,6 @@ import { SocialRedirectContextProvider } from '../SocialRedirectContext/SocialRe
|
|
|
85
86
|
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
86
87
|
import '@hcaptcha/react-hcaptcha';
|
|
87
88
|
import '../FooterAnimationContext/index.js';
|
|
88
|
-
import { WalletGroupContextProvider } from '../WalletGroupContext/WalletGroupContext.js';
|
|
89
89
|
import { IpConfigurationContextProvider } from '../IpConfigurationContext/IpConfigurationContext.js';
|
|
90
90
|
import { PasskeyContextProvider } from '../PasskeyContext/PasskeyContext.js';
|
|
91
91
|
import { SyncAuthFlow } from '../../components/SyncAuthFlow/SyncAuthFlow.js';
|
|
@@ -307,6 +307,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
307
307
|
connectedInfo: connectedWalletsInfo[0],
|
|
308
308
|
connectedWallets,
|
|
309
309
|
enableInstrumentation,
|
|
310
|
+
environmentId,
|
|
310
311
|
primaryWallet,
|
|
311
312
|
projectSettings,
|
|
312
313
|
user: user !== null && user !== void 0 ? user : unauthenticatedUser,
|
|
@@ -50,6 +50,7 @@ require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
|
50
50
|
require('@dynamic-labs/rpc-providers');
|
|
51
51
|
require('react-i18next');
|
|
52
52
|
require('../../context/MfaSettingsContext/MfaSettingsContext.cjs');
|
|
53
|
+
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
53
54
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
54
55
|
require('../../components/IconButton/IconButton.cjs');
|
|
55
56
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
@@ -71,7 +72,6 @@ require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
|
71
72
|
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
72
73
|
require('@hcaptcha/react-hcaptcha');
|
|
73
74
|
require('../../context/FooterAnimationContext/index.cjs');
|
|
74
|
-
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
75
75
|
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
76
76
|
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
77
77
|
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
@@ -46,6 +46,7 @@ import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
|
46
46
|
import '@dynamic-labs/rpc-providers';
|
|
47
47
|
import 'react-i18next';
|
|
48
48
|
import '../../context/MfaSettingsContext/MfaSettingsContext.js';
|
|
49
|
+
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
49
50
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
50
51
|
import '../../components/IconButton/IconButton.js';
|
|
51
52
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
@@ -67,7 +68,6 @@ import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
|
67
68
|
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
68
69
|
import '@hcaptcha/react-hcaptcha';
|
|
69
70
|
import '../../context/FooterAnimationContext/index.js';
|
|
70
|
-
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
71
71
|
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
72
72
|
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
73
73
|
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
@@ -47,6 +47,7 @@ require('../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
|
47
47
|
require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
48
48
|
require('@dynamic-labs/rpc-providers');
|
|
49
49
|
require('../../context/MfaSettingsContext/MfaSettingsContext.cjs');
|
|
50
|
+
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
50
51
|
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
51
52
|
require('../../components/Alert/Alert.cjs');
|
|
52
53
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
@@ -70,7 +71,6 @@ require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
|
70
71
|
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
71
72
|
require('@hcaptcha/react-hcaptcha');
|
|
72
73
|
require('../../context/FooterAnimationContext/index.cjs');
|
|
73
|
-
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
74
74
|
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
75
75
|
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
76
76
|
var useConfirmationPortal = require('../../utils/hooks/useConfirmationPortal/useConfirmationPortal.cjs');
|
|
@@ -43,6 +43,7 @@ import '../../context/FieldsStateContext/FieldsStateContext.js';
|
|
|
43
43
|
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
44
44
|
import '@dynamic-labs/rpc-providers';
|
|
45
45
|
import '../../context/MfaSettingsContext/MfaSettingsContext.js';
|
|
46
|
+
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
46
47
|
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
47
48
|
import '../../components/Alert/Alert.js';
|
|
48
49
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
@@ -66,7 +67,6 @@ import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
|
66
67
|
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
67
68
|
import '@hcaptcha/react-hcaptcha';
|
|
68
69
|
import '../../context/FooterAnimationContext/index.js';
|
|
69
|
-
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
70
70
|
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
71
71
|
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
72
72
|
import { useConfirmationPortal } from '../../utils/hooks/useConfirmationPortal/useConfirmationPortal.js';
|
|
@@ -24,6 +24,7 @@ require('../../utils/constants/colors.cjs');
|
|
|
24
24
|
require('../../utils/constants/values.cjs');
|
|
25
25
|
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
26
26
|
require('../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
27
|
+
var useEffectOnce = require('../../shared/utils/hooks/useEffectOnce/useEffectOnce.cjs');
|
|
27
28
|
var usePreventPageScroll = require('../../shared/utils/hooks/usePreventPageScroll/usePreventPageScroll.cjs');
|
|
28
29
|
var index = require('../../shared/consts/index.cjs');
|
|
29
30
|
var Icon = require('../../components/Icon/Icon.cjs');
|
|
@@ -109,7 +110,7 @@ var NeedHelpSection = require('../../components/NeedHelpSection/NeedHelpSection.
|
|
|
109
110
|
require('qrcode');
|
|
110
111
|
var SignMessagePreview = require('../../components/SignMessagePreview/SignMessagePreview.cjs');
|
|
111
112
|
|
|
112
|
-
const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message, handler, onReject, onSignMessage, }) => {
|
|
113
|
+
const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message, handler, onReject, onSignMessage, hideModal, }) => {
|
|
113
114
|
usePreventPageScroll.usePreventPageScroll(true);
|
|
114
115
|
const didConfirmRef = React.useRef(false);
|
|
115
116
|
const [show, setShow] = React.useState(true);
|
|
@@ -152,16 +153,20 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
|
|
|
152
153
|
}
|
|
153
154
|
onReject(signMessageError || new Error('user rejected signing'));
|
|
154
155
|
}, [signedMessage, onSignMessage, onReject, signMessageError]);
|
|
155
|
-
const handleMessageSign = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
156
|
+
const handleMessageSign = (signWithoutModal) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
157
|
+
if (yield shouldInitRecovery()) {
|
|
158
|
+
yield initPasskeyRecoveryProcess('email', 'signMessage');
|
|
159
|
+
}
|
|
160
|
+
if (signWithoutModal === true) {
|
|
161
|
+
onSignMessage('callHandlerOutsideModal');
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
156
164
|
if (walletConnectorCore.isSessionKeyCompatibleWalletConnector(walletConnector) ||
|
|
157
165
|
((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev' &&
|
|
158
166
|
walletConnectorCore.isSessionKeyCompatibleWalletConnector(walletConnector.getEOAConnector()))) {
|
|
159
167
|
confirm();
|
|
160
168
|
return;
|
|
161
169
|
}
|
|
162
|
-
if (yield shouldInitRecovery()) {
|
|
163
|
-
yield initPasskeyRecoveryProcess('email', 'signMessage');
|
|
164
|
-
}
|
|
165
170
|
if (isTurnkeyWallet && userNeedsCrossDomainPasskey) {
|
|
166
171
|
setView('passkey-new-domain-detected');
|
|
167
172
|
setShowAuthFlow(true, {
|
|
@@ -175,8 +180,13 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
|
|
|
175
180
|
}
|
|
176
181
|
confirm();
|
|
177
182
|
});
|
|
183
|
+
useEffectOnce.useEffectOnce(() => {
|
|
184
|
+
if (hideModal) {
|
|
185
|
+
handleMessageSign(true);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
178
188
|
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleOnReject, "data-testid": 'close', disabled: isLoading, children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
179
|
-
return (jsxRuntime.jsx(Portal.Portal, { handleClose: handleOnReject, isShown: show, zIndex: index.authModalZIndex, withBackdrop: true, elementId: 'dynamic-sign-message', transitionEvents: {
|
|
189
|
+
return hideModal ? null : (jsxRuntime.jsx(Portal.Portal, { handleClose: handleOnReject, isShown: show, zIndex: index.authModalZIndex, withBackdrop: true, elementId: 'dynamic-sign-message', transitionEvents: {
|
|
180
190
|
onUnmount: handleOnModalUnmount,
|
|
181
191
|
}, children: jsxRuntime.jsx(Modal.Modal, { children: jsxRuntime.jsxs(ModalCard.ModalCard, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, alignContent: 'bottom', children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: (props) => (jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(signCircle.ReactComponent, Object.assign({}, props)) })), iconSize: 64, isSpinning: true }) }), jsxRuntime.jsx(PasskeyCreatedSuccessBanner.PasskeyCreatedSuccessBanner, {}), jsxRuntime.jsxs("div", { className: 'sign-message-confirmation__body', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'sign-message-confirmation__title', copykey: 'dyn_sign_message.title', children: t('dyn_sign_message.title') }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: signMessageError && (jsxRuntime.jsx("div", { className: 'sign-message-confirmation__error', children: jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: errorText }) })) }), jsxRuntime.jsxs("div", { className: 'sign-message-confirmation__message-container', children: [jsxRuntime.jsx(AppOriginTile.AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }), jsxRuntime.jsx("div", { className: 'sign-message-confirmation__message', children: jsxRuntime.jsx(SignMessagePreview.SignMessagePreview, { message: message.toString() }) })] }), jsxRuntime.jsxs("div", { className: 'sign-message-confirmation__actions', children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'secondary', onClick: handleOnReject, expanded: true, buttonPadding: 'large', disabled: isLoading, copykey: 'dyn_sign_message.cancel_button', children: t('dyn_sign_message.cancel_button') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'primary', buttonPadding: 'large', onClick: handleMessageSign, expanded: true, loading: isLoading, copykey: 'dyn_sign_message.sign_button', dataTestId: 'sign-button', children: t('dyn_sign_message.sign_button') })] }), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, {}), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, {})] })] }) }) }));
|
|
182
192
|
};
|
|
@@ -20,6 +20,7 @@ import '../../utils/constants/colors.js';
|
|
|
20
20
|
import '../../utils/constants/values.js';
|
|
21
21
|
import '../../shared/utils/classes/storage/localStorage.js';
|
|
22
22
|
import '../../shared/utils/classes/storage/sessionStorage.js';
|
|
23
|
+
import { useEffectOnce } from '../../shared/utils/hooks/useEffectOnce/useEffectOnce.js';
|
|
23
24
|
import { usePreventPageScroll } from '../../shared/utils/hooks/usePreventPageScroll/usePreventPageScroll.js';
|
|
24
25
|
import { authModalZIndex } from '../../shared/consts/index.js';
|
|
25
26
|
import { Icon } from '../../components/Icon/Icon.js';
|
|
@@ -105,7 +106,7 @@ import { NeedHelpSection } from '../../components/NeedHelpSection/NeedHelpSectio
|
|
|
105
106
|
import 'qrcode';
|
|
106
107
|
import { SignMessagePreview } from '../../components/SignMessagePreview/SignMessagePreview.js';
|
|
107
108
|
|
|
108
|
-
const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message, handler, onReject, onSignMessage, }) => {
|
|
109
|
+
const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message, handler, onReject, onSignMessage, hideModal, }) => {
|
|
109
110
|
usePreventPageScroll(true);
|
|
110
111
|
const didConfirmRef = useRef(false);
|
|
111
112
|
const [show, setShow] = useState(true);
|
|
@@ -148,16 +149,20 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
|
|
|
148
149
|
}
|
|
149
150
|
onReject(signMessageError || new Error('user rejected signing'));
|
|
150
151
|
}, [signedMessage, onSignMessage, onReject, signMessageError]);
|
|
151
|
-
const handleMessageSign = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
152
|
+
const handleMessageSign = (signWithoutModal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
153
|
+
if (yield shouldInitRecovery()) {
|
|
154
|
+
yield initPasskeyRecoveryProcess('email', 'signMessage');
|
|
155
|
+
}
|
|
156
|
+
if (signWithoutModal === true) {
|
|
157
|
+
onSignMessage('callHandlerOutsideModal');
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
152
160
|
if (isSessionKeyCompatibleWalletConnector(walletConnector) ||
|
|
153
161
|
((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev' &&
|
|
154
162
|
isSessionKeyCompatibleWalletConnector(walletConnector.getEOAConnector()))) {
|
|
155
163
|
confirm();
|
|
156
164
|
return;
|
|
157
165
|
}
|
|
158
|
-
if (yield shouldInitRecovery()) {
|
|
159
|
-
yield initPasskeyRecoveryProcess('email', 'signMessage');
|
|
160
|
-
}
|
|
161
166
|
if (isTurnkeyWallet && userNeedsCrossDomainPasskey) {
|
|
162
167
|
setView('passkey-new-domain-detected');
|
|
163
168
|
setShowAuthFlow(true, {
|
|
@@ -171,8 +176,13 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
|
|
|
171
176
|
}
|
|
172
177
|
confirm();
|
|
173
178
|
});
|
|
179
|
+
useEffectOnce(() => {
|
|
180
|
+
if (hideModal) {
|
|
181
|
+
handleMessageSign(true);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
174
184
|
const closeButton = (jsx(IconButton, { type: 'button', onClick: handleOnReject, "data-testid": 'close', disabled: isLoading, children: jsx(SvgClose, {}) }));
|
|
175
|
-
return (jsx(Portal, { handleClose: handleOnReject, isShown: show, zIndex: authModalZIndex, withBackdrop: true, elementId: 'dynamic-sign-message', transitionEvents: {
|
|
185
|
+
return hideModal ? null : (jsx(Portal, { handleClose: handleOnReject, isShown: show, zIndex: authModalZIndex, withBackdrop: true, elementId: 'dynamic-sign-message', transitionEvents: {
|
|
176
186
|
onUnmount: handleOnModalUnmount,
|
|
177
187
|
}, children: jsx(Modal, { children: jsxs(ModalCard, { children: [jsx(ModalHeader, { trailing: closeButton, alignContent: 'bottom', children: jsx(IconWithSpinner, { Icon: (props) => (jsx(Icon, { color: 'brand-primary', children: jsx(SvgSignCircle, Object.assign({}, props)) })), iconSize: 64, isSpinning: true }) }), jsx(PasskeyCreatedSuccessBanner, {}), jsxs("div", { className: 'sign-message-confirmation__body', children: [jsx(Typography, { variant: 'title', color: 'primary', className: 'sign-message-confirmation__title', copykey: 'dyn_sign_message.title', children: t('dyn_sign_message.title') }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: signMessageError && (jsx("div", { className: 'sign-message-confirmation__error', children: jsx(ErrorContainer, { children: errorText }) })) }), jsxs("div", { className: 'sign-message-confirmation__message-container', children: [jsx(AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }), jsx("div", { className: 'sign-message-confirmation__message', children: jsx(SignMessagePreview, { message: message.toString() }) })] }), jsxs("div", { className: 'sign-message-confirmation__actions', children: [jsx(TypographyButton, { buttonVariant: 'secondary', onClick: handleOnReject, expanded: true, buttonPadding: 'large', disabled: isLoading, copykey: 'dyn_sign_message.cancel_button', children: t('dyn_sign_message.cancel_button') }), jsx(TypographyButton, { buttonVariant: 'primary', buttonPadding: 'large', onClick: handleMessageSign, expanded: true, loading: isLoading, copykey: 'dyn_sign_message.sign_button', dataTestId: 'sign-button', children: t('dyn_sign_message.sign_button') })] }), jsx(NeedHelpSection, {}), jsx(PoweredByDynamic, {})] })] }) }) }));
|
|
178
188
|
};
|
|
@@ -8,6 +8,7 @@ export type SignMessageConfirmationModalProps = {
|
|
|
8
8
|
message: string | ArrayLike<number>;
|
|
9
9
|
onReject: (error: unknown) => void;
|
|
10
10
|
onSignMessage: (signedMessage: string) => void;
|
|
11
|
+
hideModal: boolean;
|
|
11
12
|
};
|
|
12
13
|
export type SignMessageConfirmationModalComponent = FC<SignMessageConfirmationModalProps>;
|
|
13
14
|
export type SignMessageError = Error & PasskeyError & {
|
|
@@ -46,6 +46,7 @@ require('../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
|
46
46
|
require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
47
47
|
require('@dynamic-labs/rpc-providers');
|
|
48
48
|
require('../../context/MfaSettingsContext/MfaSettingsContext.cjs');
|
|
49
|
+
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
49
50
|
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
50
51
|
require('../../components/Alert/Alert.cjs');
|
|
51
52
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
@@ -69,7 +70,6 @@ require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
|
69
70
|
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
70
71
|
require('@hcaptcha/react-hcaptcha');
|
|
71
72
|
require('../../context/FooterAnimationContext/index.cjs');
|
|
72
|
-
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
73
73
|
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
74
74
|
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
75
75
|
var useConfirmationPortal = require('../../utils/hooks/useConfirmationPortal/useConfirmationPortal.cjs');
|
|
@@ -42,6 +42,7 @@ import '../../context/FieldsStateContext/FieldsStateContext.js';
|
|
|
42
42
|
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
43
43
|
import '@dynamic-labs/rpc-providers';
|
|
44
44
|
import '../../context/MfaSettingsContext/MfaSettingsContext.js';
|
|
45
|
+
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
45
46
|
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
46
47
|
import '../../components/Alert/Alert.js';
|
|
47
48
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
@@ -65,7 +66,6 @@ import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
|
65
66
|
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
66
67
|
import '@hcaptcha/react-hcaptcha';
|
|
67
68
|
import '../../context/FooterAnimationContext/index.js';
|
|
68
|
-
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
69
69
|
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
70
70
|
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
71
71
|
import { useConfirmationPortal } from '../../utils/hooks/useConfirmationPortal/useConfirmationPortal.js';
|
|
@@ -90,7 +90,7 @@ require('../../context/ReinitializeContext/ReinitializeContextProvider.cjs');
|
|
|
90
90
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
91
91
|
require('qrcode');
|
|
92
92
|
|
|
93
|
-
const TransactionConfirmationModal = ({ title, onReject, onTransactionResponseSuccess, transaction, copykey, walletConnector, }) => {
|
|
93
|
+
const TransactionConfirmationModal = ({ title, onReject, onTransactionResponseSuccess, transaction, copykey, walletConnector, hideModal, }) => {
|
|
94
94
|
usePreventPageScroll.usePreventPageScroll(true);
|
|
95
95
|
const [show, setShow] = React.useState(true);
|
|
96
96
|
const errorRef = React.useRef(null);
|
|
@@ -106,7 +106,7 @@ const TransactionConfirmationModal = ({ title, onReject, onTransactionResponseSu
|
|
|
106
106
|
}, [onTransactionResponseSuccess, onReject]);
|
|
107
107
|
return (jsxRuntime.jsx(Portal.Portal, { handleClose: closeModal, isShown: show, zIndex: index.authModalZIndex, withBackdrop: true, elementId: 'dynamic-send-transaction', transitionEvents: {
|
|
108
108
|
onUnmount: handleOnModalUnmount,
|
|
109
|
-
}, children: jsxRuntime.jsx(Modal.Modal, { children: jsxRuntime.jsx(ModalCard.ModalCard, { children: jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, { transaction: transaction, title: title, copykey: copykey, mutation: () => transaction.submit(), onClickClose: closeModal, onError: (error) => (errorRef.current = error), displayPoweredByDynamicFooter: true, walletConnector: walletConnector, onSuccess: (transactionResponse) => {
|
|
109
|
+
}, children: jsxRuntime.jsx(Modal.Modal, { children: jsxRuntime.jsx(ModalCard.ModalCard, { children: jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, { transaction: transaction, title: title, copykey: copykey, hideModal: hideModal, mutation: () => transaction.submit(), onClickClose: closeModal, onError: (error) => (errorRef.current = error), displayPoweredByDynamicFooter: true, walletConnector: walletConnector, onSuccess: (transactionResponse) => {
|
|
110
110
|
errorRef.current = null;
|
|
111
111
|
transactionResponseRef.current = transactionResponse;
|
|
112
112
|
closeModal();
|
|
@@ -86,7 +86,7 @@ import '../../context/ReinitializeContext/ReinitializeContextProvider.js';
|
|
|
86
86
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
87
87
|
import 'qrcode';
|
|
88
88
|
|
|
89
|
-
const TransactionConfirmationModal = ({ title, onReject, onTransactionResponseSuccess, transaction, copykey, walletConnector, }) => {
|
|
89
|
+
const TransactionConfirmationModal = ({ title, onReject, onTransactionResponseSuccess, transaction, copykey, walletConnector, hideModal, }) => {
|
|
90
90
|
usePreventPageScroll(true);
|
|
91
91
|
const [show, setShow] = useState(true);
|
|
92
92
|
const errorRef = useRef(null);
|
|
@@ -102,7 +102,7 @@ const TransactionConfirmationModal = ({ title, onReject, onTransactionResponseSu
|
|
|
102
102
|
}, [onTransactionResponseSuccess, onReject]);
|
|
103
103
|
return (jsx(Portal, { handleClose: closeModal, isShown: show, zIndex: authModalZIndex, withBackdrop: true, elementId: 'dynamic-send-transaction', transitionEvents: {
|
|
104
104
|
onUnmount: handleOnModalUnmount,
|
|
105
|
-
}, children: jsx(Modal, { children: jsx(ModalCard, { children: jsx(TransactionConfirmationView, { transaction: transaction, title: title, copykey: copykey, mutation: () => transaction.submit(), onClickClose: closeModal, onError: (error) => (errorRef.current = error), displayPoweredByDynamicFooter: true, walletConnector: walletConnector, onSuccess: (transactionResponse) => {
|
|
105
|
+
}, children: jsx(Modal, { children: jsx(ModalCard, { children: jsx(TransactionConfirmationView, { transaction: transaction, title: title, copykey: copykey, hideModal: hideModal, mutation: () => transaction.submit(), onClickClose: closeModal, onError: (error) => (errorRef.current = error), displayPoweredByDynamicFooter: true, walletConnector: walletConnector, onSuccess: (transactionResponse) => {
|
|
106
106
|
errorRef.current = null;
|
|
107
107
|
transactionResponseRef.current = transactionResponse;
|
|
108
108
|
closeModal();
|
|
@@ -8,5 +8,6 @@ export type TransactionConfirmationModalProps = {
|
|
|
8
8
|
title: ReactNode;
|
|
9
9
|
transaction: IUITransaction;
|
|
10
10
|
walletConnector: WalletConnector;
|
|
11
|
+
hideModal: boolean;
|
|
11
12
|
} & CopyKey;
|
|
12
13
|
export type TransactionConfirmationModalComponent = FC<TransactionConfirmationModalProps>;
|
|
@@ -7,7 +7,7 @@ var React = require('react');
|
|
|
7
7
|
var logger = require('../../../logger.cjs');
|
|
8
8
|
var index = require('../../functions/lastAuthenticatedAccount/index.cjs');
|
|
9
9
|
|
|
10
|
-
const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWallet, user, walletBook, enableInstrumentation, appName, }) => {
|
|
10
|
+
const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWallet, user, walletBook, enableInstrumentation, appName, environmentId, }) => {
|
|
11
11
|
var _a, _b;
|
|
12
12
|
// Once we declare the SDK as loaded, we do not ever want to flip back to false
|
|
13
13
|
const hasLoaded = React.useRef(false);
|
|
@@ -19,16 +19,16 @@ const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSe
|
|
|
19
19
|
// Calculate how long loading took and emit log
|
|
20
20
|
if (enableInstrumentation) {
|
|
21
21
|
const loadingTime = new Date().getTime() - loadingStart.current;
|
|
22
|
-
// User is already included in meta
|
|
23
|
-
const analysisParams = {
|
|
24
|
-
appName,
|
|
25
|
-
loadingTime,
|
|
26
|
-
primaryWalletId: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id,
|
|
27
|
-
projectDisplayName: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.displayName,
|
|
28
|
-
};
|
|
29
22
|
// Pass as default arg and as an object. The object value will be injected
|
|
30
23
|
// in the log later on, keeping its format as a number for calculation purposes
|
|
31
|
-
logger.logger.instrument(`SDK loaded in (ms) ${loadingTime}`,
|
|
24
|
+
logger.logger.instrument(`SDK loaded in (ms) ${loadingTime}`, {
|
|
25
|
+
appName,
|
|
26
|
+
environmentId,
|
|
27
|
+
key: 'sdkHasLoaded',
|
|
28
|
+
primaryWalletId: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id,
|
|
29
|
+
time: loadingTime,
|
|
30
|
+
userId: user === null || user === void 0 ? void 0 : user.userId,
|
|
31
|
+
});
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
if (hasLoaded.current)
|
|
@@ -13,6 +13,7 @@ type Props = {
|
|
|
13
13
|
walletBook: WalletBookSchema;
|
|
14
14
|
enableInstrumentation: boolean;
|
|
15
15
|
appName: string;
|
|
16
|
+
environmentId: string;
|
|
16
17
|
};
|
|
17
|
-
export declare const useGlobalLoading: ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWallet, user, walletBook, enableInstrumentation, appName, }: Props) => boolean;
|
|
18
|
+
export declare const useGlobalLoading: ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWallet, user, walletBook, enableInstrumentation, appName, environmentId, }: Props) => boolean;
|
|
18
19
|
export {};
|
|
@@ -3,7 +3,7 @@ import { useRef } from 'react';
|
|
|
3
3
|
import { logger } from '../../../logger.js';
|
|
4
4
|
import { lastAuthenticatedAccount } from '../../functions/lastAuthenticatedAccount/index.js';
|
|
5
5
|
|
|
6
|
-
const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWallet, user, walletBook, enableInstrumentation, appName, }) => {
|
|
6
|
+
const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWallet, user, walletBook, enableInstrumentation, appName, environmentId, }) => {
|
|
7
7
|
var _a, _b;
|
|
8
8
|
// Once we declare the SDK as loaded, we do not ever want to flip back to false
|
|
9
9
|
const hasLoaded = useRef(false);
|
|
@@ -15,16 +15,16 @@ const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSe
|
|
|
15
15
|
// Calculate how long loading took and emit log
|
|
16
16
|
if (enableInstrumentation) {
|
|
17
17
|
const loadingTime = new Date().getTime() - loadingStart.current;
|
|
18
|
-
// User is already included in meta
|
|
19
|
-
const analysisParams = {
|
|
20
|
-
appName,
|
|
21
|
-
loadingTime,
|
|
22
|
-
primaryWalletId: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id,
|
|
23
|
-
projectDisplayName: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.displayName,
|
|
24
|
-
};
|
|
25
18
|
// Pass as default arg and as an object. The object value will be injected
|
|
26
19
|
// in the log later on, keeping its format as a number for calculation purposes
|
|
27
|
-
logger.instrument(`SDK loaded in (ms) ${loadingTime}`,
|
|
20
|
+
logger.instrument(`SDK loaded in (ms) ${loadingTime}`, {
|
|
21
|
+
appName,
|
|
22
|
+
environmentId,
|
|
23
|
+
key: 'sdkHasLoaded',
|
|
24
|
+
primaryWalletId: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id,
|
|
25
|
+
time: loadingTime,
|
|
26
|
+
userId: user === null || user === void 0 ? void 0 : user.userId,
|
|
27
|
+
});
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
if (hasLoaded.current)
|
|
@@ -60,3 +60,4 @@ export { useSyncEmbeddedWalletFlow } from './useSyncEmbeddedWalletFlow';
|
|
|
60
60
|
export { useSyncOnboardingFlow } from './useSyncOnboardingFlow';
|
|
61
61
|
export { useExternalAuth } from './useExternalAuth';
|
|
62
62
|
export { useRefreshUser } from './useRefreshUser';
|
|
63
|
+
export { useSelectWalletOption } from './useSelectWalletOption';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSelectWalletOption } from './useSelectWalletOption';
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
9
|
+
var utils = require('@dynamic-labs/utils');
|
|
10
|
+
require('react');
|
|
11
|
+
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
12
|
+
require('@dynamic-labs/sdk-api-core');
|
|
13
|
+
require('../../../shared/logger.cjs');
|
|
14
|
+
require('@dynamic-labs/iconic');
|
|
15
|
+
require('react/jsx-runtime');
|
|
16
|
+
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
17
|
+
require('../../constants/colors.cjs');
|
|
18
|
+
require('../../constants/values.cjs');
|
|
19
|
+
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
20
|
+
require('../../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
21
|
+
var isWalletGroup = require('../../functions/walletListBuilder/utils/isWalletGroup/isWalletGroup.cjs');
|
|
22
|
+
require('../../../shared/consts/index.cjs');
|
|
23
|
+
require('../../../events/dynamicEvents.cjs');
|
|
24
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
25
|
+
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
26
|
+
require('@dynamic-labs/multi-wallet');
|
|
27
|
+
require('react-international-phone');
|
|
28
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
29
|
+
require('@dynamic-labs/store');
|
|
30
|
+
require('../../../locale/locale.cjs');
|
|
31
|
+
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
32
|
+
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
33
|
+
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
34
|
+
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
35
|
+
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
36
|
+
require('react-dom');
|
|
37
|
+
require('../../../context/WalletContext/WalletContext.cjs');
|
|
38
|
+
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
39
|
+
require('../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
40
|
+
require('@dynamic-labs/types');
|
|
41
|
+
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
42
|
+
require('yup');
|
|
43
|
+
require('../../../context/MockContext/MockContext.cjs');
|
|
44
|
+
require('../../../views/CollectUserDataView/useFields.cjs');
|
|
45
|
+
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
46
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
47
|
+
require('@dynamic-labs/rpc-providers');
|
|
48
|
+
var useWalletItemActions = require('../useWalletItemActions/useWalletItemActions.cjs');
|
|
49
|
+
require('react-i18next');
|
|
50
|
+
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
51
|
+
require('../../../components/Alert/Alert.cjs');
|
|
52
|
+
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
53
|
+
require('../../../components/IconButton/IconButton.cjs');
|
|
54
|
+
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
55
|
+
require('../../../components/Input/Input.cjs');
|
|
56
|
+
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
57
|
+
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
58
|
+
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
59
|
+
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
60
|
+
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
61
|
+
require('../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
62
|
+
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
63
|
+
require('../../../components/Popper/Popper/Popper.cjs');
|
|
64
|
+
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
65
|
+
require('react-focus-lock');
|
|
66
|
+
require('qrcode');
|
|
67
|
+
require('formik');
|
|
68
|
+
require('../../../views/WalletList/WalletList.cjs');
|
|
69
|
+
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
70
|
+
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
71
|
+
require('@hcaptcha/react-hcaptcha');
|
|
72
|
+
require('../../../context/FooterAnimationContext/index.cjs');
|
|
73
|
+
var WalletGroupContext = require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
74
|
+
var groupWalletOptions = require('../../functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.cjs');
|
|
75
|
+
require('../../../context/MfaSettingsContext/MfaSettingsContext.cjs');
|
|
76
|
+
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
77
|
+
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
78
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
79
|
+
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
80
|
+
require('../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
81
|
+
require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
82
|
+
require('../../../../polyfills.cjs');
|
|
83
|
+
require('../../../context/ErrorBoundary/ErrorBoundaryBase.cjs');
|
|
84
|
+
require('../../../context/ErrorBoundary/ErrorBoundaryContext.cjs');
|
|
85
|
+
require('../../../widgets/DynamicBridgeWidget/context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.cjs');
|
|
86
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetCard/DynamicWidgetCard.cjs');
|
|
87
|
+
require('../../../context/WidgetRegistry/WidgetRegistryContextProvider.cjs');
|
|
88
|
+
require('../../../context/FundingContext/FundingContext.cjs');
|
|
89
|
+
require('../../../context/SendBalanceContext/SendBalanceContext.cjs');
|
|
90
|
+
require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
91
|
+
require('../../../context/ConnectWithOtpContext/constants.cjs');
|
|
92
|
+
require('../../../context/ReinitializeContext/ReinitializeContextProvider.cjs');
|
|
93
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
94
|
+
|
|
95
|
+
const useSelectWalletOption = () => {
|
|
96
|
+
const { walletConnectorOptions, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
97
|
+
const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
|
|
98
|
+
const { setView } = ViewContext.useViewContext();
|
|
99
|
+
const { navigateToWalletGroup } = WalletGroupContext.useWalletGroupContext();
|
|
100
|
+
const { handleWalletItemClick } = useWalletItemActions.useWalletItemActions();
|
|
101
|
+
const selectWalletOption = (walletKey) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
102
|
+
const group = groupWalletOptions.groupWalletOptions(walletBook$1, walletConnectorOptions);
|
|
103
|
+
const walletOption = group.find((wallet) => wallet.key === walletKey);
|
|
104
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('[useSelectWalletOption] selectWalletOption', { walletKey, walletOption: walletOption === null || walletOption === void 0 ? void 0 : walletOption.key });
|
|
105
|
+
if (!walletOption) {
|
|
106
|
+
throw new utils.DynamicError('Invalid wallet option key provided.');
|
|
107
|
+
}
|
|
108
|
+
if (isWalletGroup.isWalletGroup(walletOption)) {
|
|
109
|
+
navigateToWalletGroup(walletOption);
|
|
110
|
+
}
|
|
111
|
+
else if (walletConnectorCore.isHardwareWalletConnector(walletOption.walletConnector) &&
|
|
112
|
+
walletOption.walletConnector.canConnectWithHardwareWallet()) {
|
|
113
|
+
setView('select-hardware-wallet', {
|
|
114
|
+
onSelectWallet: handleWalletItemClick,
|
|
115
|
+
wallet: walletOption,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
handleWalletItemClick(walletOption);
|
|
120
|
+
}
|
|
121
|
+
setShowAuthFlow(true);
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
selectWalletOption,
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
exports.useSelectWalletOption = useSelectWalletOption;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { isHardwareWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
+
import { useWalletBookContext } from '@dynamic-labs/wallet-book';
|
|
5
|
+
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '../../../context/DynamicContext/DynamicContext.js';
|
|
8
|
+
import '@dynamic-labs/sdk-api-core';
|
|
9
|
+
import '../../../shared/logger.js';
|
|
10
|
+
import '@dynamic-labs/iconic';
|
|
11
|
+
import 'react/jsx-runtime';
|
|
12
|
+
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
13
|
+
import '../../constants/colors.js';
|
|
14
|
+
import '../../constants/values.js';
|
|
15
|
+
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
16
|
+
import '../../../shared/utils/classes/storage/sessionStorage.js';
|
|
17
|
+
import { isWalletGroup } from '../../functions/walletListBuilder/utils/isWalletGroup/isWalletGroup.js';
|
|
18
|
+
import '../../../shared/consts/index.js';
|
|
19
|
+
import '../../../events/dynamicEvents.js';
|
|
20
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
21
|
+
import '../../../context/ErrorContext/ErrorContext.js';
|
|
22
|
+
import '@dynamic-labs/multi-wallet';
|
|
23
|
+
import 'react-international-phone';
|
|
24
|
+
import '../../../config/ApiEndpoint.js';
|
|
25
|
+
import '@dynamic-labs/store';
|
|
26
|
+
import '../../../locale/locale.js';
|
|
27
|
+
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
28
|
+
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
29
|
+
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
30
|
+
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
31
|
+
import '../../../context/VerificationContext/VerificationContext.js';
|
|
32
|
+
import 'react-dom';
|
|
33
|
+
import '../../../context/WalletContext/WalletContext.js';
|
|
34
|
+
import '../../../context/ThemeContext/ThemeContext.js';
|
|
35
|
+
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
36
|
+
import '@dynamic-labs/types';
|
|
37
|
+
import '../../../context/LoadingContext/LoadingContext.js';
|
|
38
|
+
import 'yup';
|
|
39
|
+
import '../../../context/MockContext/MockContext.js';
|
|
40
|
+
import '../../../views/CollectUserDataView/useFields.js';
|
|
41
|
+
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
42
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
43
|
+
import '@dynamic-labs/rpc-providers';
|
|
44
|
+
import { useWalletItemActions } from '../useWalletItemActions/useWalletItemActions.js';
|
|
45
|
+
import 'react-i18next';
|
|
46
|
+
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
47
|
+
import '../../../components/Alert/Alert.js';
|
|
48
|
+
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
49
|
+
import '../../../components/IconButton/IconButton.js';
|
|
50
|
+
import '../../../components/InlineWidget/InlineWidget.js';
|
|
51
|
+
import '../../../components/Input/Input.js';
|
|
52
|
+
import '../../../components/IsBrowser/IsBrowser.js';
|
|
53
|
+
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
54
|
+
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
55
|
+
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
56
|
+
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
57
|
+
import '../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
58
|
+
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
59
|
+
import '../../../components/Popper/Popper/Popper.js';
|
|
60
|
+
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
61
|
+
import 'react-focus-lock';
|
|
62
|
+
import 'qrcode';
|
|
63
|
+
import 'formik';
|
|
64
|
+
import '../../../views/WalletList/WalletList.js';
|
|
65
|
+
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
66
|
+
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
67
|
+
import '@hcaptcha/react-hcaptcha';
|
|
68
|
+
import '../../../context/FooterAnimationContext/index.js';
|
|
69
|
+
import { useWalletGroupContext } from '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
70
|
+
import { groupWalletOptions } from '../../functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.js';
|
|
71
|
+
import '../../../context/MfaSettingsContext/MfaSettingsContext.js';
|
|
72
|
+
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
73
|
+
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
74
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
75
|
+
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
76
|
+
import '../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
77
|
+
import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
78
|
+
import '../../../../polyfills.js';
|
|
79
|
+
import '../../../context/ErrorBoundary/ErrorBoundaryBase.js';
|
|
80
|
+
import '../../../context/ErrorBoundary/ErrorBoundaryContext.js';
|
|
81
|
+
import '../../../widgets/DynamicBridgeWidget/context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.js';
|
|
82
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetCard/DynamicWidgetCard.js';
|
|
83
|
+
import '../../../context/WidgetRegistry/WidgetRegistryContextProvider.js';
|
|
84
|
+
import '../../../context/FundingContext/FundingContext.js';
|
|
85
|
+
import '../../../context/SendBalanceContext/SendBalanceContext.js';
|
|
86
|
+
import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
87
|
+
import '../../../context/ConnectWithOtpContext/constants.js';
|
|
88
|
+
import '../../../context/ReinitializeContext/ReinitializeContextProvider.js';
|
|
89
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
90
|
+
|
|
91
|
+
const useSelectWalletOption = () => {
|
|
92
|
+
const { walletConnectorOptions, setShowAuthFlow } = useInternalDynamicContext();
|
|
93
|
+
const { walletBook } = useWalletBookContext();
|
|
94
|
+
const { setView } = useViewContext();
|
|
95
|
+
const { navigateToWalletGroup } = useWalletGroupContext();
|
|
96
|
+
const { handleWalletItemClick } = useWalletItemActions();
|
|
97
|
+
const selectWalletOption = (walletKey) => __awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
+
const group = groupWalletOptions(walletBook, walletConnectorOptions);
|
|
99
|
+
const walletOption = group.find((wallet) => wallet.key === walletKey);
|
|
100
|
+
logVerboseTroubleshootingMessage('[useSelectWalletOption] selectWalletOption', { walletKey, walletOption: walletOption === null || walletOption === void 0 ? void 0 : walletOption.key });
|
|
101
|
+
if (!walletOption) {
|
|
102
|
+
throw new DynamicError('Invalid wallet option key provided.');
|
|
103
|
+
}
|
|
104
|
+
if (isWalletGroup(walletOption)) {
|
|
105
|
+
navigateToWalletGroup(walletOption);
|
|
106
|
+
}
|
|
107
|
+
else if (isHardwareWalletConnector(walletOption.walletConnector) &&
|
|
108
|
+
walletOption.walletConnector.canConnectWithHardwareWallet()) {
|
|
109
|
+
setView('select-hardware-wallet', {
|
|
110
|
+
onSelectWallet: handleWalletItemClick,
|
|
111
|
+
wallet: walletOption,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
handleWalletItemClick(walletOption);
|
|
116
|
+
}
|
|
117
|
+
setShowAuthFlow(true);
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
selectWalletOption,
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export { useSelectWalletOption };
|
|
@@ -47,6 +47,7 @@ require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
|
47
47
|
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
48
48
|
require('@dynamic-labs/rpc-providers');
|
|
49
49
|
require('../../../context/MfaSettingsContext/MfaSettingsContext.cjs');
|
|
50
|
+
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
50
51
|
require('react-dom');
|
|
51
52
|
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
52
53
|
require('../../../components/IconButton/IconButton.cjs');
|
|
@@ -69,7 +70,6 @@ require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
|
69
70
|
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
70
71
|
require('@hcaptcha/react-hcaptcha');
|
|
71
72
|
require('../../../context/FooterAnimationContext/index.cjs');
|
|
72
|
-
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
73
73
|
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
74
74
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
75
75
|
var CreatePasswordModal = require('../../../modals/CreatePasswordModal/CreatePasswordModal.cjs');
|
|
@@ -101,34 +101,41 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, hideEmbeddedWalle
|
|
|
101
101
|
elementId: 'dynamic-sync-wallet',
|
|
102
102
|
});
|
|
103
103
|
const shouldConfirmAction = React.useCallback(() => {
|
|
104
|
-
if (hideEmbeddedWalletTransactionUIs) {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
104
|
if (confirmationStateRef.current === 'disabled') {
|
|
108
105
|
confirmationStateRef.current = 'enabled';
|
|
109
106
|
return false;
|
|
110
107
|
}
|
|
111
108
|
return true;
|
|
112
109
|
}, [confirmationStateRef, hideEmbeddedWalletTransactionUIs]);
|
|
113
|
-
const signMessage = React.useCallback(({ message, handler })
|
|
114
|
-
|
|
110
|
+
const signMessage = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ message, handler }) {
|
|
111
|
+
// prevent the modal from opening itself again
|
|
112
|
+
if (!shouldConfirmAction())
|
|
115
113
|
return handler();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
return openSignMessage((resolve, reject) => (jsxRuntime.jsx(SignMessageConfirmationModal.SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject, hideModal: hideEmbeddedWalletTransactionUIs }))).then((signedMessage) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
115
|
+
if (signedMessage === 'callHandlerOutsideModal')
|
|
116
|
+
return handler();
|
|
117
|
+
else
|
|
118
|
+
return signedMessage;
|
|
119
|
+
}));
|
|
120
|
+
}), [appLogoUrl, appName, getAppOrigin, openSignMessage, shouldConfirmAction]);
|
|
119
121
|
const sendTransaction = React.useCallback((walletConnector, transaction) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
120
|
-
|
|
122
|
+
// prevent the modal from opening itself again
|
|
123
|
+
if (!shouldConfirmAction())
|
|
121
124
|
return transaction.submit();
|
|
122
|
-
}
|
|
123
|
-
|
|
125
|
+
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { copykey: 'dyn_send_transaction.confirmation.title', title: t('dyn_send_transaction.confirmation.title'), transaction: transaction, onTransactionResponseSuccess: resolve, onReject: reject, walletConnector: walletConnector, hideModal: hideEmbeddedWalletTransactionUIs }))).then((signedTransaction) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
126
|
+
if (signedTransaction === 'callHandlerOutsideModal')
|
|
127
|
+
return transaction.submit();
|
|
128
|
+
else
|
|
129
|
+
return signedTransaction;
|
|
130
|
+
}));
|
|
124
131
|
}), [openSendTransaction, shouldConfirmAction, t]);
|
|
125
|
-
const enterPassword = React.useCallback((
|
|
132
|
+
const enterPassword = React.useCallback((_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ handler, closeView = true }) {
|
|
126
133
|
return openEnterPassword((resolve, reject) => (jsxRuntime.jsx(EnterPasswordModal.EnterPasswordModal, { handler: handler, onResolve: resolve, onReject: reject, closeView: closeView })));
|
|
127
134
|
}), [openEnterPassword]);
|
|
128
|
-
const createPassword = React.useCallback((
|
|
135
|
+
const createPassword = React.useCallback((_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ closeView = true }) {
|
|
129
136
|
return openCreatePassword((resolve, reject) => (jsxRuntime.jsx(CreatePasswordModal.CreatePasswordModal, { onResolve: resolve, onReject: reject, closeView: closeView })));
|
|
130
137
|
}), [openCreatePassword]);
|
|
131
|
-
const syncWallet = React.useCallback((
|
|
138
|
+
const syncWallet = React.useCallback((_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ walletConnector, activeAddress, expectedAddress }) {
|
|
132
139
|
if (!activeAddress) {
|
|
133
140
|
return;
|
|
134
141
|
}
|
|
@@ -43,6 +43,7 @@ import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
|
43
43
|
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
44
44
|
import '@dynamic-labs/rpc-providers';
|
|
45
45
|
import '../../../context/MfaSettingsContext/MfaSettingsContext.js';
|
|
46
|
+
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
46
47
|
import 'react-dom';
|
|
47
48
|
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
48
49
|
import '../../../components/IconButton/IconButton.js';
|
|
@@ -65,7 +66,6 @@ import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
|
65
66
|
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
66
67
|
import '@hcaptcha/react-hcaptcha';
|
|
67
68
|
import '../../../context/FooterAnimationContext/index.js';
|
|
68
|
-
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
69
69
|
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
70
70
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
71
71
|
import { CreatePasswordModal } from '../../../modals/CreatePasswordModal/CreatePasswordModal.js';
|
|
@@ -97,34 +97,41 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, hideEmbeddedWalle
|
|
|
97
97
|
elementId: 'dynamic-sync-wallet',
|
|
98
98
|
});
|
|
99
99
|
const shouldConfirmAction = useCallback(() => {
|
|
100
|
-
if (hideEmbeddedWalletTransactionUIs) {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
100
|
if (confirmationStateRef.current === 'disabled') {
|
|
104
101
|
confirmationStateRef.current = 'enabled';
|
|
105
102
|
return false;
|
|
106
103
|
}
|
|
107
104
|
return true;
|
|
108
105
|
}, [confirmationStateRef, hideEmbeddedWalletTransactionUIs]);
|
|
109
|
-
const signMessage = useCallback(({ message, handler })
|
|
110
|
-
|
|
106
|
+
const signMessage = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ message, handler }) {
|
|
107
|
+
// prevent the modal from opening itself again
|
|
108
|
+
if (!shouldConfirmAction())
|
|
111
109
|
return handler();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
return openSignMessage((resolve, reject) => (jsx(SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject, hideModal: hideEmbeddedWalletTransactionUIs }))).then((signedMessage) => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
|
+
if (signedMessage === 'callHandlerOutsideModal')
|
|
112
|
+
return handler();
|
|
113
|
+
else
|
|
114
|
+
return signedMessage;
|
|
115
|
+
}));
|
|
116
|
+
}), [appLogoUrl, appName, getAppOrigin, openSignMessage, shouldConfirmAction]);
|
|
115
117
|
const sendTransaction = useCallback((walletConnector, transaction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
|
-
|
|
118
|
+
// prevent the modal from opening itself again
|
|
119
|
+
if (!shouldConfirmAction())
|
|
117
120
|
return transaction.submit();
|
|
118
|
-
}
|
|
119
|
-
|
|
121
|
+
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { copykey: 'dyn_send_transaction.confirmation.title', title: t('dyn_send_transaction.confirmation.title'), transaction: transaction, onTransactionResponseSuccess: resolve, onReject: reject, walletConnector: walletConnector, hideModal: hideEmbeddedWalletTransactionUIs }))).then((signedTransaction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
122
|
+
if (signedTransaction === 'callHandlerOutsideModal')
|
|
123
|
+
return transaction.submit();
|
|
124
|
+
else
|
|
125
|
+
return signedTransaction;
|
|
126
|
+
}));
|
|
120
127
|
}), [openSendTransaction, shouldConfirmAction, t]);
|
|
121
|
-
const enterPassword = useCallback((
|
|
128
|
+
const enterPassword = useCallback((_b) => __awaiter(void 0, [_b], void 0, function* ({ handler, closeView = true }) {
|
|
122
129
|
return openEnterPassword((resolve, reject) => (jsx(EnterPasswordModal, { handler: handler, onResolve: resolve, onReject: reject, closeView: closeView })));
|
|
123
130
|
}), [openEnterPassword]);
|
|
124
|
-
const createPassword = useCallback((
|
|
131
|
+
const createPassword = useCallback((_c) => __awaiter(void 0, [_c], void 0, function* ({ closeView = true }) {
|
|
125
132
|
return openCreatePassword((resolve, reject) => (jsx(CreatePasswordModal, { onResolve: resolve, onReject: reject, closeView: closeView })));
|
|
126
133
|
}), [openCreatePassword]);
|
|
127
|
-
const syncWallet = useCallback((
|
|
134
|
+
const syncWallet = useCallback((_d) => __awaiter(void 0, [_d], void 0, function* ({ walletConnector, activeAddress, expectedAddress }) {
|
|
128
135
|
if (!activeAddress) {
|
|
129
136
|
return;
|
|
130
137
|
}
|
|
@@ -103,7 +103,7 @@ var useInternalDynamicContext = require('../../context/DynamicContext/useDynamic
|
|
|
103
103
|
|
|
104
104
|
const DEFAULT_PRECISION = 10;
|
|
105
105
|
const FEE_REFRESH_INTERVAL = 20000;
|
|
106
|
-
const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, }) => {
|
|
106
|
+
const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, hideModal, }) => {
|
|
107
107
|
const { appName, appLogoUrl } = useInternalDynamicContext.useInternalDynamicContext();
|
|
108
108
|
const appOrigin = getAppOrigin.getAppOrigin();
|
|
109
109
|
const [isGasSponsored, setIsGasSponsored] = React.useState(false);
|
|
@@ -199,7 +199,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
199
199
|
t,
|
|
200
200
|
currencySymbol,
|
|
201
201
|
]);
|
|
202
|
-
return (jsxRuntime.jsxs(TransactionConfirmationPageLayout.TransactionConfirmationPageLayout, { onClickBack: onClickBack, onClickClose: onClickClose, copykey: copykey, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, isLoading: isLoading, onClickSend: () => send(), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isBalanceLoading, error: errorMessage, alert: alert, children: [jsxRuntime.jsx(TransactionRow.TransactionRow, { copykey: 'dyn_send_transaction.confirmation.data.from', label: t('dyn_send_transaction.confirmation.data.from'), title: transaction.from, children: shortenWalletAddress.shortenWalletAddress(transaction.from, 4, 4) }), jsxRuntime.jsx(TransactionRow.TransactionRow, { copykey: 'dyn_send_transaction.confirmation.data.to', label: t('dyn_send_transaction.confirmation.data.to'), title: transaction.to, children: transaction.to &&
|
|
202
|
+
return (jsxRuntime.jsxs(TransactionConfirmationPageLayout.TransactionConfirmationPageLayout, { onClickBack: onClickBack, onClickClose: onClickClose, copykey: copykey, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, hideModal: hideModal, isLoading: isLoading, onClickSend: () => send(), onSuccess: (tx) => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(tx), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isBalanceLoading, error: errorMessage, alert: alert, children: [jsxRuntime.jsx(TransactionRow.TransactionRow, { copykey: 'dyn_send_transaction.confirmation.data.from', label: t('dyn_send_transaction.confirmation.data.from'), title: transaction.from, children: shortenWalletAddress.shortenWalletAddress(transaction.from, 4, 4) }), jsxRuntime.jsx(TransactionRow.TransactionRow, { copykey: 'dyn_send_transaction.confirmation.data.to', label: t('dyn_send_transaction.confirmation.data.to'), title: transaction.to, children: transaction.to &&
|
|
203
203
|
transaction.to === 'dyn_send_transaction.multiple_recipients'
|
|
204
204
|
? t('dyn_send_transaction.multiple_recipients')
|
|
205
205
|
: shortenWalletAddress.shortenWalletAddress(transaction.to, 4, 4) }), jsxRuntime.jsx(TransactionRow.TransactionRow, { copykey: 'dyn_send_transaction.confirmation.data.amount', label: t('dyn_send_transaction.confirmation.data.amount'), isEmpty: !transaction.value, title: transaction.value ? transaction.format(transaction.value) : undefined, suffix: currencySymbol, icon: chain && jsxRuntime.jsx(ChainIcon.ChainIcon, { chain: chain, chainName: chainName }), dataTestId: 'transaction-amount', children: transaction.value !== undefined
|
|
@@ -9,6 +9,7 @@ export type TransactionConfirmationViewProps = {
|
|
|
9
9
|
onClickBack?: MouseEventHandler<HTMLButtonElement>;
|
|
10
10
|
onClickClose?: MouseEventHandler<HTMLButtonElement>;
|
|
11
11
|
onError?: (error: unknown) => void;
|
|
12
|
+
hideModal?: boolean;
|
|
12
13
|
onSuccess?: (receipt: string) => void;
|
|
13
14
|
title: ReactNode;
|
|
14
15
|
transaction: IUITransaction;
|
|
@@ -99,7 +99,7 @@ import { useInternalDynamicContext } from '../../context/DynamicContext/useDynam
|
|
|
99
99
|
|
|
100
100
|
const DEFAULT_PRECISION = 10;
|
|
101
101
|
const FEE_REFRESH_INTERVAL = 20000;
|
|
102
|
-
const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, }) => {
|
|
102
|
+
const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, hideModal, }) => {
|
|
103
103
|
const { appName, appLogoUrl } = useInternalDynamicContext();
|
|
104
104
|
const appOrigin = getAppOrigin();
|
|
105
105
|
const [isGasSponsored, setIsGasSponsored] = useState(false);
|
|
@@ -195,7 +195,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
195
195
|
t,
|
|
196
196
|
currencySymbol,
|
|
197
197
|
]);
|
|
198
|
-
return (jsxs(TransactionConfirmationPageLayout, { onClickBack: onClickBack, onClickClose: onClickClose, copykey: copykey, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, isLoading: isLoading, onClickSend: () => send(), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isBalanceLoading, error: errorMessage, alert: alert, children: [jsx(TransactionRow, { copykey: 'dyn_send_transaction.confirmation.data.from', label: t('dyn_send_transaction.confirmation.data.from'), title: transaction.from, children: shortenWalletAddress(transaction.from, 4, 4) }), jsx(TransactionRow, { copykey: 'dyn_send_transaction.confirmation.data.to', label: t('dyn_send_transaction.confirmation.data.to'), title: transaction.to, children: transaction.to &&
|
|
198
|
+
return (jsxs(TransactionConfirmationPageLayout, { onClickBack: onClickBack, onClickClose: onClickClose, copykey: copykey, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, hideModal: hideModal, isLoading: isLoading, onClickSend: () => send(), onSuccess: (tx) => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(tx), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isBalanceLoading, error: errorMessage, alert: alert, children: [jsx(TransactionRow, { copykey: 'dyn_send_transaction.confirmation.data.from', label: t('dyn_send_transaction.confirmation.data.from'), title: transaction.from, children: shortenWalletAddress(transaction.from, 4, 4) }), jsx(TransactionRow, { copykey: 'dyn_send_transaction.confirmation.data.to', label: t('dyn_send_transaction.confirmation.data.to'), title: transaction.to, children: transaction.to &&
|
|
199
199
|
transaction.to === 'dyn_send_transaction.multiple_recipients'
|
|
200
200
|
? t('dyn_send_transaction.multiple_recipients')
|
|
201
201
|
: shortenWalletAddress(transaction.to, 4, 4) }), jsx(TransactionRow, { copykey: 'dyn_send_transaction.confirmation.data.amount', label: t('dyn_send_transaction.confirmation.data.amount'), isEmpty: !transaction.value, title: transaction.value ? transaction.format(transaction.value) : undefined, suffix: currencySymbol, icon: chain && jsx(ChainIcon, { chain: chain, chainName: chainName }), dataTestId: 'transaction-amount', children: transaction.value !== undefined
|