@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.
129 lines (128 loc) • 5.05 kB
JavaScript
import { GlobalEvents } from "../GlobalEvents";
/**
* 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
*/
var Events = /** @class */ (function () {
function Events() {
}
// ReSharper disable InconsistentNaming
/**
* Fires when the editor is opened in a modal window.
*/
Events.ModalOpen = GlobalEvents[GlobalEvents.ModalOpen];
/**
* Fires when the editor is closed in a modal window.
*/
Events.ModalClose = GlobalEvents[GlobalEvents.ModalClose];
/**
* Fires when the editor is switched to the full window mode.
*/
Events.FullWindow = GlobalEvents[GlobalEvents.FullWindow];
/**
* Fires when the editor is switched to the full screen mode.
*/
Events.FullScreen = GlobalEvents[GlobalEvents.FullScreen];
/**
* Fires when the editor is switched to the original size mode.
*/
Events.OriginalSize = GlobalEvents[GlobalEvents.OriginalSize];
/**
* Fires when the Image Manager opens.
*/
Events.AssetManagerOpened = GlobalEvents[GlobalEvents.AssetManagerOpened];
/**
* Fires when the Image Manager closes.
*/
Events.AssetManagerClosed = GlobalEvents[GlobalEvents.AssetManagerClosed];
/**
* Fires when a user reverts a product in the editor.
*/
Events.RevertProduct = GlobalEvents[GlobalEvents.RevertProduct];
/**
* Fires when a user switches surfaces.
*/
Events.OnSurfaceChanged = GlobalEvents[GlobalEvents.OnSurfaceChanged];
/**
* Fires when the Undo button gets enabled in the editor.
*/
Events.CanUndoChanged = GlobalEvents[GlobalEvents.CanUndoChanged];
/**
* Fires when the Redo button gets enabled in the editor.
*/
Events.CanRedoChanged = GlobalEvents[GlobalEvents.CanRedoChanged];
/**
* Fires when a user resizes images.
*/
Events.OnImageDpiChanged = GlobalEvents[GlobalEvents.OnImageDpiChanged];
/**
* Fires when a dialog box opens.
*
* @deprecated Instead, subscribe to {@link Events.UIElementStateChange} with the `TextPopup` argument.
*/
Events.PopupOpen = GlobalEvents[GlobalEvents.PopupOpen];
/**
* Fires when the size of a print area changes, for example, after using {@link Surface.setPrintAreas|`setPrintAreas()`}.
*/
Events.PrintAreaBoundsChanged = GlobalEvents[GlobalEvents.PrintAreaBoundsChanged];
/**
* Fires when a user clicks the Undo button.
*/
Events.UndoProduct = GlobalEvents[GlobalEvents.UndoProduct];
/**
* Fires when a user clicks the Redo button.
*/
Events.RedoProduct = GlobalEvents[GlobalEvents.RedoProduct];
/**
* Allows for {@link https://customerscanvas.com/dev/editors/iframe-api/howto/calculating-design-area.html|getting product measurements during customization}.
*/
Events.BoundsNotification = "BoundsNotification";
/**
* Fires when the design element is changed in the editor.
*/
Events.ItemChanged = "ItemChanged";
/**
* Fires when a design element is added to the product.
*/
Events.ItemAdded = "ItemAdded";
/**
* Fires when a design element is removed from the product.
*/
Events.ItemRemoved = "ItemRemoved";
/**
* Fires when a design element from the collection is changed in the editor.
*/
Events.SelectedItemsChanged = "SelectedItemsChanged";
/**
* 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}`.
*/
Events.UIElementStateChange = GlobalEvents[GlobalEvents.UIElementStateChange];
/**
* Fires when the custom button clicked.
*/
Events.CustomButtonClicked = GlobalEvents[GlobalEvents.CustomButtonClicked];
return Events;
}());
export { Events };
/**
* @internal
*/
export var MessageType;
(function (MessageType) {
MessageType[MessageType["Event"] = 0] = "Event";
MessageType[MessageType["ProcedureResponse"] = 1] = "ProcedureResponse";
})(MessageType || (MessageType = {}));
//# sourceMappingURL=RpcTypes.js.map