import { UiMeetingCanceledPayload, UiCanvasUpdatedPayload, UiSectionListUpdatedPayload, UiAppSetDataPayload, UiAppUpdateDataPayload, UiBroadcastRequest, UiMessagePayloads } from './types.ui'; /** * Subscribe to a given event type by its key. * * @example * const unsubscribeFromSectionListUpdate = useUi().on('ui_section_list_updated', (event: object) => { * // handle event * }) * * // later * unsubscribeFromSectionListUpdate.then(unsubscribe => unsubscribe()) * * @param type The event type/key to subscribe to. * @param handler The handler function to call when the event is emitted. * @returns A Promise resolving to a cleanup function to unsubscribe from the event. */ declare function on(type: T, handler: (data: UiMessagePayloads[T]) => Promise): Promise<() => void>; /** * Subscribe to the meeting canceled event. * * @example * const unsubscribeFromMeetingCanceled = useUi().onMeetingCanceled((event: { * accountId?: string; * eventId?: string; * }) => { * // handle event * }) * * // later * unsubscribeFromMeetingCanceled.then(cancel => cancel()) * * @param handler * @returns A Promise resolving to a cleanup function to unsubscribe from the event. */ declare function onMeetingCanceled(handler: (data: UiMeetingCanceledPayload) => Promise): Promise<() => void>; /** * Subscribe to the canvas updated event. It is triggered when the current canvas of the app is updated. * * @example * const unsubscribePromise = useUi().onCanvasUpdated((event: { canvas }) => { * // handle event * }) * * // later * unsubscribePromise.then(unsubscribe => unsubscribe()) * * @returns A Promise resolving to a cleanup function to unsubscribe from the event. */ declare function onCanvasUpdated(handler: (data: UiCanvasUpdatedPayload) => Promise): Promise<() => void>; /** * Subscribe to the section list updated event. It is triggered when the list of sections (products) in the current canvas * is updated. * * @example * const unsubscribePromise = useUi().onSectionListUpdated((event: { canvas }) => { * // handle event * }) * * // later * unsubscribePromise.then(unsubscribe => unsubscribe()) * * @returns A Promise resolving to a cleanup function to unsubscribe from the event. */ declare function onSectionListUpdated(handler: (data: UiSectionListUpdatedPayload) => Promise): Promise<() => void>; /** * Subscribe to the app set data event. It is triggered when the app data is set. This event is triggered when the app is * loaded and in certain other cases after loading. * * This is the main event for the canvas app to receive data from the CatalogIQ instance and know about its environment. * * @example * let user = null * let isEditMode = null * let activeCanvas = null * let isPrintMode = false * const unsubscribePromise = useUi().onAppSetData((data) => { * user = data?.user * isEditMode = data?.is_edit_mode * activeCanvas = data?.canvas * isPrintMode = data?.display_mode === 'print' || data?.client === 'dsr' * // ...mode logic... * }) * * // later * unsubscribePromise.then(unsubscribe => unsubscribe()) * * @returns A Promise resolving to a cleanup function to unsubscribe from the event. */ declare function onAppSetData(handler: (data: UiAppSetDataPayload) => Promise): Promise<() => void>; /** * Subscribe to the app update data event. It is triggered when the user changes from edit mode to view mode or vice versa * and when the call is started or ended. * * @example * let inCall = false * let isEditMode = false * const unsubscribePromise = useUi().onAppUpdateData((data) => { * isEditMode = data?.is_edit_mode * inCall = data?.in_call * // ...mode logic... * }) * * // later * unsubscribePromise.then(unsubscribe => unsubscribe()) * * @returns A Promise resolving to a cleanup function to unsubscribe from the event. */ declare function onAppUpdateData(handler: (data: UiAppUpdateDataPayload) => Promise): Promise<() => void>; /** * Broadcast event to the UI. Hidden from the documentation. * * @hidden */ declare function uiBroadcast(payload: UiBroadcastRequest): Promise; declare const _default: { promptPia(payload: import('./types.ui').UiPromptPiaRequest): Promise; completePostcall(payload: import('./types.ui').UiCompletePostcallRequest): Promise; cancelMeeting(): Promise; resumeMeeting(): Promise; stopMeeting(): Promise; enablePostcallSubmit(): Promise; disablePostcallSubmit(): Promise; setPostcallStyle(payload: import('./types.ui').UiSetPostcallStyleRequest): Promise; updateCanvas(payload: import('./types.ui').UiUpdateCanvasRequest): Promise; printCanvas(payload: import('./types.ui').UiPrintCanvasRequest): Promise; appLoaded(): Promise; appResize(payload: import('./types.ui').UiAppResizeRequest): Promise; closeCanvasSectionExecution(): Promise; closeCanvasDrawer(): Promise; canvasNavigateNextPage(): Promise; canvasNavigatePreviousPage(): Promise; canvasNavigatePage(payload: import('./types.ui').UiCanvasNavigatePageRequest): Promise; openCanvasOverlay(payload: { id: import('../../../../main.lib').CanvasRetrieve["id"]; edit_mode?: boolean; fullscreen?: boolean; component_id?: string; section_id?: string; position?: { left?: number | string; right?: number | string; top?: number | string; bottom?: number | string; }; }): Promise; openCollectionPlayerOverlay(payload: import('./types.ui').UiOpenCollectionPlayerOverlayRequest): Promise; selectCanvases(payload?: import('./types.ui').UiSelectCanvasesRequest): Promise; captureAppError(payload: import('./types.ui').UiCaptureAppErrorRequest): Promise; updateLocation(payload: import('../../../interfaces').UpdateLocationPitcherEvent): Promise; embeddableReady(): Promise; ui_select_content(payload?: import('./types.ui').UiSelectContentRequest): Promise; selectContent(payload?: import('./types.ui').UiSelectContentRequest): Promise; open(payload: import('./types.ui').UiOpenRequest): Promise; toast(payload: import('./types.ui').UiToastRequest): Promise; preselectSfdcMeetingId(payload: import('./types.ui').UiPreselectSfdcMeetingIdRequest): Promise; selectCollectionContent(payload?: import('./types.ui').UiSelectCollectionPlayerRequest): Promise; selectAgendaContent(payload?: import('./types.ui').UiSelectAgendaRequest): Promise; on: typeof on; onMeetingCanceled: typeof onMeetingCanceled; onCanvasUpdated: typeof onCanvasUpdated; onSectionListUpdated: typeof onSectionListUpdated; onAppSetData: typeof onAppSetData; onAppUpdateData: typeof onAppUpdateData; uiBroadcast: typeof uiBroadcast; }; export default _default;