/*!
 * Copyright 2017 - 2020 by ChartIQ, Inc.
 * All rights reserved.
 */
/**
 * Used to send, receive and manipulate notifications
 * @module NotificationClient
 */
/**
This is how we want our API to work going foward, the way the world does it: import { processAndSet } from "configClient"
```
export const processAndSet = () => { ... }
```

This module's single exported object gives us backward compatibility when our core code does this: import { ConfigClient } from "configClient"
and provides the object that is attached to FSBL.Clients. This export should be kept as clean and simple as possible.
```
export const ConfigClient = {
   processAndSet
}
```

The default export gives us backward compatibility where our core code does this: import ConfigClient from "configClient"
This can be eliminated when our core core is converted to normal imports as in the first example.
```
export default ConfigClient;
```
*/
import { Action, ActionTypes, Filter, IAction, INotification, IFilter, IMuteFilter, INotificationHistoryOptions, ISubscription, OnNotificationCallback, Notification, Subscription } from "../services/notification/types";
export { Notification, Subscription, Action, Filter, ActionTypes };
/**
 * Fetches all the notifications sent to Finsemble after a specific date.
 *
 * ```JavaScript
 * let lastMonth = new Date();
 * lastMonth.setMonth(lastMonth.getMonth()-1);
 *
 * const notifications = await FSBL.Clients.NotificationClient.fetchHistory({sentAfter: lastMonth.toISOString()})
 *
 * ```
 *
 * Get notifications sent between now and one month ago that matches a filter.
 * ```JavaScript
 *
 * const lastMonth = new Date();
 * lastMonth.setMonth(lastMonth.getMonth()-1);
 *
 * const filter = new FSBL.Clients.NotificationClient.Filter();
 *
 * // include all notifications from the OMS
 * filter.include.push({"source":"order-management-system"})
 *
 * // But exclude informational notifications from the OMS
 * filter.exclude.push({"source":"order-management-system", type:"informational"})
 * const notifications = await FSBL.Clients.NotificationClient.fetchHistory({sentAfter: lastMonth.toISOString()}, filter)
 * ```
 * @param options An options object or an ISO8601 formatted date string.
 * @param filter to match to notifications.
 * @returns array of notifications.
 * @throws Error throws an error on par with the Promise standard, containing detail why the request did not complete
 *
 * Get notifications sent between now and one month ago
 */
export declare const fetchHistory: (options?: string | INotificationHistoryOptions | undefined, filter?: IFilter | undefined) => Promise<INotification[]>;
/**
 * Return an ISO8601 date a notification matching the specified source was issued.
 * If no source is provided it will get the latest issue date for all notifications
 * (i.e the last time any notification was issue to the service)
 *
 * If you're sending notifications to Finsemble from an external source, you might want to know when the last
 * Notification of that type was received by Finsemble, so you're able to send any pending ones to the
 * user's desktop
 *
 * ```JavaScript
 * // Get the last date Finsemble received a notification sent with the source field set to "product-update-service"
 * const lastIssuedDate = await FSBL.Clients.NotificationClient.getLastIssuedAt("product-update-service")
 * ```
 * @param source to identify which notification to save lastUpdated time for.
 * @returns last issued at date string in the ISO8601 date format.
 * @throws Error throws an error on par with the Promise standard, containing detail why the request did not complete
 */
export declare const getLastIssuedAt: (source?: string | undefined) => Promise<string>;
/**
 * Tells the service to perform the supplied action on the notification(s)
 *
 *
 * ```JavaScript
 *  await FSBL.Clients.NotificationClient.performAction([notification], action).catch((e) => {
 *   console.log("Request to perform action failed");
 * });
 * // Request to perform action succeeded. The updated notification state will be broadcast to the subscribed clients
 * ```
 * @param notifications Notifications to apply action to.
 * @param action which has been triggered by user.
 * @throws If no error is thrown, the service has received the request to perform the action successfully. Note a successful resolution of the promise does not mean successful completion of the action.
 */
export declare const performAction: (notifications: Partial<INotification>[], action: IAction) => Promise<void>;
/**
 * Sets the states of the isRead field to true.
 *
 * All clients subscribed to received the updated notifications will be sent the new state.
 *
 *
 * ```JavaScript
 * await FSBL.Clients.NotificationClient.markRead([previouslyReceivedNotification]);
 * ```
 * @param notifications
 */
export declare const markRead: (notifications: INotification[]) => Promise<void>;
/**
 * Sets the states of the isRead field to false.
 *
 * All clients subscribed to received the updated notifications will be sent the new state.
 *
 *
 * ```JavaScript
 * await FSBL.Clients.NotificationClient.markUnread([previouslyReceivedNotification]);
 * ```
 * @param notifications
 */
export declare const markUnread: (notifications: INotification[]) => Promise<void>;
/**
 * Deletes a notification
 *
 * All clients subscribed to receive the updated notifications will be sent the new state.
 *
 * @param notifications The notifications to delete
 */
export declare const deleteNotifications: (notifications: INotification[]) => Promise<void>;
/**
 * Send a new notification to Finsemble or update existing notifications already in Finsemble.
 *
 * Send a new notification
 * ```JavaScript
 * const notification = new FSBL.Clients.NotificationClient.Notification();
 * // Set your notification fields accordingly
 * 	notification.title = "Regarding Order...";
 * 	notification.details = "Creates a new notification in UI";
 * 	notification.type = "email";
 *
 * await FSBL.Clients.NotificationClient.notify([notification]);
 * ```
 * @param notifications Array of INotification
 * @throws Error If no error is thrown the service has received the notifications successfully
 */
export declare const notify: (notifications: Partial<INotification>[] | Partial<INotification>) => Promise<void>;
/**
 * Subscribe to a notification stream given filters. Returns subscriptionId
 *
 * ```JavaScript
 * const { NotificationClient } = FSBL.Clients;
 * const subscription = new NotificationClient.Subscription();
 *
 * // Set the filter to match INotification fields
 * subscription.filter = new NotificationClient.Filter();
 * // subscription.filter.include.push({"type": "chat"});
 *
 * const onNotification = (notification: INotification) => {
 *  // This function will be called when a notification arrives
 *  addToList(notification);
 * };
 *
 * // Use the subscription Id to unsubscribe from a specific subscription
 * const subscriptionId = await NotificationClient.subscribe(subscription, onNotification);
 * ```
 * @param subscription with name value pair used to match on.
 * @param onNotification callback for when a subscribing UI component receives a notification.
 * @throws Throws an error on par with the Promise standard, containing detail why the request did not complete
 * @returns A subscription Id that can be used to unsubscribe from the notification stream.
 */
export declare const subscribe: (subscription: Partial<ISubscription>, onNotification: OnNotificationCallback) => Promise<string>;
/**
 * Used to unsubscribe from a notification stream.
 *
 * ```JavaScript
 * // the subscriptionId is returned from the subscribe function
 * await FSBL.Clients.NotificationClient.unsubscribe(subscriptionId);
 * ```
 * @param subscriptionId which was returned when subscription was created.
 * @throws Throws an error on par with the Promise standard, containing detail why the request did not complete
 */
export declare const unsubscribe: (subscriptionId: string) => Promise<void>;
/**
 * Unsubscribe from all notification streams registered with the window's client instance.
 *
 * ```JavaScript
 * FSBL.Clients.NotificationClient.unsubscribeAll();
 * ```
 */
export declare const unsubscribeAll: () => void;
/**
 * Sets a user preference on which notifications to mute. All future notifications that match the filter will
 * have the mute flag set to true
 *
 * ```JavaScript
 * // Mute all notifications coming from the 'order-management-system' source with type 'informational'
 * await FSBL.Clients.NotificationClient.mute({
 *   source: "order-management-system",
 *   type: "informational"
 * });
 * ```
 * @param filter Notifications to apply action to.
 * @throws If no error is thrown the service has performed the mute successfully.
 */
export declare const mute: (filter: IMuteFilter | IMuteFilter[]) => Promise<void>;
/**
 * Sets the filter preference on which notifications to mute. All future notifications that match the filter will
 * have the mute flag set to true
 *
 * ```JavaScript
 * // Unmute all notifications coming from the 'order-management-system' source with type 'informational'
 * await FSBL.Clients.NotificationClient.unmute({
 *   source: "order-management-system",
 *   type: "informational"
 * });
 * ```
 * @param filter Notifications to apply action to.
 * @throws If no error is thrown the service has performed the unmute successfully.
 */
export declare const unmute: (filter: IMuteFilter | IMuteFilter[]) => Promise<void>;
/**
 * Gets the current mute filters for Notification sources in Finsemble.
 *
 * @return an array with all the mute filters.
 */
export declare const getMuteFilters: () => Promise<IMuteFilter[]>;
/**
 * Gets the current notifications preferences object. It tries to load the configs saved in
 * the user preferences and will fallback to config/schema defaults if none are present.
 *
 * @returns The notification preferences object.
 */
export declare const getPreferences: () => Promise<Object>;
export declare const onClose: (cb?: (() => void) | undefined) => void;
/**
 * @ignore
 */
export declare const NotificationClient: {
    /**
     * For backward compatibility
     * @private
     * @deprecated
     */
    initialize: () => void;
    /**
     * For backward compatibility
     * @private
     * @deprecated
     */
    onReady: (cb?: any) => void;
    fetchHistory: (options?: string | INotificationHistoryOptions | undefined, filter?: IFilter | undefined) => Promise<INotification[]>;
    getLastIssuedAt: (source?: string | undefined) => Promise<string>;
    performAction: (notifications: Partial<INotification>[], action: IAction) => Promise<void>;
    markRead: (notifications: INotification[]) => Promise<void>;
    markUnread: (notifications: INotification[]) => Promise<void>;
    deleteNotifications: (notifications: INotification[]) => Promise<void>;
    notify: (notifications: Partial<INotification>[] | Partial<INotification>) => Promise<void>;
    subscribe: (subscription: Partial<ISubscription>, onNotification: OnNotificationCallback) => Promise<string>;
    unsubscribe: (subscriptionId: string) => Promise<void>;
    unsubscribeAll: () => void;
    mute: (filter: IMuteFilter | IMuteFilter[]) => Promise<void>;
    unmute: (filter: IMuteFilter | IMuteFilter[]) => Promise<void>;
    getPreferences: () => Promise<Object>;
    getMuteFilters: () => Promise<IMuteFilter[]>;
    /**
     * @deprecated
     */
    getSources: () => Promise<string[]>;
    onClose: (cb?: (() => void) | undefined) => void;
    Notification: typeof Notification;
    ActionTypes: typeof ActionTypes;
    Subscription: typeof Subscription;
    Action: typeof Action;
    Filter: typeof Filter;
    actionTypes: typeof ActionTypes;
};
/**
 * @ignore
 */
export default NotificationClient;
//# sourceMappingURL=notificationClient.d.ts.map