zakeke-configurator-react 0.0.60 → 0.0.64

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.
@@ -129,6 +129,7 @@ export declare class MeshDesignManager implements IDisposable {
129
129
  private compareTextures;
130
130
  private dataURItoBlob;
131
131
  private downloadImage;
132
+ setDesignMeshVisibility(visibile: boolean): void;
132
133
  getItemsInfo(): MPlaza.ItemInfo[];
133
134
  removeItem(itemGuid: string): void;
134
135
  addItemText(settings: any): void;
@@ -40,6 +40,7 @@ export declare class SceneDesignManager implements IDisposable {
40
40
  setItemImage(guid: string, image: any): Promise<void>;
41
41
  setItemTextOnPath(guid: string, areaId: number, value: boolean): void;
42
42
  removeItemImage(guid: string): void;
43
+ setDesignVisibility(meshId: string, visibile: boolean): void;
43
44
  getDesignItemsJson(): string;
44
45
  getDesignID(): number;
45
46
  private fireRenderingNeededEvent;
@@ -277,6 +277,7 @@ export declare class SceneViewer implements IDisposable {
277
277
  setDesignItemImage(guid: string, image: MPlaza.Image): Promise<void>;
278
278
  setItemTextOnPath(guid: string, areaId: number, value: boolean): void;
279
279
  removeDesignItemImage(guid: string): void;
280
+ setDesignVisibility(meshId: string, opacity: boolean): void;
280
281
  setupShaderMaterialsCameraPosition(): void;
281
282
  setupShaderMaterialCameraPosition(material: BABYLON.Material): void;
282
283
  setMeshLocation(locationID: string): void;
@@ -1,7 +1,7 @@
1
- import { PlatformAttributeSelection } from "./integrations/Integration";
2
- import { Group, Product, Camera, FontFamily, ImageMacroCategory, Image, Template, Item } from "./models";
3
- import _ from "lodash";
4
- import { FocusAttributesEventListener } from "../../../3D/src";
1
+ import _ from 'lodash';
2
+ import { PlatformAttributeSelection } from './integrations/Integration';
3
+ import { Camera, FontFamily, Group, Image, ImageMacroCategory, Item, Product, Template } from './models';
4
+ import { FocusAttributesEventListener } from '../../../3D/src';
5
5
  export declare class ZakekeEnvironment {
6
6
  private token;
7
7
  private platformAttributesSelection;
@@ -21,6 +21,7 @@ export declare class ZakekeEnvironment {
21
21
  private internalIsFullscreen;
22
22
  private highlightSettings;
23
23
  private previousMeshesVisibleStates;
24
+ private lastCameraLocation;
24
25
  get internalProduct(): MPlaza.Model | null;
25
26
  get internalScene(): Zakeke.Scene | null;
26
27
  get internalCurrentTemplate(): MPlaza.Design | null | undefined;
@@ -56,6 +57,7 @@ export declare class ZakekeEnvironment {
56
57
  size: number;
57
58
  }) => void;
58
59
  renderDesign: _.DebouncedFunc<() => Promise<void>>;
60
+ resize: () => void;
59
61
  private handleSceneLoaded;
60
62
  private getComposition;
61
63
  private getDesign;
@@ -160,6 +162,12 @@ export declare class ZakekeEnvironment {
160
162
  * @param meshId The mesh and childs to show
161
163
  */
162
164
  restoreMeshVisibility: (meshId: string) => void;
165
+ /**
166
+ * Change opacity for a specific mesh
167
+ * @param meshId The mesh to change the opacity
168
+ * @param opacity The opacity to set
169
+ */
170
+ setMeshDesignVisibility: (meshId: string, visible: boolean) => void;
163
171
  addFocusAttributesListener: (listenerFunction: FocusAttributesEventListener) => void;
164
172
  clearListeners: () => void;
165
173
  }
@@ -68,8 +68,10 @@ export interface ProviderValue {
68
68
  getMeshIDbyName: (name: string) => string | undefined | null;
69
69
  hideMeshAndSaveState: (meshId: string) => void;
70
70
  restoreMeshVisibility: (meshId: string) => void;
71
+ setMeshDesignVisibility: (meshId: string, visible: boolean) => void;
71
72
  clearListeners: () => void;
72
73
  addFocusAttributesListener: (listenerFunction: FocusAttributesEventListener) => void;
74
+ focusAttribute: (attributeId: number) => void;
73
75
  getQrCodeArUrl: (device: 'iOS' | 'Android') => Promise<string>;
74
76
  getMobileArUrl: (useCacheWithDesign?: boolean) => Promise<string | null>;
75
77
  openArMobile: (url: string) => void;
package/dist/index.js CHANGED
@@ -5206,6 +5206,11 @@ var MeshDesignManager = /** @class */ (function () {
5206
5206
  document.body.appendChild(downloadLink);
5207
5207
  downloadLink.click();
5208
5208
  };
5209
+ MeshDesignManager.prototype.setDesignMeshVisibility = function (visibile) {
5210
+ if (this._canvasMesh) {
5211
+ this._canvasMesh.isVisible = visibile;
5212
+ }
5213
+ };
5209
5214
  MeshDesignManager.prototype.getItemsInfo = function () {
5210
5215
  if (this._customizer) {
5211
5216
  return this._customizer.getItemsInfo();
@@ -5791,6 +5796,14 @@ var SceneDesignManager = /** @class */ (function () {
5791
5796
  return [2 /*return*/, manager.removeItemImage(guid)];
5792
5797
  }); }); });
5793
5798
  };
5799
+ SceneDesignManager.prototype.setDesignVisibility = function (meshId, visibile) {
5800
+ var mesh = this._scene.getMeshByID(meshId);
5801
+ if (mesh) {
5802
+ var manager = this.getMeshDesignMananger(mesh, mesh.subMeshes[0]);
5803
+ if (manager)
5804
+ manager.setDesignMeshVisibility(visibile);
5805
+ }
5806
+ };
5794
5807
  SceneDesignManager.prototype.getDesignItemsJson = function () {
5795
5808
  var json = "";
5796
5809
  for (var i = 0; i < this._zkDesign.get("designItems").length; i++) {
@@ -26095,6 +26108,9 @@ var SceneViewer = /** @class */ (function () {
26095
26108
  this._sceneDesignManager.removeItemImage(guid);
26096
26109
  }
26097
26110
  };
26111
+ SceneViewer.prototype.setDesignVisibility = function (meshId, opacity) {
26112
+ this._sceneDesignManager.setDesignVisibility(meshId, opacity);
26113
+ };
26098
26114
  SceneViewer.prototype.setupShaderMaterialsCameraPosition = function () {
26099
26115
  if (this._scene) {
26100
26116
  for (var i = 0; i < this._scene.materials.length; i++) {
@@ -40871,7 +40887,7 @@ var axiosApi;
40871
40887
  function setupApi(culture, token) {
40872
40888
  axiosApi = axios__WEBPACK_IMPORTED_MODULE_0___default.a.create({
40873
40889
  baseURL: Zakeke.config.baseApiUrl,
40874
- timeout: 30000,
40890
+ timeout: 120000,
40875
40891
  headers: {
40876
40892
  "Authorization": "Bearer " + token,
40877
40893
  "Accept-Language": culture
@@ -41039,15 +41055,15 @@ var templateObject_1;
41039
41055
  "use strict";
41040
41056
  __webpack_require__.r(__webpack_exports__);
41041
41057
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ZakekeEnvironment", function() { return ZakekeEnvironment; });
41042
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.tsx");
41043
- /* harmony import */ var _exceptions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./exceptions */ "./src/exceptions.tsx");
41044
- /* harmony import */ var _integrations_Integration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./integrations/Integration */ "./src/integrations/Integration.ts");
41045
- /* harmony import */ var _integrations_Helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./integrations/Helpers */ "./src/integrations/Helpers.ts");
41046
- /* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./models */ "./src/models.ts");
41047
- /* harmony import */ var _imageUploadTask__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./imageUploadTask */ "./src/imageUploadTask.ts");
41048
- /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./api */ "./src/api.ts");
41049
- /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
41050
- /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_7__);
41058
+ /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
41059
+ /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
41060
+ /* harmony import */ var _imageUploadTask__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./imageUploadTask */ "./src/imageUploadTask.ts");
41061
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helpers */ "./src/helpers.tsx");
41062
+ /* harmony import */ var _exceptions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./exceptions */ "./src/exceptions.tsx");
41063
+ /* harmony import */ var _integrations_Integration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./integrations/Integration */ "./src/integrations/Integration.ts");
41064
+ /* harmony import */ var _integrations_Helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./integrations/Helpers */ "./src/integrations/Helpers.ts");
41065
+ /* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./models */ "./src/models.ts");
41066
+ /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./api */ "./src/api.ts");
41051
41067
  /* harmony import */ var _3D_src__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../3D/src */ "../../3D/src/index.ts");
41052
41068
  /* harmony import */ var _fontsManager__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./fontsManager */ "./src/fontsManager.ts");
41053
41069
  var __assign = (undefined && undefined.__assign) || function () {
@@ -41129,6 +41145,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41129
41145
  this.internalIsFullscreen = false;
41130
41146
  this.highlightSettings = null;
41131
41147
  this.previousMeshesVisibleStates = {};
41148
+ this.lastCameraLocation = null;
41132
41149
  this.currency = 'EUR';
41133
41150
  this.groups = [];
41134
41151
  this.fonts = [];
@@ -41186,7 +41203,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41186
41203
  if (key.indexOf("attributes") == 0) {
41187
41204
  for (var _i = 0, value_1 = value; _i < value_1.length; _i++) { // For each attribute/option
41188
41205
  var attr = value_1[_i];
41189
- _this.platformAttributesSelection.push(new _integrations_Integration__WEBPACK_IMPORTED_MODULE_2__["PlatformAttributeSelection"](JSON.stringify(attr[0]), JSON.stringify(attr[1]), "", "", true, true));
41206
+ _this.platformAttributesSelection.push(new _integrations_Integration__WEBPACK_IMPORTED_MODULE_4__["PlatformAttributeSelection"](JSON.stringify(attr[0]), JSON.stringify(attr[1]), "", "", true, true));
41190
41207
  }
41191
41208
  }
41192
41209
  }
@@ -41197,7 +41214,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41197
41214
  for (var i = 0; i < pieces.length; i++) {
41198
41215
  var index = pieces[i].indexOf("=");
41199
41216
  if (index == -1) {
41200
- throw new _exceptions__WEBPACK_IMPORTED_MODULE_1__["ParametersParseFailException"](pieces[i]);
41217
+ throw new _exceptions__WEBPACK_IMPORTED_MODULE_3__["ParametersParseFailException"](pieces[i]);
41201
41218
  }
41202
41219
  var key = decodeURIComponent(pieces[i].substring(0, index));
41203
41220
  var value = pieces[i].substring(index + 1);
@@ -41243,7 +41260,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41243
41260
  var json = JSON.parse(data);
41244
41261
  for (var _a = 0, json_1 = json; _a < json_1.length; _a++) {
41245
41262
  var attr = json_1[_a];
41246
- _this.platformAttributesSelection.push(new _integrations_Integration__WEBPACK_IMPORTED_MODULE_2__["PlatformAttributeSelection"](JSON.stringify(attr[0]), JSON.stringify(attr[1]), "", "", true, true));
41263
+ _this.platformAttributesSelection.push(new _integrations_Integration__WEBPACK_IMPORTED_MODULE_4__["PlatformAttributeSelection"](JSON.stringify(attr[0]), JSON.stringify(attr[1]), "", "", true, true));
41247
41264
  }
41248
41265
  }
41249
41266
  }
@@ -41261,7 +41278,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41261
41278
  };
41262
41279
  for (var key in requiredParams) {
41263
41280
  if (!requiredParams[key])
41264
- throw new _exceptions__WEBPACK_IMPORTED_MODULE_1__["Exception"]("Missing parameter: " + key);
41281
+ throw new _exceptions__WEBPACK_IMPORTED_MODULE_3__["Exception"]("Missing parameter: " + key);
41265
41282
  }
41266
41283
  window["token"] = _this.token;
41267
41284
  window["isOwin"] = true;
@@ -41272,7 +41289,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41272
41289
  var _this = this;
41273
41290
  return __generator(this, function (_a) {
41274
41291
  if (!this.productCode || this.productCode == "")
41275
- throw new _exceptions__WEBPACK_IMPORTED_MODULE_1__["Exception"]("Loading product but no SKU found");
41292
+ throw new _exceptions__WEBPACK_IMPORTED_MODULE_3__["Exception"]("Loading product but no SKU found");
41276
41293
  return [2 /*return*/, new Promise(function (resolve, reject) {
41277
41294
  var zkModel = new MPlaza.Model();
41278
41295
  zkModel.set("modelID", 1);
@@ -41281,7 +41298,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41281
41298
  resolve(zkModel);
41282
41299
  },
41283
41300
  error: function () {
41284
- reject(new _exceptions__WEBPACK_IMPORTED_MODULE_1__["Exception"]("Failed loading product"));
41301
+ reject(new _exceptions__WEBPACK_IMPORTED_MODULE_3__["Exception"]("Failed loading product"));
41285
41302
  },
41286
41303
  data: {
41287
41304
  c: _this.productCode
@@ -41295,9 +41312,9 @@ var ZakekeEnvironment = /** @class */ (function () {
41295
41312
  var zkScene;
41296
41313
  return __generator(this, function (_a) {
41297
41314
  if (!product)
41298
- throw new _exceptions__WEBPACK_IMPORTED_MODULE_1__["Exception"]("Loading scene but no product found");
41315
+ throw new _exceptions__WEBPACK_IMPORTED_MODULE_3__["Exception"]("Loading scene but no product found");
41299
41316
  if (product.get("scenes").length == 0)
41300
- throw new _exceptions__WEBPACK_IMPORTED_MODULE_1__["Exception"]("The product don't have any scene configured");
41317
+ throw new _exceptions__WEBPACK_IMPORTED_MODULE_3__["Exception"]("The product don't have any scene configured");
41301
41318
  zkScene = new Zakeke.Scene();
41302
41319
  zkScene.set("sceneID", product.get("scenes").at(0).get("sceneID"));
41303
41320
  return [2 /*return*/, new Promise(function (resolve, reject) {
@@ -41306,7 +41323,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41306
41323
  resolve(zkScene);
41307
41324
  },
41308
41325
  error: function () {
41309
- reject(new _exceptions__WEBPACK_IMPORTED_MODULE_1__["Exception"]("Failed loading scene"));
41326
+ reject(new _exceptions__WEBPACK_IMPORTED_MODULE_3__["Exception"]("Failed loading scene"));
41310
41327
  }
41311
41328
  });
41312
41329
  })];
@@ -41317,7 +41334,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41317
41334
  var _this = this;
41318
41335
  return __generator(this, function (_a) {
41319
41336
  if (!this.productCode || this.productCode == "")
41320
- throw new _exceptions__WEBPACK_IMPORTED_MODULE_1__["Exception"]("Loading product but no SKU found");
41337
+ throw new _exceptions__WEBPACK_IMPORTED_MODULE_3__["Exception"]("Loading product but no SKU found");
41321
41338
  return [2 /*return*/, new Promise(function (resolve, reject) {
41322
41339
  var models = new Zakeke.ComposerModels();
41323
41340
  models.set("modelID", 1);
@@ -41326,7 +41343,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41326
41343
  resolve(models);
41327
41344
  },
41328
41345
  error: function () {
41329
- reject(new _exceptions__WEBPACK_IMPORTED_MODULE_1__["Exception"]("Failed loading product"));
41346
+ reject(new _exceptions__WEBPACK_IMPORTED_MODULE_3__["Exception"]("Failed loading product"));
41330
41347
  },
41331
41348
  data: {
41332
41349
  c: _this.productCode
@@ -41343,7 +41360,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41343
41360
  switch (_c.label) {
41344
41361
  case 0:
41345
41362
  _c.trys.push([0, 2, , 3]);
41346
- return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_6__["axiosApi"].get(Zakeke.config.baseApiUrl + "fontfamilies/")];
41363
+ return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_7__["axiosApi"].get(Zakeke.config.baseApiUrl + "fontfamilies/")];
41347
41364
  case 1:
41348
41365
  fonts = (_c.sent()).data;
41349
41366
  productFonts_1 = (_b = (_a = this.zkProduct) === null || _a === void 0 ? void 0 : _a.get("printTypes").at(0).get("fonts").map(function (x) { return x.get("fontFamilyID"); })) !== null && _b !== void 0 ? _b : [];
@@ -41365,7 +41382,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41365
41382
  switch (_a.label) {
41366
41383
  case 0:
41367
41384
  _a.trys.push([0, 2, , 3]);
41368
- return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_6__["axiosApi"].get(Zakeke.config.baseApiUrl + "customizerinfo/")];
41385
+ return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_7__["axiosApi"].get(Zakeke.config.baseApiUrl + "customizerinfo/")];
41369
41386
  case 1:
41370
41387
  settings = (_a.sent()).data;
41371
41388
  return [2 /*return*/, settings];
@@ -41394,7 +41411,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41394
41411
  switch (_h.label) {
41395
41412
  case 0:
41396
41413
  this.parseParameters(parameters);
41397
- Object(_api__WEBPACK_IMPORTED_MODULE_6__["setupApi"])(this.culture, this.token);
41414
+ Object(_api__WEBPACK_IMPORTED_MODULE_7__["setupApi"])(this.culture, this.token);
41398
41415
  _a = this;
41399
41416
  return [4 /*yield*/, this.getSettings()];
41400
41417
  case 1:
@@ -41405,9 +41422,9 @@ var ZakekeEnvironment = /** @class */ (function () {
41405
41422
  composerModels = _h.sent();
41406
41423
  this.zkScene = composerModels.get('scene');
41407
41424
  this.zkProduct = composerModels.get('model');
41408
- this.product = _models__WEBPACK_IMPORTED_MODULE_4__["Product"].fromProduct(this.zkProduct);
41425
+ this.product = _models__WEBPACK_IMPORTED_MODULE_6__["Product"].fromProduct(this.zkProduct);
41409
41426
  _b = this;
41410
- return [4 /*yield*/, Object(_integrations_Helpers__WEBPACK_IMPORTED_MODULE_3__["integrationFor"])(this.platform)];
41427
+ return [4 /*yield*/, Object(_integrations_Helpers__WEBPACK_IMPORTED_MODULE_5__["integrationFor"])(this.platform)];
41411
41428
  case 3:
41412
41429
  _b.integration = _h.sent();
41413
41430
  if (!this.zkScene)
@@ -41422,8 +41439,8 @@ var ZakekeEnvironment = /** @class */ (function () {
41422
41439
  return [4 /*yield*/, this.getTemplates()];
41423
41440
  case 5:
41424
41441
  _d.zkTemplates = _h.sent();
41425
- this.templates = this.zkTemplates.map(function (zkTemplate) { return _models__WEBPACK_IMPORTED_MODULE_4__["Template"].fromTemplate(zkTemplate); });
41426
- this.cameras = (_g = (_f = this.zkScene) === null || _f === void 0 ? void 0 : _f.get('cameraLocations').map(function (x) { return _models__WEBPACK_IMPORTED_MODULE_4__["Camera"].fromZkCamera(x); })) !== null && _g !== void 0 ? _g : [];
41442
+ this.templates = this.zkTemplates.map(function (zkTemplate) { return _models__WEBPACK_IMPORTED_MODULE_6__["Template"].fromTemplate(zkTemplate); });
41443
+ this.cameras = (_g = (_f = this.zkScene) === null || _f === void 0 ? void 0 : _f.get('cameraLocations').map(function (x) { return _models__WEBPACK_IMPORTED_MODULE_6__["Camera"].fromZkCamera(x); })) !== null && _g !== void 0 ? _g : [];
41427
41444
  this.trigger("change");
41428
41445
  _e = this;
41429
41446
  return [4 /*yield*/, _3D_src__WEBPACK_IMPORTED_MODULE_8__["SceneViewer"].createSceneViewerAsync()];
@@ -41476,7 +41493,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41476
41493
  _this.viewer.highlightSize = settings.size;
41477
41494
  }
41478
41495
  };
41479
- this.renderDesign = lodash__WEBPACK_IMPORTED_MODULE_7___default.a.throttle(function () { return __awaiter(_this, void 0, void 0, function () {
41496
+ this.renderDesign = lodash__WEBPACK_IMPORTED_MODULE_0___default.a.throttle(function () { return __awaiter(_this, void 0, void 0, function () {
41480
41497
  return __generator(this, function (_a) {
41481
41498
  switch (_a.label) {
41482
41499
  case 0:
@@ -41490,11 +41507,25 @@ var ZakekeEnvironment = /** @class */ (function () {
41490
41507
  }
41491
41508
  });
41492
41509
  }); }, 300);
41510
+ this.resize = function () {
41511
+ if (!_this.viewer)
41512
+ return;
41513
+ _this.viewer.updateView(false);
41514
+ // Restore last camera locazione
41515
+ if (_this.lastCameraLocation) {
41516
+ console.log("Restoring last camera location " + _this.lastCameraLocation + " ...");
41517
+ _this.setCamera(_this.lastCameraLocation, false);
41518
+ }
41519
+ else {
41520
+ _this.viewer.adjustCamera(false);
41521
+ }
41522
+ };
41493
41523
  this.handleSceneLoaded = function () { return __awaiter(_this, void 0, void 0, function () {
41494
41524
  var _this = this;
41495
41525
  return __generator(this, function (_a) {
41496
41526
  switch (_a.label) {
41497
41527
  case 0:
41528
+ window.addEventListener("resize", this.resize);
41498
41529
  console.log("Scene loaded");
41499
41530
  this.selection = Zakeke.ComposerSelection.CreateComposerSelection(this.zkProduct);
41500
41531
  return [4 /*yield*/, this.internalLoadComposition(this.compositionId)];
@@ -41596,10 +41627,10 @@ var ZakekeEnvironment = /** @class */ (function () {
41596
41627
  _loop_1 = function (platformSelection) {
41597
41628
  // Search the attribute
41598
41629
  this_1.zkProduct.get("attributes").each(function (attribute) {
41599
- if (Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["isPlatformCode"])(attribute.get("attributeCode"))) {
41600
- if (Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["compare"])(JSON.parse(attribute.get("attributeCode")), JSON.parse(platformSelection.attributeCode))) {
41630
+ if (Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["isPlatformCode"])(attribute.get("attributeCode"))) {
41631
+ if (Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["compare"])(JSON.parse(attribute.get("attributeCode")), JSON.parse(platformSelection.attributeCode))) {
41601
41632
  var option = attribute.get("options").find(function (option) {
41602
- return Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["compare"])(JSON.parse(option.get("optionCode")), JSON.parse(platformSelection.optionCode));
41633
+ return Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["compare"])(JSON.parse(option.get("optionCode")), JSON.parse(platformSelection.optionCode));
41603
41634
  });
41604
41635
  if (option) {
41605
41636
  _this.selection.selectAttributeValue(attribute.get('attributeID'), option.get('optionID'));
@@ -41624,12 +41655,12 @@ var ZakekeEnvironment = /** @class */ (function () {
41624
41655
  // If yes, we ignore it because the correct value was already selected in the previous rows.
41625
41656
  // else we add it to the list of attributes selections
41626
41657
  var oldAttribute = _this.platformAttributesSelection.find(function (x) {
41627
- return Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["matchCodes"])(x.attributeCode, attribute.get("attributeCode"));
41658
+ return Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["matchCodes"])(x.attributeCode, attribute.get("attributeCode"));
41628
41659
  });
41629
41660
  if ((!oldAttribute)) {
41630
41661
  var selectedOption = attribute.get("options").findWhere({ selected: true });
41631
41662
  if (selectedOption)
41632
- _this.platformAttributesSelection.push(new _integrations_Integration__WEBPACK_IMPORTED_MODULE_2__["PlatformAttributeSelection"](attribute.get("attributeCode"), selectedOption.get("optionCode"), attribute.get("name"), selectedOption.get("name"), attribute.get("enabled"), selectedOption.get("enabled")));
41663
+ _this.platformAttributesSelection.push(new _integrations_Integration__WEBPACK_IMPORTED_MODULE_4__["PlatformAttributeSelection"](attribute.get("attributeCode"), selectedOption.get("optionCode"), attribute.get("name"), selectedOption.get("name"), attribute.get("enabled"), selectedOption.get("enabled")));
41633
41664
  }
41634
41665
  });
41635
41666
  });
@@ -41671,7 +41702,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41671
41702
  option = attribute.get("options").find(function (option) { return option.get('optionID') == e.selectedValue; });
41672
41703
  if (option) {
41673
41704
  platformSelection = this.platformAttributesSelection.find(function (x) {
41674
- return Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["matchCodes"])(x.attributeCode, attribute.get("attributeCode"));
41705
+ return Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["matchCodes"])(x.attributeCode, attribute.get("attributeCode"));
41675
41706
  });
41676
41707
  if (platformSelection) {
41677
41708
  platformSelection.optionCode = option.get("optionCode");
@@ -41715,7 +41746,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41715
41746
  var attribute = _this.zkProduct.get("attributes").find(function (attribute) { return attribute.get('attributeID') == attributeId; });
41716
41747
  if (attribute) {
41717
41748
  var attributePlatformSelection = _this.platformAttributesSelection.find(function (selection) {
41718
- return Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["matchCodes"])(selection.attributeCode, attribute.get("attributeCode"));
41749
+ return Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["matchCodes"])(selection.attributeCode, attribute.get("attributeCode"));
41719
41750
  });
41720
41751
  if (attributePlatformSelection) {
41721
41752
  attributePlatformSelection.attributeIsEnabled = isEnabled;
@@ -41733,9 +41764,9 @@ var ZakekeEnvironment = /** @class */ (function () {
41733
41764
  var option = attribute.get("options").find(function (option) { return option.get('optionID') == optionId; });
41734
41765
  if (option) {
41735
41766
  var attributePlatformSelection = _this.platformAttributesSelection.find(function (selection) {
41736
- return Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["matchCodes"])(selection.attributeCode, attribute.get("attributeCode"));
41767
+ return Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["matchCodes"])(selection.attributeCode, attribute.get("attributeCode"));
41737
41768
  });
41738
- if (attributePlatformSelection && Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["matchCodes"])(attributePlatformSelection.optionCode, option.get("optionCode"))) {
41769
+ if (attributePlatformSelection && Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["matchCodes"])(attributePlatformSelection.optionCode, option.get("optionCode"))) {
41739
41770
  attributePlatformSelection.optionIsEnabled = isEnabled;
41740
41771
  }
41741
41772
  }
@@ -41775,7 +41806,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41775
41806
  }
41776
41807
  });
41777
41808
  }); };
41778
- this.updatePrice = lodash__WEBPACK_IMPORTED_MODULE_7___default.a.debounce(this._updatePrice, 300);
41809
+ this.updatePrice = lodash__WEBPACK_IMPORTED_MODULE_0___default.a.debounce(this._updatePrice, 300);
41779
41810
  this.buildStructure = function () {
41780
41811
  var data = [];
41781
41812
  if (_this.selection) {
@@ -41792,7 +41823,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41792
41823
  this.createGroupFromSelection = function (groupSelection) {
41793
41824
  var zakekeGroup = _this.zkProduct.get("attributeGroups").get(groupSelection.get("groupID"));
41794
41825
  var imageUrl = zakekeGroup ? zakekeGroup.get("imageUrl") : null;
41795
- var group = new _models__WEBPACK_IMPORTED_MODULE_4__["Group"]();
41826
+ var group = new _models__WEBPACK_IMPORTED_MODULE_6__["Group"]();
41796
41827
  group.id = zakekeGroup ? zakekeGroup.get('groupID') : -1;
41797
41828
  group.guid = zakekeGroup ? zakekeGroup.get("groupGuid") : '-1';
41798
41829
  group.name = zakekeGroup ? zakekeGroup.get("name") : "Other";
@@ -41823,13 +41854,13 @@ var ZakekeEnvironment = /** @class */ (function () {
41823
41854
  };
41824
41855
  this.createAttributeFromSelection = function (attributeSelection) {
41825
41856
  var zakekeAttribute = _this.zkProduct.get("attributes").get(attributeSelection.get("attributeID"));
41826
- var attribute = new _models__WEBPACK_IMPORTED_MODULE_4__["Attribute"]();
41857
+ var attribute = new _models__WEBPACK_IMPORTED_MODULE_6__["Attribute"]();
41827
41858
  attribute.id = zakekeAttribute.get('attributeID');
41828
41859
  attribute.guid = zakekeAttribute.get("attributeGuid");
41829
41860
  attribute.code = zakekeAttribute.get("attributeCode");
41830
41861
  attribute.name = zakekeAttribute.get("name") || '';
41831
41862
  attribute.description = zakekeAttribute.get("description") || '';
41832
- attribute.optionShapeType = zakekeAttribute.get("optionPreviewShapeID") == 1 ? _models__WEBPACK_IMPORTED_MODULE_4__["AttributeOptionShapeType"].Round : _models__WEBPACK_IMPORTED_MODULE_4__["AttributeOptionShapeType"].Square;
41863
+ attribute.optionShapeType = zakekeAttribute.get("optionPreviewShapeID") == 1 ? _models__WEBPACK_IMPORTED_MODULE_6__["AttributeOptionShapeType"].Round : _models__WEBPACK_IMPORTED_MODULE_6__["AttributeOptionShapeType"].Square;
41833
41864
  attribute.displayOrder = zakekeAttribute.get("displayOrder");
41834
41865
  attribute.enabled = attributeSelection.get("enabled");
41835
41866
  attribute.groupId = zakekeAttribute.get("groupID");
@@ -41844,19 +41875,19 @@ var ZakekeEnvironment = /** @class */ (function () {
41844
41875
  attribute.options.push(option);
41845
41876
  }
41846
41877
  if (attributeSelection.get("attributeTypeID") == MPlaza.AttributeType.Options) {
41847
- attribute.type = _models__WEBPACK_IMPORTED_MODULE_4__["AttributeType"].Select;
41878
+ attribute.type = _models__WEBPACK_IMPORTED_MODULE_6__["AttributeType"].Select;
41848
41879
  }
41849
41880
  else if (attributeSelection.get("attributeTypeID") == MPlaza.AttributeType.Color) {
41850
- attribute.type = _models__WEBPACK_IMPORTED_MODULE_4__["AttributeType"].Colorpicker;
41881
+ attribute.type = _models__WEBPACK_IMPORTED_MODULE_6__["AttributeType"].Colorpicker;
41851
41882
  attribute.value = attributeSelection.get("selectedValue");
41852
41883
  }
41853
41884
  else if (attributeSelection.get("attributeTypeID") == MPlaza.AttributeType.Number) {
41854
- attribute.type = _models__WEBPACK_IMPORTED_MODULE_4__["AttributeType"].Colorpicker;
41885
+ attribute.type = _models__WEBPACK_IMPORTED_MODULE_6__["AttributeType"].Colorpicker;
41855
41886
  attribute.value = attributeSelection.get("selectedValue");
41856
41887
  attribute.numberFormat = "";
41857
41888
  }
41858
41889
  else if (attributeSelection.get("attributeTypeID") == MPlaza.AttributeType.String) {
41859
- attribute.type = _models__WEBPACK_IMPORTED_MODULE_4__["AttributeType"].Colorpicker;
41890
+ attribute.type = _models__WEBPACK_IMPORTED_MODULE_6__["AttributeType"].Colorpicker;
41860
41891
  attribute.value = attributeSelection.get("selectedValue");
41861
41892
  attribute.numberFormat = "";
41862
41893
  }
@@ -41865,7 +41896,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41865
41896
  };
41866
41897
  this.createOptionFromSelection = function (optionSelection) {
41867
41898
  var zakekeOption = _this.zkProduct.get("attributes").get(optionSelection.get("attributeID")).get("options").get(optionSelection.get("optionID"));
41868
- var option = new _models__WEBPACK_IMPORTED_MODULE_4__["Option"]();
41899
+ var option = new _models__WEBPACK_IMPORTED_MODULE_6__["Option"]();
41869
41900
  option.id = zakekeOption.get('optionID');
41870
41901
  option.guid = zakekeOption.get("optionGuid");
41871
41902
  option.code = zakekeOption.get("optionCode");
@@ -41950,7 +41981,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41950
41981
  }
41951
41982
  };
41952
41983
  this.on = function (event, callback) {
41953
- _this.events.push(new _models__WEBPACK_IMPORTED_MODULE_4__["ZakekeEvent"](event, callback));
41984
+ _this.events.push(new _models__WEBPACK_IMPORTED_MODULE_6__["ZakekeEvent"](event, callback));
41954
41985
  };
41955
41986
  this.off = function (event, callback) {
41956
41987
  _this.events = _this.events.filter(function (x) {
@@ -41991,7 +42022,7 @@ var ZakekeEnvironment = /** @class */ (function () {
41991
42022
  var templatesList, templates, _i, _a, _template, template;
41992
42023
  return __generator(this, function (_b) {
41993
42024
  switch (_b.label) {
41994
- case 0: return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_6__["axiosApi"].get("designs/templates/" + this.zkProduct.get('modelID'))];
42025
+ case 0: return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_7__["axiosApi"].get("designs/templates/" + this.zkProduct.get('modelID'))];
41995
42026
  case 1:
41996
42027
  templatesList = (_b.sent()).data;
41997
42028
  templates = [];
@@ -42064,14 +42095,16 @@ var ZakekeEnvironment = /** @class */ (function () {
42064
42095
  _this.selection.selectAttributeValue(attribute.get('attributeID'), optionId);
42065
42096
  }
42066
42097
  else {
42067
- throw new _exceptions__WEBPACK_IMPORTED_MODULE_1__["Exception"]("Invalid option with id " + optionId);
42098
+ throw new _exceptions__WEBPACK_IMPORTED_MODULE_3__["Exception"]("Invalid option with id " + optionId);
42068
42099
  }
42069
42100
  };
42070
42101
  // Focus a group executing some camera movements
42071
42102
  this.focusGroup = function (groupId) {
42072
42103
  var sceneGroup = _this.groups.find(function (x) { return x.id == groupId; });
42073
- if (sceneGroup && sceneGroup.cameraLocationId)
42104
+ if (sceneGroup && sceneGroup.cameraLocationId) {
42074
42105
  _this.viewer.setCameraLocation(sceneGroup.cameraLocationId);
42106
+ _this.lastCameraLocation = sceneGroup.cameraLocationId;
42107
+ }
42075
42108
  };
42076
42109
  this.focusAttribute = function (attributeId) { return __awaiter(_this, void 0, void 0, function () {
42077
42110
  var unselectedOptionsActions, attribute;
@@ -42083,8 +42116,10 @@ var ZakekeEnvironment = /** @class */ (function () {
42083
42116
  case 1:
42084
42117
  _a.sent();
42085
42118
  attribute = this.zkProduct.get("attributes").find(function (attribute) { return attribute.get('attributeID') == attributeId; });
42086
- if (attribute && attribute.get("sceneCameraLocationID"))
42119
+ if (attribute && attribute.get("sceneCameraLocationID")) {
42087
42120
  this.viewer.setCameraLocation(attribute.get("sceneCameraLocationID"));
42121
+ this.lastCameraLocation = attribute.get("sceneCameraLocationID");
42122
+ }
42088
42123
  return [2 /*return*/];
42089
42124
  }
42090
42125
  });
@@ -42100,7 +42135,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42100
42135
  this.setCameraLocation('buy_screenshot_camera', false);
42101
42136
  else
42102
42137
  this.viewer.restoreCameraState();
42103
- return [4 /*yield*/, Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["sleep"])(1)];
42138
+ return [4 /*yield*/, Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["sleep"])(1)];
42104
42139
  case 2:
42105
42140
  _a.sent();
42106
42141
  // Save composition
@@ -42123,7 +42158,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42123
42158
  _this.viewer.zoomOut();
42124
42159
  };
42125
42160
  this.isFullscreenEnabled = function () {
42126
- return !_helpers__WEBPACK_IMPORTED_MODULE_0__["iOS"];
42161
+ return !_helpers__WEBPACK_IMPORTED_MODULE_2__["iOS"];
42127
42162
  };
42128
42163
  this.switchFullscreen = function () {
42129
42164
  var interval = null;
@@ -42213,7 +42248,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42213
42248
  var zkScene = _this.zkScene;
42214
42249
  if (color.indexOf("rgb") == 0) {
42215
42250
  var values = color.replace("rgb(", "").replace(")", "").split(",");
42216
- color = Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["rgb2hex"])(values[0], values[1], values[2]);
42251
+ color = Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["rgb2hex"])(values[0], values[1], values[2]);
42217
42252
  }
42218
42253
  if (_this.viewer && zkScene) {
42219
42254
  zkScene.getOrCreateEnvironmentConfig().set("mainColor", color);
@@ -42222,7 +42257,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42222
42257
  }
42223
42258
  };
42224
42259
  this.getCurrentSelection = function () {
42225
- return lodash__WEBPACK_IMPORTED_MODULE_7___default.a.cloneDeep(_this.platformAttributesSelection);
42260
+ return lodash__WEBPACK_IMPORTED_MODULE_0___default.a.cloneDeep(_this.platformAttributesSelection);
42226
42261
  };
42227
42262
  this.getScreenshot = function (width, height, backgroundColor) {
42228
42263
  if (width === void 0) { width = 1024; }
@@ -42338,7 +42373,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42338
42373
  switch (_a.label) {
42339
42374
  case 0:
42340
42375
  if (!this.viewer) return [3 /*break*/, 2];
42341
- imageTask = new _imageUploadTask__WEBPACK_IMPORTED_MODULE_5__["default"](this.culture, this.token);
42376
+ imageTask = new _imageUploadTask__WEBPACK_IMPORTED_MODULE_1__["default"](this.culture, this.token);
42342
42377
  return [4 /*yield*/, imageTask.upload(file, progress)];
42343
42378
  case 1:
42344
42379
  result = _a.sent();
@@ -42354,7 +42389,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42354
42389
  switch (_a.label) {
42355
42390
  case 0:
42356
42391
  if (!this.viewer) return [3 /*break*/, 2];
42357
- return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_6__["axiosApi"].post(Zakeke.config.baseApiUrl + "images/import/url", {
42392
+ return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_7__["axiosApi"].post(Zakeke.config.baseApiUrl + "images/import/url", {
42358
42393
  url: url
42359
42394
  })];
42360
42395
  case 1:
@@ -42459,7 +42494,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42459
42494
  var macroCategories, _i, macroCategories_1, macroCategory;
42460
42495
  return __generator(this, function (_a) {
42461
42496
  switch (_a.label) {
42462
- case 0: return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_6__["axiosApi"].get(Zakeke.config.baseApiUrl + "imagemacrocategories/")];
42497
+ case 0: return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_7__["axiosApi"].get(Zakeke.config.baseApiUrl + "imagemacrocategories/")];
42463
42498
  case 1:
42464
42499
  macroCategories = (_a.sent()).data;
42465
42500
  macroCategories = macroCategories.filter(function (x) { return x.hasImages; });
@@ -42474,7 +42509,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42474
42509
  this.getImages = function (categoryId) { return __awaiter(_this, void 0, void 0, function () {
42475
42510
  return __generator(this, function (_a) {
42476
42511
  switch (_a.label) {
42477
- case 0: return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_6__["axiosApi"].get(Zakeke.config.baseApiUrl + "images/", {
42512
+ case 0: return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_7__["axiosApi"].get(Zakeke.config.baseApiUrl + "images/", {
42478
42513
  params: {
42479
42514
  type: 'lib',
42480
42515
  c: categoryId
@@ -42485,33 +42520,42 @@ var ZakekeEnvironment = /** @class */ (function () {
42485
42520
  });
42486
42521
  }); };
42487
42522
  this.getPDF = function () { return __awaiter(_this, void 0, void 0, function () {
42488
- var data, params, pdf;
42489
- return __generator(this, function (_a) {
42490
- switch (_a.label) {
42523
+ var data, items, areas, selectedOptions, params, pdf;
42524
+ var _this = this;
42525
+ var _a;
42526
+ return __generator(this, function (_b) {
42527
+ switch (_b.label) {
42491
42528
  case 0: return [4 /*yield*/, this.getScreenshot(2048, 2048)];
42492
42529
  case 1:
42493
- data = _a.sent();
42530
+ data = _b.sent();
42531
+ items = this.getDesignItemsInfo();
42532
+ areas = (_a = this.product) === null || _a === void 0 ? void 0 : _a.areas.filter(function (x) { return _this.isAreaVisible(x.id); }).map(function (x) { return ({
42533
+ name: x.name,
42534
+ textItems: items.filter(function (i) { return i.areaId == x.id; })
42535
+ }); }).filter(function (x) { return x.textItems.length > 0; });
42536
+ selectedOptions = this.platformAttributesSelection.filter(function (x) { return x.attributeIsEnabled && x.attributeIsEnabled; }).map(function (_a) {
42537
+ var attributeLabel = _a.attributeLabel, attributeCode = _a.attributeCode, optionCode = _a.optionCode, optionLabel = _a.optionLabel;
42538
+ return ({
42539
+ attributeLabel: attributeLabel,
42540
+ attributeCode: !Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["isPlatformCode"])(attributeCode) ? attributeCode : '',
42541
+ optionLabel: optionLabel,
42542
+ optionCode: !Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["isPlatformCode"])(optionCode) ? optionCode : '',
42543
+ });
42544
+ });
42494
42545
  params = {
42495
42546
  environment: 2,
42496
42547
  productName: this.zkProduct.get('name'),
42497
- sides: [],
42498
42548
  previewImage: data,
42499
- selectedOptions: this.platformAttributesSelection.filter(function (x) { return x.attributeIsEnabled && x.attributeIsEnabled; }).map(function (_a) {
42500
- var attributeLabel = _a.attributeLabel, attributeCode = _a.attributeCode, optionCode = _a.optionCode, optionLabel = _a.optionLabel;
42501
- return ({
42502
- attributeLabel: attributeLabel,
42503
- attributeCode: !Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["isPlatformCode"])(attributeCode) ? attributeCode : '',
42504
- optionLabel: optionLabel,
42505
- optionCode: !Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["isPlatformCode"])(optionCode) ? optionCode : '',
42506
- });
42507
- })
42549
+ sides: [],
42550
+ areas: areas,
42551
+ selectedOptions: selectedOptions,
42508
42552
  };
42509
- return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_6__["axiosApi"].post(Zakeke.config.baseApiUrl + "previewdesigns/pdf", params, {
42553
+ return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_7__["axiosApi"].post(Zakeke.config.baseApiUrl + "previewdesigns/pdf", params, {
42510
42554
  transformResponse: function (res) { return res; },
42511
42555
  responseType: "text"
42512
42556
  })];
42513
42557
  case 2:
42514
- pdf = (_a.sent()).data.replace(/"/g, "");
42558
+ pdf = (_b.sent()).data.replace(/"/g, "");
42515
42559
  return [2 /*return*/, pdf];
42516
42560
  }
42517
42561
  });
@@ -42537,7 +42581,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42537
42581
  case 0: return [4 /*yield*/, this.getScreenshot(width, height, backgroundColor)];
42538
42582
  case 1:
42539
42583
  preview = _a.sent();
42540
- return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_6__["axiosApi"].post(Zakeke.config.baseApiUrl + "designs/save-share-preview", { preview: preview })];
42584
+ return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_7__["axiosApi"].post(Zakeke.config.baseApiUrl + "designs/save-share-preview", { preview: preview })];
42541
42585
  case 2:
42542
42586
  url = (_a.sent()).data.url;
42543
42587
  url = this.rewriteShareUrl(url);
@@ -42626,7 +42670,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42626
42670
  case 0:
42627
42671
  url = null;
42628
42672
  if (!this.zkScene) return [3 /*break*/, 7];
42629
- if (!_helpers__WEBPACK_IMPORTED_MODULE_0__["IS_IOS"]) return [3 /*break*/, 3];
42673
+ if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["IS_IOS"]) return [3 /*break*/, 3];
42630
42674
  _a = this.getPregeneratedARUrl('usdz');
42631
42675
  if (_a) return [3 /*break*/, 2];
42632
42676
  return [4 /*yield*/, this.viewer.exportSceneToUsdzAsync(this.zkScene.get('sceneID'), this.selection.getCompositionHashCode(), useCacheWithDesign)];
@@ -42653,7 +42697,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42653
42697
  }); };
42654
42698
  this.openArMobile = function (url) {
42655
42699
  if (_this.viewer && _this.zkScene) {
42656
- if (_helpers__WEBPACK_IMPORTED_MODULE_0__["IS_IOS"]) {
42700
+ if (_helpers__WEBPACK_IMPORTED_MODULE_2__["IS_IOS"]) {
42657
42701
  if (url && !_this.zkScene.getARScale())
42658
42702
  url += '#allowsContentScaling=0';
42659
42703
  var anchor = document.createElement('a');
@@ -42662,7 +42706,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42662
42706
  anchor.appendChild(document.createElement('img'));
42663
42707
  anchor.click();
42664
42708
  }
42665
- else if (_helpers__WEBPACK_IMPORTED_MODULE_0__["IS_ANDROID"]) {
42709
+ else if (_helpers__WEBPACK_IMPORTED_MODULE_2__["IS_ANDROID"]) {
42666
42710
  _3D_src__WEBPACK_IMPORTED_MODULE_8__["AndroidAR"].openSceneViewer(url, function () {
42667
42711
  alert('Device not supported.');
42668
42712
  }, _this.zkScene.getARScale());
@@ -42679,7 +42723,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42679
42723
  _a.label = 1;
42680
42724
  case 1:
42681
42725
  _a.trys.push([1, 3, , 4]);
42682
- return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_6__["axiosApi"].post(Zakeke.config.baseApiUrl + 'viewscount/addview', {
42726
+ return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_7__["axiosApi"].post(Zakeke.config.baseApiUrl + 'viewscount/addview', {
42683
42727
  productID: this.zkProduct.get('modelID'),
42684
42728
  environment: this.zkProduct.get('environment')
42685
42729
  })];
@@ -42737,6 +42781,17 @@ var ZakekeEnvironment = /** @class */ (function () {
42737
42781
  }
42738
42782
  }
42739
42783
  };
42784
+ /**
42785
+ * Change opacity for a specific mesh
42786
+ * @param meshId The mesh to change the opacity
42787
+ * @param opacity The opacity to set
42788
+ */
42789
+ this.setMeshDesignVisibility = function (meshId, visible) {
42790
+ if (_this.viewer) {
42791
+ _this.viewer.setDesignVisibility(meshId, visible);
42792
+ _this.viewer.setRenderingNeeded();
42793
+ }
42794
+ };
42740
42795
  // Events
42741
42796
  this.addFocusAttributesListener = function (listenerFunction) {
42742
42797
  if (_this.viewer)
@@ -42808,7 +42863,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42808
42863
  this.updatePrice();
42809
42864
  };
42810
42865
  ZakekeEnvironment.prototype.createStep = function (zkStep, groupSelection) {
42811
- var step = new _models__WEBPACK_IMPORTED_MODULE_4__["Step"]();
42866
+ var step = new _models__WEBPACK_IMPORTED_MODULE_6__["Step"]();
42812
42867
  step.id = zkStep.get("stepID");
42813
42868
  step.guid = zkStep.get("stepGuid");
42814
42869
  step.name = zkStep.get("name");
@@ -42831,6 +42886,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42831
42886
  };
42832
42887
  ZakekeEnvironment.prototype.setCamera = function (cameraLocationId, onlyAngleOfView, animate) {
42833
42888
  this.viewer.setCameraLocation(cameraLocationId, onlyAngleOfView, animate);
42889
+ this.lastCameraLocation = cameraLocationId;
42834
42890
  };
42835
42891
  ZakekeEnvironment.prototype.getCameraByName = function (name) {
42836
42892
  var _a;
@@ -42850,7 +42906,7 @@ var ZakekeEnvironment = /** @class */ (function () {
42850
42906
  var items = [];
42851
42907
  if (this.viewer) {
42852
42908
  items = (_b = (_a = this.viewer.getDesignItemsInfo()) === null || _a === void 0 ? void 0 : _a.map(function (item) {
42853
- return item instanceof MPlaza.ImageItemInfo ? new _models__WEBPACK_IMPORTED_MODULE_4__["ImageItem"](item) : new _models__WEBPACK_IMPORTED_MODULE_4__["TextItem"](item);
42909
+ return item instanceof MPlaza.ImageItemInfo ? new _models__WEBPACK_IMPORTED_MODULE_6__["ImageItem"](item) : new _models__WEBPACK_IMPORTED_MODULE_6__["TextItem"](item);
42854
42910
  })) !== null && _b !== void 0 ? _b : [];
42855
42911
  }
42856
42912
  return items;
@@ -44566,9 +44622,11 @@ var createProviderValue = function (state, dispatch) {
44566
44622
  getMeshIDbyName: state.environment.getMeshIDbyName.bind(state.environment),
44567
44623
  hideMeshAndSaveState: state.environment.hideMeshAndSaveState.bind(state.environment),
44568
44624
  restoreMeshVisibility: state.environment.restoreMeshVisibility.bind(state.environment),
44625
+ setMeshDesignVisibility: state.environment.setMeshDesignVisibility.bind(state.environment),
44569
44626
  // Events
44570
44627
  clearListeners: state.environment.clearListeners,
44571
44628
  addFocusAttributesListener: state.environment.addFocusAttributesListener,
44629
+ focusAttribute: state.environment.focusAttribute,
44572
44630
  // AR
44573
44631
  getQrCodeArUrl: state.environment.getQrCodeArUrl,
44574
44632
  getMobileArUrl: state.environment.getMobileArUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zakeke-configurator-react",
3
- "version": "0.0.60",
3
+ "version": "0.0.64",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/declarations/composer/Module/src/index.d.ts",