zakeke-configurator-react 0.0.190 → 0.0.192

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,5 +3,5 @@ export declare class AndroidAR {
3
3
  private static readonly _linkOrTitle;
4
4
  private static readonly _noArViewerSigil;
5
5
  private static _fallbackInvoked;
6
- static openSceneViewer(gltfSrc: any, notifyUnsupportedAR: () => void, arScale?: boolean): void;
6
+ static openSceneViewer(gltfSrc: any, notifyUnsupportedAR: () => void, arScale?: boolean, anchor?: 'wall' | 'floor' | null): void;
7
7
  }
@@ -1,4 +1,5 @@
1
1
  import { IDisposable } from "../Interfaces/IDisposable";
2
+ import { TryOnFineTuningSettings } from "../Interfaces/ITryOn";
2
3
  import { Nullable } from "../types";
3
4
  export type WorldExtends = {
4
5
  min: BABYLON.Vector3;
@@ -75,6 +76,7 @@ export declare class SceneHelper implements IDisposable {
75
76
  getTextureUrl(texture: Nullable<BABYLON.BaseTexture>): Nullable<string>;
76
77
  private isEditControl;
77
78
  isRealMesh(mesh: BABYLON.AbstractMesh): boolean;
79
+ meshFineTuningSettings(mesh: BABYLON.AbstractMesh): Nullable<TryOnFineTuningSettings>;
78
80
  meshHasParent(meshID: string, parentID: string): boolean;
79
81
  countSceneMeshes(): number;
80
82
  sceneHasRealMeshes(): boolean;
@@ -84,6 +86,7 @@ export declare class SceneHelper implements IDisposable {
84
86
  getInvisibleMeshes(): BABYLON.AbstractMesh[];
85
87
  getSubMesh(mesh: BABYLON.AbstractMesh, submeshIdx: number): Nullable<BABYLON.SubMesh>;
86
88
  getMeshHierarchy(parentID: string): BABYLON.AbstractMesh[];
89
+ getTryOnMeshHierarchy(parentID: string): BABYLON.AbstractMesh[];
87
90
  isCanvasMesh(mesh: BABYLON.AbstractMesh): boolean;
88
91
  isAREnabledForMesh(mesh: BABYLON.AbstractMesh): boolean;
89
92
  isTryOnEnabledForMesh(mesh: BABYLON.AbstractMesh): boolean;
@@ -213,6 +216,7 @@ export declare class SceneHelper implements IDisposable {
213
216
  arFileUrl: string;
214
217
  }[]>;
215
218
  private getGltfBlobForARExport;
219
+ exportMeshToGLBBlob(sceneRootUrl: Nullable<string>, meshID: string): Promise<Blob | null>;
216
220
  exportMeshesToARAsync(filePrefix: string, sceneRootUrl: Nullable<string>, meshes: BABYLON.AbstractMesh[], sceneID?: string, sceneCode?: string, fileFormat?: 'usdz' | 'glTF' | 'glb', arScale?: boolean): Promise<string>;
217
221
  exportMeshesToARMultiformatAsync(filePrefix: string, sceneRootUrl: Nullable<string>, meshes: BABYLON.AbstractMesh[], formats?: string[], arScale?: boolean): Promise<{
218
222
  format: string;
@@ -0,0 +1,73 @@
1
+ import { Nullable } from "../types";
2
+ export declare enum TryOnType {
3
+ Eyewear = 1,
4
+ Shoes = 2,
5
+ Jewelry = 3,
6
+ Headwear = 4,
7
+ Watches = 5
8
+ }
9
+ export interface TryOnProduct {
10
+ productID: number;
11
+ typeID: number;
12
+ providerID: number;
13
+ settings: string;
14
+ }
15
+ export declare enum TryOnProvider {
16
+ NotSelected = -1,
17
+ Mazing = 1,
18
+ Banuba = 2
19
+ }
20
+ export interface TryOnTypeSettings {
21
+ try_on: boolean;
22
+ pd?: boolean;
23
+ active: boolean;
24
+ }
25
+ export declare enum TryOnSettingsType {
26
+ VirtualTryOn = "try_on",
27
+ GlassPupillaryDistanceTool = "pd",
28
+ StyleButton = "styleButton",
29
+ MandatoryPupillaryDistance = "mandatoryPD"
30
+ }
31
+ export interface TryOnButtonCustomization {
32
+ image: Nullable<string>;
33
+ textLabel: Nullable<string>;
34
+ textColor: Nullable<string>;
35
+ backgroundColor: Nullable<string>;
36
+ borderColor: Nullable<string>;
37
+ borderWidth: number;
38
+ borderRadius: number;
39
+ }
40
+ export interface TryOnSettings {
41
+ type: TryOnType;
42
+ styleButton: "single" | "multiple";
43
+ buttonCustomizations: TryOnButtonCustomization[];
44
+ typeSettings: TryOnTypeSettings;
45
+ }
46
+ export declare enum TryOnFineTuningMazingEnvironment {
47
+ Neutral = "neutral.hdr",
48
+ Light = "light.hdr",
49
+ Bright = "bright.hdr",
50
+ Studio = "studio.hdr"
51
+ }
52
+ export interface TryOnFineTuningSettings {
53
+ scale: number;
54
+ position: {
55
+ x: number;
56
+ y: number;
57
+ z: number;
58
+ };
59
+ }
60
+ export interface TryOnFineTuningMazingSettings extends TryOnFineTuningSettings {
61
+ temple: boolean;
62
+ environment: TryOnFineTuningMazingEnvironment;
63
+ }
64
+ export interface ProductTryOn {
65
+ productID: number;
66
+ typeID: TryOnType;
67
+ providerID: number;
68
+ settings?: string;
69
+ }
70
+ export interface FineTuningProviderData {
71
+ mesh?: Blob;
72
+ settings?: TryOnFineTuningMazingSettings;
73
+ }
@@ -5,6 +5,7 @@ import { ISceneEditor } from "../Interfaces/ISceneEditor";
5
5
  import { LightSelectedEventArgs, LightSelectedEventHandler } from "../Layers/LightsLayer";
6
6
  import { Nullable } from "../types";
7
7
  import { SceneViewer } from "./SceneViewer";
8
+ import { TryOnSettingsType, TryOnType, TryOnSettings, TryOnProvider, TryOnFineTuningMazingSettings, FineTuningProviderData } from "../Interfaces/ITryOn";
8
9
  export declare class MaterialGroup {
9
10
  groupName: string;
10
11
  materials: BABYLON.Material[];
@@ -94,6 +95,11 @@ export type UploadSceneFileInfo = {
94
95
  incrementalsFileLength?: number | null | undefined;
95
96
  incrementalsFileUrl?: string | null | undefined;
96
97
  };
98
+ export type ProvidersTypesMapping = {
99
+ list: {
100
+ [key: string]: number;
101
+ };
102
+ };
97
103
  export type MaterialType = "Standard" | "PBRMetallicRoughness" | "PBRSpecularGlossiness" | "PBR" | "NewPBR";
98
104
  export type LightType = "Point" | "Directional" | "Spot" | "Hemispheric";
99
105
  export type ObjectSizeType = "width" | "height" | "depth";
@@ -115,6 +121,8 @@ export type MeshLocationsUpdateEventHandler = (evt: Zakeke.SceneMeshLocation[])
115
121
  export type ArTaskSuccessEventHandler = () => void;
116
122
  export type ArTaskErrorEventHandler = () => void;
117
123
  export type ArTasksCheckEventHandler = () => void;
124
+ export type TryOnTaskUpdateFineTuningSettingsEventHandler = (evt: TryOnFineTuningMazingSettings) => void;
125
+ export type TryOnTaskCloseFineTuningEventHandler = () => void;
118
126
  export declare class SceneEditor extends SceneViewer implements ISceneEditor, IDisposable {
119
127
  private _dracoEnabled;
120
128
  private _dracoEncodingSpeed;
@@ -129,6 +137,8 @@ export declare class SceneEditor extends SceneViewer implements ISceneEditor, ID
129
137
  private _lightsLayer;
130
138
  private _showAxes;
131
139
  private _axesLayer;
140
+ private _showFineTuning;
141
+ private _fineTuningModelLoaded;
132
142
  private _showHighlight;
133
143
  private _highlightOver;
134
144
  private _highlightOverColor;
@@ -162,6 +172,13 @@ export declare class SceneEditor extends SceneViewer implements ISceneEditor, ID
162
172
  private _arTaskSuccessListeners;
163
173
  private _arTaskErrorListeners;
164
174
  private _arTasksCheckListeners;
175
+ private _tryOnFineTuningSettingListeners;
176
+ private _tryOnFineTuningCloseListeners;
177
+ private _providersTypesMapping;
178
+ private _pickedProvider;
179
+ private _providerData;
180
+ private _sessionTryOnEnabled;
181
+ private _tryOnInfoLoading;
165
182
  private _initialMeshMaterials;
166
183
  private _initialSubMeshMaterials;
167
184
  private _lastMeshMaterials;
@@ -189,6 +206,14 @@ export declare class SceneEditor extends SceneViewer implements ISceneEditor, ID
189
206
  set showLights(value: boolean);
190
207
  get showAxes(): boolean;
191
208
  set showAxes(value: boolean);
209
+ get showFineTuning(): boolean;
210
+ set showFineTuning(value: boolean);
211
+ set fineTuningModelLoaded(value: boolean);
212
+ get fineTuningModelLoaded(): boolean;
213
+ get sessionTryOnEnabled(): boolean;
214
+ set sessionTryOnEnabled(value: boolean);
215
+ get tryOnInfoLoading(): boolean;
216
+ set tryOnInfoLoading(value: boolean);
192
217
  get showHighlight(): boolean;
193
218
  set showHighlight(value: boolean);
194
219
  get highlightOver(): boolean;
@@ -199,6 +224,10 @@ export declare class SceneEditor extends SceneViewer implements ISceneEditor, ID
199
224
  set editingMode(value: EditingMode);
200
225
  get editControlVisible(): boolean;
201
226
  set editControlVisible(value: boolean);
227
+ get providersTypesMapping(): ProvidersTypesMapping;
228
+ set providersTypesMapping(value: ProvidersTypesMapping);
229
+ get selectedProvider(): TryOnProvider;
230
+ get selectedProviderFineTuningData(): FineTuningProviderData;
202
231
  protected constructor(options?: SceneEditorOptions);
203
232
  static createSceneEditorAsync(options?: SceneEditorOptions): Promise<SceneEditor>;
204
233
  protected createCanvas(): HTMLCanvasElement;
@@ -217,10 +246,18 @@ export declare class SceneEditor extends SceneViewer implements ISceneEditor, ID
217
246
  setMatchSameNameTextures(value: boolean): void;
218
247
  getAREnabled(): boolean;
219
248
  setAREnabled(value: boolean): void;
220
- getArOnTheFly(): boolean;
221
- setArOnTheFly(value: boolean): void;
249
+ getAROnTheFly(): boolean;
250
+ setAROnTheFly(value: boolean): void;
251
+ setARAnchor(value: 'wall' | 'floor' | null): void;
222
252
  getTryOnEnabled(): boolean;
223
253
  setTryOnEnabled(value: boolean): void;
254
+ setTryOnSelectedType(value: TryOnType): void;
255
+ setProvider(provider: TryOnProvider): void;
256
+ setProviderFineTuningData(data: FineTuningProviderData): void;
257
+ getTryOnSelectedType(): TryOnType | null;
258
+ getTryOnSetting(key: TryOnSettingsType): boolean;
259
+ setTryOnSetting(key: TryOnSettingsType, value: any): void;
260
+ setTryOnTypeSettings(settings: TryOnSettings): void;
224
261
  getUseDelayedMaterialLoading(): boolean;
225
262
  setUseDelayedMaterialLoading(value: boolean): void;
226
263
  getUseDelayedTextureLoading(): boolean;
@@ -415,6 +452,12 @@ export declare class SceneEditor extends SceneViewer implements ISceneEditor, ID
415
452
  addArTaskErrorListener(listenerFunction: ArTaskErrorEventHandler): void;
416
453
  protected fireArTaskCheckEvent(): void;
417
454
  addArTaskCheckListener(listenerFunction: ArTasksCheckEventHandler): void;
455
+ fireFineTuningSettingEvent(settings: TryOnFineTuningMazingSettings): void;
456
+ addFineTuningSettingListener(listenerFunction: TryOnTaskUpdateFineTuningSettingsEventHandler): number;
457
+ removeFineTuningSettingListener(listenerIndex: number): void;
458
+ removeAllFineTuningSettingListeners(): void;
459
+ fireFineTuningCloseEvent(): void;
460
+ addFineTuningCloseListener(listenerFunction: TryOnTaskCloseFineTuningEventHandler): void;
418
461
  clearListeners(): void;
419
462
  protected onPointerDown(evt: PointerEvent, pickInfo: BABYLON.PickingInfo): void;
420
463
  protected onPointerMove(evt: BABYLON.IPointerEvent, pickInfo: BABYLON.PickingInfo): void;
@@ -118,6 +118,7 @@ export declare class SceneViewer implements IDisposable {
118
118
  private _isHologram;
119
119
  private _lastResizableMeshID;
120
120
  private _brandLogoButton;
121
+ private _performanceInfo;
121
122
  get zkScene(): Nullable<Zakeke.Scene>;
122
123
  get zkModel(): Nullable<MPlaza.Model>;
123
124
  get canvas(): Nullable<HTMLCanvasElement>;
@@ -127,6 +128,7 @@ export declare class SceneViewer implements IDisposable {
127
128
  set autoRender(value: boolean);
128
129
  get antialias(): boolean;
129
130
  set antialias(value: boolean);
131
+ get isLowEndDevice(): boolean | null;
130
132
  get isHologramSource(): boolean;
131
133
  set isHologramSource(value: boolean);
132
134
  get isHologram(): boolean;
@@ -193,6 +195,8 @@ export declare class SceneViewer implements IDisposable {
193
195
  onBeforeRender(): void;
194
196
  render(): void;
195
197
  protected checkRendering(): void;
198
+ private resetPerformanceInfo;
199
+ private checkPerformance;
196
200
  protected setupAntialiasPostProcesses(): void;
197
201
  protected createAntialiasPostProcesses(): void;
198
202
  protected canEnableAntialiasing(): boolean;
@@ -340,6 +344,7 @@ export declare class SceneViewer implements IDisposable {
340
344
  private getArFileUrlCacheKey;
341
345
  private getCachedArFileUrl;
342
346
  private cacheArFileUrl;
347
+ exportMeshToGLBBlob(meshID: string): Promise<Blob | null>;
343
348
  exportSceneToUsdzAsync(sceneID?: string, sceneCode?: string, useCacheWithDesign?: boolean): Promise<Nullable<string>>;
344
349
  exportMeshToUsdzAsync(meshID: string): Promise<Nullable<string>>;
345
350
  exportSceneToRemoteGlTFAsync(sceneID?: string, sceneCode?: string, useCacheWithDesign?: boolean): Promise<Nullable<string>>;
@@ -360,6 +365,8 @@ export declare class SceneViewer implements IDisposable {
360
365
  exportSceneToLocalUSDZAsync(): Promise<string | null>;
361
366
  downloadSceneLocalUSDZAsync(): Promise<void>;
362
367
  getSceneRootUrl(): Promise<Nullable<string>>;
368
+ isTryOnMeshVisibleEnabledToShow(): boolean;
369
+ getTryOnMeshVisible(): BABYLON.Mesh | null;
363
370
  refreshInfoPoints(): void;
364
371
  private getInfoPointsManagerStyle;
365
372
  private updateInfoPointsManagerStyle;
@@ -0,0 +1,109 @@
1
+ import { FunctionComponent } from "react";
2
+ import { TryOnFineTuningMazingSettings, TryOnGenericFineTuningSettings, TryOnProduct, TryOnProvider, TryOnSeller, TryOnType } from "../models";
3
+ export declare function parseJSON(json: string): any;
4
+ export declare enum TryOnMode {
5
+ Undefined = 0,
6
+ TryOn = 1,
7
+ PDTool = 2
8
+ }
9
+ export interface TryOnViewerProps {
10
+ mode: TryOnMode;
11
+ onTimeout?: (value: boolean) => void;
12
+ onPDUpdated?: (pd: number) => void;
13
+ onClose?: () => void;
14
+ }
15
+ export interface VTryOnViewerProps {
16
+ className?: string;
17
+ provider: TryOnProvider;
18
+ type: TryOnType;
19
+ obj: Blob;
20
+ settings?: TryOnGenericFineTuningSettings;
21
+ product: TryOnProduct;
22
+ customer: TryOnSeller;
23
+ onReady?: () => void;
24
+ onClose?: () => void;
25
+ }
26
+ export interface TryOnPDToolProps {
27
+ className?: string;
28
+ provider: TryOnProvider;
29
+ product: TryOnProduct;
30
+ customer: TryOnSeller;
31
+ onReady?: () => void;
32
+ onPDUpdated?: (pd: number) => void;
33
+ onClose?: () => void;
34
+ }
35
+ export declare const TryOnViewerComponent: FunctionComponent<TryOnViewerProps>;
36
+ export declare const VTryOnViewerComponent: FunctionComponent<VTryOnViewerProps>;
37
+ export declare const TryOnPDToolComponent: FunctionComponent<TryOnPDToolProps>;
38
+ export declare enum MazingTryOnState {
39
+ Start = "",
40
+ WaitingAuthentication = "WAITING_AUTH",
41
+ AuthSuccessful = "AUTH_SUCCESS",
42
+ TryOnLoaded = "MODEL_LOADED",
43
+ AuthError = "AUTH_ERROR",
44
+ WebcamError = "WEBCAM_ERROR",
45
+ ScreenShotTaken = "SCREENSHOT_TAKEN",
46
+ WebcamStopped = "WEBCAM_STOPPED"
47
+ }
48
+ export declare enum MazingTryOnOutMessage {
49
+ StartAuthenticationTryOn = "AUTH_TRY_ON",
50
+ LoadTryOn = "LOAD_MODEL",
51
+ TakeScreenshot = "TAKE_SCREENSHOT",
52
+ StopWebcam = "STOP_WEBCAM"
53
+ }
54
+ export declare enum MazingPDState {
55
+ Start = "",
56
+ WaitingAuthentication = "WAITING_AUTH",
57
+ AuthSuccessful = "AUTH_SUCCESS",
58
+ PDLoaded = "PD_LOADED",
59
+ PDUpdated = "NEW_PD",
60
+ AuthError = "AUTH_ERROR",
61
+ PDDataNotFoundError = "PD_ERROR",
62
+ WebcamError = "WEBCAM_ERROR",
63
+ PDCountdown = "PD_COUNTDOWN",
64
+ PDCountdownEnd = "PD_COUNTDOWN_END",
65
+ WebcamStopped = "WEBCAM_STOPPED"
66
+ }
67
+ export declare enum MazingPDOutMessage {
68
+ StartAuthenticationPD = "AUTH_TRY_ON",
69
+ LoadPD = "LOAD_PD",
70
+ StartPD = "START_PD",
71
+ StopWebcam = "STOP_WEBCAM"
72
+ }
73
+ export interface MazingTryOnInMessage {
74
+ type: MazingFrameState;
75
+ value: any;
76
+ }
77
+ export interface MazingFrameProps {
78
+ className?: string;
79
+ outMessageHandler: (e: MessageEvent<any>) => void;
80
+ onReady?: (w: Window) => void;
81
+ }
82
+ export interface MazingTryOnProps {
83
+ className?: string;
84
+ obj: Blob;
85
+ product: TryOnProduct;
86
+ customer: TryOnSeller;
87
+ fineTuningSettings?: TryOnFineTuningMazingSettings;
88
+ initialState?: MazingTryOnInMessage;
89
+ closeFlag: boolean;
90
+ onReady?: () => void;
91
+ onReadyToShow?: () => void;
92
+ onClosed?: () => void;
93
+ }
94
+ export interface MazingPDProps {
95
+ className?: string;
96
+ product: TryOnProduct;
97
+ customer: TryOnSeller;
98
+ initialState?: MazingTryOnInMessage;
99
+ closeFlag: boolean;
100
+ onReady?: () => void;
101
+ onReadyToShow?: () => void;
102
+ onPDUpdated?: (pd: number) => void;
103
+ onClosed?: () => void;
104
+ onClose?: () => void;
105
+ }
106
+ export type MazingFrameState = MazingTryOnState | MazingPDState;
107
+ export declare const MazingFrameComponent: (props: MazingFrameProps) => JSX.Element;
108
+ export declare const MazingTryOnComponent: FunctionComponent<MazingTryOnProps>;
109
+ export declare const MazingPDToolComponent: FunctionComponent<MazingPDProps>;
@@ -1,5 +1,6 @@
1
1
  export * from './components/customizer';
2
2
  export * from './components/sceneViewer';
3
+ export * from './components/tryOnViewer';
3
4
  export * from './environment';
4
5
  export * from './hooks/useZakeke';
5
6
  export * from './models';
@@ -1,4 +1,3 @@
1
- import { pricing_model } from "./pricing_model.graphql";
2
1
  interface FormulaModel {
3
2
  operator: string;
4
3
  values: number[];
@@ -24,7 +23,7 @@ export declare class DesignPriceCalculatorRuleBased {
24
23
  constructor(apiUrl?: string, token?: string, isOwin?: boolean, cloudFlareApiUrl?: string, clientLang?: string);
25
24
  init: (product: any) => Promise<void>;
26
25
  getPricings: (product: any, callback: (pricings: any, properties?: PricingRulePropertyModel[]) => void) => Promise<void>;
27
- getPricing: (design: any) => pricing_model | undefined;
26
+ getPricing: (design: any) => any;
28
27
  distinct: (value: any, index: any, self: any) => boolean;
29
28
  ElementSizeFunction: (pContext: any, formula: FormulaModel) => {
30
29
  result: boolean;
@@ -50,9 +49,8 @@ export declare class DesignPriceCalculatorRuleBased {
50
49
  conditions: any[];
51
50
  }[];
52
51
  getFunctionName: (properties: any, rule: any) => any;
53
- clearPricings: () => void;
54
- GetContextForRule: (rule: any, product: any, design: any) => IContext;
55
- isUsingAmountOfColors: (design: any) => boolean;
52
+ GetContextForRule: (rule: any, product: any, design: any, sidesOnWhichThePriceIsEnabled: any) => IContext;
53
+ isUsingAmountOfColors: (printTypeID: number) => boolean;
56
54
  getPremiumPhotosPrice: (design: any, quantity: number) => number;
57
55
  /**
58
56
  * Get Image Price
@@ -71,11 +69,11 @@ export declare class DesignPriceCalculatorRuleBased {
71
69
  getImagePrice: (design: any, quantity: number) => number;
72
70
  getMatchedConditions: (design: any, quantity: number, includePercentage: boolean) => any;
73
71
  calculate: (design: any, quantity: number) => number;
74
- getPricingAdditionalInfo: (design: any) => {
75
- description: string | null;
76
- priceDescriptionEnabled: boolean | null;
77
- infoPricingText: string | null;
78
- priceStructure: import("./pricing_model.graphql").PriceStructure | null;
72
+ getPricingAdditionalInfo: (printTypeID: number) => {
73
+ description: any;
74
+ priceDescriptionEnabled: any;
75
+ infoPricingText: any;
76
+ priceStructure: any;
79
77
  } | undefined;
80
78
  }
81
79
  export {};