@causalfoundry/js-sdk
Version:
Causal Foundry WEB SDK (JS/TS)
33 lines (27 loc) • 935 B
text/typescript
import {Nudge, NudgeDefinition} from "../../core/repositories/nudges/typings";
export declare interface NotificationDispatcher {
on<U extends keyof CfNotificationEvents>(
event: U, listener: CfNotificationEvents[U]
): this;
emit<U extends keyof CfNotificationEvents>(
event: U, ...args: Parameters<CfNotificationEvents[U]>
): boolean;
}
export enum NotificationAction {
Shown = 'shown',
Error = 'error',
Block = 'block',
Discard = 'discard',
Open = 'open',
Expired = "expired"
}
export interface CfNotificationEvents {
[NotificationAction.Shown]: (id: number) => void;
[NotificationAction.Block]: (id: number) => void;
[NotificationAction.Discard]: (id: number) => void;
[NotificationAction.Open]: (id: number) => void;
[NotificationAction.Expired]: (id: number) => void;
}
export interface NotificationDispatcher {
show(nudge : Nudge, id: number)
}