@threekit-tools/treble 0.0.82 → 0.0.85-next-1
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/dist/Treble/Treble.d.ts +15 -6
- package/dist/Treble/Treble.js +58 -20
- package/dist/Treble/index.d.ts +2 -2
- package/dist/Treble/index.js +2 -2
- package/dist/Treble/{Snapshots.d.ts → snapshots.d.ts} +4 -9
- package/dist/Treble/snapshots.js +247 -0
- package/dist/Treble/{Wishlist.d.ts → wishlist.d.ts} +2 -6
- package/dist/Treble/wishlist.js +135 -0
- package/dist/api/catalog.js +6 -6
- package/dist/api/configurations.d.ts +2 -0
- package/dist/api/configurations.js +7 -5
- package/dist/api/datatables.js +5 -5
- package/dist/api/files.d.ts +1 -0
- package/dist/api/files.js +63 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/api/orders.d.ts +5 -7
- package/dist/api/orders.js +12 -12
- package/dist/api/price.js +2 -2
- package/dist/api/products.js +2 -2
- package/dist/components/Accordion/index.js +1 -6
- package/dist/components/AttributeTitle/index.d.ts +0 -9
- package/dist/components/AttributeTitle/index.js +0 -9
- package/dist/components/AttributeValue/index.d.ts +0 -6
- package/dist/components/AttributeValue/index.js +2 -8
- package/dist/components/Button/index.d.ts +0 -27
- package/dist/components/Button/index.js +0 -27
- package/dist/components/Cards/index.d.ts +2 -55
- package/dist/components/Cards/index.js +3 -60
- package/dist/components/Drawer/index.js +0 -13
- package/dist/components/Dropdown/index.d.ts +2 -59
- package/dist/components/Dropdown/index.js +4 -69
- package/dist/components/FlatForm/index.d.ts +0 -21
- package/dist/components/FlatForm/index.js +5 -24
- package/dist/components/Modal/index.js +0 -13
- package/dist/components/Player/index.d.ts +1 -1
- package/dist/components/PortalToElement/index.js +0 -8
- package/dist/components/ProductDescription/index.d.ts +0 -6
- package/dist/components/ProductDescription/index.js +0 -6
- package/dist/components/ProductName/index.d.ts +0 -9
- package/dist/components/ProductName/index.js +0 -9
- package/dist/components/Share/index.d.ts +4 -12
- package/dist/components/Share/index.js +143 -21
- package/dist/components/Share/share.styles.d.ts +9 -0
- package/dist/components/Share/share.styles.js +23 -0
- package/dist/components/Snapshots/index.d.ts +0 -8
- package/dist/components/Snapshots/index.js +0 -8
- package/dist/components/Strips/index.d.ts +2 -55
- package/dist/components/Strips/index.js +3 -60
- package/dist/components/Swatch/index.d.ts +2 -64
- package/dist/components/Swatch/index.js +3 -69
- package/dist/components/Switch/index.d.ts +2 -34
- package/dist/components/Switch/index.js +2 -38
- package/dist/components/TextInput/index.d.ts +2 -1
- package/dist/components/TextInput/index.js +2 -3
- package/dist/components/Tiles/index.d.ts +2 -29
- package/dist/components/Tiles/index.js +3 -33
- package/dist/components/TilesGroup/index.d.ts +2 -26
- package/dist/components/TilesGroup/index.js +3 -30
- package/dist/components/TotalPrice/index.d.ts +0 -6
- package/dist/components/TotalPrice/index.js +0 -6
- package/dist/components/Upload/index.d.ts +2 -1
- package/dist/components/Upload/index.js +7 -8
- package/dist/components/UploadArea/index.d.ts +2 -1
- package/dist/components/UploadArea/index.js +6 -7
- package/dist/components/Wishlist/index.d.ts +1 -4
- package/dist/components/Wishlist/index.js +2 -5
- package/dist/components/Zoom/index.d.ts +1 -18
- package/dist/components/Zoom/index.js +0 -17
- package/dist/components/formComponents.d.ts +12 -0
- package/dist/components/formComponents.js +5 -7
- package/dist/components/message/index.d.ts +0 -9
- package/dist/components/message/index.js +0 -9
- package/dist/connection.js +2 -2
- package/dist/constants.d.ts +0 -49
- package/dist/constants.js +1 -59
- package/dist/hooks/useAttribute/index.js +6 -6
- package/dist/hooks/useConfigurationLoader/index.js +5 -5
- package/dist/hooks/useNestedConfigurator/index.js +2 -2
- package/dist/hooks/useShare/index.js +3 -3
- package/dist/hooks/useSingleAnimation/index.js +20 -25
- package/dist/http/configurations.d.ts +1 -0
- package/dist/http/datatables.js +0 -1
- package/dist/http/files.d.ts +21 -0
- package/dist/http/files.js +26 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.js +2 -0
- package/dist/http/orders.d.ts +6 -8
- package/dist/icons/index.d.ts +0 -41
- package/dist/icons/index.js +0 -42
- package/dist/index.d.ts +42 -3
- package/dist/index.js +84 -30
- package/dist/store/attributes.d.ts +0 -12
- package/dist/store/attributes.js +2 -15
- package/dist/store/price.d.ts +0 -12
- package/dist/store/price.js +2 -16
- package/dist/store/product.d.ts +2 -17
- package/dist/store/product.js +26 -38
- package/dist/store/translations.d.ts +0 -12
- package/dist/store/translations.js +2 -12
- package/dist/store/treble.d.ts +1 -15
- package/dist/store/treble.js +34 -68
- package/dist/store/wishlist.d.ts +0 -12
- package/dist/store/wishlist.js +4 -17
- package/dist/types.d.ts +73 -58
- package/dist/types.js +54 -0
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +8 -16
- package/package.json +20 -4
- package/dist/Treble/Snapshots.js +0 -251
- package/dist/Treble/Wishlist.js +0 -136
package/dist/store/treble.js
CHANGED
|
@@ -63,17 +63,7 @@ var wishlist_1 = require("./wishlist");
|
|
|
63
63
|
var translations_1 = require("./translations");
|
|
64
64
|
var product_1 = require("./product");
|
|
65
65
|
var message_1 = __importDefault(require("../components/message"));
|
|
66
|
-
/*****************************************************
|
|
67
|
-
* Helper Functions
|
|
68
|
-
****************************************************/
|
|
69
66
|
var createPlayerLoaderEl = function (elementId) {
|
|
70
|
-
/**
|
|
71
|
-
* By default the player is loaded into a player-loader div that
|
|
72
|
-
* is placed outside the user's view. This is done because in
|
|
73
|
-
* React the Threekit Initialization may happen before the
|
|
74
|
-
* component with the player HTML element has loaded which would
|
|
75
|
-
* otherwise throw an error.
|
|
76
|
-
*/
|
|
77
67
|
var playerElement = document.getElementById(elementId);
|
|
78
68
|
if (playerElement)
|
|
79
69
|
return playerElement;
|
|
@@ -90,13 +80,7 @@ var createPlayerLoaderEl = function (elementId) {
|
|
|
90
80
|
document.body.appendChild(playerLoader);
|
|
91
81
|
return playerElement;
|
|
92
82
|
};
|
|
93
|
-
/*****************************************************
|
|
94
|
-
* Constants and Event Handlers
|
|
95
|
-
****************************************************/
|
|
96
83
|
var EVENTS = {};
|
|
97
|
-
/*****************************************************
|
|
98
|
-
* State
|
|
99
|
-
****************************************************/
|
|
100
84
|
var initialState = {
|
|
101
85
|
threekitEnv: 'preview',
|
|
102
86
|
isThreekitInitialized: false,
|
|
@@ -105,18 +89,12 @@ var initialState = {
|
|
|
105
89
|
notifications: true,
|
|
106
90
|
loadingProgress: 0,
|
|
107
91
|
};
|
|
108
|
-
/*****************************************************
|
|
109
|
-
* Actions
|
|
110
|
-
****************************************************/
|
|
111
92
|
exports.setThreekitEnv = (0, toolkit_1.createAction)('treble/set-threekit-env');
|
|
112
93
|
exports.setThreekitInitialized = (0, toolkit_1.createAction)('treble/set-threekit-initialized');
|
|
113
94
|
exports.setPlayerLoading = (0, toolkit_1.createAction)('treble/set-player-loading');
|
|
114
95
|
exports.setPlayerElement = (0, toolkit_1.createAction)('treble/set-player-element');
|
|
115
96
|
exports.reloadTreble = (0, toolkit_1.createAction)('treble/reload');
|
|
116
97
|
exports.updateLoadingProgress = (0, toolkit_1.createAction)('treble/update-loading-progress');
|
|
117
|
-
/*****************************************************
|
|
118
|
-
* Slice
|
|
119
|
-
****************************************************/
|
|
120
98
|
var reducer = (0, toolkit_1.createSlice)({
|
|
121
99
|
name: 'treble',
|
|
122
100
|
initialState: initialState,
|
|
@@ -147,15 +125,10 @@ var reducer = (0, toolkit_1.createSlice)({
|
|
|
147
125
|
});
|
|
148
126
|
},
|
|
149
127
|
}).reducer;
|
|
150
|
-
/*****************************************************
|
|
151
|
-
* Standard Selectors
|
|
152
|
-
****************************************************/
|
|
153
|
-
// Loading Trackers
|
|
154
128
|
var getThreekitEnv = function (state) {
|
|
155
129
|
return state.treble.threekitEnv;
|
|
156
130
|
};
|
|
157
131
|
exports.getThreekitEnv = getThreekitEnv;
|
|
158
|
-
// Loading Trackers
|
|
159
132
|
var isThreekitInitialized = function (state) {
|
|
160
133
|
return state.treble.isThreekitInitialized;
|
|
161
134
|
};
|
|
@@ -164,36 +137,29 @@ var isPlayerLoading = function (state) {
|
|
|
164
137
|
return state.treble.isPlayerLoading;
|
|
165
138
|
};
|
|
166
139
|
exports.isPlayerLoading = isPlayerLoading;
|
|
167
|
-
// Player's HTML element
|
|
168
140
|
var getPlayerElementId = function (state) {
|
|
169
141
|
return state.treble.playerElId;
|
|
170
142
|
};
|
|
171
143
|
exports.getPlayerElementId = getPlayerElementId;
|
|
172
|
-
// Player's HTML element
|
|
173
144
|
var getLoadingProgress = function (state) {
|
|
174
145
|
return state.treble.loadingProgress;
|
|
175
146
|
};
|
|
176
147
|
exports.getLoadingProgress = getLoadingProgress;
|
|
177
|
-
/*****************************************************
|
|
178
|
-
* Complex Actions
|
|
179
|
-
****************************************************/
|
|
180
148
|
var initPlayer = function (config) {
|
|
181
149
|
return function (dispatch, getState) { return __awaiter(void 0, void 0, void 0, function () {
|
|
182
|
-
var el, authToken, assetId, stageId, orgId, playerConfig, initialConfiguration, player, configurator;
|
|
150
|
+
var el, authToken, assetId, stageId, configurationId, orgId, playerConfig, initialConfiguration, player, configurator;
|
|
183
151
|
return __generator(this, function (_a) {
|
|
184
152
|
switch (_a.label) {
|
|
185
153
|
case 0:
|
|
186
|
-
el = config.el, authToken = config.authToken, assetId = config.assetId, stageId = config.stageId, orgId = config.orgId, playerConfig = config.playerConfig, initialConfiguration = config.initialConfiguration;
|
|
187
|
-
return [4
|
|
188
|
-
// Variables to sort out
|
|
189
|
-
authToken: authToken, stageId: stageId, assetId: assetId }, playerConfig), { initialConfiguration: initialConfiguration, onLoadingProgress: function (progress) {
|
|
154
|
+
el = config.el, authToken = config.authToken, assetId = config.assetId, stageId = config.stageId, configurationId = config.configurationId, orgId = config.orgId, playerConfig = config.playerConfig, initialConfiguration = config.initialConfiguration;
|
|
155
|
+
return [4, window.threekitPlayer(__assign(__assign({ el: el, authToken: authToken, stageId: stageId, assetId: assetId, configurationId: configurationId }, playerConfig), { initialConfiguration: initialConfiguration, onLoadingProgress: function (progress) {
|
|
190
156
|
var _a;
|
|
191
157
|
dispatch((0, exports.updateLoadingProgress)(progress));
|
|
192
158
|
(_a = playerConfig === null || playerConfig === void 0 ? void 0 : playerConfig.onLoadingProgress) === null || _a === void 0 ? void 0 : _a.call(playerConfig, progress);
|
|
193
159
|
} }))];
|
|
194
160
|
case 1:
|
|
195
161
|
player = _a.sent();
|
|
196
|
-
return [4
|
|
162
|
+
return [4, player.getConfigurator()];
|
|
197
163
|
case 2:
|
|
198
164
|
configurator = _a.sent();
|
|
199
165
|
if (window.threekit) {
|
|
@@ -228,14 +194,14 @@ var initPlayer = function (config) {
|
|
|
228
194
|
previousAttributes = Object.values(attributes);
|
|
229
195
|
updatedAttributes = window.threekit.configurator.getDisplayAttributes();
|
|
230
196
|
dispatch((0, attributes_1.setAttributes)(updatedAttributes));
|
|
231
|
-
return [4
|
|
197
|
+
return [4, ((_a = EVENTS.postConfigurationChange) === null || _a === void 0 ? void 0 : _a.call(EVENTS, updatedAttributes, {}, previousAttributes))];
|
|
232
198
|
case 1:
|
|
233
199
|
_b.sent();
|
|
234
|
-
return [2
|
|
200
|
+
return [2];
|
|
235
201
|
}
|
|
236
202
|
});
|
|
237
203
|
}); });
|
|
238
|
-
return [2
|
|
204
|
+
return [2];
|
|
239
205
|
}
|
|
240
206
|
});
|
|
241
207
|
}); };
|
|
@@ -249,7 +215,7 @@ var launch = function (launchConfig) {
|
|
|
249
215
|
switch (_j.label) {
|
|
250
216
|
case 0:
|
|
251
217
|
if (window.threekit)
|
|
252
|
-
return [2
|
|
218
|
+
return [2];
|
|
253
219
|
config = (0, utils_1.loadTrebleConfig)();
|
|
254
220
|
credentials = ((_b = launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.project) === null || _b === void 0 ? void 0 : _b.credentials) || ((_c = config.project) === null || _c === void 0 ? void 0 : _c.credentials) || {};
|
|
255
221
|
productsRaw = ((_d = launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.project) === null || _d === void 0 ? void 0 : _d.products) || ((_e = config.project) === null || _e === void 0 ? void 0 : _e.products) || {};
|
|
@@ -296,12 +262,14 @@ var launch = function (launchConfig) {
|
|
|
296
262
|
return Object.assign(output, (_b = {}, _b[prodId] = updatedEnvs, _b));
|
|
297
263
|
}, {});
|
|
298
264
|
if (!Object.keys(credentials).length || !Object.keys(products).length)
|
|
299
|
-
return [2
|
|
265
|
+
return [2, console.error('Missing credentials')];
|
|
266
|
+
dispatch((0, product_1.initProduct)(products));
|
|
267
|
+
dispatch((0, product_1.setProductId)(productId));
|
|
300
268
|
threekitEnv = (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.threekitEnv) || process.env.THREEKIT_ENV || 'preview';
|
|
301
269
|
serverUrl = (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.serverUrl) || ((_g = config === null || config === void 0 ? void 0 : config.project) === null || _g === void 0 ? void 0 : _g.serverUrl);
|
|
302
270
|
playerConfig = Object.assign({}, constants_1.DEFAULT_PLAYER_CONFIG, config.player, launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.playerConfig);
|
|
303
271
|
envCredentials = credentials[threekitEnv];
|
|
304
|
-
_a = products[productId][threekitEnv], assetIdRaw = _a.assetId, stageId = _a.stageId, configurationId = _a.configurationId, initialConfigurationRaw = _a.initialConfiguration;
|
|
272
|
+
_a = products[productId][threekitEnv] || {}, assetIdRaw = _a.assetId, stageId = _a.stageId, configurationId = _a.configurationId, initialConfigurationRaw = _a.initialConfiguration;
|
|
305
273
|
assetId = (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.assetId) || assetIdRaw;
|
|
306
274
|
threekitDomainRaw = envCredentials.threekitDomain || "".concat(threekitEnv, ".threekit.com");
|
|
307
275
|
orgId = envCredentials.orgId, authToken = envCredentials.publicToken;
|
|
@@ -314,7 +282,6 @@ var launch = function (launchConfig) {
|
|
|
314
282
|
el = createPlayerLoaderEl(constants_1.TK_PLAYER_ROOT_DIV);
|
|
315
283
|
dispatch((0, exports.setPlayerElement)(constants_1.TK_PLAYER_ROOT_DIV));
|
|
316
284
|
}
|
|
317
|
-
// Connection
|
|
318
285
|
connection_1.default.connect({
|
|
319
286
|
authToken: authToken,
|
|
320
287
|
orgId: orgId,
|
|
@@ -329,8 +296,8 @@ var launch = function (launchConfig) {
|
|
|
329
296
|
configId = ((_h = params[constants_1.TK_SAVED_CONFIG_PARAM_KEY]) === null || _h === void 0 ? void 0 : _h.length)
|
|
330
297
|
? params[constants_1.TK_SAVED_CONFIG_PARAM_KEY]
|
|
331
298
|
: configurationId;
|
|
332
|
-
if (!configId) return [3
|
|
333
|
-
return [4
|
|
299
|
+
if (!configId) return [3, 2];
|
|
300
|
+
return [4, api_1.default.configurations.fetch(configId)];
|
|
334
301
|
case 1:
|
|
335
302
|
configuration = _j.sent();
|
|
336
303
|
if (configuration) {
|
|
@@ -341,9 +308,8 @@ var launch = function (launchConfig) {
|
|
|
341
308
|
_j.label = 2;
|
|
342
309
|
case 2:
|
|
343
310
|
if (!updatedAssetId)
|
|
344
|
-
return [2
|
|
345
|
-
|
|
346
|
-
return [4 /*yield*/, new Promise(function (resolve) {
|
|
311
|
+
return [2, console.error('missing assetId')];
|
|
312
|
+
return [4, new Promise(function (resolve) {
|
|
347
313
|
var script = document.createElement('script');
|
|
348
314
|
script.src = "".concat(threekitDomain, "/app/js/threekit-player-bundle.js");
|
|
349
315
|
script.id = 'threekit-player-bundle';
|
|
@@ -351,14 +317,14 @@ var launch = function (launchConfig) {
|
|
|
351
317
|
document.head.appendChild(script);
|
|
352
318
|
})];
|
|
353
319
|
case 3:
|
|
354
|
-
// We create the threekit script
|
|
355
320
|
_j.sent();
|
|
356
|
-
return [4
|
|
321
|
+
return [4, dispatch((0, exports.initPlayer)({
|
|
357
322
|
el: el,
|
|
358
323
|
orgId: orgId,
|
|
359
324
|
authToken: authToken,
|
|
360
325
|
stageId: stageId,
|
|
361
326
|
assetId: updatedAssetId,
|
|
327
|
+
configurationId: configId,
|
|
362
328
|
playerConfig: playerConfig,
|
|
363
329
|
initialConfiguration: initialConfiguration,
|
|
364
330
|
}))];
|
|
@@ -368,14 +334,15 @@ var launch = function (launchConfig) {
|
|
|
368
334
|
message_1.default.info(e.detail.message);
|
|
369
335
|
});
|
|
370
336
|
EVENTS = Object.assign(EVENTS, launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.eventHandlers);
|
|
337
|
+
dispatch((0, product_1.setName)());
|
|
338
|
+
dispatch((0, product_1.setMetadata)());
|
|
339
|
+
dispatch((0, product_1.initProduct)());
|
|
371
340
|
dispatch((0, exports.setThreekitEnv)(threekitEnv));
|
|
372
341
|
dispatch((0, translations_1.initTranslations)(launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.locale));
|
|
373
342
|
dispatch((0, price_1.initPrice)());
|
|
374
343
|
dispatch((0, price_1.updatePrice)());
|
|
375
|
-
dispatch((0, product_1.initProduct)(products));
|
|
376
|
-
dispatch((0, product_1.setProductId)(productId));
|
|
377
344
|
dispatch((0, wishlist_1.refreshWishlist)());
|
|
378
|
-
return [2
|
|
345
|
+
return [2];
|
|
379
346
|
}
|
|
380
347
|
});
|
|
381
348
|
}); };
|
|
@@ -390,10 +357,10 @@ var unloadPlayer = function () { return function (dispatch) { return __awaiter(v
|
|
|
390
357
|
dispatch((0, attributes_1.setAttributes)([]));
|
|
391
358
|
dispatch((0, product_1.setName)(''));
|
|
392
359
|
dispatch((0, product_1.setMetadata)({}));
|
|
393
|
-
return [4
|
|
360
|
+
return [4, window.threekit.player.unload()];
|
|
394
361
|
case 1:
|
|
395
362
|
_a.sent();
|
|
396
|
-
return [2
|
|
363
|
+
return [2];
|
|
397
364
|
}
|
|
398
365
|
});
|
|
399
366
|
}); }; };
|
|
@@ -405,19 +372,19 @@ var reloadPlayer = function (config) {
|
|
|
405
372
|
switch (_a.label) {
|
|
406
373
|
case 0:
|
|
407
374
|
connectionObj = connection_1.default.getConnection();
|
|
408
|
-
if (!(config === undefined)) return [3
|
|
375
|
+
if (!(config === undefined)) return [3, 1];
|
|
409
376
|
assetId = connectionObj.assetId;
|
|
410
|
-
return [3
|
|
377
|
+
return [3, 4];
|
|
411
378
|
case 1:
|
|
412
|
-
if (!(typeof config === 'string')) return [3
|
|
379
|
+
if (!(typeof config === 'string')) return [3, 2];
|
|
413
380
|
assetId = config;
|
|
414
|
-
return [3
|
|
381
|
+
return [3, 4];
|
|
415
382
|
case 2:
|
|
416
383
|
assetId = (config === null || config === void 0 ? void 0 : config.assetId) || connectionObj.assetId;
|
|
417
384
|
stageId = config === null || config === void 0 ? void 0 : config.stageId;
|
|
418
385
|
initialConfiguration = (config === null || config === void 0 ? void 0 : config.configuration) || {};
|
|
419
|
-
if (!(config === null || config === void 0 ? void 0 : config.configurationId)) return [3
|
|
420
|
-
return [4
|
|
386
|
+
if (!(config === null || config === void 0 ? void 0 : config.configurationId)) return [3, 4];
|
|
387
|
+
return [4, api_1.default.configurations.fetch(config === null || config === void 0 ? void 0 : config.configurationId)];
|
|
421
388
|
case 3:
|
|
422
389
|
configuration = _a.sent();
|
|
423
390
|
if (configuration) {
|
|
@@ -426,19 +393,18 @@ var reloadPlayer = function (config) {
|
|
|
426
393
|
}
|
|
427
394
|
_a.label = 4;
|
|
428
395
|
case 4:
|
|
429
|
-
// Update connection
|
|
430
396
|
if (assetId !== connectionObj.assetId)
|
|
431
397
|
connection_1.default.connect({ assetId: assetId });
|
|
432
398
|
state = getState();
|
|
433
399
|
trebleConfig = (0, utils_1.loadTrebleConfig)();
|
|
434
400
|
playerConfig = Object.assign({}, constants_1.DEFAULT_PLAYER_CONFIG, trebleConfig.player);
|
|
435
401
|
el = document.getElementById(state.treble.playerElId);
|
|
436
|
-
if (!state.treble.isThreekitInitialized) return [3
|
|
437
|
-
return [4
|
|
402
|
+
if (!state.treble.isThreekitInitialized) return [3, 6];
|
|
403
|
+
return [4, dispatch((0, exports.unloadPlayer)())];
|
|
438
404
|
case 5:
|
|
439
405
|
_a.sent();
|
|
440
406
|
_a.label = 6;
|
|
441
|
-
case 6: return [4
|
|
407
|
+
case 6: return [4, dispatch((0, exports.initPlayer)({
|
|
442
408
|
el: el,
|
|
443
409
|
orgId: connectionObj.orgId,
|
|
444
410
|
authToken: connectionObj.authToken,
|
|
@@ -451,7 +417,7 @@ var reloadPlayer = function (config) {
|
|
|
451
417
|
_a.sent();
|
|
452
418
|
dispatch((0, price_1.updatePrice)());
|
|
453
419
|
dispatch((0, product_1.initProduct)());
|
|
454
|
-
return [2
|
|
420
|
+
return [2];
|
|
455
421
|
}
|
|
456
422
|
});
|
|
457
423
|
}); };
|
package/dist/store/wishlist.d.ts
CHANGED
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
import { RootState, ThreekitDispatch } from './index';
|
|
2
2
|
import { WishlistArray } from '../Treble';
|
|
3
3
|
import { ISaveConfiguration } from '../api/configurations';
|
|
4
|
-
/*****************************************************
|
|
5
|
-
* Types and Interfaces
|
|
6
|
-
****************************************************/
|
|
7
4
|
export declare type WishlistState = WishlistArray;
|
|
8
|
-
/*****************************************************
|
|
9
|
-
* Standard Selectors
|
|
10
|
-
****************************************************/
|
|
11
5
|
export declare const refreshWishlist: import("@reduxjs/toolkit").AsyncThunk<import("../http/configurations").IConfigurationResponse[], void, {}>;
|
|
12
6
|
export declare const addToWishlist: import("@reduxjs/toolkit").AsyncThunk<import("../http/configurations").IConfigurationResponse[], Omit<ISaveConfiguration, "configuration">, {}>;
|
|
13
7
|
export declare const clearWishlist: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[], import("../http/configurations").IConfigurationResponse[], "treble/wishlist/clear", never, never>;
|
|
14
8
|
export declare const removeFromWishlist: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[idx: number], import("../http/configurations").IConfigurationResponse[], "treble/wishlist/remove-item", never, never>;
|
|
15
|
-
/*****************************************************
|
|
16
|
-
* Slice
|
|
17
|
-
****************************************************/
|
|
18
9
|
declare const reducer: import("redux").Reducer<WishlistArray, import("redux").AnyAction>;
|
|
19
|
-
/*****************************************************
|
|
20
|
-
* Standard Selectors
|
|
21
|
-
****************************************************/
|
|
22
10
|
export declare const getWishlist: (state: RootState) => WishlistArray;
|
|
23
11
|
export declare const resumeFromWishlist: (idx: number) => (_: ThreekitDispatch, getState: () => RootState) => void;
|
|
24
12
|
export default reducer;
|
package/dist/store/wishlist.js
CHANGED
|
@@ -38,21 +38,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.resumeFromWishlist = exports.getWishlist = exports.removeFromWishlist = exports.clearWishlist = exports.addToWishlist = exports.refreshWishlist = void 0;
|
|
40
40
|
var toolkit_1 = require("@reduxjs/toolkit");
|
|
41
|
-
/*****************************************************
|
|
42
|
-
* State
|
|
43
|
-
****************************************************/
|
|
44
41
|
var initialState = [];
|
|
45
|
-
/*****************************************************
|
|
46
|
-
* Standard Selectors
|
|
47
|
-
****************************************************/
|
|
48
42
|
exports.refreshWishlist = (0, toolkit_1.createAsyncThunk)('treble/wishlist/refresh-data', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
43
|
var wishlistData;
|
|
50
44
|
return __generator(this, function (_a) {
|
|
51
45
|
switch (_a.label) {
|
|
52
|
-
case 0: return [4
|
|
46
|
+
case 0: return [4, window.threekit.treble.wishlist.getWishlist()];
|
|
53
47
|
case 1:
|
|
54
48
|
wishlistData = _a.sent();
|
|
55
|
-
return [2
|
|
49
|
+
return [2, wishlistData];
|
|
56
50
|
}
|
|
57
51
|
});
|
|
58
52
|
}); });
|
|
@@ -60,10 +54,10 @@ exports.addToWishlist = (0, toolkit_1.createAsyncThunk)('treble/wishlist/add-ite
|
|
|
60
54
|
var wishlistData;
|
|
61
55
|
return __generator(this, function (_a) {
|
|
62
56
|
switch (_a.label) {
|
|
63
|
-
case 0: return [4
|
|
57
|
+
case 0: return [4, window.threekit.treble.wishlist.addItem(config)];
|
|
64
58
|
case 1:
|
|
65
59
|
wishlistData = _a.sent();
|
|
66
|
-
return [2
|
|
60
|
+
return [2, wishlistData];
|
|
67
61
|
}
|
|
68
62
|
});
|
|
69
63
|
}); });
|
|
@@ -75,9 +69,6 @@ exports.removeFromWishlist = (0, toolkit_1.createAction)('treble/wishlist/remove
|
|
|
75
69
|
var wishlistData = window.threekit.treble.wishlist.removeItemByIdx(idx);
|
|
76
70
|
return { payload: wishlistData };
|
|
77
71
|
});
|
|
78
|
-
/*****************************************************
|
|
79
|
-
* Slice
|
|
80
|
-
****************************************************/
|
|
81
72
|
var reducer = (0, toolkit_1.createSlice)({
|
|
82
73
|
name: 'wishlist',
|
|
83
74
|
initialState: initialState,
|
|
@@ -97,10 +88,6 @@ var reducer = (0, toolkit_1.createSlice)({
|
|
|
97
88
|
});
|
|
98
89
|
},
|
|
99
90
|
}).reducer;
|
|
100
|
-
/*****************************************************
|
|
101
|
-
* Standard Selectors
|
|
102
|
-
****************************************************/
|
|
103
|
-
// Wishlist
|
|
104
91
|
var getWishlist = function (state) { return state.wishlist; };
|
|
105
92
|
exports.getWishlist = getWishlist;
|
|
106
93
|
var resumeFromWishlist = function (idx) { return function (_, getState) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,33 +1,67 @@
|
|
|
1
1
|
/// <reference types="webpack-env" />
|
|
2
2
|
import threekitAPI from './api';
|
|
3
3
|
import Treble from './Treble';
|
|
4
|
-
declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
declare enum SCENE_PHASES {
|
|
5
|
+
LOADED = 0,
|
|
6
|
+
PRELOADED = 1,
|
|
7
|
+
RENDERED = 2
|
|
8
|
+
}
|
|
9
|
+
export declare enum PRIVATE_APIS {
|
|
10
|
+
SCENE = "scene",
|
|
11
|
+
PLAYER = "player"
|
|
12
|
+
}
|
|
13
|
+
export declare enum DISPLAY_OPTIONS {
|
|
14
|
+
WEBGL = "webgl",
|
|
15
|
+
IMAGE = "image"
|
|
16
|
+
}
|
|
17
|
+
export declare enum ATTRIBUTE_TYPES {
|
|
18
|
+
STRING = "String",
|
|
19
|
+
ASSET = "Asset",
|
|
20
|
+
COLOR = "Color",
|
|
21
|
+
NUMBER = "Number",
|
|
22
|
+
BOOLEAN = "Boolean"
|
|
23
|
+
}
|
|
24
|
+
export declare enum ASSET_TYPES {
|
|
25
|
+
UPLOAD = "upload",
|
|
26
|
+
ITEM = "item"
|
|
27
|
+
}
|
|
28
|
+
export declare enum PLUG_TYPES {
|
|
29
|
+
PROXY = "Proxy",
|
|
30
|
+
TRANSFORM = "Transform"
|
|
31
|
+
}
|
|
32
|
+
export declare enum TRANSFORM_PROPERTY_TYPES {
|
|
33
|
+
ROTATION = "rotation",
|
|
34
|
+
TRANSLATION = "translation",
|
|
35
|
+
SCALE = "scale"
|
|
36
|
+
}
|
|
37
|
+
export declare enum SNAPSHOT_FORMATS {
|
|
38
|
+
JPG = "jpg",
|
|
39
|
+
PNG = "png"
|
|
40
|
+
}
|
|
41
|
+
export declare enum SNAPSHOT_OUTPUTS {
|
|
42
|
+
URL = "url",
|
|
43
|
+
DOWNLOAD = "download",
|
|
44
|
+
DATA_URL = "dataUrl",
|
|
45
|
+
BLOB = "blob",
|
|
46
|
+
FILE = "file"
|
|
47
|
+
}
|
|
9
48
|
export declare type IMetadata = Record<string, string | number | null>;
|
|
10
|
-
|
|
11
|
-
* Scene
|
|
12
|
-
**************************************************/
|
|
13
|
-
export interface ISceneQuery {
|
|
49
|
+
export interface ISceneQueryShared {
|
|
14
50
|
all?: boolean;
|
|
15
51
|
id?: string;
|
|
16
52
|
name?: string | RegExp;
|
|
17
53
|
type?: string | Array<string>;
|
|
18
54
|
names?: Array<RegExp>;
|
|
19
55
|
properties?: any;
|
|
20
|
-
property?: string;
|
|
21
56
|
child?: string;
|
|
22
57
|
parent?: boolean;
|
|
23
58
|
includeParent?: boolean;
|
|
24
|
-
from?: string |
|
|
59
|
+
from?: string | ISceneQueryShared | ISceneQueryNode;
|
|
25
60
|
hasPlug?: string;
|
|
26
61
|
operator?: any;
|
|
27
62
|
operatorIndex?: number;
|
|
28
63
|
evalNode?: boolean;
|
|
29
64
|
evalPlug?: string;
|
|
30
|
-
plug?: string;
|
|
31
65
|
shallow?: boolean;
|
|
32
66
|
skipModels?: boolean;
|
|
33
67
|
configurator?: boolean;
|
|
@@ -36,14 +70,20 @@ export interface ISceneQuery {
|
|
|
36
70
|
tags?: Array<RegExp>;
|
|
37
71
|
hierarchial?: boolean;
|
|
38
72
|
}
|
|
73
|
+
export interface ISceneQueryNode extends ISceneQueryShared {
|
|
74
|
+
plug?: PLUG_TYPES.PROXY;
|
|
75
|
+
property?: 'asset';
|
|
76
|
+
}
|
|
77
|
+
export interface ISceneQueryTransform extends ISceneQueryShared {
|
|
78
|
+
plug: PLUG_TYPES.TRANSFORM;
|
|
79
|
+
property: TRANSFORM_PROPERTY_TYPES;
|
|
80
|
+
}
|
|
81
|
+
export declare type ISceneQuery = ISceneQueryNode | ISceneQueryTransform | string;
|
|
39
82
|
export interface ISceneResult {
|
|
40
83
|
id: string;
|
|
41
84
|
name: string;
|
|
42
85
|
configurator: IThreekitPrivateConfigurator;
|
|
43
86
|
}
|
|
44
|
-
/***************************************************
|
|
45
|
-
* Configuration
|
|
46
|
-
**************************************************/
|
|
47
87
|
export interface IConfigurationAsset {
|
|
48
88
|
assetId: string;
|
|
49
89
|
configuration?: string;
|
|
@@ -57,22 +97,16 @@ export interface IConfigurationColor {
|
|
|
57
97
|
export declare type IConfigurationAttribute = IConfigurationAsset | IConfigurationColor | string | number | boolean | undefined;
|
|
58
98
|
export declare type IConfiguration = Record<string, IConfigurationAttribute>;
|
|
59
99
|
export declare type ISetConfiguration = Record<string, IConfigurationAttribute>;
|
|
60
|
-
/***************************************************
|
|
61
|
-
* ATTRIBUTES
|
|
62
|
-
*
|
|
63
|
-
* This section covers both getAttributes() and getDisplayAttributes()
|
|
64
|
-
**************************************************/
|
|
65
100
|
interface IDisplayAttributeConfig {
|
|
66
101
|
includeHidden?: boolean;
|
|
67
102
|
}
|
|
68
|
-
interface IAttributeBase<T extends
|
|
103
|
+
interface IAttributeBase<T extends ATTRIBUTE_TYPES, V extends IConfigurationAttribute> {
|
|
69
104
|
type: T;
|
|
70
105
|
id: string;
|
|
71
106
|
name: string;
|
|
72
107
|
value: V;
|
|
73
108
|
label: string;
|
|
74
109
|
}
|
|
75
|
-
/****** ASSET TYPE ATTRIBUTE *******/
|
|
76
110
|
export interface IConfigurationAssetValue {
|
|
77
111
|
assetId: string;
|
|
78
112
|
name: string;
|
|
@@ -90,8 +124,8 @@ export interface IHydratedAttributeAssetValue extends IDisplayAttributeAssetValu
|
|
|
90
124
|
handleSelect: () => Promise<void>;
|
|
91
125
|
selected: boolean;
|
|
92
126
|
}
|
|
93
|
-
export interface IAttributeAssetBase<V> extends IAttributeBase<
|
|
94
|
-
assetType:
|
|
127
|
+
export interface IAttributeAssetBase<V> extends IAttributeBase<ATTRIBUTE_TYPES.ASSET, IConfigurationAsset> {
|
|
128
|
+
assetType: ASSET_TYPES;
|
|
95
129
|
blacklist: [];
|
|
96
130
|
defaultValue: IConfigurationAsset;
|
|
97
131
|
hiddenValues?: Array<string>;
|
|
@@ -101,7 +135,6 @@ export interface IAttributeAssetBase<V> extends IAttributeBase<'Asset', IConfigu
|
|
|
101
135
|
export declare type IDisplayAttributeAsset = IAttributeAssetBase<IDisplayAttributeAssetValue>;
|
|
102
136
|
export declare type IHydratedAttributeAsset = IAttributeAssetBase<IHydratedAttributeAssetValue>;
|
|
103
137
|
export declare type IAttributeAsset = IAttributeAssetBase<IConfigurationAssetValue>;
|
|
104
|
-
/****** String TYPE ATTRIBUTE *******/
|
|
105
138
|
export interface IDisplayAttributeStringValue {
|
|
106
139
|
label: string;
|
|
107
140
|
value: string;
|
|
@@ -110,7 +143,7 @@ export interface IHydratedAttributeStringValue extends IDisplayAttributeStringVa
|
|
|
110
143
|
handleSelect: () => Promise<void>;
|
|
111
144
|
selected: boolean;
|
|
112
145
|
}
|
|
113
|
-
export interface IAttributeStringBase<V> extends IAttributeBase<
|
|
146
|
+
export interface IAttributeStringBase<V> extends IAttributeBase<ATTRIBUTE_TYPES.STRING, string> {
|
|
114
147
|
blacklist: [];
|
|
115
148
|
defaultValue: string;
|
|
116
149
|
hiddenValues?: Array<string>;
|
|
@@ -120,31 +153,22 @@ export interface IAttributeStringBase<V> extends IAttributeBase<'String', string
|
|
|
120
153
|
export declare type IDisplayAttributeString = IAttributeStringBase<IDisplayAttributeStringValue>;
|
|
121
154
|
export declare type IHydratedAttributeString = IAttributeStringBase<IHydratedAttributeStringValue>;
|
|
122
155
|
export declare type IAttributeString = IAttributeStringBase<string>;
|
|
123
|
-
|
|
124
|
-
export interface IAttributeColor extends IAttributeBase<'Color', IConfigurationColor> {
|
|
156
|
+
export interface IAttributeColor extends IAttributeBase<ATTRIBUTE_TYPES.COLOR, IConfigurationColor> {
|
|
125
157
|
defaultValue: IConfigurationColor;
|
|
126
158
|
}
|
|
127
|
-
|
|
128
|
-
export interface IAttributeNumber extends IAttributeBase<'Number', number> {
|
|
159
|
+
export interface IAttributeNumber extends IAttributeBase<ATTRIBUTE_TYPES.NUMBER, number> {
|
|
129
160
|
defaultValue: number;
|
|
130
161
|
lockToStep: boolean;
|
|
131
162
|
max?: number;
|
|
132
163
|
min?: number;
|
|
133
164
|
step: number;
|
|
134
165
|
}
|
|
135
|
-
|
|
136
|
-
export interface IAttributeBoolean extends IAttributeBase<'Boolean', boolean> {
|
|
166
|
+
export interface IAttributeBoolean extends IAttributeBase<ATTRIBUTE_TYPES.BOOLEAN, boolean> {
|
|
137
167
|
defaultValue: boolean;
|
|
138
168
|
}
|
|
139
|
-
/****** getAttributes() *******/
|
|
140
169
|
export declare type IThreekitAttribute = IAttributeAsset | IAttributeColor | IAttributeString | IAttributeNumber | IAttributeBoolean;
|
|
141
|
-
/****** getDisplayAttributes() *******/
|
|
142
170
|
export declare type IThreekitDisplayAttribute = IDisplayAttributeAsset | IDisplayAttributeString | IAttributeColor | IAttributeNumber | IAttributeBoolean;
|
|
143
|
-
/****** Treble Hydrated Values *******/
|
|
144
171
|
export declare type IHydratedAttribute = IHydratedAttributeAsset | IHydratedAttributeString | IAttributeColor | IAttributeNumber | IAttributeBoolean;
|
|
145
|
-
/***************************************************
|
|
146
|
-
* Camera
|
|
147
|
-
**************************************************/
|
|
148
172
|
export interface ICoordinates {
|
|
149
173
|
x: number;
|
|
150
174
|
y: number;
|
|
@@ -160,10 +184,6 @@ export interface ISnapshotConfig {
|
|
|
160
184
|
height: number;
|
|
161
185
|
};
|
|
162
186
|
}
|
|
163
|
-
export declare type SNAPSHOT_FORMAT_TYPES = 'jpg' | 'png';
|
|
164
|
-
/***************************************************
|
|
165
|
-
* Tools
|
|
166
|
-
**************************************************/
|
|
167
187
|
export interface Node {
|
|
168
188
|
name: string;
|
|
169
189
|
nodeId: string;
|
|
@@ -211,9 +231,6 @@ export interface IThreekitTools {
|
|
|
211
231
|
setTool: () => void;
|
|
212
232
|
setTools: () => void;
|
|
213
233
|
}
|
|
214
|
-
/***************************************************
|
|
215
|
-
* Threekit Api
|
|
216
|
-
**************************************************/
|
|
217
234
|
export interface IConfigurationChangeEvent {
|
|
218
235
|
name: string;
|
|
219
236
|
appliedConfiguration: Record<string, string>;
|
|
@@ -231,13 +248,13 @@ export interface IThreekitConfigurator {
|
|
|
231
248
|
}
|
|
232
249
|
export interface IThreekitScene {
|
|
233
250
|
PHASES: {
|
|
234
|
-
LOADED:
|
|
235
|
-
PRELOADED:
|
|
236
|
-
RENDERED:
|
|
251
|
+
LOADED: SCENE_PHASES.LOADED;
|
|
252
|
+
PRELOADED: SCENE_PHASES.PRELOADED;
|
|
253
|
+
RENDERED: SCENE_PHASES.RENDERED;
|
|
237
254
|
};
|
|
238
|
-
get: (query:
|
|
239
|
-
find: (query: ISceneQuery
|
|
240
|
-
set: (query:
|
|
255
|
+
get: <T extends ISceneQuery>(query: T) => T extends ISceneQueryTransform ? ICoordinates : ISceneResult;
|
|
256
|
+
find: (query: ISceneQuery) => string;
|
|
257
|
+
set: (query: ISceneQueryTransform, transform: ICoordinates) => void;
|
|
241
258
|
}
|
|
242
259
|
export interface IThreekitCamera {
|
|
243
260
|
frameBoundingSphere: () => void;
|
|
@@ -259,12 +276,13 @@ export interface IThreekitPlayer {
|
|
|
259
276
|
on: (phase: SCENE_PHASES | string, callback: (args: any) => void) => void;
|
|
260
277
|
getConfigurator: () => Promise<IThreekitConfigurator>;
|
|
261
278
|
getStageConfigurator: () => Promise<IThreekitConfigurator>;
|
|
262
|
-
enableApi: (api:
|
|
279
|
+
enableApi: <T extends PRIVATE_APIS>(api: T) => T extends PRIVATE_APIS.PLAYER ? IThreekitPrivatePlayer : any;
|
|
263
280
|
snapshotAsync: (snapshotConfig: ISnapshotConfig) => Promise<string>;
|
|
264
281
|
unload: () => Promise<string>;
|
|
265
282
|
}
|
|
266
283
|
export interface IThreekitPrivateConfigurator extends IThreekitConfigurator {
|
|
267
284
|
getAppliedConfiguration: (attributeName: string) => string;
|
|
285
|
+
getFullConfiguration: () => IConfiguration;
|
|
268
286
|
}
|
|
269
287
|
export interface IThreekitPrivatePlayer {
|
|
270
288
|
getConfigurator: () => IThreekitPrivateConfigurator;
|
|
@@ -272,12 +290,15 @@ export interface IThreekitPrivatePlayer {
|
|
|
272
290
|
getFullConfiguration: () => IConfiguration;
|
|
273
291
|
};
|
|
274
292
|
calculateLogs: () => Promise<Record<string, any>>;
|
|
293
|
+
getAssetInstance: (query: ISceneQueryNode | string) => Promise<string>;
|
|
294
|
+
saveSceneGraphState: () => string;
|
|
275
295
|
}
|
|
276
296
|
export interface ThreekitInitConfig {
|
|
277
297
|
authToken: string;
|
|
278
298
|
el: HTMLElement;
|
|
279
299
|
assetId: string;
|
|
280
300
|
stageId?: string;
|
|
301
|
+
configurationId?: string;
|
|
281
302
|
orgId?: string;
|
|
282
303
|
showConfigurator?: boolean;
|
|
283
304
|
initialConfiguration?: Record<string, any>;
|
|
@@ -305,9 +326,6 @@ export interface ThreekitInitConfig {
|
|
|
305
326
|
help?: string;
|
|
306
327
|
};
|
|
307
328
|
}
|
|
308
|
-
/***************************************************
|
|
309
|
-
* Treble Declarations
|
|
310
|
-
**************************************************/
|
|
311
329
|
export interface IFrameworkConfig {
|
|
312
330
|
productsCtx: __WebpackModuleApi.RequireContext;
|
|
313
331
|
}
|
|
@@ -337,9 +355,6 @@ export interface ITrebleConfig {
|
|
|
337
355
|
treble: IFrameworkConfig;
|
|
338
356
|
player: IPlayerConfig;
|
|
339
357
|
}
|
|
340
|
-
/***************************************************
|
|
341
|
-
* Global Declaration
|
|
342
|
-
**************************************************/
|
|
343
358
|
declare global {
|
|
344
359
|
interface Window {
|
|
345
360
|
threekitPlayer: (arg0: ThreekitInitConfig) => Promise<IThreekitPlayer>;
|