@dynamic-labs/sdk-react-core 0.19.0-alpha.15 → 0.19.0-alpha.16
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 +23 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +46 -26
- package/src/lib/components/SendBalanceForm/SendBalanceForm.d.ts +1 -0
- package/src/lib/components/SendBalanceForm/SendBalanceForm.js +46 -26
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +2 -2
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.d.ts +1 -0
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +2 -2
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +20 -7
- package/src/lib/context/DynamicContext/DynamicContext.js +20 -7
- package/src/lib/context/DynamicContext/handleDisconnectWallet/handleDisconnectWallet.cjs +34 -0
- package/src/lib/context/DynamicContext/handleDisconnectWallet/handleDisconnectWallet.d.ts +13 -0
- package/src/lib/context/DynamicContext/handleDisconnectWallet/handleDisconnectWallet.js +30 -0
- package/src/lib/context/DynamicContext/handleDisconnectWallet/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/types.d.ts +5 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +11 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.d.ts +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +11 -2
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
- package/src/lib/locale/en/translation.cjs +0 -7
- package/src/lib/locale/en/translation.js +1 -7
- package/src/lib/shared/types/index.d.ts +6 -0
- package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.cjs +4 -3
- package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.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/functions/getOrdinalNumber/getOrdinalNumber.cjs +21 -0
- package/src/lib/utils/functions/getOrdinalNumber/getOrdinalNumber.d.ts +1 -0
- package/src/lib/utils/functions/getOrdinalNumber/getOrdinalNumber.js +17 -0
- package/src/lib/utils/functions/getOrdinalNumber/index.d.ts +1 -0
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/functions/isTestnet/isTestnet.cjs +1 -1
- package/src/lib/utils/functions/isTestnet/isTestnet.js +1 -1
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.cjs +1 -1
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +1 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +0 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +0 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +5 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +5 -4
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +5 -2
- package/src/lib/utils/hooks/useHandleWalletsToConnect/useHandleWalletsToConnect.d.ts +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +1 -1
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.cjs +9 -4
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.js +9 -4
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +3 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.js +3 -2
- package/src/lib/views/viewToComponentMap.cjs +0 -2
- package/src/lib/views/viewToComponentMap.js +0 -2
- package/src/lib/views/PasskeySuccessView/PasskeySuccessView.cjs +0 -71
- package/src/lib/views/PasskeySuccessView/PasskeySuccessView.d.ts +0 -2
- package/src/lib/views/PasskeySuccessView/PasskeySuccessView.js +0 -67
- package/src/lib/views/PasskeySuccessView/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.19.0-alpha.16](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.15...v0.19.0-alpha.16) (2023-10-17)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* ethers extension integration and rename provider methods (#3573)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add onDisconnect ([#3572](https://github.com/dynamic-labs/DynamicAuth/issues/3572)) ([3e612f7](https://github.com/dynamic-labs/DynamicAuth/commit/3e612f72540781b9246a47ac12a7c979fb6c0d88))
|
|
12
|
+
* user callback on passkey creation complete ([#3591](https://github.com/dynamic-labs/DynamicAuth/issues/3591)) ([92d5f7d](https://github.com/dynamic-labs/DynamicAuth/commit/92d5f7df2ac1cc06338f7e9e75125f7bb71455ab))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* argentX in-browser wallet ([#3588](https://github.com/dynamic-labs/DynamicAuth/issues/3588)) ([7f3b22d](https://github.com/dynamic-labs/DynamicAuth/commit/7f3b22d003182aa0d84406086a313fc4de25e4a8))
|
|
18
|
+
* display a better message when transaction amount decimals are invalid ([#3577](https://github.com/dynamic-labs/DynamicAuth/issues/3577)) ([0238d9b](https://github.com/dynamic-labs/DynamicAuth/commit/0238d9b7712d6a52aec89193c751224dd8fd8b17))
|
|
19
|
+
* remove passkey success view ([#3536](https://github.com/dynamic-labs/DynamicAuth/issues/3536)) ([b559de9](https://github.com/dynamic-labs/DynamicAuth/commit/b559de9c83096ed98e9f073b998ac08f876af24e))
|
|
20
|
+
* **wagmi-connector:** use wallets list to sync wagmi client ([#3563](https://github.com/dynamic-labs/DynamicAuth/issues/3563)) ([1d551b9](https://github.com/dynamic-labs/DynamicAuth/commit/1d551b933aefe0c535285d68c2e6f819cd321e62))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
* ethers extension integration and rename provider methods ([#3573](https://github.com/dynamic-labs/DynamicAuth/issues/3573)) ([efd73c3](https://github.com/dynamic-labs/DynamicAuth/commit/efd73c3b8121df9a7d4ec8c1fb6c4fd76ecce6df))
|
|
24
|
+
|
|
2
25
|
## [0.19.0-alpha.15](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.14...v0.19.0-alpha.15) (2023-10-11)
|
|
3
26
|
|
|
4
27
|
## [0.19.0-alpha.14](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.13...v0.19.0-alpha.14) (2023-10-10)
|
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": "0.19.0-alpha.
|
|
3
|
+
"version": "0.19.0-alpha.16",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"react-focus-lock": "2.9.2",
|
|
18
18
|
"react-i18next": "^13.2.0",
|
|
19
19
|
"yup": "0.32.11",
|
|
20
|
-
"@dynamic-labs/logger": "0.19.0-alpha.
|
|
21
|
-
"@dynamic-labs/multi-wallet": "0.19.0-alpha.
|
|
22
|
-
"@dynamic-labs/rpc-providers": "0.19.0-alpha.
|
|
23
|
-
"@dynamic-labs/types": "0.19.0-alpha.
|
|
24
|
-
"@dynamic-labs/utils": "0.19.0-alpha.
|
|
25
|
-
"@dynamic-labs/wallet-book": "0.19.0-alpha.
|
|
26
|
-
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.
|
|
20
|
+
"@dynamic-labs/logger": "0.19.0-alpha.16",
|
|
21
|
+
"@dynamic-labs/multi-wallet": "0.19.0-alpha.16",
|
|
22
|
+
"@dynamic-labs/rpc-providers": "0.19.0-alpha.16",
|
|
23
|
+
"@dynamic-labs/types": "0.19.0-alpha.16",
|
|
24
|
+
"@dynamic-labs/utils": "0.19.0-alpha.16",
|
|
25
|
+
"@dynamic-labs/wallet-book": "0.19.0-alpha.16",
|
|
26
|
+
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.16",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -8,6 +8,19 @@ var formik = require('formik');
|
|
|
8
8
|
var yup = require('yup');
|
|
9
9
|
var Input = require('../Input/Input.cjs');
|
|
10
10
|
var Button = require('../Button/Button.cjs');
|
|
11
|
+
require('@dynamic-labs/sdk-api');
|
|
12
|
+
require('../../shared/logger.cjs');
|
|
13
|
+
require('@dynamic-labs/iconic');
|
|
14
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
15
|
+
require('../../context/ViewContext/ViewContext.cjs');
|
|
16
|
+
require('@dynamic-labs/wallet-book');
|
|
17
|
+
require('@dynamic-labs/utils');
|
|
18
|
+
require('../../utils/constants/colors.cjs');
|
|
19
|
+
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
20
|
+
require('viem');
|
|
21
|
+
require('../../shared/consts/index.cjs');
|
|
22
|
+
require('@dynamic-labs/multi-wallet');
|
|
23
|
+
var getOrdinalNumber = require('../../utils/functions/getOrdinalNumber/getOrdinalNumber.cjs');
|
|
11
24
|
|
|
12
25
|
const sendBalanceFormInitialValues = {
|
|
13
26
|
amount: '',
|
|
@@ -15,6 +28,7 @@ const sendBalanceFormInitialValues = {
|
|
|
15
28
|
};
|
|
16
29
|
const mapFieldAndErrorToMessage = {
|
|
17
30
|
amount: {
|
|
31
|
+
invalidDecimals: 'Please enter a value up to the {decimals} decimal place.',
|
|
18
32
|
invalidFormat: 'The amount is in invalid format',
|
|
19
33
|
overBalance: 'Insufficient funds to send this amount.',
|
|
20
34
|
required: 'The amount field is required',
|
|
@@ -24,37 +38,43 @@ const mapFieldAndErrorToMessage = {
|
|
|
24
38
|
required: 'The recipient is required',
|
|
25
39
|
},
|
|
26
40
|
};
|
|
27
|
-
const getDisplayErrorMessage = (errors, field) => {
|
|
41
|
+
const getDisplayErrorMessage = (errors, field, decimals) => {
|
|
28
42
|
const errorType = errors[field];
|
|
29
43
|
if (errorType) {
|
|
30
|
-
|
|
44
|
+
const errorMessage = mapFieldAndErrorToMessage[field][errorType];
|
|
45
|
+
return errorMessage.replace('{decimals}', getOrdinalNumber.getOrdinalNumber(decimals !== null && decimals !== void 0 ? decimals : 0));
|
|
31
46
|
}
|
|
32
47
|
return '';
|
|
33
48
|
};
|
|
34
|
-
const SendBalanceForm = ({ initialValues, onSubmit, balance, }) => {
|
|
35
|
-
const sendBalanceFormValidationSchema = React.useMemo(() =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
const SendBalanceForm = ({ initialValues, onSubmit, balance, decimals = 18, }) => {
|
|
50
|
+
const sendBalanceFormValidationSchema = React.useMemo(() => {
|
|
51
|
+
const decimalsRegex = new RegExp(`^\\d*(\\.\\d{1,${decimals}})?$`);
|
|
52
|
+
return yup.object().shape({
|
|
53
|
+
amount: yup.string()
|
|
54
|
+
.required('required')
|
|
55
|
+
.matches(/^\d*(\.\d+)?$/, 'invalidFormat')
|
|
56
|
+
.matches(decimalsRegex, 'invalidDecimals')
|
|
57
|
+
.test({
|
|
58
|
+
message: 'overBalance',
|
|
59
|
+
test: (value) => {
|
|
60
|
+
if (!value || balance === undefined)
|
|
61
|
+
return true;
|
|
62
|
+
try {
|
|
63
|
+
const valueNumber = parseFloat(value);
|
|
64
|
+
return valueNumber < balance;
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
recipient: yup.string()
|
|
72
|
+
.required('required')
|
|
73
|
+
.matches(/^0x[0-9a-fA-F]{40}$/, 'invalidFormat'),
|
|
74
|
+
});
|
|
75
|
+
}, [balance, decimals]);
|
|
76
|
+
return (jsxRuntime.jsx(formik.Formik, { initialValues: initialValues || sendBalanceFormInitialValues, validationSchema: sendBalanceFormValidationSchema, onSubmit: (values) => onSubmit(values), validateOnChange: false, validateOnBlur: false, children: ({ errors, touched }) => (jsxRuntime.jsxs(formik.Form, { className: 'send-balance-form', children: [jsxRuntime.jsx(formik.Field, { variant: 'regular', className: 'send-balance-form__field', name: 'amount', label: 'Amount', placeholder: 'Select amount', as: Input.Input, error: errors['amount'], message: touched['amount'] &&
|
|
77
|
+
getDisplayErrorMessage(errors, 'amount', decimals) }), jsxRuntime.jsx(formik.Field, { variant: 'regular', className: 'send-balance-form__field', placeholder: 'Enter wallet address...', label: 'Recipient', id: 'recipient', name: 'recipient', as: Input.Input, error: errors['recipient'], message: touched['recipient'] &&
|
|
58
78
|
getDisplayErrorMessage(errors, 'recipient') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'sendBalanceFormSubmitButton', expanded: true, type: 'submit', buttonVariant: 'primary', buttonPadding: 'large', buttonRounded: 'default', buttonClassName: 'send-balance-form__button', children: "Send now" })] })) }));
|
|
59
79
|
};
|
|
60
80
|
|
|
@@ -4,6 +4,19 @@ import { Formik, Form, Field } from 'formik';
|
|
|
4
4
|
import { object, string } from 'yup';
|
|
5
5
|
import { Input } from '../Input/Input.js';
|
|
6
6
|
import { Button } from '../Button/Button.js';
|
|
7
|
+
import '@dynamic-labs/sdk-api';
|
|
8
|
+
import '../../shared/logger.js';
|
|
9
|
+
import '@dynamic-labs/iconic';
|
|
10
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
11
|
+
import '../../context/ViewContext/ViewContext.js';
|
|
12
|
+
import '@dynamic-labs/wallet-book';
|
|
13
|
+
import '@dynamic-labs/utils';
|
|
14
|
+
import '../../utils/constants/colors.js';
|
|
15
|
+
import '../../shared/utils/classes/storage/localStorage.js';
|
|
16
|
+
import 'viem';
|
|
17
|
+
import '../../shared/consts/index.js';
|
|
18
|
+
import '@dynamic-labs/multi-wallet';
|
|
19
|
+
import { getOrdinalNumber } from '../../utils/functions/getOrdinalNumber/getOrdinalNumber.js';
|
|
7
20
|
|
|
8
21
|
const sendBalanceFormInitialValues = {
|
|
9
22
|
amount: '',
|
|
@@ -11,6 +24,7 @@ const sendBalanceFormInitialValues = {
|
|
|
11
24
|
};
|
|
12
25
|
const mapFieldAndErrorToMessage = {
|
|
13
26
|
amount: {
|
|
27
|
+
invalidDecimals: 'Please enter a value up to the {decimals} decimal place.',
|
|
14
28
|
invalidFormat: 'The amount is in invalid format',
|
|
15
29
|
overBalance: 'Insufficient funds to send this amount.',
|
|
16
30
|
required: 'The amount field is required',
|
|
@@ -20,37 +34,43 @@ const mapFieldAndErrorToMessage = {
|
|
|
20
34
|
required: 'The recipient is required',
|
|
21
35
|
},
|
|
22
36
|
};
|
|
23
|
-
const getDisplayErrorMessage = (errors, field) => {
|
|
37
|
+
const getDisplayErrorMessage = (errors, field, decimals) => {
|
|
24
38
|
const errorType = errors[field];
|
|
25
39
|
if (errorType) {
|
|
26
|
-
|
|
40
|
+
const errorMessage = mapFieldAndErrorToMessage[field][errorType];
|
|
41
|
+
return errorMessage.replace('{decimals}', getOrdinalNumber(decimals !== null && decimals !== void 0 ? decimals : 0));
|
|
27
42
|
}
|
|
28
43
|
return '';
|
|
29
44
|
};
|
|
30
|
-
const SendBalanceForm = ({ initialValues, onSubmit, balance, }) => {
|
|
31
|
-
const sendBalanceFormValidationSchema = useMemo(() =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
const SendBalanceForm = ({ initialValues, onSubmit, balance, decimals = 18, }) => {
|
|
46
|
+
const sendBalanceFormValidationSchema = useMemo(() => {
|
|
47
|
+
const decimalsRegex = new RegExp(`^\\d*(\\.\\d{1,${decimals}})?$`);
|
|
48
|
+
return object().shape({
|
|
49
|
+
amount: string()
|
|
50
|
+
.required('required')
|
|
51
|
+
.matches(/^\d*(\.\d+)?$/, 'invalidFormat')
|
|
52
|
+
.matches(decimalsRegex, 'invalidDecimals')
|
|
53
|
+
.test({
|
|
54
|
+
message: 'overBalance',
|
|
55
|
+
test: (value) => {
|
|
56
|
+
if (!value || balance === undefined)
|
|
57
|
+
return true;
|
|
58
|
+
try {
|
|
59
|
+
const valueNumber = parseFloat(value);
|
|
60
|
+
return valueNumber < balance;
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
recipient: string()
|
|
68
|
+
.required('required')
|
|
69
|
+
.matches(/^0x[0-9a-fA-F]{40}$/, 'invalidFormat'),
|
|
70
|
+
});
|
|
71
|
+
}, [balance, decimals]);
|
|
72
|
+
return (jsx(Formik, { initialValues: initialValues || sendBalanceFormInitialValues, validationSchema: sendBalanceFormValidationSchema, onSubmit: (values) => onSubmit(values), validateOnChange: false, validateOnBlur: false, children: ({ errors, touched }) => (jsxs(Form, { className: 'send-balance-form', children: [jsx(Field, { variant: 'regular', className: 'send-balance-form__field', name: 'amount', label: 'Amount', placeholder: 'Select amount', as: Input, error: errors['amount'], message: touched['amount'] &&
|
|
73
|
+
getDisplayErrorMessage(errors, 'amount', decimals) }), jsx(Field, { variant: 'regular', className: 'send-balance-form__field', placeholder: 'Enter wallet address...', label: 'Recipient', id: 'recipient', name: 'recipient', as: Input, error: errors['recipient'], message: touched['recipient'] &&
|
|
54
74
|
getDisplayErrorMessage(errors, 'recipient') }), jsx(Button, { dataTestId: 'sendBalanceFormSubmitButton', expanded: true, type: 'submit', buttonVariant: 'primary', buttonPadding: 'large', buttonRounded: 'default', buttonClassName: 'send-balance-form__button', children: "Send now" })] })) }));
|
|
55
75
|
};
|
|
56
76
|
|
|
@@ -34,7 +34,7 @@ var Chip = require('../Chip/Chip.cjs');
|
|
|
34
34
|
var FormFieldLabel = require('../FormFieldLabel/FormFieldLabel.cjs');
|
|
35
35
|
var TokenBalanceCard = require('./components/TokenBalanceCard/TokenBalanceCard.cjs');
|
|
36
36
|
|
|
37
|
-
const SendBalancePageLayout = ({ error, walletAddress, onClickClose, onClickBack, walletKey, onSubmit, displayPoweredByDynamicFooter = false, balance, chain, currencySymbol, initialValues, networkName, networkIcon, }) => {
|
|
37
|
+
const SendBalancePageLayout = ({ error, walletAddress, onClickClose, onClickBack, walletKey, onSubmit, displayPoweredByDynamicFooter = false, balance, chain, currencySymbol, initialValues, networkName, networkIcon, networkCurrencyDecimals, }) => {
|
|
38
38
|
const closeButton = onClickClose && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickClose, "data-testid": 'close-button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
39
39
|
const backButton = onClickBack && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
40
40
|
const balanceNumber = React.useMemo(() => {
|
|
@@ -45,7 +45,7 @@ const SendBalancePageLayout = ({ error, walletAddress, onClickClose, onClickBack
|
|
|
45
45
|
return;
|
|
46
46
|
return parseFloat(balance);
|
|
47
47
|
}, [balance]);
|
|
48
|
-
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, trailing: closeButton, children: jsxRuntime.jsxs("div", { className: 'send-balance-page-layout__header-content', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', as: 'p', children: "Send from" }), walletKey && (jsxRuntime.jsx(Icon.Icon, { size: 'small', children: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletKey }) })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', as: 'p', children: shortenWalletAddress.shortenWalletAddress(walletAddress, 3, 3) })] }) }), jsxRuntime.jsxs("div", { className: 'send-balance-page-layout__body', children: [jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: error && (jsxRuntime.jsx("div", { className: 'send-balance-page-layout__error', children: jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', children: error }) })) }), networkName && networkIcon && (jsxRuntime.jsx("div", { className: 'send-balance-page-layout__network-container', children: jsxRuntime.jsx(Chip.Chip, { icon: networkIcon, children: networkName }) })), jsxRuntime.jsxs("div", { className: 'send-balance-page-layout__balance-container', children: [jsxRuntime.jsx(FormFieldLabel.FormFieldLabel, { divider: true, children: "Token" }), jsxRuntime.jsx(TokenBalanceCard.TokenBalanceCard, { chain: chain, currencySymbol: currencySymbol, balance: balance })] }), jsxRuntime.jsx(SendBalanceForm.SendBalanceForm, { onSubmit: onSubmit, initialValues: initialValues, balance: balanceNumber }), displayPoweredByDynamicFooter && (jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'send-balance-page-layout__footer' }))] })] }));
|
|
48
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, trailing: closeButton, children: jsxRuntime.jsxs("div", { className: 'send-balance-page-layout__header-content', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', as: 'p', children: "Send from" }), walletKey && (jsxRuntime.jsx(Icon.Icon, { size: 'small', children: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletKey }) })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', as: 'p', children: shortenWalletAddress.shortenWalletAddress(walletAddress, 3, 3) })] }) }), jsxRuntime.jsxs("div", { className: 'send-balance-page-layout__body', children: [jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: error && (jsxRuntime.jsx("div", { className: 'send-balance-page-layout__error', children: jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', children: error }) })) }), networkName && networkIcon && (jsxRuntime.jsx("div", { className: 'send-balance-page-layout__network-container', children: jsxRuntime.jsx(Chip.Chip, { icon: networkIcon, children: networkName }) })), jsxRuntime.jsxs("div", { className: 'send-balance-page-layout__balance-container', children: [jsxRuntime.jsx(FormFieldLabel.FormFieldLabel, { divider: true, children: "Token" }), jsxRuntime.jsx(TokenBalanceCard.TokenBalanceCard, { chain: chain, currencySymbol: currencySymbol, balance: balance })] }), jsxRuntime.jsx(SendBalanceForm.SendBalanceForm, { onSubmit: onSubmit, initialValues: initialValues, balance: balanceNumber, decimals: networkCurrencyDecimals }), displayPoweredByDynamicFooter && (jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'send-balance-page-layout__footer' }))] })] }));
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
exports.SendBalancePageLayout = SendBalancePageLayout;
|
|
@@ -10,6 +10,7 @@ export type SendBalancePageLayoutProps = {
|
|
|
10
10
|
isLoading: boolean;
|
|
11
11
|
networkIcon?: ReactNode;
|
|
12
12
|
networkName?: string;
|
|
13
|
+
networkCurrencyDecimals?: number;
|
|
13
14
|
onClickBack?: MouseEventHandler<HTMLButtonElement>;
|
|
14
15
|
onClickClose?: MouseEventHandler<HTMLButtonElement>;
|
|
15
16
|
onSubmit: (formValues: SendBalanceFormValues) => void;
|
|
@@ -30,7 +30,7 @@ import { Chip } from '../Chip/Chip.js';
|
|
|
30
30
|
import { FormFieldLabel } from '../FormFieldLabel/FormFieldLabel.js';
|
|
31
31
|
import { TokenBalanceCard } from './components/TokenBalanceCard/TokenBalanceCard.js';
|
|
32
32
|
|
|
33
|
-
const SendBalancePageLayout = ({ error, walletAddress, onClickClose, onClickBack, walletKey, onSubmit, displayPoweredByDynamicFooter = false, balance, chain, currencySymbol, initialValues, networkName, networkIcon, }) => {
|
|
33
|
+
const SendBalancePageLayout = ({ error, walletAddress, onClickClose, onClickBack, walletKey, onSubmit, displayPoweredByDynamicFooter = false, balance, chain, currencySymbol, initialValues, networkName, networkIcon, networkCurrencyDecimals, }) => {
|
|
34
34
|
const closeButton = onClickClose && (jsx(IconButton, { type: 'button', onClick: onClickClose, "data-testid": 'close-button', children: jsx(SvgClose, {}) }));
|
|
35
35
|
const backButton = onClickBack && (jsx(IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
36
36
|
const balanceNumber = useMemo(() => {
|
|
@@ -41,7 +41,7 @@ const SendBalancePageLayout = ({ error, walletAddress, onClickClose, onClickBack
|
|
|
41
41
|
return;
|
|
42
42
|
return parseFloat(balance);
|
|
43
43
|
}, [balance]);
|
|
44
|
-
return (jsxs("div", { children: [jsx(ModalHeader, { leading: backButton, trailing: closeButton, children: jsxs("div", { className: 'send-balance-page-layout__header-content', children: [jsx(Typography, { variant: 'body_normal', color: 'primary', as: 'p', children: "Send from" }), walletKey && (jsx(Icon, { size: 'small', children: jsx(WalletIcon, { walletKey: walletKey }) })), jsx(Typography, { variant: 'body_normal', color: 'primary', as: 'p', children: shortenWalletAddress(walletAddress, 3, 3) })] }) }), jsxs("div", { className: 'send-balance-page-layout__body', children: [jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: error && (jsx("div", { className: 'send-balance-page-layout__error', children: jsx(Alert, { icon: 'error', variant: 'error', children: error }) })) }), networkName && networkIcon && (jsx("div", { className: 'send-balance-page-layout__network-container', children: jsx(Chip, { icon: networkIcon, children: networkName }) })), jsxs("div", { className: 'send-balance-page-layout__balance-container', children: [jsx(FormFieldLabel, { divider: true, children: "Token" }), jsx(TokenBalanceCard, { chain: chain, currencySymbol: currencySymbol, balance: balance })] }), jsx(SendBalanceForm, { onSubmit: onSubmit, initialValues: initialValues, balance: balanceNumber }), displayPoweredByDynamicFooter && (jsx(PoweredByDynamic, { classNameRoot: 'send-balance-page-layout__footer' }))] })] }));
|
|
44
|
+
return (jsxs("div", { children: [jsx(ModalHeader, { leading: backButton, trailing: closeButton, children: jsxs("div", { className: 'send-balance-page-layout__header-content', children: [jsx(Typography, { variant: 'body_normal', color: 'primary', as: 'p', children: "Send from" }), walletKey && (jsx(Icon, { size: 'small', children: jsx(WalletIcon, { walletKey: walletKey }) })), jsx(Typography, { variant: 'body_normal', color: 'primary', as: 'p', children: shortenWalletAddress(walletAddress, 3, 3) })] }) }), jsxs("div", { className: 'send-balance-page-layout__body', children: [jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: error && (jsx("div", { className: 'send-balance-page-layout__error', children: jsx(Alert, { icon: 'error', variant: 'error', children: error }) })) }), networkName && networkIcon && (jsx("div", { className: 'send-balance-page-layout__network-container', children: jsx(Chip, { icon: networkIcon, children: networkName }) })), jsxs("div", { className: 'send-balance-page-layout__balance-container', children: [jsx(FormFieldLabel, { divider: true, children: "Token" }), jsx(TokenBalanceCard, { chain: chain, currencySymbol: currencySymbol, balance: balance })] }), jsx(SendBalanceForm, { onSubmit: onSubmit, initialValues: initialValues, balance: balanceNumber, decimals: networkCurrencyDecimals }), displayPoweredByDynamicFooter && (jsx(PoweredByDynamic, { classNameRoot: 'send-balance-page-layout__footer' }))] })] }));
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export { SendBalancePageLayout };
|
package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs
CHANGED
|
@@ -38,7 +38,7 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
|
|
|
38
38
|
const backButton = onClickBack && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
39
39
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: (props) => (jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(signCircle.ReactComponent, Object.assign({}, props)) })), iconSize: 64, isSpinning: true }) }), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__body', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'transaction-confirmation__title', children: title }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: error && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__error', children: jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__content', children: [jsxRuntime.jsx("div", { className: 'transaction-confirmation__app-origin-tile', children: jsxRuntime.jsx(AppOriginTile.AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }) }), jsxRuntime.jsx("div", { className: 'transaction-confirmation__rows', children: children })] }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: warningMessage && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__warning', children: jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'warning', contentDataTestId: 'warning_content', children: warningMessage }) })) }), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__actions', children: [onClickClose && (jsxRuntime.jsx(Button.Button, { buttonVariant: 'secondary', onClick: onClickClose, expanded: true, buttonPadding: 'large', buttonRounded: 'default', disabled: isLoading, children: "Cancel" })), jsxRuntime.jsx(Button.Button, { buttonVariant: 'primary', buttonPadding: 'large', onClick: (event) => {
|
|
40
40
|
onClickSend === null || onClickSend === void 0 ? void 0 : onClickSend(event);
|
|
41
|
-
}, expanded: true, buttonRounded: 'default', loading: isLoading, disabled: disableSendButton, children: "
|
|
41
|
+
}, expanded: true, buttonRounded: 'default', loading: isLoading, disabled: disableSendButton, children: "Confirm" })] }), displayPoweredByDynamicFooter && (jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' }))] })] }));
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
exports.TransactionConfirmationPageLayout = TransactionConfirmationPageLayout;
|
package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js
CHANGED
|
@@ -34,7 +34,7 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
|
|
|
34
34
|
const backButton = onClickBack && (jsx(IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
35
35
|
return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsx(IconWithSpinner, { Icon: (props) => (jsx(Icon, { color: 'brand-primary', children: jsx(SvgSignCircle, Object.assign({}, props)) })), iconSize: 64, isSpinning: true }) }), jsxs("div", { className: 'transaction-confirmation__body', children: [jsx(Typography, { variant: 'title', color: 'primary', className: 'transaction-confirmation__title', children: title }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: error && (jsx("div", { className: 'transaction-confirmation__error', children: jsx(Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsxs("div", { className: 'transaction-confirmation__content', children: [jsx("div", { className: 'transaction-confirmation__app-origin-tile', children: jsx(AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }) }), jsx("div", { className: 'transaction-confirmation__rows', children: children })] }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: warningMessage && (jsx("div", { className: 'transaction-confirmation__warning', children: jsx(Alert, { icon: 'error', variant: 'warning', contentDataTestId: 'warning_content', children: warningMessage }) })) }), jsxs("div", { className: 'transaction-confirmation__actions', children: [onClickClose && (jsx(Button, { buttonVariant: 'secondary', onClick: onClickClose, expanded: true, buttonPadding: 'large', buttonRounded: 'default', disabled: isLoading, children: "Cancel" })), jsx(Button, { buttonVariant: 'primary', buttonPadding: 'large', onClick: (event) => {
|
|
36
36
|
onClickSend === null || onClickSend === void 0 ? void 0 : onClickSend(event);
|
|
37
|
-
}, expanded: true, buttonRounded: 'default', loading: isLoading, disabled: disableSendButton, children: "
|
|
37
|
+
}, expanded: true, buttonRounded: 'default', loading: isLoading, disabled: disableSendButton, children: "Confirm" })] }), displayPoweredByDynamicFooter && (jsx(PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' }))] })] }));
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
export { TransactionConfirmationPageLayout };
|
|
@@ -104,6 +104,7 @@ var useCustomerCallbacks = require('./useCustomerCallbacks/useCustomerCallbacks.
|
|
|
104
104
|
var useCustomerAuthFlowCallbacks = require('./useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs');
|
|
105
105
|
var validators = require('./validators.cjs');
|
|
106
106
|
var internalEvents = require('./internalEvents/internalEvents.cjs');
|
|
107
|
+
var handleDisconnectWallet = require('./handleDisconnectWallet/handleDisconnectWallet.cjs');
|
|
107
108
|
|
|
108
109
|
const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9';
|
|
109
110
|
const EMPTY_INITIAL_USER = undefined;
|
|
@@ -202,10 +203,13 @@ const DynamicContextProvider = ({ children, theme, settings, locale: locale$1, }
|
|
|
202
203
|
enableVisitTrackingOnConnectOnly,
|
|
203
204
|
environmentId,
|
|
204
205
|
onBeforeConnectSuccessConfirmation: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onBeforeConnectSuccessConfirmation,
|
|
205
|
-
onUnlink: (
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
onUnlink: (wallet, connectedWalletsInfo) => handleDisconnectWallet.handleDisconnectWallet({
|
|
207
|
+
connectedWalletsInfo,
|
|
208
|
+
eventsCallbacks,
|
|
209
|
+
setWalletsToConnectByChain,
|
|
210
|
+
wallet,
|
|
211
|
+
walletsByChain,
|
|
212
|
+
}),
|
|
209
213
|
primaryWalletId,
|
|
210
214
|
setPrimaryWalletId,
|
|
211
215
|
setShowAuthFlow,
|
|
@@ -267,7 +271,7 @@ const DynamicContextProvider = ({ children, theme, settings, locale: locale$1, }
|
|
|
267
271
|
clearOphanedWalletConnectSessions,
|
|
268
272
|
]);
|
|
269
273
|
const handleLogOut = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
270
|
-
var _j, _k;
|
|
274
|
+
var _j, _k, _l;
|
|
271
275
|
clearAllWalletConnectSessions();
|
|
272
276
|
setWalletsToConnectByChain(walletsByChain);
|
|
273
277
|
setShowDynamicUserProfile(false);
|
|
@@ -300,13 +304,21 @@ const DynamicContextProvider = ({ children, theme, settings, locale: locale$1, }
|
|
|
300
304
|
removeIsFullyConnected();
|
|
301
305
|
clearPrimaryWalletId();
|
|
302
306
|
removeConnectedNameService();
|
|
303
|
-
(
|
|
307
|
+
if (connectedWallet) {
|
|
308
|
+
(_k = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onDisconnect) === null || _k === void 0 ? void 0 : _k.call(eventsCallbacks, {
|
|
309
|
+
walletConnector: connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
(_l = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onLogout) === null || _l === void 0 ? void 0 : _l.call(eventsCallbacks, user);
|
|
304
313
|
internalEventsRef.current.emit('logout');
|
|
305
314
|
}), [
|
|
306
315
|
clearAllWalletConnectSessions,
|
|
307
316
|
walletsByChain,
|
|
317
|
+
toolkitEnabled,
|
|
308
318
|
user,
|
|
309
|
-
connectedWallet
|
|
319
|
+
connectedWallet,
|
|
320
|
+
isVerificationInProgress,
|
|
321
|
+
setIsVerificationInProgress,
|
|
310
322
|
setAuthMode,
|
|
311
323
|
initialAuthenticationMode,
|
|
312
324
|
setMultiWalletWidgetState,
|
|
@@ -386,6 +398,7 @@ const DynamicContextProvider = ({ children, theme, settings, locale: locale$1, }
|
|
|
386
398
|
onConnectSuccess: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onConnectSuccess,
|
|
387
399
|
onEmailVerificationFailure,
|
|
388
400
|
onEmailVerificationSuccess,
|
|
401
|
+
onEmbeddedWalletCreated: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onEmbeddedWalletCreated,
|
|
389
402
|
onLinkSuccess: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onLinkSuccess,
|
|
390
403
|
onUserProfileUpdate: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onUserProfileUpdate,
|
|
391
404
|
},
|
|
@@ -100,6 +100,7 @@ import { useCustomerCallbacks } from './useCustomerCallbacks/useCustomerCallback
|
|
|
100
100
|
import { useCustomerAuthFlowCallbacks } from './useCustomerCallbacks/useCustomerAuthFlowCallbacks.js';
|
|
101
101
|
import { validateAuthUser } from './validators.js';
|
|
102
102
|
import { getInternalEvents } from './internalEvents/internalEvents.js';
|
|
103
|
+
import { handleDisconnectWallet } from './handleDisconnectWallet/handleDisconnectWallet.js';
|
|
103
104
|
|
|
104
105
|
const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9';
|
|
105
106
|
const EMPTY_INITIAL_USER = undefined;
|
|
@@ -198,10 +199,13 @@ const DynamicContextProvider = ({ children, theme, settings, locale, }) => {
|
|
|
198
199
|
enableVisitTrackingOnConnectOnly,
|
|
199
200
|
environmentId,
|
|
200
201
|
onBeforeConnectSuccessConfirmation: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onBeforeConnectSuccessConfirmation,
|
|
201
|
-
onUnlink: (
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
onUnlink: (wallet, connectedWalletsInfo) => handleDisconnectWallet({
|
|
203
|
+
connectedWalletsInfo,
|
|
204
|
+
eventsCallbacks,
|
|
205
|
+
setWalletsToConnectByChain,
|
|
206
|
+
wallet,
|
|
207
|
+
walletsByChain,
|
|
208
|
+
}),
|
|
205
209
|
primaryWalletId,
|
|
206
210
|
setPrimaryWalletId,
|
|
207
211
|
setShowAuthFlow,
|
|
@@ -263,7 +267,7 @@ const DynamicContextProvider = ({ children, theme, settings, locale, }) => {
|
|
|
263
267
|
clearOphanedWalletConnectSessions,
|
|
264
268
|
]);
|
|
265
269
|
const handleLogOut = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
266
|
-
var _j, _k;
|
|
270
|
+
var _j, _k, _l;
|
|
267
271
|
clearAllWalletConnectSessions();
|
|
268
272
|
setWalletsToConnectByChain(walletsByChain);
|
|
269
273
|
setShowDynamicUserProfile(false);
|
|
@@ -296,13 +300,21 @@ const DynamicContextProvider = ({ children, theme, settings, locale, }) => {
|
|
|
296
300
|
removeIsFullyConnected();
|
|
297
301
|
clearPrimaryWalletId();
|
|
298
302
|
removeConnectedNameService();
|
|
299
|
-
(
|
|
303
|
+
if (connectedWallet) {
|
|
304
|
+
(_k = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onDisconnect) === null || _k === void 0 ? void 0 : _k.call(eventsCallbacks, {
|
|
305
|
+
walletConnector: connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
(_l = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onLogout) === null || _l === void 0 ? void 0 : _l.call(eventsCallbacks, user);
|
|
300
309
|
internalEventsRef.current.emit('logout');
|
|
301
310
|
}), [
|
|
302
311
|
clearAllWalletConnectSessions,
|
|
303
312
|
walletsByChain,
|
|
313
|
+
toolkitEnabled,
|
|
304
314
|
user,
|
|
305
|
-
connectedWallet
|
|
315
|
+
connectedWallet,
|
|
316
|
+
isVerificationInProgress,
|
|
317
|
+
setIsVerificationInProgress,
|
|
306
318
|
setAuthMode,
|
|
307
319
|
initialAuthenticationMode,
|
|
308
320
|
setMultiWalletWidgetState,
|
|
@@ -382,6 +394,7 @@ const DynamicContextProvider = ({ children, theme, settings, locale, }) => {
|
|
|
382
394
|
onConnectSuccess: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onConnectSuccess,
|
|
383
395
|
onEmailVerificationFailure,
|
|
384
396
|
onEmailVerificationSuccess,
|
|
397
|
+
onEmbeddedWalletCreated: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onEmbeddedWalletCreated,
|
|
385
398
|
onLinkSuccess: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onLinkSuccess,
|
|
386
399
|
onUserProfileUpdate: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onUserProfileUpdate,
|
|
387
400
|
},
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('@dynamic-labs/sdk-api');
|
|
6
|
+
var logger = require('../../../shared/logger.cjs');
|
|
7
|
+
require('@dynamic-labs/iconic');
|
|
8
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
9
|
+
require('react/jsx-runtime');
|
|
10
|
+
require('../../ViewContext/ViewContext.cjs');
|
|
11
|
+
require('react');
|
|
12
|
+
require('@dynamic-labs/wallet-book');
|
|
13
|
+
require('@dynamic-labs/utils');
|
|
14
|
+
require('../../../utils/constants/colors.cjs');
|
|
15
|
+
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
16
|
+
require('viem');
|
|
17
|
+
require('../../../shared/consts/index.cjs');
|
|
18
|
+
var getMissingChains = require('../../../utils/functions/getMissingChains/getMissingChains.cjs');
|
|
19
|
+
|
|
20
|
+
const handleDisconnectWallet = ({ wallet, connectedWalletsInfo, walletsByChain, setWalletsToConnectByChain, eventsCallbacks, }) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const missingChains = getMissingChains.getMissingChains(walletsByChain, connectedWalletsInfo);
|
|
23
|
+
setWalletsToConnectByChain(missingChains);
|
|
24
|
+
try {
|
|
25
|
+
(_a = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onDisconnect) === null || _a === void 0 ? void 0 : _a.call(eventsCallbacks, {
|
|
26
|
+
walletConnector: wallet.connector,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
logger.logger.warn('Error calling onDisconnect', error);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.handleDisconnectWallet = handleDisconnectWallet;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { DynamicEventsCallbacks, Wallet } from '../../../shared';
|
|
3
|
+
import { ConnectedWalletConnectorType } from '../../../utils/hooks/useConnectWallet/useConnectWallet';
|
|
4
|
+
import { ChainsToConnect } from '../types';
|
|
5
|
+
type HandleDisconnectWalletArgs = {
|
|
6
|
+
wallet: Wallet;
|
|
7
|
+
connectedWalletsInfo: ConnectedWalletConnectorType[];
|
|
8
|
+
walletsByChain: ChainsToConnect[] | undefined;
|
|
9
|
+
setWalletsToConnectByChain: Dispatch<SetStateAction<ChainsToConnect[] | undefined>>;
|
|
10
|
+
eventsCallbacks?: DynamicEventsCallbacks;
|
|
11
|
+
};
|
|
12
|
+
export declare const handleDisconnectWallet: ({ wallet, connectedWalletsInfo, walletsByChain, setWalletsToConnectByChain, eventsCallbacks, }: HandleDisconnectWalletArgs) => void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import '@dynamic-labs/sdk-api';
|
|
2
|
+
import { logger } from '../../../shared/logger.js';
|
|
3
|
+
import '@dynamic-labs/iconic';
|
|
4
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import '../../ViewContext/ViewContext.js';
|
|
7
|
+
import 'react';
|
|
8
|
+
import '@dynamic-labs/wallet-book';
|
|
9
|
+
import '@dynamic-labs/utils';
|
|
10
|
+
import '../../../utils/constants/colors.js';
|
|
11
|
+
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
12
|
+
import 'viem';
|
|
13
|
+
import '../../../shared/consts/index.js';
|
|
14
|
+
import { getMissingChains } from '../../../utils/functions/getMissingChains/getMissingChains.js';
|
|
15
|
+
|
|
16
|
+
const handleDisconnectWallet = ({ wallet, connectedWalletsInfo, walletsByChain, setWalletsToConnectByChain, eventsCallbacks, }) => {
|
|
17
|
+
var _a;
|
|
18
|
+
const missingChains = getMissingChains(walletsByChain, connectedWalletsInfo);
|
|
19
|
+
setWalletsToConnectByChain(missingChains);
|
|
20
|
+
try {
|
|
21
|
+
(_a = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onDisconnect) === null || _a === void 0 ? void 0 : _a.call(eventsCallbacks, {
|
|
22
|
+
walletConnector: wallet.connector,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
logger.warn('Error calling onDisconnect', error);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { handleDisconnectWallet };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './handleDisconnectWallet';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api/src/models/JwtVerifiedCredential';
|
|
1
2
|
import { WalletConnector } from '../../../..';
|
|
2
|
-
import { AuthModeType, OnAuthSuccess, OnBeforeConnectSuccessConfirmation, OnConnectSuccess, OnEmailVerificationFailure, OnEmailVerificationSuccess, OnUserProfileUpdate, UserProfile, Wallet } from '../../../shared/types';
|
|
3
|
+
import { AuthModeType, OnAuthSuccess, OnBeforeConnectSuccessConfirmation, OnConnectSuccess, OnEmailVerificationFailure, OnEmailVerificationSuccess, OnEmbeddedWalletCreated, OnUserProfileUpdate, UserProfile, Wallet } from '../../../shared/types';
|
|
3
4
|
import { IDynamicContext } from '../types';
|
|
4
|
-
export type Callback = 'authSuccess' | 'linkSuccess' | 'emailVerificationSuccess' | 'emailVerificationFailure' | 'userProfileUpdate' | 'connectSuccess' | 'onBeforeConnectSuccessConfirmation';
|
|
5
|
+
export type Callback = 'authSuccess' | 'linkSuccess' | 'emailVerificationSuccess' | 'emailVerificationFailure' | 'userProfileUpdate' | 'connectSuccess' | 'onBeforeConnectSuccessConfirmation' | 'embeddedWalletCreated';
|
|
5
6
|
export type CallbackParams = {
|
|
6
7
|
/** For email verification */
|
|
7
8
|
email: string;
|
|
9
|
+
verifiedCredential?: JwtVerifiedCredential;
|
|
8
10
|
};
|
|
9
11
|
export type UseCustomerCallbacksArgs = {
|
|
10
12
|
authMode: AuthModeType;
|
|
@@ -16,6 +18,7 @@ export type UseCustomerCallbacksArgs = {
|
|
|
16
18
|
onBeforeConnectSuccessConfirmation?: OnBeforeConnectSuccessConfirmation;
|
|
17
19
|
onLinkSuccess?: OnAuthSuccess;
|
|
18
20
|
onUserProfileUpdate?: OnUserProfileUpdate;
|
|
21
|
+
onEmbeddedWalletCreated?: OnEmbeddedWalletCreated;
|
|
19
22
|
};
|
|
20
23
|
handleLogOut: () => Promise<void>;
|
|
21
24
|
isAuthenticated: boolean;
|