zakeke-configurator-react 0.0.231 → 0.1.231

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.
@@ -2,7 +2,7 @@ import { EventMessage, ExtensionFields, NftForm, NftSettings, OnBeforeSendDataTo
2
2
  import { FocusAttributesEventListener } from '../../../3D/src';
3
3
  import { PlatformAttributeSelection } from './integrations/Integration';
4
4
  import { BootParameters, Camera, Composition, FontFamily, Group, ImageMacroCategory, Item, Product, ProductQuantityRule, SellerSettings, Template, TemplateMacroCategory, Translations, TryOnGenericFineTuningSettings, TryOnProduct, TryOnSeller } from './models';
5
- import type { Image, PrintingMethodsTextRestrictions } from './models';
5
+ import type { Image, PrintingMethodsRestrictions } from './models';
6
6
  declare global {
7
7
  interface Window {
8
8
  token: string;
@@ -296,9 +296,6 @@ export declare class ZakekeEnvironment {
296
296
  setCameraLocked: (isBlocked?: boolean) => void;
297
297
  isSceneTryOnEnabled: () => boolean;
298
298
  getTryOnUrl: (tryOnUrl?: string) => Promise<string>;
299
- private getDisableTextColors;
300
- private getTextColors;
301
- private getDefaultColor;
302
299
  saveComposition: (customPreviewSize?: CustomPreviewSize, legacyScreenshot?: boolean, isSharing?: boolean) => Promise<void>;
303
300
  private bootstrapComposition;
304
301
  loadSavedComposition: (docID: string) => Promise<void>;
@@ -327,6 +324,13 @@ export declare class ZakekeEnvironment {
327
324
  exportTryOnMesh: () => Promise<Blob | null>;
328
325
  getTryOnSettings: () => Zakeke.TryOnSettings | undefined;
329
326
  tryOnCountView: (sellerID: number, providerID: number, modeChosen: TryOnMode) => Promise<void>;
330
- getPrintingMethodsTextRestrictions: () => PrintingMethodsTextRestrictions | null;
327
+ /**
328
+ * Ottiene le restrizioni sul printing method (che nel caso di un prodotto configuratore 3D c'è sempre ed è 1 solo).
329
+ * @remarks
330
+ * Se non ci sono restrizioni, ritorna quelle di default
331
+ * @returns
332
+ * Le restrizioni sul printing method o quelle di default
333
+ */
334
+ getPrintingMethodsRestrictions: () => PrintingMethodsRestrictions;
331
335
  }
332
336
  export {};
@@ -529,10 +529,13 @@ export interface TemplateUploadRestrictictions {
529
529
  isEpsAllowed: boolean;
530
530
  isPdfWithRasterAllowed: boolean;
531
531
  }
532
- export interface PrintingMethodsTextRestrictions {
533
- bold: boolean;
534
- italic: boolean;
535
- curved: boolean;
532
+ export interface PrintingMethodsRestrictions {
533
+ allowedBold: boolean;
534
+ allowedItalic: boolean;
535
+ allowedCurved: boolean;
536
+ disableTextColors: boolean;
537
+ textColors: Array<RestrictionColor>;
538
+ defaultColor: string;
536
539
  }
537
540
  export declare class SelectedOption {
538
541
  attributeID: number;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @module Zakeke
3
3
  */
4
- import { EventMessage, FontFamily, Group, Item, NftForm, NftSettings, OnBeforeSendDataToParent, PrintingMethodsTextRestrictions, Product, Template, TemplateMacroCategory, Translations, VisibleEventMessage } from '..';
4
+ import { EventMessage, FontFamily, Group, Item, NftForm, NftSettings, OnBeforeSendDataToParent, PrintingMethodsRestrictions, Product, Template, TemplateMacroCategory, Translations, VisibleEventMessage } from '..';
5
5
  import { FocusAttributesEventListener } from '../../../../3D/src';
6
6
  import { Camera, Image, ImageMacroCategory, ProductQuantityRule, SellerSettings, TemplateUploadRestrictictions } from '../models';
7
7
  interface RestrictionColor {
@@ -89,7 +89,7 @@ export interface Zakeke {
89
89
  * @internal
90
90
  */
91
91
  internalAppendViewer: (container: HTMLElement) => void;
92
- getPrintingMethodsTextRestrictions: () => PrintingMethodsTextRestrictions | null;
92
+ getPrintingMethodsRestrictions: () => PrintingMethodsRestrictions;
93
93
  designUpdate: () => void;
94
94
  createQuote: (formData: any) => Promise<any>;
95
95
  setTemplate: (templateId: number) => Promise<void>;
package/dist/index.js CHANGED
@@ -64025,9 +64025,10 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
64025
64025
  }
64026
64026
  _this.integration.setPricingCalculator(_this.pricingCalculator);
64027
64027
  _this.fonts = fonts;
64028
- _this.defaultColor = _this.getDefaultColor();
64029
- _this.disableTextColors = _this.getDisableTextColors();
64030
- _this.textColors = _this.getTextColors();
64028
+ var restriction = _this.getPrintingMethodsRestrictions();
64029
+ _this.defaultColor = restriction.defaultColor;
64030
+ _this.disableTextColors = restriction.disableTextColors;
64031
+ _this.textColors = restriction.textColors;
64031
64032
  _this.zkTemplates = zkTemplates;
64032
64033
  _this.templates = _this.zkTemplates.map(function (zkTemplate) {
64033
64034
  return _models__WEBPACK_IMPORTED_MODULE_11__.Template.fromTemplate(zkTemplate);
@@ -66871,43 +66872,6 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
66871
66872
  }
66872
66873
  });
66873
66874
  });
66874
- _defineProperty(this, "getDisableTextColors", function () {
66875
- try {
66876
- var _get$at$get$get, _get$at$get;
66877
- var disableTextColors = (_get$at$get$get = (_get$at$get = _this.zkProduct.get('printTypes').at(0).get('printTypeRestrictions')) === null || _get$at$get === void 0 ? void 0 : _get$at$get.get('disableTextColors')) !== null && _get$at$get$get !== void 0 ? _get$at$get$get : false;
66878
- return disableTextColors;
66879
- } catch (ex) {
66880
- console.log(ex);
66881
- throw 'Failed loading restrictions';
66882
- }
66883
- });
66884
- _defineProperty(this, "getTextColors", function () {
66885
- try {
66886
- var _get$at$get$get2, _get$at$get2;
66887
- var textColors = (_get$at$get$get2 = (_get$at$get2 = _this.zkProduct.get('printTypes').at(0).get('printTypeRestrictions')) === null || _get$at$get2 === void 0 ? void 0 : _get$at$get2.get('textColors')) !== null && _get$at$get$get2 !== void 0 ? _get$at$get$get2 : [];
66888
- var defaultColor = {
66889
- colorCode: _this.defaultColor,
66890
- isDefault: true
66891
- };
66892
- if (!textColors.find(function (color) {
66893
- return color.colorCode === defaultColor.colorCode;
66894
- })) textColors.push(defaultColor);
66895
- return textColors;
66896
- } catch (ex) {
66897
- console.log(ex);
66898
- throw 'Failed loading restrictions';
66899
- }
66900
- });
66901
- _defineProperty(this, "getDefaultColor", function () {
66902
- try {
66903
- var _get$at$get$get3, _get$at$get3;
66904
- var defaultColor = (_get$at$get$get3 = (_get$at$get3 = _this.zkProduct.get('printTypes').at(0).get('printTypeRestrictions')) === null || _get$at$get3 === void 0 ? void 0 : _get$at$get3.get('defaultColor')) !== null && _get$at$get$get3 !== void 0 ? _get$at$get$get3 : '#000000';
66905
- return defaultColor;
66906
- } catch (ex) {
66907
- console.log(ex);
66908
- throw 'Failed loading restrictions';
66909
- }
66910
- });
66911
66875
  _defineProperty(this, "saveComposition", /*#__PURE__*/function () {
66912
66876
  var _ref69 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(customPreviewSize, legacyScreenshot, isSharing) {
66913
66877
  var _this$zkScene6, _customPreviewSize$cu, _customPreviewSize$cu2;
@@ -67398,17 +67362,45 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
67398
67362
  return _ref80.apply(this, arguments);
67399
67363
  };
67400
67364
  }());
67401
- _defineProperty(this, "getPrintingMethodsTextRestrictions", function () {
67402
- var restrictions = null;
67365
+ /**
67366
+ * Ottiene le restrizioni sul printing method (che nel caso di un prodotto configuratore 3D c'è sempre ed è 1 solo).
67367
+ * @remarks
67368
+ * Se non ci sono restrizioni, ritorna quelle di default
67369
+ * @returns
67370
+ * Le restrizioni sul printing method o quelle di default
67371
+ */
67372
+ _defineProperty(this, "getPrintingMethodsRestrictions", function () {
67373
+ var defaultColor = {
67374
+ colorCode: '#000000',
67375
+ isDefault: true
67376
+ };
67377
+ var restrictions = {
67378
+ allowedBold: true,
67379
+ allowedItalic: true,
67380
+ allowedCurved: true,
67381
+ disableTextColors: false,
67382
+ textColors: [defaultColor],
67383
+ defaultColor: '#000000'
67384
+ };
67403
67385
  if (_this.zkProduct && _this.zkProduct.get('printTypes').length > 0) {
67404
67386
  var printType = _this.zkProduct.get('printTypes').at(0);
67405
67387
  var printRestrictions = printType.get('printTypeRestrictions');
67406
67388
  if (printRestrictions) {
67407
- var _printRestrictions$ge, _printRestrictions$ge2, _printRestrictions$ge3;
67389
+ var _printRestrictions$ge, _printRestrictions$ge2, _printRestrictions$ge3, _printRestrictions$ge4, _printRestrictions$ge5, _printRestrictions$ge6, _printRestrictions$ge7;
67390
+ defaultColor = _objectSpread(_objectSpread({}, defaultColor), {}, {
67391
+ colorCode: (_printRestrictions$ge = printRestrictions.get('defaultColor')) !== null && _printRestrictions$ge !== void 0 ? _printRestrictions$ge : '#000000'
67392
+ });
67393
+ var textColors = (_printRestrictions$ge2 = printRestrictions.get('textColors')) !== null && _printRestrictions$ge2 !== void 0 ? _printRestrictions$ge2 : [];
67394
+ if (!textColors.find(function (color) {
67395
+ return color.colorCode === defaultColor.colorCode;
67396
+ })) textColors.push(defaultColor);
67408
67397
  restrictions = {
67409
- bold: (_printRestrictions$ge = printRestrictions.get('allowBold')) !== null && _printRestrictions$ge !== void 0 ? _printRestrictions$ge : true,
67410
- italic: (_printRestrictions$ge2 = printRestrictions.get('allowItalic')) !== null && _printRestrictions$ge2 !== void 0 ? _printRestrictions$ge2 : true,
67411
- curved: (_printRestrictions$ge3 = printRestrictions.get('curvedText')) !== null && _printRestrictions$ge3 !== void 0 ? _printRestrictions$ge3 : true
67398
+ allowedBold: (_printRestrictions$ge3 = printRestrictions.get('allowBold')) !== null && _printRestrictions$ge3 !== void 0 ? _printRestrictions$ge3 : true,
67399
+ allowedItalic: (_printRestrictions$ge4 = printRestrictions.get('allowItalic')) !== null && _printRestrictions$ge4 !== void 0 ? _printRestrictions$ge4 : true,
67400
+ allowedCurved: (_printRestrictions$ge5 = printRestrictions.get('curvedText')) !== null && _printRestrictions$ge5 !== void 0 ? _printRestrictions$ge5 : true,
67401
+ disableTextColors: (_printRestrictions$ge6 = printRestrictions.get('disableTextColors')) !== null && _printRestrictions$ge6 !== void 0 ? _printRestrictions$ge6 : false,
67402
+ textColors: textColors,
67403
+ defaultColor: (_printRestrictions$ge7 = printRestrictions.get('defaultColor')) !== null && _printRestrictions$ge7 !== void 0 ? _printRestrictions$ge7 : '#000000'
67412
67404
  };
67413
67405
  }
67414
67406
  }
@@ -70214,7 +70206,7 @@ var createProviderValue = function createProviderValue(state, dispatch) {
70214
70206
  container: container
70215
70207
  });
70216
70208
  },
70217
- getPrintingMethodsTextRestrictions: state.environment.getPrintingMethodsTextRestrictions.bind(state.environment),
70209
+ getPrintingMethodsRestrictions: state.environment.getPrintingMethodsRestrictions.bind(state.environment),
70218
70210
  designUpdate: function designUpdate() {
70219
70211
  return dispatch({
70220
70212
  type: 'DESIGN_UPDATE'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zakeke-configurator-react",
3
- "version": "0.0.231",
3
+ "version": "0.1.231",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/declarations/composer/Module/src/index.d.ts",