@colijnit/configurator 1.0.13 → 1.0.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.
Files changed (34) hide show
  1. package/app/builder.d.ts +12 -11
  2. package/app/components/answers/answer/answer.component.d.ts +0 -1
  3. package/app/services/configurator.service.d.ts +9 -14
  4. package/app/services/locator.service.d.ts +4 -0
  5. package/bundles/colijnit-configurator.umd.js +207 -76
  6. package/bundles/colijnit-configurator.umd.js.map +1 -1
  7. package/bundles/colijnit-configurator.umd.min.js +2 -2
  8. package/bundles/colijnit-configurator.umd.min.js.map +1 -1
  9. package/colijnit-configurator.d.ts +6 -7
  10. package/colijnit-configurator.metadata.json +1 -1
  11. package/esm2015/app/builder.js +67 -25
  12. package/esm2015/app/components/answers/answer/answer.component.js +26 -17
  13. package/esm2015/app/components/answers/answers.component.js +16 -13
  14. package/esm2015/app/components/selections/selections.component.js +45 -25
  15. package/esm2015/app/services/configurator.service.js +36 -21
  16. package/esm2015/app/services/image-cache.service.js +3 -1
  17. package/esm2015/app/services/locator.service.js +10 -0
  18. package/esm2015/colijnit-configurator.js +7 -8
  19. package/esm2015/public_api.js +2 -1
  20. package/esm5/app/builder.js +116 -34
  21. package/esm5/app/components/answers/answer/answer.component.js +20 -10
  22. package/esm5/app/components/answers/answers.component.js +3 -3
  23. package/esm5/app/components/selections/selections.component.js +4 -4
  24. package/esm5/app/services/configurator.service.js +55 -22
  25. package/esm5/app/services/image-cache.service.js +3 -1
  26. package/esm5/app/services/locator.service.js +13 -0
  27. package/esm5/colijnit-configurator.js +7 -8
  28. package/esm5/public_api.js +2 -1
  29. package/fesm2015/colijnit-configurator.js +192 -96
  30. package/fesm2015/colijnit-configurator.js.map +1 -1
  31. package/fesm5/colijnit-configurator.js +203 -68
  32. package/fesm5/colijnit-configurator.js.map +1 -1
  33. package/package.json +2 -2
  34. package/public_api.d.ts +1 -0
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('@colijnit/configuratorapi/build/model/deco-node'), require('@colijnit/configuratorapi/build/service/business-object-factory'), require('@colijnit/configuratorapi/build/model/selection'), require('@colijnit/configuratorapi/build/enum/deco-node-type.enum'), require('axios'), require('@colijnit/configuratorapi/build/enum/deco-node-kind.enum'), require('jszip'), require('@colijnit/configuratorapi/build/model/article'), require('@angular/core'), require('@colijnit/configuratorapi/build/configurator'), require('rxjs'), require('@angular/common'), require('@angular/animations')) :
3
- typeof define === 'function' && define.amd ? define('@colijnit/configurator', ['exports', 'three', '@colijnit/configuratorapi/build/model/deco-node', '@colijnit/configuratorapi/build/service/business-object-factory', '@colijnit/configuratorapi/build/model/selection', '@colijnit/configuratorapi/build/enum/deco-node-type.enum', 'axios', '@colijnit/configuratorapi/build/enum/deco-node-kind.enum', 'jszip', '@colijnit/configuratorapi/build/model/article', '@angular/core', '@colijnit/configuratorapi/build/configurator', 'rxjs', '@angular/common', '@angular/animations'], factory) :
4
- (global = global || self, factory((global.colijnit = global.colijnit || {}, global.colijnit.configurator = {}), global.three, global.decoNode, global.businessObjectFactory, global.selection, global.decoNodeType_enum, global.axios, global.decoNodeKind_enum, global.JSZip, global.article, global.ng.core, global.configurator, global.rxjs, global.ng.common, global.ng.animations));
5
- }(this, (function (exports, three, decoNode, businessObjectFactory, selection, decoNodeType_enum, axios, decoNodeKind_enum, JSZip, article, core, configurator, rxjs, common, animations) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('@colijnit/configuratorapi/build/model/options'), require('@colijnit/configuratorapi/build/model/deco-node'), require('@colijnit/configuratorapi/build/service/business-object-factory'), require('@colijnit/configuratorapi/build/model/selection'), require('@colijnit/configuratorapi/build/enum/deco-node-type.enum'), require('axios'), require('@colijnit/configuratorapi/build/enum/deco-node-kind.enum'), require('jszip'), require('@colijnit/configuratorapi/build/model/article'), require('@angular/core'), require('@colijnit/configuratorapi/build/configurator'), require('@colijnit/configuratorapi/build/utils/function/not-nill.function'), require('@colijnit/configuratorapi/build/enum/node-type.enum'), require('@colijnit/configuratorapi/build/utils/function/is-nill.function'), require('rxjs'), require('@angular/common'), require('@angular/animations')) :
3
+ typeof define === 'function' && define.amd ? define('@colijnit/configurator', ['exports', 'three', '@colijnit/configuratorapi/build/model/options', '@colijnit/configuratorapi/build/model/deco-node', '@colijnit/configuratorapi/build/service/business-object-factory', '@colijnit/configuratorapi/build/model/selection', '@colijnit/configuratorapi/build/enum/deco-node-type.enum', 'axios', '@colijnit/configuratorapi/build/enum/deco-node-kind.enum', 'jszip', '@colijnit/configuratorapi/build/model/article', '@angular/core', '@colijnit/configuratorapi/build/configurator', '@colijnit/configuratorapi/build/utils/function/not-nill.function', '@colijnit/configuratorapi/build/enum/node-type.enum', '@colijnit/configuratorapi/build/utils/function/is-nill.function', 'rxjs', '@angular/common', '@angular/animations'], factory) :
4
+ (global = global || self, factory((global.colijnit = global.colijnit || {}, global.colijnit.configurator = {}), global.three, global.options, global.decoNode, global.businessObjectFactory, global.selection, global.decoNodeType_enum, global.axios, global.decoNodeKind_enum, global.JSZip, global.article, global.ng.core, global.configurator, global.notNill_function, global.nodeType_enum, global.isNill_function, global.rxjs, global.ng.common, global.ng.animations));
5
+ }(this, (function (exports, three, options, decoNode, businessObjectFactory, selection, decoNodeType_enum, axios, decoNodeKind_enum, JSZip, article, core, configurator, notNill_function, nodeType_enum, isNill_function, rxjs, common, animations) { 'use strict';
6
6
 
7
7
  axios = axios && Object.prototype.hasOwnProperty.call(axios, 'default') ? axios['default'] : axios;
8
8
 
@@ -1558,22 +1558,25 @@
1558
1558
  return VariationHelper;
1559
1559
  }());
1560
1560
 
1561
+ var ServiceLocator = /** @class */ (function () {
1562
+ function ServiceLocator() {
1563
+ }
1564
+ ServiceLocator.injector = undefined;
1565
+ ServiceLocator = __decorate([
1566
+ core.Injectable()
1567
+ ], ServiceLocator);
1568
+ return ServiceLocator;
1569
+ }());
1570
+
1561
1571
  var ConfiguratorService = /** @class */ (function () {
1562
- function ConfiguratorService() {
1563
- this.selectionsReceived = new rxjs.BehaviorSubject([]);
1564
- this.answersReceived = new rxjs.BehaviorSubject([]);
1565
- this.questionReceived = new rxjs.BehaviorSubject(undefined);
1566
- this._subs = [];
1572
+ function ConfiguratorService(_injector) {
1573
+ this._injector = _injector;
1574
+ if (!ServiceLocator.injector) {
1575
+ ServiceLocator.injector = _injector;
1576
+ }
1567
1577
  }
1568
- ConfiguratorService.prototype.ngOnDestroy = function () {
1569
- this._subs.forEach(function (subscription) {
1570
- subscription.unsubscribe();
1571
- });
1572
- };
1573
1578
  ConfiguratorService.prototype.initApi = function (options) {
1574
- var _this = this;
1575
1579
  this._configuratorApi = new configurator.Configurator(options);
1576
- this._subs.push(this._configuratorApi.selectionsReceived.subscribe(function (selections) { return _this.selectionsReceived.next(selections); }), this._configuratorApi.answersReceived.subscribe(function (answers) { return _this.answersReceived.next(answers); }), this._configuratorApi.questionReceived.subscribe(function (question) { return _this.questionReceived.next(question); }));
1577
1580
  };
1578
1581
  ConfiguratorService.prototype.initNodeInstance = function (goodId) {
1579
1582
  return __awaiter(this, void 0, void 0, function () {
@@ -1618,13 +1621,21 @@
1618
1621
  });
1619
1622
  });
1620
1623
  };
1621
- ConfiguratorService.prototype.getSelections = function (showLoader) {
1624
+ ConfiguratorService.prototype.getSelections = function (showLoader, publicationCode) {
1622
1625
  if (showLoader === void 0) { showLoader = false; }
1626
+ if (publicationCode === void 0) { publicationCode = 2; }
1623
1627
  return __awaiter(this, void 0, void 0, function () {
1628
+ var selections;
1624
1629
  return __generator(this, function (_a) {
1625
1630
  switch (_a.label) {
1626
1631
  case 0: return [4 /*yield*/, this._configuratorApi.getSelections(showLoader)];
1627
- case 1: return [2 /*return*/, _a.sent()];
1632
+ case 1:
1633
+ selections = _a.sent();
1634
+ selections.resultObjects.filter(function (s) {
1635
+ (isNill_function.isNill(s.hierarchicalPublicationCode) || ((s.hierarchicalPublicationCode & publicationCode) > 0)) && ((s.nodeType === nodeType_enum.NodeType.Question && (((s.questionPublicationCode & publicationCode) > 0) || isNill_function.isNill(s.questionPublicationCode))) ||
1636
+ (s.nodeType === nodeType_enum.NodeType.Answer && (((s.answerPublicationCode & publicationCode) > 0) || isNill_function.isNill(s.answerPublicationCode))));
1637
+ });
1638
+ return [2 /*return*/, selections];
1628
1639
  }
1629
1640
  });
1630
1641
  });
@@ -1640,11 +1651,23 @@
1640
1651
  });
1641
1652
  });
1642
1653
  };
1643
- ConfiguratorService.prototype.getQuestionAndAnswers = function (showLoader) {
1654
+ ConfiguratorService.prototype.getQuestionAndAnswers = function (showLoader, publicationCode) {
1644
1655
  if (showLoader === void 0) { showLoader = false; }
1656
+ if (publicationCode === void 0) { publicationCode = 2; }
1645
1657
  return __awaiter(this, void 0, void 0, function () {
1658
+ var questionAndAnswers;
1646
1659
  return __generator(this, function (_a) {
1647
- return [2 /*return*/, this._configuratorApi.getQuestionAndAnswers(showLoader)];
1660
+ switch (_a.label) {
1661
+ case 0: return [4 /*yield*/, this._configuratorApi.getQuestionAndAnswers(showLoader)];
1662
+ case 1:
1663
+ questionAndAnswers = _a.sent();
1664
+ questionAndAnswers.answers.filter(function (answer) {
1665
+ (notNill_function.notNill(answer.hierarchicalPublicationCode) && (answer.hierarchicalPublicationCode & publicationCode) === 0) ||
1666
+ (answer.type === nodeType_enum.NodeType.Question && (answer.questionPublicationCode & publicationCode) === 0 && notNill_function.notNill(answer.questionPublicationCode)) ||
1667
+ (answer.type === nodeType_enum.NodeType.Answer && (answer.publicationCode & publicationCode) === 0 && notNill_function.notNill(answer.publicationCode));
1668
+ });
1669
+ return [2 /*return*/, questionAndAnswers];
1670
+ }
1648
1671
  });
1649
1672
  });
1650
1673
  };
@@ -1664,13 +1687,30 @@
1664
1687
  };
1665
1688
  ConfiguratorService.prototype.selectSelection = function (selection, showLoader) {
1666
1689
  if (showLoader === void 0) { showLoader = false; }
1667
- this._configuratorApi.selectSelection(selection, showLoader);
1690
+ return __awaiter(this, void 0, void 0, function () {
1691
+ return __generator(this, function (_a) {
1692
+ switch (_a.label) {
1693
+ case 0: return [4 /*yield*/, this._configuratorApi.selectSelection(selection, showLoader)];
1694
+ case 1: return [2 /*return*/, _a.sent()];
1695
+ }
1696
+ });
1697
+ });
1668
1698
  };
1669
1699
  ConfiguratorService.prototype.selectAnswer = function (answer, showLoader) {
1670
1700
  if (showLoader === void 0) { showLoader = false; }
1671
- this._configuratorApi.selectAnswer(answer, showLoader);
1701
+ return __awaiter(this, void 0, void 0, function () {
1702
+ return __generator(this, function (_a) {
1703
+ switch (_a.label) {
1704
+ case 0: return [4 /*yield*/, this._configuratorApi.selectAnswer(answer, showLoader)];
1705
+ case 1: return [2 /*return*/, _a.sent()];
1706
+ }
1707
+ });
1708
+ });
1672
1709
  };
1673
- ConfiguratorService.ɵprov = core.ɵɵdefineInjectable({ factory: function ConfiguratorService_Factory() { return new ConfiguratorService(); }, token: ConfiguratorService, providedIn: "root" });
1710
+ ConfiguratorService.ctorParameters = function () { return [
1711
+ { type: core.Injector }
1712
+ ]; };
1713
+ ConfiguratorService.ɵprov = core.ɵɵdefineInjectable({ factory: function ConfiguratorService_Factory() { return new ConfiguratorService(core.ɵɵinject(core.INJECTOR)); }, token: ConfiguratorService, providedIn: "root" });
1674
1714
  ConfiguratorService = __decorate([
1675
1715
  core.Injectable({
1676
1716
  providedIn: 'root'
@@ -1680,71 +1720,76 @@
1680
1720
  }());
1681
1721
 
1682
1722
  var Builder = /** @class */ (function () {
1683
- function Builder(_configuratorService) {
1684
- var _this = this;
1685
- this._configuratorService = _configuratorService;
1723
+ function Builder(scene, options, useInAngular) {
1686
1724
  this.selectionsReceived = new rxjs.BehaviorSubject([]);
1687
1725
  this.answersReceived = new rxjs.BehaviorSubject([]);
1688
- this.questionReceived = new rxjs.BehaviorSubject(undefined);
1726
+ this.modelLoaded = new rxjs.BehaviorSubject(null);
1689
1727
  this._selections = [];
1728
+ this._answers = [];
1690
1729
  this._decos = [];
1691
1730
  this._placedAdjustables = [];
1692
1731
  this._placedAddables = [];
1693
1732
  this._adjustables = [];
1694
1733
  this._addables = [];
1695
1734
  this._articleCache = new Map();
1696
- this._subs = [];
1697
1735
  this._boFactory = new businessObjectFactory.BusinessObjectFactory();
1698
1736
  this._threedUtils = new ThreedUtils();
1699
1737
  this._variationHelper = new VariationHelper();
1700
- this._subs.push(this._configuratorService.selectionsReceived.subscribe(function (selections) { return _this.selectionsReceived.next(selections); }), this._configuratorService.answersReceived.subscribe(function (answers) { return _this.answersReceived.next(answers); }), this._configuratorService.questionReceived.subscribe(function (question) { return _this.questionReceived.next(question); }));
1701
- }
1702
- Builder.prototype.init = function (scene, options) {
1703
1738
  if (!scene) {
1704
1739
  throw 'No scene object provided!';
1705
1740
  }
1706
1741
  if (!options) {
1707
1742
  throw 'No connection options provided!';
1708
1743
  }
1709
- if (!this._configuratorService) {
1710
- this._configuratorService = new ConfiguratorService();
1744
+ if (useInAngular) {
1745
+ this._configuratorService = ServiceLocator.injector.get(ConfiguratorService);
1746
+ }
1747
+ else {
1748
+ this._configuratorService = new ConfiguratorService(undefined);
1711
1749
  }
1712
1750
  this._configuratorService.initApi(options);
1713
1751
  this._scene = scene;
1714
- };
1715
- Builder.prototype.buildModel = function (instanceId, sku, goodId) {
1752
+ }
1753
+ Builder.prototype.buildModel = function (sku, instanceId, goodId) {
1716
1754
  return __awaiter(this, void 0, void 0, function () {
1717
1755
  var promises, e_1;
1718
1756
  return __generator(this, function (_a) {
1719
1757
  switch (_a.label) {
1720
1758
  case 0:
1721
- if (!this._scene && !instanceId) {
1759
+ if (!this._scene) {
1722
1760
  return [2 /*return*/];
1723
1761
  }
1724
1762
  _a.label = 1;
1725
1763
  case 1:
1726
- _a.trys.push([1, 7, , 8]);
1727
- return [4 /*yield*/, this._prepareConfiguration(sku, goodId)];
1764
+ _a.trys.push([1, 8, , 9]);
1765
+ return [4 /*yield*/, this._setInstanceId(sku, instanceId, goodId)];
1728
1766
  case 2:
1729
1767
  _a.sent();
1730
- if (!this._source) return [3 /*break*/, 5];
1731
- return [4 /*yield*/, this._configuratorService.setInstanceToConfigure(instanceId)];
1768
+ return [4 /*yield*/, this._prepareConfiguration(this._sku, this._goodId)];
1732
1769
  case 3:
1770
+ _a.sent();
1771
+ if (!this._source) return [3 /*break*/, 6];
1772
+ return [4 /*yield*/, this._configuratorService.setInstanceToConfigure(this._instanceId)];
1773
+ case 4:
1733
1774
  _a.sent();
1734
1775
  promises = [];
1735
- promises.push(this._getSelections(instanceId));
1776
+ promises.push(this.getQuestionAndAnswers());
1777
+ promises.push(this._getSelections(this._instanceId));
1736
1778
  promises.push(this._getDecos());
1737
1779
  return [4 /*yield*/, Promise.all(promises)];
1738
- case 4:
1780
+ case 5:
1739
1781
  _a.sent();
1782
+ if (this._answers.length > 0) {
1783
+ return [2 /*return*/];
1784
+ }
1740
1785
  this._linkSelectionsAndDecos();
1741
- return [2 /*return*/, this._build(instanceId)];
1742
- case 5: throw 'GLB source not found!';
1743
- case 6: return [3 /*break*/, 8];
1744
- case 7:
1786
+ return [2 /*return*/, this._build(this._instanceId)];
1787
+ case 6: throw 'GLB source not found!';
1788
+ case 7: return [3 /*break*/, 9];
1789
+ case 8:
1745
1790
  e_1 = _a.sent();
1746
1791
  throw e_1;
1747
- case 8: return [2 /*return*/];
1792
+ case 9: return [2 /*return*/];
1748
1793
  }
1749
1794
  });
1750
1795
  });
@@ -1757,17 +1802,87 @@
1757
1802
  this._variationHelper.clearCache();
1758
1803
  };
1759
1804
  Builder.prototype.selectSelection = function (selection) {
1760
- this._configuratorService.selectSelection(selection, false);
1805
+ return __awaiter(this, void 0, void 0, function () {
1806
+ return __generator(this, function (_a) {
1807
+ switch (_a.label) {
1808
+ case 0: return [4 /*yield*/, this._configuratorService.selectSelection(selection, false)];
1809
+ case 1:
1810
+ _a.sent();
1811
+ this.getQuestionAndAnswers();
1812
+ return [2 /*return*/];
1813
+ }
1814
+ });
1815
+ });
1761
1816
  };
1762
- Builder.prototype.getQuestionAndAnswers = function () {
1817
+ Builder.prototype.getQuestionAndAnswers = function (publicationCode) {
1763
1818
  return __awaiter(this, void 0, void 0, function () {
1819
+ var questionsAndAnswers;
1764
1820
  return __generator(this, function (_a) {
1765
- return [2 /*return*/, this._configuratorService.getQuestionAndAnswers(false)];
1821
+ switch (_a.label) {
1822
+ case 0: return [4 /*yield*/, this._configuratorService.getQuestionAndAnswers(false, publicationCode)];
1823
+ case 1:
1824
+ questionsAndAnswers = _a.sent();
1825
+ this._answers = questionsAndAnswers.answers;
1826
+ this.answersReceived.next(questionsAndAnswers.answers);
1827
+ return [2 /*return*/];
1828
+ }
1766
1829
  });
1767
1830
  });
1768
1831
  };
1769
1832
  Builder.prototype.selectAnswer = function (answer) {
1770
- this._configuratorService.selectAnswer(answer, false);
1833
+ return __awaiter(this, void 0, void 0, function () {
1834
+ var _a, _b;
1835
+ return __generator(this, function (_c) {
1836
+ switch (_c.label) {
1837
+ case 0: return [4 /*yield*/, this._configuratorService.selectAnswer(answer, false)];
1838
+ case 1:
1839
+ _c.sent();
1840
+ _b = (_a = this.modelLoaded).next;
1841
+ return [4 /*yield*/, this.buildModel()];
1842
+ case 2:
1843
+ _b.apply(_a, [_c.sent()]);
1844
+ return [2 /*return*/];
1845
+ }
1846
+ });
1847
+ });
1848
+ };
1849
+ Builder.prototype._setInstanceId = function (sku, instanceId, goodId) {
1850
+ return __awaiter(this, void 0, void 0, function () {
1851
+ var result;
1852
+ return __generator(this, function (_a) {
1853
+ switch (_a.label) {
1854
+ case 0:
1855
+ if (!(!instanceId && !this._instanceId)) return [3 /*break*/, 4];
1856
+ if (!!goodId) return [3 /*break*/, 2];
1857
+ return [4 /*yield*/, this._getGoodIdFromSku(sku)];
1858
+ case 1:
1859
+ goodId = _a.sent();
1860
+ _a.label = 2;
1861
+ case 2:
1862
+ this._goodId = goodId;
1863
+ return [4 /*yield*/, this.initNodeInstance(this._goodId)];
1864
+ case 3:
1865
+ result = _a.sent();
1866
+ if (result && result.resultObject) {
1867
+ this._instanceId = result.resultObject;
1868
+ }
1869
+ else {
1870
+ throw 'Failed to initialize node instance';
1871
+ }
1872
+ return [3 /*break*/, 5];
1873
+ case 4:
1874
+ if (!this._instanceId) {
1875
+ this._instanceId = instanceId;
1876
+ }
1877
+ _a.label = 5;
1878
+ case 5:
1879
+ if (!this._sku) {
1880
+ this._sku = sku;
1881
+ }
1882
+ return [2 /*return*/];
1883
+ }
1884
+ });
1885
+ });
1771
1886
  };
1772
1887
  Builder.prototype._prepareConfiguration = function (sku, goodId) {
1773
1888
  return __awaiter(this, void 0, void 0, function () {
@@ -2052,19 +2167,21 @@
2052
2167
  });
2053
2168
  });
2054
2169
  };
2055
- Builder.prototype._getSelections = function (instanceId) {
2170
+ Builder.prototype._getSelections = function (instanceId, publicationCode) {
2056
2171
  return __awaiter(this, void 0, void 0, function () {
2057
2172
  var selectionResponse;
2058
2173
  return __generator(this, function (_a) {
2059
2174
  switch (_a.label) {
2060
2175
  case 0:
2061
- this._selections.length = 0;
2062
- return [4 /*yield*/, this._configuratorService.getSelections(false)];
2176
+ this._selections = [];
2177
+ return [4 /*yield*/, this._configuratorService.getSelections(false, publicationCode)];
2063
2178
  case 1:
2064
2179
  selectionResponse = _a.sent();
2065
2180
  if (selectionResponse.resultObjects && selectionResponse.resultObjects.length > 0) {
2066
2181
  this._selections = this._boFactory.makeBOArrayFromRawBackendDataArray(selection.Selection, selectionResponse.resultObjects);
2067
2182
  this._selections.forEach(function (s) { return s.instanceId = instanceId; });
2183
+ // const filtered: Selection[] = this._selections.filter(s => s.nodeType !== NodeType.Article && s.presentationLevel === 1);
2184
+ this.selectionsReceived.next(this._selections);
2068
2185
  }
2069
2186
  else {
2070
2187
  throw 'No selections found!';
@@ -2080,7 +2197,7 @@
2080
2197
  return __generator(this, function (_a) {
2081
2198
  switch (_a.label) {
2082
2199
  case 0:
2083
- this._decos.length = 0;
2200
+ this._decos = [];
2084
2201
  return [4 /*yield*/, this._configuratorService.getDecos(false)];
2085
2202
  case 1:
2086
2203
  decosResponse = _a.sent();
@@ -2165,7 +2282,9 @@
2165
2282
  this._prepareTheSelections();
2166
2283
  };
2167
2284
  Builder.ctorParameters = function () { return [
2168
- { type: ConfiguratorService }
2285
+ { type: three.Scene },
2286
+ { type: options.Options },
2287
+ { type: Boolean }
2169
2288
  ]; };
2170
2289
  Builder = __decorate([
2171
2290
  core.Injectable()
@@ -2190,8 +2309,8 @@
2190
2309
  AnswersComponent = __decorate([
2191
2310
  core.Component({
2192
2311
  selector: "answers",
2193
- template: "\n <ng-container>\n <div class=\"answers-container\" visibilityObserverMaster>\n <h2 class=\"answers-title\" [textContent]=\"selectionTitle\"></h2>\n <answer *ngFor=\"let answer of answers\"\n (click)=\"answerClick.emit(answer)\"\n [answer]=\"answer\"\n visibilityObserver\n #intersection=\"intersection\"\n [observerEnabled]=\"true\"\n [showing]=\"intersection.isIntersecting\"\n ></answer>\n </div>\n </ng-container>\n ",
2194
- styles: [":host{position:absolute;top:0;right:0;width:400px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}:host .answers-title{margin-left:10px;color:#1a1a1a}:host .answers-container{height:100vh;overflow-y:scroll}", ".selection{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.img-size{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.unloaded{background-color:#d3d3d3}.titles{margin-left:14px;-ms-grid-row-align:center;align-self:center}"]
2312
+ template: "\n <div class=\"ione-configurator\">\n <div class=\"rp-answers-slideout\">\n <h2 class=\"answers-title\" [textContent]=\"selectionTitle\"></h2>\n <div class=\"answers-container\" visibilityObserverMaster>\n <answer *ngFor=\"let answer of answers\"\n (click)=\"answerClick.emit(answer)\"\n [answer]=\"answer\"\n visibilityObserver\n #intersection=\"intersection\"\n [observerEnabled]=\"true\"\n [showing]=\"intersection.isIntersecting\"\n ></answer>\n </div>\n \n </div>\n </div>\n ",
2313
+ styles: [".ione-configurator .rp-answers-slideout{position:absolute;top:0;right:0;width:400px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.ione-configurator .answers-title{margin-left:10px;color:#1a1a1a}.ione-configurator .answers-container{height:100vh;overflow-y:scroll}.ione-configurator .answer-content{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.ione-configurator .thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .img-size{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-wrapper{display:block}.ione-configurator .answer-title{font-size:12px;position:relative;overflow:hidden;cursor:pointer}.ione-configurator .question{font-weight:700;color:#1a1a1a}.ione-configurator .answer{font-size:12px;font-style:italic;margin-top:3px}.ione-configurator .collapse-content,.ione-configurator .collapse-wrapper{display:block}.ione-configurator .collapse-handle{position:absolute;top:10px;right:12px;border:solid #000;border-width:0 3px 3px 0;display:inline-block;padding:3px;transform:rotate(45deg);-webkit-transform:rotate(45deg)}.ione-configurator .collapse-handle.expanded{transform:rotate(-135deg);-webkit-transform:rotate(-135deg)}.ione-configurator .child-selection{margin-left:10px;display:flex;flex-direction:column;margin-top:5px}.ione-configurator .mat-title{margin-left:10px;color:#1a1a1a}.ione-configurator .drawer__header{height:48px}.ione-configurator .rp-selections-summary{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;background:0 0;overflow:auto;position:absolute;top:0;right:0;width:400px}.ione-configurator .selections-content{overflow-y:auto}.ione-configurator .co-summary-line{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.ione-configurator .selection-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .selection-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .answer-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .unloaded{background-color:#d3d3d3}.ione-configurator .titles{margin-left:14px;-ms-grid-row-align:center;align-self:center}.ione-configurator .title-wrapper{display:flex;flex-direction:column}.ione-configurator .answer-title-wrapper{text-align:center;-ms-grid-row-align:center;align-self:center;margin-left:14px}"]
2195
2314
  })
2196
2315
  ], AnswersComponent);
2197
2316
  return AnswersComponent;
@@ -2233,6 +2352,8 @@
2233
2352
  var base64 = ImageCacheService_1._handleResponseData(includeMimeType, thumb, responseData);
2234
2353
  _this._imageCache.set(object.nodeId, base64);
2235
2354
  resolve(base64);
2355
+ }).catch(function () {
2356
+ reject();
2236
2357
  });
2237
2358
  }
2238
2359
  else {
@@ -2260,13 +2381,16 @@
2260
2381
  var AnswerComponent = /** @class */ (function () {
2261
2382
  function AnswerComponent(_imageCacheService) {
2262
2383
  this._imageCacheService = _imageCacheService;
2263
- this.thumbnailLoaded = false;
2264
2384
  }
2265
2385
  Object.defineProperty(AnswerComponent.prototype, "showing", {
2266
2386
  set: function (value) {
2267
- if (value) {
2387
+ this.answer.imageData = '';
2388
+ if (value && this.answer.answer !== 'Skip / Cancel') {
2268
2389
  this._loadThumbnail(this.answer);
2269
2390
  }
2391
+ else {
2392
+ this.answer.imageData = null;
2393
+ }
2270
2394
  },
2271
2395
  enumerable: true,
2272
2396
  configurable: true
@@ -2274,10 +2398,17 @@
2274
2398
  AnswerComponent.prototype.ngOnInit = function () {
2275
2399
  };
2276
2400
  AnswerComponent.prototype._loadThumbnail = function (answer) {
2277
- var _this = this;
2278
- this._imageCacheService.getImageForSelectionOrAnswer(answer).then(function (imageSrc) {
2279
- answer.imageData = imageSrc;
2280
- _this.thumbnailLoaded = true;
2401
+ return __awaiter(this, void 0, void 0, function () {
2402
+ return __generator(this, function (_a) {
2403
+ switch (_a.label) {
2404
+ case 0: return [4 /*yield*/, this._imageCacheService.getImageForSelectionOrAnswer(answer).then(function (imageSrc) {
2405
+ answer.imageData = imageSrc === "" ? null : imageSrc;
2406
+ })];
2407
+ case 1:
2408
+ _a.sent();
2409
+ return [2 /*return*/];
2410
+ }
2411
+ });
2281
2412
  });
2282
2413
  };
2283
2414
  AnswerComponent.ctorParameters = function () { return [
@@ -2292,7 +2423,7 @@
2292
2423
  AnswerComponent = __decorate([
2293
2424
  core.Component({
2294
2425
  selector: 'answer',
2295
- template: "\n <ng-container>\n <div class=\"selection\" @answerAppear>\n <div class=\"thumbnail\">\n <rp-loader *ngIf=\"!thumbnailLoaded\"></rp-loader>\n <img *ngIf=\"answer.imageData\" class=\"img-size\" [src]=\"answer.imageData\">\n </div>\n <div class=\"titles\">\n <div class=\"answer\" [textContent]=\"answer.commercialAnswer\"></div>\n </div>\n </div>\n </ng-container>\n ",
2426
+ template: "\n <div class=\"ione-configurator\">\n <div class=\"answer-wrapper\">\n <div class=\"answer-content\" @answerAppear>\n <div class=\"answer-thumbnail\">\n <rp-loader *ngIf=\"answer.imageData === ''\"></rp-loader>\n <img *ngIf=\"answer.imageData !== '' && answer.imageData !== null\" class=\"answer-img\" [src]=\"answer.imageData\">\n </div>\n <div class=\"answer-title-wrapper\">\n <span class=\"answer-title\" [textContent]=\"answer.commercialAnswer\"></span>\n </div>\n <div class=\"price\">\n <span class=\"price-value\"></span>\n </div>\n </div>\n </div>\n </div>\n ",
2296
2427
  animations: [
2297
2428
  animations.trigger('answerAppear', [
2298
2429
  animations.state('void', animations.style({ 'background': '#dbdbdb' })),
@@ -2300,7 +2431,7 @@
2300
2431
  animations.transition('void <=> *', animations.animate(500))
2301
2432
  ])
2302
2433
  ],
2303
- styles: [".answer{font-size:12px;position:relative;overflow:hidden;cursor:pointer}", ".selection{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.img-size{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.unloaded{background-color:#d3d3d3}.titles{margin-left:14px;-ms-grid-row-align:center;align-self:center}"]
2434
+ styles: [".ione-configurator .rp-answers-slideout{position:absolute;top:0;right:0;width:400px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.ione-configurator .answers-title{margin-left:10px;color:#1a1a1a}.ione-configurator .answers-container{height:100vh;overflow-y:scroll}.ione-configurator .answer-content{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.ione-configurator .thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .img-size{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-wrapper{display:block}.ione-configurator .answer-title{font-size:12px;position:relative;overflow:hidden;cursor:pointer}.ione-configurator .question{font-weight:700;color:#1a1a1a}.ione-configurator .answer{font-size:12px;font-style:italic;margin-top:3px}.ione-configurator .collapse-content,.ione-configurator .collapse-wrapper{display:block}.ione-configurator .collapse-handle{position:absolute;top:10px;right:12px;border:solid #000;border-width:0 3px 3px 0;display:inline-block;padding:3px;transform:rotate(45deg);-webkit-transform:rotate(45deg)}.ione-configurator .collapse-handle.expanded{transform:rotate(-135deg);-webkit-transform:rotate(-135deg)}.ione-configurator .child-selection{margin-left:10px;display:flex;flex-direction:column;margin-top:5px}.ione-configurator .mat-title{margin-left:10px;color:#1a1a1a}.ione-configurator .drawer__header{height:48px}.ione-configurator .rp-selections-summary{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;background:0 0;overflow:auto;position:absolute;top:0;right:0;width:400px}.ione-configurator .selections-content{overflow-y:auto}.ione-configurator .co-summary-line{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.ione-configurator .selection-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .selection-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .answer-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .unloaded{background-color:#d3d3d3}.ione-configurator .titles{margin-left:14px;-ms-grid-row-align:center;align-self:center}.ione-configurator .title-wrapper{display:flex;flex-direction:column}.ione-configurator .answer-title-wrapper{text-align:center;-ms-grid-row-align:center;align-self:center;margin-left:14px}"]
2304
2435
  })
2305
2436
  ], AnswerComponent);
2306
2437
  return AnswerComponent;
@@ -2519,7 +2650,7 @@
2519
2650
  return __generator(this, function (_a) {
2520
2651
  switch (_a.label) {
2521
2652
  case 0: return [4 /*yield*/, this._imageCacheService.getImageForSelectionOrAnswer(viewModel.selection).then(function (imageSrc) {
2522
- viewModel.thumbnail = imageSrc;
2653
+ viewModel.thumbnail = imageSrc === "" ? null : imageSrc;
2523
2654
  })];
2524
2655
  case 1:
2525
2656
  _a.sent();
@@ -2561,7 +2692,7 @@
2561
2692
  SelectionsComponent = __decorate([
2562
2693
  core.Component({
2563
2694
  selector: "selections",
2564
- template: "\n <ng-container>\n <div class=\"selections-container\">\n <h2 class=\"selections-title\">Configuratie</h2>\n <div *ngFor=\"let selectionViewModel of selectionViewModels\">\n <div class=\"selection\" (click)=\"selectSelection(selectionViewModel.selection, $event)\">\n <div class=\"thumbnail\">\n <rp-loader *ngIf=\"selectionViewModel.thumbnail === ''\"></rp-loader>\n <img visibilityObserver *ngIf=\"selectionViewModel.thumbnail !== ''\" class=\"img-size\" [src]=\"selectionViewModel.thumbnail\">\n </div>\n <div class=\"titles\">\n <div class=\"question\" [textContent]=\"selectionViewModel.selection.commercialQuestion\"></div>\n <div class=\"answer\" [textContent]=\"selectionViewModel.selection.answer\"></div>\n <div class=\"collapse-handle\" [class.expanded]=\"selectionViewModel.expanded\"\n *ngIf=\"selectionViewModel.children.length > 0\" (click)=\"expandClicked(selectionViewModel, $event)\"></div>\n <div *ngIf=\"selectionViewModel.children.length > 0 && selectionViewModel.expanded\" @showHideChildren>\n <div class=\"child-selection\" *ngFor=\"let selection of selectionViewModel.children\"\n (click)=\"selectSelection(selection, $event)\"\n >\n <div class=\"question\" [textContent]=\"selection.commercialQuestion\"></div>\n <div class=\"answer\" [textContent]=\"selection.answer\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n ",
2695
+ template: "\n <div class=\"ione-configurator\">\n <div class=\"rp-selections-summary\">\n <header class=\"drawer__header\">\n <h2 class=\"mat-title\" [textContent]=\"'Configuratie'\"></h2>\n <!--<button>-->\n <!---->\n <!--</button>-->\n </header>\n <div class=\"selections-content\">\n <ng-container *ngFor=\"let selectionViewModel of selectionViewModels\">\n\n <div class=\"co-summary-line\" (click)=\"selectSelection(selectionViewModel.selection, $event)\">\n <div class=\"selection-thumbnail\">\n <rp-loader *ngIf=\"selectionViewModel.thumbnail === ''\"></rp-loader>\n <img visibilityObserver *ngIf=\"selectionViewModel.thumbnail !== '' && selectionViewModel.thumbnail !== null\" class=\"selection-img\" [src]=\"selectionViewModel.thumbnail\">\n </div>\n <div class=\"titles\">\n <div class=\"title-wrapper\">\n <label class=\"question\" [textContent]=\"selectionViewModel.selection.question\"></label>\n <span class=\"answer\" [textContent]=\"selectionViewModel.selection.answer\"></span>\n <div *ngIf=\"selectionViewModel.children.length > 0 && selectionViewModel.expanded\" @showHideChildren>\n <div class=\"child-selection\" *ngFor=\"let selection of selectionViewModel.children\"\n (click)=\"selectSelection(selection, $event)\"\n >\n <label class=\"question\" [textContent]=\"selection.commercialQuestion\"></label>\n <span class=\"answer\" [textContent]=\"selection.answer\"></span>\n </div>\n </div>\n </div>\n </div>\n \n <div class=\"price-wrapper\">\n <span class=\"price-value\"></span>\n </div>\n\n <div class=\"collapse-wrapper\">\n <div class=\"collapse-content\">\n <div class=\"collapse-handle\" [class.expanded]=\"selectionViewModel.expanded\"\n *ngIf=\"selectionViewModel.children.length > 0\" (click)=\"expandClicked(selectionViewModel, $event)\"></div>\n </div>\n </div>\n </div>\n\n </ng-container>\n </div>\n </div>\n </div>\n ",
2565
2696
  animations: [
2566
2697
  animations.trigger('showHideChildren', [
2567
2698
  animations.state('void', animations.style({ 'height': '0' })),
@@ -2569,7 +2700,7 @@
2569
2700
  animations.transition('void <=> *', animations.animate(200))
2570
2701
  ])
2571
2702
  ],
2572
- styles: [":host{position:absolute;top:0;right:0;width:400px}:host .question{font-weight:700;color:#1a1a1a}:host .answer{font-size:12px;font-style:italic;margin-top:3px}:host .collapse-handle{position:absolute;top:10px;right:12px;border:solid #000;border-width:0 3px 3px 0;display:inline-block;padding:3px;transform:rotate(45deg);-webkit-transform:rotate(45deg)}:host .collapse-handle.expanded{transform:rotate(-135deg);-webkit-transform:rotate(-135deg)}:host .child-selection{margin-left:10px;margin-top:5px}:host .selections-title{margin-left:10px;color:#1a1a1a}:host .selections-container{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;background:0 0;overflow:auto}", ".selection{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.img-size{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.unloaded{background-color:#d3d3d3}.titles{margin-left:14px;-ms-grid-row-align:center;align-self:center}"]
2703
+ styles: [".ione-configurator .rp-answers-slideout{position:absolute;top:0;right:0;width:400px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.ione-configurator .answers-title{margin-left:10px;color:#1a1a1a}.ione-configurator .answers-container{height:100vh;overflow-y:scroll}.ione-configurator .answer-content{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.ione-configurator .thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .img-size{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-wrapper{display:block}.ione-configurator .answer-title{font-size:12px;position:relative;overflow:hidden;cursor:pointer}.ione-configurator .question{font-weight:700;color:#1a1a1a}.ione-configurator .answer{font-size:12px;font-style:italic;margin-top:3px}.ione-configurator .collapse-content,.ione-configurator .collapse-wrapper{display:block}.ione-configurator .collapse-handle{position:absolute;top:10px;right:12px;border:solid #000;border-width:0 3px 3px 0;display:inline-block;padding:3px;transform:rotate(45deg);-webkit-transform:rotate(45deg)}.ione-configurator .collapse-handle.expanded{transform:rotate(-135deg);-webkit-transform:rotate(-135deg)}.ione-configurator .child-selection{margin-left:10px;display:flex;flex-direction:column;margin-top:5px}.ione-configurator .mat-title{margin-left:10px;color:#1a1a1a}.ione-configurator .drawer__header{height:48px}.ione-configurator .rp-selections-summary{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;background:0 0;overflow:auto;position:absolute;top:0;right:0;width:400px}.ione-configurator .selections-content{overflow-y:auto}.ione-configurator .co-summary-line{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.ione-configurator .selection-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .selection-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .answer-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .unloaded{background-color:#d3d3d3}.ione-configurator .titles{margin-left:14px;-ms-grid-row-align:center;align-self:center}.ione-configurator .title-wrapper{display:flex;flex-direction:column}.ione-configurator .answer-title-wrapper{text-align:center;-ms-grid-row-align:center;align-self:center;margin-left:14px}"]
2573
2704
  })
2574
2705
  ], SelectionsComponent);
2575
2706
  return SelectionsComponent;
@@ -2598,15 +2729,15 @@
2598
2729
  exports.AnswersComponent = AnswersComponent;
2599
2730
  exports.AnswersModule = AnswersModule;
2600
2731
  exports.Builder = Builder;
2732
+ exports.ConfiguratorService = ConfiguratorService;
2601
2733
  exports.SelectionsComponent = SelectionsComponent;
2602
2734
  exports.SelectionsModule = SelectionsModule;
2603
- exports.ɵa = ConfiguratorService;
2604
- exports.ɵb = SharedModule;
2605
- exports.ɵc = LoaderComponent;
2606
- exports.ɵd = AnswerComponent;
2607
- exports.ɵe = ImageCacheService;
2608
- exports.ɵf = VisibilityObserverDirective;
2609
- exports.ɵg = VisibilityObserverMasterDirective;
2735
+ exports.ɵa = SharedModule;
2736
+ exports.ɵb = LoaderComponent;
2737
+ exports.ɵc = AnswerComponent;
2738
+ exports.ɵd = ImageCacheService;
2739
+ exports.ɵe = VisibilityObserverDirective;
2740
+ exports.ɵf = VisibilityObserverMasterDirective;
2610
2741
 
2611
2742
  Object.defineProperty(exports, '__esModule', { value: true });
2612
2743