UNPKG

@builder.io/sdk-vue

Version:
38 lines (37 loc) 1.47 kB
import type { ContentProps } from '../components/content/content.types'; import type { BuilderAnimation } from '../types/builder-block'; import type { BuilderContent } from '../types/builder-content'; import type { Dictionary } from '../types/typescript'; type ContentListener = Required<Pick<ContentProps, 'model' | 'trustedHosts'>> & { callbacks: { contentUpdate: (updatedContent: BuilderContent) => void; stateUpdate: (newState: Dictionary<string>) => void; animation: (updatedContent: BuilderAnimation) => void; configureSdk: (updatedContent: any) => void; }; }; export declare const createEditorListener: ({ model, trustedHosts, callbacks }: ContentListener) => (event: MessageEvent<any>) => void; type SubscribeToEditor = ({ model, apiKey, callback, trustedHosts }: { /** * The Builder `model` to subscribe to */ model: string; /** * Builder API Key to use for the editor. */ apiKey: string; /** * The callback function to call when the content is updated. */ callback: (updatedContent: BuilderContent) => void; /** * List of hosts to allow editing content from. */ trustedHosts?: string[] | undefined; }) => () => void; /** * Subscribes to the Builder editor and listens to `content` updates of a certain `model`. * Sends the updated `content` to the `callback` function. */ export declare const subscribeToEditor: SubscribeToEditor; export {};