@colijnit/homedecorator 256.1.16 → 256.1.17

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.
@@ -1,5 +1,7 @@
1
1
  export declare class FileUtils {
2
2
  private static _cachedTextureUploads;
3
+ private static _filesDontExist;
4
+ private static _filesExist;
3
5
  static StripMimeStringFromDataUri(dataUri: string): string;
4
6
  static GetMimeStringFromDataUri(dataUri: string): string;
5
7
  /**
@@ -18,6 +18,7 @@ export declare class VariationCacheService implements OnDestroy {
18
18
  preloadVariationsAsync(schema: string, fileNames: string[], articleAssetPath?: string): Promise<void>;
19
19
  loadVariation(schema: string, fileName: string): Promise<VariationSettings>;
20
20
  private _waitForVariationToLoad;
21
+ private _createSettingsForFileName;
21
22
  static ɵfac: i0.ɵɵFactoryDeclaration<VariationCacheService, never>;
22
23
  static ɵprov: i0.ɵɵInjectableDeclaration<VariationCacheService>;
23
24
  }
@@ -94,7 +94,7 @@
94
94
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
95
95
  PERFORMANCE OF THIS SOFTWARE.
96
96
  ***************************************************************************** */
97
- /* global Reflect, Promise, SuppressedError, Symbol */
97
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
98
98
  var extendStatics = function (d, b) {
99
99
  extendStatics = Object.setPrototypeOf ||
100
100
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -230,8 +230,8 @@
230
230
  }
231
231
  function __generator(thisArg, body) {
232
232
  var _ = { label: 0, sent: function () { if (t[0] & 1)
233
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
234
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
233
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
234
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
235
235
  function verb(n) { return function (v) { return step([n, v]); }; }
236
236
  function step(op) {
237
237
  if (f)
@@ -386,7 +386,7 @@
386
386
  if (!Symbol.asyncIterator)
387
387
  throw new TypeError("Symbol.asyncIterator is not defined.");
388
388
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
389
- return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
389
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
390
390
  function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
391
391
  function verb(n, f) { if (g[n]) {
392
392
  i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); };
@@ -433,14 +433,24 @@
433
433
  }) : function (o, v) {
434
434
  o["default"] = v;
435
435
  };
436
+ var ownKeys = function (o) {
437
+ ownKeys = Object.getOwnPropertyNames || function (o) {
438
+ var ar = [];
439
+ for (var k in o)
440
+ if (Object.prototype.hasOwnProperty.call(o, k))
441
+ ar[ar.length] = k;
442
+ return ar;
443
+ };
444
+ return ownKeys(o);
445
+ };
436
446
  function __importStar(mod) {
437
447
  if (mod && mod.__esModule)
438
448
  return mod;
439
449
  var result = {};
440
450
  if (mod != null)
441
- for (var k in mod)
442
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
443
- __createBinding(result, mod, k);
451
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
452
+ if (k[i] !== "default")
453
+ __createBinding(result, mod, k[i]);
444
454
  __setModuleDefault(result, mod);
445
455
  return result;
446
456
  }
@@ -510,29 +520,49 @@
510
520
  env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
511
521
  env.hasError = true;
512
522
  }
523
+ var r, s = 0;
513
524
  function next() {
514
- while (env.stack.length) {
515
- var rec = env.stack.pop();
525
+ while (r = env.stack.pop()) {
516
526
  try {
517
- var result = rec.dispose && rec.dispose.call(rec.value);
518
- if (rec.async)
519
- return Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
527
+ if (!r.async && s === 1)
528
+ return s = 0, env.stack.push(r), Promise.resolve().then(next);
529
+ if (r.dispose) {
530
+ var result = r.dispose.call(r.value);
531
+ if (r.async)
532
+ return s |= 2, Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
533
+ }
534
+ else
535
+ s |= 1;
520
536
  }
521
537
  catch (e) {
522
538
  fail(e);
523
539
  }
524
540
  }
541
+ if (s === 1)
542
+ return env.hasError ? Promise.reject(env.error) : Promise.resolve();
525
543
  if (env.hasError)
526
544
  throw env.error;
527
545
  }
528
546
  return next();
529
547
  }
548
+ function __rewriteRelativeImportExtension(path, preserveJsx) {
549
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
550
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
551
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
552
+ });
553
+ }
554
+ return path;
555
+ }
530
556
  var tslib_es6 = {
531
557
  __extends: __extends,
532
558
  __assign: __assign,
533
559
  __rest: __rest,
534
560
  __decorate: __decorate,
535
561
  __param: __param,
562
+ __esDecorate: __esDecorate,
563
+ __runInitializers: __runInitializers,
564
+ __propKey: __propKey,
565
+ __setFunctionName: __setFunctionName,
536
566
  __metadata: __metadata,
537
567
  __awaiter: __awaiter$1p,
538
568
  __generator: __generator,
@@ -555,6 +585,7 @@
555
585
  __classPrivateFieldIn: __classPrivateFieldIn,
556
586
  __addDisposableResource: __addDisposableResource,
557
587
  __disposeResources: __disposeResources,
588
+ __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
558
589
  };
559
590
 
560
591
  var MessageType;
@@ -2783,14 +2814,14 @@
2783
2814
  }
2784
2815
  if (obj.hasOwnProperty('assetPath')) {
2785
2816
  this.settings.assetPath = obj['assetPath'];
2786
- if (this.settings.assetPath[this.settings.assetPath.length - 1] !== '/') {
2817
+ if (!this.settings.assetPath[this.settings.assetPath.length - 1].endsWith('/')) {
2787
2818
  this.settings.assetPath += '/';
2788
2819
  }
2789
2820
  this.settings.threeDAssetPath = this.settings.assetPath;
2790
2821
  }
2791
2822
  if (obj.hasOwnProperty('threeDAssetPath')) {
2792
2823
  this.settings.threeDAssetPath = obj['threeDAssetPath'];
2793
- if (this.settings.threeDAssetPath[this.settings.threeDAssetPath.length - 1] !== '/') {
2824
+ if (!this.settings.threeDAssetPath[this.settings.threeDAssetPath.length - 1].endsWith('/')) {
2794
2825
  this.settings.threeDAssetPath += '/';
2795
2826
  }
2796
2827
  }
@@ -4423,13 +4454,24 @@
4423
4454
  switch (_a.label) {
4424
4455
  case 0:
4425
4456
  _a.trys.push([0, 2, , 3]);
4426
- return [4 /*yield*/, fetch(url, { method: 'OPTIONS' })];
4457
+ if (this._filesDontExist.indexOf(url) > -1) { // no need to check again
4458
+ return [2 /*return*/, false];
4459
+ }
4460
+ if (this._filesExist.indexOf(url) > -1) { // no need to check again
4461
+ return [2 /*return*/, true];
4462
+ }
4463
+ return [4 /*yield*/, fetch(url, { method: 'HEAD' })];
4427
4464
  case 1:
4428
4465
  response = _a.sent();
4429
- return [2 /*return*/, response.ok];
4466
+ if (response.ok && response.status === 200) {
4467
+ this._filesExist.push(url);
4468
+ return [2 /*return*/, true];
4469
+ }
4470
+ this._filesDontExist.push(url);
4471
+ return [2 /*return*/, false];
4430
4472
  case 2:
4431
4473
  error_1 = _a.sent();
4432
- // console.warn('Error checking URL status:', error);
4474
+ this._filesDontExist.push(url);
4433
4475
  return [2 /*return*/, false];
4434
4476
  case 3: return [2 /*return*/];
4435
4477
  }
@@ -4621,7 +4663,9 @@
4621
4663
  };
4622
4664
  return FileUtils;
4623
4665
  }());
4624
- FileUtils._cachedTextureUploads = new Map();
4666
+ FileUtils._cachedTextureUploads = new Map();
4667
+ FileUtils._filesDontExist = [];
4668
+ FileUtils._filesExist = [];
4625
4669
 
4626
4670
  var __awaiter$1f = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4627
4671
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -16168,8 +16212,8 @@
16168
16212
  /* tslint:disable */
16169
16213
  var VersionInfo = {
16170
16214
  application: "Homedecorator",
16171
- appVersion: "256.1.13",
16172
- revision: "115041"
16215
+ appVersion: "256.1.15",
16216
+ revision: "115403"
16173
16217
  };
16174
16218
  /* tslint:enable */
16175
16219
 
@@ -23325,7 +23369,7 @@
23325
23369
  VariationUtils.LoadVariation = function (assetPath, url, fileName, includeVariationFolder) {
23326
23370
  if (includeVariationFolder === void 0) { includeVariationFolder = true; }
23327
23371
  return __awaiter$O(this, void 0, void 0, function () {
23328
- var id, variationUrl, response, compressed, err_1, mute;
23372
+ var id, variationUrl, fileExists, response, compressed, err_1, mute;
23329
23373
  return __generator(this, function (_a) {
23330
23374
  switch (_a.label) {
23331
23375
  case 0:
@@ -23339,23 +23383,29 @@
23339
23383
  variationUrl = url + (includeVariationFolder ? '/variation' : '') + "/" + fileName;
23340
23384
  _a.label = 1;
23341
23385
  case 1:
23342
- _a.trys.push([1, 5, , 6]);
23343
- return [4 /*yield*/, fetch(variationUrl)];
23386
+ _a.trys.push([1, 8, , 9]);
23387
+ return [4 /*yield*/, FileUtils.DoesFileExist(variationUrl)];
23344
23388
  case 2:
23389
+ fileExists = _a.sent();
23390
+ if (!!fileExists) return [3 /*break*/, 3];
23391
+ return [2 /*return*/, null];
23392
+ case 3: return [4 /*yield*/, fetch(variationUrl)];
23393
+ case 4:
23345
23394
  response = _a.sent();
23346
23395
  if (!response.ok) {
23347
23396
  return [2 /*return*/, null];
23348
23397
  }
23349
23398
  return [4 /*yield*/, response.blob()];
23350
- case 3:
23399
+ case 5:
23351
23400
  compressed = _a.sent();
23352
23401
  return [4 /*yield*/, VariationUtils.GetVariationSettingsFromFile(id, compressed)];
23353
- case 4: return [2 /*return*/, _a.sent()];
23354
- case 5:
23402
+ case 6: return [2 /*return*/, _a.sent()];
23403
+ case 7: return [3 /*break*/, 9];
23404
+ case 8:
23355
23405
  err_1 = _a.sent();
23356
23406
  mute = err_1;
23357
23407
  return [2 /*return*/, null];
23358
- case 6: return [2 /*return*/];
23408
+ case 9: return [2 /*return*/];
23359
23409
  }
23360
23410
  });
23361
23411
  });
@@ -24041,19 +24091,8 @@
24041
24091
  if (articleAssetPath === void 0) { articleAssetPath = ''; }
24042
24092
  fileNames.forEach(function (fileName) {
24043
24093
  if (fileName && !_this.get(fileName)) {
24044
- var settings_1 = new VariationSettings();
24045
- settings_1.id = fileName;
24046
- settings_1.loading = true;
24047
- _this._variations.push(settings_1);
24048
- var assetPath = _this._settingsService.settings.assetPath;
24049
- if (!assetPath.endsWith('/')) {
24050
- assetPath += '/';
24051
- }
24052
- var threeDAssetPath = articleAssetPath ? articleAssetPath : _this._settingsService.settings.threeDAssetPath;
24053
- if (!threeDAssetPath.endsWith('/')) {
24054
- threeDAssetPath += '/';
24055
- }
24056
- VariationUtils.LoadVariation(assetPath, threeDAssetPath + schema, fileName).then(function (variationSettings) {
24094
+ var settings_1 = _this._createSettingsForFileName(fileName);
24095
+ VariationUtils.LoadVariation(_this._settingsService.settings.assetPath, (articleAssetPath ? articleAssetPath : _this._settingsService.settings.threeDAssetPath) + schema, fileName).then(function (variationSettings) {
24057
24096
  settings_1.loading = false;
24058
24097
  settings_1.loaded.next(variationSettings);
24059
24098
  if (variationSettings) {
@@ -24074,20 +24113,9 @@
24074
24113
  promises = [];
24075
24114
  fileNames.forEach(function (fileName) {
24076
24115
  if (fileName && !_this.get(fileName)) {
24077
- var settings_2 = new VariationSettings();
24078
- settings_2.id = fileName;
24079
- settings_2.loading = true;
24080
- _this._variations.push(settings_2);
24081
- var assetPath_1 = _this._settingsService.settings.assetPath;
24082
- if (!assetPath_1.endsWith('/')) {
24083
- assetPath_1 += '/';
24084
- }
24085
- var threeDAssetPath_1 = articleAssetPath ? articleAssetPath : _this._settingsService.settings.threeDAssetPath;
24086
- if (!threeDAssetPath_1.endsWith('/')) {
24087
- threeDAssetPath_1 += '/';
24088
- }
24116
+ var settings_2 = _this._createSettingsForFileName(fileName);
24089
24117
  promises.push(new Promise(function (resolve) {
24090
- VariationUtils.LoadVariation(assetPath_1, threeDAssetPath_1 + schema, fileName).then(function (variationSettings) {
24118
+ VariationUtils.LoadVariation(_this._settingsService.settings.assetPath, (articleAssetPath ? articleAssetPath : _this._settingsService.settings.threeDAssetPath) + schema, fileName).then(function (variationSettings) {
24091
24119
  settings_2.loading = false;
24092
24120
  settings_2.loaded.next(variationSettings);
24093
24121
  if (variationSettings) {
@@ -24133,6 +24161,13 @@
24133
24161
  });
24134
24162
  });
24135
24163
  };
24164
+ VariationCacheService.prototype._createSettingsForFileName = function (fileName) {
24165
+ var settings = new VariationSettings();
24166
+ settings.id = fileName;
24167
+ settings.loading = true;
24168
+ this._variations.push(settings);
24169
+ return settings;
24170
+ };
24136
24171
  return VariationCacheService;
24137
24172
  }());
24138
24173
  VariationCacheService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: VariationCacheService, deps: [{ token: HomedecoratorSettingsService }, { token: PresetsService }, { token: ItemService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
@@ -24258,12 +24293,8 @@
24258
24293
  switch (_a.label) {
24259
24294
  case 0:
24260
24295
  url = VariationUtils.GetUrl(assetPath, schema, id);
24261
- return [4 /*yield*/, FileUtils.DoesFileExist(url)];
24262
- case 1:
24263
- if (!_a.sent()) return [3 /*break*/, 3];
24264
24296
  return [4 /*yield*/, this._variationCacheService.loadVariation(schema, id)];
24265
- case 2: return [2 /*return*/, _a.sent()];
24266
- case 3: return [2 /*return*/];
24297
+ case 1: return [2 /*return*/, _a.sent()];
24267
24298
  }
24268
24299
  });
24269
24300
  });
@@ -24409,7 +24440,8 @@
24409
24440
  switch (_b.label) {
24410
24441
  case 0:
24411
24442
  newVariation = new Variation();
24412
- newVariation.decoId = parseFloat(variations[j].id);
24443
+ newVariation.decoId = variations[j] instanceof Variation ? variations[j].decoId : parseFloat(variations[j].id);
24444
+ newVariation.node = variations[j] instanceof Variation ? variations[j].node : variations[j].nodeId;
24413
24445
  newVariation.brandId = variations[j].brandId;
24414
24446
  newVariation.optionText = variations[j].optionText;
24415
24447
  newVariation.gameObjectName = variations[j].gameObjectName;
@@ -26900,7 +26932,7 @@
26900
26932
  var len = this.selections.length;
26901
26933
  var _loop_3 = function (i) {
26902
26934
  // const id: string = this.selections[i].artNodeIdDeco;
26903
- var deco = this_2._iOne.decoNodes.find(function (d) { return d.id === _this.selections[i].artNodeIdDeco; });
26935
+ var deco = this_2._iOne.decoNodes.find(function (d) { return d.nodeId === _this.selections[i].node; });
26904
26936
  if (!deco) {
26905
26937
  deco = new decoNode.DecoNode();
26906
26938
  }
@@ -27136,7 +27168,7 @@
27136
27168
  break;
27137
27169
  }
27138
27170
  currentLevel = selection.presentationLevel;
27139
- if (selection.hdecoGameObject) {
27171
+ if (currentLevel === 1 && selection.hdecoGameObject) {
27140
27172
  return selection.hdecoGameObject;
27141
27173
  }
27142
27174
  }
@@ -27394,44 +27426,36 @@
27394
27426
  BuildFurnitureService.prototype._preloadMaterial = function (answer) {
27395
27427
  var _this = this;
27396
27428
  if (answer.elementType === decoNodeType_enum.DecoNodeType.Variation && answer.gameObject) {
27397
- var variationDecoNode_1 = new decoNode.DecoNode();
27398
- variationDecoNode_1.gameObjectName = answer.gameObject;
27399
- var adjustablesClone_1 = this._adjustables.map(function (s) { return Object.assign({}, s); });
27429
+ var variations = this._getVariations();
27430
+ var variationDecoNode_1 = variations.find(function (v) { return ((v.parentId && answer.parentArticleDecoId && v.parentId.toString() === answer.parentArticleDecoId.toString()) ||
27431
+ // @ts-ignore
27432
+ (v.parentId && answer.parentNodeId && v.parentId.toString() === answer.parentNodeId.toString())); });
27433
+ if (!variationDecoNode_1 || !this.currentCustomFloorGroup) {
27434
+ return;
27435
+ }
27436
+ var affectedSelections = [];
27400
27437
  if (this._genericSelection) {
27401
- if (this.currentCustomFloorGroup) {
27402
- adjustablesClone_1.forEach(function (selection) { return selection.variations = [variationDecoNode_1]; });
27403
- this._variationCacheService.preloadVariationsAsync(adjustablesClone_1[0].schema, [variationDecoNode_1.gameObjectName], this.articleAssetPath)
27404
- .then(function () {
27405
- _this._variationService.loadVariation(_this.articleAssetPath, adjustablesClone_1, '', _this.currentCustomFloorGroup, true)
27406
- .then(function () { return _this._sceneService.needsRender = true; });
27407
- });
27408
- }
27409
- else {
27410
- this._adjustables.forEach(function (selection) { return selection.variations = [variationDecoNode_1]; });
27411
- }
27438
+ affectedSelections = this._adjustables;
27412
27439
  }
27413
27440
  else {
27414
27441
  var currentSelection_1 = ObjectUtils.GetSelectionFromSelectedObject(this._activeChildElement);
27415
- if (currentSelection_1) {
27416
- if (this.currentCustomFloorGroup) {
27417
- var selectionFromAdjustables = adjustablesClone_1
27418
- .find(function (selection) { return selection.nodeId === currentSelection_1.nodeId; });
27419
- if (selectionFromAdjustables) {
27420
- selectionFromAdjustables.variations = [variationDecoNode_1];
27421
- this._variationCacheService.preloadVariationsAsync(adjustablesClone_1[0].schema, [variationDecoNode_1.gameObjectName], this.articleAssetPath)
27422
- .then(function () {
27423
- _this._variationService.loadVariation(_this.articleAssetPath, adjustablesClone_1, '', _this.currentCustomFloorGroup, true)
27424
- .then(function () { return _this._sceneService.needsRender = true; });
27425
- });
27426
- }
27427
- }
27428
- else {
27429
- var selectionFromAdjustables = this._adjustables
27430
- .find(function (selection) { return selection.nodeId === currentSelection_1.nodeId; });
27431
- selectionFromAdjustables.variations = [variationDecoNode_1];
27432
- }
27433
- }
27442
+ affectedSelections = [this._adjustables.find(function (selection) { return selection.nodeId === currentSelection_1.nodeId; })];
27443
+ }
27444
+ var adjustablesClone_1 = affectedSelections && affectedSelections.length > 0 ? affectedSelections.map(function (s) { return Object.assign({}, s); }) : [];
27445
+ if (adjustablesClone_1.length === 0) {
27446
+ return;
27434
27447
  }
27448
+ adjustablesClone_1.forEach(function (selection) {
27449
+ var variation = selection.variations.find(function (v) { return v.decoId.toString() === variationDecoNode_1.id.toString() && v.node.toString() === variationDecoNode_1.nodeId.toString(); });
27450
+ if (variation) {
27451
+ variation.gameObjectName = answer.gameObject;
27452
+ }
27453
+ });
27454
+ this._variationCacheService.preloadVariationsAsync(adjustablesClone_1[0].schema, [answer.gameObject], this.articleAssetPath)
27455
+ .then(function () {
27456
+ _this._variationService.loadVariation(_this.articleAssetPath, adjustablesClone_1, '', _this.currentCustomFloorGroup, true)
27457
+ .then(function () { return _this._sceneService.needsRender = true; });
27458
+ });
27435
27459
  }
27436
27460
  };
27437
27461
  return BuildFurnitureService;
@@ -28390,7 +28414,7 @@
28390
28414
  set: function (value) {
28391
28415
  this._article = value;
28392
28416
  if (this._article) {
28393
- this._buildFurnitureService.articleAssetPath = this._article.contentDeliveryUrl;
28417
+ this._buildFurnitureService.articleAssetPath = this._article.contentDeliveryUrl + (!this._article.contentDeliveryUrl.endsWith('/') ? '/' : '');
28394
28418
  }
28395
28419
  this.articleLoaded.next(this._article);
28396
28420
  },