zakeke-configurator-react 0.0.223 → 0.0.225

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.
@@ -1,109 +1,109 @@
1
- import { FunctionComponent } from "react";
2
- import { TryOnFineTuningMazingSettings, TryOnGenericFineTuningSettings, TryOnProduct, TryOnProvider, TryOnSeller, TryOnType } from "../models";
3
- export declare function parseJSON(json: string): any;
4
- export declare enum TryOnMode {
5
- Undefined = 0,
6
- TryOn = 1,
7
- PDTool = 2
8
- }
9
- export interface TryOnViewerProps {
10
- mode: TryOnMode;
11
- onTimeout?: (value: boolean) => void;
12
- onPDUpdated?: (pd: number) => void;
13
- onClose?: () => void;
14
- }
15
- export interface VTryOnViewerProps {
16
- className?: string;
17
- provider: TryOnProvider;
18
- type: TryOnType;
19
- obj: Blob;
20
- settings?: TryOnGenericFineTuningSettings;
21
- product: TryOnProduct;
22
- customer: TryOnSeller;
23
- onReady?: () => void;
24
- onClose?: () => void;
25
- }
26
- export interface TryOnPDToolProps {
27
- className?: string;
28
- provider: TryOnProvider;
29
- product: TryOnProduct;
30
- customer: TryOnSeller;
31
- onReady?: () => void;
32
- onPDUpdated?: (pd: number) => void;
33
- onClose?: () => void;
34
- }
35
- export declare const TryOnViewerComponent: FunctionComponent<TryOnViewerProps>;
36
- export declare const VTryOnViewerComponent: FunctionComponent<VTryOnViewerProps>;
37
- export declare const TryOnPDToolComponent: FunctionComponent<TryOnPDToolProps>;
38
- export declare enum MazingTryOnState {
39
- Start = "",
40
- WaitingAuthentication = "WAITING_AUTH",
41
- AuthSuccessful = "AUTH_SUCCESS",
42
- TryOnLoaded = "MODEL_LOADED",
43
- AuthError = "AUTH_ERROR",
44
- WebcamError = "WEBCAM_ERROR",
45
- ScreenShotTaken = "SCREENSHOT_TAKEN",
46
- WebcamStopped = "WEBCAM_STOPPED"
47
- }
48
- export declare enum MazingTryOnOutMessage {
49
- StartAuthenticationTryOn = "AUTH_TRY_ON",
50
- LoadTryOn = "LOAD_MODEL",
51
- TakeScreenshot = "TAKE_SCREENSHOT",
52
- StopWebcam = "STOP_WEBCAM"
53
- }
54
- export declare enum MazingPDState {
55
- Start = "",
56
- WaitingAuthentication = "WAITING_AUTH",
57
- AuthSuccessful = "AUTH_SUCCESS",
58
- PDLoaded = "PD_LOADED",
59
- PDUpdated = "NEW_PD",
60
- AuthError = "AUTH_ERROR",
61
- PDDataNotFoundError = "PD_ERROR",
62
- WebcamError = "WEBCAM_ERROR",
63
- PDCountdown = "PD_COUNTDOWN",
64
- PDCountdownEnd = "PD_COUNTDOWN_END",
65
- WebcamStopped = "WEBCAM_STOPPED"
66
- }
67
- export declare enum MazingPDOutMessage {
68
- StartAuthenticationPD = "AUTH_TRY_ON",
69
- LoadPD = "LOAD_PD",
70
- StartPD = "START_PD",
71
- StopWebcam = "STOP_WEBCAM"
72
- }
73
- export interface MazingTryOnInMessage {
74
- type: MazingFrameState;
75
- value: any;
76
- }
77
- export interface MazingFrameProps {
78
- className?: string;
79
- outMessageHandler: (e: MessageEvent<any>) => void;
80
- onReady?: (w: Window) => void;
81
- }
82
- export interface MazingTryOnProps {
83
- className?: string;
84
- obj: Blob;
85
- product: TryOnProduct;
86
- customer: TryOnSeller;
87
- fineTuningSettings?: TryOnFineTuningMazingSettings;
88
- initialState?: MazingTryOnInMessage;
89
- closeFlag: boolean;
90
- onReady?: () => void;
91
- onReadyToShow?: () => void;
92
- onClosed?: () => void;
93
- }
94
- export interface MazingPDProps {
95
- className?: string;
96
- product: TryOnProduct;
97
- customer: TryOnSeller;
98
- initialState?: MazingTryOnInMessage;
99
- closeFlag: boolean;
100
- onReady?: () => void;
101
- onReadyToShow?: () => void;
102
- onPDUpdated?: (pd: number) => void;
103
- onClosed?: () => void;
104
- onClose?: () => void;
105
- }
106
- export type MazingFrameState = MazingTryOnState | MazingPDState;
107
- export declare const MazingFrameComponent: (props: MazingFrameProps) => JSX.Element;
108
- export declare const MazingTryOnComponent: FunctionComponent<MazingTryOnProps>;
109
- export declare const MazingPDToolComponent: FunctionComponent<MazingPDProps>;
1
+ import { FunctionComponent } from "react";
2
+ import { TryOnFineTuningMazingSettings, TryOnGenericFineTuningSettings, TryOnProduct, TryOnProvider, TryOnSeller, TryOnType } from "../models";
3
+ export declare function parseJSON(json: string): any;
4
+ export declare enum TryOnMode {
5
+ Undefined = 0,
6
+ TryOn = 1,
7
+ PDTool = 2
8
+ }
9
+ export interface TryOnViewerProps {
10
+ mode: TryOnMode;
11
+ onTimeout?: (value: boolean) => void;
12
+ onPDUpdated?: (pd: number) => void;
13
+ onClose?: () => void;
14
+ }
15
+ export interface VTryOnViewerProps {
16
+ className?: string;
17
+ provider: TryOnProvider;
18
+ type: TryOnType;
19
+ obj: Blob;
20
+ settings?: TryOnGenericFineTuningSettings;
21
+ product: TryOnProduct;
22
+ customer: TryOnSeller;
23
+ onReady?: () => void;
24
+ onClose?: () => void;
25
+ }
26
+ export interface TryOnPDToolProps {
27
+ className?: string;
28
+ provider: TryOnProvider;
29
+ product: TryOnProduct;
30
+ customer: TryOnSeller;
31
+ onReady?: () => void;
32
+ onPDUpdated?: (pd: number) => void;
33
+ onClose?: () => void;
34
+ }
35
+ export declare const TryOnViewerComponent: FunctionComponent<TryOnViewerProps>;
36
+ export declare const VTryOnViewerComponent: FunctionComponent<VTryOnViewerProps>;
37
+ export declare const TryOnPDToolComponent: FunctionComponent<TryOnPDToolProps>;
38
+ export declare enum MazingTryOnState {
39
+ Start = "",
40
+ WaitingAuthentication = "WAITING_AUTH",
41
+ AuthSuccessful = "AUTH_SUCCESS",
42
+ TryOnLoaded = "MODEL_LOADED",
43
+ AuthError = "AUTH_ERROR",
44
+ WebcamError = "WEBCAM_ERROR",
45
+ ScreenShotTaken = "SCREENSHOT_TAKEN",
46
+ WebcamStopped = "WEBCAM_STOPPED"
47
+ }
48
+ export declare enum MazingTryOnOutMessage {
49
+ StartAuthenticationTryOn = "AUTH_TRY_ON",
50
+ LoadTryOn = "LOAD_MODEL",
51
+ TakeScreenshot = "TAKE_SCREENSHOT",
52
+ StopWebcam = "STOP_WEBCAM"
53
+ }
54
+ export declare enum MazingPDState {
55
+ Start = "",
56
+ WaitingAuthentication = "WAITING_AUTH",
57
+ AuthSuccessful = "AUTH_SUCCESS",
58
+ PDLoaded = "PD_LOADED",
59
+ PDUpdated = "NEW_PD",
60
+ AuthError = "AUTH_ERROR",
61
+ PDDataNotFoundError = "PD_ERROR",
62
+ WebcamError = "WEBCAM_ERROR",
63
+ PDCountdown = "PD_COUNTDOWN",
64
+ PDCountdownEnd = "PD_COUNTDOWN_END",
65
+ WebcamStopped = "WEBCAM_STOPPED"
66
+ }
67
+ export declare enum MazingPDOutMessage {
68
+ StartAuthenticationPD = "AUTH_TRY_ON",
69
+ LoadPD = "LOAD_PD",
70
+ StartPD = "START_PD",
71
+ StopWebcam = "STOP_WEBCAM"
72
+ }
73
+ export interface MazingTryOnInMessage {
74
+ type: MazingFrameState;
75
+ value: any;
76
+ }
77
+ export interface MazingFrameProps {
78
+ className?: string;
79
+ outMessageHandler: (e: MessageEvent<any>) => void;
80
+ onReady?: (w: Window) => void;
81
+ }
82
+ export interface MazingTryOnProps {
83
+ className?: string;
84
+ obj: Blob;
85
+ product: TryOnProduct;
86
+ customer: TryOnSeller;
87
+ fineTuningSettings?: TryOnFineTuningMazingSettings;
88
+ initialState?: MazingTryOnInMessage;
89
+ closeFlag: boolean;
90
+ onReady?: () => void;
91
+ onReadyToShow?: () => void;
92
+ onClosed?: () => void;
93
+ }
94
+ export interface MazingPDProps {
95
+ className?: string;
96
+ product: TryOnProduct;
97
+ customer: TryOnSeller;
98
+ initialState?: MazingTryOnInMessage;
99
+ closeFlag: boolean;
100
+ onReady?: () => void;
101
+ onReadyToShow?: () => void;
102
+ onPDUpdated?: (pd: number) => void;
103
+ onClosed?: () => void;
104
+ onClose?: () => void;
105
+ }
106
+ export type MazingFrameState = MazingTryOnState | MazingPDState;
107
+ export declare const MazingFrameComponent: (props: MazingFrameProps) => JSX.Element;
108
+ export declare const MazingTryOnComponent: FunctionComponent<MazingTryOnProps>;
109
+ export declare const MazingPDToolComponent: FunctionComponent<MazingPDProps>;
@@ -1,16 +1,16 @@
1
- import { DesignPriceCalculatorRuleBased } from '../../../../libs/pricingRuleBase/DesignPriceCalculatorRuleBased';
2
- import { Item } from '../models';
3
- import { Integration, PlatformAttributeSelection } from './Integration';
4
- export default class MerchantIntegrationGeneric implements Integration {
5
- private readonly callbacks;
6
- private messageIds;
7
- private pricingCalculator;
8
- constructor();
9
- addToCart(composition: any, design: any, model: any, attributes: PlatformAttributeSelection[], designItems: Item[], quantity: number, additionalProperties: any, shopifyNFTPrice: number): void;
10
- getPrice(composition: any, design: any, model: any, attributes: any, compositionPrice: any, isCustomPricingConfiguratorEnabled: any, isCustomPricingRuleBasedEnabled: any, quantity: number): Promise<number>;
11
- getSharedCompositionUrl(compositionDocID: string): Promise<{
12
- url: string;
13
- }>;
14
- close(): void;
15
- setPricingCalculator(pricingCalculator: DesignPriceCalculatorRuleBased): void;
16
- }
1
+ import { DesignPriceCalculatorRuleBased } from '../../../../libs/pricingRuleBase/DesignPriceCalculatorRuleBased';
2
+ import { Item } from '../models';
3
+ import { Integration, PlatformAttributeSelection } from './Integration';
4
+ export default class MerchantIntegrationGeneric implements Integration {
5
+ private readonly callbacks;
6
+ private messageIds;
7
+ private pricingCalculator;
8
+ constructor();
9
+ addToCart(composition: any, design: any, model: any, attributes: PlatformAttributeSelection[], designItems: Item[], quantity: number, additionalProperties: any, shopifyNFTPrice: number): void;
10
+ getPrice(composition: any, design: any, model: any, attributes: any, compositionPrice: any, isCustomPricingConfiguratorEnabled: any, isCustomPricingRuleBasedEnabled: any, quantity: number): Promise<number>;
11
+ getSharedCompositionUrl(compositionDocID: string): Promise<{
12
+ url: string;
13
+ }>;
14
+ close(): void;
15
+ setPricingCalculator(pricingCalculator: DesignPriceCalculatorRuleBased): void;
16
+ }
package/dist/index.js CHANGED
@@ -57641,13 +57641,11 @@ var SceneViewer = /*#__PURE__*/function () {
57641
57641
  }, {
57642
57642
  key: "updateView",
57643
57643
  value: function updateView() {
57644
- var adjustCamera = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
57645
- this.resize(adjustCamera);
57644
+ this.resize();
57646
57645
  }
57647
57646
  }, {
57648
57647
  key: "resize",
57649
57648
  value: function resize() {
57650
- var adjustCamera = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
57651
57649
  if (!this._canvas) return;
57652
57650
  this.disableAntialiasing(true);
57653
57651
  var parent = this._canvas.parentNode;
@@ -57661,10 +57659,13 @@ var SceneViewer = /*#__PURE__*/function () {
57661
57659
  this._canvas.style.height = "100%";
57662
57660
  if (this._engine) {
57663
57661
  this._engine.resize();
57664
- if (adjustCamera) {
57665
- if (this._scene) this.adjustCamera(false);
57666
- this.setupShaderMaterialsCameraPosition();
57667
- }
57662
+
57663
+ // if (adjustCamera) {
57664
+ // if (this._scene)
57665
+ // this.adjustCamera(false);
57666
+ // this.setupShaderMaterialsCameraPosition();
57667
+ // }
57668
+
57668
57669
  if (this._brandLogoButton) {
57669
57670
  // There is no / 2 because the advancedTexture has a renderScale = 2
57670
57671
  this._brandLogoButton.left = -this._canvas.width + 100 + "px";
@@ -63383,12 +63384,12 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
63383
63384
  _defineProperty(this, "debouncedChange", (0,lodash__WEBPACK_IMPORTED_MODULE_0__.debounce)(function () {
63384
63385
  return _this.trigger('change');
63385
63386
  }, 300));
63386
- _defineProperty(this, "resize", function () {
63387
+ _defineProperty(this, "restoreLastCameraLocation", function () {
63387
63388
  if (!_this.viewer) return;
63388
63389
 
63389
63390
  //this.viewer.updateView(false);
63390
63391
 
63391
- // Restore last camera locazione
63392
+ // Restore last camera location
63392
63393
  if (_this.lastCameraLocation && _this.lastCameraLocation !== Zakeke.getEmptyUUID()) {
63393
63394
  console.log('Restoring last camera location ' + _this.lastCameraLocation + ' ...');
63394
63395
  _this.setCamera(_this.lastCameraLocation, false, false);
@@ -63498,16 +63499,17 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
63498
63499
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
63499
63500
  while (1) switch (_context17.prev = _context17.next) {
63500
63501
  case 0:
63501
- window.addEventListener('resize', _this.resize);
63502
+ // window.addEventListener('resize', this.resize);
63503
+
63502
63504
  console.log('Scene loaded');
63503
63505
  _this.selection = Zakeke.ComposerSelection.CreateComposerSelection(_this.zkProduct);
63504
63506
  currentCompositionId = _this.templateId || _this.draftCompositionDocId || _this.sharedCompositionDocId || _this.compositionId;
63505
63507
  if (_this.initialSelection == undefined) {
63506
63508
  _this.initialSelection = _this.cloneSelection(_this.selection);
63507
63509
  }
63508
- _context17.next = 7;
63510
+ _context17.next = 6;
63509
63511
  return _this.internalLoadComposition(currentCompositionId);
63510
- case 7:
63512
+ case 6:
63511
63513
  _this.trigger('change');
63512
63514
  _this.buildStructure();
63513
63515
 
@@ -63555,16 +63557,16 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
63555
63557
  }
63556
63558
  _this.registerView();
63557
63559
  if (_this.isTemplateEditor) {
63558
- _context17.next = 20;
63560
+ _context17.next = 19;
63559
63561
  break;
63560
63562
  }
63561
- _context17.next = 20;
63563
+ _context17.next = 19;
63562
63564
  return _this.updateSavedCompositions();
63563
- case 20:
63565
+ case 19:
63564
63566
  setTimeout(function () {
63565
63567
  return _this.updateRecapAndExtensionField();
63566
63568
  }, 1000);
63567
- case 21:
63569
+ case 20:
63568
63570
  case "end":
63569
63571
  return _context17.stop();
63570
63572
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zakeke-configurator-react",
3
- "version": "0.0.223",
3
+ "version": "0.0.225",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/declarations/composer/Module/src/index.d.ts",