@dynamic-labs/sdk-react-core 3.9.9 → 3.9.11
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 +16 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/index.d.ts +1 -0
- package/src/lib/components/NeedHelpSection/NeedHelpSection.cjs +32 -31
- package/src/lib/components/NeedHelpSection/NeedHelpSection.d.ts +2 -1
- package/src/lib/components/NeedHelpSection/NeedHelpSection.js +34 -33
- package/src/lib/components/SupportLinks/SupportLinks.cjs +24 -0
- package/src/lib/components/SupportLinks/SupportLinks.d.ts +6 -0
- package/src/lib/components/SupportLinks/SupportLinks.js +20 -0
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +3 -2
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +3 -2
- package/src/lib/components/TransactionConfirmationPageLayout/utils.cjs +6 -2
- package/src/lib/components/TransactionConfirmationPageLayout/utils.js +6 -2
- package/src/lib/context/DynamicContext/DynamicContext.cjs +2 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +2 -0
- package/src/lib/context/UserWalletsContext/UserWalletsContext.cjs +19 -14
- package/src/lib/context/UserWalletsContext/UserWalletsContext.js +20 -15
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/data/api/wallets/wallets.cjs +3 -0
- package/src/lib/data/api/wallets/wallets.js +4 -1
- package/src/lib/events/dynamicEvents.cjs +4 -0
- package/src/lib/events/dynamicEvents.d.ts +2 -2
- package/src/lib/events/dynamicEvents.js +4 -0
- package/src/lib/events/index.d.ts +1 -0
- package/src/lib/events/wallets.d.ts +25 -0
- package/src/lib/locale/en/translation.cjs +7 -2
- package/src/lib/locale/en/translation.d.ts +5 -0
- package/src/lib/locale/en/translation.js +7 -2
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +3 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +3 -1
- package/src/lib/shared/types/embeddedWallets.d.ts +7 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.d.ts +1 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useAggregateWalletEvents/index.d.ts +1 -0
- package/src/lib/utils/hooks/useAggregateWalletEvents/useAggregateWalletEvents.cjs +56 -0
- package/src/lib/utils/hooks/useAggregateWalletEvents/useAggregateWalletEvents.d.ts +2 -0
- package/src/lib/utils/hooks/useAggregateWalletEvents/useAggregateWalletEvents.js +52 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +4 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +4 -0
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +3 -1
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +3 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +5 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +6 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +3 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +3 -0
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +4 -3
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +4 -3
- package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.cjs +14 -4
- package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.js +14 -4
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.cjs +1 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.js +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +11 -3
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +11 -3
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.cjs +3 -3
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.d.ts +4 -1
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.js +3 -3
- package/src/lib/views/WalletAlreadyExistsView/WalletAlreadyExistsView.cjs +101 -0
- package/src/lib/views/WalletAlreadyExistsView/WalletAlreadyExistsView.d.ts +2 -0
- package/src/lib/views/WalletAlreadyExistsView/WalletAlreadyExistsView.js +97 -0
- package/src/lib/views/WalletAlreadyExistsView/index.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.d.ts +2 -1
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +10 -4
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.d.ts +3 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +10 -4
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +3 -1
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
### [3.9.11](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.10...v3.9.11) (2025-02-08)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* ensure correct dependencies are listed in packages ([#7958](https://github.com/dynamic-labs/DynamicAuth/issues/7958)) ([0ba0035](https://github.com/dynamic-labs/DynamicAuth/commit/0ba003520136336ea69a6ac163d36acec2b67970))
|
|
8
|
+
* ensure user wallets state has been updated before emitting walletAdded/walletRemoved events ([#7870](https://github.com/dynamic-labs/DynamicAuth/issues/7870)) ([5d89ad0](https://github.com/dynamic-labs/DynamicAuth/commit/5d89ad02a278ccb1b47bc46a8e36c15180ed7965)), closes [#7863](https://github.com/dynamic-labs/DynamicAuth/issues/7863)
|
|
9
|
+
|
|
10
|
+
### [3.9.10](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.9...v3.9.10) (2025-01-16)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add EthereumWalletConnectorsWithConfig ([#7796](https://github.com/dynamic-labs/DynamicAuth/issues/7796)) ([#7819](https://github.com/dynamic-labs/DynamicAuth/issues/7819)) ([510f9ac](https://github.com/dynamic-labs/DynamicAuth/commit/510f9acbd7ffa7fa767d45de22c95e03186d542d))
|
|
16
|
+
* add new super event that aggregates all user wallet events ([#7823](https://github.com/dynamic-labs/DynamicAuth/issues/7823)) ([ffe4fe7](https://github.com/dynamic-labs/DynamicAuth/commit/ffe4fe7c4ff4d0f12dee588fce84983c7b567d5e)), closes [#7797](https://github.com/dynamic-labs/DynamicAuth/issues/7797) [#7798](https://github.com/dynamic-labs/DynamicAuth/issues/7798)
|
|
17
|
+
|
|
2
18
|
### [3.9.9](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.8...v3.9.9) (2025-01-15)
|
|
3
19
|
|
|
4
20
|
|
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.9.
|
|
3
|
+
"version": "3.9.11",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/assert-package-version": "3.9.
|
|
21
|
-
"@dynamic-labs/iconic": "3.9.
|
|
22
|
-
"@dynamic-labs/logger": "3.9.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "3.9.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "3.9.
|
|
25
|
-
"@dynamic-labs/store": "3.9.
|
|
26
|
-
"@dynamic-labs/types": "3.9.
|
|
27
|
-
"@dynamic-labs/utils": "3.9.
|
|
28
|
-
"@dynamic-labs/wallet-book": "3.9.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "3.9.
|
|
20
|
+
"@dynamic-labs/assert-package-version": "3.9.11",
|
|
21
|
+
"@dynamic-labs/iconic": "3.9.11",
|
|
22
|
+
"@dynamic-labs/logger": "3.9.11",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "3.9.11",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "3.9.11",
|
|
25
|
+
"@dynamic-labs/store": "3.9.11",
|
|
26
|
+
"@dynamic-labs/types": "3.9.11",
|
|
27
|
+
"@dynamic-labs/utils": "3.9.11",
|
|
28
|
+
"@dynamic-labs/wallet-book": "3.9.11",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "3.9.11",
|
|
30
30
|
"bs58": "5.0.0",
|
|
31
31
|
"eventemitter3": "5.0.1"
|
|
32
32
|
},
|
package/src/index.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ AuthOptions as AuthOption, AuthOptions,
|
|
|
99
99
|
/** @deprecated use AuthMethod instead */
|
|
100
100
|
AuthMethod as AuthType, AuthMethod, } from '@dynamic-labs/types';
|
|
101
101
|
export { publicDynamicEvents as dynamicEvents } from './lib/events/dynamicEvents';
|
|
102
|
+
export { type UserWalletsChangedParams } from './lib/events';
|
|
102
103
|
export { mergeNetworks } from './lib/utils/functions/mergeNetworks';
|
|
103
104
|
export {
|
|
104
105
|
/** @deprecated use https://www.npmjs.com/package/classnames */
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var reactI18next = require('react-i18next');
|
|
8
8
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
9
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
10
9
|
require('react');
|
|
11
10
|
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
12
11
|
require('../../shared/logger.cjs');
|
|
13
12
|
require('@dynamic-labs/iconic');
|
|
14
|
-
require('
|
|
13
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
14
|
+
var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
|
|
15
15
|
require('@dynamic-labs/wallet-book');
|
|
16
16
|
require('@dynamic-labs/utils');
|
|
17
17
|
require('../../utils/constants/colors.cjs');
|
|
@@ -34,7 +34,6 @@ require('../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
|
34
34
|
require('../../context/VerificationContext/VerificationContext.cjs');
|
|
35
35
|
require('react-dom');
|
|
36
36
|
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
37
|
-
var useSmartWallets = require('../../utils/hooks/useSmartWallets/useSmartWallets.cjs');
|
|
38
37
|
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
39
38
|
var usePasskeyRecovery = require('../../utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs');
|
|
40
39
|
require('@dynamic-labs/types');
|
|
@@ -64,6 +63,7 @@ require('../Transition/ZoomTransition/ZoomTransition.cjs');
|
|
|
64
63
|
require('../Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
65
64
|
require('../Transition/OpacityTransition/OpacityTransition.cjs');
|
|
66
65
|
require('../OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
66
|
+
var SupportLinks = require('../SupportLinks/SupportLinks.cjs');
|
|
67
67
|
require('../PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
68
68
|
require('../Popper/Popper/Popper.cjs');
|
|
69
69
|
require('../Popper/PopperContext/PopperContext.cjs');
|
|
@@ -87,43 +87,44 @@ require('../../store/state/tokenBalances.cjs');
|
|
|
87
87
|
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
88
88
|
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
89
89
|
|
|
90
|
-
const NeedHelpSection = ({ isRecoveryFlow = false }) => {
|
|
91
|
-
var _a, _b, _c, _d, _e
|
|
92
|
-
const { projectSettings,
|
|
90
|
+
const NeedHelpSection = ({ isRecoveryFlow = false, isExport = false, }) => {
|
|
91
|
+
var _a, _b, _c, _d, _e;
|
|
92
|
+
const { projectSettings, user } = useInternalDynamicContext.useInternalDynamicContext();
|
|
93
93
|
const { t } = reactI18next.useTranslation();
|
|
94
|
+
const { setView } = ViewContext.useViewContext();
|
|
94
95
|
const { initPasskeyRecoveryProcess } = usePasskeyRecovery.usePasskeyRecovery();
|
|
95
96
|
const supportEmail = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _a === void 0 ? void 0 : _a.supportEmail;
|
|
96
|
-
const
|
|
97
|
-
((_c = Object.values(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.supportUrls)) === null || _c === void 0 ? void 0 : _c[0]);
|
|
97
|
+
const supportUrls = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _b === void 0 ? void 0 : _b.supportUrls;
|
|
98
98
|
// don't show passkey recovery helper on passkey creation flow views
|
|
99
99
|
const isRecoveryEnabled = !isRecoveryFlow &&
|
|
100
|
-
((
|
|
101
|
-
Boolean((
|
|
102
|
-
const {
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const hasContactInfo = Boolean(supportEmail || supportUrl);
|
|
100
|
+
((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _c === void 0 ? void 0 : _c.find((p) => p.provider === sdkApiCore.ProviderEnum.Turnkey && p.enabledAt)) &&
|
|
101
|
+
Boolean((_e = (_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _d === void 0 ? void 0 : _d.embeddedWallets) === null || _e === void 0 ? void 0 : _e.emailRecoveryEnabled);
|
|
102
|
+
const v2Wallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.some((credential) => { var _a; return ((_a = credential.walletProperties) === null || _a === void 0 ? void 0 : _a.version) === sdkApiCore.EmbeddedWalletVersionEnum.V2; });
|
|
103
|
+
// revert to v2 wallet view (no passkey recovery) if passkey recovery is not enabled
|
|
104
|
+
const v1Wallet = !v2Wallet && isRecoveryEnabled;
|
|
105
|
+
const hasContactInfo = Boolean(supportEmail || Object.keys(supportUrls || {}).length > 0);
|
|
107
106
|
const getSupportHelpSession = () => {
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
// For v1 wallets, only show the "Go here for support" link that triggers recovery
|
|
108
|
+
if (v1Wallet) {
|
|
109
|
+
return (jsxRuntime.jsx(TextButton.TextButton, { copykey: 'dyn_need_help_section.help_button', className: classNames.classNames('need-help-section__helper-link'), onClick: () => initPasskeyRecoveryProcess(undefined, {
|
|
110
|
+
settings: isExport
|
|
111
|
+
? {
|
|
112
|
+
goBack: () => {
|
|
113
|
+
setView('embedded-reveal-view');
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
: undefined,
|
|
117
|
+
type: 'helpSession',
|
|
118
|
+
}), children: t('dyn_need_help_section.help_button') }));
|
|
110
119
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (!isRecoveryEnabled) {
|
|
115
|
-
return null;
|
|
120
|
+
// V2 Wallet or V1 Wallet without recovery
|
|
121
|
+
if (hasContactInfo) {
|
|
122
|
+
return (jsxRuntime.jsx(SupportLinks.SupportLinks, { supportEmail: supportEmail, supportUrls: supportUrls }));
|
|
116
123
|
}
|
|
117
|
-
const recoveryText = t('dyn_need_help_section.help_button');
|
|
118
|
-
const finalRecoveryText = hasContactInfo
|
|
119
|
-
? recoveryText
|
|
120
|
-
: recoveryText.slice(0, 1).toUpperCase() + recoveryText.slice(1);
|
|
121
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [hasContactInfo && (jsxRuntime.jsx(Typography.Typography, { color: 'secondary', variant: 'body_small', copykey: 'dyn_need_help_section.divider', children: t('dyn_need_help_section.divider') })), jsxRuntime.jsx(TextButton.TextButton, { copykey: 'dyn_need_help_section.help_button', className: classNames.classNames('need-help-section__helper-link'), onClick: () => initPasskeyRecoveryProcess(undefined, 'helpSession'), children: finalRecoveryText })] }));
|
|
122
|
-
};
|
|
123
|
-
if (!hasContactInfo && (!isRecoveryEnabled || isSessionKeyCompatible)) {
|
|
124
124
|
return null;
|
|
125
|
-
}
|
|
126
|
-
|
|
125
|
+
};
|
|
126
|
+
// if there is no support info, don't render the component
|
|
127
|
+
return getSupportHelpSession() ? (jsxRuntime.jsxs("div", { className: 'need-help-section', children: [jsxRuntime.jsx(Typography.Typography, { color: 'secondary', variant: 'body_small', copykey: 'dyn_need_help_section.info', weight: 'medium', children: t('dyn_need_help_section.info') }), getSupportHelpSession()] })) : null;
|
|
127
128
|
};
|
|
128
129
|
|
|
129
130
|
exports.NeedHelpSection = NeedHelpSection;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
type Props = {
|
|
3
3
|
isRecoveryFlow?: boolean;
|
|
4
|
+
isExport?: boolean;
|
|
4
5
|
};
|
|
5
|
-
export declare const NeedHelpSection: ({ isRecoveryFlow }: Props) => JSX.Element | null;
|
|
6
|
+
export declare const NeedHelpSection: ({ isRecoveryFlow, isExport, }: Props) => JSX.Element | null;
|
|
6
7
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { jsxs, jsx
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { ProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
|
-
import { isSessionKeyCompatibleWallet } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
+
import { ProviderEnum, EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';
|
|
6
5
|
import 'react';
|
|
7
6
|
import '../../context/DynamicContext/DynamicContext.js';
|
|
8
7
|
import '../../shared/logger.js';
|
|
9
8
|
import '@dynamic-labs/iconic';
|
|
10
|
-
import '
|
|
9
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
10
|
+
import { useViewContext } from '../../context/ViewContext/ViewContext.js';
|
|
11
11
|
import '@dynamic-labs/wallet-book';
|
|
12
12
|
import '@dynamic-labs/utils';
|
|
13
13
|
import '../../utils/constants/colors.js';
|
|
@@ -30,7 +30,6 @@ import '../../context/UserWalletsContext/UserWalletsContext.js';
|
|
|
30
30
|
import '../../context/VerificationContext/VerificationContext.js';
|
|
31
31
|
import 'react-dom';
|
|
32
32
|
import '../../context/ThemeContext/ThemeContext.js';
|
|
33
|
-
import { useSmartWallets } from '../../utils/hooks/useSmartWallets/useSmartWallets.js';
|
|
34
33
|
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
35
34
|
import { usePasskeyRecovery } from '../../utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js';
|
|
36
35
|
import '@dynamic-labs/types';
|
|
@@ -60,6 +59,7 @@ import '../Transition/ZoomTransition/ZoomTransition.js';
|
|
|
60
59
|
import '../Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
61
60
|
import '../Transition/OpacityTransition/OpacityTransition.js';
|
|
62
61
|
import '../OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
62
|
+
import { SupportLinks } from '../SupportLinks/SupportLinks.js';
|
|
63
63
|
import '../PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
64
64
|
import '../Popper/Popper/Popper.js';
|
|
65
65
|
import '../Popper/PopperContext/PopperContext.js';
|
|
@@ -83,43 +83,44 @@ import '../../store/state/tokenBalances.js';
|
|
|
83
83
|
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
84
84
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
85
85
|
|
|
86
|
-
const NeedHelpSection = ({ isRecoveryFlow = false }) => {
|
|
87
|
-
var _a, _b, _c, _d, _e
|
|
88
|
-
const { projectSettings,
|
|
86
|
+
const NeedHelpSection = ({ isRecoveryFlow = false, isExport = false, }) => {
|
|
87
|
+
var _a, _b, _c, _d, _e;
|
|
88
|
+
const { projectSettings, user } = useInternalDynamicContext();
|
|
89
89
|
const { t } = useTranslation();
|
|
90
|
+
const { setView } = useViewContext();
|
|
90
91
|
const { initPasskeyRecoveryProcess } = usePasskeyRecovery();
|
|
91
92
|
const supportEmail = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _a === void 0 ? void 0 : _a.supportEmail;
|
|
92
|
-
const
|
|
93
|
-
((_c = Object.values(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.supportUrls)) === null || _c === void 0 ? void 0 : _c[0]);
|
|
93
|
+
const supportUrls = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _b === void 0 ? void 0 : _b.supportUrls;
|
|
94
94
|
// don't show passkey recovery helper on passkey creation flow views
|
|
95
95
|
const isRecoveryEnabled = !isRecoveryFlow &&
|
|
96
|
-
((
|
|
97
|
-
Boolean((
|
|
98
|
-
const {
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
const hasContactInfo = Boolean(supportEmail || supportUrl);
|
|
96
|
+
((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _c === void 0 ? void 0 : _c.find((p) => p.provider === ProviderEnum.Turnkey && p.enabledAt)) &&
|
|
97
|
+
Boolean((_e = (_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _d === void 0 ? void 0 : _d.embeddedWallets) === null || _e === void 0 ? void 0 : _e.emailRecoveryEnabled);
|
|
98
|
+
const v2Wallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.some((credential) => { var _a; return ((_a = credential.walletProperties) === null || _a === void 0 ? void 0 : _a.version) === EmbeddedWalletVersionEnum.V2; });
|
|
99
|
+
// revert to v2 wallet view (no passkey recovery) if passkey recovery is not enabled
|
|
100
|
+
const v1Wallet = !v2Wallet && isRecoveryEnabled;
|
|
101
|
+
const hasContactInfo = Boolean(supportEmail || Object.keys(supportUrls || {}).length > 0);
|
|
103
102
|
const getSupportHelpSession = () => {
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
// For v1 wallets, only show the "Go here for support" link that triggers recovery
|
|
104
|
+
if (v1Wallet) {
|
|
105
|
+
return (jsx(TextButton, { copykey: 'dyn_need_help_section.help_button', className: classNames('need-help-section__helper-link'), onClick: () => initPasskeyRecoveryProcess(undefined, {
|
|
106
|
+
settings: isExport
|
|
107
|
+
? {
|
|
108
|
+
goBack: () => {
|
|
109
|
+
setView('embedded-reveal-view');
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
: undefined,
|
|
113
|
+
type: 'helpSession',
|
|
114
|
+
}), children: t('dyn_need_help_section.help_button') }));
|
|
106
115
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (!isRecoveryEnabled) {
|
|
111
|
-
return null;
|
|
116
|
+
// V2 Wallet or V1 Wallet without recovery
|
|
117
|
+
if (hasContactInfo) {
|
|
118
|
+
return (jsx(SupportLinks, { supportEmail: supportEmail, supportUrls: supportUrls }));
|
|
112
119
|
}
|
|
113
|
-
const recoveryText = t('dyn_need_help_section.help_button');
|
|
114
|
-
const finalRecoveryText = hasContactInfo
|
|
115
|
-
? recoveryText
|
|
116
|
-
: recoveryText.slice(0, 1).toUpperCase() + recoveryText.slice(1);
|
|
117
|
-
return (jsxs(Fragment, { children: [hasContactInfo && (jsx(Typography, { color: 'secondary', variant: 'body_small', copykey: 'dyn_need_help_section.divider', children: t('dyn_need_help_section.divider') })), jsx(TextButton, { copykey: 'dyn_need_help_section.help_button', className: classNames('need-help-section__helper-link'), onClick: () => initPasskeyRecoveryProcess(undefined, 'helpSession'), children: finalRecoveryText })] }));
|
|
118
|
-
};
|
|
119
|
-
if (!hasContactInfo && (!isRecoveryEnabled || isSessionKeyCompatible)) {
|
|
120
120
|
return null;
|
|
121
|
-
}
|
|
122
|
-
|
|
121
|
+
};
|
|
122
|
+
// if there is no support info, don't render the component
|
|
123
|
+
return getSupportHelpSession() ? (jsxs("div", { className: 'need-help-section', children: [jsx(Typography, { color: 'secondary', variant: 'body_small', copykey: 'dyn_need_help_section.info', weight: 'medium', children: t('dyn_need_help_section.info') }), getSupportHelpSession()] })) : null;
|
|
123
124
|
};
|
|
124
125
|
|
|
125
126
|
export { NeedHelpSection };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
8
|
+
var Typography = require('../Typography/Typography.cjs');
|
|
9
|
+
|
|
10
|
+
const SupportLinks = ({ supportEmail, supportUrls, }) => {
|
|
11
|
+
const { t } = reactI18next.useTranslation();
|
|
12
|
+
if (!supportEmail && !supportUrls) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [supportEmail && (jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'secondary', copykey: 'dyn_need_help_section.contact_support', children: [t('dyn_need_help_section.contact_support'), ":", ' ', jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'link', as: 'span', children: jsxRuntime.jsx("a", { href: `mailto:${supportEmail}`, children: supportEmail }) })] })), supportUrls &&
|
|
16
|
+
Object.entries(supportUrls).map(([key, url]) => {
|
|
17
|
+
const platformName = key.charAt(0).toUpperCase() + key.slice(1);
|
|
18
|
+
return (jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'secondary', copykey: 'dyn_need_help_section.visit_platform', children: [t('dyn_need_help_section.visit_platform', {
|
|
19
|
+
platform: platformName,
|
|
20
|
+
}), ":", ' ', jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'link', as: 'span', children: jsxRuntime.jsx("a", { href: url, rel: 'noreferrer', target: '_blank', children: url }) })] }, key));
|
|
21
|
+
})] }));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.SupportLinks = SupportLinks;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Typography } from '../Typography/Typography.js';
|
|
5
|
+
|
|
6
|
+
const SupportLinks = ({ supportEmail, supportUrls, }) => {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
if (!supportEmail && !supportUrls) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return (jsxs(Fragment, { children: [supportEmail && (jsxs(Typography, { variant: 'body_small', color: 'secondary', copykey: 'dyn_need_help_section.contact_support', children: [t('dyn_need_help_section.contact_support'), ":", ' ', jsx(Typography, { variant: 'body_small', color: 'link', as: 'span', children: jsx("a", { href: `mailto:${supportEmail}`, children: supportEmail }) })] })), supportUrls &&
|
|
12
|
+
Object.entries(supportUrls).map(([key, url]) => {
|
|
13
|
+
const platformName = key.charAt(0).toUpperCase() + key.slice(1);
|
|
14
|
+
return (jsxs(Typography, { variant: 'body_small', color: 'secondary', copykey: 'dyn_need_help_section.visit_platform', children: [t('dyn_need_help_section.visit_platform', {
|
|
15
|
+
platform: platformName,
|
|
16
|
+
}), ":", ' ', jsx(Typography, { variant: 'body_small', color: 'link', as: 'span', children: jsx("a", { href: url, rel: 'noreferrer', target: '_blank', children: url }) })] }, key));
|
|
17
|
+
})] }));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { SupportLinks };
|
package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs
CHANGED
|
@@ -72,6 +72,7 @@ require('../Transition/OpacityTransition/OpacityTransition.cjs');
|
|
|
72
72
|
var VerticalDrawerTransition = require('../Transition/VerticalDrawerTransition/VerticalDrawerTransition.cjs');
|
|
73
73
|
require('../OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
74
74
|
var ModalHeader = require('../ModalHeader/ModalHeader.cjs');
|
|
75
|
+
var NeedHelpSection = require('../NeedHelpSection/NeedHelpSection.cjs');
|
|
75
76
|
var PasskeyCreatedSuccessBanner = require('../PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
76
77
|
require('../Popper/Popper/Popper.cjs');
|
|
77
78
|
require('../Popper/PopperContext/PopperContext.cjs');
|
|
@@ -123,9 +124,9 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
|
|
|
123
124
|
const backButton = onClickBack && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
|
|
124
125
|
const gasFiatValue = fiatUtils.getGasFiatValue(currentToken, transaction, nativePrice);
|
|
125
126
|
const totalGasFiatValue = fiatUtils.getTotalFiatCost(currentToken, transaction, nativePrice, transactionValue);
|
|
126
|
-
return hideModal ? null : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.confirmation_tx', children: t('dyn_send_transaction.data.confirmation_tx') }) }) }), jsxRuntime.jsx("div", { className: 'transaction-confirmation__banner', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_send_transaction.data.banner', children: t('dyn_send_transaction.data.banner') }) }), jsxRuntime.jsx(PasskeyCreatedSuccessBanner.PasskeyCreatedSuccessBanner, {}), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__body', children: [jsxRuntime.jsxs("div", { className: 'transaction-confirmation__content', children: [!sendBalanceTransaction ? (jsxRuntime.jsx(TransactionCard.TransactionCard, { transaction: transaction, isGasSponsored: isGasSponsored, simulationResult: simulationResult, recipient: recipient })) : (jsxRuntime.jsx(OldTransactionCard.OldTransactionCard, { transaction: transaction, currentToken: currentToken, currencySymbol: currencySymbol, valueRounded: (_a = utils.getValueRounded(Boolean(isNativeToken), transaction)) === null || _a === void 0 ? void 0 : _a.toString(), transactionValue: transactionValue, isGasSponsored: isGasSponsored, gasFiatValue: gasFiatValue || '0', totalGasFiatValue: totalGasFiatValue || '0', currency: currency, total: total, t: t, walletKey: walletKey })), children && (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: [(onClickBack || onClickClose) && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'primary', buttonPadding: 'small', onClick: onClickBack || onClickClose, expanded: true, disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'small', onClick: handleSubmitWithChecks, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.send', startSlot:
|
|
127
|
+
return hideModal ? null : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.confirmation_tx', children: t('dyn_send_transaction.data.confirmation_tx') }) }) }), !sendBalanceTransaction && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__banner', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_send_transaction.data.banner', children: t('dyn_send_transaction.data.banner') }) })), jsxRuntime.jsx(PasskeyCreatedSuccessBanner.PasskeyCreatedSuccessBanner, {}), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__body', children: [jsxRuntime.jsxs("div", { className: 'transaction-confirmation__content', children: [!sendBalanceTransaction ? (jsxRuntime.jsx(TransactionCard.TransactionCard, { transaction: transaction, isGasSponsored: isGasSponsored, simulationResult: simulationResult, recipient: recipient })) : (jsxRuntime.jsx(OldTransactionCard.OldTransactionCard, { transaction: transaction, currentToken: currentToken, currencySymbol: currencySymbol, valueRounded: (_a = utils.getValueRounded(Boolean(isNativeToken), transaction)) === null || _a === void 0 ? void 0 : _a.toString(), transactionValue: transactionValue, isGasSponsored: isGasSponsored, gasFiatValue: gasFiatValue || '0', totalGasFiatValue: totalGasFiatValue || '0', currency: currency, total: total, t: t, walletKey: walletKey })), children && (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: [(onClickBack || onClickClose) && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'primary', buttonPadding: 'small', onClick: onClickBack || onClickClose, expanded: true, disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'small', onClick: handleSubmitWithChecks, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.send', startSlot:
|
|
127
128
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
128
|
-
jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-secondary', children: jsxRuntime.jsx(send.ReactComponent, {}) }), dataTestId: 'transaction-confirmation-send', children: t('dyn_send_transaction.confirmation.send') })] }), displayPoweredByDynamicFooter && (jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' }))] })] }));
|
|
129
|
+
jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-secondary', children: jsxRuntime.jsx(send.ReactComponent, {}) }), dataTestId: 'transaction-confirmation-send', children: t('dyn_send_transaction.confirmation.send') })] }), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, {}), displayPoweredByDynamicFooter && (jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' }))] })] }));
|
|
129
130
|
};
|
|
130
131
|
|
|
131
132
|
exports.TransactionConfirmationPageLayout = TransactionConfirmationPageLayout;
|
package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js
CHANGED
|
@@ -68,6 +68,7 @@ import '../Transition/OpacityTransition/OpacityTransition.js';
|
|
|
68
68
|
import { VerticalDrawerTransition } from '../Transition/VerticalDrawerTransition/VerticalDrawerTransition.js';
|
|
69
69
|
import '../OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
70
70
|
import { ModalHeader } from '../ModalHeader/ModalHeader.js';
|
|
71
|
+
import { NeedHelpSection } from '../NeedHelpSection/NeedHelpSection.js';
|
|
71
72
|
import { PasskeyCreatedSuccessBanner } from '../PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
72
73
|
import '../Popper/Popper/Popper.js';
|
|
73
74
|
import '../Popper/PopperContext/PopperContext.js';
|
|
@@ -119,9 +120,9 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
|
|
|
119
120
|
const backButton = onClickBack && (jsx(IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsx(SvgArrowLeft, {}) }));
|
|
120
121
|
const gasFiatValue = getGasFiatValue(currentToken, transaction, nativePrice);
|
|
121
122
|
const totalGasFiatValue = getTotalFiatCost(currentToken, transaction, nativePrice, transactionValue);
|
|
122
|
-
return hideModal ? null : (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.confirmation_tx', children: t('dyn_send_transaction.data.confirmation_tx') }) }) }), jsx("div", { className: 'transaction-confirmation__banner', children: jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_send_transaction.data.banner', children: t('dyn_send_transaction.data.banner') }) }), jsx(PasskeyCreatedSuccessBanner, {}), jsxs("div", { className: 'transaction-confirmation__body', children: [jsxs("div", { className: 'transaction-confirmation__content', children: [!sendBalanceTransaction ? (jsx(TransactionCard, { transaction: transaction, isGasSponsored: isGasSponsored, simulationResult: simulationResult, recipient: recipient })) : (jsx(OldTransactionCard, { transaction: transaction, currentToken: currentToken, currencySymbol: currencySymbol, valueRounded: (_a = getValueRounded(Boolean(isNativeToken), transaction)) === null || _a === void 0 ? void 0 : _a.toString(), transactionValue: transactionValue, isGasSponsored: isGasSponsored, gasFiatValue: gasFiatValue || '0', totalGasFiatValue: totalGasFiatValue || '0', currency: currency, total: total, t: t, walletKey: walletKey })), children && (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: [(onClickBack || onClickClose) && (jsx(TypographyButton, { buttonVariant: 'primary', buttonPadding: 'small', onClick: onClickBack || onClickClose, expanded: true, disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsx(TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'small', onClick: handleSubmitWithChecks, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.send', startSlot:
|
|
123
|
+
return hideModal ? null : (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.confirmation_tx', children: t('dyn_send_transaction.data.confirmation_tx') }) }) }), !sendBalanceTransaction && (jsx("div", { className: 'transaction-confirmation__banner', children: jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_send_transaction.data.banner', children: t('dyn_send_transaction.data.banner') }) })), jsx(PasskeyCreatedSuccessBanner, {}), jsxs("div", { className: 'transaction-confirmation__body', children: [jsxs("div", { className: 'transaction-confirmation__content', children: [!sendBalanceTransaction ? (jsx(TransactionCard, { transaction: transaction, isGasSponsored: isGasSponsored, simulationResult: simulationResult, recipient: recipient })) : (jsx(OldTransactionCard, { transaction: transaction, currentToken: currentToken, currencySymbol: currencySymbol, valueRounded: (_a = getValueRounded(Boolean(isNativeToken), transaction)) === null || _a === void 0 ? void 0 : _a.toString(), transactionValue: transactionValue, isGasSponsored: isGasSponsored, gasFiatValue: gasFiatValue || '0', totalGasFiatValue: totalGasFiatValue || '0', currency: currency, total: total, t: t, walletKey: walletKey })), children && (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: [(onClickBack || onClickClose) && (jsx(TypographyButton, { buttonVariant: 'primary', buttonPadding: 'small', onClick: onClickBack || onClickClose, expanded: true, disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsx(TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'small', onClick: handleSubmitWithChecks, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.send', startSlot:
|
|
123
124
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
124
|
-
jsx(Icon, { size: 'small', color: 'text-secondary', children: jsx(SvgSend, {}) }), dataTestId: 'transaction-confirmation-send', children: t('dyn_send_transaction.confirmation.send') })] }), displayPoweredByDynamicFooter && (jsx(PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' }))] })] }));
|
|
125
|
+
jsx(Icon, { size: 'small', color: 'text-secondary', children: jsx(SvgSend, {}) }), dataTestId: 'transaction-confirmation-send', children: t('dyn_send_transaction.confirmation.send') })] }), jsx(NeedHelpSection, {}), displayPoweredByDynamicFooter && (jsx(PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' }))] })] }));
|
|
125
126
|
};
|
|
126
127
|
|
|
127
128
|
export { TransactionConfirmationPageLayout };
|
|
@@ -66,7 +66,9 @@ const useHandleRecovery = (walletConnector, usingSessionKey, onSuccess, shouldIn
|
|
|
66
66
|
if ((yield shouldInitRecovery()) &&
|
|
67
67
|
walletConnector &&
|
|
68
68
|
!usingSessionKey(walletConnector)) {
|
|
69
|
-
yield initPasskeyRecoveryProcess('email',
|
|
69
|
+
yield initPasskeyRecoveryProcess('email', {
|
|
70
|
+
type: 'sendTransaction',
|
|
71
|
+
}); // Ensure the parameters match the actual function signature
|
|
70
72
|
}
|
|
71
73
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess('callHandlerOutsideModal');
|
|
72
74
|
});
|
|
@@ -85,7 +87,9 @@ const useHandleSubmitWithChecks = (config, recoveryHandlers, viewHandlers) => (e
|
|
|
85
87
|
return;
|
|
86
88
|
}
|
|
87
89
|
if (yield shouldInitRecovery()) {
|
|
88
|
-
yield initPasskeyRecoveryProcess('email',
|
|
90
|
+
yield initPasskeyRecoveryProcess('email', {
|
|
91
|
+
type: 'sendTransaction',
|
|
92
|
+
});
|
|
89
93
|
}
|
|
90
94
|
if (isTurnkeyWallet && userNeedsCrossDomainPasskey) {
|
|
91
95
|
setView('passkey-new-domain-detected');
|
|
@@ -62,7 +62,9 @@ const useHandleRecovery = (walletConnector, usingSessionKey, onSuccess, shouldIn
|
|
|
62
62
|
if ((yield shouldInitRecovery()) &&
|
|
63
63
|
walletConnector &&
|
|
64
64
|
!usingSessionKey(walletConnector)) {
|
|
65
|
-
yield initPasskeyRecoveryProcess('email',
|
|
65
|
+
yield initPasskeyRecoveryProcess('email', {
|
|
66
|
+
type: 'sendTransaction',
|
|
67
|
+
}); // Ensure the parameters match the actual function signature
|
|
66
68
|
}
|
|
67
69
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess('callHandlerOutsideModal');
|
|
68
70
|
});
|
|
@@ -81,7 +83,9 @@ const useHandleSubmitWithChecks = (config, recoveryHandlers, viewHandlers) => (e
|
|
|
81
83
|
return;
|
|
82
84
|
}
|
|
83
85
|
if (yield shouldInitRecovery()) {
|
|
84
|
-
yield initPasskeyRecoveryProcess('email',
|
|
86
|
+
yield initPasskeyRecoveryProcess('email', {
|
|
87
|
+
type: 'sendTransaction',
|
|
88
|
+
});
|
|
85
89
|
}
|
|
86
90
|
if (isTurnkeyWallet && userNeedsCrossDomainPasskey) {
|
|
87
91
|
setView('passkey-new-domain-detected');
|
|
@@ -69,6 +69,7 @@ require('../../store/state/tokenBalances.cjs');
|
|
|
69
69
|
var WalletGroupContext = require('../WalletGroupContext/WalletGroupContext.cjs');
|
|
70
70
|
var useResetCookieLocalStorage = require('../../utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.cjs');
|
|
71
71
|
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
72
|
+
var useAggregateWalletEvents = require('../../utils/hooks/useAggregateWalletEvents/useAggregateWalletEvents.cjs');
|
|
72
73
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
73
74
|
require('../../components/IconButton/IconButton.cjs');
|
|
74
75
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
@@ -392,6 +393,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
392
393
|
}
|
|
393
394
|
},
|
|
394
395
|
});
|
|
396
|
+
useAggregateWalletEvents.useAggregateWalletEvents(primaryWallet);
|
|
395
397
|
useWalletEventListeners.useWalletEventListeners({
|
|
396
398
|
authMode,
|
|
397
399
|
detectNewWalletsForLinking,
|
|
@@ -65,6 +65,7 @@ import '../../store/state/tokenBalances.js';
|
|
|
65
65
|
import { WalletGroupContextProvider } from '../WalletGroupContext/WalletGroupContext.js';
|
|
66
66
|
import { useResetCookieLocalStorage } from '../../utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.js';
|
|
67
67
|
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
68
|
+
import { useAggregateWalletEvents } from '../../utils/hooks/useAggregateWalletEvents/useAggregateWalletEvents.js';
|
|
68
69
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
69
70
|
import '../../components/IconButton/IconButton.js';
|
|
70
71
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
@@ -388,6 +389,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
388
389
|
}
|
|
389
390
|
},
|
|
390
391
|
});
|
|
392
|
+
useAggregateWalletEvents(primaryWallet);
|
|
391
393
|
useWalletEventListeners({
|
|
392
394
|
authMode,
|
|
393
395
|
detectNewWalletsForLinking,
|
|
@@ -11,28 +11,33 @@ var dynamicEvents = require('../../events/dynamicEvents.cjs');
|
|
|
11
11
|
const UserWalletsContext = React.createContext(undefined);
|
|
12
12
|
const UserWalletsProvider = ({ children }) => {
|
|
13
13
|
const [userWallets, _setUserWallets] = React.useState([]);
|
|
14
|
+
const prevUserWallets = React.useRef([]);
|
|
14
15
|
const addedWalletsIds = React.useRef([]);
|
|
15
16
|
const removedWalletsIds = React.useRef([]);
|
|
16
17
|
const setUserWallets = React.useCallback((returnUpdatedWallets) => {
|
|
17
18
|
_setUserWallets((prevWallets) => {
|
|
19
|
+
prevUserWallets.current = prevWallets;
|
|
18
20
|
const updatedWallets = returnUpdatedWallets(prevWallets);
|
|
19
|
-
addedWalletsIds.current.forEach((walletId) => {
|
|
20
|
-
const wallet = updatedWallets.find(({ id }) => id === walletId);
|
|
21
|
-
if (!wallet)
|
|
22
|
-
return;
|
|
23
|
-
dynamicEvents.dynamicEvents.emit('walletAdded', wallet, updatedWallets);
|
|
24
|
-
});
|
|
25
|
-
removedWalletsIds.current.forEach((walletId) => {
|
|
26
|
-
const wallet = prevWallets.find(({ id }) => id === walletId);
|
|
27
|
-
if (!wallet)
|
|
28
|
-
return;
|
|
29
|
-
dynamicEvents.dynamicEvents.emit('walletRemoved', wallet, updatedWallets);
|
|
30
|
-
});
|
|
31
|
-
addedWalletsIds.current = [];
|
|
32
|
-
removedWalletsIds.current = [];
|
|
33
21
|
return updatedWallets;
|
|
34
22
|
});
|
|
35
23
|
}, []);
|
|
24
|
+
// it's an useEffect because it needs to be called after the userWallets state is updated
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
addedWalletsIds.current.forEach((walletId) => {
|
|
27
|
+
const wallet = userWallets.find(({ id }) => id === walletId);
|
|
28
|
+
if (!wallet)
|
|
29
|
+
return;
|
|
30
|
+
dynamicEvents.dynamicEvents.emit('walletAdded', wallet, userWallets);
|
|
31
|
+
});
|
|
32
|
+
removedWalletsIds.current.forEach((walletId) => {
|
|
33
|
+
const wallet = prevUserWallets.current.find(({ id }) => id === walletId);
|
|
34
|
+
if (!wallet)
|
|
35
|
+
return;
|
|
36
|
+
dynamicEvents.dynamicEvents.emit('walletRemoved', wallet, userWallets);
|
|
37
|
+
});
|
|
38
|
+
addedWalletsIds.current = [];
|
|
39
|
+
removedWalletsIds.current = [];
|
|
40
|
+
}, [userWallets]);
|
|
36
41
|
return (jsxRuntime.jsx(UserWalletsContext.Provider, { value: {
|
|
37
42
|
addedWalletsIds,
|
|
38
43
|
registerUserWallet: (newWallet) => setUserWallets((userWallets) => [...userWallets, newWallet]),
|