/************************************************************************* * Copyright 2020 Adobe * All Rights Reserved. * * NOTICE: Adobe permits you to use, modify, and distribute this file in * accordance with the terms of the Adobe license agreement accompanying * it. If you have received this file from a source other than Adobe, * then your use, modification, or distribution of it requires the prior * written permission of Adobe. **************************************************************************/ /** * APIs that let solutions interact with Pulse, Adobe's Notification System. * * ***Import:*** * * ```typescript * import pulse from '@adobe/exc-app/pulse'; * ``` * * ***Default export:*** * * [PulseApi](../interfaces/pulse.pulseapi.md#interface-pulserapi) * * ***Usage:*** * * ```typescript * import pulse, {NotificationType} from '@adobe/exc-app/pulse'; * * pulse.send([{ * groupIds: [], * messageType: NotificationType.UPDATES_ON_SUBSCRIBED_OBJECT, * metadata: {priority: 'low'}, * sendToOrg: false, * templateParams: {message: 'System shared Asset shared'}, * userIds: [] * }]); * ``` * * API for sending pulse notifications. * @packageDocumentation * @module pulse */ /** * @ignore */ export declare enum NotificationType { /** * Request for approval of a resource. */ APPROVAL_REQUEST = "approval_request", /** * Acceptance or rejection of an approval request. */ APPROVAL_REQUEST_ACTION = "approval_request_action", /** * Request for access. */ ACCESS_REQUEST = "access_request", /** * Acceptance or rejection of an access request. */ ACCESS_REQUEST_ACTION = "access_request_action", /** * Assignment notification. */ ASSIGNED = "assigned", /** * Sharing notification. */ SHARED = "shared", /** * Mentions notification. */ MENTIONS = "mentions", /** * Update notification. */ UPDATES_ON_SUBSCRIBED_OBJECT = "updates_on_subscribed_object", /** * Notification for completion with errors. */ ERROR_COMPLETED_WITH_ERRORS = "completed_with_errors", /** * Notification for failure with errors. */ ERROR_FAILED_WITH_ERRORS = "failed_with_errors", /** * Error default message. */ ERROR_DEFAULT_MESSAGE = "errors_default_message", /** * Other notification. */ OTHERS = "others" } export interface PulseNotification { /** * Type of Notification to be sent. */ messageType: NotificationType; /** * A map of key value pairs which can be provided by publisher of notification for the consumer. */ metadata?: Record; /** * Templated parameters. */ templateParams: Record; /** * List of IMS user ids of the users to receive notification. * A maximum of 100 user-ids are supported at a time. */ userIds?: string[]; /** * List of group ids to receive notification. */ groupIds?: string[]; /** * Specifies whether to send notifications to the complete IMS org. */ sendToOrg?: boolean; } export interface PulseResponse { /** * Notifications */ notifications: { /** * Specific notification. */ notification: { /** * Status code for the notification. */ statusCode: number; /** * Error message received if applicable. */ errorMessage: string; /** * Id of the notification. */ 'notification-id': string; }[]; }; } export interface PulseButtonConfig { /** * Text of the button. */ label: string; /** * Callback function to be automatically executed on click. */ callback?: (value?: any) => void; } export interface PulseApi { /** * Method to send a pulse notification. */ send(notifications: PulseNotification[]): Promise; /** * Adds an additional custom button to the bottom of the Pulse container. * Will fire the attached callback when a user presses the button. * @param buttonConfig The button configuration */ setButton(buttonConfig: PulseButtonConfig): void; /** * Adds additional values to the notification. * If Pulse has 3 internally and this is set to 2, the UI will show 5. * @param count Additional values to add to the pulse notification. */ setCount(count: number): void; } declare const pulse: PulseApi; export default pulse;