@threekit-tools/treble 0.0.80 → 0.0.83

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 (105) hide show
  1. package/dist/Treble/Snapshots.d.ts +2 -2
  2. package/dist/Treble/Snapshots.js +31 -32
  3. package/dist/Treble/Treble.d.ts +2 -2
  4. package/dist/Treble/Treble.js +4 -5
  5. package/dist/Treble/Wishlist.d.ts +2 -2
  6. package/dist/Treble/Wishlist.js +19 -21
  7. package/dist/Treble/index.js +5 -1
  8. package/dist/api/catalog.js +6 -6
  9. package/dist/api/configurations.js +3 -3
  10. package/dist/api/datatables.js +5 -5
  11. package/dist/api/index.js +5 -1
  12. package/dist/api/orders.js +12 -12
  13. package/dist/api/price.js +2 -2
  14. package/dist/api/products.js +2 -2
  15. package/dist/components/Accordion/index.js +6 -7
  16. package/dist/components/AttributeTitle/index.d.ts +0 -9
  17. package/dist/components/AttributeTitle/index.js +0 -9
  18. package/dist/components/AttributeValue/index.d.ts +0 -6
  19. package/dist/components/AttributeValue/index.js +0 -6
  20. package/dist/components/Button/index.d.ts +0 -27
  21. package/dist/components/Button/index.js +0 -27
  22. package/dist/components/Cards/index.d.ts +0 -54
  23. package/dist/components/Cards/index.js +0 -57
  24. package/dist/components/Drawer/index.js +7 -16
  25. package/dist/components/Dropdown/index.d.ts +0 -58
  26. package/dist/components/Dropdown/index.js +8 -69
  27. package/dist/components/FlatForm/index.d.ts +0 -21
  28. package/dist/components/FlatForm/index.js +5 -22
  29. package/dist/components/Modal/index.js +2 -15
  30. package/dist/components/Player/index.d.ts +0 -1
  31. package/dist/components/Player/index.js +4 -38
  32. package/dist/components/PortalToArOverlay/index.js +5 -1
  33. package/dist/components/PortalToElement/index.js +0 -8
  34. package/dist/components/ProductDescription/index.d.ts +0 -6
  35. package/dist/components/ProductDescription/index.js +0 -6
  36. package/dist/components/ProductName/index.d.ts +0 -9
  37. package/dist/components/ProductName/index.js +0 -9
  38. package/dist/components/Share/index.d.ts +0 -12
  39. package/dist/components/Share/index.js +2 -14
  40. package/dist/components/Snapshots/index.d.ts +0 -8
  41. package/dist/components/Snapshots/index.js +2 -10
  42. package/dist/components/Strips/index.d.ts +0 -54
  43. package/dist/components/Strips/index.js +0 -57
  44. package/dist/components/Swatch/index.d.ts +0 -63
  45. package/dist/components/Swatch/index.js +0 -66
  46. package/dist/components/Switch/index.d.ts +0 -33
  47. package/dist/components/Switch/index.js +0 -36
  48. package/dist/components/Tabs/index.js +5 -1
  49. package/dist/components/TextInput/index.js +0 -1
  50. package/dist/components/ThreekitProvider/index.js +7 -2
  51. package/dist/components/Tiles/index.d.ts +0 -28
  52. package/dist/components/Tiles/index.js +0 -30
  53. package/dist/components/TilesGroup/index.d.ts +0 -25
  54. package/dist/components/TilesGroup/index.js +0 -27
  55. package/dist/components/TotalPrice/index.d.ts +0 -6
  56. package/dist/components/TotalPrice/index.js +0 -6
  57. package/dist/components/TrebleApp/index.js +5 -1
  58. package/dist/components/Upload/index.js +19 -15
  59. package/dist/components/UploadArea/index.js +16 -13
  60. package/dist/components/Wishlist/index.d.ts +0 -3
  61. package/dist/components/Wishlist/index.js +12 -10
  62. package/dist/components/Zoom/index.d.ts +0 -17
  63. package/dist/components/Zoom/index.js +5 -21
  64. package/dist/components/formComponents.js +5 -3
  65. package/dist/components/message/index.d.ts +0 -9
  66. package/dist/components/message/index.js +4 -31
  67. package/dist/connection.js +2 -2
  68. package/dist/constants.d.ts +0 -27
  69. package/dist/constants.js +0 -36
  70. package/dist/hooks/useAttribute/index.d.ts +1 -1
  71. package/dist/hooks/useAttribute/index.js +6 -6
  72. package/dist/hooks/useConfigurationLoader/index.js +5 -5
  73. package/dist/hooks/useLoadingProgress/index.d.ts +2 -0
  74. package/dist/hooks/useLoadingProgress/index.js +9 -0
  75. package/dist/hooks/useNestedConfigurator/index.js +2 -2
  76. package/dist/hooks/usePlayer/index.d.ts +3 -0
  77. package/dist/hooks/usePlayer/index.js +38 -0
  78. package/dist/hooks/useShare/index.js +3 -3
  79. package/dist/hooks/useSingleAnimation/index.js +5 -11
  80. package/dist/hooks/useSnapshot/index.d.ts +1 -1
  81. package/dist/hooks/useWishlist/index.d.ts +1 -1
  82. package/dist/http/datatables.js +0 -1
  83. package/dist/http/index.js +5 -1
  84. package/dist/icons/Spinner.js +5 -1
  85. package/dist/icons/index.d.ts +0 -41
  86. package/dist/icons/index.js +0 -42
  87. package/dist/index.d.ts +44 -3
  88. package/dist/index.js +88 -26
  89. package/dist/store/attributes.d.ts +0 -12
  90. package/dist/store/attributes.js +2 -15
  91. package/dist/store/index.d.ts +1 -1
  92. package/dist/store/price.d.ts +0 -12
  93. package/dist/store/price.js +2 -16
  94. package/dist/store/product.d.ts +6 -21
  95. package/dist/store/product.js +23 -37
  96. package/dist/store/translations.d.ts +1 -13
  97. package/dist/store/translations.js +2 -12
  98. package/dist/store/treble.d.ts +4 -16
  99. package/dist/store/treble.js +47 -66
  100. package/dist/store/wishlist.d.ts +1 -13
  101. package/dist/store/wishlist.js +4 -17
  102. package/dist/types.d.ts +47 -41
  103. package/dist/utils.d.ts +8 -8
  104. package/dist/utils.js +3 -12
  105. package/package.json +16 -4
@@ -1,7 +1,4 @@
1
1
  import { RootState, ThreekitDispatch } from './index';
2
- /*****************************************************
3
- * Types and Interfaces
4
- ****************************************************/
5
2
  export interface IPriceConfig {
6
3
  id: string;
7
4
  currency: string;
@@ -15,20 +12,11 @@ export interface PriceState {
15
12
  currency: undefined | string;
16
13
  price: undefined | number;
17
14
  }
18
- /*****************************************************
19
- * Actions
20
- ****************************************************/
21
15
  export declare const setPriceConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<IPriceConfig, string>;
22
16
  export declare const setPrice: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>;
23
17
  export declare const initPrice: () => (dispatch: ThreekitDispatch) => Promise<void>;
24
18
  declare const reducer: import("redux").Reducer<PriceState, import("redux").AnyAction>;
25
- /*****************************************************
26
- * Standard Selectors
27
- ****************************************************/
28
19
  export declare const getPrice: (state: RootState) => undefined | IPrice;
29
20
  export declare const getPriceConfig: (state: RootState) => undefined | IPriceConfig;
30
- /*****************************************************
31
- * Complex Actions
32
- ****************************************************/
33
21
  export declare const updatePrice: () => (dispatch: ThreekitDispatch, getState: () => RootState) => void;
34
22
  export default reducer;
@@ -42,17 +42,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.updatePrice = exports.getPriceConfig = exports.getPrice = exports.initPrice = exports.setPrice = exports.setPriceConfig = void 0;
43
43
  var toolkit_1 = require("@reduxjs/toolkit");
44
44
  var api_1 = __importDefault(require("../api"));
45
- /*****************************************************
46
- * Actions
47
- ****************************************************/
48
- // Actions to be used only internally
49
45
  exports.setPriceConfig = (0, toolkit_1.createAction)('treble/price/set-price-config');
50
46
  exports.setPrice = (0, toolkit_1.createAction)('treble/price/set-price');
51
47
  var initPrice = function () { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
52
48
  var pricebook, id, currency, price;
53
49
  return __generator(this, function (_a) {
54
50
  switch (_a.label) {
55
- case 0: return [4 /*yield*/, api_1.default.price.getPricebooksList()];
51
+ case 0: return [4, api_1.default.price.getPricebooksList()];
56
52
  case 1:
57
53
  pricebook = _a.sent();
58
54
  if (pricebook.length) {
@@ -62,16 +58,12 @@ var initPrice = function () { return function (dispatch) { return __awaiter(void
62
58
  price = window.threekit.configurator.getPrice(id, currency);
63
59
  dispatch((0, exports.setPrice)(price));
64
60
  }
65
- return [2 /*return*/];
61
+ return [2];
66
62
  }
67
63
  });
68
64
  }); }; };
69
65
  exports.initPrice = initPrice;
70
- /*****************************************************
71
- * State
72
- ****************************************************/
73
66
  var initialState = {
74
- // Selected language
75
67
  id: undefined,
76
68
  currency: undefined,
77
69
  price: undefined,
@@ -93,9 +85,6 @@ var reducer = (0, toolkit_1.createSlice)({
93
85
  },
94
86
  reducers: {},
95
87
  }).reducer;
96
- /*****************************************************
97
- * Standard Selectors
98
- ****************************************************/
99
88
  var getPrice = function (state) {
100
89
  var _a = state.price, price = _a.price, currency = _a.currency;
101
90
  if (!price || !currency)
@@ -110,9 +99,6 @@ var getPriceConfig = function (state) {
110
99
  return { id: id, currency: currency };
111
100
  };
112
101
  exports.getPriceConfig = getPriceConfig;
113
- /*****************************************************
114
- * Complex Actions
115
- ****************************************************/
116
102
  var updatePrice = function () { return function (dispatch, getState) {
117
103
  var price = getState().price;
118
104
  if (!price.id || !price.currency)
@@ -2,9 +2,6 @@ import { RootState, ThreekitDispatch } from './index';
2
2
  import { IMetadata, IConfiguration, IProduct } from '../types';
3
3
  import { IConnectionConfig } from '../connection';
4
4
  import { IReloadConfig } from './treble';
5
- /*****************************************************
6
- * Types and Interfaces
7
- ****************************************************/
8
5
  export interface CachedProduct {
9
6
  id: undefined | string;
10
7
  name?: string;
@@ -30,16 +27,10 @@ export interface ProductState {
30
27
  cache: Array<CachedProductState>;
31
28
  activeCacheIdx: number;
32
29
  }
33
- /*****************************************************
34
- * Constants
35
- ****************************************************/
36
30
  export declare let PRODUCTS: IHydratedProducts;
37
- /*****************************************************
38
- * Actions
39
- ****************************************************/
40
31
  export declare const setProductId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>;
41
- export declare const setName: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>;
42
- export declare const setMetadata: import("@reduxjs/toolkit").ActionCreatorWithPayload<IMetadata, string>;
32
+ export declare const setName: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>;
33
+ export declare const setMetadata: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<IMetadata | undefined, string>;
43
34
  export declare const appendToCache: import("@reduxjs/toolkit").ActionCreatorWithPayload<CachedProductState, string>;
44
35
  export declare const updateActiveProductCache: import("@reduxjs/toolkit").ActionCreatorWithPayload<CachedProductState, string>;
45
36
  export declare const removeFromCache: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>;
@@ -47,24 +38,18 @@ export declare const setActiveCacheIdx: import("@reduxjs/toolkit").ActionCreator
47
38
  export declare const incrementActiveCacheIdx: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<undefined, string>;
48
39
  export declare const decrementActiveCacheIdx: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<undefined, string>;
49
40
  declare const reducer: import("redux").Reducer<ProductState, import("redux").AnyAction>;
50
- /*****************************************************
51
- * Standard Selectors
52
- ****************************************************/
53
41
  export declare const getProductId: (state: RootState) => undefined | string;
54
42
  export declare const getName: (state: RootState) => undefined | string;
55
43
  export declare const getMetadata: (state: RootState) => undefined | IMetadata;
56
44
  export declare const getActiveCacheIdx: (state: RootState) => number;
57
45
  export declare const getProductCache: (state: RootState) => Array<Pick<CachedProduct, 'name' | 'label' | 'thumbnail'>>;
58
- /*****************************************************
59
- * Complex Actions
60
- ****************************************************/
61
- export declare const initProduct: (prods?: IHydratedProducts | undefined) => (dispatch: ThreekitDispatch, getState: () => RootState) => void;
62
- export declare const cacheActiveProduct: (config?: Pick<IReloadConfig, "label" | "thumbnail"> | undefined) => (dispatch: ThreekitDispatch, getState: () => RootState) => {
46
+ export declare const initProduct: (prods?: IHydratedProducts) => (dispatch: ThreekitDispatch, getState: () => RootState) => void;
47
+ export declare const cacheActiveProduct: (config?: Pick<IReloadConfig, 'label' | 'thumbnail'>) => (dispatch: ThreekitDispatch, getState: () => RootState) => {
63
48
  payload: CachedProductState;
64
49
  type: string;
65
50
  };
66
- export declare const loadProduct: (id: string, config?: LoadProductConfig | undefined) => (dispatch: ThreekitDispatch, getState: () => RootState) => Promise<void>;
51
+ export declare const loadProduct: (id: string, config?: LoadProductConfig) => (dispatch: ThreekitDispatch, getState: () => RootState) => Promise<void>;
67
52
  export declare const loadNewProduct: (config: undefined | string | IReloadConfig) => (dispatch: ThreekitDispatch) => Promise<void>;
68
53
  export declare const changeActiveCacheIdx: (idx: number) => (dispatch: ThreekitDispatch, getState: () => RootState) => Promise<void>;
69
- export declare const removeProductIdx: (idx?: number | undefined) => (dispatch: ThreekitDispatch, getState: () => RootState) => Promise<void>;
54
+ export declare const removeProductIdx: (idx?: number) => (dispatch: ThreekitDispatch, getState: () => RootState) => Promise<void>;
70
55
  export default reducer;
@@ -54,10 +54,6 @@ exports.removeProductIdx = exports.changeActiveCacheIdx = exports.loadNewProduct
54
54
  var toolkit_1 = require("@reduxjs/toolkit");
55
55
  var connection_1 = __importDefault(require("../connection"));
56
56
  var treble_1 = require("./treble");
57
- /*****************************************************
58
- * Actions
59
- ****************************************************/
60
- // Actions to be used only internally
61
57
  exports.setProductId = (0, toolkit_1.createAction)('treble/set-product-id');
62
58
  exports.setName = (0, toolkit_1.createAction)('treble/set-product-name');
63
59
  exports.setMetadata = (0, toolkit_1.createAction)('treble/set-metadata');
@@ -67,17 +63,10 @@ exports.removeFromCache = (0, toolkit_1.createAction)('treble/remove-from-cache'
67
63
  exports.setActiveCacheIdx = (0, toolkit_1.createAction)('treble/set-active-cache-idx');
68
64
  exports.incrementActiveCacheIdx = (0, toolkit_1.createAction)('treble/increment-active-cache-idx');
69
65
  exports.decrementActiveCacheIdx = (0, toolkit_1.createAction)('treble/decrement-active-cache-idx');
70
- /*****************************************************
71
- * State
72
- ****************************************************/
73
66
  var initialState = {
74
- // ID of initialized item
75
67
  id: undefined,
76
- // Name of the Initialized Item
77
68
  name: undefined,
78
- // Initialized item's metadata
79
69
  metadata: undefined,
80
- // cached products. Does not include the active product
81
70
  cache: [],
82
71
  activeCacheIdx: 0,
83
72
  };
@@ -89,10 +78,13 @@ var reducer = (0, toolkit_1.createSlice)({
89
78
  return __assign(__assign({}, state), { id: action.payload });
90
79
  });
91
80
  builder.addCase(exports.setName, function (state, action) {
92
- return __assign(__assign({}, state), { name: action.payload });
81
+ var name = window.threekit.player.scene.get({
82
+ id: window.threekit.player.assetId,
83
+ }).name;
84
+ return __assign(__assign({}, state), { name: action.payload || name });
93
85
  });
94
86
  builder.addCase(exports.setMetadata, function (state, action) {
95
- return __assign(__assign({}, state), { metadata: action.payload });
87
+ return __assign(__assign({}, state), { metadata: action.payload || window.threekit.configurator.getMetadata() });
96
88
  });
97
89
  builder.addCase(exports.appendToCache, function (state, action) {
98
90
  state.cache.push(action.payload);
@@ -125,9 +117,6 @@ var reducer = (0, toolkit_1.createSlice)({
125
117
  },
126
118
  reducers: {},
127
119
  }).reducer;
128
- /*****************************************************
129
- * Standard Selectors
130
- ****************************************************/
131
120
  var getProductId = function (state) {
132
121
  return state.product.id;
133
122
  };
@@ -136,12 +125,10 @@ var getName = function (state) {
136
125
  return state.product.name;
137
126
  };
138
127
  exports.getName = getName;
139
- // Metadata
140
128
  var getMetadata = function (state) {
141
129
  return state.product.metadata;
142
130
  };
143
131
  exports.getMetadata = getMetadata;
144
- // Product Cache
145
132
  var getActiveCacheIdx = function (state) {
146
133
  return state.product.activeCacheIdx;
147
134
  };
@@ -154,13 +141,12 @@ var getProductCache = function (state) {
154
141
  });
155
142
  };
156
143
  exports.getProductCache = getProductCache;
157
- /*****************************************************
158
- * Complex Actions
159
- ****************************************************/
160
144
  var initProduct = function (prods) {
161
145
  return function (dispatch, getState) {
162
146
  if (prods)
163
147
  exports.PRODUCTS = prods;
148
+ if (!window.threekit)
149
+ return;
164
150
  var state = getState();
165
151
  var name = window.threekit.player.scene.get({
166
152
  id: window.threekit.player.assetId,
@@ -203,19 +189,19 @@ var loadProduct = function (id, config) {
203
189
  state = getState();
204
190
  productsList = Object.keys(exports.PRODUCTS);
205
191
  if (!productsList.includes(id))
206
- return [2 /*return*/];
192
+ return [2];
207
193
  productConfig = exports.PRODUCTS[id][state.treble.threekitEnv];
208
194
  dispatch((0, exports.setProductId)(id));
209
195
  if (cacheProduct)
210
196
  dispatch((0, exports.cacheActiveProduct)());
211
- return [4 /*yield*/, dispatch((0, treble_1.reloadPlayer)(productConfig))];
197
+ return [4, dispatch((0, treble_1.reloadPlayer)(productConfig))];
212
198
  case 1:
213
199
  _a.sent();
214
200
  if (cacheProduct) {
215
201
  dispatch((0, exports.incrementActiveCacheIdx)());
216
202
  dispatch((0, exports.cacheActiveProduct)());
217
203
  }
218
- return [2 /*return*/];
204
+ return [2];
219
205
  }
220
206
  });
221
207
  }); };
@@ -238,14 +224,14 @@ var loadNewProduct = function (config) {
238
224
  dispatch((0, exports.cacheActiveProduct)({ label: label, thumbnail: thumbnail }));
239
225
  if (config)
240
226
  dispatch((0, exports.setProductId)(undefined));
241
- return [4 /*yield*/, dispatch((0, treble_1.reloadPlayer)(config))];
227
+ return [4, dispatch((0, treble_1.reloadPlayer)(config))];
242
228
  case 1:
243
229
  _a.sent();
244
230
  if (shouldCacheProduct) {
245
231
  dispatch((0, exports.incrementActiveCacheIdx)());
246
232
  dispatch((0, exports.cacheActiveProduct)({ label: label, thumbnail: thumbnail }));
247
233
  }
248
- return [2 /*return*/];
234
+ return [2];
249
235
  }
250
236
  });
251
237
  }); };
@@ -260,20 +246,20 @@ var changeActiveCacheIdx = function (idx) {
260
246
  state = getState();
261
247
  cache = state.product.cache;
262
248
  if (idx >= cache.length)
263
- return [2 /*return*/, Promise.resolve()];
249
+ return [2, Promise.resolve()];
264
250
  dispatch((0, exports.cacheActiveProduct)());
265
251
  cachedProduct = __assign({}, state.product.cache[idx]);
266
252
  data = JSON.parse(cachedProduct.data);
267
253
  connection_1.default.connect(data.connection);
268
254
  dispatch((0, exports.setActiveCacheIdx)(idx));
269
255
  dispatch((0, exports.setProductId)(cachedProduct.id));
270
- return [4 /*yield*/, dispatch((0, treble_1.reloadPlayer)({
256
+ return [4, dispatch((0, treble_1.reloadPlayer)({
271
257
  assetId: data.connection.assetId,
272
258
  configuration: data.configuration,
273
259
  }))];
274
260
  case 1:
275
261
  _a.sent();
276
- return [2 /*return*/];
262
+ return [2];
277
263
  }
278
264
  });
279
265
  }); };
@@ -288,21 +274,21 @@ var removeProductIdx = function (idx) {
288
274
  state = getState();
289
275
  _a = state.product, cache = _a.cache, activeCacheIdx = _a.activeCacheIdx;
290
276
  if (cache.length <= 1)
291
- return [2 /*return*/, Promise.resolve()];
292
- if (!(!idx || idx === activeCacheIdx)) return [3 /*break*/, 5];
293
- if (!(activeCacheIdx === state.product.cache.length - 1)) return [3 /*break*/, 2];
294
- return [4 /*yield*/, dispatch((0, exports.changeActiveCacheIdx)(activeCacheIdx - 1))];
277
+ return [2, Promise.resolve()];
278
+ if (!(!idx || idx === activeCacheIdx)) return [3, 5];
279
+ if (!(activeCacheIdx === state.product.cache.length - 1)) return [3, 2];
280
+ return [4, dispatch((0, exports.changeActiveCacheIdx)(activeCacheIdx - 1))];
295
281
  case 1:
296
282
  _b.sent();
297
283
  dispatch((0, exports.removeFromCache)(activeCacheIdx));
298
- return [3 /*break*/, 4];
284
+ return [3, 4];
299
285
  case 2:
300
286
  dispatch((0, exports.removeFromCache)(activeCacheIdx));
301
- return [4 /*yield*/, dispatch((0, exports.changeActiveCacheIdx)(activeCacheIdx))];
287
+ return [4, dispatch((0, exports.changeActiveCacheIdx)(activeCacheIdx))];
302
288
  case 3:
303
289
  _b.sent();
304
290
  _b.label = 4;
305
- case 4: return [3 /*break*/, 6];
291
+ case 4: return [3, 6];
306
292
  case 5:
307
293
  if (idx >= activeCacheIdx) {
308
294
  dispatch((0, exports.removeFromCache)(idx));
@@ -312,7 +298,7 @@ var removeProductIdx = function (idx) {
312
298
  dispatch((0, exports.removeFromCache)(idx));
313
299
  }
314
300
  _b.label = 6;
315
- case 6: return [2 /*return*/, Promise.resolve()];
301
+ case 6: return [2, Promise.resolve()];
316
302
  }
317
303
  });
318
304
  }); };
@@ -1,24 +1,12 @@
1
1
  import { RootState, ThreekitDispatch } from './index';
2
2
  import { ITranslationMap } from '../api/products';
3
- /*****************************************************
4
- * Types and Interfaces
5
- ****************************************************/
6
3
  export interface TranslationsState {
7
4
  language: string | undefined;
8
5
  }
9
- /*****************************************************
10
- * Constants
11
- ****************************************************/
12
6
  export declare let TRANSLATIONS: undefined | ITranslationMap;
13
- /*****************************************************
14
- * Actions
15
- ****************************************************/
16
7
  export declare const setLanguage: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>;
17
- export declare const initTranslations: (language?: string | undefined) => (dispatch: ThreekitDispatch) => Promise<void>;
8
+ export declare const initTranslations: (language?: string) => (dispatch: ThreekitDispatch) => Promise<void>;
18
9
  declare const reducer: import("redux").Reducer<TranslationsState, import("redux").AnyAction>;
19
- /*****************************************************
20
- * Standard Selectors
21
- ****************************************************/
22
10
  export declare const getLanguage: (state: RootState) => undefined | string;
23
11
  export declare const getLanguageOptions: (state: RootState) => Array<string>;
24
12
  export default reducer;
@@ -42,28 +42,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.getLanguageOptions = exports.getLanguage = exports.initTranslations = exports.setLanguage = exports.TRANSLATIONS = void 0;
43
43
  var toolkit_1 = require("@reduxjs/toolkit");
44
44
  var api_1 = __importDefault(require("../api"));
45
- /*****************************************************
46
- * Actions
47
- ****************************************************/
48
45
  exports.setLanguage = (0, toolkit_1.createAction)('treble/translations/set-language');
49
46
  var initTranslations = function (language) { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
50
47
  return __generator(this, function (_a) {
51
48
  switch (_a.label) {
52
- case 0: return [4 /*yield*/, api_1.default.products.fetchTranslations()];
49
+ case 0: return [4, api_1.default.products.fetchTranslations()];
53
50
  case 1:
54
51
  exports.TRANSLATIONS = _a.sent();
55
52
  if (language)
56
53
  dispatch((0, exports.setLanguage)(language));
57
- return [2 /*return*/];
54
+ return [2];
58
55
  }
59
56
  });
60
57
  }); }; };
61
58
  exports.initTranslations = initTranslations;
62
- /*****************************************************
63
- * State
64
- ****************************************************/
65
59
  var initialState = {
66
- // Selected language
67
60
  language: undefined,
68
61
  };
69
62
  var reducer = (0, toolkit_1.createSlice)({
@@ -76,9 +69,6 @@ var reducer = (0, toolkit_1.createSlice)({
76
69
  },
77
70
  reducers: {},
78
71
  }).reducer;
79
- /*****************************************************
80
- * Standard Selectors
81
- ****************************************************/
82
72
  var getLanguage = function (state) {
83
73
  return state.translations.language;
84
74
  };
@@ -1,8 +1,5 @@
1
1
  import { RootState, ThreekitDispatch } from './index';
2
2
  import { IProject, IPlayerConfig, IThreekitDisplayAttribute, ISetConfiguration, IConfiguration } from '../types';
3
- /*****************************************************
4
- * Types and Interfaces
5
- ****************************************************/
6
3
  export interface IPlayerInit {
7
4
  el: HTMLElement;
8
5
  authToken: string;
@@ -37,6 +34,7 @@ export interface TrebleState {
37
34
  isThreekitInitialized: boolean;
38
35
  playerElId: undefined | string;
39
36
  notifications: boolean;
37
+ loadingProgress: number;
40
38
  }
41
39
  export interface NotificationEvent extends Event {
42
40
  detail: {
@@ -47,30 +45,20 @@ export interface NotificationEvent extends Event {
47
45
  interface EventHandlers {
48
46
  postConfigurationChange?: (updatedAttributes: Array<IThreekitDisplayAttribute>, configurationChange: ISetConfiguration, previousConfiguration: Array<IThreekitDisplayAttribute>) => void | Promise<void>;
49
47
  }
50
- /*****************************************************
51
- * Actions
52
- ****************************************************/
53
48
  export declare const setThreekitEnv: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>;
54
49
  export declare const setThreekitInitialized: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
55
50
  export declare const setPlayerLoading: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
56
51
  export declare const setPlayerElement: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>;
57
52
  export declare const reloadTreble: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<TrebleState>, string>;
58
- /*****************************************************
59
- * Slice
60
- ****************************************************/
53
+ export declare const updateLoadingProgress: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>;
61
54
  declare const reducer: import("redux").Reducer<TrebleState, import("redux").AnyAction>;
62
- /*****************************************************
63
- * Standard Selectors
64
- ****************************************************/
65
55
  export declare const getThreekitEnv: (state: RootState) => string;
66
56
  export declare const isThreekitInitialized: (state: RootState) => boolean;
67
57
  export declare const isPlayerLoading: (state: RootState) => boolean;
68
58
  export declare const getPlayerElementId: (state: RootState) => undefined | string;
69
- /*****************************************************
70
- * Complex Actions
71
- ****************************************************/
59
+ export declare const getLoadingProgress: (state: RootState) => number;
72
60
  export declare const initPlayer: (config: IPlayerInit) => (dispatch: ThreekitDispatch, getState: () => RootState) => Promise<void>;
73
- export declare const launch: (launchConfig?: Partial<ILaunchConfig> | undefined) => (dispatch: ThreekitDispatch) => Promise<void>;
61
+ export declare const launch: (launchConfig?: Partial<ILaunchConfig>) => (dispatch: ThreekitDispatch) => Promise<void>;
74
62
  export declare const unloadPlayer: () => (dispatch: ThreekitDispatch) => Promise<void>;
75
63
  export declare const reloadPlayer: (config: undefined | string | Pick<IReloadConfig, 'assetId' | 'stageId' | 'configurationId' | 'configuration'>) => (dispatch: ThreekitDispatch, getState: () => RootState) => Promise<void>;
76
64
  export default reducer;