zakeke-configurator-react 0.0.85 → 0.0.88

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.
@@ -172,5 +172,5 @@ export declare class ZakekeEnvironment {
172
172
  clearListeners: () => void;
173
173
  setCameraLocked: (isBlocked?: boolean | undefined) => void;
174
174
  isSceneTryOnEnabled: () => boolean;
175
- getTryOnUrl: () => Promise<string>;
175
+ getTryOnUrl: (tryOnUrl?: string | undefined) => Promise<string>;
176
176
  }
@@ -80,7 +80,7 @@ export interface ProviderValue {
80
80
  IS_ANDROID: boolean;
81
81
  IS_IOS: boolean;
82
82
  setBackgroundColor: (color: string, alpha: number) => void;
83
- getTryOnUrl: () => Promise<string>;
83
+ getTryOnUrl: (tryOnUrl?: string) => Promise<string>;
84
84
  isSceneTryOnEnabled: () => boolean;
85
85
  setCameraLocked: (isBlocked: boolean) => void;
86
86
  }
package/dist/index.js CHANGED
@@ -29866,6 +29866,24 @@ class SceneViewer {
29866
29866
  this._infoPointsManagerStyle = null;
29867
29867
  this._canShowInfoPoints = true;
29868
29868
  this._canShowInfoPointsContent = true;
29869
+ this.setCameraLocked = (isBlocked) => {
29870
+ if (this._zkScene && this._sceneHelper && this._scene) {
29871
+ this._sceneHelper.setupCamera();
29872
+ this._camera = this._scene.activeCamera;
29873
+ if (this._camera) {
29874
+ if (isBlocked) {
29875
+ this._sceneHelper.setCameraLimitLowerRadius(true);
29876
+ this._sceneHelper.setMinZoomPerc(1);
29877
+ this._sceneHelper.setMaxZoomPerc(1);
29878
+ }
29879
+ else {
29880
+ this._sceneHelper.setCameraLimitLowerRadius(false);
29881
+ this._sceneHelper.setMinZoomPerc(1);
29882
+ this._sceneHelper.setMaxZoomPerc(1.5);
29883
+ }
29884
+ }
29885
+ }
29886
+ };
29869
29887
  if (options != undefined) {
29870
29888
  if (typeof options == "boolean")
29871
29889
  this._configPreview = options;
@@ -49746,7 +49764,17 @@ class ZakekeEnvironment {
49746
49764
  if (this.viewer)
49747
49765
  this.viewer.clearListeners();
49748
49766
  };
49749
- this.getTryOnUrl = () => {
49767
+ this.setCameraLocked = (isBlocked) => {
49768
+ return this.viewer.setCameraLocked(isBlocked);
49769
+ };
49770
+ this.isSceneTryOnEnabled = () => {
49771
+ var _a;
49772
+ if (this.viewer)
49773
+ if (this.zkScene)
49774
+ return (_a = this.zkScene.getTryOnEnabled()) !== null && _a !== void 0 ? _a : false;
49775
+ return false;
49776
+ };
49777
+ this.getTryOnUrl = (tryOnUrl) => {
49750
49778
  return new Promise(resolve => {
49751
49779
  if (this.zkScene && this.viewer) {
49752
49780
  const fileId = this.zkScene.getSceneID();
@@ -49756,7 +49784,7 @@ class ZakekeEnvironment {
49756
49784
  const attachmentPoint = 'noseBridge';
49757
49785
  // Salvo le mesh su IndexedDB
49758
49786
  this.viewer.saveVisibleMeshesOnDatabaseAsync(fileId).then(() => {
49759
- const url = "https://zakekecdn.blob.core.windows.net/cdn/c/tryon/index.html";
49787
+ const url = tryOnUrl !== null && tryOnUrl !== void 0 ? tryOnUrl : "https://zakekecdn.blob.core.windows.net/cdn/c/tryon/index.html";
49760
49788
  const link = new URL(url);
49761
49789
  let search = "id=" + fileId;
49762
49790
  search += '&rootUrl=' + encodeURIComponent(rootUrl);
@@ -49772,13 +49800,6 @@ class ZakekeEnvironment {
49772
49800
  }
49773
49801
  });
49774
49802
  };
49775
- this.isSceneTryOnEnabled = () => {
49776
- var _a;
49777
- if (this.viewer)
49778
- if (this.zkScene)
49779
- return (_a = this.zkScene.getTryOnEnabled()) !== null && _a !== void 0 ? _a : false;
49780
- return false;
49781
- };
49782
49803
  }
49783
49804
  get internalProduct() {
49784
49805
  return this.zkProduct;
@@ -50310,15 +50331,15 @@ function compare(_obj1, _obj2) {
50310
50331
  // We need to expand it
50311
50332
  try {
50312
50333
  const idJson1 = JSON.parse(obj1.id);
50313
- if (idJson1.id) {
50334
+ if (typeof idJson1 === 'object' && idJson1.id) {
50314
50335
  obj1 = idJson1;
50336
+ console.log("Code is a valid json with Id for obj1, use json instead", obj1, obj2);
50315
50337
  }
50316
- console.log("Code is a valid json with Id for obj1, use json instead", obj1, obj2);
50317
50338
  const idJson2 = JSON.parse(obj2.id);
50318
- if (idJson2.id) {
50339
+ if (typeof idJson2 === 'object' && idJson2.id) {
50319
50340
  obj2 = idJson2;
50341
+ console.log("Code is a valid json with Id for obj2, use json instead", obj1, obj2);
50320
50342
  }
50321
- console.log("Code is a valid json with Id for obj2, use json instead", obj1, obj2);
50322
50343
  }
50323
50344
  catch (ex) { }
50324
50345
  // Remove dummy property
@@ -50346,7 +50367,8 @@ function compare(_obj1, _obj2) {
50346
50367
  try {
50347
50368
  const a = typeof v === "object" ? v : JSON.parse(v);
50348
50369
  const b = typeof obj2[k] === "object" ? obj2[k] : JSON.parse(obj2[k]);
50349
- same = compare(a, b);
50370
+ if (typeof a == 'object' && typeof b == 'object')
50371
+ same = compare(a, b);
50350
50372
  }
50351
50373
  catch (_a) { }
50352
50374
  }
@@ -51305,7 +51327,8 @@ const createProviderValue = (state, dispatch) => {
51305
51327
  setBackgroundColor: state.environment.setBackgroundColor.bind(state.environment),
51306
51328
  // TRY ON
51307
51329
  getTryOnUrl: state.environment.getTryOnUrl.bind(state.environment),
51308
- isSceneTryOnEnabled: state.environment.isSceneTryOnEnabled.bind(state.environment)
51330
+ isSceneTryOnEnabled: state.environment.isSceneTryOnEnabled.bind(state.environment),
51331
+ setCameraLocked: state.environment.setCameraLocked.bind(state.environment)
51309
51332
  };
51310
51333
  };
51311
51334
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zakeke-configurator-react",
3
- "version": "0.0.85",
3
+ "version": "0.0.88",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/declarations/composer/Module/src/index.d.ts",