import { Id, RuntimeConfigType } from '../types/CommonTypes'; /** * The SubscriberController is responsible for all listeners which can influence the application-state from outside. * Callbacks inside this controller can be set by `window.SDK.subscriber.{method-name}` */ export declare class SubscriberController { /** * @ignore */ private config; /** * @ignore */ private localConfig; /** * @ignore */ constructor(config: RuntimeConfigType, localConfig: Map); /** * Listener on actions, if this changes, this listener will get triggered with the updates * @param actions Stringified array of DocumentAction type */ onActionsChanged: (actions: string) => void; /** * Listener on when a certain animation gets changed * @param animation Stringified array of FrameAnimationType */ onAnimationChanged: (animation: string) => void; /** * Listener on the playback state of the animation, it contains the current time of the playback (in milliseconds) and a flag that describes if the animation is currently playing * @param animationPlaybackState Stringified array of AnimationPlaybackType */ onAnimationPlaybackChanged: (animationPlaybackState: string) => void; /** * Listener on the state of the currently selected layout, if its properties are changed, this listener will get triggered with the new properties * @param layoutProperties Stringified object of LayoutPropertiesType */ onSelectedLayoutPropertiesChanged: (layoutProperties: string) => void; /** * Listener on the unit of the currently active layout. If you switch between layouts with different units, this listener will get triggered with the new unit * If you switch the unit of a layout this listener will get triggered with the new unit * * @param unit Stringified object of MeasurementUnit */ onSelectedLayoutUnitChanged: (unit: string) => void; /** * Listener on the state of all frames, if this changes, this listener will get triggered with the updates * @param framesLayout Stringified array of FrameLayoutType objects */ onFramesLayoutChanged: (framesLayout: string) => void; /** * Listener on the state of the currently selected frames, if this changes, this listener will get triggered with the updates * @param framesLayout Stringified array of FrameLayoutType objects */ onSelectedFramesLayoutChanged: (framesLayout: string) => void; /** * Listener on the state of the currently selected frame, it contains some basic information on the type of frame it is * @param framesContent Stringified array of Frame objects */ onSelectedFramesContentChanged: (framesContent: string) => void; /** * Listener on the general state of the document, gets triggered every time a change is done on the document. */ onStateChanged: () => void; /** * Listener on authentication expiration. * The callback should resolve to the refreshed authentication. If the * listener is not defined, the http requests from the connector will return * 401 with no refetch of assets. * * When this emits it means either: * - the grafxToken needs to be renewed * - any other authentication needs to be renewed (user impersonation, static..) * * @param authRefreshRequest Stringified object of AuthRefreshRequest */ onAuthExpired: (authRefreshRequest: string) => Promise; /** * Listener on viewport request. * The callback should resolve to the visible viewport. If the * listener is not defined, the viewport will take full size. * * When this emits it means that the engine requested the viewport for a * zoom to page call. */ onViewportRequested: () => string | null; /** * Listener on when the document is fully loaded. */ onDocumentLoaded: () => void; /** * @deprecated use `onSelectedPageIdChanged` instead * To be implemented, gets triggered when clicking on the pageTitle on the canvas. */ onPageSelectionChanged: (id: Id) => void; /** * Listener on when variables change * @param variablesJson Stringified array of Variable */ onVariableListChanged: (variablesJson: string) => void; /** * Listener on when the tool has changed by the canvas * @param tool the string representation of a certain tool */ onSelectedToolChanged: (tool: string) => void; /** * Listener on state changes * @param undoState Stringified object of UndoState */ onUndoStateChanged: (undoState: string) => void; /** * Listener on custom undo data changes * * @param customData Stringified object of custom undo data */ onCustomUndoDataChanged: (customData: string) => void; /** * Listener on the state of the currently selected layout's frames, if this changes, this listener will get triggered with the updates * @param layoutFrames Stringified object of Frames */ onSelectedLayoutFramesChanged: (layoutFrames: string) => void; /** * Listener on the state of the currently selected text's styles, if this changes, this listener will get triggered with the updates * @param styles Stringified object of styles */ onSelectedTextStyleChanged: (styles: string) => void; /** * Listener on the state of the currently selected color's styles, if this changes, this listener will get triggered with the updates * @param colors Stringified object of colors */ onColorsChanged: (colors: string) => void; /** * Listener on paragraph styles, if this changes, this listener will get triggered with the updates * @param paragraphStyles Stringified object of paragraph styles */ onParagraphStylesChanged: (paragraphStyles: string) => void; /** * Listener on character styles, if this changes, this listener will get triggered with the updates * @param characterStyles Stringified object of character styles */ onCharacterStylesChanged: (characterStyles: string) => void; /** * Listener on fonts, if this changes, this listener will get triggered with the updates * @param fonts Stringified object of font families */ onFontFamiliesChanged: (fonts: string) => void; /** * Listener on selected layout id, this listener will get triggered when a different layout is selected. * @param id the currently selected layout id */ onSelectedLayoutIdChanged: (id: Id) => void; /** * Listener on layouts, this listener will get triggered when a (sub)layout is * - created * - removed * - renamed * - duplicated * @param layouts Stringified object of layouts */ onLayoutsChanged: (layouts: string) => void; /** * Listener on scale factor of the canvas, this listener will get triggered when a zoom is applied to the canvas * @param zoom Stringified scale factor */ onZoomChanged: (zoom: string) => void; /** * Listener on connector events, this listener will get triggered when a connector emits one of those events * - reloadRequired * - authChanged * - unloaded * - stateChanged * * stateChanged - this event will be triggered by connector states: loading, loaded, running, ready, error * @param connectorEvent Stringified object of ConnectorEvent */ onConnectorEvent: (connectorEvent: string) => void; /** * Listener on connectors, if this changes, this listener will get triggered with the updates * @param connectors Stringified array of ConnectorInstance type */ onConnectorsChanged: (connectors: string) => void; /** * @experimental * Listener on when the selectedPageID is changed. * @param pageId Stringified pageId */ onSelectedPageIdChanged: (pageId: string) => void; /** * @experimental * Listener on pages list, this listener will get triggered when the pages are updated. * @param pages Stringified object of the pages */ onPagesChanged: (pages: string) => void; /** * @experimental * Listener on pages snapshots, this will fire when a page snapshot is invalidated and should be updated. * @param pageId id of the page */ onPageSnapshotInvalidated: (pageId: Id) => void; /** * Listener on page size, this listener will get triggered when the page size is changed, while the document is a `project`. * This will not emit anything if your document is a `template`. * @param pageSize Stringified object of the PageSize */ onPageSizeChanged: (pageSize: string) => void; /** * Listener on corner radii of rectangle and polygon shapes, this listener will get triggered when any corner radius is changed * @param cornerRadius Stringified object of the CornerRadius */ onShapeCornerRadiusChanged: (cornerRadius: string) => void; /** * Listener of editor entering / exiting the crop mode * @param id frame id when entering / null when exiting */ onCropActiveFrameIdChanged: (id?: Id) => void; /** * Listener on async errors. * Async errors are thrown at times not directly tied to SDK calls. * e.g. Getting an action error triggered after a late event. * * If this is an `ActionAsyncError`: * - `id` refers to the action id * - `event` refers to the event that triggered the action * - `eventChain` refers the chain of events that lead to the action, first * item being the closest parent. * @param asyncError error triggered asynchronously */ onAsyncError: (asyncError: string) => void; /** * Listener on when the view mode has changed * @param viewMode the string representation of a view mode */ onViewModeChanged: (viewMode: string) => void; /** * Listener on when barcode frames change their validation state * * @param validationResults the json string representation of the validation results */ onBarcodeValidationChanged: (validationResults: string) => void; /** * Listener on when the data source has changed * * @param connectorId the id of the data connector */ onDataSourceIdChanged: (connectorId?: Id) => void; /** * Listener on when injected data has changed * * @param variableId the id of the injected data source variable */ onInjectedDataChanged: (variableId: Id) => void; /** * Listener on document issues, if this changes, this listener will get triggered with the updates * @param documentIssues Stringified object of document issues */ onDocumentIssueListChanged: (documentIssues: string) => void; /** * Listener on engine editing mode, if this changes, this listener will get triggered with the updates * @param engineEditMode Stringified object of engine edit mode */ onEngineEditModeChanged: (engineEditMode: string) => void; /** * Listener on brand kit media, if this changes, this listener will get triggered with the updates * @param brandKitMedia Stringified array of BrandKitMedia objects */ onBrandKitMediaChanged: (brandKitMedia: string) => void; }