import { CanvasRetrieve } from '../../../../../types/openapi'; import { UiAppResizeRequest, UiCanvasNavigatePageRequest, UiUpdateCanvasRequest, UiPrintCanvasRequest, UiPrintCanvasResponse, UiSelectCanvasesRequest, UiSelectCanvasesResponse, UiOpenCollectionPlayerOverlayRequest } from './types.ui'; /** * Modify the currently loaded canvas. On the web it sends * an [update_canvas](https://pitcher.readme.io/reference/update_canvas) request to the server. * * @param payload parts of the canvas object to update with fields to return */ export declare function updateCanvas(payload: UiUpdateCanvasRequest): Promise; /** * Trigger async print/download of a canvas with optional notification URL. * Calls the downloader-test endpoint to convert the canvas to PDF. * * @param payload Canvas ID and optional notify URL for async notifications * @returns Promise with job ID and success status * * @example * useUi().printCanvas({ * id: '01HH4RCBH631K4JDHWAQB0RPR6', * notify_url: 'https://my-webhook.example.com/canvas-ready' * }) */ export declare function printCanvas(payload: UiPrintCanvasRequest): Promise; /** * Notify the CatalogIQ instance that the app is loaded and ready to get the data. Triggering this method will trigger * the `on_app_set_data` event. * * @example * @example * useUi().appLoaded() */ export declare function appLoaded(): Promise; /** * Resize the app iframe to a given height. * * Note that initial iframe height comes from the `app.json` manifest file. It can also be adjusted by the user when adding * app component to the canvas. In case when the app must be temporarily resized to show larger ui elements it can read the * user-set height from the [on_app_set_data](#on-app-set-data) event. * @param payload object containing requested height of the iframe as the number of pixels */ export declare function appResize(payload: UiAppResizeRequest): Promise; /** * Close the Canvas Section Execution modal. Only takes effect for `canvas_section_execution` app modules * * Note that this method simply closes the modal and will result in the app calling it being unmounted from the DOM and * destroyed. Make sure your app has finished updating data before you call this method. * * @example * useUi().closeCanvasSectionExecution() */ export declare function closeCanvasSectionExecution(): Promise; /** * Close the Canvas Drawer modal. Only takes effect for apps running in `canvas_drawer` embed location * * Note that this method simply closes the drawer and will result in the app calling it being unmounted from the DOM and * destroyed. Make sure your app has finished updating data before you call this method. * * @example * useUi().closeCanvasDrawer() */ export declare function closeCanvasDrawer(): Promise; /** * Navigate to the next page in the current canvas. Noop if the current page is the last one. * * @example * useUi().canvasNavigateNextPage() */ export declare function canvasNavigateNextPage(): Promise; /** * Navigate to the previous page in the current canvas. Noop if the current page is the first one. * * @example * useUi().canvasNavigatePreviousPage() */ export declare function canvasNavigatePreviousPage(): Promise; /** * Navigate to a specific canvas place in the current canvas. Despite the event and parameter name, it takes the component * id that we want to put in view. * * @example * const uiApi = useUi() // our useApi() * * let activeCanvas = null * const unsubscribe = uiApi.on_app_set_data((data) => { * activeCanvas = data?.canvas * }) * * document.getElementById('my-button').addEventListener('click', () => { * const target = activeCanvas?.content?.data?.find((i: any) => i.data.app_name === 'my-target-app-id') || null * if (target) { * uiApi.canvasNavigatePage({ page: target.id }) * } * }) */ export declare function canvasNavigatePage(payload: UiCanvasNavigatePageRequest): Promise; /** * Opens a modal to view a canvas by ID. * * ``` * onMounted(() => { * uiApi.openCanvasOverlay({ * id: '01HH4RCBH631K4JDHWAQB0RPR6', * edit_mode: false, * fullscreen: true, * }) * }) * ``` * * You can also specify a position for the canvas overlay: * * ``` * uiApi.openCanvasOverlay({ * id: '01HH4RCBH631K4JDHWAQB0RPR6', * position: { * top: '10px', * left: '20px', * right: '20px', * bottom: '10px' * } * }) * ``` */ export declare function openCanvasOverlay(payload: { id: 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; /** * Opens the collection player overlay to view a collection of files/slides. * * This method opens the native Pitcher collection player interface with the specified * files and slides. You can show entire files or specific pages from files. * * @example * // Open collection with full files * useUi().openCollectionPlayerOverlay({ * groups: [ * { id: 'file-123-abc', name: 'Product Overview' }, * { id: 'file-456-def', name: 'Pricing Slides' } * ], * name: 'Sales Deck' * }) * * // Open collection with specific slides/pages * useUi().openCollectionPlayerOverlay({ * groups: [ * { * id: 'file-123-abc', * name: 'Product Overview', * slides: [ * { file_id: 'file-123-abc', slide_index: 0 }, * { file_id: 'file-123-abc', slide_index: 2 } * ] * } * ], * name: 'Custom Sales Presentation' * }) * * @param payload Object containing groups array and collection name */ export declare function openCollectionPlayerOverlay(payload: UiOpenCollectionPlayerOverlayRequest): Promise; /** * Allows the user to select (and preselect) canvases from the instance. * * This method allows you to prompt the user to select canvases from the CatalogIQ * instance and use that canvas selection in your application. * * @example * const api = useApi() // or useUi() if you know that you 're in UI context * api * .selectCanvases({ * allowed_types: ['canvas','canvas-template','section','section-template'] // default ['canvas'] * selections: [ * { id: "01HCZ623YYRFJQ0F7B69VWE510" }, * { id: "02HCZ623YYRFJQ0F7B69VWE510" }, * ], // default [] * }) * * @param payload optional payload to preselect specific canvases * @returns Promise with the user action and selected canvases */ export declare function selectCanvases(payload?: UiSelectCanvasesRequest): Promise;