zakeke-configurator-react 0.0.203 → 0.0.205

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.
@@ -53,7 +53,7 @@ export interface TryOnProviderProps {
53
53
  onReady?: () => void;
54
54
  onLoaded?: () => void;
55
55
  onClose?: () => void;
56
- onPDUpdated: (pd: number) => void;
56
+ onPDUpdated?: (pd: number) => void;
57
57
  onWebcamError: () => void;
58
58
  }
59
59
  export interface PupillaryDistanceProviderProps {
@@ -23,7 +23,7 @@ export interface TryOnViewProps {
23
23
  onReady?: () => void;
24
24
  onLoaded?: () => void;
25
25
  onClose: () => void;
26
- onPDUpdated: (pd: number) => void;
26
+ onPDUpdated?: (pd: number) => void;
27
27
  onWebcamError: () => void;
28
28
  }
29
29
  export declare const TryOnView: FunctionComponent<TryOnViewProps>;
@@ -71,6 +71,7 @@ export declare class ZakekeEnvironment {
71
71
  currentAttributesSelection: Object | null;
72
72
  currentCompositionInfo: CurrentCompositionInfo | null;
73
73
  private copyrightMessageLocalStorageKey;
74
+ private isPupillaryDistanceMandatory;
74
75
  sellerSettings: SellerSettings | null;
75
76
  get internalProduct(): MPlaza.Model | null;
76
77
  get internalScene(): Zakeke.Scene | null;
@@ -107,7 +108,7 @@ export declare class ZakekeEnvironment {
107
108
  visibleEventMessages: VisibleEventMessage[];
108
109
  tryOnProductSettings: TryOnProduct | null;
109
110
  tryOnSellerSettings: TryOnSeller | null;
110
- private pdSettings;
111
+ pdSettings: number;
111
112
  isInfoPointContentVisible: boolean;
112
113
  private internalTranslations;
113
114
  private integrationVersion;
@@ -317,9 +318,11 @@ export declare class ZakekeEnvironment {
317
318
  get canUseTryOn(): boolean;
318
319
  get canUsePD(): boolean;
319
320
  get isVisibleMeshShownForTryOn(): boolean;
321
+ get isMandatoryPD(): boolean;
320
322
  get isTryOnMeshVisible(): boolean;
321
323
  get tryOnMeshVisibleSettings(): TryOnGenericFineTuningSettings | undefined;
322
- setPDDistance: (distance: number) => Promise<void>;
324
+ setPDDistance: (distance: number) => void;
325
+ pdDistance: () => number;
323
326
  exportTryOnMesh: () => Promise<Blob | null>;
324
327
  getTryOnSettings: () => Zakeke.TryOnSettings | undefined;
325
328
  tryOnCountView: (sellerID: number, providerID: number, modeChosen: TryOnMode) => Promise<void>;
@@ -1,6 +1,8 @@
1
- import { FC } from 'react';
1
+ import React, { FC } from 'react';
2
2
  import { BootParameters } from '..';
3
- declare const Boot: FC<{
3
+ export interface BootProps {
4
4
  parameters?: BootParameters | null;
5
- }>;
5
+ children?: React.ReactNode;
6
+ }
7
+ declare const Boot: FC<BootProps>;
6
8
  export default Boot;
@@ -195,7 +195,9 @@ export interface Zakeke {
195
195
  canUsePD: boolean;
196
196
  getTryOnSettings: () => Zakeke.TryOnSettings | undefined;
197
197
  isTryOnMeshVisible: boolean;
198
+ isMandatoryPD: boolean;
198
199
  isVisibleMeshShownForTryOn: boolean;
199
200
  setPDDistance: (distance: number) => void;
201
+ pdDistance: () => number;
200
202
  }
201
203
  export {};
package/dist/index.js CHANGED
@@ -61291,6 +61291,7 @@ __webpack_require__.r(__webpack_exports__);
61291
61291
  /* harmony import */ var _tryOnModels__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../tryOnModels */ "./src/components/tryon/tryOnModels.ts");
61292
61292
  /* harmony import */ var _hooks_tryonContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../hooks/tryonContext */ "./src/hooks/tryonContext.ts");
61293
61293
  /* harmony import */ var _tryOnFrame__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../tryOnFrame */ "./src/components/tryon/tryOnFrame.tsx");
61294
+ /* harmony import */ var _state_provider__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../state/provider */ "./src/state/provider.tsx");
61294
61295
  var _templateObject,
61295
61296
  _this = undefined;
61296
61297
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
@@ -61312,6 +61313,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
61312
61313
 
61313
61314
 
61314
61315
 
61316
+
61315
61317
  // #region interfaces
61316
61318
  var MazingTryOnBaseReceivedMessage = {
61317
61319
  WaitingAuthentication: 'WAITING_AUTH',
@@ -61350,6 +61352,10 @@ var MazingTryOnComponentContainer = styled_components__WEBPACK_IMPORTED_MODULE_1
61350
61352
  // #region virtual try on
61351
61353
 
61352
61354
  var MazingTryOn = function MazingTryOn(props) {
61355
+ var internalState = (0,_state_provider__WEBPACK_IMPORTED_MODULE_5__.useInternalState)();
61356
+ var stateRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(internalState);
61357
+ stateRef.current = internalState;
61358
+ var store = stateRef.current.state.environment;
61353
61359
  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({}),
61354
61360
  _useState2 = _slicedToArray(_useState, 2),
61355
61361
  tryOnState = _useState2[0],
@@ -61428,7 +61434,7 @@ var MazingTryOn = function MazingTryOn(props) {
61428
61434
  (_props$onLoaded2 = props.onLoaded) === null || _props$onLoaded2 === void 0 ? void 0 : _props$onLoaded2.call(props);
61429
61435
  break;
61430
61436
  case MazingPupillaryDistanceStateReceivedMessage.PDUpdated:
61431
- console.log('PD updated', (_tryOnState$value = tryOnState.value) === null || _tryOnState$value === void 0 ? void 0 : _tryOnState$value.pd);
61437
+ store.setPDDistance((_tryOnState$value = tryOnState.value) === null || _tryOnState$value === void 0 ? void 0 : _tryOnState$value.pd);
61432
61438
  (_props$onPDUpdated = props.onPDUpdated) === null || _props$onPDUpdated === void 0 ? void 0 : _props$onPDUpdated.call(props, (_tryOnState$value2 = tryOnState.value) === null || _tryOnState$value2 === void 0 ? void 0 : _tryOnState$value2.pd);
61433
61439
  break;
61434
61440
  case MazingPupillaryDistanceStateReceivedMessage.PDDataNotFoundError:
@@ -61475,6 +61481,10 @@ var MazingPupillaryDistance = function MazingPupillaryDistance(props) {
61475
61481
  var _useZakekeTryOn2 = (0,_hooks_tryonContext__WEBPACK_IMPORTED_MODULE_3__.useZakekeTryOn)(),
61476
61482
  tryon = _useZakekeTryOn2.tryon,
61477
61483
  setTryon = _useZakekeTryOn2.setTryon;
61484
+ var internalState = (0,_state_provider__WEBPACK_IMPORTED_MODULE_5__.useInternalState)();
61485
+ var stateRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(internalState);
61486
+ stateRef.current = internalState;
61487
+ var store = stateRef.current.state.environment;
61478
61488
  var _useState9 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),
61479
61489
  _useState10 = _slicedToArray(_useState9, 2),
61480
61490
  frameWindow = _useState10[0],
@@ -61522,6 +61532,7 @@ var MazingPupillaryDistance = function MazingPupillaryDistance(props) {
61522
61532
  (_props$onLoaded3 = props.onLoaded) === null || _props$onLoaded3 === void 0 ? void 0 : _props$onLoaded3.call(props);
61523
61533
  break;
61524
61534
  case MazingPupillaryDistanceStateReceivedMessage.PDUpdated:
61535
+ store.setPDDistance(pdState.value.pd);
61525
61536
  (_props$onPDUpdated2 = props.onPDUpdated) === null || _props$onPDUpdated2 === void 0 ? void 0 : _props$onPDUpdated2.call(props, pdState.value.pd);
61526
61537
  break;
61527
61538
  case MazingPupillaryDistanceStateReceivedMessage.PDDataNotFoundError:
@@ -61911,6 +61922,7 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
61911
61922
  _defineProperty(this, "currentAttributesSelection", null);
61912
61923
  _defineProperty(this, "currentCompositionInfo", null);
61913
61924
  _defineProperty(this, "copyrightMessageLocalStorageKey", '');
61925
+ _defineProperty(this, "isPupillaryDistanceMandatory", false);
61914
61926
  _defineProperty(this, "sellerSettings", null);
61915
61927
  _defineProperty(this, "themeCompositions", null);
61916
61928
  _defineProperty(this, "currency", 'EUR');
@@ -61941,7 +61953,7 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
61941
61953
  _defineProperty(this, "visibleEventMessages", []);
61942
61954
  _defineProperty(this, "tryOnProductSettings", null);
61943
61955
  _defineProperty(this, "tryOnSellerSettings", null);
61944
- _defineProperty(this, "pdSettings", null);
61956
+ _defineProperty(this, "pdSettings", -1);
61945
61957
  _defineProperty(this, "isInfoPointContentVisible", false);
61946
61958
  _defineProperty(this, "internalTranslations", {
61947
61959
  statics: [],
@@ -62484,7 +62496,8 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
62484
62496
  */
62485
62497
  _defineProperty(this, "boot", /*#__PURE__*/function () {
62486
62498
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(parameters) {
62487
- var staticTranslations, dynamicTranslations, composerModels, promises;
62499
+ var _this$zkScene2, _this$zkScene2$getTry, _tryOnSettings$typeSe;
62500
+ var staticTranslations, dynamicTranslations, composerModels, promises, tryOnSettings;
62488
62501
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
62489
62502
  while (1) switch (_context15.prev = _context15.next) {
62490
62503
  case 0:
@@ -62659,10 +62672,12 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
62659
62672
  return _this.viewer.loadSceneFromModelAsync(_this.zkProduct, _this.zkScene);
62660
62673
  case 55:
62661
62674
  if (_this.settings.brand) _this.viewer.createBrandLogoButton();
62675
+ tryOnSettings = (_this$zkScene2 = _this.zkScene) === null || _this$zkScene2 === void 0 ? void 0 : (_this$zkScene2$getTry = _this$zkScene2.getTryOnSettings) === null || _this$zkScene2$getTry === void 0 ? void 0 : _this$zkScene2$getTry.call(_this$zkScene2);
62676
+ if (tryOnSettings !== null && tryOnSettings !== void 0 && (_tryOnSettings$typeSe = tryOnSettings.typeSettings) !== null && _tryOnSettings$typeSe !== void 0 && _tryOnSettings$typeSe.mandatoryPD) _this.isPupillaryDistanceMandatory = true;
62662
62677
  _this.trigger('change');
62663
- _context15.next = 59;
62678
+ _context15.next = 61;
62664
62679
  return _this.handleSceneLoaded();
62665
- case 59:
62680
+ case 61:
62666
62681
  case "end":
62667
62682
  return _context15.stop();
62668
62683
  }
@@ -64104,7 +64119,7 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
64104
64119
  }());
64105
64120
  _defineProperty(this, "addToCart", /*#__PURE__*/function () {
64106
64121
  var _ref39 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(additionalProperties, onBeforeSendDataToParent, legacyScreenshot, nftForm) {
64107
- var _this$zkScene2;
64122
+ var _this$zkScene3;
64108
64123
  var compositionClientPreviews, sortedBuyScreenshotCameras, buyScreenshotCameras, _iterator6, _step6, camera, preview, formData, file, previewCameraFile;
64109
64124
  return _regeneratorRuntime().wrap(function _callee38$(_context39) {
64110
64125
  while (1) switch (_context39.prev = _context39.next) {
@@ -64116,7 +64131,7 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
64116
64131
  _this.composition.set('compositionClientPreviews', []);
64117
64132
  compositionClientPreviews = [];
64118
64133
  sortedBuyScreenshotCameras = [];
64119
- buyScreenshotCameras = (_this$zkScene2 = _this.zkScene) === null || _this$zkScene2 === void 0 ? void 0 : _this$zkScene2.get('cameraLocations').filter(function (x) {
64134
+ buyScreenshotCameras = (_this$zkScene3 = _this.zkScene) === null || _this$zkScene3 === void 0 ? void 0 : _this$zkScene3.get('cameraLocations').filter(function (x) {
64120
64135
  var _x$get;
64121
64136
  return ((_x$get = x.get('name')) === null || _x$get === void 0 ? void 0 : _x$get.toLowerCase().indexOf('buy_screenshot_camera_')) !== -1;
64122
64137
  });
@@ -64974,8 +64989,8 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
64974
64989
  }());
64975
64990
  // AR - Augmented Reality
64976
64991
  _defineProperty(this, "isSceneArOnTheFly", function () {
64977
- var _this$zkScene3;
64978
- if (_this.viewer) return (_this$zkScene3 = _this.zkScene) === null || _this$zkScene3 === void 0 ? void 0 : _this$zkScene3.getAROnTheFly();
64992
+ var _this$zkScene4;
64993
+ if (_this.viewer) return (_this$zkScene4 = _this.zkScene) === null || _this$zkScene4 === void 0 ? void 0 : _this$zkScene4.getAROnTheFly();
64979
64994
  return false;
64980
64995
  });
64981
64996
  _defineProperty(this, "isArDeviceCompliant", function () {
@@ -65030,10 +65045,10 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
65030
65045
  return false;
65031
65046
  });
65032
65047
  _defineProperty(this, "getPregeneratedARUrl", function (fileType) {
65033
- var _this$zkScene4, _this$zkScene4$get, _this$zkScene4$get$fi;
65034
- return (_this$zkScene4 = _this.zkScene) === null || _this$zkScene4 === void 0 ? void 0 : (_this$zkScene4$get = _this$zkScene4.get('arFiles')) === null || _this$zkScene4$get === void 0 ? void 0 : (_this$zkScene4$get$fi = _this$zkScene4$get.find(function (x) {
65048
+ var _this$zkScene5, _this$zkScene5$get, _this$zkScene5$get$fi;
65049
+ return (_this$zkScene5 = _this.zkScene) === null || _this$zkScene5 === void 0 ? void 0 : (_this$zkScene5$get = _this$zkScene5.get('arFiles')) === null || _this$zkScene5$get === void 0 ? void 0 : (_this$zkScene5$get$fi = _this$zkScene5$get.find(function (x) {
65035
65050
  return x.get('fileType') == fileType;
65036
- })) === null || _this$zkScene4$get$fi === void 0 ? void 0 : _this$zkScene4$get$fi.get('url');
65051
+ })) === null || _this$zkScene5$get$fi === void 0 ? void 0 : _this$zkScene5$get$fi.get('url');
65037
65052
  });
65038
65053
  _defineProperty(this, "getQrCodeArUrl", /*#__PURE__*/function () {
65039
65054
  var _ref62 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(device) {
@@ -65409,13 +65424,13 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
65409
65424
  });
65410
65425
  _defineProperty(this, "saveComposition", /*#__PURE__*/function () {
65411
65426
  var _ref66 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(customPreviewSize, legacyScreenshot, isSharing) {
65412
- var _this$zkScene5, _customPreviewSize$cu, _customPreviewSize$cu2;
65427
+ var _this$zkScene6, _customPreviewSize$cu, _customPreviewSize$cu2;
65413
65428
  var buyScreenshotCamera, data, design, designItems, itemsNotPlaceholders, nonStaticElementsCount;
65414
65429
  return _regeneratorRuntime().wrap(function _callee65$(_context66) {
65415
65430
  while (1) switch (_context66.prev = _context66.next) {
65416
65431
  case 0:
65417
65432
  console.log('Saving...');
65418
- buyScreenshotCamera = (_this$zkScene5 = _this.zkScene) === null || _this$zkScene5 === void 0 ? void 0 : _this$zkScene5.get('cameraLocations').find(function (x) {
65433
+ buyScreenshotCamera = (_this$zkScene6 = _this.zkScene) === null || _this$zkScene6 === void 0 ? void 0 : _this$zkScene6.get('cameraLocations').find(function (x) {
65419
65434
  var _x$get2;
65420
65435
  return ((_x$get2 = x.get('name')) === null || _x$get2 === void 0 ? void 0 : _x$get2.toLowerCase()) === 'buy_screenshot_camera';
65421
65436
  });
@@ -65816,63 +65831,53 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
65816
65831
  return _ref75.apply(this, arguments);
65817
65832
  };
65818
65833
  }());
65819
- _defineProperty(this, "setPDDistance", /*#__PURE__*/function () {
65820
- var _ref76 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(distance) {
65821
- return _regeneratorRuntime().wrap(function _callee75$(_context77) {
65822
- while (1) switch (_context77.prev = _context77.next) {
65823
- case 0:
65824
- _this.pdSettings = distance;
65825
- case 1:
65826
- case "end":
65827
- return _context77.stop();
65828
- }
65829
- }, _callee75);
65830
- }));
65831
- return function (_x72) {
65832
- return _ref76.apply(this, arguments);
65833
- };
65834
- }());
65835
- _defineProperty(this, "exportTryOnMesh", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76() {
65834
+ _defineProperty(this, "setPDDistance", function (distance) {
65835
+ _this.pdSettings = distance;
65836
+ });
65837
+ _defineProperty(this, "pdDistance", function () {
65838
+ return _this.pdSettings;
65839
+ });
65840
+ _defineProperty(this, "exportTryOnMesh", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75() {
65836
65841
  var tryOnMesh;
65837
- return _regeneratorRuntime().wrap(function _callee76$(_context78) {
65838
- while (1) switch (_context78.prev = _context78.next) {
65842
+ return _regeneratorRuntime().wrap(function _callee75$(_context77) {
65843
+ while (1) switch (_context77.prev = _context77.next) {
65839
65844
  case 0:
65840
65845
  if (_this.zkScene) {
65841
- _context78.next = 2;
65846
+ _context77.next = 2;
65842
65847
  break;
65843
65848
  }
65844
- return _context78.abrupt("return", null);
65849
+ return _context77.abrupt("return", null);
65845
65850
  case 2:
65846
65851
  if (_this.viewer) {
65847
- _context78.next = 4;
65852
+ _context77.next = 4;
65848
65853
  break;
65849
65854
  }
65850
- return _context78.abrupt("return", null);
65855
+ return _context77.abrupt("return", null);
65851
65856
  case 4:
65852
65857
  tryOnMesh = _this.viewer.getTryOnMeshVisible();
65853
65858
  if (tryOnMesh) {
65854
- _context78.next = 7;
65859
+ _context77.next = 7;
65855
65860
  break;
65856
65861
  }
65857
- return _context78.abrupt("return", null);
65862
+ return _context77.abrupt("return", null);
65858
65863
  case 7:
65859
- return _context78.abrupt("return", _this.viewer.exportMeshToGLBBlob(tryOnMesh.id));
65864
+ return _context77.abrupt("return", _this.viewer.exportMeshToGLBBlob(tryOnMesh.id));
65860
65865
  case 8:
65861
65866
  case "end":
65862
- return _context78.stop();
65867
+ return _context77.stop();
65863
65868
  }
65864
- }, _callee76);
65869
+ }, _callee75);
65865
65870
  })));
65866
65871
  _defineProperty(this, "getTryOnSettings", function () {
65867
65872
  if (_this.zkScene) return _this.zkScene.getTryOnSettings();
65868
65873
  return undefined;
65869
65874
  });
65870
65875
  _defineProperty(this, "tryOnCountView", /*#__PURE__*/function () {
65871
- var _ref78 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(sellerID, providerID, modeChosen) {
65872
- return _regeneratorRuntime().wrap(function _callee77$(_context79) {
65873
- while (1) switch (_context79.prev = _context79.next) {
65876
+ var _ref77 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(sellerID, providerID, modeChosen) {
65877
+ return _regeneratorRuntime().wrap(function _callee76$(_context78) {
65878
+ while (1) switch (_context78.prev = _context78.next) {
65874
65879
  case 0:
65875
- _context79.next = 2;
65880
+ _context78.next = 2;
65876
65881
  return _api__WEBPACK_IMPORTED_MODULE_4__.axiosApi.post(Zakeke.config.tryOnApiUrl + 'tryoncount/view', {
65877
65882
  sellerID: sellerID,
65878
65883
  providerID: providerID,
@@ -65880,12 +65885,12 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
65880
65885
  });
65881
65886
  case 2:
65882
65887
  case "end":
65883
- return _context79.stop();
65888
+ return _context78.stop();
65884
65889
  }
65885
- }, _callee77);
65890
+ }, _callee76);
65886
65891
  }));
65887
- return function (_x73, _x74, _x75) {
65888
- return _ref78.apply(this, arguments);
65892
+ return function (_x72, _x73, _x74) {
65893
+ return _ref77.apply(this, arguments);
65889
65894
  };
65890
65895
  }());
65891
65896
  }
@@ -66013,34 +66018,34 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
66013
66018
  }, {
66014
66019
  key: "selectOptionsbyPrompt",
66015
66020
  value: function () {
66016
- var _selectOptionsbyPrompt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(prompt) {
66021
+ var _selectOptionsbyPrompt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(prompt) {
66017
66022
  var _this$product2,
66018
66023
  _this3 = this;
66019
66024
  var response, _iterator12, _step12, _loop10;
66020
- return _regeneratorRuntime().wrap(function _callee78$(_context81) {
66021
- while (1) switch (_context81.prev = _context81.next) {
66025
+ return _regeneratorRuntime().wrap(function _callee77$(_context80) {
66026
+ while (1) switch (_context80.prev = _context80.next) {
66022
66027
  case 0:
66023
66028
  if (prompt) {
66024
- _context81.next = 2;
66029
+ _context80.next = 2;
66025
66030
  break;
66026
66031
  }
66027
66032
  throw new Error('Invalid prompt');
66028
66033
  case 2:
66029
- _context81.next = 4;
66034
+ _context80.next = 4;
66030
66035
  return _api__WEBPACK_IMPORTED_MODULE_4__.axiosApi.get(Zakeke.config.baseApiUrl + 'ai/configuration-by-prompt', {
66031
66036
  params: {
66032
66037
  productId: (_this$product2 = this.product) === null || _this$product2 === void 0 ? void 0 : _this$product2.id
66033
66038
  }
66034
66039
  });
66035
66040
  case 4:
66036
- response = _context81.sent.data;
66041
+ response = _context80.sent.data;
66037
66042
  _iterator12 = _createForOfIteratorHelper(response);
66038
- _context81.prev = 6;
66043
+ _context80.prev = 6;
66039
66044
  _loop10 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop10() {
66040
66045
  var _this3$groups$flatMap;
66041
66046
  var _step12$value, attributeName, optionName, optionId;
66042
- return _regeneratorRuntime().wrap(function _loop10$(_context80) {
66043
- while (1) switch (_context80.prev = _context80.next) {
66047
+ return _regeneratorRuntime().wrap(function _loop10$(_context79) {
66048
+ while (1) switch (_context79.prev = _context79.next) {
66044
66049
  case 0:
66045
66050
  _step12$value = _slicedToArray(_step12.value, 2), attributeName = _step12$value[0], optionName = _step12$value[1];
66046
66051
  optionId = (_this3$groups$flatMap = _this3.groups.flatMap(function (x) {
@@ -66055,38 +66060,38 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
66055
66060
  }
66056
66061
  case 3:
66057
66062
  case "end":
66058
- return _context80.stop();
66063
+ return _context79.stop();
66059
66064
  }
66060
66065
  }, _loop10);
66061
66066
  });
66062
66067
  _iterator12.s();
66063
66068
  case 9:
66064
66069
  if ((_step12 = _iterator12.n()).done) {
66065
- _context81.next = 13;
66070
+ _context80.next = 13;
66066
66071
  break;
66067
66072
  }
66068
- return _context81.delegateYield(_loop10(), "t0", 11);
66073
+ return _context80.delegateYield(_loop10(), "t0", 11);
66069
66074
  case 11:
66070
- _context81.next = 9;
66075
+ _context80.next = 9;
66071
66076
  break;
66072
66077
  case 13:
66073
- _context81.next = 18;
66078
+ _context80.next = 18;
66074
66079
  break;
66075
66080
  case 15:
66076
- _context81.prev = 15;
66077
- _context81.t1 = _context81["catch"](6);
66078
- _iterator12.e(_context81.t1);
66081
+ _context80.prev = 15;
66082
+ _context80.t1 = _context80["catch"](6);
66083
+ _iterator12.e(_context80.t1);
66079
66084
  case 18:
66080
- _context81.prev = 18;
66085
+ _context80.prev = 18;
66081
66086
  _iterator12.f();
66082
- return _context81.finish(18);
66087
+ return _context80.finish(18);
66083
66088
  case 21:
66084
66089
  case "end":
66085
- return _context81.stop();
66090
+ return _context80.stop();
66086
66091
  }
66087
- }, _callee78, this, [[6, 15, 18, 21]]);
66092
+ }, _callee77, this, [[6, 15, 18, 21]]);
66088
66093
  }));
66089
- function selectOptionsbyPrompt(_x76) {
66094
+ function selectOptionsbyPrompt(_x75) {
66090
66095
  return _selectOptionsbyPrompt.apply(this, arguments);
66091
66096
  }
66092
66097
  return selectOptionsbyPrompt;
@@ -66100,8 +66105,8 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
66100
66105
  }, {
66101
66106
  key: "getCameraByName",
66102
66107
  value: function getCameraByName(name) {
66103
- var _this$zkScene6;
66104
- var location = (_this$zkScene6 = this.zkScene) === null || _this$zkScene6 === void 0 ? void 0 : _this$zkScene6.get('cameraLocations').find(function (x) {
66108
+ var _this$zkScene7;
66109
+ var location = (_this$zkScene7 = this.zkScene) === null || _this$zkScene7 === void 0 ? void 0 : _this$zkScene7.get('cameraLocations').find(function (x) {
66105
66110
  return x.get('name') == name;
66106
66111
  });
66107
66112
  return location;
@@ -66156,13 +66161,13 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
66156
66161
  }, {
66157
66162
  key: "addItemText",
66158
66163
  value: function () {
66159
- var _addItemText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(settings, areaId) {
66164
+ var _addItemText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(settings, areaId) {
66160
66165
  var font;
66161
- return _regeneratorRuntime().wrap(function _callee79$(_context82) {
66162
- while (1) switch (_context82.prev = _context82.next) {
66166
+ return _regeneratorRuntime().wrap(function _callee78$(_context81) {
66167
+ while (1) switch (_context81.prev = _context81.next) {
66163
66168
  case 0:
66164
66169
  if (!this.viewer) {
66165
- _context82.next = 12;
66170
+ _context81.next = 12;
66166
66171
  break;
66167
66172
  }
66168
66173
  // First download the font
@@ -66170,32 +66175,32 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
66170
66175
  return x.name === settings.fontFamily;
66171
66176
  });
66172
66177
  if (!font) {
66173
- _context82.next = 9;
66178
+ _context81.next = 9;
66174
66179
  break;
66175
66180
  }
66176
- _context82.next = 5;
66181
+ _context81.next = 5;
66177
66182
  return (0,_fontsManager__WEBPACK_IMPORTED_MODULE_6__.loadFonts)([font]);
66178
66183
  case 5:
66179
66184
  this.viewer.addDesignItemText(_objectSpread(_objectSpread({}, settings), {}, {
66180
66185
  content: settings.text
66181
66186
  }), areaId);
66182
66187
  this.renderDesign();
66183
- _context82.next = 10;
66188
+ _context81.next = 10;
66184
66189
  break;
66185
66190
  case 9:
66186
66191
  console.warn("No font found for ".concat(settings.fontFamily));
66187
66192
  case 10:
66188
- _context82.next = 13;
66193
+ _context81.next = 13;
66189
66194
  break;
66190
66195
  case 12:
66191
66196
  throw 'Called add item text but no viewer or viewer not ready';
66192
66197
  case 13:
66193
66198
  case "end":
66194
- return _context82.stop();
66199
+ return _context81.stop();
66195
66200
  }
66196
- }, _callee79, this);
66201
+ }, _callee78, this);
66197
66202
  }));
66198
- function addItemText(_x77, _x78) {
66203
+ function addItemText(_x76, _x77) {
66199
66204
  return _addItemText.apply(this, arguments);
66200
66205
  }
66201
66206
  return addItemText;
@@ -66288,6 +66293,11 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
66288
66293
  var _this$viewer4;
66289
66294
  return (_this$viewer4 = this.viewer) === null || _this$viewer4 === void 0 ? void 0 : _this$viewer4.isTryOnMeshVisibleEnabledToShow();
66290
66295
  }
66296
+ }, {
66297
+ key: "isMandatoryPD",
66298
+ get: function get() {
66299
+ return this.isPupillaryDistanceMandatory;
66300
+ }
66291
66301
  }, {
66292
66302
  key: "isTryOnMeshVisible",
66293
66303
  get: function get() {
@@ -68292,7 +68302,6 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
68292
68302
 
68293
68303
 
68294
68304
 
68295
-
68296
68305
  // Handle boot when provider is ready
68297
68306
  var Boot = function Boot(_ref) {
68298
68307
  var parameters = _ref.parameters,
@@ -68753,8 +68762,10 @@ var createProviderValue = function createProviderValue(state, dispatch) {
68753
68762
  canUseTryOn: state.environment.canUseTryOn,
68754
68763
  canUsePD: state.environment.canUsePD,
68755
68764
  isTryOnMeshVisible: state.environment.isTryOnMeshVisible,
68765
+ isMandatoryPD: state.environment.isMandatoryPD,
68756
68766
  getTryOnSettings: state.environment.getTryOnSettings.bind(state.environment),
68757
68767
  setPDDistance: state.environment.setPDDistance.bind(state.environment),
68768
+ pdDistance: state.environment.pdDistance,
68758
68769
  setCameraLocked: state.environment.setCameraLocked.bind(state.environment),
68759
68770
  getTemplateUploadRestrictictions: state.environment.getTemplateUploadRestrictictions.bind(state.environment),
68760
68771
  getShareCompositionUrl: state.environment.getShareCompositionUrl.bind(state.environment),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zakeke-configurator-react",
3
- "version": "0.0.203",
3
+ "version": "0.0.205",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/declarations/composer/Module/src/index.d.ts",