/** * Custom artwork item interface for artworkLibrary prop */ export interface CustomArtworkItem { name: string; url: string; thumbnail?: string; id?: string; } /** * Label configuration for UI text customization */ export interface LabelConfig { label?: string; tooltip?: string; icon?: string; // HTML string for icon } /** * Label configuration for customLabels prop */ export interface CustomLabelsConfig { artwork?: LabelConfig; colorOptions?: LabelConfig; artworkLibrary?: LabelConfig; } /** * Color option for a Dynamic AI Shop product */ export interface DynamicAiShopProductColor { /** Color display name */ name: string; /** Hex color value */ hex: string; } /** * Product configuration for Dynamic AI Shop */ export interface DynamicAiShopProduct { /** Unique product identifier */ id: string; /** Product display name */ name: string; /** Optional product description */ description?: string; /** Product price */ price: number; /** Optional discounted price (shows strikethrough on original) */ discountedPrice?: number; /** Optional available colors */ colors?: DynamicAiShopProductColor[]; /** Optional available sizes */ sizes?: string[]; /** Dynamic Mockups mockup UUID for rendering */ mockupUUID: string; /** Smart object UUID within the mockup template */ smartObjectUUID: string; /** Optional preview image URL */ previewImageUrl?: string; } /** * Configuration for Dynamic AI Shop editor type */ export interface DynamicAiShopConfig { /** Array of products to display in the shop */ products: DynamicAiShopProduct[]; } /** * Rendered product data returned in the add-to-cart callback */ export interface DynamicAiShopRenderedProduct { /** Product identifier */ productId: string; /** Product display name */ name: string; /** Product description */ description?: string; /** Product price */ price: number; /** Discounted price if applicable */ discountedPrice?: number; /** Available colors */ colors?: DynamicAiShopProductColor[]; /** Available sizes */ sizes?: string[]; /** Rendered product image URL */ imageUrl: string; } /** * Add-to-cart callback response from Dynamic AI Shop */ export interface DynamicAiShopAddToCartResponse { /** Event type identifier */ type: "DYNAMIC_AI_SHOP_ADD_TO_CART"; /** The product being added */ product: DynamicAiShopRenderedProduct; /** Selected color, or null if none */ selectedColor: DynamicAiShopProductColor | null; /** Selected size, or null if none */ selectedSize: string | null; /** Quantity selected */ quantity: number; /** URL of the AI-generated artwork */ aiGeneratedArtworkUrl: string; } /** * Session configuration for persisting user state across iframe reloads. */ export interface SessionDataConfig { /** * Whether to enable session persistence. */ enableSession?: boolean; /** * Session identifier for restoring a previously saved state. */ sessionId?: string; /** * Optional product identifier to associate with this session. */ productId?: string; /** * Optional shop identifier to associate with this session. */ shopId?: string; /** * Optional customer identifier to associate with this session. */ customerId?: string; /** * Optional arbitrary metadata to associate with this session. */ metaData?: Record; } /** * Interface representing data to send to the iframe. */ export interface IframeData { /** * Whether to show the collections widget in the UI. */ showCollectionsWidget?: boolean; /** * Whether to show the color picker in the UI. */ showColorPicker?: boolean; /** * Whether to display preset colors set for loaded template. */ showColorPresets?: boolean; /** * Restricts the user to one color per smart object. */ oneColorPerSmartObject?: boolean; /** * Theme appearance 'dark' or 'light'. If set, it overrides setting set by dashboard config. */ themeAppearance?: "dark" | "light"; /** * Theme 'default' or 'adjustments' */ theme?: "default" | "adjustments"; /** * Options for exporting mockups. */ mockupExportOptions?: { /** * The format of the exported image (e.g., "webp", "png" or "jpg"). */ image_format?: "webp" | "png" | "jpg"; /** * The size of the exported image in pixels. */ image_size?: number; /** * Rendered image URL type "download" or "view". The default is "download." */ mode?: "download" | "view"; }; /** * The URL of the design file to be used for every smart object. */ designUrl?: string; /** * If enabled, exporting a single mockup from a collection will automatically export all mockups in the collection, retaining the position and size of the design from the edited mockup. */ enableCollectionExport?: boolean; /** * Custom data fields as a JSON string (will be returned as is with callback data). */ customFields?: string; /** * A unique key to identify the website making the request. */ "x-website-key": string; /** * Session configuration for persisting user state across iframe reloads. */ sessionData?: SessionDataConfig; /** * Enables the export of print files. */ enableCreatePrintFiles?: boolean; /** * Displays color options. */ enableColorOptions?: boolean; /** * Enables the export of mockups. */ enableExportMockups?: boolean; /** * Displays smart object boundaries in the mockup editor. */ showSmartObjectArea?: boolean; /** * Export Mockups button text. */ exportMockupsButtonText?: string; /** * List of color presets, each with optional name and an array of hex colors. These presets appear in the colors popup and can be selected by the user. */ colorPresets?: { name?: string; autoApplyColors?: boolean; colors: { hex: string; name?: string; }[]; }[]; /** * Displays artwork transform controls, like width, height, rotate inputs. */ showTransformControls?: boolean; /** * Use array of template UUID's */ templates?: string[]; /** * Whether to show artwork library */ showArtworkLibrary?: boolean; /** * Custom artwork items for the artwork library */ artworkLibrary?: CustomArtworkItem[]; /** * Custom label configuration for UI text customization */ customLabels?: CustomLabelsConfig; /** * Whether to show "Upload your artwork" button */ showUploadYourArtwork?: boolean; /** * Whether to show artwork editor */ showArtworkEditor?: boolean; /** * Sets editor type. Default is classic. */ editorType?: "classic" | "mockanything" | "dynamicaishop"; /** * Options for mockanything editor type. */ mockanything?: { /** * Name of event listener used for parent-child iframe communication. */ eventListenerName: string; /** * Custom image url provided, instead of api generated approach. Used for custom iframe implementation via parameters. */ customModelImage: string; /** * Custom prompt provided, based on which an image will be generated. */ prompt: string; }; /** * Options for dynamicaishop editor type. */ dynamicaishop?: DynamicAiShopConfig; } /** * Response structure for iframe communication. */ export interface IframeResponse { /** * Array of mockup export data. */ mockupsExport?: { /** * Label for the exported mockup. */ export_label: string | null; /** * Path or URL to the exported mockup file. */ export_path: string; }[]; printFilesExport?: { /** * Label for the exported mockup. */ export_label: string | null; print_files: { /** * Path or URL to the exported print file. */ export_path: string; /** * Smart object UUID of print file. */ smart_object_uuid: string; /** * Smart object name of print file. */ smart_object_name: string; }[]; }; mockupsAndPrintFilesExport?: { mockupsExport: { /** * Label for the exported mockup. */ export_label: string | null; /** * Path or URL to the exported mockup file. */ export_path: string; }[]; printFilesExport: { /** * Label for the exported mockup. */ export_label: string | null; print_files: { /** * Path or URL to the exported print file. */ export_path: string; /** * Smart object UUID of print file. */ smart_object_uuid: string; /** * Smart object name of print file. */ smart_object_name: string; }[]; }; }; /** * Custom data fields as a string (optional). */ customFields?: string; /** * Array of artwork data (optional). */ artworks?: { /** * UUID of the smart object in the artwork. */ smartObjectUUID: string; /** * File representing the artwork (optional). */ file?: File; /** * URL of the artwork file (optional). */ url?: string; /** * Configuration data for the artwork's placement (optional). */ configData?: { /** * Width of the artwork in pixels. */ width: number; /** * Height of the artwork in pixels. */ height: number; /** * Rotation angle of the artwork in degrees. */ rotate: number; /** * Left offset of the artwork in pixels. */ left: number; /** * Top offset of the artwork in pixels. */ top: number; }; /** * Base64-encoded string representing the artwork file (optional). */ fileBase64?: string; }[]; } /** * Session ID event emitted by the iframe after session init. */ export interface DmSessionIdResponse { /** * The session ID created or restored by the iframe. */ dmSessionId: string; } /** * Parameters for initializing the iframe communication. */ export interface InitDynamicMockupsIframeParams { /** * The ID of the iframe element to target. */ iframeId: string; /** * The data to be sent to the iframe during initialization. */ data: IframeData; /** * The mode of operation for the iframe. * - `"download"`: Allows users to download the mockup. * - `"custom"`: Enables custom behavior within the iframe. */ mode: "download" | "custom"; /** * Optional callback function to handle responses from the iframe. * * @param response - The response data sent back from the iframe. */ callback?: ( response: IframeResponse | DynamicAiShopAddToCartResponse | DmSessionIdResponse, ) => void; } /** * Initializes iframe communication with the specified parameters. * @param params - The parameters for initializing the iframe. */ export declare const initDynamicMockupsIframe: ({ iframeId, data, mode, callback, }: InitDynamicMockupsIframeParams) => void;