react-native-notificare-in-app-messaging
Version:
Notificare In-App Messaging React Native module.
96 lines • 4.77 kB
TypeScript
import { type EmitterSubscription } from 'react-native';
import type { NotificareInAppMessage, NotificareInAppMessageAction } from './models/notificare-in-app-message';
export declare class NotificareInAppMessaging {
private static readonly eventEmitter;
/**
* Indicates whether in-app messages are currently suppressed.
*
* @returns {Promise<boolean>} - A promise that resolves to `true` if message
* dispatching and the presentation of in-app messages are temporarily
* suppressed and `false` if in-app messages are allowed to be presented.
*/
static hasMessagesSuppressed(): Promise<boolean>;
/**
* Sets the message suppression state.
*
* When messages are suppressed, in-app messages will not be presented to the
* user. By default, stopping the in-app message suppression does not
* re-evaluate the foreground context.
*
* To trigger a new context evaluation after stopping in-app message
* suppression, set the `evaluateContext` parameter to `true`.
*
* @param {boolean} suppressed - Set to `true` to suppress in-app messages, or
* `false` to stop suppressing them.
* @param {boolean} evaluateContext - Set to `true` to re-evaluate the foreground
* context when stopping in-app message suppression.
* @returns {Promise<void>} - A promise that resolves when the message suppression
* state has been successfully set.
*/
static setMessagesSuppressed(suppressed: boolean, evaluateContext?: boolean): Promise<void>;
/**
* Called when an in-app message is successfully presented to the user.
*
* @param callback - A callback that will be invoked with the result of the
* onMessagePresented event. It will provide the {@link NotificareInAppMessage}
* that was presented.
* @returns {EmitterSubscription} - The {@link EmitterSubscription} for the
* onMessagePresented event.
*/
static onMessagePresented(callback: (message: NotificareInAppMessage) => void): EmitterSubscription;
/**
* Called when the presentation of an in-app message has finished.
*
* This method is invoked after the message is no longer visible to the user.
*
* @param callback - A callback that will be invoked with the result of the
* onMessageFinishedPresenting event. It will provide the
* {@link NotificareInAppMessage} that finished presenting.
* @returns {EmitterSubscription} - The {@link EmitterSubscription} for the
* onMessageFinishedPresenting event.
*/
static onMessageFinishedPresenting(callback: (message: NotificareInAppMessage) => void): EmitterSubscription;
/**
* Called when an in-app message failed to present.
*
* @param callback - A callback that will be invoked with the result of the
* onMessageFailedToPresent event. It will provide the
* {@link NotificareInAppMessage} that failed to present.
* @returns {EmitterSubscription} - The {@link EmitterSubscription} for the
* onMessageFailedToPresent event.
*/
static onMessageFailedToPresent(callback: (message: NotificareInAppMessage) => void): EmitterSubscription;
/**
* Called when an action is successfully executed for an in-app message.
*
* @param callback - A callback that will be invoked with the result of the
* onActionExecuted event. It will provide the
* {@link NotificareInAppMessageAction} that was executed and the
* {@link NotificareInAppMessage} for which the action was executed.
* @returns {EmitterSubscription} - The {@link EmitterSubscription} for the
* onActionExecuted event.
*/
static onActionExecuted(callback: (data: {
readonly message: NotificareInAppMessage;
readonly action: NotificareInAppMessageAction;
}) => void): EmitterSubscription;
/**
* Called when an action execution failed for an in-app message.
*
* This method is triggered when an error occurs while attempting to execute
* an action.
*
* @param callback - A callback that will be invoked with the result of the
* onActionFailedToExecuted event. It will provide the
* {@link NotificareInAppMessageAction} that failed to execute and the
* {@link NotificareInAppMessage} for which the action was attempted.
* @returns {EmitterSubscription} - The {@link EmitterSubscription} for the
* onActionFailedToExecute event.
*/
static onActionFailedToExecute(callback: (data: {
readonly message: NotificareInAppMessage;
readonly action: NotificareInAppMessageAction;
readonly error?: string | null;
}) => void): EmitterSubscription;
}
//# sourceMappingURL=notificare-in-app-messaging.d.ts.map