UNPKG

@aurigma/design-editor-iframe

Version:

Using this module you can embed Design Editor (a part of Customer's Canvas) to your page through the IFrame API.

160 lines (158 loc) 4.67 kB
/** * Events supported in the Design Editor. * @remarks To subscribe to an event, use the {@link (Editor:class).subscribe|`subscribe()`} method. * @example The following snippet subscribes to the `BoundsNotification` and `PrintAreaBoundsChanged` events and outputs their arguments to the console. * ``` js * const editor = await CustomersCanvas.IframeApi.loadEditor(iframe, productDefinition); * editor.subscribe(CustomersCanvas.IframeApi.PostMessage.Events.BoundsNotification, (args) => { * console.log("BoundsNotification was triggered."); * console.log(JSON.stringify(args, null, 4)); * * editor.subscribe(CustomersCanvas.IframeApi.PostMessage.Events.PrintAreaBoundsChanged, (args) => { * console.log("PrintAreaBoundsChanged"); * console.log(args); * }); * ``` * @public */ export declare class Events { /** * Fires when the editor is opened in a modal window. */ static ModalOpen: string; /** * Fires when the editor is closed in a modal window. */ static ModalClose: string; /** * Fires when the editor is switched to the full window mode. */ static FullWindow: string; /** * Fires when the editor is switched to the full screen mode. */ static FullScreen: string; /** * Fires when the editor is switched to the original size mode. */ static OriginalSize: string; /** * Fires when the Image Manager opens. */ static AssetManagerOpened: string; /** * Fires when the Image Manager closes. */ static AssetManagerClosed: string; /** * Fires when a user reverts a product in the editor. */ static RevertProduct: string; /** * Fires when a user switches surfaces. */ static OnSurfaceChanged: string; /** * Fires when the Undo button gets enabled in the editor. */ static CanUndoChanged: string; /** * Fires when the Redo button gets enabled in the editor. */ static CanRedoChanged: string; /** * Fires when a user resizes images. */ static OnImageDpiChanged: string; /** * Fires when a dialog box opens. * * @deprecated Instead, subscribe to {@link Events.UIElementStateChange} with the `TextPopup` argument. */ static PopupOpen: string; /** * Fires when the size of a print area changes, for example, after using {@link Surface.setPrintAreas|`setPrintAreas()`}. */ static PrintAreaBoundsChanged: string; /** * Fires when a user clicks the Undo button. */ static UndoProduct: string; /** * Fires when a user clicks the Redo button. */ static RedoProduct: string; /** * Allows for {@link https://customerscanvas.com/dev/editors/iframe-api/howto/calculating-design-area.html|getting product measurements during customization}. */ static BoundsNotification: string; /** * Fires when the design element is changed in the editor. */ static ItemChanged: string; /** * Fires when a design element is added to the product. */ static ItemAdded: string; /** * Fires when a design element is removed from the product. */ static ItemRemoved: string; /** * Fires when a design element from the collection is changed in the editor. */ static SelectedItemsChanged: string; /** * Fires when `TextPopup`, `BottomToolbar.Zoom`, or `BottomToolbar.Settings` popups is opened or closed in the editor. {@link UIElementStateChangeEventArgs|Arguments of this event} look as follows: `{element: "BottomToolbar.Zoom", isOpen: true}`. */ static UIElementStateChange: string; /** * Fires when the custom button clicked. */ static CustomButtonClicked: string; } /** * @internal */ export interface IProcCallDescription { id: number; clientInstanceId: number; methodName: string; methodArgs: any[]; source: string; } /** * @internal */ export declare enum MessageType { Event = 0, ProcedureResponse = 1 } /** * @internal */ export interface IServerMessage { type: MessageType; source: string; } /** * @internal */ export interface IProcResponse { id: number; result: any; success: boolean; source: string; } /** * @internal */ export interface IServerEvent extends IServerMessage { event: string; result?: any[]; } export interface IMessage { procDescription: IProcCallDescription; callId: number; source: string; }