zakeke-configurator-react 0.0.96 → 0.0.97

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 (6) hide show
  1. package/README.md +243 -243
  2. package/dist/globals0.js +7131 -7131
  3. package/dist/globals1.js +1459 -1459
  4. package/dist/globals2.js +3393 -3393
  5. package/dist/index.js +36601 -36601
  6. package/package.json +13 -24
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;