UNPKG

@3dsource/metabox-front-api

Version:

API for Metabox BASIC configurator

1,057 lines (1,026 loc) 35.8 kB
import { Observable } from 'rxjs'; type ApplicationDeviceTypes = 'deviceTypeAuto' | 'deviceTypeMobile' | 'deviceTypeDesktop'; type FromMetaboxApiAction = 'bridge' | 'appLoaded'; /** * @hidden * Preserved for backward compatibility. * @deprecated Use FromMetaboxApiAction type instead. * * Union type members: * - unrealFeatureBridge: @deprecated, use MetaBoxApiAction.Bridge with eventType: "unrealFeature" * - unrealCallback: @deprecated, use MetaBoxApiAction.Bridge with eventType: "unrealCallback" * - configuratorDataWithStateBridge: @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState" * - configuratorDataBridge: @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState" * - menuDataBridge: @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState" * - flatMenuDataBridge: @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState" * - fullScreenBridge: @deprecated, use Bridge with isFullscreen * - videoSize: @deprecated, use Bridge with streamResolution * - unrealResponse: Used in a platform, must be removed in future @deprecated * - getFastRender: @deprecated */ type FromMetaboxDeprecatedApiAction = 'unrealFeatureBridge' | 'unrealCallback' | 'configuratorDataWithStateBridge' | 'configuratorDataBridge' | 'menuDataBridge' | 'flatMenuDataBridge' | 'fullScreenBridge' | 'videoSize' | 'unrealResponse' | 'getFastRender'; declare const MetaboxBasicConfiguratorActions: { readonly loadLevel: "loadLevel"; readonly setEnvironmentMaterialById: "setEnvironmentMaterialById"; readonly setProduct: "setProduct"; readonly setMaterialById: "setMaterialById"; readonly getPdf: "getPdf"; readonly getScreenshot: "getScreenshot"; readonly getFastRender: "getFastRender"; readonly showEmbeddedMenu: "showEmbeddedMenu"; readonly forceSetDeviceType: "forceSetDeviceType"; readonly showOverlayInterface: "showOverlayInterface"; readonly resetCamera: "resetCamera"; readonly applyZoom: "applyZoom"; readonly initShowcase: "initShowcase"; readonly playShowcase: "playShowcase"; readonly pauseShowcase: "pauseShowcase"; readonly stopShowcase: "stopShowcase"; readonly sendCommandToUnreal: "sendCommandToUnreal"; readonly addResponse: "addResponse"; readonly watchCallbacks: "watchCallbacks"; }; type ToMetaBoxActions = (typeof MetaboxBasicConfiguratorActions)[keyof typeof MetaboxBasicConfiguratorActions]; /** * @internal * @hidden */ type ToMetaboxMessagePayload = ToMetaboxMessagePayloads[keyof ToMetaboxMessagePayloads]; /** * Interface for messages sent from the application to the Basic Metabox API. */ interface ToMetaboxMessagePayloads { [MetaboxBasicConfiguratorActions.getPdf]: void; [MetaboxBasicConfiguratorActions.loadLevel]: { id: string; }; [MetaboxBasicConfiguratorActions.setProduct]: { productId: string; }; /** * @deprecated * @hidden use * {@link MetaboxBasicConfiguratorActions.watchCallbacks} */ [MetaboxBasicConfiguratorActions.addResponse]: void; [MetaboxBasicConfiguratorActions.watchCallbacks]: void; [MetaboxBasicConfiguratorActions.getFastRender]: { format: MimeType; size?: { x: number; y: number; }; }; [MetaboxBasicConfiguratorActions.getScreenshot]: { format: MimeType; size?: { x: number; y: number; }; }; [MetaboxBasicConfiguratorActions.setMaterialById]: { slotId: string; materialId: string; }; [MetaboxBasicConfiguratorActions.setEnvironmentMaterialById]: { slotId: string; materialId: string; }; [MetaboxBasicConfiguratorActions.showEmbeddedMenu]: { visible: boolean; }; [MetaboxBasicConfiguratorActions.showOverlayInterface]: { visible: boolean; }; [MetaboxBasicConfiguratorActions.forceSetDeviceType]: { deviceType: ApplicationDeviceTypes; }; [MetaboxBasicConfiguratorActions.resetCamera]: void; [MetaboxBasicConfiguratorActions.applyZoom]: { zoom: number; }; [MetaboxBasicConfiguratorActions.initShowcase]: { productId: string; }; [MetaboxBasicConfiguratorActions.playShowcase]: void; [MetaboxBasicConfiguratorActions.pauseShowcase]: void; [MetaboxBasicConfiguratorActions.stopShowcase]: void; [MetaboxBasicConfiguratorActions.sendCommandToUnreal]: object; } interface ToMetaBoxMessageEnvelope { action: ToMetaBoxActions; payload?: ToMetaboxMessagePayload | never; } interface ToMetaBoxMessage { host: 'metaBoxHost'; payload: ToMetaBoxMessageEnvelope; } /** * Represents a basic configurator object with its configuration, selected materials, * product identifier, and associated environment with its materials. */ interface ConfiguratorEnvelope { /** * A reference to the universal configurator. */ configurator: UniversalConfigurator; /** * The unique product identifier. */ productId: string; /** * A record mapping product material selections. */ productMaterialsIds: SelectedIds; /** * @deprecated, * use `productMaterialsIds` instead. * @hidden */ selectedMaterials: SelectedIds; /** * The unique environment identifier. */ environmentId: string; /** * A record mapping environment material selections. */ environmentMaterialsIds: SelectedIds; } /** * Represents the universal configurator with its basic properties and components. */ interface UniversalConfigurator { /** Unique identifier for the configurator. */ id: string; /** Client information associated with the configurator. */ /** The name of the configurator. */ name: string; /** Label for the product collection. */ productCollectionLabel: string; /** A list of products for the configurator. */ products: UniversalConfiguratorProduct[]; /** A list of available environments. */ environments: UniversalConfiguratorEnvironment[]; /** The camera settings used in the configurator. */ /** Indicates if the configurator is active. */ isActive: boolean; /** GraphQL typename for the configurator. */ __typename: 'UniversalConfigurator'; } /** * Represents a product within the universal configurator. */ interface UniversalConfiguratorProduct { /** The product's unique identifier. */ productId: string; /** Position index of the product. */ position: number; /** Display label for the product. */ label: string; /** Optional camera settings for the product. */ /** The detailed product information. */ product: Product; /** GraphQL typename for the product. */ __typename: 'UniversalConfiguratorProduct'; } /** * Represents product details including visual assets and configuration. */ interface Product { /** The title of the product. */ title: string; /** List of thumbnails for the product. */ thumbnailList: Thumbnail[]; /** Available slots for the product. */ slots: Slot[]; /** List of metaProperties for the product (optional). */ metaProperties: MetaProperty[]; /** The model information associated with the product. */ /** Unique identifier for the product. */ id: string; /** Unique external id for the product. */ externalId: string; /** Showcase details for the product. */ showcase?: Showcase; /** GraphQL typename for the product. */ __typename: 'Product'; } /** * Represents a thumbnail image entity with dimensions and URL path. */ interface Thumbnail { /** Width of the thumbnail. */ width: number; /** Height of the thumbnail. */ height: number; /** URL path to the thumbnail image. */ urlPath: string; /** GraphQL typename (as a string, flexible type). */ __typename: 'Thumbnail'; } /** * Represents a slot within a product that may allow material customization. */ interface Slot { /** Unique identifier for the slot. */ id: string; /** Display a label for the slot. */ label: string; /** A list of enabled materials for the slot. */ enabledMaterials: Material[]; /** GraphQL typename for the slot. */ __typename: 'Slot'; } /** * Represents a metaProperty within a product that may allow business logic customization. */ interface MetaProperty { /** Unique identifier for the metaProperty. */ id: string; /** Display the name for the metaProperty. */ name: string; /** Value for the metaProperty. */ value: string; /** Type for the metaProperty. */ type: string; /** GraphQL typename for the metaProperty. */ __typename: 'MetaProperty'; } /** * Represents a material that can be applied to a product slot. */ interface Material { /** Unique identifier for the material. */ id: string; /** Title or name of the material. */ title: string; /** Unique external id for the material. */ externalId: string; /** List of thumbnails for the material. */ thumbnailList: Thumbnail[]; /** The model information associated with the material. */ /** GraphQL typename for the material. */ __typename: 'Material'; } /** * Details showcase the presentation of a product. */ interface Showcase { /** A list of low-bandwidth versions for the showcase (optional). */ lowBandwidth?: (Timecode | null)[] | null; /** Duration for the showcase (optional). */ duration?: number; /** GraphQL typename for the showcase. */ __typename: 'Showcase'; } /** * Represents a low-bandwidth entity used in showcases in LBM mode. */ interface Timecode { /** Time marker for the entity. */ time: number; /** Duration of the entity display. */ duration: number; /** GraphQL typename (as a string, flexible type). */ __typename: 'Timecode'; } /** * Represents the environment settings for a universal configurator. */ interface UniversalConfiguratorEnvironment { /** Unique identifier for the environment. */ environmentId: string; /** Position index of the environment. */ position: number; /** Display label for the environment. */ label: string; /** Detailed environment configuration. */ environment: Environment; /** GraphQL typename for the environment. */ __typename: 'UniversalConfiguratorEnvironment'; } /** * Represents an environment with associated media and configuration. */ interface Environment { /** Unique identifier for the environment. */ id: string; /** Title or name of the environment. */ title: string; /** Flag indicating if UDS is enabled. */ udsEnabled: boolean; /** The north yaw of the sun in the environment. */ sunNorthYaw: number; /** The UDS hour setting for the environment. */ udsHour: number; /** GraphQL typename for the environment. */ __typename: 'Environment'; /** List of thumbnails for the environment (optional). */ thumbnailList: Thumbnail[]; /** List of slots for the environment (optional). */ slots: Slot[]; } /** * Defines the structure for a mapping of selected materials. */ type SelectedIds = Record<string, Record<string, string>>; /** * Defines the structure for an available showcase status for the current product on a scene. */ type ShowCaseStatus = 'init' | 'play' | 'pause' | 'stop'; /** * Defines the structure for a video resolution. */ interface VideoResolution { width: number | null; height: number | null; } interface FromMetaboxMessagePayloads { /** * @hidden * @deprecated use {@link FromMetaboxMessagePayloads.configuratorDataUpdated} */ configuratorData: ConfiguratorEnvelope; /** * @hidden * @deprecated use {@link FromMetaboxMessagePayloads.configuratorDataUpdated} */ basicConfiguratorDataWithState: ConfiguratorEnvelope; /** * Dispatches Every time the configurator data is updated. * I.e., when the user changes the configuration. (Material, Product, Environment) */ configuratorDataUpdated: ConfiguratorEnvelope; /** * Dispatches Every time when the configurator connected/disconnected with Unreal Engine. */ dataChannelConnected: boolean; /** * Dispatches Every time when the Unreal Viewport is visible/hidden. */ viewportReady: boolean; /** * Dispatches at the moment while the configurator loads. Shows status information.. */ showcaseStatusChanged: ShowCaseStatus; /** * @hidden * @deprecated * Dispatches Every when user toggles fullscreen button in an internal menu. */ isFullScreen: boolean; /** * @hidden * @deprecated use {@link FromMetaboxMessagePayloads.statusMessageChanged} * Dispatches at the moment while the configurator loads. Shows status information. */ statusMessage: string | null; /** * Dispatches at the moment while the configurator loads. Shows status information. */ statusMessageChanged: string | null; /** * @hidden * @deprecated * Dispatches every time when the freeze-frame is arrived or updated. */ freezeFrame: { dataUrl: string | null; progress: number | null; }; /** * Dispatches every time when Unreal is sending ordered render with new GetScreenshot() command. */ screenshotReady: string | null; /** * @hidden * @deprecated use {@link FromMetaboxMessagePayloads.screenshotReady} * Dispatches every time when Unreal is sending ordered render with new GetScreenshot() command. */ screenshot: string | null; /** * @hidden * @deprecated, use {@link FromMetaboxMessagePayloads.screenshotReady} */ getScreenshot: string | null; /** * @hidden * @deprecated, use {@link FromMetaboxMessagePayloads.screenshotReady} */ fastRender: string | null; /** * @hidden * @deprecated, use {@link FromMetaboxMessagePayloads.screenshotReady} */ getFastRender: string | null; /** * @internal * @experimental * Dispatches every Unreal is sending a command callback. * Works only after the new WatchCallbacks () command is sent. * !!! WARNING use at your own risk. We don't guarantee right behavior * */ unrealCallback: { json: object; }; /** * @hidden * @internal * @experimental * Dispatches every Unreal state is changing, including all unreal module current state. * !!! WARNING use at your own risk. We don't guarantee right behavior */ unrealState: object; /** * @hidden * @internal * @deprecated, use {@link FromMetaboxMessagePayloads.unrealState} */ unrealFeature: object; /** * Dispatches every time when Unreal is changing its video stream size. */ videoResolutionChanged: VideoResolution; /** * @hidden * @deprecated, use ${@link FromMetaboxMessagePayloads.videoResolutionChanged } */ videoResolution: VideoResolution; /** * @hidden * @deprecated, use ${@link FromMetaboxMessagePayloads.videoResolutionChanged } */ streamResolution: VideoResolution; } /** * @hidden */ type FromMetaBoxApiEvents = keyof FromMetaboxMessagePayloads; /** * @internal * This creates all event envelopes defined in MetaBoxAPIPayloads. */ interface MetaBoxApiEnvelope<T extends FromMetaBoxApiEvents> { action: 'bridge'; eventType: T; payload: FromMetaboxMessagePayloads[T]; } /** * @hidden * @internal * Used for signaling that the app is loaded and ready to open api. */ interface MCAppLoaded { action: 'appLoaded'; eventType?: unknown; payload?: unknown; } /** * @hidden * Preserved for backward compatibility. * @deprecated * Used for sending deprecated messages, must be removed in the future. */ interface DeprecatedEnvelope { action: FromMetaboxDeprecatedApiAction | FromMetaboxApiAction; eventType?: unknown; payload?: unknown; } /** * @internal * @hidden * This creates a union of all event envelopes defined in MetaBoxAPIPayloads. */ type FromMetaBoxAPIEnvelope = { [K in keyof FromMetaboxMessagePayloads]: MetaBoxApiEnvelope<K>; }[keyof FromMetaboxMessagePayloads] | MCAppLoaded | DeprecatedEnvelope; interface FromMetaBoxMessage { host: 'metabox'; /** * @hidden * Preserved for backward compatibility. * @deprecated, use `envelope` instead. */ payload?: FromMetaBoxAPIEnvelope; envelope: FromMetaBoxAPIEnvelope; } /** * Base class for commands sent to the Metabox API. */ declare class CommandBase { data: ToMetaBoxMessageEnvelope; } /** * Represents a callback listener for specific message types. * Used internally by EventDispatcher to store event listeners. * * @public */ interface Listener { /** The message type this listener is registered for */ messageType: string; /** The callback function to execute when a message of the specified type is received */ callback: (data: unknown) => void; } /** * EventDispatcher is a class that manages event listeners and dispatches events to them. */ declare class EventDispatcher { /** * Storage for callback listeners by message type. */ listeners: Listener[]; destroy(): void; /** * Adds an event listener for receiving specific types of messages. * * @param messageType - The message type to listen for. * @param callback - The callback function to execute when a message is received. */ addEventListener(messageType: string, callback: (data: unknown) => void): this; /** * Dispatches an event to all listeners of a specific message type. * * @param messageType - The message type. * @param data - The data associated with the event. */ dispatchEvent(messageType: string, data: unknown): this; /** * Removes an event listener for a specific type of message. * * @param messageType - The message type. * @param callback - The callback function to remove. */ removeEventListener(messageType: string, callback: (data: unknown) => void): this; } /** * Handles messaging between the host page and embedded Metabox content. * @internal Use {@link Communicator.createInstance} or the {@link integrateMetaBox} helper to instantiate. */ declare class Communicator extends EventDispatcher { /** * Singleton reference to the current communicator instance. */ static instance: Communicator | null; /** * Bound handler for incoming postMessage events. */ private binder; /** * Constructs a Communicator, replacing any existing instance, and begins listening for messages. * @internal */ constructor(); /** * Listens for Metabox to signal readiness, then initializes communicator. * @param apiReadyCallback - Called with the new Communicator once to the Metabox is loaded. */ static createInstance(apiReadyCallback: (api: Communicator) => void): void; /** * Cleans up resources and stops listening for messages. */ destroy(): void; /** * Posts a command to the Metabox iframe. * @param command - An action command containing data to send. */ sendCommandToMetaBox<T extends CommandBase>(command: T): void; /** * Registers an event listener for messages dispatched by to the Metabox. * @override */ addEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this; /** * Dispatches a typed event to all registered listeners. * @override */ dispatchEvent<T extends FromMetaBoxApiEvents>(messageType: T, data: FromMetaboxMessagePayloads[T]): this; /** * Removes a previously registered event listener. * @override */ removeEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this; /** * Filters and dispatches incoming messages from to the Metabox. * @param {FromMetaBoxApiEvents | 'metaboxData' } messageType - Expected message type for filtering ('metaboxData'). * @param {MessageEvent} event - The postMessage event received on a window. */ private handleMessageReceived; } /** * Integrates Metabox Basic Configurator into the provided layout. * * @remarks * This function injects an iframe into a specified container element in the DOM and initializes * the communicator for interacting with the Metabox embedded content. * * @param {string} iframeSrc - The source URL of the Metabox iframe. * Additional url parameters: * ```javascript * sidebar=false - disables the internal Metabox menu * introImage=https://example.com/image.png - sets the intro image * ``` * i.e., a final link will look like https://metabox.3dsource.com/metabox-configurator/basic/your-configurator-id?sidebar=false&introImage=https://example.com/image.png * * @param {string} containerId - The ID of the layout element. Defaults to 'embed3DSource'. * @param apiReadyCallback * @throws Error if the container element with the specified ID is not found. * * @example * import { * integrateMetaBox, * } from '@3dsource/metabox-front-api'; * * integrateMetaBox( * 'https://metabox.3dsource.com/metabox-configurator/basic/12345678-1234-1234-1234-01234567890?introImage=https://example.com/intro.webp&sidebar=false', * 'embed3DSource' * ); */ declare function integrateMetaBox(iframeSrc: string, containerId: string | undefined, apiReadyCallback: (api: Communicator) => void): void; /** * Saves an image by triggering a download. * * @remarks * This function creates an anchor element, sets its `href` attribute to the provided image URL, * and triggers a click event to initiate a download with the specified filename. * * @param {string} imageUrl - The URL of the image to save. * @param {string} filename - The name of the file to save. */ declare function saveImage(imageUrl: string, filename: string): void; /** * Sets the URL parameters based on the provided state. * * @remarks * This function updates the current URL by replacing its search parameters with the key-value pairs from the provided state object. * * @param {Record<string, string>} state - An object containing key-value pairs to set as URL parameters. */ declare function setUrlParams(state: Record<string, string>): void; /** * Retrieves the URL parameters as an object. * * @remarks * This function parses the current URL's search parameters and returns them as a key-value object. * * @returns An object containing the URL parameters. */ declare function getUrlParams(): Record<string, string>; /** * Wrapper helper function to use it with rxJs the same as `fromEvent` to listen to events from the Communicator. * @param {Communicator} target * @param eventName */ declare function fromCommunicatorEvent<T extends FromMetaBoxApiEvents>(target: Communicator, eventName: T): Observable<FromMetaboxMessagePayloads[T]>; /** * Represents a command to get a PDF from Metabox. * @remarks * This class sends a message to the Metabox API to generate a PDF based on the current configuration. * This action does not require any parameters. * * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed. * * @example * import { GetPdf, Communicator } from '@3dsource/metabox-front-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetaBox(new GetPdf()); * }; */ declare class GetPdf extends CommandBase { /** * Creates an instance of GetPdf. * * @remarks * This constructor does not require any parameters. */ constructor(); } /** * Image format. * @remarks * This type represents the allowed image formats. */ type MimeType = 'image/png' | 'image/jpeg' | 'image/webp'; /** * Represents a command to get a screenshot. * * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed. * * @example * import { GetScreenshot, Communicator, saveImage } from '@3dsource/metabox-front-api'; * window.env3DSource.apiReady = (api: Communicator) => { * // Listen for events from to the Metabox API * api.addEventListener('screenshot', (data) => { * // Process the get screenshot response * saveImage(data, 'Render.png'); * }); * api.sendCommandToMetaBox(new GetScreenshot('image/png', { x: 1024, y: 1024 })); * }; */ declare class GetScreenshot extends CommandBase { /** * Constructs an instance of GetScreenshot. * @param {MimeType} mimeType - The output format. * @param {{ x: number; y: number }} [size] - Optional size in pixels. */ constructor(mimeType: MimeType, size?: { x: number; y: number; }); } declare const GetFastRender: typeof GetScreenshot; /** * Represents a command to send to unreal and reset camera to initial. * @remarks * This class sends a message to the Metabox API to reset the camera on a scene. * This action does not require any parameters. * * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed. * * @example * import { ResetCamera, Communicator } from '@3dsource/metabox-front-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetaBox(new ResetCamera()); * }; */ declare class ResetCamera extends CommandBase { /** * Creates an instance of ResetCamera. * * @remarks * This constructor does not require any parameters. */ constructor(); } /** * Represents a command to ApplyZoom and change zoom camera on a scene. * @remarks * This class sends a command to the Metabox API to change zoom on a scene. * * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed. * * @example * import { ApplyZoom, Communicator } from '@3dsource/metabox-front-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetaBox(new ApplyZoom(10)); * api.sendCommandToMetaBox(new ApplyZoom(-10)); * }; */ declare class ApplyZoom extends CommandBase { /** * Creates an instance of ApplyZoom. * * @param {...number} zoom */ constructor(zoom: number); } /** * Represents a command to Init Showcase for a product a scene and start a sequence for the product. * @remarks * This class sends a command to the Metabox API to init showcase if the product has a sequence. * For check this needs to find a showcase property in current product * If this property exist you can send init showcase command * @internal Use {@link ModularConfiguratorComponent.product.showcase} * * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed. * * @example * import { InitShowcase, Communicator } from '@3dsource/metabox-front-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetaBox(new InitShowcase('ffea6b5c-3a8a-4f56-9417-e605acb5cca3'); * }; */ declare class InitShowcase extends CommandBase { /** * Creates an instance of InitShowcase. * * @param {string} productId */ constructor(productId: string); } /** * Represents a command to Play Showcase for a product when it already init, and you call pause, for example, before it. * @remarks * This class sends a command to the Metabox API to play showcase for a product if it is already initialized and pause. * * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed. * * @example * import { PlayShowcase, Communicator } from '@3dsource/metabox-front-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetaBox(new PlayShowcase()); * }; */ declare class PlayShowcase extends CommandBase { /** * Creates an instance of PlayShowcase. * * @remarks * This constructor does not require any parameters. */ constructor(); } /** * @internal * @hidden * Represents a command to send Unreal command. */ declare class UnrealCommand extends CommandBase { constructor(payload: object); } /** * Represents a command to Pause Showcase for a product when it already init and play, and you call pause. * @remarks * This class sends a command to the Metabox API to pause showcase for a product if it is already initialized and play. * * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed. * * @example * import { PauseShowcase, Communicator } from '@3dsource/metabox-front-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetaBox(new PauseShowcase()); * }; */ declare class PauseShowcase extends CommandBase { /** * Creates an instance of PauseShowcase. * * @remarks * This constructor does not require any parameters. */ constructor(); } /** * Represents a command to Stop Showcase for a product when it already init, and you want to destroy it. * @remarks * This class sends a command to the Metabox API to Stop showcase for a product if it is already initialized. * * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed. * * @example * import { StopShowcase, Communicator } from '@3dsource/metabox-front-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetaBox(new StopShowcase()); * }; */ declare class StopShowcase extends CommandBase { /** * Creates an instance of StopShowcase. * * @remarks * This constructor does not require any parameters. */ constructor(); } /** * Represents a command to set a product by its ID. * * @remarks * This action sends a message to the Metabox API to set a product using the provided product ID. * * @example * import { SetProduct, Communicator } from '@3dsource/metabox-front-api'; * * //...Assume that the integration is already implemented * window.env3DSource.apiReady = (api: Communicator) => { * api.setCommandToMetaBox(new SetProduct( * 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3' * )); * }; */ declare class SetProduct extends CommandBase { /** * Creates an instance of SetProduct. * * @param {string} productId - The product ID. */ constructor(productId: string); } /** * Represents a command to set a material by its slot ID and Material ID. * * @example * import { SetMaterial, Communicator } from '@3dsource/metabox-front-api'; * * //...Assume that the integration is already implemented * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetaBox(new SetMaterial( * 'carpaint', * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91', * )); * }; */ declare class SetMaterial extends CommandBase { /** * Creates an instance of SetMaterial. * * @param {string} slotId - The slot ID. * @param {string} materialId - The material ID. */ constructor(slotId: string, materialId: string); } /** * Represents a command to set the environment by its ID. * * @example * import { SetEnvironment, Communicator } from '@3dsource/metabox-front-api'; * * //...Assume that the integration is already implemented * window.env3DSource.apiReady = (api: Communicator) => { * // Change the environment to '55555555-1234-1234-1234-01234567890' * api.sendCommandToMetaBox(new SetEnvironment('55555555-1234-1234-1234-01234567890')); * }; */ declare class SetEnvironment extends CommandBase { /** * Creates an instance of SetEnvironment. * * @param {string} environmentId - The environment ID. */ constructor(environmentId: string); } /** * Represents a command to set an environment material by its slot ID and Material ID. * * @example * import { SetEnvironmentMaterial, Communicator } from '@3dsource/metabox-front-api'; * * //...Assume that the integration is already implemented * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetaBox(new SetEnvironmentMaterial( * 'carpaint', * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91', * )); * }; */ declare class SetEnvironmentMaterial extends CommandBase { /** * Creates an instance of SetEnvironmentMaterial. * * @param {string} slotId - The slot ID. * @param {string} materialId - The material ID. */ constructor(slotId: string, materialId: string); } /** * Represents a command to toggle the Embedded to the Metabox Menu. * * @example * import { ShowEmbeddedMenu, Communicator } from '@3dsource/metabox-front-api'; * * //...Assume that the integration is already implemented * window.env3DSource.apiReady = (api: Communicator) => { * api.setCommandToMetaBox(new ShowEmbeddedMenu(true)); * }; */ declare class ShowEmbeddedMenu extends CommandBase { /** * Creates an instance of ShowEmbeddedMenu. * * @param {boolean} visible - A flag indicating whether the embedded menu should be visible. */ constructor(visible: boolean); } /** * Represents a command to toggle the Unreal Overlay Interface Menu. * * @remarks * This action sends a message to the Metabox API to toggle the visibility of the Unreal overlay UI. * * @example * import { ShowOverlayInterface, Communicator } from '@3dsource/metabox-front-api'; * * //...Assume that the integration is already implemented * window.env3DSource.apiReady = (api: Communicator) => { * api.setCommandToMetaBox(new ShowOverlayInterface(true)); * }; */ declare class ShowOverlayInterface extends CommandBase { /** * Creates an instance of ShowOverlayInterface. * * @param {boolean} visible - A flag indicating whether the Unreal overlay UI should be visible. */ constructor(visible: boolean); } /** * @experimental * @internal * @hidden * @remarks * Represents a command to watch Unreal callbacks from Unreal engine. * Can be useful for custom solutions. */ declare class WatchCallbacks extends CommandBase { /** * Creates an instance of WatchCallbacks. * * @remarks * This constructor does not require any parameters. */ constructor(); } export { ApplyZoom, CommandBase, Communicator, EventDispatcher, GetFastRender, GetPdf, GetScreenshot, InitShowcase, MetaboxBasicConfiguratorActions, PauseShowcase, PlayShowcase, ResetCamera, SetEnvironment, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, ShowOverlayInterface, StopShowcase, UnrealCommand, WatchCallbacks, fromCommunicatorEvent, getUrlParams, integrateMetaBox, saveImage, setUrlParams }; export type { ApplicationDeviceTypes, ConfiguratorEnvelope, DeprecatedEnvelope, Environment, FromMetaBoxAPIEnvelope, FromMetaBoxApiEvents, FromMetaBoxMessage, FromMetaboxApiAction, FromMetaboxDeprecatedApiAction, FromMetaboxMessagePayloads, Listener, MCAppLoaded, Material, MetaBoxApiEnvelope, MetaProperty, MimeType, Product, SelectedIds, ShowCaseStatus, Slot, Thumbnail, ToMetaBoxActions, ToMetaBoxMessage, ToMetaBoxMessageEnvelope, ToMetaboxMessagePayload, ToMetaboxMessagePayloads, UniversalConfigurator, UniversalConfiguratorEnvironment, UniversalConfiguratorProduct, VideoResolution };