trillion-widget
Version:
Trillion AR Widget
208 lines (207 loc) • 7.45 kB
TypeScript
import { FingerName } from './modules/AR';
import { JewelryTypeName } from '../../trillion-common/src/typings/jewelry-type';
import { TWidgetMode, CustomLoaderType } from '@/modules/TrillionWidget';
import { TCarouselMode } from './modules/TrillionWidget/types/carousel-mode';
import { ConfiguratorType } from '@/modules/AR/types/configuratorType';
import { OnWidgetConfigSaved } from 'trillion-viewer/src/viewer/types/on-widget-config-saved';
export declare class TrillionWidgetApp {
private _root;
private _widgetMode;
private _carouselMode;
private _jewelryId;
private _carousel;
private _jewelryType;
private _excludedFingers;
private _isUsePerformanceCheck;
private _isGUIEnabled;
private _annotationEnabled;
private _sandboxEnabled;
private _controls3DEnabled;
private _videoUrl;
private _disableLogo;
private _favoritesList;
private _onFavoritesChange;
private _sharingBackgroundUrl;
private _dataAcquisitionFormUrl;
private _language;
private _customCDNUrl;
private _staticConfigsUrl;
private _dynamicBrightnessEnabled;
private _fingerBorderEstimationEnabled;
private _customLoader;
private _isDataCollectFormBeforeTryOnEnabled;
private _customBackendUrl;
private _posteffectsConfigJson;
private _serviceActivationKey;
private _disableShadowRoot;
private _cancelMirroring;
private _onWidgetConfigSaved;
private _configurator;
private _useExternalUi;
/**
* Create widget on the provided HTML element
* @param entryElem - HTMLElement that the widget will be loaded into
*/
init(entryElem: HTMLElement): void;
/**
* Set widget mode
* 1. Basic - any jewelry type, no selectors or any additional UI (only screenshot button). JewelryId field is optional.
* 2. Ring Carousel - only rings, one hand, one ring, selector for many SKUs. Possibility to switch jewelry in runtime. Carousel field is required.
* 3. Two hands - only rings, two hands, up to 10 rings, selector for many SKUs. Possibility to switch jewelry for each hand and finger. Carousel field is required.
* @param mode - widget mode
*/
setWidgetMode(mode: TWidgetMode): void;
/**
* Get current widget mode
*/
getWidgetMode(): TWidgetMode;
/**
* Set carousel mode (used when widget mode Ring Carousel or Two hands)
*/
setCarouselMode(mode: TCarouselMode): void;
/**
* Get current carousel mode
*/
getCarouselMode(): TWidgetMode;
/**
* Set the id(SKU) of the jewelry to load
* @param sku - Stock keeping unit
*/
setJewelryID(sku: string | null): void;
/**
* Get the id(SKU) of the uploaded jewelry
*/
getJewelryID(): string | null;
/**
* Set array of sku ids for jewelry carousel
* @param ids - array of sku
*/
setCarousel(ids: Array<string> | null): void;
getCarousel(): Array<string> | null;
/**
* Set the jewelry type (earrings, ring, necklace) to load
* @param type
* @deprecated type is now detected automatically
*/
setJewelryType(type: JewelryTypeName): void;
/**
* Get the uploaded jewelry type
* @deprecated type is now detected automatically
*/
getJewelryType(): JewelryTypeName | null;
/**
* Set array of excluded fingers from tracking
* @param fingers - array of enums corresponding fingers
*/
setExcludedFingers(fingers: Array<FingerName> | null): void;
/**
* Get array of excluded fingers from tracking
* @returns excluded fingers
*/
getExcludedFingers(): Array<FingerName> | null;
/**
* use performance check
* @param use
*/
setUsePerformanceCheck(use: boolean): void;
/**
* is performance checking used
*/
getUsePerformanceCheck(): boolean;
/**
* use annotation
* @param enabled
*/
setAnnotationEnabled(enabled: boolean): void;
/**
* @returns is annotation enabled
*/
getAnnotationEnabled(): boolean;
setSandboxEnabled(enabled: boolean): void;
/**
* use controls 3d
* @param enabled
*/
setControls3DEnabled(enabled: boolean): void;
/**
* @returns id controls 3d enabled
*/
getControls3DEnabled(): boolean;
/**
* @param url - url of recorded video for test/tune tracking
*/
setVideoUrl(url: string | undefined): void;
/**
* @returns url of recorded video for test/tune tracking
*/
getVideoUrl(): string | undefined;
/**
* @param url - url of the background image for the sharing screenshot
*/
setSharingBackgroundUrl(url: string | undefined): void;
/**
* @returns url of the background image for the sharing screenshot
*/
getSharingBackgroundUrl(): string | undefined;
/**
* @param url - url of the target window after sharing the screenshot
*/
setDataAcquisitionFormUrl(url: string | undefined): void;
/**
* @returns url of the target window after sharing the screenshot
*/
getDataAcquisitionFormUrl(): string | undefined;
setIsGUIEnabled(isGUIEnabled: boolean | undefined): void;
getIsGUIEnabled(): boolean | undefined;
setDisableLogo(disable: boolean): void;
getDisableLogo(): boolean;
setFavoritesList(favorites: Array<string> | null): void;
getFavoritesList(): Array<string> | null;
setOnFavoritesChange(onChange: (newList: Array<string>) => void): void;
/**
* Set language for the widget
* @param language - language code (en, kr, etc.)
*/
setLanguage(language: string): void;
/**
* Get current language
* @returns language code (en, kr, etc.)
* @default en
*/
getLanguage(): string;
setCustomCDNUrl(url: string | undefined): void;
getCustomCDNUrl(): string | undefined;
setStaticConfigsUrl(url: string | undefined): void;
getStaticConfigsUrl(): string | undefined;
setDynamicBrightnessEnabled(value: boolean | undefined): void;
getDynamicBrightness(): boolean | undefined;
getFingerBorderEstimationEnabled(): boolean | undefined;
setFingerBorderEstimationEnabled(enabled: boolean | undefined): void;
setCustomLoader(loader: CustomLoaderType | undefined): void;
getCustomLoader(): CustomLoaderType | undefined;
getIsDataCollectFormBeforeTryOnEnabled(): boolean | undefined;
setIsDataCollectFormBeforeTryOnEnabled(enabled: boolean | undefined): void;
setCustomBackendUrl(url: string | null): void;
getCustomBackendUrl(): string | null;
setPosteffectsConfigJson(posteffectsConfigJson: string | undefined): void;
getPosteffectsConfig(): string | undefined;
setServiceActivationKey(key: string | null): void;
getServiceActivationKey(): string | null;
setDisableShadowRoot(value: boolean): void;
getDisableShadowRoot(): boolean;
setCancelMirroring(value: boolean): void;
setConfigurator(configurator: ConfiguratorType): void;
setOnWidgetConfigSaved(callback: OnWidgetConfigSaved | undefined): void;
getOnWidgetConfigSaved(): OnWidgetConfigSaved | undefined;
useExternalUi(value: boolean): void;
updateCarouselItem(id: string): void;
getScreenshot(): void;
/**
* Restart the widget after changing the parameters
*/
refresh(): void;
/**
* Remove an existing widget from the DOM
*/
destroy(): void;
}