@threekit-tools/treble 0.0.91-next-03 → 0.0.92

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 (91) hide show
  1. package/dist/Treble/Treble.d.ts +2 -2
  2. package/dist/Treble/Treble.js +3 -3
  3. package/dist/Treble/index.d.ts +1 -1
  4. package/dist/Treble/index.js +1 -1
  5. package/dist/Treble/snapshot.d.ts +1 -1
  6. package/dist/Treble/snapshots.d.ts +22 -0
  7. package/dist/Treble/snapshots.js +247 -0
  8. package/dist/Treble/wishlist.d.ts +1 -1
  9. package/dist/Treble/wishlist.js +1 -1
  10. package/dist/api/catalog.js +1 -1
  11. package/dist/api/configurations.js +1 -1
  12. package/dist/api/datatables.js +1 -1
  13. package/dist/api/orders.js +1 -1
  14. package/dist/api/price.js +1 -1
  15. package/dist/api/products.d.ts +2 -2
  16. package/dist/api/products.js +1 -1
  17. package/dist/components/BreatheAnimation/index.js +1 -1
  18. package/dist/components/Button/index.d.ts +2 -2
  19. package/dist/components/DraggableHint/draggableIndicator.styles.d.ts +1 -1
  20. package/dist/components/PlayerLoadingSpinner/playerLoadingSpinner.styles.d.ts +1 -1
  21. package/dist/components/Share/index.js +1 -1
  22. package/dist/components/Share/share.styles.d.ts +1 -1
  23. package/dist/components/ThreekitProvider/index.js +3 -2
  24. package/dist/components/TurntableAnimation/index.js +1 -1
  25. package/dist/components/Upload/index.js +1 -1
  26. package/dist/components/UploadArea/index.js +1 -1
  27. package/dist/components/Wishlist/index.js +1 -1
  28. package/dist/connection.d.ts +4 -1
  29. package/dist/connection.js +16 -53
  30. package/dist/hooks/useAttribute/index.d.ts +4 -4
  31. package/dist/hooks/useAttribute/index.js +2 -6
  32. package/dist/hooks/useConfigurationLoader/index.js +1 -1
  33. package/dist/hooks/useConfigurator/index.d.ts +3 -3
  34. package/dist/hooks/useDevTools/index.d.ts +1 -1
  35. package/dist/hooks/useNestedConfigurator/index.d.ts +2 -2
  36. package/dist/hooks/useNestedConfigurator/index.js +3 -2
  37. package/dist/hooks/usePlayer/index.d.ts +1 -1
  38. package/dist/hooks/usePlayerPortal/index.d.ts +1 -1
  39. package/dist/hooks/useProductCache/index.js +1 -1
  40. package/dist/hooks/useResetProduct/index.d.ts +1 -1
  41. package/dist/hooks/useResetProduct/index.js +1 -1
  42. package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +95 -0
  43. package/dist/hooks/useRoomBuilder/RoomBuilderState.js +1237 -0
  44. package/dist/hooks/useRoomBuilder/constants.d.ts +41 -0
  45. package/dist/hooks/useRoomBuilder/constants.js +48 -0
  46. package/dist/hooks/useRoomBuilder/dataHandlers.d.ts +18 -0
  47. package/dist/hooks/useRoomBuilder/dataHandlers.js +187 -0
  48. package/dist/hooks/useRoomBuilder/draw.d.ts +55 -0
  49. package/dist/hooks/useRoomBuilder/draw.js +573 -0
  50. package/dist/hooks/useRoomBuilder/findLoops.d.ts +5 -0
  51. package/dist/hooks/useRoomBuilder/findLoops.js +99 -0
  52. package/dist/hooks/useRoomBuilder/geometry.d.ts +33 -0
  53. package/dist/hooks/useRoomBuilder/geometry.js +325 -0
  54. package/dist/hooks/useRoomBuilder/index.d.ts +40 -0
  55. package/dist/hooks/useRoomBuilder/index.js +303 -0
  56. package/dist/hooks/useRoomBuilder/messaging.d.ts +8 -0
  57. package/dist/hooks/useRoomBuilder/messaging.js +18 -0
  58. package/dist/hooks/useRoomBuilder/themes.d.ts +12 -0
  59. package/dist/hooks/useRoomBuilder/themes.js +273 -0
  60. package/dist/hooks/useRoomBuilder/types.d.ts +238 -0
  61. package/dist/hooks/useRoomBuilder/types.js +36 -0
  62. package/dist/hooks/useRoomBuilder/validators.d.ts +36 -0
  63. package/dist/hooks/useRoomBuilder/validators.js +362 -0
  64. package/dist/hooks/useShare/index.d.ts +1 -1
  65. package/dist/hooks/useShare/index.js +1 -1
  66. package/dist/hooks/useSingleAnimation/index.js +1 -1
  67. package/dist/hooks/useSnapshot/index.d.ts +1 -1
  68. package/dist/hooks/useWishlist/index.d.ts +1 -1
  69. package/dist/hooks/useZoom/index.d.ts +1 -1
  70. package/dist/http/orders.d.ts +1 -1
  71. package/dist/icons/Draw.js +3 -3
  72. package/dist/icons/Window.js +4 -4
  73. package/dist/icons/index.js +0 -26
  74. package/dist/index.d.ts +2 -16
  75. package/dist/index.js +5 -33
  76. package/dist/store/attributes.d.ts +1 -2
  77. package/dist/store/attributes.js +1 -1
  78. package/dist/store/index.d.ts +2 -9
  79. package/dist/store/index.js +1 -3
  80. package/dist/store/price.js +1 -1
  81. package/dist/store/product.d.ts +1 -1
  82. package/dist/store/product.js +8 -5
  83. package/dist/store/translations.js +1 -1
  84. package/dist/store/treble.d.ts +4 -2
  85. package/dist/store/treble.js +60 -43
  86. package/dist/store/wishlist.d.ts +1 -1
  87. package/dist/store/wishlist.js +1 -1
  88. package/dist/types.d.ts +25 -21
  89. package/dist/utils.d.ts +1 -1
  90. package/dist/utils.js +1 -1
  91. package/package.json +2 -1
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ while (_) try {
29
29
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
30
  if (y = 0, t) op = [op[0] & 2, t.value];
31
31
  switch (op[0]) {
@@ -167,33 +167,32 @@ var getPlayerInteraction = function (state) {
167
167
  exports.getPlayerInteraction = getPlayerInteraction;
168
168
  var initPlayer = function (config) {
169
169
  return function (dispatch, getState) { return __awaiter(void 0, void 0, void 0, function () {
170
- var el, authToken, assetId, stageId, playerConfig, initialConfiguration, player, configurator, orgId, cacheParameters, ruleName;
171
- return __generator(this, function (_a) {
172
- switch (_a.label) {
170
+ var el, authToken, assetId, customId, stageId, playerConfig, initialConfiguration, player, configurator, _a, initializedAssetId, orgId, cacheParameters, ruleName;
171
+ return __generator(this, function (_b) {
172
+ switch (_b.label) {
173
173
  case 0:
174
- el = config.el, authToken = config.authToken, assetId = config.assetId, stageId = config.stageId, playerConfig = config.playerConfig, initialConfiguration = config.initialConfiguration;
174
+ el = config.el, authToken = config.authToken, assetId = config.assetId, customId = config.customId, stageId = config.stageId, playerConfig = config.playerConfig, initialConfiguration = config.initialConfiguration;
175
175
  dispatch((0, exports.updateLoadingProgress)(0));
176
- return [4, window.threekitPlayer(__assign(__assign({ el: el, authToken: authToken, stageId: stageId, assetId: assetId }, playerConfig), { initialConfiguration: initialConfiguration, onLoadingProgress: function (progress) {
176
+ return [4, window.threekitPlayer(__assign(__assign({ el: el, authToken: authToken, stageId: stageId, assetId: assetId, customId: customId }, playerConfig), { initialConfiguration: initialConfiguration, onLoadingProgress: function (progress) {
177
177
  var _a;
178
178
  dispatch((0, exports.updateLoadingProgress)(progress));
179
179
  (_a = playerConfig === null || playerConfig === void 0 ? void 0 : playerConfig.onLoadingProgress) === null || _a === void 0 ? void 0 : _a.call(playerConfig, progress);
180
180
  } }))];
181
181
  case 1:
182
- player = _a.sent();
182
+ player = _b.sent();
183
183
  return [4, player.getConfigurator()];
184
184
  case 2:
185
- configurator = _a.sent();
186
- orgId = player.enableApi(types_1.PRIVATE_APIS.PLAYER).orgId;
187
- connection_1.default.connect({ orgId: orgId });
185
+ configurator = _b.sent();
186
+ _a = player.enableApi(types_1.PRIVATE_APIS.PLAYER), initializedAssetId = _a.assetId, orgId = _a.orgId;
187
+ connection_1.default.connect({ assetId: initializedAssetId, orgId: orgId });
188
188
  cacheParameters = player.cacheParameters;
189
189
  if (cacheParameters)
190
190
  connection_1.default.connect({ cacheParameters: cacheParameters });
191
- if (window.threekit) {
191
+ if (window.threekit)
192
192
  window.threekit = Object.assign(window.threekit, {
193
193
  player: player,
194
194
  configurator: configurator,
195
195
  });
196
- }
197
196
  else
198
197
  window.threekit = {
199
198
  player: player,
@@ -208,11 +207,11 @@ var initPlayer = function (config) {
208
207
  dispatch((0, exports.setPlayerLoading)(false));
209
208
  dispatch((0, exports.updateLoadingProgress)(1));
210
209
  dispatch((0, exports.setPlayerInteraction)(true));
211
- window.threekit.player.on(types_1.SCENE_PHASES.RENDERED, function () {
210
+ player.on(types_1.SCENE_PHASES.RENDERED, function () {
212
211
  dispatch((0, exports.setIsFirstRenderComplete)(true));
213
212
  });
214
213
  ruleName = 'use-first-player-interaction';
215
- window.threekit.player.tools.addTool({
214
+ player.tools.addTool({
216
215
  key: ruleName,
217
216
  label: 'use-first-player-interaction',
218
217
  active: true,
@@ -221,7 +220,7 @@ var initPlayer = function (config) {
221
220
  mousedown: function () { return __awaiter(void 0, void 0, void 0, function () {
222
221
  return __generator(this, function (_a) {
223
222
  dispatch((0, exports.setPlayerInteraction)(false));
224
- window.threekit.player.tools.removeTool(ruleName);
223
+ player.tools.removeTool(ruleName);
225
224
  return [2];
226
225
  });
227
226
  }); },
@@ -229,12 +228,14 @@ var initPlayer = function (config) {
229
228
  });
230
229
  if (window.threekit.treble._debugMode)
231
230
  (0, utils_1.runDebugger)();
232
- window.threekit.player.on('setConfiguration', function () { return __awaiter(void 0, void 0, void 0, function () {
231
+ player.on('setConfiguration', function () { return __awaiter(void 0, void 0, void 0, function () {
233
232
  var state, previousAttributes, attributes, configuration, updatedAttributes;
234
233
  var _a;
235
234
  return __generator(this, function (_b) {
236
235
  switch (_b.label) {
237
- case 0:
236
+ case 0: return [4, window.threekit.treble._player.api.evaluate()];
237
+ case 1:
238
+ _b.sent();
238
239
  state = getState();
239
240
  previousAttributes = Object.values(state.attributes);
240
241
  attributes = window.threekit.configurator.getDisplayAttributes();
@@ -248,7 +249,7 @@ var initPlayer = function (config) {
248
249
  });
249
250
  dispatch((0, attributes_1.setAttributes)(updatedAttributes));
250
251
  return [4, ((_a = EVENTS.postConfigurationChange) === null || _a === void 0 ? void 0 : _a.call(EVENTS, updatedAttributes, {}, previousAttributes))];
251
- case 1:
252
+ case 2:
252
253
  _b.sent();
253
254
  return [2];
254
255
  }
@@ -262,10 +263,10 @@ var initPlayer = function (config) {
262
263
  exports.initPlayer = initPlayer;
263
264
  var launch = function (launchConfig) {
264
265
  return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
265
- var config, productId, credentials, productsRaw, products, threekitEnv, serverUrl, playerConfig, envCredentials, _a, assetIdRaw, stageId, configurationId, initialConfigurationRaw, assetId, threekitDomainRaw, authToken, playerScriptUrl, el, threekitDomain, initialConfiguration, updatedAssetId, params, configId, configuration;
266
- var _b, _c, _d, _e, _f, _g, _h;
267
- return __generator(this, function (_j) {
268
- switch (_j.label) {
266
+ var config, productId, credentials, productsRaw, products, threekitEnv, serverUrl, playerConfig, envCredentials, _a, assetIdRaw, customIdRaw, stageId, configurationId, initialConfigurationRaw, customId, assetId, threekitDomainRaw, authToken, el, threekitDomain, initialConfiguration, updatedAssetId, params, configId, configuration;
267
+ var _b, _c, _d, _e, _f, _g, _h, _j;
268
+ return __generator(this, function (_k) {
269
+ switch (_k.label) {
269
270
  case 0:
270
271
  if (window.threekit)
271
272
  return [2];
@@ -286,6 +287,7 @@ var launch = function (launchConfig) {
286
287
  var env = _a[0], conf = _a[1];
287
288
  var initialConfiguration;
288
289
  var assetId;
290
+ var customId;
289
291
  var stageId;
290
292
  var configurationId;
291
293
  if (typeof conf === 'string') {
@@ -299,6 +301,8 @@ var launch = function (launchConfig) {
299
301
  initialConfiguration = conf.initialConfiguration;
300
302
  if (conf.configurationId)
301
303
  configurationId = conf.configurationId;
304
+ else if (conf.customId)
305
+ customId = conf.customId;
302
306
  else if ((0, utils_1.isUuid)(conf.assetId))
303
307
  assetId = conf.assetId;
304
308
  else
@@ -307,6 +311,7 @@ var launch = function (launchConfig) {
307
311
  return Object.assign(result, (_b = {},
308
312
  _b[env] = {
309
313
  assetId: assetId,
314
+ customId: customId,
310
315
  stageId: stageId,
311
316
  configurationId: configurationId,
312
317
  initialConfiguration: initialConfiguration,
@@ -323,10 +328,13 @@ var launch = function (launchConfig) {
323
328
  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);
324
329
  playerConfig = Object.assign({}, constants_1.DEFAULT_PLAYER_CONFIG, config.player, launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.playerConfig);
325
330
  envCredentials = credentials[threekitEnv];
326
- _a = products[productId][threekitEnv] || {}, assetIdRaw = _a.assetId, stageId = _a.stageId, configurationId = _a.configurationId, initialConfigurationRaw = _a.initialConfiguration;
327
- assetId = (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.assetId) || assetIdRaw;
331
+ _a = products[productId][threekitEnv] || {}, assetIdRaw = _a.assetId, customIdRaw = _a.customId, stageId = _a.stageId, configurationId = _a.configurationId, initialConfigurationRaw = _a.initialConfiguration;
332
+ customId = (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.customId) || customIdRaw;
333
+ assetId = ((_h = launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.customId) === null || _h === void 0 ? void 0 : _h.length)
334
+ ? undefined
335
+ : (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.assetId) || assetIdRaw;
328
336
  threekitDomainRaw = envCredentials.threekitDomain || "".concat(threekitEnv, ".threekit.com");
329
- authToken = envCredentials.publicToken, playerScriptUrl = envCredentials.playerScriptUrl;
337
+ authToken = envCredentials.publicToken;
330
338
  if (playerConfig.elementId) {
331
339
  el = document.getElementById(playerConfig.elementId);
332
340
  if (el)
@@ -338,6 +346,7 @@ var launch = function (launchConfig) {
338
346
  }
339
347
  connection_1.default.connect({
340
348
  authToken: authToken,
349
+ customId: customId,
341
350
  assetId: assetId,
342
351
  threekitDomain: threekitDomainRaw,
343
352
  serverUrl: serverUrl,
@@ -346,42 +355,42 @@ var launch = function (launchConfig) {
346
355
  initialConfiguration = __assign({}, initialConfigurationRaw);
347
356
  updatedAssetId = assetId;
348
357
  params = (0, utils_1.getParams)();
349
- configId = ((_h = params[constants_1.TK_SAVED_CONFIG_PARAM_KEY]) === null || _h === void 0 ? void 0 : _h.length)
358
+ configId = ((_j = params[constants_1.TK_SAVED_CONFIG_PARAM_KEY]) === null || _j === void 0 ? void 0 : _j.length)
350
359
  ? params[constants_1.TK_SAVED_CONFIG_PARAM_KEY]
351
360
  : configurationId;
352
361
  if (!configId) return [3, 2];
353
362
  return [4, api_1.default.configurations.fetch(configId)];
354
363
  case 1:
355
- configuration = _j.sent();
364
+ configuration = _k.sent();
356
365
  if (configuration) {
357
366
  initialConfiguration = Object.assign({}, initialConfigurationRaw, configuration.data.variant);
358
367
  connection_1.default.connect({ assetId: configuration.data.productId });
359
368
  updatedAssetId = configuration.data.productId;
360
369
  }
361
- _j.label = 2;
370
+ _k.label = 2;
362
371
  case 2:
363
- if (!updatedAssetId)
364
- return [2, console.error('missing assetId')];
372
+ if (!updatedAssetId && !customId)
373
+ throw new Error('missing assetId and customId');
365
374
  return [4, new Promise(function (resolve) {
366
375
  var script = document.createElement('script');
367
- script.src =
368
- playerScriptUrl || "".concat(threekitDomain, "/app/js/threekit-player-bundle.js");
376
+ script.src = "".concat(threekitDomain, "/app/js/threekit-player-bundle.js");
369
377
  script.id = 'threekit-player-bundle';
370
378
  script.onload = function () { return resolve(); };
371
379
  document.head.appendChild(script);
372
380
  })];
373
381
  case 3:
374
- _j.sent();
382
+ _k.sent();
375
383
  return [4, dispatch((0, exports.initPlayer)({
376
384
  el: el,
377
385
  authToken: authToken,
378
386
  stageId: stageId,
379
387
  assetId: updatedAssetId,
388
+ customId: customId,
380
389
  playerConfig: playerConfig,
381
390
  initialConfiguration: initialConfiguration,
382
391
  }))];
383
392
  case 4:
384
- _j.sent();
393
+ _k.sent();
385
394
  document.addEventListener('treble:notification', function (e) {
386
395
  message_1.default.info(e.detail.message);
387
396
  });
@@ -400,14 +409,22 @@ var launch = function (launchConfig) {
400
409
  }); };
401
410
  };
402
411
  exports.launch = launch;
403
- var unloadPlayer = function (dispatch) {
404
- dispatch((0, exports.setThreekitInitialized)(false));
405
- dispatch((0, exports.setPlayerLoading)(true));
406
- dispatch((0, attributes_1.setAttributes)([]));
407
- dispatch((0, product_1.setName)(''));
408
- dispatch((0, product_1.setMetadata)({}));
409
- return window.threekit.player.unload();
410
- };
412
+ var unloadPlayer = function () { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
413
+ return __generator(this, function (_a) {
414
+ switch (_a.label) {
415
+ case 0:
416
+ dispatch((0, exports.setThreekitInitialized)(false));
417
+ dispatch((0, exports.setPlayerLoading)(true));
418
+ dispatch((0, attributes_1.setAttributes)([]));
419
+ dispatch((0, product_1.setName)(''));
420
+ dispatch((0, product_1.setMetadata)({}));
421
+ return [4, window.threekit.player.unload()];
422
+ case 1:
423
+ _a.sent();
424
+ return [2];
425
+ }
426
+ });
427
+ }); }; };
411
428
  exports.unloadPlayer = unloadPlayer;
412
429
  var reloadPlayer = function (config) {
413
430
  return function (dispatch, getState) { return __awaiter(void 0, void 0, void 0, function () {
@@ -444,7 +461,7 @@ var reloadPlayer = function (config) {
444
461
  playerConfig = Object.assign({}, constants_1.DEFAULT_PLAYER_CONFIG, trebleConfig.player);
445
462
  el = document.getElementById(state.treble.playerElId);
446
463
  if (!state.treble.isThreekitInitialized) return [3, 6];
447
- return [4, dispatch(exports.unloadPlayer)];
464
+ return [4, dispatch((0, exports.unloadPlayer)())];
448
465
  case 5:
449
466
  _a.sent();
450
467
  _a.label = 6;
@@ -1,7 +1,7 @@
1
1
  import { RootState, ThreekitDispatch } from './index';
2
2
  import { WishlistArray } from '../Treble';
3
3
  import { ISaveConfiguration } from '../api/configurations';
4
- export type WishlistState = WishlistArray;
4
+ export declare type WishlistState = WishlistArray;
5
5
  export declare const refreshWishlist: import("@reduxjs/toolkit").AsyncThunk<import("../http/configurations").IConfigurationResponse[], void, {
6
6
  state?: unknown;
7
7
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ while (_) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
package/dist/types.d.ts CHANGED
@@ -46,7 +46,7 @@ export declare enum SNAPSHOT_OUTPUTS {
46
46
  BLOB = "blob",
47
47
  FILE = "file"
48
48
  }
49
- export type IMetadata = Record<string, string | number | null>;
49
+ export declare type IMetadata = Record<string, string | number | null>;
50
50
  export interface ISceneQueryShared {
51
51
  all?: boolean;
52
52
  id?: string;
@@ -79,7 +79,7 @@ export interface ISceneQueryTransform extends ISceneQueryShared {
79
79
  plug: PLUG_TYPES.TRANSFORM;
80
80
  property: TRANSFORM_PROPERTY_TYPES;
81
81
  }
82
- export type ISceneQuery = ISceneQueryNode | ISceneQueryTransform | string;
82
+ export declare type ISceneQuery = ISceneQueryNode | ISceneQueryTransform | string;
83
83
  export interface ISceneResult {
84
84
  id: string;
85
85
  name: string;
@@ -97,9 +97,9 @@ export interface IConfigurationColor {
97
97
  g: number;
98
98
  b: number;
99
99
  }
100
- export type IConfigurationAttribute = IConfigurationAsset | IConfigurationArray | IConfigurationColor | string | number | boolean | undefined;
101
- export type IConfiguration = Record<string, IConfigurationAttribute>;
102
- export type ISetConfiguration = Record<string, IConfigurationAttribute>;
100
+ export declare type IConfigurationAttribute = IConfigurationAsset | IConfigurationArray | IConfigurationColor | string | number | boolean | undefined;
101
+ export declare type IConfiguration = Record<string, IConfigurationAttribute>;
102
+ export declare type ISetConfiguration = Record<string, IConfigurationAttribute>;
103
103
  interface IDisplayAttributeConfig {
104
104
  includeHidden?: boolean;
105
105
  }
@@ -135,9 +135,9 @@ export interface IAttributeAssetBase<V> extends IAttributeBase<ATTRIBUTE_TYPES.A
135
135
  disabledValues?: Array<string>;
136
136
  values: Array<V>;
137
137
  }
138
- export type IDisplayAttributeAsset = IAttributeAssetBase<IDisplayAttributeAssetValue>;
139
- export type IHydratedAttributeAsset = IAttributeAssetBase<IHydratedAttributeAssetValue>;
140
- export type IAttributeAsset = IAttributeAssetBase<IConfigurationAssetValue>;
138
+ export declare type IDisplayAttributeAsset = IAttributeAssetBase<IDisplayAttributeAssetValue>;
139
+ export declare type IHydratedAttributeAsset = IAttributeAssetBase<IHydratedAttributeAssetValue>;
140
+ export declare type IAttributeAsset = IAttributeAssetBase<IConfigurationAssetValue>;
141
141
  export interface IConfigurationArrayValue {
142
142
  assetId: string;
143
143
  name: string;
@@ -167,9 +167,9 @@ export interface IAttributeArrayBase<V> extends IAttributeBase<ATTRIBUTE_TYPES.A
167
167
  assetType: ASSET_TYPES;
168
168
  };
169
169
  }
170
- export type IDisplayAttributeArray = IAttributeArrayBase<IDisplayAttributeArrayValue>;
171
- export type IHydratedAttributeArray = IAttributeArrayBase<IHydratedAttributeArrayValue>;
172
- export type IAttributeArray = IAttributeArrayBase<Pick<IConfigurationArrayValue, 'assetId'>>;
170
+ export declare type IDisplayAttributeArray = IAttributeArrayBase<IDisplayAttributeArrayValue>;
171
+ export declare type IHydratedAttributeArray = IAttributeArrayBase<IHydratedAttributeArrayValue>;
172
+ export declare type IAttributeArray = IAttributeArrayBase<Pick<IConfigurationArrayValue, 'assetId'>>;
173
173
  export interface IDisplayAttributeStringValue {
174
174
  label: string;
175
175
  value: string;
@@ -185,9 +185,9 @@ export interface IAttributeStringBase<V> extends IAttributeBase<ATTRIBUTE_TYPES.
185
185
  disabledValues?: Array<string>;
186
186
  values: Array<V>;
187
187
  }
188
- export type IDisplayAttributeString = IAttributeStringBase<IDisplayAttributeStringValue>;
189
- export type IHydratedAttributeString = IAttributeStringBase<IHydratedAttributeStringValue>;
190
- export type IAttributeString = IAttributeStringBase<string>;
188
+ export declare type IDisplayAttributeString = IAttributeStringBase<IDisplayAttributeStringValue>;
189
+ export declare type IHydratedAttributeString = IAttributeStringBase<IHydratedAttributeStringValue>;
190
+ export declare type IAttributeString = IAttributeStringBase<string>;
191
191
  export interface IAttributeColor extends IAttributeBase<ATTRIBUTE_TYPES.COLOR, IConfigurationColor> {
192
192
  defaultValue: IConfigurationColor;
193
193
  }
@@ -201,9 +201,9 @@ export interface IAttributeNumber extends IAttributeBase<ATTRIBUTE_TYPES.NUMBER,
201
201
  export interface IAttributeBoolean extends IAttributeBase<ATTRIBUTE_TYPES.BOOLEAN, boolean> {
202
202
  defaultValue: boolean;
203
203
  }
204
- export type IThreekitAttribute = IAttributeAsset | IAttributeArray | IAttributeColor | IAttributeString | IAttributeNumber | IAttributeBoolean;
205
- export type IThreekitDisplayAttribute = IDisplayAttributeAsset | IDisplayAttributeArray | IDisplayAttributeString | IAttributeColor | IAttributeNumber | IAttributeBoolean;
206
- export type IHydratedAttribute = IHydratedAttributeAsset | IHydratedAttributeArray | IHydratedAttributeString | IAttributeColor | IAttributeNumber | IAttributeBoolean;
204
+ export declare type IThreekitAttribute = IAttributeAsset | IAttributeArray | IAttributeColor | IAttributeString | IAttributeNumber | IAttributeBoolean;
205
+ export declare type IThreekitDisplayAttribute = IDisplayAttributeAsset | IDisplayAttributeArray | IDisplayAttributeString | IAttributeColor | IAttributeNumber | IAttributeBoolean;
206
+ export declare type IHydratedAttribute = IHydratedAttributeAsset | IHydratedAttributeArray | IHydratedAttributeString | IAttributeColor | IAttributeNumber | IAttributeBoolean;
207
207
  export interface ICoordinates {
208
208
  x: number;
209
209
  y: number;
@@ -325,6 +325,7 @@ export interface IThreekitPlayer {
325
325
  enableApi: <T extends PRIVATE_APIS>(api: T) => T extends PRIVATE_APIS.PLAYER ? IThreekitPrivatePlayer : any;
326
326
  snapshotAsync: (snapshotConfig: ISnapshotConfig) => Promise<string>;
327
327
  unload: () => Promise<string>;
328
+ uploadImage: (image: File) => Promise<string>;
328
329
  cacheParameters: ICacheParameters;
329
330
  }
330
331
  export interface IThreekitPrivateConfigurator extends IThreekitConfigurator {
@@ -348,11 +349,15 @@ export interface IThreekitPrivatePlayer {
348
349
  configurator: IThreekitPrivateConfigurator;
349
350
  calculateLogs: () => Promise<Record<string, any>>;
350
351
  getAssetInstance: (query: ISceneQueryNode | string) => Promise<string>;
352
+ api: {
353
+ evaluate: () => Promise<void>;
354
+ };
351
355
  }
352
356
  export interface ThreekitInitConfig {
353
357
  authToken: string;
354
358
  el: HTMLElement;
355
- assetId: string;
359
+ assetId?: string;
360
+ customId?: string;
356
361
  stageId?: string;
357
362
  orgId?: string;
358
363
  showConfigurator?: boolean;
@@ -389,14 +394,13 @@ export interface ICredential {
389
394
  publicToken: string;
390
395
  publishStage?: string;
391
396
  threekitDomain?: string;
392
- playerScriptUrl?: string;
393
397
  }
394
398
  export interface ICredentials extends Record<string, ICredential> {
395
399
  }
396
- export interface IPlayerConfig extends Omit<ThreekitInitConfig, 'el' | 'authToken' | 'orgId' | 'assetId' | 'stageId' | 'locale'> {
400
+ export interface IPlayerConfig extends Omit<ThreekitInitConfig, 'el' | 'authToken' | 'orgId' | 'assetId' | 'customId' | 'stageId' | 'locale'> {
397
401
  elementId?: string;
398
402
  }
399
- export interface IProduct extends Pick<ThreekitInitConfig, 'assetId' | 'stageId' | 'initialConfiguration'> {
403
+ export interface IProduct extends Pick<ThreekitInitConfig, 'assetId' | 'customId' | 'stageId' | 'initialConfiguration'> {
400
404
  configurationId?: string;
401
405
  }
402
406
  export interface IProducts extends Record<string, string | Partial<IProduct>> {
package/dist/utils.d.ts CHANGED
@@ -53,7 +53,7 @@ export declare const hydrateAttribute: (data: [
53
53
  undefined | ITranslationMap,
54
54
  undefined | string
55
55
  ], optionSelectionHandler: (config: ISetConfiguration) => Promise<void>) => Record<string, IHydratedAttribute>;
56
- export declare const selectionToConfiguration: (value: RawAttributeValue, attributeType: ATTRIBUTE_TYPES) => string | number | boolean | IConfigurationColor | File | {
56
+ export declare const selectionToConfiguration: (value: RawAttributeValue, attributeType: ATTRIBUTE_TYPES) => string | number | boolean | File | IConfigurationColor | {
57
57
  assetId: RawAttributeValue;
58
58
  } | undefined;
59
59
  export declare const filterFormAttributes: (attributes: Record<string, IThreekitDisplayAttribute>, attributeComponentProps: IAttributesComponentProps, includeReservedAttributes: boolean) => IThreekitDisplayAttribute[];
package/dist/utils.js CHANGED
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ while (_) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threekit-tools/treble",
3
- "version": "0.0.91-next-03",
3
+ "version": "0.0.92",
4
4
  "author": "Amaan Saeed",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -46,6 +46,7 @@
46
46
  "axios": "^0.22.0",
47
47
  "chokidar": "^3.5.3",
48
48
  "live-server": "^1.2.2",
49
+ "joi": "^17.10.0",
49
50
  "react-redux": "^7.2.6",
50
51
  "redux": "^4.1.2",
51
52
  "redux-logger": "^3.0.6",