@threekit-tools/treble 0.0.81 → 0.0.84

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 (110) hide show
  1. package/dist/Treble/Treble.d.ts +11 -5
  2. package/dist/Treble/Treble.js +41 -12
  3. package/dist/Treble/index.d.ts +2 -2
  4. package/dist/Treble/index.js +7 -3
  5. package/dist/Treble/{Snapshots.d.ts → snapshots.d.ts} +4 -9
  6. package/dist/Treble/snapshots.js +247 -0
  7. package/dist/Treble/{Wishlist.d.ts → wishlist.d.ts} +2 -6
  8. package/dist/Treble/wishlist.js +135 -0
  9. package/dist/api/catalog.js +6 -6
  10. package/dist/api/configurations.js +3 -3
  11. package/dist/api/datatables.js +5 -5
  12. package/dist/api/index.js +5 -1
  13. package/dist/api/orders.d.ts +5 -7
  14. package/dist/api/orders.js +12 -12
  15. package/dist/api/price.js +2 -2
  16. package/dist/api/products.js +2 -2
  17. package/dist/components/Accordion/index.js +6 -7
  18. package/dist/components/AttributeTitle/index.d.ts +0 -9
  19. package/dist/components/AttributeTitle/index.js +0 -9
  20. package/dist/components/AttributeValue/index.d.ts +0 -6
  21. package/dist/components/AttributeValue/index.js +2 -8
  22. package/dist/components/Button/index.d.ts +0 -27
  23. package/dist/components/Button/index.js +0 -27
  24. package/dist/components/Cards/index.d.ts +2 -55
  25. package/dist/components/Cards/index.js +3 -60
  26. package/dist/components/Drawer/index.js +7 -16
  27. package/dist/components/Dropdown/index.d.ts +2 -59
  28. package/dist/components/Dropdown/index.js +11 -72
  29. package/dist/components/FlatForm/index.d.ts +0 -21
  30. package/dist/components/FlatForm/index.js +10 -25
  31. package/dist/components/Modal/index.js +2 -15
  32. package/dist/components/Player/index.d.ts +1 -1
  33. package/dist/components/PortalToArOverlay/index.js +5 -1
  34. package/dist/components/PortalToElement/index.js +0 -8
  35. package/dist/components/ProductDescription/index.d.ts +0 -6
  36. package/dist/components/ProductDescription/index.js +0 -6
  37. package/dist/components/ProductName/index.d.ts +0 -9
  38. package/dist/components/ProductName/index.js +0 -9
  39. package/dist/components/Share/index.d.ts +0 -12
  40. package/dist/components/Share/index.js +2 -14
  41. package/dist/components/Snapshots/index.d.ts +0 -8
  42. package/dist/components/Snapshots/index.js +2 -10
  43. package/dist/components/Strips/index.d.ts +2 -55
  44. package/dist/components/Strips/index.js +3 -60
  45. package/dist/components/Swatch/index.d.ts +2 -64
  46. package/dist/components/Swatch/index.js +3 -69
  47. package/dist/components/Switch/index.d.ts +2 -34
  48. package/dist/components/Switch/index.js +2 -38
  49. package/dist/components/Tabs/index.js +5 -1
  50. package/dist/components/TextInput/index.d.ts +2 -1
  51. package/dist/components/TextInput/index.js +2 -3
  52. package/dist/components/ThreekitProvider/index.js +5 -1
  53. package/dist/components/Tiles/index.d.ts +2 -29
  54. package/dist/components/Tiles/index.js +3 -33
  55. package/dist/components/TilesGroup/index.d.ts +2 -26
  56. package/dist/components/TilesGroup/index.js +3 -30
  57. package/dist/components/TotalPrice/index.d.ts +0 -6
  58. package/dist/components/TotalPrice/index.js +0 -6
  59. package/dist/components/TrebleApp/index.js +5 -1
  60. package/dist/components/Upload/index.d.ts +2 -1
  61. package/dist/components/Upload/index.js +21 -17
  62. package/dist/components/UploadArea/index.d.ts +2 -1
  63. package/dist/components/UploadArea/index.js +18 -15
  64. package/dist/components/Wishlist/index.d.ts +0 -3
  65. package/dist/components/Wishlist/index.js +12 -10
  66. package/dist/components/Zoom/index.d.ts +0 -17
  67. package/dist/components/Zoom/index.js +5 -21
  68. package/dist/components/formComponents.d.ts +12 -0
  69. package/dist/components/formComponents.js +10 -8
  70. package/dist/components/message/index.d.ts +0 -9
  71. package/dist/components/message/index.js +4 -31
  72. package/dist/connection.js +2 -2
  73. package/dist/constants.d.ts +0 -49
  74. package/dist/constants.js +1 -59
  75. package/dist/hooks/useAttribute/index.d.ts +1 -1
  76. package/dist/hooks/useAttribute/index.js +6 -6
  77. package/dist/hooks/useConfigurationLoader/index.js +5 -5
  78. package/dist/hooks/useNestedConfigurator/index.js +2 -2
  79. package/dist/hooks/useShare/index.js +3 -3
  80. package/dist/hooks/useSingleAnimation/index.js +20 -25
  81. package/dist/http/datatables.js +0 -1
  82. package/dist/http/index.js +5 -1
  83. package/dist/http/orders.d.ts +6 -8
  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 +42 -3
  88. package/dist/index.js +84 -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 +26 -38
  96. package/dist/store/translations.d.ts +1 -13
  97. package/dist/store/translations.js +2 -12
  98. package/dist/store/treble.d.ts +1 -16
  99. package/dist/store/treble.js +31 -66
  100. package/dist/store/wishlist.d.ts +0 -12
  101. package/dist/store/wishlist.js +4 -17
  102. package/dist/types.d.ts +118 -65
  103. package/dist/types.js +54 -0
  104. package/dist/utils.d.ts +10 -10
  105. package/dist/utils.js +8 -16
  106. package/package.json +16 -4
  107. package/dist/Treble/Snapshots.js +0 -251
  108. package/dist/Treble/Wishlist.js +0 -136
  109. package/dist/hooks/useImageEditor/index.d.ts +0 -14
  110. package/dist/hooks/useImageEditor/index.js +0 -320
@@ -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,19 +137,14 @@ 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
150
  var el, authToken, assetId, stageId, orgId, playerConfig, initialConfiguration, player, configurator;
@@ -184,16 +152,14 @@ var initPlayer = function (config) {
184
152
  switch (_a.label) {
185
153
  case 0:
186
154
  el = config.el, authToken = config.authToken, assetId = config.assetId, stageId = config.stageId, orgId = config.orgId, playerConfig = config.playerConfig, initialConfiguration = config.initialConfiguration;
187
- return [4 /*yield*/, window.threekitPlayer(__assign(__assign({ el: el,
188
- // Variables to sort out
189
- authToken: authToken, stageId: stageId, assetId: assetId }, playerConfig), { initialConfiguration: initialConfiguration, onLoadingProgress: function (progress) {
155
+ return [4, window.threekitPlayer(__assign(__assign({ el: el, authToken: authToken, stageId: stageId, assetId: assetId }, 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 /*yield*/, player.getConfigurator()];
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 /*yield*/, ((_a = EVENTS.postConfigurationChange) === null || _a === void 0 ? void 0 : _a.call(EVENTS, updatedAttributes, {}, previousAttributes))];
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 /*return*/];
200
+ return [2];
235
201
  }
236
202
  });
237
203
  }); });
238
- return [2 /*return*/];
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 /*return*/];
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 /*return*/, console.error('Missing credentials')];
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 /*break*/, 2];
333
- return [4 /*yield*/, api_1.default.configurations.fetch(configId)];
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 /*return*/, console.error('missing assetId')];
345
- // We create the threekit script
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,9 +317,8 @@ 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 /*yield*/, dispatch((0, exports.initPlayer)({
321
+ return [4, dispatch((0, exports.initPlayer)({
357
322
  el: el,
358
323
  orgId: orgId,
359
324
  authToken: authToken,
@@ -368,14 +333,15 @@ var launch = function (launchConfig) {
368
333
  message_1.default.info(e.detail.message);
369
334
  });
370
335
  EVENTS = Object.assign(EVENTS, launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.eventHandlers);
336
+ dispatch((0, product_1.setName)());
337
+ dispatch((0, product_1.setMetadata)());
338
+ dispatch((0, product_1.initProduct)());
371
339
  dispatch((0, exports.setThreekitEnv)(threekitEnv));
372
340
  dispatch((0, translations_1.initTranslations)(launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.locale));
373
341
  dispatch((0, price_1.initPrice)());
374
342
  dispatch((0, price_1.updatePrice)());
375
- dispatch((0, product_1.initProduct)(products));
376
- dispatch((0, product_1.setProductId)(productId));
377
343
  dispatch((0, wishlist_1.refreshWishlist)());
378
- return [2 /*return*/];
344
+ return [2];
379
345
  }
380
346
  });
381
347
  }); };
@@ -390,10 +356,10 @@ var unloadPlayer = function () { return function (dispatch) { return __awaiter(v
390
356
  dispatch((0, attributes_1.setAttributes)([]));
391
357
  dispatch((0, product_1.setName)(''));
392
358
  dispatch((0, product_1.setMetadata)({}));
393
- return [4 /*yield*/, window.threekit.player.unload()];
359
+ return [4, window.threekit.player.unload()];
394
360
  case 1:
395
361
  _a.sent();
396
- return [2 /*return*/];
362
+ return [2];
397
363
  }
398
364
  });
399
365
  }); }; };
@@ -405,19 +371,19 @@ var reloadPlayer = function (config) {
405
371
  switch (_a.label) {
406
372
  case 0:
407
373
  connectionObj = connection_1.default.getConnection();
408
- if (!(config === undefined)) return [3 /*break*/, 1];
374
+ if (!(config === undefined)) return [3, 1];
409
375
  assetId = connectionObj.assetId;
410
- return [3 /*break*/, 4];
376
+ return [3, 4];
411
377
  case 1:
412
- if (!(typeof config === 'string')) return [3 /*break*/, 2];
378
+ if (!(typeof config === 'string')) return [3, 2];
413
379
  assetId = config;
414
- return [3 /*break*/, 4];
380
+ return [3, 4];
415
381
  case 2:
416
382
  assetId = (config === null || config === void 0 ? void 0 : config.assetId) || connectionObj.assetId;
417
383
  stageId = config === null || config === void 0 ? void 0 : config.stageId;
418
384
  initialConfiguration = (config === null || config === void 0 ? void 0 : config.configuration) || {};
419
- if (!(config === null || config === void 0 ? void 0 : config.configurationId)) return [3 /*break*/, 4];
420
- return [4 /*yield*/, api_1.default.configurations.fetch(config === null || config === void 0 ? void 0 : config.configurationId)];
385
+ if (!(config === null || config === void 0 ? void 0 : config.configurationId)) return [3, 4];
386
+ return [4, api_1.default.configurations.fetch(config === null || config === void 0 ? void 0 : config.configurationId)];
421
387
  case 3:
422
388
  configuration = _a.sent();
423
389
  if (configuration) {
@@ -426,19 +392,18 @@ var reloadPlayer = function (config) {
426
392
  }
427
393
  _a.label = 4;
428
394
  case 4:
429
- // Update connection
430
395
  if (assetId !== connectionObj.assetId)
431
396
  connection_1.default.connect({ assetId: assetId });
432
397
  state = getState();
433
398
  trebleConfig = (0, utils_1.loadTrebleConfig)();
434
399
  playerConfig = Object.assign({}, constants_1.DEFAULT_PLAYER_CONFIG, trebleConfig.player);
435
400
  el = document.getElementById(state.treble.playerElId);
436
- if (!state.treble.isThreekitInitialized) return [3 /*break*/, 6];
437
- return [4 /*yield*/, dispatch((0, exports.unloadPlayer)())];
401
+ if (!state.treble.isThreekitInitialized) return [3, 6];
402
+ return [4, dispatch((0, exports.unloadPlayer)())];
438
403
  case 5:
439
404
  _a.sent();
440
405
  _a.label = 6;
441
- case 6: return [4 /*yield*/, dispatch((0, exports.initPlayer)({
406
+ case 6: return [4, dispatch((0, exports.initPlayer)({
442
407
  el: el,
443
408
  orgId: connectionObj.orgId,
444
409
  authToken: connectionObj.authToken,
@@ -451,7 +416,7 @@ var reloadPlayer = function (config) {
451
416
  _a.sent();
452
417
  dispatch((0, price_1.updatePrice)());
453
418
  dispatch((0, product_1.initProduct)());
454
- return [2 /*return*/];
419
+ return [2];
455
420
  }
456
421
  });
457
422
  }); };
@@ -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;
@@ -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 /*yield*/, window.threekit.treble.wishlist.getWishlist()];
46
+ case 0: return [4, window.threekit.treble.wishlist.getWishlist()];
53
47
  case 1:
54
48
  wishlistData = _a.sent();
55
- return [2 /*return*/, wishlistData];
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 /*yield*/, window.threekit.treble.wishlist.addItem(config)];
57
+ case 0: return [4, window.threekit.treble.wishlist.addItem(config)];
64
58
  case 1:
65
59
  wishlistData = _a.sent();
66
- return [2 /*return*/, wishlistData];
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) {