zakeke-configurator-react 0.1.373 → 0.1.375

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.
package/dist/index.js CHANGED
@@ -108943,20 +108943,21 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
108943
108943
  while (1) switch (_context9.prev = _context9.next) {
108944
108944
  case 0:
108945
108945
  quote = new _models__WEBPACK_IMPORTED_MODULE_12__.Quote();
108946
+ console.log('LOG: Creating quote for composition', _this.composition.get('docID'), 'with formData', formData);
108946
108947
  quote.formData = JSON.stringify(_this.normalizeQuoteFormData(formData));
108947
108948
  quote.quantity = _this.quantity;
108948
108949
  quote.compositionDocID = _this.composition.get('docID');
108949
- _context9.next = 6;
108950
+ _context9.next = 7;
108950
108951
  return _this.getPrice();
108951
- case 6:
108952
+ case 7:
108952
108953
  quote.modelPrice = _context9.sent.price;
108953
108954
  quote.variantName = (_name = _this.product.name) !== null && _name !== void 0 ? _name : '';
108954
- _context9.next = 10;
108955
+ _context9.next = 11;
108955
108956
  return _api__WEBPACK_IMPORTED_MODULE_4__.axiosApi.post(Zakeke.config.baseApiUrl + 'quotes', quote);
108956
- case 10:
108957
+ case 11:
108957
108958
  quoteCreated = _context9.sent.data;
108958
108959
  return _context9.abrupt("return", quoteCreated);
108959
- case 12:
108960
+ case 13:
108960
108961
  case "end":
108961
108962
  return _context9.stop();
108962
108963
  }
@@ -109151,17 +109152,18 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
109151
109152
  return _this.fetchVisitorToken(userID);
109152
109153
  case 8:
109153
109154
  _this.parseParameters(parameters);
109155
+ console.log('LOG: Booting Zakeke environment with parameters', parameters);
109154
109156
  (0,_api__WEBPACK_IMPORTED_MODULE_4__.setupApi)(_this.culture, _this.token);
109155
109157
  if (_this.zkScene && _this.zkScene.get('url') && _this.zkScene.get('url').endsWith('.glb')) {
109156
- _context15.next = 13;
109158
+ _context15.next = 14;
109157
109159
  break;
109158
109160
  }
109159
- _context15.next = 13;
109161
+ _context15.next = 14;
109160
109162
  return _this.loadLocalization();
109161
- case 13:
109162
- _context15.next = 15;
109163
+ case 14:
109164
+ _context15.next = 16;
109163
109165
  return _this.getSettings();
109164
- case 15:
109166
+ case 16:
109165
109167
  _this.settings = _context15.sent;
109166
109168
  _this.copyrightMessageLocalStorageKey = _this.settings.userID + '_copyright_accepted';
109167
109169
  _this.eventMessages = _this.settings.eventMessages.map(function (message) {
@@ -109171,9 +109173,9 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
109171
109173
  _this.isAIEnabled = (_this$settings$additi3 = (_this$settings$additi4 = _this.settings.additionalFeatures) === null || _this$settings$additi4 === void 0 ? void 0 : _this$settings$additi4.aiPoweredTools) !== null && _this$settings$additi3 !== void 0 ? _this$settings$additi3 : false;
109172
109174
 
109173
109175
  // Fetch granular AI service availability
109174
- _context15.next = 22;
109176
+ _context15.next = 23;
109175
109177
  return _this.fetchServicesAvailability();
109176
- case 22:
109178
+ case 23:
109177
109179
  servicesAvailability = _context15.sent;
109178
109180
  imageAIFeatureEnabled = (0,_generated_feature_flags__WEBPACK_IMPORTED_MODULE_6__.isFeatureEnabled)('imageAI');
109179
109181
  console.log('[AI-Studio] servicesAvailability:', servicesAvailability);
@@ -109197,9 +109199,9 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
109197
109199
  console.log('[AI-Studio] isAIStudioShoppingPreviewEnabled:', _this.isAIStudioShoppingPreviewEnabled);
109198
109200
  _this.trigger('change');
109199
109201
  _this.trigger('change');
109200
- _context15.next = 39;
109202
+ _context15.next = 40;
109201
109203
  return _this.getComposerModels();
109202
- case 39:
109204
+ case 40:
109203
109205
  composerModels = _context15.sent;
109204
109206
  if (!composerModels.get('scene').get('config')) composerModels.set('config', composerModels.get('model').get('sceneConfig'));
109205
109207
  _this.zkScene = composerModels.get('scene');
@@ -109208,45 +109210,45 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
109208
109210
  // Refine AI flags with product-level rules check
109209
109211
  productModelId = (_this$zkProduct2 = _this.zkProduct) === null || _this$zkProduct2 === void 0 ? void 0 : _this$zkProduct2.get('modelID');
109210
109212
  if (!productModelId) {
109211
- _context15.next = 59;
109213
+ _context15.next = 60;
109212
109214
  break;
109213
109215
  }
109214
109216
  if (!_this.isAiProductStagingEnabled) {
109215
- _context15.next = 50;
109217
+ _context15.next = 51;
109216
109218
  break;
109217
109219
  }
109218
- _context15.next = 48;
109220
+ _context15.next = 49;
109219
109221
  return _this.getApplicableAIStagingRules({
109220
109222
  productID: productModelId
109221
109223
  });
109222
- case 48:
109224
+ case 49:
109223
109225
  stagingRules = _context15.sent;
109224
109226
  _this.isAiProductStagingEnabled = !!stagingRules;
109225
- case 50:
109227
+ case 51:
109226
109228
  if (!_this.isAiVtoEnabled) {
109227
- _context15.next = 55;
109229
+ _context15.next = 56;
109228
109230
  break;
109229
109231
  }
109230
- _context15.next = 53;
109232
+ _context15.next = 54;
109231
109233
  return _this.getApplicableAIVirtualModelRules({
109232
109234
  productID: productModelId
109233
109235
  });
109234
- case 53:
109236
+ case 54:
109235
109237
  vtoRules = _context15.sent;
109236
109238
  _this.isAiVtoEnabled = !!vtoRules;
109237
- case 55:
109239
+ case 56:
109238
109240
  // Update master flag after product-level check
109239
109241
  _this.isAIStudioEnabled = !_this.isViewerMode && (_this.isAiProductStagingEnabled || _this.isAiVtoEnabled);
109240
109242
  console.log('[AI-Studio] After product rules check - isAiProductStagingEnabled:', _this.isAiProductStagingEnabled);
109241
109243
  console.log('[AI-Studio] After product rules check - isAiVtoEnabled:', _this.isAiVtoEnabled);
109242
109244
  console.log('[AI-Studio] After product rules check - isAIStudioEnabled:', _this.isAIStudioEnabled);
109243
- case 59:
109245
+ case 60:
109244
109246
  // Initialize defaultFontID from product
109245
109247
  _this.defaultFontID = (_this$zkProduct$get$a2 = (_this$zkProduct3 = _this.zkProduct) === null || _this$zkProduct3 === void 0 ? void 0 : (_this$zkProduct3$get = _this$zkProduct3.get('printTypes')) === null || _this$zkProduct3$get === void 0 ? void 0 : (_this$zkProduct3$get$ = _this$zkProduct3$get.at(0)) === null || _this$zkProduct3$get$ === void 0 ? void 0 : _this$zkProduct3$get$.get('printTypeDefaultFontFamilyID')) !== null && _this$zkProduct$get$a2 !== void 0 ? _this$zkProduct$get$a2 : null;
109246
109248
  statusID = (_this$zkProduct4 = _this.zkProduct) === null || _this$zkProduct4 === void 0 ? void 0 : _this$zkProduct4.get('statusID');
109247
109249
  console.log('sono prima del customEvent', statusID);
109248
109250
  if (!(statusID === 2 && _this.zkScene && _this.zkScene.get('url') && _this.zkScene.get('url').endsWith('.glb') || statusID === 2 && !_this.isShoppingPreview)) {
109249
- _context15.next = 68;
109251
+ _context15.next = 69;
109250
109252
  break;
109251
109253
  }
109252
109254
  console.log('Product unpublished, triggering event');
@@ -109256,9 +109258,9 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
109256
109258
  }
109257
109259
  });
109258
109260
  window.dispatchEvent(event);
109259
- _context15.next = 119;
109261
+ _context15.next = 120;
109260
109262
  break;
109261
- case 68:
109263
+ case 69:
109262
109264
  // fill the uiconfig with zkscene config url loader and ar icon
109263
109265
  if ((_this$zkScene = _this.zkScene) !== null && _this$zkScene !== void 0 && _this$zkScene.get('config')) {
109264
109266
  console.log('fill UIconfig and animations');
@@ -109286,10 +109288,10 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
109286
109288
  promises.push(_this.getMacroCategories());
109287
109289
  }
109288
109290
  if (_this.zkScene && _this.zkScene.get('url') && _this.zkScene.get('url').endsWith('.glb')) {
109289
- _context15.next = 82;
109291
+ _context15.next = 83;
109290
109292
  break;
109291
109293
  }
109292
- _context15.next = 80;
109294
+ _context15.next = 81;
109293
109295
  return Promise.all(promises).then(function (_ref16) {
109294
109296
  var _this$product3, _this$product4, _this$zkScene$get$map, _this$zkScene7;
109295
109297
  var _ref17 = _slicedToArray(_ref16, 9),
@@ -109334,31 +109336,31 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
109334
109336
  return _models__WEBPACK_IMPORTED_MODULE_12__.Camera.fromZkCamera(x);
109335
109337
  })) !== null && _this$zkScene$get$map !== void 0 ? _this$zkScene$get$map : [];
109336
109338
  });
109337
- case 80:
109338
- _context15.next = 84;
109339
+ case 81:
109340
+ _context15.next = 85;
109339
109341
  break;
109340
- case 82:
109341
- _context15.next = 84;
109342
+ case 83:
109343
+ _context15.next = 85;
109342
109344
  return Promise.all(promises).then(function () {
109343
109345
  return console.log('Promises for viewer resolved');
109344
109346
  });
109345
- case 84:
109347
+ case 85:
109346
109348
  if (_this.zkScene) {
109347
- _context15.next = 86;
109349
+ _context15.next = 87;
109348
109350
  break;
109349
109351
  }
109350
109352
  throw new Error('Product has no 3D scene.');
109351
- case 86:
109353
+ case 87:
109352
109354
  if (_this.tryOnProductSettings) {
109353
109355
  _this.getTryOnSellerInfo(_this.tryOnProductSettings.typeID, _this.tryOnProductSettings.providerID);
109354
109356
  }
109355
109357
  if (_this.debugMode) _this.trigger('debugMode');
109356
109358
  _this.trigger('change');
109357
- _context15.next = 91;
109359
+ _context15.next = 92;
109358
109360
  return _zakeke_zakeke_3d_core__WEBPACK_IMPORTED_MODULE_0__.SceneViewer.createSceneViewerAsync({
109359
109361
  isViewer: _this.isDAMViewer
109360
109362
  });
109361
- case 91:
109363
+ case 92:
109362
109364
  _this.viewer = _context15.sent;
109363
109365
  _this.trigger('viewer', _this.viewer);
109364
109366
  _this.viewer.isHologramSource = true;
@@ -109409,38 +109411,38 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
109409
109411
  // this.zkScene.getOrCreateGeneralConfig().set('backgroundColor', '#000000');
109410
109412
  // this.zkScene.getOrCreateGeneralConfig().set('backgroundAlpha', 0);
109411
109413
  if (_this.zkScene && _this.zkScene.get('url') && _this.zkScene.get('url').endsWith('.glb')) {
109412
- _context15.next = 105;
109414
+ _context15.next = 106;
109413
109415
  break;
109414
109416
  }
109415
- _context15.next = 104;
109417
+ _context15.next = 105;
109416
109418
  return _libs_pricingRuleBase_DesignPriceCalculatorRuleBased__WEBPACK_IMPORTED_MODULE_3__.DesignPriceCalculatorRuleFactory.create(_this.zkProduct, Zakeke.config.baseApiUrl, _this.token, true, Zakeke.config.cloudFlareApiUrl);
109417
- case 104:
109418
- _this.pricingCalculator = _context15.sent;
109419
109419
  case 105:
109420
+ _this.pricingCalculator = _context15.sent;
109421
+ case 106:
109420
109422
  if (_this.zkProduct.get('colors').length > 0) {
109421
109423
  _this.pricingCalculator.colorID = _this.zkProduct.get('colors').at(0).get('colorID');
109422
109424
  _this.integration.setPricingCalculator(_this.pricingCalculator);
109423
109425
  }
109424
109426
  if (!(_this.zkScene && _this.zkScene.get('url') && _this.zkScene.get('url').endsWith('.glb'))) {
109425
- _context15.next = 111;
109427
+ _context15.next = 112;
109426
109428
  break;
109427
109429
  }
109428
- _context15.next = 109;
109430
+ _context15.next = 110;
109429
109431
  return _this.loadSceneFromGlbUrl(_this.zkScene.get('url'), (_ref18 = _this.zkScene.get('config')) !== null && _ref18 !== void 0 ? _ref18 : new Zakeke.SceneConfig({}));
109430
- case 109:
109431
- _context15.next = 113;
109432
+ case 110:
109433
+ _context15.next = 114;
109432
109434
  break;
109433
- case 111:
109434
- _context15.next = 113;
109435
+ case 112:
109436
+ _context15.next = 114;
109435
109437
  return _this.viewer.loadSceneFromModelAsync(_this.zkProduct, _this.zkScene);
109436
- case 113:
109438
+ case 114:
109437
109439
  if (_this.settings.brand) _this.viewer.createBrandLogoButton();
109438
109440
  tryOnSettings = (_this$zkScene8 = _this.zkScene) === null || _this$zkScene8 === void 0 ? void 0 : (_this$zkScene8$getTry = _this$zkScene8.getTryOnSettings) === null || _this$zkScene8$getTry === void 0 ? void 0 : _this$zkScene8$getTry.call(_this$zkScene8);
109439
109441
  if (tryOnSettings !== null && tryOnSettings !== void 0 && (_tryOnSettings$typeSe = tryOnSettings.typeSettings) !== null && _tryOnSettings$typeSe !== void 0 && _tryOnSettings$typeSe.mandatoryPD) _this.isPupillaryDistanceMandatory = true;
109440
109442
  _this.trigger('change');
109441
- _context15.next = 119;
109443
+ _context15.next = 120;
109442
109444
  return _this.handleSceneLoaded();
109443
- case 119:
109445
+ case 120:
109444
109446
  case "end":
109445
109447
  return _context15.stop();
109446
109448
  }