Skip to content

Commit 3a624d8

Browse files
Merge pull request #1707 from multiversx/development
5.6.0
2 parents 3f6358e + e53e823 commit 3a624d8

6 files changed

Lines changed: 30 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [[5.6.0](https://github.com/multiversx/mx-sdk-dapp/pull/1707)] - 2026-01-13
11+
12+
- [Added async `onCancelLogin` callback to UnlockPanelManager and made `onClose` callback async](https://github.com/multiversx/mx-sdk-dapp/pull/1706)
13+
1014
## [[5.5.2](https://github.com/multiversx/mx-sdk-dapp/pull/1704)] - 2026-01-13
1115

1216
- [Added `selectProvider` method to UnlockPanelManager](https://github.com/multiversx/mx-sdk-dapp/pull/1703)

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ export const AdvancedConnectButton = () => {
183183
const { address, signature } = await provider.login();
184184
navigate(`/dashboard?address=${address}`);
185185
},
186+
onCancelLogin: async () => { // optional action to be performed when the user cancels the login
187+
navigate('/');
188+
}
186189
});
187190
const handleOpenUnlockPanel = () => {
188191
unlockPanelManager.openUnlockPanel();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@multiversx/sdk-dapp",
3-
"version": "5.5.2",
3+
"version": "5.6.0",
44
"description": "A library to hold the main logic for a dapp on the MultiversX blockchain",
55
"author": "MultiversX",
66
"license": "MIT",

src/managers/UnlockPanelManager/UnlockPanelManager.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export class UnlockPanelManager extends SidePanelBaseManager<
3737
private static loginHandler: LoginHandlerType | null = null;
3838
private static onClose: OnCloseUnlockPanelType | null = null;
3939
private static allowedProviders?: ProviderType[] | null = null;
40+
private static onCancelLogin?: (() => Promise<void>) | null = null;
4041

4142
constructor() {
4243
super({
@@ -62,6 +63,10 @@ export class UnlockPanelManager extends SidePanelBaseManager<
6263
this.onClose = params.onClose;
6364
}
6465

66+
if (params.onCancelLogin) {
67+
this.onCancelLogin = params.onCancelLogin;
68+
}
69+
6570
return this.getInstance();
6671
}
6772

@@ -109,7 +114,7 @@ export class UnlockPanelManager extends SidePanelBaseManager<
109114
isLoginFinished?: boolean;
110115
}) => {
111116
if (!options?.isLoginFinished && UnlockPanelManager.onClose) {
112-
UnlockPanelManager.onClose();
117+
await UnlockPanelManager.onClose();
113118
}
114119

115120
this.closeUI();
@@ -142,5 +147,8 @@ export class UnlockPanelManager extends SidePanelBaseManager<
142147

143148
private readonly handleCancelLogin = async () => {
144149
await ProviderFactory.destroy();
150+
if (UnlockPanelManager.onCancelLogin) {
151+
await UnlockPanelManager.onCancelLogin();
152+
}
145153
};
146154
}

src/managers/UnlockPanelManager/UnlockPanelManager.types.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type LoginFunctonType = ({
2424
export type LoginCallbackType = () => void;
2525

2626
export type LoginHandlerType = LoginFunctonType | LoginCallbackType;
27-
export type OnCloseUnlockPanelType = () => void;
27+
export type OnCloseUnlockPanelType = () => Promise<void>;
2828

2929
export type UnlockPanelManagerInitParamsType = {
3030
/**
@@ -70,10 +70,20 @@ export type UnlockPanelManagerInitParamsType = {
7070
*
7171
* @example
7272
* ```ts
73-
onClose: () => {
73+
onClose: async () => {
7474
navigate('/');
7575
}
7676
* ```
7777
*/
7878
onClose?: OnCloseUnlockPanelType;
79+
/**
80+
* Callback function to handle UI behavior when the login is cancelled
81+
* @example
82+
* ```ts
83+
* onCancelLogin: async () => {
84+
* navigate('/');
85+
* }
86+
* ```
87+
*/
88+
onCancelLogin?: () => Promise<void>;
7989
};

src/managers/UnlockPanelManager/tests/UnlockPanelManager.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('UnlockPanelManager tests', () => {
4343
loginHandler: () => {
4444
navigete();
4545
},
46-
onClose: () => {
46+
onClose: async () => {
4747
onClose();
4848
}
4949
});

0 commit comments

Comments
 (0)