zakeke-configurator-react 0.0.92 → 0.0.93

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/README.md CHANGED
@@ -1,244 +1,244 @@
1
-
2
- # Zakeke Configurator for React
3
-
4
-
5
-
6
- This library let you build a custom UI for the Zakeke 3D configurator tool.
7
-
8
-
9
-
10
- ## How to install and run a basic example
11
-
12
-
13
-
14
- git clone https://github.com/UpCommerce/zakeke-configurator-react-example.git
15
- npm install
16
- npm run start
17
-
18
-
19
-
20
- After running the example you will see a blank page running on `localhost:3000` , that because Zakeke must have some parameters to know what product to load.
21
-
22
- The parameters are automatically sent from the plugins with a postMessage but, for testing, we can pass them as query string in the URL.
23
-
24
- The easiest way to have all the parameters is:
25
-
26
-
27
-
28
- 1. Go in Zakeke configurator backoffice
29
-
30
- 2. Add or edit a new product
31
-
32
- 3. Go in the Shopping Preview page
33
-
34
- 4. Right click on the page -> inspect element
35
-
36
- 5. Find the zakeke `<iframe>` src attribute and copy all query string parameters
37
-
38
- 6. Paste the parameters in the localhost page.
39
-
40
- You should have something like:
41
-
42
- http://localhost:3000?modelCode=XXX&culture=XX&token=XXXXXX....
43
-
44
-
45
-
46
- With these parameter you should see the product loading in a basic UI interface.
47
-
48
- You can start customizing it.
49
-
50
-
51
-
52
- ## References
53
-
54
- The library exposes 4 elements:
55
-
56
-
57
-
58
- - a ZakekeEnvironment class that contains the state of the current scene
59
-
60
- - a ZakekeProvider react component that should wrap your application
61
-
62
- - a ZakekeViewer react component that will render the 3D scene
63
-
64
- - a useZakeke effect to get the data and methods to execute
65
-
66
-
67
-
68
- A basic Zakeke theme should be like:
69
-
70
- const zakekeEnvironment = new ZakekeEnvironment();
71
-
72
- <ZakekeProvider environment={zakekeEnvironment}>
73
- <div>
74
- <ZakekeViewer />
75
- </div>
76
- </ZakekeProvider>
77
-
78
-
79
-
80
- ## Properties and methods
81
-
82
- price: number;
83
-
84
- culture: string;
85
-
86
- currency: string;
87
-
88
- isSceneLoading: boolean;
89
-
90
- isAddToCartLoading: boolean;
91
-
92
- isViewerReady: boolean;
93
-
94
- fonts: FontFamily[];
95
-
96
- groups: Group[];
97
-
98
- templates: Template[];
99
-
100
- currentTemplate: Template | null;
101
-
102
- items: Item[];
103
-
104
- productName: string;
105
-
106
- productCode: string;
107
-
108
- product: Product | null;
109
-
110
- cameras: Camera[];
111
-
112
-
113
-
114
- selectOption: (optionId: number) => void;
115
-
116
- setTemplate: (templateId: number) => void;
117
-
118
- isAreaVisible: (areaId: number) => boolean;
119
-
120
-
121
-
122
- saveComposition: () => Promise<string>;
123
-
124
- loadComposition: (id: string) => Promise<void>;
125
-
126
- addToCart: (additionalProperties: Record<string, any>) => Promise<void>;
127
-
128
-
129
-
130
- getPDF: () => Promise<string>;
131
-
132
- getOnlineScreenshot: (width: number, height: number, backgroundColor?: string, padding?: number) => Promise<string>;
133
-
134
-
135
-
136
- setCamera: (id: string, onlyAngleOfView?: boolean, animate?: boolean) => void;
137
-
138
- setCameraByName: (name: string, onlyAngleOfView?: boolean, animate?: boolean) => void;
139
-
140
- setCameraZoomEnabled: (enabled: boolean) => void;
141
-
142
- resetCameraPivot: () => void;
143
-
144
- setCameraPivot: (meshId: string) => void;
145
-
146
-
147
-
148
- getImages: (categoryId: number) => Promise<Image[]>;
149
-
150
- getMacroCategories: () => Promise<ImageMacroCategory[]>;
151
-
152
- previewOnly__setItemImageFromBase64: (guid: string, base64: string) => void;
153
-
154
-
155
-
156
- setItemImageFromFile: (guid: string, file: File) => Promise<void>;
157
-
158
- addItemImage: (id: number, areaId: number) => Promise<void>;
159
-
160
- createImage: (file: File, progress?: (percentage: number) => void) => Promise<Image>;
161
-
162
- createImageFromUrl: (url: string) => Promise<Image>;
163
-
164
- setItemImage: (guid: string, imageId: number) => Promise<void>;
165
-
166
- setItemFontFamily: (guid: string, fontFamily: string) => void;
167
-
168
- setItemColor: (guid: string, color: string) => void;
169
-
170
- setItemBold: (guid: string, bold: boolean) => void;
171
-
172
- setItemItalic: (guid: string, italic: boolean) => void;
173
-
174
- setItemText: (guid: string, text: string) => void;
175
-
176
- addItemText: (settings: { text: string, fontFamily: string }, areaId: number) => Promise<void>;
177
-
178
- removeItem: (guid: string) => Promise<void>;
179
-
180
-
181
-
182
- switchFullscreen: () => void;
183
-
184
- isFullscreenMode: boolean;
185
-
186
- zoomIn: () => void;
187
-
188
- zoomOut: () => void;
189
-
190
-
191
-
192
- updateView: (adjustCamera?: boolean) => void;
193
-
194
- setHighlightSettings: (settings: { color: string, size: number }) => void;
195
-
196
- hasExplodedMode: () => boolean;
197
-
198
- isExplodedMode: boolean;
199
-
200
- setExplodedMode: (exploded: boolean) => void;
201
-
202
-
203
-
204
- // Scene manipulation
205
-
206
- getMeshIDbyName: (name: string) => string | undefined | null,
207
-
208
- hideMeshAndSaveState: (meshId: string) => void,
209
-
210
- restoreMeshVisibility: (meshId: string) => void,
211
-
212
- setMeshDesignVisibility: (meshId: string, visible: boolean) => void,
213
-
214
-
215
-
216
- // Events
217
-
218
- clearListeners: () => void;
219
-
220
- addFocusAttributesListener: (listenerFunction: FocusAttributesEventListener) => void;
221
-
222
- focusAttribute: (attributeId: number) => void;
223
-
224
-
225
-
226
- // AR
227
-
228
- getQrCodeArUrl: (device: 'iOS' | 'Android') => Promise<string>;
229
-
230
- getMobileArUrl: (useCacheWithDesign?: boolean) => Promise<string | null>;
231
-
232
- openArMobile: (url: string) => void;
233
-
234
- isSceneArEnabled: () => boolean;
235
-
236
-
237
-
238
- IS_ANDROID: boolean;
239
-
240
- IS_IOS: boolean;
241
-
242
-
243
-
1
+
2
+ # Zakeke Configurator for React
3
+
4
+
5
+
6
+ This library let you build a custom UI for the Zakeke 3D configurator tool.
7
+
8
+
9
+
10
+ ## How to install and run a basic example
11
+
12
+
13
+
14
+ git clone https://github.com/UpCommerce/zakeke-configurator-react-example.git
15
+ npm install
16
+ npm run start
17
+
18
+
19
+
20
+ After running the example you will see a blank page running on `localhost:3000` , that because Zakeke must have some parameters to know what product to load.
21
+
22
+ The parameters are automatically sent from the plugins with a postMessage but, for testing, we can pass them as query string in the URL.
23
+
24
+ The easiest way to have all the parameters is:
25
+
26
+
27
+
28
+ 1. Go in Zakeke configurator backoffice
29
+
30
+ 2. Add or edit a new product
31
+
32
+ 3. Go in the Shopping Preview page
33
+
34
+ 4. Right click on the page -> inspect element
35
+
36
+ 5. Find the zakeke `<iframe>` src attribute and copy all query string parameters
37
+
38
+ 6. Paste the parameters in the localhost page.
39
+
40
+ You should have something like:
41
+
42
+ http://localhost:3000?modelCode=XXX&culture=XX&token=XXXXXX....
43
+
44
+
45
+
46
+ With these parameter you should see the product loading in a basic UI interface.
47
+
48
+ You can start customizing it.
49
+
50
+
51
+
52
+ ## References
53
+
54
+ The library exposes 4 elements:
55
+
56
+
57
+
58
+ - a ZakekeEnvironment class that contains the state of the current scene
59
+
60
+ - a ZakekeProvider react component that should wrap your application
61
+
62
+ - a ZakekeViewer react component that will render the 3D scene
63
+
64
+ - a useZakeke effect to get the data and methods to execute
65
+
66
+
67
+
68
+ A basic Zakeke theme should be like:
69
+
70
+ const zakekeEnvironment = new ZakekeEnvironment();
71
+
72
+ <ZakekeProvider environment={zakekeEnvironment}>
73
+ <div>
74
+ <ZakekeViewer />
75
+ </div>
76
+ </ZakekeProvider>
77
+
78
+
79
+
80
+ ## Properties and methods
81
+
82
+ price: number;
83
+
84
+ culture: string;
85
+
86
+ currency: string;
87
+
88
+ isSceneLoading: boolean;
89
+
90
+ isAddToCartLoading: boolean;
91
+
92
+ isViewerReady: boolean;
93
+
94
+ fonts: FontFamily[];
95
+
96
+ groups: Group[];
97
+
98
+ templates: Template[];
99
+
100
+ currentTemplate: Template | null;
101
+
102
+ items: Item[];
103
+
104
+ productName: string;
105
+
106
+ productCode: string;
107
+
108
+ product: Product | null;
109
+
110
+ cameras: Camera[];
111
+
112
+
113
+
114
+ selectOption: (optionId: number) => void;
115
+
116
+ setTemplate: (templateId: number) => void;
117
+
118
+ isAreaVisible: (areaId: number) => boolean;
119
+
120
+
121
+
122
+ saveComposition: () => Promise<string>;
123
+
124
+ loadComposition: (id: string) => Promise<void>;
125
+
126
+ addToCart: (additionalProperties: Record<string, any>) => Promise<void>;
127
+
128
+
129
+
130
+ getPDF: () => Promise<string>;
131
+
132
+ getOnlineScreenshot: (width: number, height: number, backgroundColor?: string, padding?: number) => Promise<string>;
133
+
134
+
135
+
136
+ setCamera: (id: string, onlyAngleOfView?: boolean, animate?: boolean) => void;
137
+
138
+ setCameraByName: (name: string, onlyAngleOfView?: boolean, animate?: boolean) => void;
139
+
140
+ setCameraZoomEnabled: (enabled: boolean) => void;
141
+
142
+ resetCameraPivot: () => void;
143
+
144
+ setCameraPivot: (meshId: string) => void;
145
+
146
+
147
+
148
+ getImages: (categoryId: number) => Promise<Image[]>;
149
+
150
+ getMacroCategories: () => Promise<ImageMacroCategory[]>;
151
+
152
+ previewOnly__setItemImageFromBase64: (guid: string, base64: string) => void;
153
+
154
+
155
+
156
+ setItemImageFromFile: (guid: string, file: File) => Promise<void>;
157
+
158
+ addItemImage: (id: number, areaId: number) => Promise<void>;
159
+
160
+ createImage: (file: File, progress?: (percentage: number) => void) => Promise<Image>;
161
+
162
+ createImageFromUrl: (url: string) => Promise<Image>;
163
+
164
+ setItemImage: (guid: string, imageId: number) => Promise<void>;
165
+
166
+ setItemFontFamily: (guid: string, fontFamily: string) => void;
167
+
168
+ setItemColor: (guid: string, color: string) => void;
169
+
170
+ setItemBold: (guid: string, bold: boolean) => void;
171
+
172
+ setItemItalic: (guid: string, italic: boolean) => void;
173
+
174
+ setItemText: (guid: string, text: string) => void;
175
+
176
+ addItemText: (settings: { text: string, fontFamily: string }, areaId: number) => Promise<void>;
177
+
178
+ removeItem: (guid: string) => Promise<void>;
179
+
180
+
181
+
182
+ switchFullscreen: () => void;
183
+
184
+ isFullscreenMode: boolean;
185
+
186
+ zoomIn: () => void;
187
+
188
+ zoomOut: () => void;
189
+
190
+
191
+
192
+ updateView: (adjustCamera?: boolean) => void;
193
+
194
+ setHighlightSettings: (settings: { color: string, size: number }) => void;
195
+
196
+ hasExplodedMode: () => boolean;
197
+
198
+ isExplodedMode: boolean;
199
+
200
+ setExplodedMode: (exploded: boolean) => void;
201
+
202
+
203
+
204
+ // Scene manipulation
205
+
206
+ getMeshIDbyName: (name: string) => string | undefined | null,
207
+
208
+ hideMeshAndSaveState: (meshId: string) => void,
209
+
210
+ restoreMeshVisibility: (meshId: string) => void,
211
+
212
+ setMeshDesignVisibility: (meshId: string, visible: boolean) => void,
213
+
214
+
215
+
216
+ // Events
217
+
218
+ clearListeners: () => void;
219
+
220
+ addFocusAttributesListener: (listenerFunction: FocusAttributesEventListener) => void;
221
+
222
+ focusAttribute: (attributeId: number) => void;
223
+
224
+
225
+
226
+ // AR
227
+
228
+ getQrCodeArUrl: (device: 'iOS' | 'Android') => Promise<string>;
229
+
230
+ getMobileArUrl: (useCacheWithDesign?: boolean) => Promise<string | null>;
231
+
232
+ openArMobile: (url: string) => void;
233
+
234
+ isSceneArEnabled: () => boolean;
235
+
236
+
237
+
238
+ IS_ANDROID: boolean;
239
+
240
+ IS_IOS: boolean;
241
+
242
+
243
+
244
244
  setBackgroundColor: (color: string, alpha: number) => void;
@@ -3,6 +3,10 @@ import { OnBeforeSendDataToParent } from '.';
3
3
  import { FocusAttributesEventListener } from '../../../3D/src';
4
4
  import { PlatformAttributeSelection } from './integrations/Integration';
5
5
  import { Camera, FontFamily, Group, Image, ImageMacroCategory, Item, Product, SellerSettings, Template } from './models';
6
+ interface RestrictionColor {
7
+ colorCode: string;
8
+ isDefault: boolean;
9
+ }
6
10
  export declare class ZakekeEnvironment {
7
11
  private token;
8
12
  private platformAttributesSelection;
@@ -30,6 +34,9 @@ export declare class ZakekeEnvironment {
30
34
  currency: string;
31
35
  groups: Group[];
32
36
  fonts: FontFamily[];
37
+ disableTextColors: boolean;
38
+ textColors: RestrictionColor[];
39
+ defaultColor: string;
33
40
  quantity: number;
34
41
  culture: string;
35
42
  productCode: string;
@@ -91,11 +98,14 @@ export declare class ZakekeEnvironment {
91
98
  on: (event: string, callback: any) => void;
92
99
  off: (event: string, callback: any) => void;
93
100
  setTemplate: (templateId: number) => void;
94
- getTemplateRestrictions: (templateId: number, areaId: number) => {
101
+ getTemplateUploadRestrictictions: (templateId: number, areaId: number) => {
95
102
  isUserImageAllowed: any;
96
103
  isJpgAllowed: any;
97
104
  isPngAllowed: any;
98
105
  isSvgAllowed: any;
106
+ isPdfAllowed: boolean;
107
+ isEpsAllowed: boolean;
108
+ isPdfWithRasterAllowed: boolean;
99
109
  };
100
110
  private getTemplates;
101
111
  private getTemplate;
@@ -131,6 +141,7 @@ export declare class ZakekeEnvironment {
131
141
  setItemBold: (guid: string, bold: boolean) => void;
132
142
  setItemColor: (guid: string, color: string) => void;
133
143
  setItemFontFamily: (guid: string, fontFamily: string) => Promise<void>;
144
+ setItemTextOnPath: (guid: string, areaId: number, value: boolean) => void;
134
145
  createImage: (file: File, progress?: ((percentage: number) => void) | undefined) => Promise<Image>;
135
146
  createImageFromUrl: (url: string) => Promise<Image>;
136
147
  addItemImage: (id: number, areaId: number) => Promise<void>;
@@ -176,4 +187,8 @@ export declare class ZakekeEnvironment {
176
187
  setCameraLocked: (isBlocked?: boolean | undefined) => void;
177
188
  isSceneTryOnEnabled: () => boolean;
178
189
  getTryOnUrl: (tryOnUrl?: string | undefined) => Promise<string>;
190
+ private getDisableTextColors;
191
+ private getTextColors;
192
+ private getDefaultColor;
179
193
  }
194
+ export {};
@@ -1,7 +1,11 @@
1
1
  import { FontFamily, Group, Item, OnBeforeSendDataToParent, Product, Template } from "..";
2
2
  import { FocusAttributesEventListener } from "../../../../3D/src";
3
- import { Camera, Image, ImageMacroCategory, SellerSettings } from "../models";
3
+ import { Camera, Image, ImageMacroCategory, SellerSettings, TemplateUploadRestrictictions } from "../models";
4
4
  import { AppState } from "./state";
5
+ interface RestrictionColor {
6
+ colorCode: string;
7
+ isDefault: boolean;
8
+ }
5
9
  export interface ProviderValue {
6
10
  internalProduct: MPlaza.Model | null;
7
11
  internalScene: Zakeke.Scene | null;
@@ -13,6 +17,9 @@ export interface ProviderValue {
13
17
  isAddToCartLoading: boolean;
14
18
  isViewerReady: boolean;
15
19
  fonts: FontFamily[];
20
+ disableTextColors: boolean;
21
+ defaultColor: string;
22
+ textColors: RestrictionColor[];
16
23
  groups: Group[];
17
24
  templates: Template[];
18
25
  currentTemplate: Template | null;
@@ -49,6 +56,7 @@ export interface ProviderValue {
49
56
  setItemColor: (guid: string, color: string) => void;
50
57
  setItemBold: (guid: string, bold: boolean) => void;
51
58
  setItemItalic: (guid: string, italic: boolean) => void;
59
+ setItemTextOnPath: (guid: string, areaId: number, value: boolean) => void;
52
60
  setItemText: (guid: string, text: string) => void;
53
61
  addItemText: (settings: {
54
62
  text: string;
@@ -84,5 +92,7 @@ export interface ProviderValue {
84
92
  getTryOnUrl: (tryOnUrl?: string) => Promise<string>;
85
93
  isSceneTryOnEnabled: () => boolean;
86
94
  setCameraLocked: (isBlocked: boolean) => void;
95
+ getTemplateUploadRestrictictions: (templateId: number, areaId: number) => TemplateUploadRestrictictions;
87
96
  }
88
97
  export declare const createProviderValue: (state: AppState, dispatch: React.Dispatch<any>) => ProviderValue;
98
+ export {};