zakeke-configurator-react 0.1.277-prod → 0.1.278-prod

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.
Files changed (2) hide show
  1. package/dist/index.js +54 -28
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -21411,12 +21411,35 @@ var ZakekeViewer = function ZakekeViewer(_ref) {
21411
21411
  backgroundColor = _useZakeke.backgroundColor,
21412
21412
  removeBackground = _useZakeke.removeBackground;
21413
21413
  var internalState = (0,_state_provider__WEBPACK_IMPORTED_MODULE_4__.useInternalState)();
21414
+ var _React$useState3 = react__WEBPACK_IMPORTED_MODULE_0__.useState(null),
21415
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
21416
+ stateBackgroundCol = _React$useState4[0],
21417
+ setStateBackgroundCol = _React$useState4[1];
21414
21418
  var stateRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(internalState);
21419
+ var getBackgroundColor = function getBackgroundColor() {
21420
+ var ignoreRemove = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
21421
+ var removeBackground = stateRef.current.state.environment.removeBackground;
21422
+ var backgroundColor = stateRef.current.state.environment.backgroundColor;
21423
+ if (!ignoreRemove && removeBackground) return null; // 1 non cè' il background
21424
+ if (backgroundColor) return backgroundColor; // 2 background lato config
21425
+ return bgColor !== null && bgColor !== void 0 ? bgColor : '#f2f2f2'; // 3 background lato tema o default
21426
+ };
21415
21427
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
21416
21428
  if (isViewerReady) internalAppendViewer(document.getElementById('zakeke-viewer-container-' + guid));
21417
21429
  }, [isViewerReady]);
21430
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
21431
+ setStateBackgroundCol(getBackgroundColor());
21432
+ var e = function e() {
21433
+ var isFullscreen = !window.screenTop && !window.screenY;
21434
+ setStateBackgroundCol(getBackgroundColor(!isFullscreen));
21435
+ };
21436
+ document.addEventListener('fullscreenchange', e);
21437
+ return function () {
21438
+ document.removeEventListener('fullscreenchange', e);
21439
+ };
21440
+ }, []);
21418
21441
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ZakekeViewerContainer, {
21419
- backgroundColor: bgColor && !removeBackground ? bgColor : backgroundColor && !removeBackground ? backgroundColor : backgroundColor ? null : '#f2f2f2',
21442
+ backgroundColor: stateBackgroundCol,
21420
21443
  id: 'zakeke-viewer-container-' + guid,
21421
21444
  className: "zakeke-viewer-container ".concat(className)
21422
21445
  }, (stateRef === null || stateRef === void 0 ? void 0 : stateRef.current.state.isDebug) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_debugs_debugPanel__WEBPACK_IMPORTED_MODULE_5__.DebugPanel, null));
@@ -22431,8 +22454,8 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
22431
22454
  _defineProperty(this, "fonts", []);
22432
22455
  _defineProperty(this, "disableTextColors", false);
22433
22456
  _defineProperty(this, "textColors", []);
22434
- /**
22435
- * Get the current text default color.
22457
+ /**
22458
+ * Get the current text default color.
22436
22459
  */
22437
22460
  _defineProperty(this, "defaultColor", '');
22438
22461
  _defineProperty(this, "quantity", 1);
@@ -22535,13 +22558,16 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
22535
22558
  break;
22536
22559
  case 'selectedTemplateCategory':
22537
22560
  _this.selectedTemplateCategory = parseSecure(value);
22561
+ break;
22538
22562
  case 'legacyScreenshot':
22539
22563
  _this.useLegacyScreenshot = value == '1';
22540
22564
  break;
22541
22565
  case 'integrationVersion':
22542
22566
  _this.integrationVersion = (_parseInt = parseInt(value)) !== null && _parseInt !== void 0 ? _parseInt : 1;
22567
+ break;
22543
22568
  case 'dam':
22544
22569
  _this.isDAMViewer = value == '1' || value == 'true';
22570
+ break;
22545
22571
  case 'debugMode':
22546
22572
  _this.debugMode = value == '1' || value == 'true';
22547
22573
  break;
@@ -23009,8 +23035,8 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
23009
23035
  } catch (e) {}
23010
23036
  return copyrightMessageAccepted;
23011
23037
  });
23012
- /**
23013
- * @private
23038
+ /**
23039
+ * @private
23014
23040
  */
23015
23041
  _defineProperty(this, "boot", /*#__PURE__*/function () {
23016
23042
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(parameters) {
@@ -23268,11 +23294,11 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
23268
23294
  _this.viewer.highlightSize = settings.size;
23269
23295
  }
23270
23296
  });
23271
- /*public renderDesign = _.throttle(async () => {
23272
- if (this.viewer && this.zkCurrentTemplate) {
23273
- await this.viewer.renderDesignAsync(this.zkCurrentTemplate);
23274
- this.fireItemsChange();
23275
- }
23297
+ /*public renderDesign = _.throttle(async () => {
23298
+ if (this.viewer && this.zkCurrentTemplate) {
23299
+ await this.viewer.renderDesignAsync(this.zkCurrentTemplate);
23300
+ this.fireItemsChange();
23301
+ }
23276
23302
  }, 300);*/
23277
23303
  _defineProperty(this, "renderDesign", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
23278
23304
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
@@ -23893,8 +23919,8 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
23893
23919
  }
23894
23920
  }, _callee26);
23895
23921
  })));
23896
- /**
23897
- * Reset the platform attributes selection to the current selection
23922
+ /**
23923
+ * Reset the platform attributes selection to the current selection
23898
23924
  */
23899
23925
  _defineProperty(this, "resetPlatformAttributesSelection", function () {
23900
23926
  _this.selection.get('groups').each(function (group) {
@@ -25985,9 +26011,9 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
25985
26011
  var _this$viewer, _this$viewer$getMeshB;
25986
26012
  return (_this$viewer = _this.viewer) === null || _this$viewer === void 0 ? void 0 : (_this$viewer$getMeshB = _this$viewer.getMeshByName(name)) === null || _this$viewer$getMeshB === void 0 ? void 0 : _this$viewer$getMeshB.id;
25987
26013
  });
25988
- /**
25989
- * Hide a mesh and its children and save the state
25990
- * @param meshId The mesh and childs to hide
26014
+ /**
26015
+ * Hide a mesh and its children and save the state
26016
+ * @param meshId The mesh and childs to hide
25991
26017
  */
25992
26018
  _defineProperty(this, "hideMeshAndSaveState", function (meshId) {
25993
26019
  if (_this.viewer.scene) {
@@ -26013,9 +26039,9 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
26013
26039
  }
26014
26040
  }
26015
26041
  });
26016
- /**
26017
- * Restore a mesh visibility state from a previous saved one (see hideMeshAndSaveState)
26018
- * @param meshId The mesh and childs to show
26042
+ /**
26043
+ * Restore a mesh visibility state from a previous saved one (see hideMeshAndSaveState)
26044
+ * @param meshId The mesh and childs to show
26019
26045
  */
26020
26046
  _defineProperty(this, "restoreMeshVisibility", function (meshId) {
26021
26047
  if (_this.viewer.scene) {
@@ -26041,10 +26067,10 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
26041
26067
  }
26042
26068
  }
26043
26069
  });
26044
- /**
26045
- * Change opacity for a specific mesh
26046
- * @param meshId The mesh to change the opacity
26047
- * @param opacity The opacity to set
26070
+ /**
26071
+ * Change opacity for a specific mesh
26072
+ * @param meshId The mesh to change the opacity
26073
+ * @param opacity The opacity to set
26048
26074
  */
26049
26075
  _defineProperty(this, "setMeshDesignVisibility", function (meshId, visible) {
26050
26076
  if (_this.viewer) {
@@ -26652,12 +26678,12 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
26652
26678
  return _ref83.apply(this, arguments);
26653
26679
  };
26654
26680
  }());
26655
- /**
26656
- * Ottiene le restrizioni sul printing method (che nel caso di un prodotto configuratore 3D c'è sempre ed è 1 solo).
26657
- * @remarks
26658
- * Se non ci sono restrizioni, ritorna quelle di default
26659
- * @returns
26660
- * Le restrizioni sul printing method o quelle di default
26681
+ /**
26682
+ * Ottiene le restrizioni sul printing method (che nel caso di un prodotto configuratore 3D c'è sempre ed è 1 solo).
26683
+ * @remarks
26684
+ * Se non ci sono restrizioni, ritorna quelle di default
26685
+ * @returns
26686
+ * Le restrizioni sul printing method o quelle di default
26661
26687
  */
26662
26688
  _defineProperty(this, "getPrintingMethodsRestrictions", function () {
26663
26689
  var defaultColor = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zakeke-configurator-react",
3
- "version": "0.1.277-prod",
3
+ "version": "0.1.278-prod",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/declarations/composer/Module/src/index.d.ts",