@colijnit/configurator 12.0.6 → 12.0.7

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.
@@ -1186,44 +1186,53 @@
1186
1186
  };
1187
1187
  VariationUtils.LoadVariation = function (assetPath, fileName) {
1188
1188
  return __awaiter(this, void 0, void 0, function () {
1189
- var id, file, err_1, mute;
1189
+ var _this = this;
1190
1190
  return __generator(this, function (_a) {
1191
- switch (_a.label) {
1192
- case 0:
1193
- if (!fileName) {
1194
- return [2 /*return*/, null];
1195
- }
1196
- if (fileName.indexOf('ione3d') < 0) {
1197
- fileName = fileName.concat('.ione3d');
1198
- }
1199
- id = fileName.substr(0, fileName.lastIndexOf('.ione3d'));
1200
- _a.label = 1;
1201
- case 1:
1202
- _a.trys.push([1, 6, , 7]);
1203
- if (!assetPath.endsWith('/')) {
1204
- assetPath += '/';
1205
- }
1206
- if (!window.hasOwnProperty('downloadVariation')) {
1207
- console.error('downloadVariation not defined in window global');
1208
- return [2 /*return*/, null];
1209
- }
1210
- file = void 0;
1211
- if (!this.MaterialCache.has(id)) return [3 /*break*/, 2];
1212
- file = this.MaterialCache.get(id);
1213
- return [3 /*break*/, 4];
1214
- case 2: return [4 /*yield*/, window.downloadVariation(assetPath.replace('https://cdn1.colijn-it.nl/', '') + "variation/" + fileName)];
1215
- case 3:
1216
- file = _a.sent();
1217
- this.MaterialCache.set(id, file);
1218
- _a.label = 4;
1219
- case 4: return [4 /*yield*/, VariationUtils.GetVariationSettingsFromFile(id, file)];
1220
- case 5: return [2 /*return*/, _a.sent()];
1221
- case 6:
1222
- err_1 = _a.sent();
1223
- mute = err_1;
1224
- return [2 /*return*/, null];
1225
- case 7: return [2 /*return*/];
1226
- }
1191
+ return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
1192
+ var id, file, settings, err_1, mute;
1193
+ return __generator(this, function (_a) {
1194
+ switch (_a.label) {
1195
+ case 0:
1196
+ if (!fileName) {
1197
+ resolve(null);
1198
+ }
1199
+ if (fileName.indexOf('ione3d') < 0) {
1200
+ fileName = fileName.concat('.ione3d');
1201
+ }
1202
+ id = fileName.substr(0, fileName.lastIndexOf('.ione3d'));
1203
+ _a.label = 1;
1204
+ case 1:
1205
+ _a.trys.push([1, 6, , 7]);
1206
+ if (!assetPath.endsWith('/')) {
1207
+ assetPath += '/';
1208
+ }
1209
+ if (!window.hasOwnProperty('downloadVariation')) {
1210
+ console.error('downloadVariation not defined in window global');
1211
+ reject('downloadVariation not defined in window global');
1212
+ }
1213
+ file = void 0;
1214
+ if (!this.MaterialCache.has(id)) return [3 /*break*/, 2];
1215
+ resolve(this.MaterialCache.get(id));
1216
+ return [3 /*break*/, 5];
1217
+ case 2: return [4 /*yield*/, window.downloadVariation(assetPath.replace('https://cdn1.colijn-it.nl/', '') + "variation/" + fileName)];
1218
+ case 3:
1219
+ file = _a.sent();
1220
+ return [4 /*yield*/, VariationUtils.GetVariationSettingsFromFile(id, file)];
1221
+ case 4:
1222
+ settings = _a.sent();
1223
+ this.MaterialCache.set(id, settings);
1224
+ resolve(settings);
1225
+ _a.label = 5;
1226
+ case 5: return [3 /*break*/, 7];
1227
+ case 6:
1228
+ err_1 = _a.sent();
1229
+ mute = err_1;
1230
+ reject(err_1);
1231
+ return [3 /*break*/, 7];
1232
+ case 7: return [2 /*return*/];
1233
+ }
1234
+ });
1235
+ }); })];
1227
1236
  });
1228
1237
  });
1229
1238
  };