ebs.confirmAsync
(FintechOS Studio 20.2.1 and later)
Displays a modal confirmation window that returns the user’s selection asynchronously. The window contains two buttons that allow the user to confirm or reject an action.
Syntax
Copy
function confirmAsync(options: IEbsConfirmAsyncOptions): Promise<boolean>;
| Parameter | Type | Description |
|---|---|---|
options
|
IEbsConfirmAsyncOptions | Configuration settings for the title, message, and button labels of the confirmation window. |
Type Aliases
IEbsConfirmAsyncOptions
Configuration options for customizing the title, message, and button labels of a confirmation window with an asynchronous result.
Copy
interface IEbsConfirmAsyncOptions {
title?: string;
message?: string;
yesButtonLabel?: string;
noButtonLabel?: string;
}
| Property | Type | Description |
|---|---|---|
title (optional) |
string | Tile of the confirmation window. Default: Confirmation. |
message (optional) |
string | Content of the confirmation window. You can use HTML markup for formatting. Default: Are you sure? |
yesButtonLabel(optional)
|
string | Label displayed on the confirmation button. Default: Yes. |
noButtonLabel(optional)
|
string | Label displayed on the rejection button. Default. No. |
Response
Returns a promise boolean value that resolves based on the user’s choice:
- true if the confirmation button is selected
- false if the rejection button is selected
This allows confirmation and rejection to be handled asynchronously.
Examples
In this example, we create a cookie consent confirmation window with the following features:
- We create a function called manageCookies to redirect the user to the https://www.mywebsite.com/cookies-policy in case of refusal. For details on how to navigate to a URL, see ebs.goToUrl.
- The confirmation window title is Cookie Consent.
- The confirmation window message is We use cookies. This site uses cookies to offer you a better browsing experience. By continuing to use our site, you consent to the use of cookies.
- The label used to close the alert window and proceed is I agree.
- The label used to redirect the user to the cookies policy page is Manage cookies.
Copy
function manageCookies(){
ebs.goToUrl('https://www.mywebsite.com/cookies-policy')
}
ebs.confirmAsync({
title: 'Cookie Consent',
message: '<h1>We use cookies</h1><p>This site uses cookies to offer you a better browsing experience.<p><p>By continuing to use our site, you consent to the use of cookies.</p>',
yesButtonLabel: 'I agree',
noButtonLabel: 'Manage cookies'
})
.then(function(userConfirmed) {
if (userConfirmed) {
// User pressed the "I agree" button
// proceed with business as usual
} else {
// User pressed the "Manage cookies" button
manageCookies();
}
});
This displays the following alert window in the user interface: