@colijnit/product 258.1.4 → 258.1.6

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,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/common/http'), require('@colijnit/ioneconnector/build/utils/string-utils'), require('@colijnit/ioneconnector/build/model/options'), require('@colijnit/articleapi/build/model/article-full-object'), require('@colijnit/articleapi/build/model/super-article'), require('@colijnit/articleapi/build/articles'), require('@colijnit/articleapi/build/model/delivery-prognosis'), require('@colijnit/articleapi/build/model/document-content'), require('@colijnit/ioneconnector/build/service/business-object-factory'), require('@colijnit/transactionapi/build/transaction'), require('@colijnit/mainapi'), require('@colijnit/transactionapi/build/model/transaction-info-response.bo'), require('@colijnit/articleapi/build/model/article-list-object-extended.bo'), require('@angular/common'), require('@angular/animations'), require('@angular/platform-browser'), require('@colijnit/corecomponents'), require('@colijnit/mainapi/build/model/co-document'), require('@colijnit/articleapi/build/model/configurator-statistics-environment'), require('@colijnit/corecomponents_v12')) :
3
- typeof define === 'function' && define.amd ? define('@colijnit/product', ['exports', '@angular/core', 'rxjs', '@angular/common/http', '@colijnit/ioneconnector/build/utils/string-utils', '@colijnit/ioneconnector/build/model/options', '@colijnit/articleapi/build/model/article-full-object', '@colijnit/articleapi/build/model/super-article', '@colijnit/articleapi/build/articles', '@colijnit/articleapi/build/model/delivery-prognosis', '@colijnit/articleapi/build/model/document-content', '@colijnit/ioneconnector/build/service/business-object-factory', '@colijnit/transactionapi/build/transaction', '@colijnit/mainapi', '@colijnit/transactionapi/build/model/transaction-info-response.bo', '@colijnit/articleapi/build/model/article-list-object-extended.bo', '@angular/common', '@angular/animations', '@angular/platform-browser', '@colijnit/corecomponents', '@colijnit/mainapi/build/model/co-document', '@colijnit/articleapi/build/model/configurator-statistics-environment', '@colijnit/corecomponents_v12'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.colijnit = global.colijnit || {}, global.colijnit.product = {}), global.ng.core, global.rxjs, global.ng.common.http, global.stringUtils, global.options, global.articleFullObject, global.superArticle, global.articles, global.deliveryPrognosis, global.documentContent, global.businessObjectFactory, global.transaction, global.mainapi, global.transactionInfoResponse_bo, global.articleListObjectExtended_bo, global.ng.common, global.ng.animations, global.ng.platformBrowser, global.corecomponents, global.coDocument, global.configuratorStatisticsEnvironment, global.corecomponents_v12));
5
- })(this, (function (exports, i0, rxjs, i1, stringUtils, options, articleFullObject, superArticle, articles, deliveryPrognosis, documentContent, businessObjectFactory, transaction, mainapi, transactionInfoResponse_bo, articleListObjectExtended_bo, common, animations, i1$1, corecomponents, coDocument, configuratorStatisticsEnvironment, corecomponents_v12) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@colijnit/ioneconnector/build/model/options'), require('@colijnit/articleapi/build/model/article-full-object'), require('@colijnit/articleapi/build/model/super-article'), require('@colijnit/articleapi/build/articles'), require('@colijnit/articleapi/build/model/delivery-prognosis'), require('@colijnit/articleapi/build/model/document-content'), require('@colijnit/ioneconnector/build/service/business-object-factory'), require('@colijnit/transactionapi/build/transaction'), require('@colijnit/mainapi'), require('@colijnit/transactionapi/build/model/transaction-info-response.bo'), require('@colijnit/articleapi/build/model/article-list-object-extended.bo'), require('@angular/common/http'), require('@colijnit/ioneconnector/build/utils/string-utils'), require('@angular/common'), require('@angular/animations'), require('@angular/platform-browser'), require('@colijnit/corecomponents'), require('@colijnit/mainapi/build/model/co-document'), require('@colijnit/articleapi/build/model/configurator-statistics-environment'), require('@colijnit/corecomponents_v12')) :
3
+ typeof define === 'function' && define.amd ? define('@colijnit/product', ['exports', '@angular/core', 'rxjs', '@colijnit/ioneconnector/build/model/options', '@colijnit/articleapi/build/model/article-full-object', '@colijnit/articleapi/build/model/super-article', '@colijnit/articleapi/build/articles', '@colijnit/articleapi/build/model/delivery-prognosis', '@colijnit/articleapi/build/model/document-content', '@colijnit/ioneconnector/build/service/business-object-factory', '@colijnit/transactionapi/build/transaction', '@colijnit/mainapi', '@colijnit/transactionapi/build/model/transaction-info-response.bo', '@colijnit/articleapi/build/model/article-list-object-extended.bo', '@angular/common/http', '@colijnit/ioneconnector/build/utils/string-utils', '@angular/common', '@angular/animations', '@angular/platform-browser', '@colijnit/corecomponents', '@colijnit/mainapi/build/model/co-document', '@colijnit/articleapi/build/model/configurator-statistics-environment', '@colijnit/corecomponents_v12'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.colijnit = global.colijnit || {}, global.colijnit.product = {}), global.ng.core, global.rxjs, global.options, global.articleFullObject, global.superArticle, global.articles, global.deliveryPrognosis, global.documentContent, global.businessObjectFactory, global.transaction, global.mainapi, global.transactionInfoResponse_bo, global.articleListObjectExtended_bo, global.ng.common.http, global.stringUtils, global.ng.common, global.ng.animations, global.ng.platformBrowser, global.corecomponents, global.coDocument, global.configuratorStatisticsEnvironment, global.corecomponents_v12));
5
+ })(this, (function (exports, i0, rxjs, options, articleFullObject, superArticle, articles, deliveryPrognosis, documentContent, businessObjectFactory, transaction, mainapi, transactionInfoResponse_bo, articleListObjectExtended_bo, i1, stringUtils, common, animations, i1$1, corecomponents, coDocument, configuratorStatisticsEnvironment, corecomponents_v12) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -31,8 +31,8 @@
31
31
  function Version() {
32
32
  this.name = "@colijnit/product";
33
33
  this.description = "Product detail page project for iOne";
34
- this.symVer = "258.1.4";
35
- this.publishDate = "23-6-2025 16:38:29";
34
+ this.symVer = "258.1.6";
35
+ this.publishDate = "22-8-2025 14:23:38";
36
36
  }
37
37
  return Version;
38
38
  }());
@@ -514,6 +514,51 @@
514
514
  __disposeResources: __disposeResources,
515
515
  };
516
516
 
517
+ var SettingsOptions = /** @class */ (function () {
518
+ function SettingsOptions() {
519
+ this.showStockStatus = false;
520
+ this.showZoomButton = false;
521
+ this.showTagFilter = false;
522
+ this.showAsConfigured = false;
523
+ this.inlineAnswers = false;
524
+ this.showArButton = false;
525
+ this.arEnabled = false;
526
+ this.vrEnabled = false;
527
+ }
528
+ return SettingsOptions;
529
+ }());
530
+
531
+ var RenderModes;
532
+ (function (RenderModes) {
533
+ RenderModes["RenderRoom"] = "render_room";
534
+ RenderModes["RenderShop"] = "render_shop";
535
+ RenderModes["RenderIone"] = "render_ione";
536
+ })(RenderModes || (RenderModes = {}));
537
+
538
+ var RenderParameters$1 = /** @class */ (function () {
539
+ function RenderParameters() {
540
+ this.host = "";
541
+ this.port = 0;
542
+ this.secure = false;
543
+ this.renderMode = RenderModes.RenderShop;
544
+ }
545
+ return RenderParameters;
546
+ }());
547
+
548
+ var ProductSettings = /** @class */ (function (_super) {
549
+ __extends(ProductSettings, _super);
550
+ function ProductSettings() {
551
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
552
+ _this.session = undefined;
553
+ _this.createWebOrder = true;
554
+ _this.currencySymbol = '€';
555
+ _this.options = new SettingsOptions();
556
+ _this.renderParameters = new RenderParameters$1();
557
+ return _this;
558
+ }
559
+ return ProductSettings;
560
+ }(options.Options));
561
+
517
562
  var ProductEventService = /** @class */ (function () {
518
563
  function ProductEventService() {
519
564
  this.onAddToCart = new rxjs.Subject();
@@ -540,474 +585,192 @@
540
585
  { type: i0.Injectable }
541
586
  ];
542
587
 
543
- var JsonUtilsService = /** @class */ (function () {
544
- function JsonUtilsService() {
588
+ // Sole responsibility is simply to wrap around a colijn.Connector to create a stable inner interface to the library in a 1:1 method way.
589
+ // Only to be used by the IOneControllerService.
590
+ var ProductConnectorAdapterService = /** @class */ (function () {
591
+ function ProductConnectorAdapterService(_eventService) {
592
+ this._eventService = _eventService;
593
+ this.showLoader = new rxjs.Subject();
594
+ this._boFactory = new businessObjectFactory.BusinessObjectFactory();
595
+ this._subs = [];
545
596
  }
546
- JsonUtilsService.prototype.readJsonFile = function (filePath) {
597
+ ProductConnectorAdapterService.prototype.ngOnDestroy = function () {
598
+ this._subs.forEach(function (s) { return s.unsubscribe(); });
599
+ };
600
+ ProductConnectorAdapterService.prototype.initConnector = function (options) {
547
601
  return __awaiter(this, void 0, void 0, function () {
548
- var response, e_1;
602
+ var _this = this;
549
603
  return __generator(this, function (_a) {
550
604
  switch (_a.label) {
551
605
  case 0:
552
- _a.trys.push([0, 2, , 3]);
553
- return [4 /*yield*/, fetch(filePath)];
606
+ this.articleConnector = new articles.Articles(options);
607
+ return [4 /*yield*/, this.articleConnector.connect()];
608
+ case 1:
609
+ _a.sent();
610
+ this.transactionConnector = new transaction.Transaction(options);
611
+ this._subs.push(
612
+ // @ts-ignore
613
+ this.articleConnector.showLoader.subscribe(function (value) { return _this.showLoader.next(value); }));
614
+ return [2 /*return*/];
615
+ }
616
+ });
617
+ });
618
+ };
619
+ ProductConnectorAdapterService.prototype.setInstance = function (instanceId) {
620
+ // this.articleConnector.setInstanceToConfigure(instanceId, false);
621
+ };
622
+ ProductConnectorAdapterService.prototype.getProductBundleSettings = function (url, upId) {
623
+ return __awaiter(this, void 0, void 0, function () {
624
+ var tempSettings, tempMainConnector, response;
625
+ return __generator(this, function (_a) {
626
+ switch (_a.label) {
627
+ case 0:
628
+ tempSettings = new ProductSettings();
629
+ tempSettings.url = url;
630
+ tempSettings.schema = upId.toString();
631
+ tempMainConnector = new mainapi.MainApi(tempSettings);
632
+ return [4 /*yield*/, tempMainConnector.getPublicParams(upId)];
554
633
  case 1:
555
634
  response = _a.sent();
556
- if (!response.ok) {
635
+ if (response) {
636
+ return [2 /*return*/, response.productSettings];
637
+ }
638
+ return [2 /*return*/, ""];
639
+ }
640
+ });
641
+ });
642
+ };
643
+ ProductConnectorAdapterService.prototype.convertArticleFullObjectToArticleExtended = function (article) {
644
+ if (article) {
645
+ return this._boFactory.makeWithRawBackendData(articleListObjectExtended_bo.ArticleListObjectExtended, article);
646
+ }
647
+ };
648
+ ProductConnectorAdapterService.prototype.getDeliveryPrognosis = function (goodId, branchNr) {
649
+ return __awaiter(this, void 0, void 0, function () {
650
+ var deliveryPrognosis;
651
+ return __generator(this, function (_a) {
652
+ switch (_a.label) {
653
+ case 0: return [4 /*yield*/, this.getSelectorDeliveryDate()];
654
+ case 1:
655
+ deliveryPrognosis = _a.sent();
656
+ if (!deliveryPrognosis || !deliveryPrognosis.returnValue) {
657
+ return [2 /*return*/, this.getDeliveryDate2(goodId)];
658
+ }
659
+ return [2 /*return*/, deliveryPrognosis];
660
+ }
661
+ });
662
+ });
663
+ };
664
+ ProductConnectorAdapterService.prototype.getSelectorDeliveryDate = function () {
665
+ return __awaiter(this, void 0, void 0, function () {
666
+ var response;
667
+ return __generator(this, function (_a) {
668
+ switch (_a.label) {
669
+ case 0: return [4 /*yield*/, this.articleConnector.getSelectorDeliveryDate()];
670
+ case 1:
671
+ response = _a.sent();
672
+ if (response && response.validationResult && response.validationResult.success) {
673
+ return [2 /*return*/, this._boFactory.makeWithRawBackendData(deliveryPrognosis.DeliveryPrognosis, response.resultObject)];
674
+ }
675
+ else {
557
676
  return [2 /*return*/, null];
558
677
  }
678
+ return [2 /*return*/];
679
+ }
680
+ });
681
+ });
682
+ };
683
+ ProductConnectorAdapterService.prototype.getArtStockStatus = function (goodId) {
684
+ return __awaiter(this, void 0, void 0, function () {
685
+ var response;
686
+ return __generator(this, function (_a) {
687
+ switch (_a.label) {
688
+ case 0: return [4 /*yield*/, this.articleConnector.getArtStockStatus(goodId)];
689
+ case 1:
690
+ response = _a.sent();
691
+ if (response && response.validationResult && response.validationResult.success) {
692
+ return [2 /*return*/, response.resultObject];
693
+ }
559
694
  else {
560
- return [2 /*return*/, response.json()];
695
+ return [2 /*return*/, null];
561
696
  }
562
- return [3 /*break*/, 3];
563
- case 2:
564
- e_1 = _a.sent();
565
- console.error('Error getting file:', e_1.message);
566
- return [2 /*return*/, ''];
567
- case 3: return [2 /*return*/];
697
+ return [2 /*return*/];
568
698
  }
569
699
  });
570
700
  });
571
701
  };
572
- return JsonUtilsService;
573
- }());
574
- JsonUtilsService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function JsonUtilsService_Factory() { return new JsonUtilsService(); }, token: JsonUtilsService, providedIn: "root" });
575
- JsonUtilsService.decorators = [
576
- { type: i0.Injectable, args: [{
577
- providedIn: 'root'
578
- },] }
579
- ];
580
-
581
- var LanguageCode;
582
- (function (LanguageCode) {
583
- LanguageCode["Dutch"] = "nl-NL";
584
- LanguageCode["English"] = "en-GB";
585
- LanguageCode["German"] = "de-DE";
586
- LanguageCode["French"] = "fr-FR";
587
- })(LanguageCode || (LanguageCode = {}));
588
-
589
- var Dictionary = /** @class */ (function () {
590
- function Dictionary() {
591
- this.strings = {
592
- "en": {
593
- "ADDITIONAL_DATA": "Additional information",
594
- "ALTERNATIVE_PRODUCTS": "Alternative products",
595
- "ARTICLE_NUMBER": "Productnumber",
596
- "AS_CONFIGURED": "As configured",
597
- "CATEGORY": "Category",
598
- "CATEGORY_TYPE": "Category type",
599
- "CONFIGURE": "Configure",
600
- "DELIVERY_TIME_PERIOD": "Delivery time",
601
- "DESCRIPTION": "Description",
602
- "DOCUMENTS": "Documents",
603
- "DOWNLOADS": "Downloads",
604
- "FEATURES": "Features",
605
- "HEIGHT": "Height",
606
- "MATERIAL": "Material",
607
- "PRODUCT_IN_STOCK": "In stock",
608
- "PRODUCT_LIMITED_STOCK": "Limited stock",
609
- "PRODUCT_NOT_IN_STOCK": "Not in stock",
610
- "PROPERTIES": "Characteristics",
611
- "QUOTATION": "Quotation",
612
- "READ_MORE": "Read more",
613
- "RELATED_PRODUCTS": "Related products",
614
- "SHOPPING_CART_IN": "In Shopping Cart",
615
- "SHOW_IN": "Show in",
616
- "STOCK": "Stock",
617
- "SYMBOLS": "Symbols",
618
- "TITLE": "Title",
619
- "TURNOVERGROUP": "Turnover group",
620
- "VARIANTS": "Variations",
621
- "WIDTH": "Width",
622
- "SUGGESTION": "Suggestion",
623
- },
624
- "nl": {
625
- "ADDITIONAL_DATA": "Extra informatie",
626
- "ALTERNATIVE_PRODUCTS": "Alternatieve producten",
627
- "ARTICLE_NUMBER": "Artikel nummer",
628
- "AS_CONFIGURED": "Zoals samengesteld",
629
- "CATEGORY": "Categorie",
630
- "CATEGORY_TYPE": "Categorie type",
631
- "CONFIGURE": "Configureren",
632
- "DELIVERY_TIME_PERIOD": "Levertijd",
633
- "DESCRIPTION": "Omschrijving",
634
- "DOCUMENTS": "Documenten",
635
- "DOWNLOADS": "Downloads",
636
- "FEATURES": "Kenmerken",
637
- "HEIGHT": "Hoogte",
638
- "MATERIAL": "Materiaal",
639
- "PRODUCT_IN_STOCK": "Op voorraad",
640
- "PRODUCT_LIMITED_STOCK": "Beperkt op voorraad",
641
- "PRODUCT_NOT_IN_STOCK": "Niet op voorraad",
642
- "PROPERTIES": "Eigenschappen",
643
- "QUOTATION": "Quotatie",
644
- "READ_MORE": "Lees meer",
645
- "RELATED_PRODUCTS": "Gerelateerde producten",
646
- "SHOPPING_CART_IN": "In winkelwagen",
647
- "SHOW_IN": "Laat zien",
648
- "STOCK": "Voorraad",
649
- "SYMBOLS": "Symbolen",
650
- "TITLE": "Titel",
651
- "TURNOVERGROUP": "Omzetgroep",
652
- "VARIANTS": "Varianten",
653
- "WIDTH": "Breedte",
654
- "SUGGESTION": "Suggesties bij",
655
- },
656
- "de": {
657
- "ADDITIONAL_DATA": "Extra informatie",
658
- "ALTERNATIVE_PRODUCTS": "Alternative Produkte",
659
- "ARTICLE_NUMBER": "Artikelnummer",
660
- "CATEGORY": "Kategorie",
661
- "CATEGORY_TYPE": "Kategorietype",
662
- "CONFIGURE": "Konfigurieren",
663
- "DELIVERY_TIME_PERIOD": "Lieferzeit",
664
- "DESCRIPTION": "Beschreibung",
665
- "DOCUMENTS": "Dateien",
666
- "DOWNLOADS": "Downloads",
667
- "FEATURES": "Eigenschaften",
668
- "HEIGHT": "Höhe",
669
- "MATERIAL": "Material",
670
- "PRODUCT_IN_STOCK": "Auf lager",
671
- "PRODUCT_LIMITED_STOCK": "Begrentzt auf lager",
672
- "PRODUCT_NOT_IN_STOCK": "Nicht auf lager",
673
- "PROPERTIES": "Eigenschaften",
674
- "QUOTATION": "Angebot",
675
- "READ_MORE": "Lesen Sie mehr",
676
- "RELATED_PRODUCTS": "Verwandte Produkte",
677
- "SHOPPING_CART_IN": "Im Einkaufswagen",
678
- "SHOW_IN": "Zeigen",
679
- "STOCK": "Vorrat",
680
- "SYMBOLS": "Symbole",
681
- "TITLE": "Titulatur",
682
- "TURNOVERGROUP": "Umsatzgruppe",
683
- "VARIANTS": "Varianten",
684
- "WIDTH": "Breite",
685
- "SUGGESTION": "Suggesties bij",
686
- }
687
- };
688
- }
689
- return Dictionary;
690
- }());
691
-
692
- // The localization service, providing peers with text translation functionality.
693
- var DictionaryService = /** @class */ (function () {
694
- function DictionaryService(_http, _jsonUtils) {
695
- this._http = _http;
696
- this._jsonUtils = _jsonUtils;
697
- this.dictionaryUrl = 'js/browser/res/dictionary/';
698
- // private _dictionaryPromise: Map<LanguageCode, Promise<{ [key: string]: string }>> = new Map<LanguageCode, Promise<{ [key: string]: string }>>();
699
- this._dictionaries = new Map();
700
- // Some dictionary values have one or more '|~' texts in them, meant to be replaced with client-side given texts.
701
- this._placeholder = '|~';
702
- }
703
- Object.defineProperty(DictionaryService.prototype, "language", {
704
- get: function () {
705
- return this._language;
706
- },
707
- enumerable: false,
708
- configurable: true
709
- });
710
- Object.defineProperty(DictionaryService.prototype, "rootUrl", {
711
- set: function (value) {
712
- this._rootUrl = value;
713
- this._dictBasePath = this._rootUrl + '/' + this.dictionaryUrl;
714
- },
715
- enumerable: false,
716
- configurable: true
717
- });
718
- // Loads the dictionary for given language in memory.
719
- DictionaryService.prototype.setDictionary = function (language) {
720
- return __awaiter(this, void 0, void 0, function () {
721
- var dictionary;
722
- return __generator(this, function (_a) {
723
- this._language = language || LanguageCode.Dutch;
724
- if (!this._dictionaries.has(this._language)) {
725
- dictionary = new Dictionary();
726
- if (dictionary.strings[this._language.substr(0, 2).toLowerCase()] !== undefined) {
727
- this._dictionaries.set(this._language, dictionary.strings[this._language.substr(0, 2).toLowerCase()]);
728
- }
729
- }
730
- return [2 /*return*/];
731
- });
732
- });
733
- };
734
- /**
735
- * Returns the localized text for the given dictionary key.
736
- * @param {string} key
737
- * @param {boolean} [upperCaseFirst = true] False for first letter lowercase, true for first letter uppercase for returned dict val
738
- * @param {string[]} replacementTexts Rest params for replacement of '|~' in returned dict value
739
- * @returns {string} The translated text for given dictionary key
740
- */
741
- DictionaryService.prototype.get = function (key, upperCaseFirst) {
742
- if (upperCaseFirst === void 0) { upperCaseFirst = true; }
743
- var replacementTexts = [];
744
- for (var _i = 2; _i < arguments.length; _i++) {
745
- replacementTexts[_i - 2] = arguments[_i];
746
- }
747
- if (!stringUtils.StringUtils.IsStringWithLength(key)) {
748
- return key || '';
749
- }
750
- var text = this._dictionaries.get(this.language)[key];
751
- text = stringUtils.StringUtils.IsStringWithLength(text) ? text : key;
752
- if (upperCaseFirst) {
753
- text = text.charAt(0).toUpperCase() + text.slice(1);
754
- }
755
- else {
756
- text = text.charAt(0).toLowerCase() + text.slice(1);
757
- }
758
- if (replacementTexts.length > 0) {
759
- text = stringUtils.StringUtils.ReplaceOccurrencesIn.apply(stringUtils.StringUtils, __spreadArray([text, this._placeholder], __read(replacementTexts)));
760
- }
761
- return text;
762
- };
763
- return DictionaryService;
764
- }());
765
- DictionaryService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function DictionaryService_Factory() { return new DictionaryService(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(JsonUtilsService)); }, token: DictionaryService, providedIn: "root" });
766
- DictionaryService.decorators = [
767
- { type: i0.Injectable, args: [{
768
- providedIn: 'root'
769
- },] }
770
- ];
771
- DictionaryService.ctorParameters = function () { return [
772
- { type: i1.HttpClient },
773
- { type: JsonUtilsService }
774
- ]; };
775
-
776
- var SettingsOptions = /** @class */ (function () {
777
- function SettingsOptions() {
778
- this.showStockStatus = false;
779
- this.showZoomButton = false;
780
- this.showTagFilter = false;
781
- this.showAsConfigured = false;
782
- this.inlineAnswers = false;
783
- this.showArButton = false;
784
- this.arEnabled = false;
785
- this.vrEnabled = false;
786
- }
787
- return SettingsOptions;
788
- }());
789
-
790
- var RenderModes;
791
- (function (RenderModes) {
792
- RenderModes["RenderRoom"] = "render_room";
793
- RenderModes["RenderShop"] = "render_shop";
794
- RenderModes["RenderIone"] = "render_ione";
795
- })(RenderModes || (RenderModes = {}));
796
-
797
- var RenderParameters$1 = /** @class */ (function () {
798
- function RenderParameters() {
799
- this.host = "";
800
- this.port = 0;
801
- this.secure = false;
802
- this.renderMode = RenderModes.RenderShop;
803
- }
804
- return RenderParameters;
805
- }());
806
-
807
- var ProductSettings = /** @class */ (function (_super) {
808
- __extends(ProductSettings, _super);
809
- function ProductSettings() {
810
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
811
- _this.session = undefined;
812
- _this.createWebOrder = true;
813
- _this.currencySymbol = '€';
814
- _this.options = new SettingsOptions();
815
- _this.renderParameters = new RenderParameters$1();
816
- return _this;
817
- }
818
- return ProductSettings;
819
- }(options.Options));
820
-
821
- var ProductSettingsService = /** @class */ (function () {
822
- function ProductSettingsService(_jsonUtilsService, _dictionaryService) {
823
- this._jsonUtilsService = _jsonUtilsService;
824
- this._dictionaryService = _dictionaryService;
825
- this.settingsLoaded = new rxjs.BehaviorSubject(false);
826
- }
827
- Object.defineProperty(ProductSettingsService.prototype, "settings", {
828
- get: function () {
829
- return this._settings;
830
- },
831
- set: function (value) {
832
- this._settings = value;
833
- },
834
- enumerable: false,
835
- configurable: true
836
- });
837
- ProductSettingsService.prototype.initializeSettings = function (finish) {
838
- if (finish === void 0) { finish = true; }
702
+ ProductConnectorAdapterService.prototype.getDeliveryDate2 = function (goodId) {
839
703
  return __awaiter(this, void 0, void 0, function () {
840
- var jsonSettings;
704
+ var response;
841
705
  return __generator(this, function (_a) {
842
706
  switch (_a.label) {
843
- case 0:
844
- if (!(typeof settings === 'undefined')) return [3 /*break*/, 2];
845
- return [4 /*yield*/, this._jsonUtilsService.readJsonFile('product-settings.json')];
707
+ case 0: return [4 /*yield*/, this.articleConnector.getDeliveryDate2(goodId)];
846
708
  case 1:
847
- jsonSettings = _a.sent();
848
- if (jsonSettings) {
849
- this.settings = Object.assign(new ProductSettings(), jsonSettings);
850
- this.settings.options = Object.assign(new SettingsOptions(), this.settings.options);
851
- if (finish) {
852
- this.settingsFinished();
853
- }
709
+ response = _a.sent();
710
+ if (response && response.validationResult && response.validationResult.success) {
711
+ return [2 /*return*/, this._boFactory.makeWithRawBackendData(deliveryPrognosis.DeliveryPrognosis, response.resultObject)];
854
712
  }
855
- return [3 /*break*/, 3];
856
- case 2:
857
- this.settings = Object.assign(new ProductSettings(), settings);
858
- this.settings.options = Object.assign(new SettingsOptions(), this.settings.options);
859
- if (finish) {
860
- this.settingsFinished();
713
+ else {
714
+ return [2 /*return*/, null];
861
715
  }
862
- _a.label = 3;
863
- case 3: return [2 /*return*/];
864
- }
865
- });
866
- });
867
- };
868
- ProductSettingsService.prototype.createSettingsFromObject = function (obj) {
869
- return __awaiter(this, void 0, void 0, function () {
870
- var ownOptions, ownRenderParameters;
871
- return __generator(this, function (_a) {
872
- if (!this.settings) {
873
- this.settings = new ProductSettings();
874
- }
875
- ownOptions = Object.assign({}, this.settings.options);
876
- ownRenderParameters = Object.assign({}, this.settings.renderParameters);
877
- this.settings = Object.assign({}, this.settings, obj);
878
- if (obj.renderParameters) {
879
- this.settings.renderParameters = Object.assign({}, ownRenderParameters, obj.renderParameters);
880
- }
881
- if (obj.options) {
882
- this.settings.options = Object.assign({}, ownOptions, obj.options);
883
- }
884
- if (obj.hasOwnProperty('assetPath')) {
885
- this.settings.assetPath = obj['assetPath'];
886
- if (this.settings.assetPath[this.settings.assetPath.length - 1] !== '/') {
887
- this.settings.assetPath += '/';
888
- }
889
- this.settings.threeDAssetPath = this.settings.assetPath;
890
- }
891
- if (obj.hasOwnProperty('threeDAssetPath')) {
892
- this.settings.threeDAssetPath = obj['threeDAssetPath'];
893
- if (this.settings.threeDAssetPath[this.settings.threeDAssetPath.length - 1] !== '/') {
894
- this.settings.threeDAssetPath += '/';
895
- }
896
- }
897
- this.settingsFinished();
898
- return [2 /*return*/];
899
- });
900
- });
901
- };
902
- ProductSettingsService.prototype.settingsFinished = function () {
903
- return __awaiter(this, void 0, void 0, function () {
904
- return __generator(this, function (_a) {
905
- switch (_a.label) {
906
- case 0: return [4 /*yield*/, this._dictionaryService.setDictionary(this.settings.languageCode)];
907
- case 1:
908
- _a.sent();
909
- this.settingsLoaded.next(true);
910
716
  return [2 /*return*/];
911
717
  }
912
718
  });
913
719
  });
914
720
  };
915
- return ProductSettingsService;
916
- }());
917
- ProductSettingsService.decorators = [
918
- { type: i0.Injectable }
919
- ];
920
- ProductSettingsService.ctorParameters = function () { return [
921
- { type: JsonUtilsService },
922
- { type: DictionaryService }
923
- ]; };
924
-
925
- // Sole responsibility is simply to wrap around a colijn.Connector to create a stable inner interface to the library in a 1:1 method way.
926
- // Only to be used by the IOneControllerService.
927
- var ProductConnectorAdapterService = /** @class */ (function () {
928
- function ProductConnectorAdapterService(_eventService) {
929
- this._eventService = _eventService;
930
- this.showLoader = new rxjs.Subject();
931
- this._boFactory = new businessObjectFactory.BusinessObjectFactory();
932
- this._subs = [];
933
- }
934
- ProductConnectorAdapterService.prototype.ngOnDestroy = function () {
935
- this._subs.forEach(function (s) { return s.unsubscribe(); });
936
- };
937
- ProductConnectorAdapterService.prototype.initConnector = function (options) {
721
+ ProductConnectorAdapterService.prototype.getJsonConfiguredArticles = function (configuratorStatistics) {
938
722
  return __awaiter(this, void 0, void 0, function () {
939
- var _this = this;
723
+ var response;
940
724
  return __generator(this, function (_a) {
941
725
  switch (_a.label) {
942
- case 0:
943
- this.articleConnector = new articles.Articles(options);
944
- return [4 /*yield*/, this.articleConnector.connect()];
726
+ case 0: return [4 /*yield*/, this.articleConnector.getJsonConfiguredArticles(configuratorStatistics)];
945
727
  case 1:
946
- _a.sent();
947
- this.transactionConnector = new transaction.Transaction(options);
948
- this._subs.push(
949
- // @ts-ignore
950
- this.articleConnector.showLoader.subscribe(function (value) { return _this.showLoader.next(value); }));
728
+ response = _a.sent();
729
+ if (response && response.validationResult && response.validationResult.success) {
730
+ return [2 /*return*/, response.resultObject];
731
+ }
732
+ else {
733
+ return [2 /*return*/, ''];
734
+ }
951
735
  return [2 /*return*/];
952
736
  }
953
737
  });
954
738
  });
955
739
  };
956
- ProductConnectorAdapterService.prototype.setInstance = function (instanceId) {
957
- // this.articleConnector.setInstanceToConfigure(instanceId, false);
958
- };
959
- ProductConnectorAdapterService.prototype.getProductBundleSettings = function (url, upId) {
740
+ ProductConnectorAdapterService.prototype.getJsonArticleFlatTree = function (goodId, goodType, quantity, externalSource, showLoader, instanceId, configuratorStatistics) {
741
+ if (externalSource === void 0) { externalSource = false; }
742
+ if (showLoader === void 0) { showLoader = true; }
960
743
  return __awaiter(this, void 0, void 0, function () {
961
- var tempSettings, tempMainConnector, response;
744
+ var _this = this;
962
745
  return __generator(this, function (_a) {
963
- switch (_a.label) {
964
- case 0:
965
- tempSettings = new ProductSettings();
966
- tempSettings.url = url;
967
- tempSettings.schema = upId.toString();
968
- tempMainConnector = new mainapi.MainApi(tempSettings);
969
- return [4 /*yield*/, tempMainConnector.getPublicParams(upId)];
970
- case 1:
971
- response = _a.sent();
972
- if (response) {
973
- return [2 /*return*/, response.productSettings];
974
- }
975
- return [2 /*return*/, ""];
976
- }
746
+ return [2 /*return*/, this.articleConnector.getJsonArticleFlatTree(goodId, goodType, quantity, externalSource, showLoader, instanceId, configuratorStatistics).catch(function (messages) {
747
+ _this._eventService.errorMessage.next(messages);
748
+ return null;
749
+ })];
977
750
  });
978
751
  });
979
752
  };
980
- ProductConnectorAdapterService.prototype.convertArticleFullObjectToArticleExtended = function (article) {
981
- if (article) {
982
- return this._boFactory.makeWithRawBackendData(articleListObjectExtended_bo.ArticleListObjectExtended, article);
983
- }
984
- };
985
- ProductConnectorAdapterService.prototype.getDeliveryPrognosis = function (goodId, branchNr) {
753
+ ProductConnectorAdapterService.prototype.getGeneratedArtDirectly = function (goodId, showLoader) {
986
754
  return __awaiter(this, void 0, void 0, function () {
987
- var deliveryPrognosis;
755
+ var _this = this;
988
756
  return __generator(this, function (_a) {
989
- switch (_a.label) {
990
- case 0: return [4 /*yield*/, this.getSelectorDeliveryDate()];
991
- case 1:
992
- deliveryPrognosis = _a.sent();
993
- if (!deliveryPrognosis || !deliveryPrognosis.returnValue) {
994
- return [2 /*return*/, this.getDeliveryDate2(goodId)];
995
- }
996
- return [2 /*return*/, deliveryPrognosis];
997
- }
757
+ return [2 /*return*/, this.articleConnector.getGeneratedArtDirectly(goodId, showLoader).catch(function (messages) {
758
+ _this._eventService.errorMessage.next(messages);
759
+ return null;
760
+ })];
998
761
  });
999
762
  });
1000
763
  };
1001
- ProductConnectorAdapterService.prototype.getSelectorDeliveryDate = function () {
764
+ ProductConnectorAdapterService.prototype.getGoodIdFromArticleNr = function (sku) {
1002
765
  return __awaiter(this, void 0, void 0, function () {
1003
766
  var response;
1004
767
  return __generator(this, function (_a) {
1005
768
  switch (_a.label) {
1006
- case 0: return [4 /*yield*/, this.articleConnector.getSelectorDeliveryDate()];
769
+ case 0: return [4 /*yield*/, this.articleConnector.getGoodIdFromArticleNr(sku)];
1007
770
  case 1:
1008
771
  response = _a.sent();
1009
772
  if (response && response.validationResult && response.validationResult.success) {
1010
- return [2 /*return*/, this._boFactory.makeWithRawBackendData(deliveryPrognosis.DeliveryPrognosis, response.resultObject)];
773
+ return [2 /*return*/, response.resultObject];
1011
774
  }
1012
775
  else {
1013
776
  return [2 /*return*/, null];
@@ -1017,16 +780,17 @@
1017
780
  });
1018
781
  });
1019
782
  };
1020
- ProductConnectorAdapterService.prototype.getArtStockStatus = function (goodId) {
783
+ ProductConnectorAdapterService.prototype.getArticleFullObject = function (goodId, showLoader) {
784
+ if (showLoader === void 0) { showLoader = true; }
1021
785
  return __awaiter(this, void 0, void 0, function () {
1022
786
  var response;
1023
787
  return __generator(this, function (_a) {
1024
788
  switch (_a.label) {
1025
- case 0: return [4 /*yield*/, this.articleConnector.getArtStockStatus(goodId)];
789
+ case 0: return [4 /*yield*/, this.articleConnector.getArticleFullObject(goodId, showLoader)];
1026
790
  case 1:
1027
791
  response = _a.sent();
1028
792
  if (response && response.validationResult && response.validationResult.success) {
1029
- return [2 /*return*/, response.resultObject];
793
+ return [2 /*return*/, this._boFactory.makeWithRawBackendData(articleFullObject.ArticleFullObject, response.resultObject)];
1030
794
  }
1031
795
  else {
1032
796
  return [2 /*return*/, null];
@@ -1036,16 +800,16 @@
1036
800
  });
1037
801
  });
1038
802
  };
1039
- ProductConnectorAdapterService.prototype.getDeliveryDate2 = function (goodId) {
803
+ ProductConnectorAdapterService.prototype.getSuperArticle = function (id, branch) {
1040
804
  return __awaiter(this, void 0, void 0, function () {
1041
805
  var response;
1042
806
  return __generator(this, function (_a) {
1043
807
  switch (_a.label) {
1044
- case 0: return [4 /*yield*/, this.articleConnector.getDeliveryDate2(goodId)];
808
+ case 0: return [4 /*yield*/, this.articleConnector.getSuperArticleQuickSel(id, branch)];
1045
809
  case 1:
1046
810
  response = _a.sent();
1047
811
  if (response && response.validationResult && response.validationResult.success) {
1048
- return [2 /*return*/, this._boFactory.makeWithRawBackendData(deliveryPrognosis.DeliveryPrognosis, response.resultObject)];
812
+ return [2 /*return*/, this._boFactory.makeWithRawBackendData(superArticle.SuperArticle, response.resultObject)];
1049
813
  }
1050
814
  else {
1051
815
  return [2 /*return*/, null];
@@ -1055,151 +819,387 @@
1055
819
  });
1056
820
  });
1057
821
  };
1058
- ProductConnectorAdapterService.prototype.getJsonConfiguredArticles = function (configuratorStatistics) {
822
+ ProductConnectorAdapterService.prototype.getDocumentContent = function (docId, thumbnail) {
823
+ if (thumbnail === void 0) { thumbnail = true; }
1059
824
  return __awaiter(this, void 0, void 0, function () {
1060
825
  var response;
1061
826
  return __generator(this, function (_a) {
1062
827
  switch (_a.label) {
1063
- case 0: return [4 /*yield*/, this.articleConnector.getJsonConfiguredArticles(configuratorStatistics)];
828
+ case 0: return [4 /*yield*/, this.articleConnector.getDocumentContent(docId, thumbnail)];
1064
829
  case 1:
1065
830
  response = _a.sent();
1066
831
  if (response && response.validationResult && response.validationResult.success) {
1067
- return [2 /*return*/, response.resultObject];
832
+ return [2 /*return*/, this._boFactory.makeWithRawBackendData(documentContent.DocumentContent, response.resultObject)];
1068
833
  }
1069
834
  else {
1070
- return [2 /*return*/, ''];
835
+ return [2 /*return*/, null];
1071
836
  }
1072
837
  return [2 /*return*/];
1073
838
  }
1074
839
  });
1075
840
  });
1076
841
  };
1077
- ProductConnectorAdapterService.prototype.getJsonArticleFlatTree = function (goodId, goodType, quantity, externalSource, showLoader, instanceId, configuratorStatistics) {
1078
- if (externalSource === void 0) { externalSource = false; }
1079
- if (showLoader === void 0) { showLoader = true; }
1080
- return __awaiter(this, void 0, void 0, function () {
1081
- var _this = this;
1082
- return __generator(this, function (_a) {
1083
- return [2 /*return*/, this.articleConnector.getJsonArticleFlatTree(goodId, goodType, quantity, externalSource, showLoader, instanceId, configuratorStatistics).catch(function (messages) {
1084
- _this._eventService.errorMessage.next(messages);
1085
- return null;
1086
- })];
1087
- });
1088
- });
1089
- };
1090
- ProductConnectorAdapterService.prototype.getGeneratedArtDirectly = function (goodId, showLoader) {
842
+ ProductConnectorAdapterService.prototype.addWebSessionTransactionLine = function (transactionUuid, sku, quantity) {
1091
843
  return __awaiter(this, void 0, void 0, function () {
1092
- var _this = this;
844
+ var response, infoResponse;
1093
845
  return __generator(this, function (_a) {
1094
- return [2 /*return*/, this.articleConnector.getGeneratedArtDirectly(goodId, showLoader).catch(function (messages) {
1095
- _this._eventService.errorMessage.next(messages);
1096
- return null;
1097
- })];
846
+ switch (_a.label) {
847
+ case 0: return [4 /*yield*/, this.transactionConnector.addWebSessionTransactionLine(transactionUuid, sku, quantity)];
848
+ case 1:
849
+ response = _a.sent();
850
+ if (response && response.validationResult && response.validationResult.success) {
851
+ infoResponse = this._boFactory.makeWithRawBackendData(transactionInfoResponse_bo.TransactionInfoResponse, response.resultObject);
852
+ return [2 /*return*/, infoResponse.transactionInfo.uuid];
853
+ }
854
+ return [2 /*return*/, ""];
855
+ }
1098
856
  });
1099
857
  });
1100
858
  };
1101
- ProductConnectorAdapterService.prototype.getGoodIdFromArticleNr = function (sku) {
859
+ return ProductConnectorAdapterService;
860
+ }());
861
+ ProductConnectorAdapterService.decorators = [
862
+ { type: i0.Injectable }
863
+ ];
864
+ ProductConnectorAdapterService.ctorParameters = function () { return [
865
+ { type: ProductEventService }
866
+ ]; };
867
+
868
+ var JsonUtilsService = /** @class */ (function () {
869
+ function JsonUtilsService() {
870
+ }
871
+ JsonUtilsService.prototype.readJsonFile = function (filePath) {
1102
872
  return __awaiter(this, void 0, void 0, function () {
1103
- var response;
873
+ var response, e_1;
1104
874
  return __generator(this, function (_a) {
1105
875
  switch (_a.label) {
1106
- case 0: return [4 /*yield*/, this.articleConnector.getGoodIdFromArticleNr(sku)];
876
+ case 0:
877
+ _a.trys.push([0, 2, , 3]);
878
+ return [4 /*yield*/, fetch(filePath)];
1107
879
  case 1:
1108
880
  response = _a.sent();
1109
- if (response && response.validationResult && response.validationResult.success) {
1110
- return [2 /*return*/, response.resultObject];
881
+ if (!response.ok) {
882
+ return [2 /*return*/, null];
1111
883
  }
1112
884
  else {
1113
- return [2 /*return*/, null];
885
+ return [2 /*return*/, response.json()];
1114
886
  }
1115
- return [2 /*return*/];
887
+ return [3 /*break*/, 3];
888
+ case 2:
889
+ e_1 = _a.sent();
890
+ console.error('Error getting file:', e_1.message);
891
+ return [2 /*return*/, ''];
892
+ case 3: return [2 /*return*/];
893
+ }
894
+ });
895
+ });
896
+ };
897
+ return JsonUtilsService;
898
+ }());
899
+ JsonUtilsService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function JsonUtilsService_Factory() { return new JsonUtilsService(); }, token: JsonUtilsService, providedIn: "root" });
900
+ JsonUtilsService.decorators = [
901
+ { type: i0.Injectable, args: [{
902
+ providedIn: 'root'
903
+ },] }
904
+ ];
905
+
906
+ var LanguageCode;
907
+ (function (LanguageCode) {
908
+ LanguageCode["Dutch"] = "nl-NL";
909
+ LanguageCode["English"] = "en-GB";
910
+ LanguageCode["German"] = "de-DE";
911
+ LanguageCode["French"] = "fr-FR";
912
+ })(LanguageCode || (LanguageCode = {}));
913
+
914
+ var Dictionary = /** @class */ (function () {
915
+ function Dictionary() {
916
+ this.strings = {
917
+ "en": {
918
+ "ADDITIONAL_DATA": "Additional information",
919
+ "ALTERNATIVE_PRODUCTS": "Alternative products",
920
+ "ARTICLE_NUMBER": "Productnumber",
921
+ "AS_CONFIGURED": "As configured",
922
+ "CATEGORY": "Category",
923
+ "CATEGORY_TYPE": "Category type",
924
+ "CONFIGURE": "Configure",
925
+ "DELIVERY_TIME_PERIOD": "Delivery time",
926
+ "DESCRIPTION": "Description",
927
+ "DOCUMENTS": "Documents",
928
+ "DOWNLOADS": "Downloads",
929
+ "FEATURES": "Features",
930
+ "HEIGHT": "Height",
931
+ "MATERIAL": "Material",
932
+ "PRODUCT_IN_STOCK": "In stock",
933
+ "PRODUCT_LIMITED_STOCK": "Limited stock",
934
+ "PRODUCT_NOT_IN_STOCK": "Not in stock",
935
+ "PROPERTIES": "Characteristics",
936
+ "QUOTATION": "Quotation",
937
+ "READ_MORE": "Read more",
938
+ "RELATED_PRODUCTS": "Related products",
939
+ "SHOPPING_CART_IN": "In Shopping Cart",
940
+ "SHOW_IN": "Show in",
941
+ "STOCK": "Stock",
942
+ "SYMBOLS": "Symbols",
943
+ "TITLE": "Title",
944
+ "TURNOVERGROUP": "Turnover group",
945
+ "VARIANTS": "Variations",
946
+ "WIDTH": "Width",
947
+ "SUGGESTION": "Suggestion",
948
+ },
949
+ "nl": {
950
+ "ADDITIONAL_DATA": "Extra informatie",
951
+ "ALTERNATIVE_PRODUCTS": "Alternatieve producten",
952
+ "ARTICLE_NUMBER": "Artikel nummer",
953
+ "AS_CONFIGURED": "Zoals samengesteld",
954
+ "CATEGORY": "Categorie",
955
+ "CATEGORY_TYPE": "Categorie type",
956
+ "CONFIGURE": "Configureren",
957
+ "DELIVERY_TIME_PERIOD": "Levertijd",
958
+ "DESCRIPTION": "Omschrijving",
959
+ "DOCUMENTS": "Documenten",
960
+ "DOWNLOADS": "Downloads",
961
+ "FEATURES": "Kenmerken",
962
+ "HEIGHT": "Hoogte",
963
+ "MATERIAL": "Materiaal",
964
+ "PRODUCT_IN_STOCK": "Op voorraad",
965
+ "PRODUCT_LIMITED_STOCK": "Beperkt op voorraad",
966
+ "PRODUCT_NOT_IN_STOCK": "Niet op voorraad",
967
+ "PROPERTIES": "Eigenschappen",
968
+ "QUOTATION": "Quotatie",
969
+ "READ_MORE": "Lees meer",
970
+ "RELATED_PRODUCTS": "Gerelateerde producten",
971
+ "SHOPPING_CART_IN": "In winkelwagen",
972
+ "SHOW_IN": "Laat zien",
973
+ "STOCK": "Voorraad",
974
+ "SYMBOLS": "Symbolen",
975
+ "TITLE": "Titel",
976
+ "TURNOVERGROUP": "Omzetgroep",
977
+ "VARIANTS": "Varianten",
978
+ "WIDTH": "Breedte",
979
+ "SUGGESTION": "Suggesties bij",
980
+ },
981
+ "de": {
982
+ "ADDITIONAL_DATA": "Extra informatie",
983
+ "ALTERNATIVE_PRODUCTS": "Alternative Produkte",
984
+ "ARTICLE_NUMBER": "Artikelnummer",
985
+ "CATEGORY": "Kategorie",
986
+ "CATEGORY_TYPE": "Kategorietype",
987
+ "CONFIGURE": "Konfigurieren",
988
+ "DELIVERY_TIME_PERIOD": "Lieferzeit",
989
+ "DESCRIPTION": "Beschreibung",
990
+ "DOCUMENTS": "Dateien",
991
+ "DOWNLOADS": "Downloads",
992
+ "FEATURES": "Eigenschaften",
993
+ "HEIGHT": "Höhe",
994
+ "MATERIAL": "Material",
995
+ "PRODUCT_IN_STOCK": "Auf lager",
996
+ "PRODUCT_LIMITED_STOCK": "Begrentzt auf lager",
997
+ "PRODUCT_NOT_IN_STOCK": "Nicht auf lager",
998
+ "PROPERTIES": "Eigenschaften",
999
+ "QUOTATION": "Angebot",
1000
+ "READ_MORE": "Lesen Sie mehr",
1001
+ "RELATED_PRODUCTS": "Verwandte Produkte",
1002
+ "SHOPPING_CART_IN": "Im Einkaufswagen",
1003
+ "SHOW_IN": "Zeigen",
1004
+ "STOCK": "Vorrat",
1005
+ "SYMBOLS": "Symbole",
1006
+ "TITLE": "Titulatur",
1007
+ "TURNOVERGROUP": "Umsatzgruppe",
1008
+ "VARIANTS": "Varianten",
1009
+ "WIDTH": "Breite",
1010
+ "SUGGESTION": "Suggesties bij",
1011
+ }
1012
+ };
1013
+ }
1014
+ return Dictionary;
1015
+ }());
1016
+
1017
+ // The localization service, providing peers with text translation functionality.
1018
+ var DictionaryService = /** @class */ (function () {
1019
+ function DictionaryService(_http, _jsonUtils) {
1020
+ this._http = _http;
1021
+ this._jsonUtils = _jsonUtils;
1022
+ this.dictionaryUrl = 'js/browser/res/dictionary/';
1023
+ // private _dictionaryPromise: Map<LanguageCode, Promise<{ [key: string]: string }>> = new Map<LanguageCode, Promise<{ [key: string]: string }>>();
1024
+ this._dictionaries = new Map();
1025
+ // Some dictionary values have one or more '|~' texts in them, meant to be replaced with client-side given texts.
1026
+ this._placeholder = '|~';
1027
+ }
1028
+ Object.defineProperty(DictionaryService.prototype, "language", {
1029
+ get: function () {
1030
+ return this._language;
1031
+ },
1032
+ enumerable: false,
1033
+ configurable: true
1034
+ });
1035
+ Object.defineProperty(DictionaryService.prototype, "rootUrl", {
1036
+ set: function (value) {
1037
+ this._rootUrl = value;
1038
+ this._dictBasePath = this._rootUrl + '/' + this.dictionaryUrl;
1039
+ },
1040
+ enumerable: false,
1041
+ configurable: true
1042
+ });
1043
+ // Loads the dictionary for given language in memory.
1044
+ DictionaryService.prototype.setDictionary = function (language) {
1045
+ return __awaiter(this, void 0, void 0, function () {
1046
+ var dictionary;
1047
+ return __generator(this, function (_a) {
1048
+ this._language = language || LanguageCode.Dutch;
1049
+ if (!this._dictionaries.has(this._language)) {
1050
+ dictionary = new Dictionary();
1051
+ if (dictionary.strings[this._language.substr(0, 2).toLowerCase()] !== undefined) {
1052
+ this._dictionaries.set(this._language, dictionary.strings[this._language.substr(0, 2).toLowerCase()]);
1053
+ }
1116
1054
  }
1055
+ return [2 /*return*/];
1117
1056
  });
1118
1057
  });
1119
1058
  };
1120
- ProductConnectorAdapterService.prototype.getArticleFullObject = function (goodId, showLoader) {
1121
- if (showLoader === void 0) { showLoader = true; }
1059
+ /**
1060
+ * Returns the localized text for the given dictionary key.
1061
+ * @param {string} key
1062
+ * @param {boolean} [upperCaseFirst = true] False for first letter lowercase, true for first letter uppercase for returned dict val
1063
+ * @param {string[]} replacementTexts Rest params for replacement of '|~' in returned dict value
1064
+ * @returns {string} The translated text for given dictionary key
1065
+ */
1066
+ DictionaryService.prototype.get = function (key, upperCaseFirst) {
1067
+ if (upperCaseFirst === void 0) { upperCaseFirst = true; }
1068
+ var replacementTexts = [];
1069
+ for (var _i = 2; _i < arguments.length; _i++) {
1070
+ replacementTexts[_i - 2] = arguments[_i];
1071
+ }
1072
+ if (!stringUtils.StringUtils.IsStringWithLength(key)) {
1073
+ return key || '';
1074
+ }
1075
+ var text = this._dictionaries.get(this.language)[key];
1076
+ text = stringUtils.StringUtils.IsStringWithLength(text) ? text : key;
1077
+ if (upperCaseFirst) {
1078
+ text = text.charAt(0).toUpperCase() + text.slice(1);
1079
+ }
1080
+ else {
1081
+ text = text.charAt(0).toLowerCase() + text.slice(1);
1082
+ }
1083
+ if (replacementTexts.length > 0) {
1084
+ text = stringUtils.StringUtils.ReplaceOccurrencesIn.apply(stringUtils.StringUtils, __spreadArray([text, this._placeholder], __read(replacementTexts)));
1085
+ }
1086
+ return text;
1087
+ };
1088
+ return DictionaryService;
1089
+ }());
1090
+ DictionaryService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function DictionaryService_Factory() { return new DictionaryService(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(JsonUtilsService)); }, token: DictionaryService, providedIn: "root" });
1091
+ DictionaryService.decorators = [
1092
+ { type: i0.Injectable, args: [{
1093
+ providedIn: 'root'
1094
+ },] }
1095
+ ];
1096
+ DictionaryService.ctorParameters = function () { return [
1097
+ { type: i1.HttpClient },
1098
+ { type: JsonUtilsService }
1099
+ ]; };
1100
+
1101
+ var ProductSettingsService = /** @class */ (function () {
1102
+ function ProductSettingsService(_jsonUtilsService, _dictionaryService) {
1103
+ this._jsonUtilsService = _jsonUtilsService;
1104
+ this._dictionaryService = _dictionaryService;
1105
+ this.settingsLoaded = new rxjs.BehaviorSubject(false);
1106
+ }
1107
+ Object.defineProperty(ProductSettingsService.prototype, "settings", {
1108
+ get: function () {
1109
+ return this._settings;
1110
+ },
1111
+ set: function (value) {
1112
+ this._settings = value;
1113
+ },
1114
+ enumerable: false,
1115
+ configurable: true
1116
+ });
1117
+ ProductSettingsService.prototype.initializeSettings = function (finish) {
1118
+ if (finish === void 0) { finish = true; }
1122
1119
  return __awaiter(this, void 0, void 0, function () {
1123
- var response;
1120
+ var jsonSettings;
1124
1121
  return __generator(this, function (_a) {
1125
1122
  switch (_a.label) {
1126
- case 0: return [4 /*yield*/, this.articleConnector.getArticleFullObject(goodId, showLoader)];
1123
+ case 0:
1124
+ if (!(typeof settings === 'undefined')) return [3 /*break*/, 2];
1125
+ return [4 /*yield*/, this._jsonUtilsService.readJsonFile('product-settings.json')];
1127
1126
  case 1:
1128
- response = _a.sent();
1129
- if (response && response.validationResult && response.validationResult.success) {
1130
- return [2 /*return*/, this._boFactory.makeWithRawBackendData(articleFullObject.ArticleFullObject, response.resultObject)];
1127
+ jsonSettings = _a.sent();
1128
+ if (jsonSettings) {
1129
+ this.settings = Object.assign(new ProductSettings(), jsonSettings);
1130
+ this.settings.options = Object.assign(new SettingsOptions(), this.settings.options);
1131
+ if (finish) {
1132
+ this.settingsFinished();
1133
+ }
1131
1134
  }
1132
- else {
1133
- return [2 /*return*/, null];
1135
+ return [3 /*break*/, 3];
1136
+ case 2:
1137
+ this.settings = Object.assign(new ProductSettings(), settings);
1138
+ this.settings.options = Object.assign(new SettingsOptions(), this.settings.options);
1139
+ if (finish) {
1140
+ this.settingsFinished();
1134
1141
  }
1135
- return [2 /*return*/];
1142
+ _a.label = 3;
1143
+ case 3: return [2 /*return*/];
1136
1144
  }
1137
1145
  });
1138
1146
  });
1139
1147
  };
1140
- ProductConnectorAdapterService.prototype.getSuperArticle = function (id, branch) {
1148
+ ProductSettingsService.prototype.createSettingsFromObject = function (obj) {
1141
1149
  return __awaiter(this, void 0, void 0, function () {
1142
- var response;
1150
+ var ownOptions, ownRenderParameters;
1143
1151
  return __generator(this, function (_a) {
1144
- switch (_a.label) {
1145
- case 0: return [4 /*yield*/, this.articleConnector.getSuperArticleQuickSel(id, branch)];
1146
- case 1:
1147
- response = _a.sent();
1148
- if (response && response.validationResult && response.validationResult.success) {
1149
- return [2 /*return*/, this._boFactory.makeWithRawBackendData(superArticle.SuperArticle, response.resultObject)];
1150
- }
1151
- else {
1152
- return [2 /*return*/, null];
1153
- }
1154
- return [2 /*return*/];
1152
+ if (!this.settings) {
1153
+ this.settings = new ProductSettings();
1155
1154
  }
1156
- });
1157
- });
1158
- };
1159
- ProductConnectorAdapterService.prototype.getDocumentContent = function (docId, thumbnail) {
1160
- if (thumbnail === void 0) { thumbnail = true; }
1161
- return __awaiter(this, void 0, void 0, function () {
1162
- var response;
1163
- return __generator(this, function (_a) {
1164
- switch (_a.label) {
1165
- case 0: return [4 /*yield*/, this.articleConnector.getDocumentContent(docId, thumbnail)];
1166
- case 1:
1167
- response = _a.sent();
1168
- if (response && response.validationResult && response.validationResult.success) {
1169
- return [2 /*return*/, this._boFactory.makeWithRawBackendData(documentContent.DocumentContent, response.resultObject)];
1170
- }
1171
- else {
1172
- return [2 /*return*/, null];
1173
- }
1174
- return [2 /*return*/];
1155
+ ownOptions = Object.assign({}, this.settings.options);
1156
+ ownRenderParameters = Object.assign({}, this.settings.renderParameters);
1157
+ this.settings = Object.assign({}, this.settings, obj);
1158
+ if (obj.renderParameters) {
1159
+ this.settings.renderParameters = Object.assign({}, ownRenderParameters, obj.renderParameters);
1160
+ }
1161
+ if (obj.options) {
1162
+ this.settings.options = Object.assign({}, ownOptions, obj.options);
1163
+ }
1164
+ if (obj.hasOwnProperty('assetPath')) {
1165
+ this.settings.assetPath = obj['assetPath'];
1166
+ if (this.settings.assetPath[this.settings.assetPath.length - 1] !== '/') {
1167
+ this.settings.assetPath += '/';
1168
+ }
1169
+ this.settings.threeDAssetPath = this.settings.assetPath;
1170
+ }
1171
+ if (obj.hasOwnProperty('threeDAssetPath')) {
1172
+ this.settings.threeDAssetPath = obj['threeDAssetPath'];
1173
+ if (this.settings.threeDAssetPath[this.settings.threeDAssetPath.length - 1] !== '/') {
1174
+ this.settings.threeDAssetPath += '/';
1175
+ }
1175
1176
  }
1177
+ this.settingsFinished();
1178
+ return [2 /*return*/];
1176
1179
  });
1177
1180
  });
1178
1181
  };
1179
- ProductConnectorAdapterService.prototype.addWebSessionTransactionLine = function (transactionUuid, sku, quantity) {
1182
+ ProductSettingsService.prototype.settingsFinished = function () {
1180
1183
  return __awaiter(this, void 0, void 0, function () {
1181
- var response, infoResponse;
1182
1184
  return __generator(this, function (_a) {
1183
1185
  switch (_a.label) {
1184
- case 0: return [4 /*yield*/, this.transactionConnector.addWebSessionTransactionLine(transactionUuid, sku, quantity)];
1186
+ case 0: return [4 /*yield*/, this._dictionaryService.setDictionary(this.settings.languageCode)];
1185
1187
  case 1:
1186
- response = _a.sent();
1187
- if (response && response.validationResult && response.validationResult.success) {
1188
- infoResponse = this._boFactory.makeWithRawBackendData(transactionInfoResponse_bo.TransactionInfoResponse, response.resultObject);
1189
- return [2 /*return*/, infoResponse.transactionInfo.uuid];
1190
- }
1191
- return [2 /*return*/, ""];
1188
+ _a.sent();
1189
+ this.settingsLoaded.next(true);
1190
+ return [2 /*return*/];
1192
1191
  }
1193
1192
  });
1194
1193
  });
1195
1194
  };
1196
- return ProductConnectorAdapterService;
1195
+ return ProductSettingsService;
1197
1196
  }());
1198
- ProductConnectorAdapterService.decorators = [
1197
+ ProductSettingsService.decorators = [
1199
1198
  { type: i0.Injectable }
1200
1199
  ];
1201
- ProductConnectorAdapterService.ctorParameters = function () { return [
1202
- { type: ProductEventService }
1200
+ ProductSettingsService.ctorParameters = function () { return [
1201
+ { type: JsonUtilsService },
1202
+ { type: DictionaryService }
1203
1203
  ]; };
1204
1204
 
1205
1205
  // Holds all iONE backend related state and methods for a running HomeDecorator. To be used anywhere internally.
@@ -1208,6 +1208,7 @@
1208
1208
  this._adapterService = _adapterService;
1209
1209
  this._settingsService = _settingsService;
1210
1210
  this.controllerInitialized = new rxjs.BehaviorSubject(false);
1211
+ this.articleLoaded = new rxjs.BehaviorSubject(false);
1211
1212
  this._initializing = false;
1212
1213
  this._initialized = false;
1213
1214
  this.connectorOptions = new options.Options();
@@ -1342,8 +1343,51 @@
1342
1343
  { type: ProductSettingsService }
1343
1344
  ]; };
1344
1345
 
1346
+ var RootStorageObject = /** @class */ (function () {
1347
+ function RootStorageObject() {
1348
+ }
1349
+ return RootStorageObject;
1350
+ }());
1351
+ var LocalStorageService = /** @class */ (function () {
1352
+ function LocalStorageService() {
1353
+ this.storage = localStorage;
1354
+ this._appRoot = "web-order";
1355
+ this._storageObj = new RootStorageObject();
1356
+ this._initLocalStorageObj();
1357
+ }
1358
+ LocalStorageService.prototype.save = function () {
1359
+ this.storage.setItem(this._appRoot, JSON.stringify(this._storageObj));
1360
+ };
1361
+ LocalStorageService.prototype.clear = function () {
1362
+ this.storage.clear();
1363
+ };
1364
+ Object.defineProperty(LocalStorageService.prototype, "id", {
1365
+ get: function () {
1366
+ return this._storageObj ? this._storageObj.id : "";
1367
+ },
1368
+ set: function (id) {
1369
+ this._storageObj.id = id;
1370
+ this.save();
1371
+ },
1372
+ enumerable: false,
1373
+ configurable: true
1374
+ });
1375
+ LocalStorageService.prototype._initLocalStorageObj = function () {
1376
+ this._storageObj = JSON.parse(this.storage.getItem(this._appRoot)) || this._storageObj;
1377
+ this.save();
1378
+ };
1379
+ return LocalStorageService;
1380
+ }());
1381
+ LocalStorageService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalStorageService_Factory() { return new LocalStorageService(); }, token: LocalStorageService, providedIn: "root" });
1382
+ LocalStorageService.decorators = [
1383
+ { type: i0.Injectable, args: [{
1384
+ providedIn: 'root'
1385
+ },] }
1386
+ ];
1387
+ LocalStorageService.ctorParameters = function () { return []; };
1388
+
1345
1389
  var IoneProductComponent = /** @class */ (function () {
1346
- function IoneProductComponent(_appEventService, _settingsService) {
1390
+ function IoneProductComponent(_appEventService, _settingsService, _productConnectorService, _localStorageService) {
1347
1391
  var _this = this;
1348
1392
  // this.sku = 'CF-HILL';
1349
1393
  // this.sku = 'CF-ALMADA';
@@ -1362,8 +1406,11 @@
1362
1406
  // this.sku = "1000612725";
1363
1407
  this._appEventService = _appEventService;
1364
1408
  this._settingsService = _settingsService;
1409
+ this._productConnectorService = _productConnectorService;
1410
+ this._localStorageService = _localStorageService;
1365
1411
  this.enableRenderCarousel = false;
1366
1412
  this.handleAddArticleInternally = true;
1413
+ this.handleAddToCartInternally = false;
1367
1414
  this.onAddToCart = new i0.EventEmitter();
1368
1415
  this.forceRenderImage = new i0.EventEmitter();
1369
1416
  this.getRenderForRenderCarousel = new i0.EventEmitter();
@@ -1426,9 +1473,41 @@
1426
1473
  };
1427
1474
  IoneProductComponent.prototype._handleAddToCart = function (data) {
1428
1475
  return __awaiter(this, void 0, void 0, function () {
1476
+ var article, transactionId, transactionId;
1429
1477
  return __generator(this, function (_a) {
1430
- this.onAddToCart.emit(data);
1431
- return [2 /*return*/];
1478
+ switch (_a.label) {
1479
+ case 0:
1480
+ if (!this.handleAddToCartInternally) return [3 /*break*/, 7];
1481
+ if (!(data && data.article)) return [3 /*break*/, 6];
1482
+ if (!(typeof data.article === 'string')) return [3 /*break*/, 3];
1483
+ article = JSON.parse(data.article);
1484
+ if (!(article.selectorData && article.selectorData.compositions)) return [3 /*break*/, 2];
1485
+ return [4 /*yield*/, this._productConnectorService.addWebSessionTransactionLine(this._localStorageService.id, article.selectorData.compositions[0].compositionArticleNo, data.quantity)];
1486
+ case 1:
1487
+ transactionId = _a.sent();
1488
+ if (transactionId) {
1489
+ this._localStorageService.id = transactionId;
1490
+ }
1491
+ _a.label = 2;
1492
+ case 2: return [3 /*break*/, 5];
1493
+ case 3:
1494
+ if (!data.article.hasOwnProperty('articleNr')) return [3 /*break*/, 5];
1495
+ return [4 /*yield*/, this._productConnectorService.addWebSessionTransactionLine(this._localStorageService.id, data.article['articleNr'], data.quantity)];
1496
+ case 4:
1497
+ transactionId = _a.sent();
1498
+ if (transactionId) {
1499
+ this._localStorageService.id = transactionId;
1500
+ }
1501
+ _a.label = 5;
1502
+ case 5:
1503
+ this.onAddToCart.next(data);
1504
+ _a.label = 6;
1505
+ case 6: return [3 /*break*/, 8];
1506
+ case 7:
1507
+ this.onAddToCart.emit(data);
1508
+ _a.label = 8;
1509
+ case 8: return [2 /*return*/];
1510
+ }
1432
1511
  });
1433
1512
  });
1434
1513
  };
@@ -1453,7 +1532,9 @@
1453
1532
  ];
1454
1533
  IoneProductComponent.ctorParameters = function () { return [
1455
1534
  { type: ProductEventService },
1456
- { type: ProductSettingsService }
1535
+ { type: ProductSettingsService },
1536
+ { type: ProductConnectorService },
1537
+ { type: LocalStorageService }
1457
1538
  ]; };
1458
1539
  IoneProductComponent.propDecorators = {
1459
1540
  sku: [{ type: i0.Input }],
@@ -1462,6 +1543,7 @@
1462
1543
  enableRenderCarousel: [{ type: i0.Input }],
1463
1544
  settings: [{ type: i0.Input }],
1464
1545
  handleAddArticleInternally: [{ type: i0.Input }],
1546
+ handleAddToCartInternally: [{ type: i0.Input }],
1465
1547
  onAddToCart: [{ type: i0.Output }],
1466
1548
  forceRenderImage: [{ type: i0.Output }],
1467
1549
  getRenderForRenderCarousel: [{ type: i0.Output }],
@@ -1605,9 +1687,19 @@
1605
1687
  if (_this.selections.nativeElement) {
1606
1688
  _this.selections.nativeElement.forceRenderImage();
1607
1689
  }
1608
- }), this.settingsService.settingsLoaded.subscribe(function (loaded) { return _this._handleSettingsLoaded(loaded); }), this._ione.controllerInitialized.subscribe(function (initialized) {
1609
- _this.settingsLoaded = initialized;
1610
- }), this.appEventService.onAnswersAvailable.subscribe(function (answers) {
1690
+ }), this.settingsService.settingsLoaded.subscribe(function (loaded) { return _this._handleSettingsLoaded(loaded); }), this._pageLoadedSubscription = rxjs.combineLatest([
1691
+ this._ione.controllerInitialized,
1692
+ this._ione.articleLoaded
1693
+ ]).subscribe(function (_a) {
1694
+ var _b = __read(_a, 2), initialized = _b[0], articleLoaded = _b[1];
1695
+ if (initialized && articleLoaded) {
1696
+ _this.settingsLoaded = initialized;
1697
+ }
1698
+ }),
1699
+ // this._ione.controllerInitialized.subscribe((initialized: boolean) => {
1700
+ // this.settingsLoaded = initialized;
1701
+ // }),
1702
+ this.appEventService.onAnswersAvailable.subscribe(function (answers) {
1611
1703
  if (answers && _this.configurable) {
1612
1704
  _this.showAddToCart = false;
1613
1705
  }
@@ -1707,6 +1799,7 @@
1707
1799
  if (this._initializedSub) {
1708
1800
  this._initializedSub.unsubscribe();
1709
1801
  }
1802
+ this._pageLoadedSubscription.unsubscribe();
1710
1803
  this.configurator = undefined;
1711
1804
  this.selections = undefined;
1712
1805
  this.fullscreenbutton = undefined;
@@ -1760,6 +1853,7 @@
1760
1853
  });
1761
1854
  _this._changeDetector.detectChanges();
1762
1855
  }
1856
+ _this._ione.articleLoaded.next(true);
1763
1857
  });
1764
1858
  }
1765
1859
  return [2 /*return*/];
@@ -1781,7 +1875,7 @@
1781
1875
  ProductPageComponent.decorators = [
1782
1876
  { type: i0.Component, args: [{
1783
1877
  selector: 'app-product-page',
1784
- template: "<ng-container *ngIf=\"settingsLoaded\">\r\n <div class=\"page-wrapper\">\r\n <div class=\"page-wrapper-content\">\r\n <div class=\"page-wrapper-left\">\r\n <div class=\"product-image-container\">\r\n <div class=\"product-page-block-selector-type\">\r\n <app-product-selector-type class=\"default-padding\"\r\n [(currentType)]=\"currentView\"\r\n [show2D]=\"configurable\"\r\n [show3D]=\"threeD\"\r\n ></app-product-selector-type>\r\n </div>\r\n <div class=\"product-page-block-image default-padding\" [class.full]=\"fullScreen\">\r\n\r\n <app-image-carousel\r\n *ngIf=\"!enableRenderCarousel\"\r\n [@toggleVisibilityByState]=\"show2D ? 'show' : 'hide'\"\r\n [images]=\"article?.images\"\r\n [showRefresh]=\"configurable && threeD\">\r\n </app-image-carousel>\r\n\r\n <app-render-carousel\r\n *ngIf=\"enableRenderCarousel\"\r\n [@toggleVisibilityByState]=\"show2D ? 'show' : 'hide'\"\r\n [article]=\"article\">\r\n </app-render-carousel>\r\n\r\n <ng-container *ngIf=\"settingsLoaded && this.configurable\">\r\n <threed-configurator\r\n #configurator\r\n class=\"threed-configurator\"\r\n [class.configurator-full-screen]=\"fullScreen\"\r\n [@toggleVisibilityByState]=\"show3D ? 'show' : 'hide'\"\r\n [@toggleFullScreen]=\"fullScreen ? 'fullscreen' : 'halfscreen'\">\r\n </threed-configurator>\r\n </ng-container>\r\n\r\n <co-icon #fullscreenbutton class=\"fullscreen-button\" *ngIf=\"show3D\"\r\n [@toggleTopLeft]=\"fullScreen ? 'fullscreen' : 'halfscreen'\"\r\n [iconData]=\"iconCache.getIcon(fullScreenIcon)\"\r\n (click)=\"showFullScreen()\"></co-icon>\r\n <co-icon class=\"threed-watermark\" *ngIf=\"show3D && fullScreen\"\r\n [iconData]=\"iconCache.getIcon(icon.Logo)\"></co-icon>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"page-wrapper-right\">\r\n <div class=\"product-page-block-description\">\r\n <app-product-description class=\"default-padding\" [article]=\"article\"></app-product-description>\r\n </div>\r\n <div class=\"product-page-block-additional\">\r\n <div class=\"product-page-block-additional-description\">\r\n <app-product-additional-description class=\"default-padding\" [article]=\"article\"></app-product-additional-description>\r\n </div>\r\n <div class=\"product-page-block-price\" [class.full]=\"configuring\">\r\n <app-product-price class=\"s-padding\" *ngIf=\"!configuring\"\r\n [pricing]=\"article?.pricing\"\r\n [configurable]=\"configurable\"\r\n ></app-product-price>\r\n <ng-container *ngIf=\"settingsLoaded\">\r\n <threed-selections #selections class=\"threed-selections\"\r\n [class.show-selections]=\"configuring\"\r\n [@toggleFullScreenRight]=\"fullScreen ? 'fullscreen' : 'halfscreen'\"\r\n [class.default-padding]=\"!fullScreen\"\r\n [class.show-full-screen]=\"fullScreen\"\r\n [class.mini-scrollbar]=\"fullScreen\"\r\n [sku]=\"sku\"\r\n [settings]=\"settings\"\r\n (onUserActionFromThreeD)=\"configuring = true\"\r\n (instanceSet)=\"setInstance($event)\"\r\n (onImageReceived)=\"appEventService.onImageReceived.next($event)\"\r\n (onRenderStarted)=\"appEventService.onRenderStarted.next()\"\r\n (onDraftRenderImageReceived)=\"appEventService.onDraftRenderImageReceived.next($event)\"\r\n (onArticleReceived)=\"appEventService.onArticleReceived.next($event.detail)\"\r\n (onSelectionsReceived)=\"appEventService.onSelectionsReceived.next($event.detail)\"\r\n (onArticleInfoReceived)=\"appEventService.onArticleInfoReceived.next($event.detail)\"\r\n (onAnswersAvailable)=\"appEventService.onAnswersAvailable.next($event.detail)\"\r\n (onReadyToRender)=\"appEventService.onReadyToRender.next($event.detail)\"\r\n (onRenderImageReceived)=\"appEventService.onRenderImageReceived.next($event.detail)\"\r\n ></threed-selections>\r\n </ng-container>\r\n </div>\r\n <div class=\"product-page-block-addtocart no-padding product-action-buttons\" *ngIf=\"!configuring\" [@toggleTopRight]=\"fullScreen ? 'fullscreen' : 'halfscreen'\">\r\n <app-product-addtocart\r\n [configurable]=\"configurable\"\r\n [createFrozenArticle]=\"createFrozenArticle\"\r\n [configuring]=\"configuring\"\r\n [showAddToCart]=\"showAddToCart\"\r\n [article]=\"article\"\r\n [externalSource]=\"externalSource\"\r\n [isReturn]=\"isReturn\"\r\n (startConfiguration)=\"handleStartConfiguration()\"\r\n (showRelatedPopup)=\"handlePopUpChange($event)\"\r\n ></app-product-addtocart>\r\n </div>\r\n <div class=\"addtocart-reserved product-action-buttons\" *ngIf=\"configuring\" [class.full-screen]=\"fullScreen\">\r\n <app-product-addtocart class=\"default-padding\"\r\n [configurable]=\"false\"\r\n [fullscreen]=\"fullScreen\"\r\n [showAddToCart]=\"showAddToCart\"\r\n [configuring]=\"configuring\"\r\n [article]=\"article\"\r\n [externalSource]=\"externalSource\"\r\n [isReturn]=\"isReturn\"\r\n (startConfiguration)=\"handleStartConfiguration()\"\r\n ></app-product-addtocart>\r\n </div>\r\n <div class=\"product-page-block-variants\">\r\n <app-product-related class=\"no-padding\" *ngIf=\"article?.relatedArticles && article?.relatedArticles.length > 0\"\r\n [externalSource]=\"externalSource\"\r\n [articles]=\"article?.relatedArticles\" [refType]=\"64\" [label]=\"'VARIANTS' | localize\"></app-product-related>\r\n </div>\r\n <div class=\"product-page-block-stock\">\r\n <app-product-stock class=\"no-padding\" [goodId]=\"article?.goodId\" (openStockEvent)=\"openStock()\"></app-product-stock>\r\n </div>\r\n <div class=\"product-page-block-delivery\">\r\n <app-product-delivery class=\"no-padding\" [stockAndDelivery]=\"stockAndDelivery\"></app-product-delivery>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"page-wrapper-content\">\r\n <div class=\"page-wrapper-left\">\r\n <app-product-info-tabs class=\"no-padding\" [article]=\"article\"></app-product-info-tabs>\r\n </div>\r\n <div class=\"page-wrapper-right\">\r\n <div class=\"product-page-block-related s-padding\">\r\n <app-product-related\r\n *ngIf=\"article?.relatedArticles && article?.relatedArticles.length > 0\"\r\n [externalSource]=\"externalSource\"\r\n [articles]=\"article?.relatedArticles\"\r\n [refType]=\"1\"\r\n [label]=\"'RELATED_PRODUCTS' | localize\">\r\n </app-product-related>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"page-wrapper-content no-top-margin\">\r\n <div class=\"page-wrapper-full\">\r\n <div class=\"product-page-block-alternatives s-padding\">\r\n <app-product-related\r\n *ngIf=\"article?.relatedArticles && article?.relatedArticles.length > 0\"\r\n [externalSource]=\"externalSource\"\r\n [articles]=\"article?.relatedArticles\"\r\n [refType]=\"4\"\r\n [isSmallModus]=\"false\"\r\n [label]=\"'ALTERNATIVE_PRODUCTS' | localize\">\r\n </app-product-related>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n\r\n <div *ngIf=\"showRelatedProductsPopup\">\r\n <co-product-dialog\r\n [mainArticle]=\"article\"\r\n [articles]=\"article?.relatedArticles\"\r\n [refType]=\"1\"\r\n (closeRelatedPopup)=\"handlePopUpChange($event)\"\r\n >\r\n </co-product-dialog>\r\n\r\n <!-- <app-product-related class=\"no-padding\" *ngIf=\"article?.relatedArticles && article?.relatedArticles.length > 0\"-->\r\n <!-- [articles]=\"article?.relatedArticles\" [refType]=\"64\" [label]=\"'VARIANTS' | localize\"></app-product-related>-->\r\n </div>\r\n\r\n\r\n </div>\r\n</ng-container>\r\n",
1878
+ template: "<ng-container *ngIf=\"settingsLoaded\">\r\n <div class=\"page-wrapper\">\r\n <div class=\"page-wrapper-content\">\r\n <div class=\"page-wrapper-left\">\r\n <div class=\"product-image-container\">\r\n <div class=\"product-page-block-selector-type\">\r\n <app-product-selector-type class=\"default-padding\"\r\n [(currentType)]=\"currentView\"\r\n [show2D]=\"configurable\"\r\n [show3D]=\"threeD\"\r\n ></app-product-selector-type>\r\n </div>\r\n <div class=\"product-page-block-image default-padding\" [class.full]=\"fullScreen\">\r\n\r\n <app-image-carousel\r\n *ngIf=\"!enableRenderCarousel\"\r\n [@toggleVisibilityByState]=\"show2D ? 'show' : 'hide'\"\r\n [images]=\"article?.images\"\r\n [showRefresh]=\"configurable && threeD\">\r\n </app-image-carousel>\r\n\r\n <app-render-carousel\r\n *ngIf=\"enableRenderCarousel\"\r\n [@toggleVisibilityByState]=\"show2D ? 'show' : 'hide'\"\r\n [article]=\"article\">\r\n </app-render-carousel>\r\n\r\n <ng-container *ngIf=\"settingsLoaded && this.configurable\">\r\n <threed-configurator\r\n #configurator\r\n class=\"threed-configurator\"\r\n [class.configurator-full-screen]=\"fullScreen\"\r\n [@toggleVisibilityByState]=\"show3D ? 'show' : 'hide'\"\r\n [@toggleFullScreen]=\"fullScreen ? 'fullscreen' : 'halfscreen'\">\r\n </threed-configurator>\r\n </ng-container>\r\n\r\n <co-icon #fullscreenbutton class=\"fullscreen-button\" *ngIf=\"show3D\"\r\n [@toggleTopLeft]=\"fullScreen ? 'fullscreen' : 'halfscreen'\"\r\n [iconData]=\"iconCache.getIcon(fullScreenIcon)\"\r\n (click)=\"showFullScreen()\"></co-icon>\r\n <co-icon class=\"threed-watermark\" *ngIf=\"show3D && fullScreen\"\r\n [iconData]=\"iconCache.getIcon(icon.Logo)\"></co-icon>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"page-wrapper-right\">\r\n <div class=\"product-page-block-description\">\r\n <app-product-description class=\"default-padding\" [article]=\"article\"></app-product-description>\r\n </div>\r\n <div class=\"product-page-block-additional\">\r\n <div class=\"product-page-block-additional-description\">\r\n <app-product-additional-description class=\"default-padding\" [article]=\"article\"></app-product-additional-description>\r\n </div>\r\n <div class=\"product-page-block-price\" [class.full]=\"configuring\">\r\n <app-product-price class=\"s-padding\" *ngIf=\"!configuring\"\r\n [pricing]=\"article?.pricing\"\r\n [configurable]=\"configurable\"\r\n ></app-product-price>\r\n <ng-container *ngIf=\"settingsLoaded\">\r\n <threed-selections #selections class=\"threed-selections\"\r\n [class.show-selections]=\"configuring\"\r\n [@toggleFullScreenRight]=\"fullScreen ? 'fullscreen' : 'halfscreen'\"\r\n [class.default-padding]=\"!fullScreen\"\r\n [class.show-full-screen]=\"fullScreen\"\r\n [class.mini-scrollbar]=\"fullScreen\"\r\n [sku]=\"sku\"\r\n [settings]=\"settings\"\r\n (onUserActionFromThreeD)=\"configuring = true\"\r\n (instanceSet)=\"setInstance($event)\"\r\n (onImageReceived)=\"appEventService.onImageReceived.next($event)\"\r\n (onRenderStarted)=\"appEventService.onRenderStarted.next()\"\r\n (onDraftRenderImageReceived)=\"appEventService.onDraftRenderImageReceived.next($event)\"\r\n (onArticleReceived)=\"appEventService.onArticleReceived.next($event.detail)\"\r\n (onSelectionsReceived)=\"appEventService.onSelectionsReceived.next($event.detail)\"\r\n (onArticleInfoReceived)=\"appEventService.onArticleInfoReceived.next($event.detail)\"\r\n (onAnswersAvailable)=\"appEventService.onAnswersAvailable.next($event.detail)\"\r\n (onReadyToRender)=\"appEventService.onReadyToRender.next($event.detail)\"\r\n (onRenderImageReceived)=\"appEventService.onRenderImageReceived.next($event.detail)\"\r\n ></threed-selections>\r\n </ng-container>\r\n </div>\r\n <div class=\"product-page-block-addtocart no-padding product-action-buttons\" *ngIf=\"!configuring\" [@toggleTopRight]=\"fullScreen ? 'fullscreen' : 'halfscreen'\">\r\n <app-product-addtocart\r\n [configurable]=\"configurable\"\r\n [createFrozenArticle]=\"createFrozenArticle\"\r\n [configuring]=\"configuring\"\r\n [showAddToCart]=\"showAddToCart\"\r\n [article]=\"article\"\r\n [externalSource]=\"externalSource\"\r\n [isReturn]=\"isReturn\"\r\n (startConfiguration)=\"handleStartConfiguration()\"\r\n (showRelatedPopup)=\"handlePopUpChange($event)\"\r\n ></app-product-addtocart>\r\n </div>\r\n <div class=\"addtocart-reserved product-action-buttons\" *ngIf=\"configuring\" [class.full-screen]=\"fullScreen\">\r\n <app-product-addtocart class=\"default-padding\"\r\n [configurable]=\"false\"\r\n [fullscreen]=\"fullScreen\"\r\n [showAddToCart]=\"showAddToCart\"\r\n [configuring]=\"configuring\"\r\n [article]=\"article\"\r\n [externalSource]=\"externalSource\"\r\n [isReturn]=\"isReturn\"\r\n (startConfiguration)=\"handleStartConfiguration()\"\r\n ></app-product-addtocart>\r\n </div>\r\n <div class=\"product-page-block-variants\">\r\n <app-product-related class=\"no-padding\" *ngIf=\"article?.relatedArticles && article?.relatedArticles.length > 0\"\r\n [externalSource]=\"externalSource\"\r\n [articles]=\"article?.relatedArticles\" [refType]=\"64\" [label]=\"'VARIANTS' | localize\"></app-product-related>\r\n </div>\r\n <div class=\"product-page-block-stock\">\r\n <app-product-stock class=\"no-padding\" [goodId]=\"article?.goodId\" (openStockEvent)=\"openStock()\"></app-product-stock>\r\n </div>\r\n <div class=\"product-page-block-delivery\">\r\n <app-product-delivery class=\"no-padding\" [stockAndDelivery]=\"stockAndDelivery\"></app-product-delivery>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"page-wrapper-content\">\r\n <div class=\"page-wrapper-left\" *ngIf=\"article\">\r\n <app-product-info-tabs class=\"no-padding\" [article]=\"article\"></app-product-info-tabs>\r\n </div>\r\n <div class=\"page-wrapper-right\">\r\n <div class=\"product-page-block-related s-padding\">\r\n <app-product-related\r\n *ngIf=\"article?.relatedArticles && article?.relatedArticles.length > 0\"\r\n [externalSource]=\"externalSource\"\r\n [articles]=\"article?.relatedArticles\"\r\n [refType]=\"1\"\r\n [label]=\"'RELATED_PRODUCTS' | localize\">\r\n </app-product-related>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"page-wrapper-content no-top-margin\">\r\n <div class=\"page-wrapper-full\">\r\n <div class=\"product-page-block-alternatives s-padding\">\r\n <app-product-related\r\n *ngIf=\"article?.relatedArticles && article?.relatedArticles.length > 0\"\r\n [externalSource]=\"externalSource\"\r\n [articles]=\"article?.relatedArticles\"\r\n [refType]=\"4\"\r\n [isSmallModus]=\"false\"\r\n [label]=\"'ALTERNATIVE_PRODUCTS' | localize\">\r\n </app-product-related>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n\r\n <div *ngIf=\"showRelatedProductsPopup\">\r\n <co-product-dialog\r\n [mainArticle]=\"article\"\r\n [articles]=\"article?.relatedArticles\"\r\n [refType]=\"1\"\r\n (closeRelatedPopup)=\"handlePopUpChange($event)\"\r\n >\r\n </co-product-dialog>\r\n\r\n <!-- <app-product-related class=\"no-padding\" *ngIf=\"article?.relatedArticles && article?.relatedArticles.length > 0\"-->\r\n <!-- [articles]=\"article?.relatedArticles\" [refType]=\"64\" [label]=\"'VARIANTS' | localize\"></app-product-related>-->\r\n </div>\r\n\r\n\r\n </div>\r\n</ng-container>\r\n",
1785
1879
  animations: [
1786
1880
  animations.trigger('toggleFullScreen', [
1787
1881
  animations.state('fullscreen', animations.style({ 'position': 'fixed', 'top': '0', 'left': '0', 'width': '100%', 'height': '100%' })),
@@ -1964,6 +2058,7 @@
1964
2058
  this._appEventService = _appEventService;
1965
2059
  this._changeDetector = _changeDetector;
1966
2060
  this._domSanitizer = _domSanitizer;
2061
+ this.isPopupOpen = false;
1967
2062
  this.showRefresh = false;
1968
2063
  this.resizing = false;
1969
2064
  this.imageViewModels = [];
@@ -1993,6 +2088,12 @@
1993
2088
  _this._changeDetector.detectChanges();
1994
2089
  }));
1995
2090
  }
2091
+ // Close on ESC
2092
+ ImageCarouselComponent.prototype.onEsc = function () {
2093
+ if (this.isPopupOpen) {
2094
+ this.closePopup();
2095
+ }
2096
+ };
1996
2097
  Object.defineProperty(ImageCarouselComponent.prototype, "images", {
1997
2098
  get: function () {
1998
2099
  return this._images;
@@ -2048,15 +2149,16 @@
2048
2149
  };
2049
2150
  ImageCarouselComponent.prototype.handleShowImage = function (imageViewModel) {
2050
2151
  if (imageViewModel && imageViewModel.originalSource) {
2051
- var popupWindow = window.open('', 'Image zoom', 'width=600,height=400');
2052
- // Set the content of the popup window
2053
- popupWindow.document.write('<html><head><title>Image zoom</title></head><body>');
2054
- popupWindow.document.write("<img src=" + imageViewModel.originalSource + " alt=\"Image\" style=\"width:100%; height:auto;\">");
2055
- popupWindow.document.write('</body></html>');
2056
- // Close the document to render the popup window
2057
- popupWindow.document.close();
2152
+ this.selectedImage = imageViewModel;
2153
+ this.isPopupOpen = true;
2154
+ this._changeDetector.markForCheck();
2058
2155
  }
2059
2156
  };
2157
+ ImageCarouselComponent.prototype.closePopup = function () {
2158
+ this.isPopupOpen = false;
2159
+ this.selectedImage = undefined;
2160
+ this._changeDetector.markForCheck();
2161
+ };
2060
2162
  ImageCarouselComponent.prototype._filterValidImages = function (value) {
2061
2163
  if (!value) {
2062
2164
  return [];
@@ -2101,39 +2203,54 @@
2101
2203
  ImageCarouselComponent.prototype._resizeAndSanitizeSource = function (source, imageViewModel) {
2102
2204
  var _this = this;
2103
2205
  var resizeCanvas = document.createElement('canvas');
2104
- var resizeCanvasContext = resizeCanvas.getContext('2d');
2105
- var resizeImage = document.createElement('img');
2106
- resizeImage.crossOrigin = 'anonymous';
2107
- resizeImage.onload = function () { return __awaiter(_this, void 0, void 0, function () {
2108
- var originalWidth, originalHeight, aspectRatio, newWidth, newHeight, imageWidth, resizedSource;
2109
- return __generator(this, function (_a) {
2110
- resizeCanvasContext.imageSmoothingEnabled = true;
2111
- resizeCanvasContext.imageSmoothingQuality = 'high';
2112
- originalWidth = resizeImage.width;
2113
- originalHeight = resizeImage.height;
2114
- aspectRatio = originalWidth / originalHeight;
2115
- newWidth = this._resizeCanvasHeight;
2116
- newHeight = this._resizeCanvasHeight;
2117
- if (originalWidth > originalHeight) {
2118
- newHeight = this._resizeCanvasHeight / aspectRatio;
2119
- }
2120
- else {
2121
- newWidth = this._resizeCanvasHeight * aspectRatio;
2122
- }
2123
- // Set the canvas size to the new width and height
2124
- resizeCanvas.width = newWidth;
2125
- resizeCanvas.height = newHeight;
2126
- imageWidth = this._resizeCanvasHeight * (resizeImage.height / resizeImage.width);
2127
- resizeCanvasContext.drawImage(resizeImage, 0, 0, newWidth, newHeight);
2128
- resizedSource = resizeCanvas.toDataURL('image/jpeg');
2129
- imageViewModel.source = this._domSanitizer.bypassSecurityTrustUrl(resizedSource);
2130
- imageViewModel.originalSource = source;
2131
- this._changeDetector.detectChanges();
2132
- return [2 /*return*/];
2133
- });
2134
- }); };
2135
- // @ts-ignore
2136
- resizeImage.src = source;
2206
+ var ctx = resizeCanvas.getContext('2d');
2207
+ var img = document.createElement('img');
2208
+ img.crossOrigin = 'anonymous';
2209
+ img.onload = function () {
2210
+ ctx.imageSmoothingEnabled = true;
2211
+ ctx.imageSmoothingQuality = 'high';
2212
+ var ow = img.width;
2213
+ var oh = img.height;
2214
+ var aspect = ow / oh;
2215
+ var newW = _this._resizeCanvasHeight;
2216
+ var newH = _this._resizeCanvasHeight;
2217
+ if (ow > oh) {
2218
+ newH = _this._resizeCanvasHeight / aspect;
2219
+ }
2220
+ else {
2221
+ newW = _this._resizeCanvasHeight * aspect;
2222
+ }
2223
+ resizeCanvas.width = Math.round(newW);
2224
+ resizeCanvas.height = Math.round(newH);
2225
+ // Ensure transparent background before drawing
2226
+ ctx.clearRect(0, 0, resizeCanvas.width, resizeCanvas.height);
2227
+ ctx.drawImage(img, 0, 0, resizeCanvas.width, resizeCanvas.height);
2228
+ var mime = _this._detectPreferredMime(source);
2229
+ var resizedSource = mime === 'image/jpeg'
2230
+ ? resizeCanvas.toDataURL('image/jpeg', 0.92) // only if original was JPEG
2231
+ : resizeCanvas.toDataURL(mime); // PNG/WebP keep alpha
2232
+ imageViewModel.source = _this._domSanitizer.bypassSecurityTrustUrl(resizedSource);
2233
+ imageViewModel.originalSource = source;
2234
+ _this._changeDetector.detectChanges();
2235
+ };
2236
+ img.src = source;
2237
+ };
2238
+ ImageCarouselComponent.prototype._detectPreferredMime = function (source) {
2239
+ // Data URI check
2240
+ var m = source.match(/^data:(image\/[a-zA-Z+.-]+);base64,/);
2241
+ if (m) {
2242
+ var t = m[1].toLowerCase();
2243
+ if (t === 'image/png' || t === 'image/webp' || t === 'image/jpeg')
2244
+ return t;
2245
+ }
2246
+ var lower = source.toLowerCase();
2247
+ if (lower.endsWith('.png'))
2248
+ return 'image/png';
2249
+ if (lower.endsWith('.webp'))
2250
+ return 'image/webp';
2251
+ if (lower.endsWith('.jpg') || lower.endsWith('.jpeg'))
2252
+ return 'image/jpeg';
2253
+ return 'image/png';
2137
2254
  };
2138
2255
  ImageCarouselComponent.prototype._scrollCarouselToIndex = function () {
2139
2256
  if (this.currentIndex > -1 && this.currentIndex <= this.images.length) {
@@ -2152,9 +2269,9 @@
2152
2269
  ImageCarouselComponent.decorators = [
2153
2270
  { type: i0.Component, args: [{
2154
2271
  selector: 'app-image-carousel',
2155
- template: "\n <div id=\"product_page_carousel\">\n <div id=\"product_page_carousel_items\">\n <co-loader [isShown]=\"true\" *ngIf=\"showLoader\"></co-loader>\n <div #carousel class=\"inner-carousel\">\n <!-- This has been taken out of the for loop to prevent flashing images when updating. -->\n <div *ngIf=\"imageViewModels[0]\" class=\"carousel-item\" [id]=\"'slide-0'\" [class.active]=\"isCurrentIndex(0)\" (click)=\"handleShowImage(imageViewModels[0])\">\n <img [src]=\"imageViewModels[0].source\">\n </div>\n <div *ngFor=\"let imageViewModel of imageViewModels.slice(1); let index = index\" class=\"carousel-item\"\n [id]=\"'slide-' + (index + 1)\" [class.active]=\"isCurrentIndex((index + 1))\" (click)=\"handleShowImage(imageViewModel)\">\n <img [src]=\"imageViewModel.source\">\n </div>\n <div class=\"carousel-scroller-layer\" *ngIf=\"imageViewModels && imageViewModels.length > 1\">\n <div class=\"carousel-item-scroller prev\" (click)=\"gotoPrevSlide()\" *ngIf=\"currentIndex > 0\"></div>\n <div class=\"carousel-item-scroller next\" (click)=\"gotoNextSlide()\" *ngIf=\"currentIndex < images.length - 1\"></div>\n </div>\n </div>\n <!--\n <co-icon class=\"selector-type-icon refresh-button\" [iconData]=\"iconCache.getIcon(icons.Refresh)\" (click)=\"onForceRenderImage()\" [class.loading]=\"showLoader\" *ngIf=\"showRefresh\"></co-icon>\n -->\n </div>\n\n <div id=\"product_page_carousel_thumbs\">\n <co-scroll-container class=\"scroll-container\" *ngIf=\"imageViewModels && imageViewModels.length > 1\">\n <div *ngFor=\"let imageViewModel of imageViewModels; let index = index\" class=\"carousel-thumb\"\n [class.active]=\"index === currentIndex\">\n <img [src]=\"imageViewModel.source\" (click)=\"handleThumbClick(index)\"/>\n </div>\n </co-scroll-container>\n </div>\n </div>\n ",
2272
+ template: "\n <div id=\"product_page_carousel\">\n <div id=\"product_page_carousel_items\">\n <co-loader [isShown]=\"true\" *ngIf=\"showLoader\"></co-loader>\n <div #carousel class=\"inner-carousel\">\n <!-- This has been taken out of the for loop to prevent flashing images when updating. -->\n <div *ngIf=\"imageViewModels[0]\" class=\"carousel-item\" [id]=\"'slide-0'\" [class.active]=\"isCurrentIndex(0)\" (click)=\"handleShowImage(imageViewModels[0])\">\n <img [src]=\"imageViewModels[0].source\">\n </div>\n <div *ngFor=\"let imageViewModel of imageViewModels.slice(1); let index = index\" class=\"carousel-item\"\n [id]=\"'slide-' + (index + 1)\" [class.active]=\"isCurrentIndex((index + 1))\" (click)=\"handleShowImage(imageViewModel)\">\n <img [src]=\"imageViewModel.source\">\n </div>\n <div class=\"carousel-scroller-layer\" *ngIf=\"imageViewModels && imageViewModels.length > 1\">\n <div class=\"carousel-item-scroller prev\" (click)=\"gotoPrevSlide()\" *ngIf=\"currentIndex > 0\"></div>\n <div class=\"carousel-item-scroller next\" (click)=\"gotoNextSlide()\" *ngIf=\"currentIndex < images.length - 1\"></div>\n </div>\n </div>\n <!--\n <co-icon class=\"selector-type-icon refresh-button\" [iconData]=\"iconCache.getIcon(icons.Refresh)\" (click)=\"onForceRenderImage()\" [class.loading]=\"showLoader\" *ngIf=\"showRefresh\"></co-icon>\n -->\n </div>\n\n <div id=\"product_page_carousel_thumbs\">\n <co-scroll-container class=\"scroll-container\" *ngIf=\"imageViewModels && imageViewModels.length > 1\">\n <div *ngFor=\"let imageViewModel of imageViewModels; let index = index\" class=\"carousel-thumb\"\n [class.active]=\"index === currentIndex\">\n <img [src]=\"imageViewModel.source\" (click)=\"handleThumbClick(index)\"/>\n </div>\n </co-scroll-container>\n </div>\n </div>\n <!-- Modal (real popup) -->\n <div\n class=\"image-modal\"\n *ngIf=\"isPopupOpen\"\n (click)=\"closePopup()\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Image preview\"\n >\n <div class=\"image-modal__content\" (click)=\"$event.stopPropagation()\">\n <button\n class=\"image-modal__close\"\n type=\"button\"\n aria-label=\"Close\"\n (click)=\"closePopup()\"\n >\n \u00D7\n </button>\n\n <img [src]=\"selectedImage?.originalSource\" alt=\"Image preview\" />\n </div>\n </div>\n ",
2156
2273
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
2157
- styles: [":host{max-height:540px;height:100%;position:relative}:host:not(.resizing) .inner-carousel{scroll-behavior:smooth;-webkit-overflow-scrolling:touch;scroll-snap-type:x mandatory}#product_page_carousel{position:relative}#product_page_carousel .refresh-button{position:absolute;bottom:10px;right:10px;background:#fff}#product_page_carousel .refresh-button.loading{animation:spin 1s linear infinite}#product_page_carousel .refresh-button:hover{box-shadow:none;background:#74B77F;transition:all .2s ease-in-out}#product_page_carousel .refresh-button:hover ::ng-deep svg path{fill:#fff!important}#product_page_carousel #product_page_carousel_items{position:relative;margin-bottom:10px}#product_page_carousel #product_page_carousel_items ::ng-deep co-loader{position:absolute}#product_page_carousel .inner-carousel{display:flex;flex-direction:row;align-items:center;overflow:hidden;max-height:500px;border:1px solid #efefef}#product_page_carousel .carousel-item{max-height:500px;width:100%;display:flex;cursor:zoom-in;flex-shrink:0;flex-grow:0}#product_page_carousel .carousel-item img{width:100%;height:auto;-o-object-fit:contain;object-fit:contain}#product_page_carousel .carousel-scroller-layer{height:100%;width:100%;position:absolute;pointer-events:none;top:0;left:0}#product_page_carousel #product_page_carousel_thumbs{display:flex;justify-content:flex-start;height:80px;margin-left:auto;margin-right:auto}#product_page_carousel #product_page_carousel_thumbs ::ng-deep co-scroll-container{padding:0 22px}#product_page_carousel #product_page_carousel_thumbs ::ng-deep co-scroll-container .content-wrapper{padding:0}#product_page_carousel #product_page_carousel_thumbs .carousel-thumb{opacity:1;cursor:pointer;transition:all .2s ease;padding:4px;border:1px solid #f6f5f4}#product_page_carousel #product_page_carousel_thumbs .carousel-thumb.active,#product_page_carousel #product_page_carousel_thumbs .carousel-thumb:hover{border-color:#22313c}#product_page_carousel #product_page_carousel_thumbs .carousel-thumb:not(:last-child){margin-right:10px}#product_page_carousel #product_page_carousel_thumbs .carousel-thumb img{height:68px}@media screen and (max-width: 650px){#product_page_carousel_thumbs{height:57px!important}#product_page_carousel_thumbs .carousel-thumb img{height:50px!important}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"]
2274
+ styles: [":host{max-height:540px;height:100%;position:relative}:host:not(.resizing) .inner-carousel{scroll-behavior:smooth;-webkit-overflow-scrolling:touch;scroll-snap-type:x mandatory}#product_page_carousel{position:relative}#product_page_carousel .refresh-button{position:absolute;bottom:10px;right:10px;background:#fff}#product_page_carousel .refresh-button.loading{animation:spin 1s linear infinite}#product_page_carousel .refresh-button:hover{box-shadow:none;background:#74B77F;transition:all .2s ease-in-out}#product_page_carousel .refresh-button:hover ::ng-deep svg path{fill:#fff!important}#product_page_carousel #product_page_carousel_items{position:relative;margin-bottom:10px}#product_page_carousel #product_page_carousel_items ::ng-deep co-loader{position:absolute}#product_page_carousel .inner-carousel{display:flex;flex-direction:row;align-items:center;overflow:hidden;max-height:500px;border:1px solid #efefef}#product_page_carousel .carousel-item{max-height:500px;width:100%;display:flex;cursor:zoom-in;flex-shrink:0;flex-grow:0}#product_page_carousel .carousel-item img{width:100%;height:auto;-o-object-fit:contain;object-fit:contain}#product_page_carousel .carousel-scroller-layer{height:100%;width:100%;position:absolute;pointer-events:none;top:0;left:0}#product_page_carousel #product_page_carousel_thumbs{display:flex;justify-content:flex-start;height:80px;margin-left:auto;margin-right:auto}#product_page_carousel #product_page_carousel_thumbs ::ng-deep co-scroll-container{padding:0 22px}#product_page_carousel #product_page_carousel_thumbs ::ng-deep co-scroll-container .content-wrapper{padding:0}#product_page_carousel #product_page_carousel_thumbs .carousel-thumb{opacity:1;cursor:pointer;transition:all .2s ease;padding:4px;border:1px solid #f6f5f4}#product_page_carousel #product_page_carousel_thumbs .carousel-thumb.active,#product_page_carousel #product_page_carousel_thumbs .carousel-thumb:hover{border-color:#22313c}#product_page_carousel #product_page_carousel_thumbs .carousel-thumb:not(:last-child){margin-right:10px}#product_page_carousel #product_page_carousel_thumbs .carousel-thumb img{height:68px}.image-modal{position:fixed;inset:0;background:rgba(0,0,0,.8);display:flex;align-items:center;justify-content:center;z-index:1000}.image-modal__content{position:relative;max-width:90vw;max-height:90vh}.image-modal__content img{max-width:90vw;max-height:90vh;-o-object-fit:contain;object-fit:contain;display:block}.image-modal__close{position:fixed;top:15px;right:30px;background:transparent;border:none;color:#fff;font-size:60px;line-height:1;cursor:pointer}@media screen and (max-width: 650px){#product_page_carousel_thumbs{height:57px!important}#product_page_carousel_thumbs .carousel-thumb img{height:50px!important}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"]
2158
2275
  },] }
2159
2276
  ];
2160
2277
  ImageCarouselComponent.ctorParameters = function () { return [
@@ -2165,6 +2282,7 @@
2165
2282
  ]; };
2166
2283
  ImageCarouselComponent.propDecorators = {
2167
2284
  carousel: [{ type: i0.ViewChild, args: ['carousel', { read: i0.ElementRef },] }],
2285
+ onEsc: [{ type: i0.HostListener, args: ['document:keydown.escape',] }],
2168
2286
  showRefresh: [{ type: i0.Input }],
2169
2287
  images: [{ type: i0.Input }],
2170
2288
  handleWindowResize: [{ type: i0.HostListener, args: ['window:resize',] }],
@@ -2469,12 +2587,12 @@
2469
2587
  };
2470
2588
  ProductAddtocartComponent.prototype.handleAddToCartClick = function (quantity) {
2471
2589
  return __awaiter(this, void 0, void 0, function () {
2472
- var article, generatedGoodId, articleFull, article, article, article;
2590
+ var article, article, article;
2473
2591
  return __generator(this, function (_a) {
2474
2592
  switch (_a.label) {
2475
2593
  case 0:
2476
- if (!this.createFrozenArticle) return [3 /*break*/, 11];
2477
- if (!(this.article.goodType === 'B')) return [3 /*break*/, 6];
2594
+ if (!this.createFrozenArticle) return [3 /*break*/, 10];
2595
+ if (!(this.article.goodType === 'B')) return [3 /*break*/, 5];
2478
2596
  if (!this.article.isConfigurable) return [3 /*break*/, 2];
2479
2597
  return [4 /*yield*/, this._getJSONFromArticleObject({ article: this.article, quantity: quantity })];
2480
2598
  case 1:
@@ -2482,39 +2600,41 @@
2482
2600
  if (article) {
2483
2601
  this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
2484
2602
  }
2485
- return [3 /*break*/, 5];
2486
- case 2: return [4 /*yield*/, this._getGeneratedArtDirectly(this.article.goodId)];
2603
+ return [3 /*break*/, 4];
2604
+ case 2: return [4 /*yield*/, this._handleGeneratedArticleDirectly(quantity)];
2487
2605
  case 3:
2488
- generatedGoodId = _a.sent();
2489
- if (!generatedGoodId) return [3 /*break*/, 5];
2490
- return [4 /*yield*/, this._productConnectorAdapterService.getArticleFullObject(generatedGoodId, true)];
2491
- case 4:
2492
- articleFull = _a.sent();
2493
- article = this._ioneControllerService.convertArticleFullObjectToArticleExtended(articleFull);
2494
- this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
2495
- _a.label = 5;
2496
- case 5: return [3 /*break*/, 10];
2497
- case 6:
2606
+ _a.sent();
2607
+ _a.label = 4;
2608
+ case 4: return [3 /*break*/, 9];
2609
+ case 5:
2498
2610
  article = void 0;
2499
- if (!!!this.externalSource) return [3 /*break*/, 8];
2611
+ if (!!!this.externalSource) return [3 /*break*/, 7];
2500
2612
  return [4 /*yield*/, this._getJSONFromArticleObject({ article: this.article, quantity: quantity })];
2501
- case 7:
2613
+ case 6:
2502
2614
  article = _a.sent();
2503
- return [3 /*break*/, 9];
2504
- case 8:
2615
+ return [3 /*break*/, 8];
2616
+ case 7:
2505
2617
  article = this._ioneControllerService.convertArticleFullObjectToArticleExtended(this.article);
2506
- _a.label = 9;
2507
- case 9:
2618
+ _a.label = 8;
2619
+ case 8:
2508
2620
  if (article) {
2509
2621
  this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
2510
2622
  }
2511
- _a.label = 10;
2512
- case 10: return [3 /*break*/, 12];
2623
+ _a.label = 9;
2624
+ case 9: return [3 /*break*/, 14];
2625
+ case 10:
2626
+ if (!(this.article.goodType === 'B')) return [3 /*break*/, 13];
2627
+ if (!!this.article.isConfigurable) return [3 /*break*/, 12];
2628
+ return [4 /*yield*/, this._handleGeneratedArticleDirectly(quantity)];
2513
2629
  case 11:
2630
+ _a.sent();
2631
+ _a.label = 12;
2632
+ case 12: return [3 /*break*/, 14];
2633
+ case 13:
2514
2634
  article = this._ioneControllerService.convertArticleFullObjectToArticleExtended(this.article);
2515
2635
  this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
2516
- _a.label = 12;
2517
- case 12: return [2 /*return*/];
2636
+ _a.label = 14;
2637
+ case 14: return [2 /*return*/];
2518
2638
  }
2519
2639
  });
2520
2640
  });
@@ -2534,6 +2654,36 @@
2534
2654
  });
2535
2655
  });
2536
2656
  };
2657
+ ProductAddtocartComponent.prototype._handleGeneratedArticleDirectly = function (quantity) {
2658
+ return __awaiter(this, void 0, void 0, function () {
2659
+ var generatedGoodId, articleFull, article;
2660
+ return __generator(this, function (_a) {
2661
+ switch (_a.label) {
2662
+ case 0: return [4 /*yield*/, this._getGeneratedArtDirectly(this.article.goodId)];
2663
+ case 1:
2664
+ generatedGoodId = _a.sent();
2665
+ if (!generatedGoodId) return [3 /*break*/, 3];
2666
+ return [4 /*yield*/, this._productConnectorAdapterService.getArticleFullObject(generatedGoodId, true)];
2667
+ case 2:
2668
+ articleFull = _a.sent();
2669
+ article = this._ioneControllerService.convertArticleFullObjectToArticleExtended(articleFull);
2670
+ this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
2671
+ _a.label = 3;
2672
+ case 3: return [2 /*return*/];
2673
+ }
2674
+ });
2675
+ });
2676
+ };
2677
+ ProductAddtocartComponent.prototype._getGeneratedArtDirectly = function (goodId) {
2678
+ return __awaiter(this, void 0, void 0, function () {
2679
+ return __generator(this, function (_a) {
2680
+ switch (_a.label) {
2681
+ case 0: return [4 /*yield*/, this._ioneControllerService.getGeneratedArtDirectly(goodId, true)];
2682
+ case 1: return [2 /*return*/, _a.sent()];
2683
+ }
2684
+ });
2685
+ });
2686
+ };
2537
2687
  ProductAddtocartComponent.prototype._getJSONFromArticleObject = function (article) {
2538
2688
  return __awaiter(this, void 0, void 0, function () {
2539
2689
  var configuratorStatistics;
@@ -2553,16 +2703,6 @@
2553
2703
  });
2554
2704
  });
2555
2705
  };
2556
- ProductAddtocartComponent.prototype._getGeneratedArtDirectly = function (goodId) {
2557
- return __awaiter(this, void 0, void 0, function () {
2558
- return __generator(this, function (_a) {
2559
- switch (_a.label) {
2560
- case 0: return [4 /*yield*/, this._ioneControllerService.getGeneratedArtDirectly(goodId, true)];
2561
- case 1: return [2 /*return*/, _a.sent()];
2562
- }
2563
- });
2564
- });
2565
- };
2566
2706
  return ProductAddtocartComponent;
2567
2707
  }());
2568
2708
  ProductAddtocartComponent.decorators = [
@@ -2978,7 +3118,7 @@
2978
3118
  this.updateHeight(tabIndex);
2979
3119
  };
2980
3120
  ProductInfoTabsComponent.prototype.updateHeight = function (tabIndex) {
2981
- if (this.tabContent.nativeElement.children.length > 0) {
3121
+ if (this.tabContent && this.tabContent.nativeElement.children.length > 0) {
2982
3122
  if (this.tabContent.nativeElement.children[tabIndex] !== undefined) {
2983
3123
  this.activeTabHeight = this.tabContent.nativeElement.children[tabIndex].offsetHeight;
2984
3124
  }
@@ -4106,6 +4246,7 @@
4106
4246
  exports["ɵbp"] = ProductHdModule;
4107
4247
  exports["ɵbq"] = ProductHdComponent;
4108
4248
  exports["ɵbr"] = ProductScriptLoaderService;
4249
+ exports["ɵbs"] = LocalStorageService;
4109
4250
  exports["ɵc"] = PipeModule;
4110
4251
  exports["ɵd"] = LocalizePipe;
4111
4252
  exports["ɵe"] = DictionaryService;