@dynamic-labs/sdk-react-core 0.19.0-alpha.26 → 0.19.0-alpha.28
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 +31 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +10 -10
- package/src/lib/components/Accordion/components/VerticalAccordion/VerticalAccordion.cjs +1 -1
- package/src/lib/components/Accordion/components/VerticalAccordion/VerticalAccordion.js +1 -1
- package/src/lib/components/Accordion/components/VerticalAccordion/VerticalAccordion.types.d.ts +2 -4
- package/src/lib/components/Button/Button.cjs +1 -0
- package/src/lib/components/Button/Button.d.ts +1 -1
- package/src/lib/components/Button/Button.js +1 -0
- package/src/lib/components/LogoutButton/LogoutButton.cjs +1 -3
- package/src/lib/components/LogoutButton/LogoutButton.js +1 -3
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +5 -2
- package/src/lib/components/NetworkPicker/NetworkPicker.js +5 -2
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +1 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +2 -2
- package/src/lib/components/Typography/Typography.cjs +1 -0
- package/src/lib/components/Typography/Typography.js +1 -0
- package/src/lib/components/Typography/Typography.types.d.ts +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +5 -3
- package/src/lib/context/DynamicContext/DynamicContext.js +5 -3
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.d.ts +0 -1
- package/src/lib/context/DynamicContext/useDynamicContext.cjs +1 -2
- package/src/lib/context/DynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext.js +1 -2
- package/src/lib/context/ViewContext/ViewContext.cjs +14 -1
- package/src/lib/context/ViewContext/ViewContext.d.ts +3 -1
- package/src/lib/context/ViewContext/ViewContext.js +15 -2
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +2 -2
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.d.ts +2 -2
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +2 -2
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.cjs +3 -2
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.d.ts +2 -3
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.js +4 -3
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +1 -7
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +2 -8
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs +2 -6
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.d.ts +1 -2
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js +2 -6
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +15 -5
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +15 -5
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +4 -2
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.d.ts +2 -1
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +4 -2
- package/src/lib/utils/types/ClassStyleProps.d.ts +5 -0
- package/src/lib/utils/types/index.d.ts +1 -0
- package/src/lib/views/LoginView/LoginView.cjs +1 -1
- package/src/lib/views/LoginView/LoginView.js +1 -1
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +7 -2
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +8 -3
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +1 -1
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +1 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +7 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.js +7 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.d.ts +4 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.d.ts +4 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedWidget.cjs +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedWidget.d.ts +4 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedWidget.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +2 -2
|
@@ -21,7 +21,7 @@ var useWalletsConnectionState = require('../useWalletsConnectionState/useWallets
|
|
|
21
21
|
var createLinkedWalletsFromWalletOptions = require('./utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs');
|
|
22
22
|
var reconnectSocialWallet = require('./reconnectSocialWallet.cjs');
|
|
23
23
|
|
|
24
|
-
const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: availableWallets, multiWalletWidgetState, setDesktopUri, setMultiWalletWidgetState, setQrcodeUri, primaryWalletId, setPrimaryWalletId, user, onboardingOnlyJwt, }) => {
|
|
24
|
+
const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: availableWallets, multiWalletWidgetState, setDesktopUri, setMultiWalletWidgetState, setQrcodeUri, primaryWalletId, setPrimaryWalletId, user, onboardingOnlyJwt, canHaveMultipleWalletsConnected, }) => {
|
|
25
25
|
const [showQrcodeModal, setShowQrcodeModal] = React.useState(false);
|
|
26
26
|
const linkedWallets = React.useMemo(() => {
|
|
27
27
|
if (!authToken) {
|
|
@@ -60,7 +60,9 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
60
60
|
computeConnectedStateForWallets();
|
|
61
61
|
}, [primaryWalletId, computeConnectedStateForWallets]);
|
|
62
62
|
const getPrimaryWallet = React.useCallback(() => { var _a; return (_a = wallets.find((wallet) => wallet.id === primaryWalletId)) !== null && _a !== void 0 ? _a : null; }, [primaryWalletId, wallets]);
|
|
63
|
-
const getSecondaryWallets = React.useCallback(() =>
|
|
63
|
+
const getSecondaryWallets = React.useCallback(() => canHaveMultipleWalletsConnected
|
|
64
|
+
? wallets.filter((wallet) => wallet.id !== primaryWalletId)
|
|
65
|
+
: [], [primaryWalletId, wallets, canHaveMultipleWalletsConnected]);
|
|
64
66
|
const getSelectedWallet = React.useCallback((walletId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
65
67
|
const newWallet = wallets.find(({ id }) => id === walletId);
|
|
66
68
|
if (!newWallet) {
|
|
@@ -15,6 +15,7 @@ type Props = {
|
|
|
15
15
|
primaryWalletId: string | undefined;
|
|
16
16
|
user?: UserProfile;
|
|
17
17
|
onboardingOnlyJwt?: string;
|
|
18
|
+
canHaveMultipleWalletsConnected?: boolean;
|
|
18
19
|
};
|
|
19
20
|
export interface UseWalletConnectors {
|
|
20
21
|
computeConnectedStateForWallets: () => Promise<void>;
|
|
@@ -29,5 +30,5 @@ export interface UseWalletConnectors {
|
|
|
29
30
|
walletConnectors: WalletConnector[];
|
|
30
31
|
wallets: Wallet[];
|
|
31
32
|
}
|
|
32
|
-
export declare const useWalletConnectors: ({ authMode, authToken, connectedWallets, wallets: availableWallets, multiWalletWidgetState, setDesktopUri, setMultiWalletWidgetState, setQrcodeUri, primaryWalletId, setPrimaryWalletId, user, onboardingOnlyJwt, }: Props) => UseWalletConnectors;
|
|
33
|
+
export declare const useWalletConnectors: ({ authMode, authToken, connectedWallets, wallets: availableWallets, multiWalletWidgetState, setDesktopUri, setMultiWalletWidgetState, setQrcodeUri, primaryWalletId, setPrimaryWalletId, user, onboardingOnlyJwt, canHaveMultipleWalletsConnected, }: Props) => UseWalletConnectors;
|
|
33
34
|
export {};
|
|
@@ -17,7 +17,7 @@ import { useWalletsConnectionState } from '../useWalletsConnectionState/useWalle
|
|
|
17
17
|
import { createLinkedWalletsFromWalletOptions } from './utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js';
|
|
18
18
|
import { reconnectSocialWallet } from './reconnectSocialWallet.js';
|
|
19
19
|
|
|
20
|
-
const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: availableWallets, multiWalletWidgetState, setDesktopUri, setMultiWalletWidgetState, setQrcodeUri, primaryWalletId, setPrimaryWalletId, user, onboardingOnlyJwt, }) => {
|
|
20
|
+
const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: availableWallets, multiWalletWidgetState, setDesktopUri, setMultiWalletWidgetState, setQrcodeUri, primaryWalletId, setPrimaryWalletId, user, onboardingOnlyJwt, canHaveMultipleWalletsConnected, }) => {
|
|
21
21
|
const [showQrcodeModal, setShowQrcodeModal] = useState(false);
|
|
22
22
|
const linkedWallets = useMemo(() => {
|
|
23
23
|
if (!authToken) {
|
|
@@ -56,7 +56,9 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
56
56
|
computeConnectedStateForWallets();
|
|
57
57
|
}, [primaryWalletId, computeConnectedStateForWallets]);
|
|
58
58
|
const getPrimaryWallet = useCallback(() => { var _a; return (_a = wallets.find((wallet) => wallet.id === primaryWalletId)) !== null && _a !== void 0 ? _a : null; }, [primaryWalletId, wallets]);
|
|
59
|
-
const getSecondaryWallets = useCallback(() =>
|
|
59
|
+
const getSecondaryWallets = useCallback(() => canHaveMultipleWalletsConnected
|
|
60
|
+
? wallets.filter((wallet) => wallet.id !== primaryWalletId)
|
|
61
|
+
: [], [primaryWalletId, wallets, canHaveMultipleWalletsConnected]);
|
|
60
62
|
const getSelectedWallet = useCallback((walletId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
63
|
const newWallet = wallets.find(({ id }) => id === walletId);
|
|
62
64
|
if (!newWallet) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ClassStyleProps';
|
|
@@ -53,6 +53,7 @@ require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUse
|
|
|
53
53
|
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
54
54
|
require('formik');
|
|
55
55
|
require('yup');
|
|
56
|
+
var Button = require('../../../../components/Button/Button.cjs');
|
|
56
57
|
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
57
58
|
require('../../../../components/Alert/Alert.cjs');
|
|
58
59
|
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
@@ -63,7 +64,7 @@ var useEmailProvider = require('../../../../utils/hooks/useEmailProvider/useEmai
|
|
|
63
64
|
|
|
64
65
|
const EMAIL_REGEX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
|
|
65
66
|
const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError, currentEmail, }) => {
|
|
66
|
-
var _a;
|
|
67
|
+
var _a, _b, _c;
|
|
67
68
|
const { t } = reactI18next.useTranslation();
|
|
68
69
|
const { environmentId, wallets, projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
69
70
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
@@ -122,7 +123,11 @@ const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError,
|
|
|
122
123
|
}
|
|
123
124
|
});
|
|
124
125
|
// social sign in currently coupled to email... might be better to decouple
|
|
125
|
-
return (jsxRuntime.
|
|
126
|
+
return (jsxRuntime.jsxs("form", { className: 'login-with-email-form', onSubmit: (e) => handleSubmit(e), children: [jsxRuntime.jsx(Input.Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, label: 'Enter your email', error: invalidEmail, message: invalidEmail && t('dyn_login.helper.email_form.invalid_email'), suffix: ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _b === void 0 ? void 0 : _b.emailSubmitButtonInsideInput)
|
|
127
|
+
? emailInputSuffixIcon
|
|
128
|
+
: null, disabled: isLoading }), !((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _c === void 0 ? void 0 : _c.emailSubmitButtonInsideInput) && (jsxRuntime.jsx(Button.Button, { dataTestId: 'email_submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading, buttonVariant: 'brand-primary', buttonPadding: 'large', expanded: true, typographyProps: {
|
|
129
|
+
color: 'inherit',
|
|
130
|
+
}, children: "Continue" }))] }));
|
|
126
131
|
};
|
|
127
132
|
|
|
128
133
|
exports.EMAIL_REGEX = EMAIL_REGEX;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useState, useMemo } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { isEmailWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
@@ -49,6 +49,7 @@ import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser
|
|
|
49
49
|
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
50
50
|
import 'formik';
|
|
51
51
|
import 'yup';
|
|
52
|
+
import { Button } from '../../../../components/Button/Button.js';
|
|
52
53
|
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
53
54
|
import '../../../../components/Alert/Alert.js';
|
|
54
55
|
import '../../../../components/Popper/Popper/Popper.js';
|
|
@@ -59,7 +60,7 @@ import { useEmailProvider } from '../../../../utils/hooks/useEmailProvider/useEm
|
|
|
59
60
|
|
|
60
61
|
const EMAIL_REGEX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
|
|
61
62
|
const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError, currentEmail, }) => {
|
|
62
|
-
var _a;
|
|
63
|
+
var _a, _b, _c;
|
|
63
64
|
const { t } = useTranslation();
|
|
64
65
|
const { environmentId, wallets, projectSettings } = useInternalDynamicContext();
|
|
65
66
|
const { setErrorMessage } = useErrorContext();
|
|
@@ -118,7 +119,11 @@ const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError,
|
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
121
|
// social sign in currently coupled to email... might be better to decouple
|
|
121
|
-
return (
|
|
122
|
+
return (jsxs("form", { className: 'login-with-email-form', onSubmit: (e) => handleSubmit(e), children: [jsx(Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, label: 'Enter your email', error: invalidEmail, message: invalidEmail && t('dyn_login.helper.email_form.invalid_email'), suffix: ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _b === void 0 ? void 0 : _b.emailSubmitButtonInsideInput)
|
|
123
|
+
? emailInputSuffixIcon
|
|
124
|
+
: null, disabled: isLoading }), !((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _c === void 0 ? void 0 : _c.emailSubmitButtonInsideInput) && (jsx(Button, { dataTestId: 'email_submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading, buttonVariant: 'brand-primary', buttonPadding: 'large', expanded: true, typographyProps: {
|
|
125
|
+
color: 'inherit',
|
|
126
|
+
}, children: "Continue" }))] }));
|
|
122
127
|
};
|
|
123
128
|
|
|
124
129
|
export { EMAIL_REGEX, LoginEmailForm };
|
|
@@ -94,7 +94,7 @@ const PendingSignatureView = () => {
|
|
|
94
94
|
} }));
|
|
95
95
|
const typographyBodyCopy = isPhantomLedger
|
|
96
96
|
? "Click sign in your wallet to confirm you own this wallet (this doesn't cost gas)."
|
|
97
|
-
: 'Click sign in your wallet to confirm you own this wallet.';
|
|
97
|
+
: 'Click sign-in in your wallet to confirm you own this wallet.';
|
|
98
98
|
return (jsxRuntime.jsxs("div", { className: 'pending-signature__container', "data-testid": 'pending-signature-view', children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: icon, iconSize: iconSize, isSpinning: true, indicator: 'connected', className: 'pending-signature__icon-with-spinner' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', className: classNames.classNames('pending-signature__copy'), children: typographyBodyCopy }), isPhantomLedger && (jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', weight: 'regular', className: classNames.classNames('pending-signature__copy', 'pending-signature__copy--mini'), children: [jsxRuntime.jsx("strong", { children: "Note:" }), " Ledger with Phantom doesn\u2019t support message signing. When logging in, a small fee (which should not apply) may appear. See below to learn more."] })), requiresTwoStepAuthentication.requiresTwoStepAuthentication(walletConnector) && (jsxRuntime.jsx(Button.Button, { buttonClassName: 'pending-signature__button', onClick: handleClick, loading: loading, buttonVariant: 'primary', buttonPadding: 'large', expanded: true, typographyProps: {
|
|
99
99
|
variant: 'button_primary',
|
|
100
100
|
weight: 'medium',
|
|
@@ -90,7 +90,7 @@ const PendingSignatureView = () => {
|
|
|
90
90
|
} }));
|
|
91
91
|
const typographyBodyCopy = isPhantomLedger
|
|
92
92
|
? "Click sign in your wallet to confirm you own this wallet (this doesn't cost gas)."
|
|
93
|
-
: 'Click sign in your wallet to confirm you own this wallet.';
|
|
93
|
+
: 'Click sign-in in your wallet to confirm you own this wallet.';
|
|
94
94
|
return (jsxs("div", { className: 'pending-signature__container', "data-testid": 'pending-signature-view', children: [jsx(IconWithSpinner, { Icon: icon, iconSize: iconSize, isSpinning: true, indicator: 'connected', className: 'pending-signature__icon-with-spinner' }), jsx(Typography, { variant: 'body_normal', weight: 'regular', className: classNames('pending-signature__copy'), children: typographyBodyCopy }), isPhantomLedger && (jsxs(Typography, { variant: 'body_small', weight: 'regular', className: classNames('pending-signature__copy', 'pending-signature__copy--mini'), children: [jsx("strong", { children: "Note:" }), " Ledger with Phantom doesn\u2019t support message signing. When logging in, a small fee (which should not apply) may appear. See below to learn more."] })), requiresTwoStepAuthentication(walletConnector) && (jsx(Button, { buttonClassName: 'pending-signature__button', onClick: handleClick, loading: loading, buttonVariant: 'primary', buttonPadding: 'large', expanded: true, typographyProps: {
|
|
95
95
|
variant: 'button_primary',
|
|
96
96
|
weight: 'medium',
|
|
@@ -65,6 +65,7 @@ var TransactionStatusLayout = require('../../components/TransactionStatusLayout/
|
|
|
65
65
|
var useFetchCurrency = require('../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.cjs');
|
|
66
66
|
var TransactionStage = require('./components/TransactionStage/TransactionStage.cjs');
|
|
67
67
|
|
|
68
|
+
const isZkSync = (chainId) => chainId === 280 || chainId === 324;
|
|
68
69
|
const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
|
|
69
70
|
const [stage, setStage] = React.useState('form');
|
|
70
71
|
const { primaryWallet, network } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -100,10 +101,15 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
100
101
|
if (!provider || value === null) {
|
|
101
102
|
return null;
|
|
102
103
|
}
|
|
104
|
+
let transactionType = 'eip2930';
|
|
105
|
+
// ZKSync RPCs return 'access lists are not supported' error when using eip2930
|
|
106
|
+
if (isZkSync(Number(network))) {
|
|
107
|
+
transactionType = undefined;
|
|
108
|
+
}
|
|
103
109
|
const transaction = {
|
|
104
110
|
from: primaryWallet.address,
|
|
105
111
|
to: recipientAddress,
|
|
106
|
-
type:
|
|
112
|
+
type: transactionType,
|
|
107
113
|
value,
|
|
108
114
|
};
|
|
109
115
|
return (jsxRuntime.jsx(TransactionStage.TransactionStage, { walletConnector: walletConnector, provider: provider, transaction: transaction, title: 'Confirm transaction', onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (transaction) => {
|
|
@@ -61,6 +61,7 @@ import { TransactionStatusLayout } from '../../components/TransactionStatusLayou
|
|
|
61
61
|
import { useFetchCurrency } from '../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.js';
|
|
62
62
|
import { TransactionStage } from './components/TransactionStage/TransactionStage.js';
|
|
63
63
|
|
|
64
|
+
const isZkSync = (chainId) => chainId === 280 || chainId === 324;
|
|
64
65
|
const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
|
|
65
66
|
const [stage, setStage] = useState('form');
|
|
66
67
|
const { primaryWallet, network } = useInternalDynamicContext();
|
|
@@ -96,10 +97,15 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
96
97
|
if (!provider || value === null) {
|
|
97
98
|
return null;
|
|
98
99
|
}
|
|
100
|
+
let transactionType = 'eip2930';
|
|
101
|
+
// ZKSync RPCs return 'access lists are not supported' error when using eip2930
|
|
102
|
+
if (isZkSync(Number(network))) {
|
|
103
|
+
transactionType = undefined;
|
|
104
|
+
}
|
|
99
105
|
const transaction = {
|
|
100
106
|
from: primaryWallet.address,
|
|
101
107
|
to: recipientAddress,
|
|
102
|
-
type:
|
|
108
|
+
type: transactionType,
|
|
103
109
|
value,
|
|
104
110
|
};
|
|
105
111
|
return (jsx(TransactionStage, { walletConnector: walletConnector, provider: provider, transaction: transaction, title: 'Confirm transaction', onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (transaction) => {
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs
CHANGED
|
@@ -61,7 +61,7 @@ var SocialRedirectContext = require('../../../context/SocialRedirectContext/Soci
|
|
|
61
61
|
require('../../../views/WalletList/WalletList.cjs');
|
|
62
62
|
var viewToComponentMap = require('../../../views/viewToComponentMap.cjs');
|
|
63
63
|
|
|
64
|
-
const DynamicEmbeddedAuthFlow = ({ background = 'none', }) => {
|
|
64
|
+
const DynamicEmbeddedAuthFlow = ({ background = 'none', className, style, }) => {
|
|
65
65
|
const hide = useIsLoggedIn.useIsLoggedIn();
|
|
66
66
|
const { projectSettings, internalEvents, isRenderingEmbeddedAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
67
67
|
const { view: authView, goToInitialView: resetAuthView } = ViewContext.useViewContext();
|
|
@@ -82,7 +82,7 @@ const DynamicEmbeddedAuthFlow = ({ background = 'none', }) => {
|
|
|
82
82
|
}, [hide]);
|
|
83
83
|
if (hide)
|
|
84
84
|
return null;
|
|
85
|
-
const content = (jsxRuntime.jsx(DynamicAuthLayout.DynamicAuthLayout, { projectSettings: projectSettings, children: viewToComponentMap.viewToComponentMap[authView] }));
|
|
85
|
+
const content = (jsxRuntime.jsx(DynamicAuthLayout.DynamicAuthLayout, { className: className, style: style, projectSettings: projectSettings, children: viewToComponentMap.viewToComponentMap[authView] }));
|
|
86
86
|
return (jsxRuntime.jsx(ShadowDOM.ShadowDOM, { className: 'embedded-widget', children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: jsxRuntime.jsx(SocialRedirectContext.SocialRedirectContextProvider, { children: jsxRuntime.jsx(index.FooterAnimationContextProvider, { children: background === 'none' ? (content) : (jsxRuntime.jsx(ModalCard.ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }) }) }));
|
|
87
87
|
};
|
|
88
88
|
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { EmbedProps } from '../EmbedProps.type';
|
|
3
|
-
|
|
3
|
+
import { ClassStyleProps } from '../../../utils/types';
|
|
4
|
+
type DynamicEmbeddedAuthFlowProps = EmbedProps & ClassStyleProps;
|
|
5
|
+
export declare const DynamicEmbeddedAuthFlow: FC<DynamicEmbeddedAuthFlowProps>;
|
|
6
|
+
export {};
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js
CHANGED
|
@@ -57,7 +57,7 @@ import { SocialRedirectContextProvider } from '../../../context/SocialRedirectCo
|
|
|
57
57
|
import '../../../views/WalletList/WalletList.js';
|
|
58
58
|
import { viewToComponentMap } from '../../../views/viewToComponentMap.js';
|
|
59
59
|
|
|
60
|
-
const DynamicEmbeddedAuthFlow = ({ background = 'none', }) => {
|
|
60
|
+
const DynamicEmbeddedAuthFlow = ({ background = 'none', className, style, }) => {
|
|
61
61
|
const hide = useIsLoggedIn();
|
|
62
62
|
const { projectSettings, internalEvents, isRenderingEmbeddedAuthFlow } = useInternalDynamicContext();
|
|
63
63
|
const { view: authView, goToInitialView: resetAuthView } = useViewContext();
|
|
@@ -78,7 +78,7 @@ const DynamicEmbeddedAuthFlow = ({ background = 'none', }) => {
|
|
|
78
78
|
}, [hide]);
|
|
79
79
|
if (hide)
|
|
80
80
|
return null;
|
|
81
|
-
const content = (jsx(DynamicAuthLayout, { projectSettings: projectSettings, children: viewToComponentMap[authView] }));
|
|
81
|
+
const content = (jsx(DynamicAuthLayout, { className: className, style: style, projectSettings: projectSettings, children: viewToComponentMap[authView] }));
|
|
82
82
|
return (jsx(ShadowDOM, { className: 'embedded-widget', children: jsx(PopperProvider, { children: jsx(SocialRedirectContextProvider, { children: jsx(FooterAnimationContextProvider, { children: background === 'none' ? (content) : (jsx(ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }) }) }));
|
|
83
83
|
};
|
|
84
84
|
|
|
@@ -54,11 +54,11 @@ var ModalCard = require('../../../components/ModalCard/ModalCard.cjs');
|
|
|
54
54
|
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
55
55
|
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
56
56
|
|
|
57
|
-
const DynamicEmbeddedUserProfile = ({ background = 'none', }) => {
|
|
57
|
+
const DynamicEmbeddedUserProfile = ({ background = 'none', className, style }) => {
|
|
58
58
|
const show = useIsLoggedIn.useIsLoggedIn();
|
|
59
59
|
if (!show)
|
|
60
60
|
return null;
|
|
61
|
-
const content = jsxRuntime.jsx(DynamicUserProfileLayout.DynamicUserProfileLayout, { variant: 'modal' });
|
|
61
|
+
const content = (jsxRuntime.jsx(DynamicUserProfileLayout.DynamicUserProfileLayout, { className: className, style: style, variant: 'modal' }));
|
|
62
62
|
return (jsxRuntime.jsx(ShadowDOM.ShadowDOM, { className: 'embedded-widget', children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: background === 'none' ? (content) : (jsxRuntime.jsx(ModalCard.ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }));
|
|
63
63
|
};
|
|
64
64
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { EmbedProps } from '../EmbedProps.type';
|
|
3
|
-
|
|
3
|
+
import { ClassStyleProps } from '../../../utils/types';
|
|
4
|
+
type DynamicEmbeddedUserProfileProps = EmbedProps & ClassStyleProps;
|
|
5
|
+
export declare const DynamicEmbeddedUserProfile: FC<DynamicEmbeddedUserProfileProps>;
|
|
6
|
+
export {};
|
|
@@ -50,11 +50,11 @@ import { ModalCard } from '../../../components/ModalCard/ModalCard.js';
|
|
|
50
50
|
import '../../../components/InlineWidget/InlineWidget.js';
|
|
51
51
|
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
52
52
|
|
|
53
|
-
const DynamicEmbeddedUserProfile = ({ background = 'none', }) => {
|
|
53
|
+
const DynamicEmbeddedUserProfile = ({ background = 'none', className, style }) => {
|
|
54
54
|
const show = useIsLoggedIn();
|
|
55
55
|
if (!show)
|
|
56
56
|
return null;
|
|
57
|
-
const content = jsx(DynamicUserProfileLayout, { variant: 'modal' });
|
|
57
|
+
const content = (jsx(DynamicUserProfileLayout, { className: className, style: style, variant: 'modal' }));
|
|
58
58
|
return (jsx(ShadowDOM, { className: 'embedded-widget', children: jsx(PopperProvider, { children: background === 'none' ? (content) : (jsx(ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }));
|
|
59
59
|
};
|
|
60
60
|
|
|
@@ -6,8 +6,8 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var DynamicEmbeddedAuthFlow = require('./DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs');
|
|
7
7
|
var DynamicEmbeddedUserProfile = require('./DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs');
|
|
8
8
|
|
|
9
|
-
const DynamicEmbeddedWidget = ({ background = 'none', }) => (
|
|
9
|
+
const DynamicEmbeddedWidget = ({ background = 'none', className, style, }) => (
|
|
10
10
|
// Only one of these 2 show at any given time, due these components' own definitions
|
|
11
|
-
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DynamicEmbeddedAuthFlow.DynamicEmbeddedAuthFlow, { background: background }), jsxRuntime.jsx(DynamicEmbeddedUserProfile.DynamicEmbeddedUserProfile, { background: background })] }));
|
|
11
|
+
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DynamicEmbeddedAuthFlow.DynamicEmbeddedAuthFlow, { background: background, className: className, style: style }), jsxRuntime.jsx(DynamicEmbeddedUserProfile.DynamicEmbeddedUserProfile, { background: background, className: className, style: style })] }));
|
|
12
12
|
|
|
13
13
|
exports.DynamicEmbeddedWidget = DynamicEmbeddedWidget;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { ClassStyleProps } from '../../utils/types';
|
|
2
3
|
import { EmbedProps } from './EmbedProps.type';
|
|
3
|
-
|
|
4
|
+
type DynamicEmbeddedWidgetProps = EmbedProps & ClassStyleProps;
|
|
5
|
+
export declare const DynamicEmbeddedWidget: FC<DynamicEmbeddedWidgetProps>;
|
|
6
|
+
export {};
|
|
@@ -2,8 +2,8 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { DynamicEmbeddedAuthFlow } from './DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js';
|
|
3
3
|
import { DynamicEmbeddedUserProfile } from './DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js';
|
|
4
4
|
|
|
5
|
-
const DynamicEmbeddedWidget = ({ background = 'none', }) => (
|
|
5
|
+
const DynamicEmbeddedWidget = ({ background = 'none', className, style, }) => (
|
|
6
6
|
// Only one of these 2 show at any given time, due these components' own definitions
|
|
7
|
-
jsxs(Fragment, { children: [jsx(DynamicEmbeddedAuthFlow, { background: background }), jsx(DynamicEmbeddedUserProfile, { background: background })] }));
|
|
7
|
+
jsxs(Fragment, { children: [jsx(DynamicEmbeddedAuthFlow, { background: background, className: className, style: style }), jsx(DynamicEmbeddedUserProfile, { background: background, className: className, style: style })] }));
|
|
8
8
|
|
|
9
9
|
export { DynamicEmbeddedWidget };
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs
CHANGED
|
@@ -71,7 +71,7 @@ const ICON_SIZE = 28;
|
|
|
71
71
|
const ActiveWalletInformation = () => {
|
|
72
72
|
const { t } = reactI18next.useTranslation();
|
|
73
73
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = React.useState(false);
|
|
74
|
-
const { primaryWallet, authToken, network,
|
|
74
|
+
const { primaryWallet, authToken, network, projectSettings, handleLogOut } = useInternalDynamicContext.useInternalDynamicContext();
|
|
75
75
|
const address = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address;
|
|
76
76
|
const nameService = useFetchNameService.useFetchNameService(address);
|
|
77
77
|
const { data: testnet } = usePromise.usePromise(() => isTestnet.isTestnet(primaryWallet), { deps: [network] });
|
|
@@ -105,7 +105,7 @@ const ActiveWalletInformation = () => {
|
|
|
105
105
|
const evmNetworks = ((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) &&
|
|
106
106
|
(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector).evmNetworks) ||
|
|
107
107
|
[];
|
|
108
|
-
return (jsxRuntime.jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxRuntime.jsxs("div", { className: 'active-wallet-information', children: [jsxRuntime.jsxs("div", { className: 'active-wallet-information__header', children: [(nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsxRuntime.jsx("div", { className: 'active-wallet-information__avatar', children: jsxRuntime.jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsxRuntime.jsx("div", { className: 'active-wallet-information__wallet-img', children: jsxRuntime.jsx(AuthProviderIcon.AuthProviderIcon, { jwt: authToken, iconSize: ICON_SIZE, showStatus: true }) })), jsxRuntime.jsxs("div", { className: 'active-wallet-information__details', children: [jsxRuntime.jsxs("div", { className: classNames.classNames('active-wallet-information__actions-container', {
|
|
108
|
+
return (jsxRuntime.jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxRuntime.jsxs("div", { className: 'active-wallet-information', children: [jsxRuntime.jsxs("div", { className: 'active-wallet-information__header', children: [jsxRuntime.jsx("div", { className: 'active-wallet-information__avatar--centered', children: (nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsxRuntime.jsx("div", { className: 'active-wallet-information__avatar', children: jsxRuntime.jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsxRuntime.jsx("div", { className: 'active-wallet-information__wallet-img', children: jsxRuntime.jsx(AuthProviderIcon.AuthProviderIcon, { jwt: authToken, iconSize: ICON_SIZE, showStatus: true }) })) }), jsxRuntime.jsxs("div", { className: 'active-wallet-information__details', children: [jsxRuntime.jsxs("div", { className: classNames.classNames('active-wallet-information__actions-container', {
|
|
109
109
|
'active-wallet-information__actions-container--centered': !(nameService === null || nameService === void 0 ? void 0 : nameService.name),
|
|
110
110
|
}), children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: nameService === null || nameService === void 0 ? void 0 : nameService.name }), jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__address', weight: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'regular' : 'medium', variant: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'body_small' : 'body_normal', color: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'secondary' : 'primary', children: shortenWalletAddress.shortenWalletAddress(address, 4, 4) })] }), jsxRuntime.jsx(DotsMenu.DotsMenu, { "data-testid": 'dots-menu', options: options, buttonClassName: 'active-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'active-wallet-information__dots-menu' })] }), jsxRuntime.jsx(NetworkPicker.NetworkPicker, { connector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, mainClassName: 'active-wallet-information__network-picker', buttonClassName: 'active-wallet-information__network-picker-button', evmNetworks: evmNetworks, showNetworkName: true })] })] }), testnet && (jsxRuntime.jsx(Alert.Alert, { variant: 'warning', children: t('dyn_active_wallet_info.testnet_warning') }))] }), jsxRuntime.jsxs("div", { className: 'balance-container', children: [jsxRuntime.jsx(Typography.Typography, { color: 'secondary', variant: 'body_small', children: "Balance" }), primaryWallet && (jsxRuntime.jsx(Balance.Balance, { className: 'balance-container__balance', connector: primaryWallet.connector, address: primaryWallet.address, network: network }))] })] }));
|
|
111
111
|
};
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js
CHANGED
|
@@ -67,7 +67,7 @@ const ICON_SIZE = 28;
|
|
|
67
67
|
const ActiveWalletInformation = () => {
|
|
68
68
|
const { t } = useTranslation();
|
|
69
69
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = useState(false);
|
|
70
|
-
const { primaryWallet, authToken, network,
|
|
70
|
+
const { primaryWallet, authToken, network, projectSettings, handleLogOut } = useInternalDynamicContext();
|
|
71
71
|
const address = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address;
|
|
72
72
|
const nameService = useFetchNameService(address);
|
|
73
73
|
const { data: testnet } = usePromise(() => isTestnet(primaryWallet), { deps: [network] });
|
|
@@ -101,7 +101,7 @@ const ActiveWalletInformation = () => {
|
|
|
101
101
|
const evmNetworks = ((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) &&
|
|
102
102
|
(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector).evmNetworks) ||
|
|
103
103
|
[];
|
|
104
|
-
return (jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information__header', children: [(nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsx("div", { className: 'active-wallet-information__avatar', children: jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsx("div", { className: 'active-wallet-information__wallet-img', children: jsx(AuthProviderIcon, { jwt: authToken, iconSize: ICON_SIZE, showStatus: true }) })), jsxs("div", { className: 'active-wallet-information__details', children: [jsxs("div", { className: classNames('active-wallet-information__actions-container', {
|
|
104
|
+
return (jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information__header', children: [jsx("div", { className: 'active-wallet-information__avatar--centered', children: (nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsx("div", { className: 'active-wallet-information__avatar', children: jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsx("div", { className: 'active-wallet-information__wallet-img', children: jsx(AuthProviderIcon, { jwt: authToken, iconSize: ICON_SIZE, showStatus: true }) })) }), jsxs("div", { className: 'active-wallet-information__details', children: [jsxs("div", { className: classNames('active-wallet-information__actions-container', {
|
|
105
105
|
'active-wallet-information__actions-container--centered': !(nameService === null || nameService === void 0 ? void 0 : nameService.name),
|
|
106
106
|
}), children: [jsxs("div", { children: [jsx(Typography, { className: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: nameService === null || nameService === void 0 ? void 0 : nameService.name }), jsx(Typography, { className: 'active-wallet-information__address', weight: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'regular' : 'medium', variant: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'body_small' : 'body_normal', color: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'secondary' : 'primary', children: shortenWalletAddress(address, 4, 4) })] }), jsx(DotsMenu, { "data-testid": 'dots-menu', options: options, buttonClassName: 'active-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'active-wallet-information__dots-menu' })] }), jsx(NetworkPicker, { connector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, mainClassName: 'active-wallet-information__network-picker', buttonClassName: 'active-wallet-information__network-picker-button', evmNetworks: evmNetworks, showNetworkName: true })] })] }), testnet && (jsx(Alert, { variant: 'warning', children: t('dyn_active_wallet_info.testnet_warning') }))] }), jsxs("div", { className: 'balance-container', children: [jsx(Typography, { color: 'secondary', variant: 'body_small', children: "Balance" }), primaryWallet && (jsx(Balance, { className: 'balance-container__balance', connector: primaryWallet.connector, address: primaryWallet.address, network: network }))] })] }));
|
|
107
107
|
};
|
|
@@ -67,7 +67,7 @@ const DynamicUserProfile = ({ variant, }) => {
|
|
|
67
67
|
}, [variant]);
|
|
68
68
|
if (!projectSettings)
|
|
69
69
|
return null;
|
|
70
|
-
return (jsxRuntime.jsx(IsBrowser.IsBrowser, { children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: jsxRuntime.jsx(DynamicWidgetVariants.DynamicWidgetVariants, { isOpen: isOpen, setIsOpen: setIsOpen, variant: _variant, zIndex: index.widgetModalZIndex, children: jsxRuntime.jsx(DynamicWidgetCard.DynamicWidgetCard, { ref: widgetRef, children: jsxRuntime.jsx(DynamicUserProfileLayout.DynamicUserProfileLayout, { variant: variant }) }) }) }) }));
|
|
70
|
+
return (jsxRuntime.jsx(IsBrowser.IsBrowser, { children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: jsxRuntime.jsx(DynamicWidgetVariants.DynamicWidgetVariants, { isOpen: isOpen, setIsOpen: setIsOpen, variant: _variant, zIndex: index.widgetModalZIndex, children: jsxRuntime.jsx(DynamicWidgetCard.DynamicWidgetCard, { ref: widgetRef, children: jsxRuntime.jsx(DynamicUserProfileLayout.DynamicUserProfileLayout, { className: 'modal-user-profile', variant: variant }) }) }) }) }));
|
|
71
71
|
};
|
|
72
72
|
const ShadowedDynamicUserProfile = () => (jsxRuntime.jsx(ShadowDOM.ShadowDOM, { zIndex: index.widgetModalZIndex, children: jsxRuntime.jsx(DynamicUserProfile, {}) }));
|
|
73
73
|
|
|
@@ -63,7 +63,7 @@ const DynamicUserProfile = ({ variant, }) => {
|
|
|
63
63
|
}, [variant]);
|
|
64
64
|
if (!projectSettings)
|
|
65
65
|
return null;
|
|
66
|
-
return (jsx(IsBrowser, { children: jsx(PopperProvider, { children: jsx(DynamicWidgetVariants, { isOpen: isOpen, setIsOpen: setIsOpen, variant: _variant, zIndex: widgetModalZIndex, children: jsx(DynamicWidgetCard, { ref: widgetRef, children: jsx(DynamicUserProfileLayout, { variant: variant }) }) }) }) }));
|
|
66
|
+
return (jsx(IsBrowser, { children: jsx(PopperProvider, { children: jsx(DynamicWidgetVariants, { isOpen: isOpen, setIsOpen: setIsOpen, variant: _variant, zIndex: widgetModalZIndex, children: jsx(DynamicWidgetCard, { ref: widgetRef, children: jsx(DynamicUserProfileLayout, { className: 'modal-user-profile', variant: variant }) }) }) }) }));
|
|
67
67
|
};
|
|
68
68
|
const ShadowedDynamicUserProfile = () => (jsx(ShadowDOM, { zIndex: widgetModalZIndex, children: jsx(DynamicUserProfile, {}) }));
|
|
69
69
|
|
|
@@ -99,7 +99,7 @@ const DynamicWidgetWalletHeader = ({ variant, }) => {
|
|
|
99
99
|
return shortenEmail.shortenEmail(user === null || user === void 0 ? void 0 : user.email);
|
|
100
100
|
};
|
|
101
101
|
const isActionsVisible = isSendBalanceEnabled || fundingEnabled;
|
|
102
|
-
return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [primaryWallet ? (jsxRuntime.
|
|
102
|
+
return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [primaryWallet ? (jsxRuntime.jsx(ActiveWalletInformation.ActiveWalletInformation, {})) : (jsxRuntime.jsx("div", { className: 'dynamic-widget-wallet-header__icon-container', children: jsxRuntime.jsx(UserAvatar.UserAvatar, { user: user }) })), primaryWallet ? (jsxRuntime.jsx("div", { "data-testid": 'primaryWalletStatus', className: 'dynamic-widget-wallet-header__wallet-info', children: isActionsVisible && (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header__wallet-actions', children: [fundingEnabled && (jsxRuntime.jsx(Button.Button, { expanded: true, dataTestId: 'buy-crypto-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: () => setShowFunding(true), disabled: !supportsFunding, startSlot:
|
|
103
103
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
104
104
|
jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-secondary', children: jsxRuntime.jsx(add.ReactComponent, {}) }), children: "Buy" })), isSendBalanceEnabled && (jsxRuntime.jsx(Button.Button, { expanded: true, dataTestId: 'send-balance-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: handleOnClickSend, startSlot:
|
|
105
105
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs,
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import React__default, { useMemo } from 'react';
|
|
3
3
|
import { isEmbeddedConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { Typography } from '../../../../../components/Typography/Typography.js';
|
|
@@ -91,7 +91,7 @@ const DynamicWidgetWalletHeader = ({ variant, }) => {
|
|
|
91
91
|
return shortenEmail(user === null || user === void 0 ? void 0 : user.email);
|
|
92
92
|
};
|
|
93
93
|
const isActionsVisible = isSendBalanceEnabled || fundingEnabled;
|
|
94
|
-
return (jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [primaryWallet ? (
|
|
94
|
+
return (jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [primaryWallet ? (jsx(ActiveWalletInformation, {})) : (jsx("div", { className: 'dynamic-widget-wallet-header__icon-container', children: jsx(UserAvatar, { user: user }) })), primaryWallet ? (jsx("div", { "data-testid": 'primaryWalletStatus', className: 'dynamic-widget-wallet-header__wallet-info', children: isActionsVisible && (jsxs("div", { className: 'dynamic-widget-wallet-header__wallet-actions', children: [fundingEnabled && (jsx(Button, { expanded: true, dataTestId: 'buy-crypto-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: () => setShowFunding(true), disabled: !supportsFunding, startSlot:
|
|
95
95
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
96
96
|
jsx(Icon, { size: 'small', color: 'text-secondary', children: jsx(SvgAdd, {}) }), children: "Buy" })), isSendBalanceEnabled && (jsx(Button, { expanded: true, dataTestId: 'send-balance-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: handleOnClickSend, startSlot:
|
|
97
97
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs
CHANGED
|
@@ -66,11 +66,11 @@ const DynamicWidgetWallets = () => {
|
|
|
66
66
|
const { secondaryWallets, user, authMode } = useInternalDynamicContext.useInternalDynamicContext();
|
|
67
67
|
const { availableWalletsContainerRef } = DynamicWidgetContext.useWidgetContext();
|
|
68
68
|
const isEmpty = secondaryWallets.length === 0;
|
|
69
|
-
return (jsxRuntime.jsxs("div", { ref: availableWalletsContainerRef, className: 'dynamic-widget-wallets', "data-testid": 'dynamicWidgetWallets', children: [jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', className: 'dynamic-widget-wallets__title', children: t('dyn_widget.other_wallets') }), jsxRuntime.jsx("div", { className: classNames.classNames('
|
|
69
|
+
return (jsxRuntime.jsxs("div", { ref: availableWalletsContainerRef, className: 'dynamic-widget-wallets', "data-testid": 'dynamicWidgetWallets', children: [jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', className: 'dynamic-widget-wallets__title', children: t('dyn_widget.other_wallets') }), jsxRuntime.jsx("div", { className: classNames.classNames('dynamic-widget-wallets__body', {
|
|
70
70
|
'dynamic-widget-wallets__body--apply-height': !isEmpty,
|
|
71
71
|
}), children: isEmpty ? (jsxRuntime.jsx(EmptyWallets.EmptyWallets, { text: t('dyn_widget.empty_wallets', {
|
|
72
72
|
action: authMode === 'connect-and-sign' ? 'Link' : 'Connect',
|
|
73
|
-
}) })) : (jsxRuntime.jsx("div", { className: '
|
|
73
|
+
}) })) : (jsxRuntime.jsx("div", { className: 'dynamic-widget-wallets__body__wallet-list', children: secondaryWallets.map((wallet, index) => {
|
|
74
74
|
var _a;
|
|
75
75
|
return (jsxRuntime.jsx(Wallet.Wallet, { ens: (_a = getWalletVerifiedCredential.getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials, wallet.chain)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet }, wallet.id));
|
|
76
76
|
}) })) })] }));
|
package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js
CHANGED
|
@@ -62,11 +62,11 @@ const DynamicWidgetWallets = () => {
|
|
|
62
62
|
const { secondaryWallets, user, authMode } = useInternalDynamicContext();
|
|
63
63
|
const { availableWalletsContainerRef } = useWidgetContext();
|
|
64
64
|
const isEmpty = secondaryWallets.length === 0;
|
|
65
|
-
return (jsxs("div", { ref: availableWalletsContainerRef, className: 'dynamic-widget-wallets', "data-testid": 'dynamicWidgetWallets', children: [jsx(Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', className: 'dynamic-widget-wallets__title', children: t('dyn_widget.other_wallets') }), jsx("div", { className: classNames('
|
|
65
|
+
return (jsxs("div", { ref: availableWalletsContainerRef, className: 'dynamic-widget-wallets', "data-testid": 'dynamicWidgetWallets', children: [jsx(Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', className: 'dynamic-widget-wallets__title', children: t('dyn_widget.other_wallets') }), jsx("div", { className: classNames('dynamic-widget-wallets__body', {
|
|
66
66
|
'dynamic-widget-wallets__body--apply-height': !isEmpty,
|
|
67
67
|
}), children: isEmpty ? (jsx(EmptyWallets, { text: t('dyn_widget.empty_wallets', {
|
|
68
68
|
action: authMode === 'connect-and-sign' ? 'Link' : 'Connect',
|
|
69
|
-
}) })) : (jsx("div", { className: '
|
|
69
|
+
}) })) : (jsx("div", { className: 'dynamic-widget-wallets__body__wallet-list', children: secondaryWallets.map((wallet, index) => {
|
|
70
70
|
var _a;
|
|
71
71
|
return (jsx(Wallet, { ens: (_a = getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials, wallet.chain)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet }, wallet.id));
|
|
72
72
|
}) })) })] }));
|