import type { TryOnResponse, TryOnStatus, FitAreaInfo, SavedTryOnResultResponse, SizingResult } from "./types"; export type StyleMatchSlot = "top" | "bottom" | "dress" | "outerwear" | "shoe" | "bag" | "accessory"; export interface StyleMatchSelection { slot?: StyleMatchSlot | string; productId?: string; title: string; image: string; /** Clean transparent cutout prepared for both presentation and virtual * try-on. When present, the SDK promotes it over the original product image. */ displayImage?: string; url?: string; color?: string; garmentType?: string; recommendedSize?: string; } export interface TryOnContext { /** Storefront product the customer is currently viewing — shown in analytics. */ productId?: string; productTitle?: string; productCategory?: string; productSubcategory?: string; productFitType?: string; productType?: string; productTags?: string[]; /** Free-text product description forwarded to the try-on prompt so Gemini * knows the garment context (e.g. "Brown slip maxi dress, spaghetti straps"). */ productDescription?: string; /** Material / fabric composition (e.g. "100% Cotton", "60% Polyester / 40% Polyester") * — forwarded to the prompt so Gemini drapes the fabric correctly without * having to guess from the image alone. */ productMaterial?: string; /** Optional clean product/detail image. The backend sends it to Gemini as an * additional design reference while `garmentImage` remains the worn/model * styling reference. */ garmentDetailImage?: string; /** Optional silhouette-prompt context forwarded to the backend Gemini try-on * call. Enables doc-example-grade fit reasoning ("X tension at button * because waist 54.4 exceeds size 50 drop"). All fields optional. */ silhouetteContext?: { recommendedSize?: string; recommendedSizeMeasurements?: string; /** @deprecated Full size guides are no longer forwarded to try-on prompts. */ sizeChartSummary?: string; userMeasurementsText?: string; userHeight?: string; userWeight?: string; }; /** True when `modelImage` is a previous try-on result rather than the * user's raw photo. Switches the backend to an edit-mode prompt that * preserves accessories (socks, ties, pocket squares, cufflinks, shoes) * the prior call already painted, instead of re-deriving them. */ editFromPrevious?: boolean; /** Backend-cached photo id from a previous /tryon response. When provided * the SDK may pass an empty `modelImage` (or omit it) and the backend * will use the cached photo. Saves uploading 700–900 KB on every regen * AND guarantees byte-identical photo across regens (no JPEG-recompression * drift). On cache miss the SDK should fall back to sending the full image. */ modelImageId?: string; /** Per-modal-open id used to find the exact SDK interaction in Clarity. */ sdkOpenId?: string; profileLoggedIn?: boolean; profileId?: string; profileName?: string; sizingResult?: SizingResult | null; styleMatchSelections?: StyleMatchSelection[]; } export type TryOnCategory = "apparel" | "shoe" | "bag" | "hat" | "sunglasses" | "earring" | "necklace" | "bracelet" | "ring" | "belt" | "watch" | "accessory"; export interface TryOnFeedbackInput { jobId?: string; historyEntryId?: string; rating?: number; note?: string; productId?: string; productTitle?: string; productUrl?: string; recommendedSize?: string; profileLoggedIn?: boolean; profileId?: string; profileName?: string; profileAccessToken?: string; } export type SdkBehaviorEventType = "PRODUCT_VIEW" | "SDK_OPENED" | "PHOTO_UPLOADED" | "SIZING_STARTED" | "SIZING_FAILED" | "SIZE_RECOMMENDATION_SHOWN" | "SIZE_RECOMMENDATION_ACCEPTED" | "ADD_TO_CART_FROM_TRYON" | "SDK_CLIENT_ERROR" | "SDK_PROFILE_CREATED" | "SDK_PROFILE_UPDATED" | "SDK_PROFILE_SELECTED"; export interface SdkBehaviorEventInput { eventType: SdkBehaviorEventType; sdkOpenId?: string; productId?: string; productTitle?: string; productUrl?: string; jobId?: string; recommendedSize?: string; profileLoggedIn?: boolean; profileId?: string; profileName?: string; profileOrigin?: string; metadata?: Record; } export interface SdkClientErrorInput { message: string; code?: string; stack?: string; component?: string; view?: string; severity?: "low" | "medium" | "high" | "critical"; productId?: string; productTitle?: string; productUrl?: string; jobId?: string; metadata?: Record; } export interface StyleMatchRequestProduct { productId?: string; title?: string; image?: string; images?: string[]; url?: string; category?: string; subcategory?: string; type?: string; fitType?: string; gender?: string; vendor?: string; tags?: string[]; description?: string; material?: string; color?: string; colorHex?: string; variants?: unknown[]; } export interface StyleMatchRequestProfile { gender?: string; recommendedSize?: string; measurements?: Record; } export interface StyleMatchRequest { product: StyleMatchRequestProduct; profile?: StyleMatchRequestProfile; modelImageId?: string; personImage?: string; limitOutfits?: number; optionsPerSlot?: number; } export interface StyleMatchItem { slot: StyleMatchSlot; productId: string; title: string; image: string; url?: string; color: string; garmentType: string; recommendedSize: string; availability: "InStock" | "LowStock" | "OutOfStock"; selected: boolean; score: number; alternatives: Array & { selected: false; }>; } export interface StyleMatchOutfit { id: string; label: string; score: number; items: StyleMatchItem[]; } export interface StyleMatchResponse { source: "rag" | "openai_rag" | "catalog-fallback" | "empty" | "disabled" | "person_image_required"; enabled?: boolean; disabledReason?: "global_disabled" | "store_disabled"; errorCode?: string; anchor: StyleMatchRequestProduct & { slot?: string | null; }; outfits: StyleMatchOutfit[]; } export declare class ApiClient { private apiKey?; private baseUrl; constructor(apiKey?: string, apiUrl?: string); private get headers(); submitTryOn(modelImage: string, garmentImage: string, fitInfo?: FitAreaInfo[], category?: TryOnCategory, context?: TryOnContext): Promise; getSavedTryOnResult(input: { productId: string; }): Promise; getStyleMatchAvailability(): Promise<{ enabled: boolean; globalEnabled: boolean; storeEnabled: boolean; disabledReason: "global_disabled" | "store_disabled" | null; }>; getStyleMatches(input: StyleMatchRequest): Promise; removeGarmentBackground(imageUrl: string): Promise; getStatus(jobId: string): Promise; submitTryOnFeedback(input: TryOnFeedbackInput): Promise<{ ok: true; }>; reportEvent(input: SdkBehaviorEventInput): Promise<{ ok: true; }>; reportClientError(input: SdkClientErrorInput): Promise<{ ok: true; }>; getStreamUrl(jobId?: string): string; } export declare function jsonHeaders(apiKey?: string): Record; export declare class PrimeStyleError extends Error { code: string; details?: unknown; constructor(message: string, code: string, details?: unknown); }