@colijnit/product 258.1.4 → 259.1.0

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 = "259.1.0";
35
+ this.publishDate = "7/9/2025, 9:58:59 AM";
36
36
  }
37
37
  return Version;
38
38
  }());
@@ -514,265 +514,6 @@
514
514
  __disposeResources: __disposeResources,
515
515
  };
516
516
 
517
- var ProductEventService = /** @class */ (function () {
518
- function ProductEventService() {
519
- this.onAddToCart = new rxjs.Subject();
520
- this.onAlternativeClick = new rxjs.Subject();
521
- this.onAddToQuote = new rxjs.Subject();
522
- this.onForceRenderImage = new rxjs.Subject();
523
- this.onArticleReceived = new rxjs.Subject();
524
- this.onSelectionsReceived = new rxjs.Subject();
525
- this.onImageReceived = new rxjs.Subject();
526
- this.onRenderStarted = new rxjs.Subject();
527
- this.onRenderImageReceived = new rxjs.Subject();
528
- this.onDraftRenderImageReceived = new rxjs.Subject();
529
- this.onArticleInfoReceived = new rxjs.Subject();
530
- this.onAnswersAvailable = new rxjs.Subject();
531
- this.onReadyToRender = new rxjs.Subject();
532
- this.onUpdateProductInfoTab = new rxjs.Subject();
533
- this.errorMessage = new rxjs.Subject();
534
- this.onGetRenderForRenderCarousel = new rxjs.Subject();
535
- }
536
- return ProductEventService;
537
- }());
538
- ProductEventService.decorators = [
539
- { type: i0.Directive },
540
- { type: i0.Injectable }
541
- ];
542
-
543
- var JsonUtilsService = /** @class */ (function () {
544
- function JsonUtilsService() {
545
- }
546
- JsonUtilsService.prototype.readJsonFile = function (filePath) {
547
- return __awaiter(this, void 0, void 0, function () {
548
- var response, e_1;
549
- return __generator(this, function (_a) {
550
- switch (_a.label) {
551
- case 0:
552
- _a.trys.push([0, 2, , 3]);
553
- return [4 /*yield*/, fetch(filePath)];
554
- case 1:
555
- response = _a.sent();
556
- if (!response.ok) {
557
- return [2 /*return*/, null];
558
- }
559
- else {
560
- return [2 /*return*/, response.json()];
561
- }
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*/];
568
- }
569
- });
570
- });
571
- };
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
517
  var SettingsOptions = /** @class */ (function () {
777
518
  function SettingsOptions() {
778
519
  this.showStockStatus = false;
@@ -818,196 +559,238 @@
818
559
  return ProductSettings;
819
560
  }(options.Options));
820
561
 
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);
562
+ var ProductEventService = /** @class */ (function () {
563
+ function ProductEventService() {
564
+ this.onAddToCart = new rxjs.Subject();
565
+ this.onAlternativeClick = new rxjs.Subject();
566
+ this.onAddToQuote = new rxjs.Subject();
567
+ this.onForceRenderImage = new rxjs.Subject();
568
+ this.onArticleReceived = new rxjs.Subject();
569
+ this.onSelectionsReceived = new rxjs.Subject();
570
+ this.onImageReceived = new rxjs.Subject();
571
+ this.onRenderStarted = new rxjs.Subject();
572
+ this.onRenderImageReceived = new rxjs.Subject();
573
+ this.onDraftRenderImageReceived = new rxjs.Subject();
574
+ this.onArticleInfoReceived = new rxjs.Subject();
575
+ this.onAnswersAvailable = new rxjs.Subject();
576
+ this.onReadyToRender = new rxjs.Subject();
577
+ this.onUpdateProductInfoTab = new rxjs.Subject();
578
+ this.errorMessage = new rxjs.Subject();
579
+ this.onGetRenderForRenderCarousel = new rxjs.Subject();
826
580
  }
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; }
581
+ return ProductEventService;
582
+ }());
583
+ ProductEventService.decorators = [
584
+ { type: i0.Directive },
585
+ { type: i0.Injectable }
586
+ ];
587
+
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 = [];
596
+ }
597
+ ProductConnectorAdapterService.prototype.ngOnDestroy = function () {
598
+ this._subs.forEach(function (s) { return s.unsubscribe(); });
599
+ };
600
+ ProductConnectorAdapterService.prototype.initConnector = function (options) {
839
601
  return __awaiter(this, void 0, void 0, function () {
840
- var jsonSettings;
602
+ var _this = this;
841
603
  return __generator(this, function (_a) {
842
604
  switch (_a.label) {
843
605
  case 0:
844
- if (!(typeof settings === 'undefined')) return [3 /*break*/, 2];
845
- return [4 /*yield*/, this._jsonUtilsService.readJsonFile('product-settings.json')];
606
+ this.articleConnector = new articles.Articles(options);
607
+ return [4 /*yield*/, this.articleConnector.connect()];
846
608
  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
- }
854
- }
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();
861
- }
862
- _a.label = 3;
863
- case 3: return [2 /*return*/];
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*/];
864
615
  }
865
616
  });
866
617
  });
867
618
  };
868
- ProductSettingsService.prototype.createSettingsFromObject = function (obj) {
619
+ ProductConnectorAdapterService.prototype.setInstance = function (instanceId) {
620
+ // this.articleConnector.setInstanceToConfigure(instanceId, false);
621
+ };
622
+ ProductConnectorAdapterService.prototype.getProductBundleSettings = function (url, upId) {
869
623
  return __awaiter(this, void 0, void 0, function () {
870
- var ownOptions, ownRenderParameters;
624
+ var tempSettings, tempMainConnector, response;
871
625
  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);
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)];
633
+ case 1:
634
+ response = _a.sent();
635
+ if (response) {
636
+ return [2 /*return*/, response.productSettings];
637
+ }
638
+ return [2 /*return*/, ""];
883
639
  }
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;
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];
890
660
  }
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
- }
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 {
676
+ return [2 /*return*/, null];
677
+ }
678
+ return [2 /*return*/];
896
679
  }
897
- this.settingsFinished();
898
- return [2 /*return*/];
899
680
  });
900
681
  });
901
682
  };
902
- ProductSettingsService.prototype.settingsFinished = function () {
683
+ ProductConnectorAdapterService.prototype.getArtStockStatus = function (goodId) {
903
684
  return __awaiter(this, void 0, void 0, function () {
685
+ var response;
904
686
  return __generator(this, function (_a) {
905
687
  switch (_a.label) {
906
- case 0: return [4 /*yield*/, this._dictionaryService.setDictionary(this.settings.languageCode)];
688
+ case 0: return [4 /*yield*/, this.articleConnector.getArtStockStatus(goodId)];
907
689
  case 1:
908
- _a.sent();
909
- this.settingsLoaded.next(true);
690
+ response = _a.sent();
691
+ if (response && response.validationResult && response.validationResult.success) {
692
+ return [2 /*return*/, response.resultObject];
693
+ }
694
+ else {
695
+ return [2 /*return*/, null];
696
+ }
910
697
  return [2 /*return*/];
911
698
  }
912
699
  });
913
700
  });
914
701
  };
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(); });
702
+ ProductConnectorAdapterService.prototype.getDeliveryDate2 = function (goodId) {
703
+ return __awaiter(this, void 0, void 0, function () {
704
+ var response;
705
+ return __generator(this, function (_a) {
706
+ switch (_a.label) {
707
+ case 0: return [4 /*yield*/, this.articleConnector.getDeliveryDate2(goodId)];
708
+ case 1:
709
+ response = _a.sent();
710
+ if (response && response.validationResult && response.validationResult.success) {
711
+ return [2 /*return*/, this._boFactory.makeWithRawBackendData(deliveryPrognosis.DeliveryPrognosis, response.resultObject)];
712
+ }
713
+ else {
714
+ return [2 /*return*/, null];
715
+ }
716
+ return [2 /*return*/];
717
+ }
718
+ });
719
+ });
936
720
  };
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; }
743
+ return __awaiter(this, void 0, void 0, function () {
744
+ var _this = this;
745
+ return __generator(this, function (_a) {
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
+ })];
750
+ });
751
+ });
752
+ };
753
+ ProductConnectorAdapterService.prototype.getGeneratedArtDirectly = function (goodId, showLoader) {
960
754
  return __awaiter(this, void 0, void 0, function () {
961
- var tempSettings, tempMainConnector, response;
755
+ var _this = this;
962
756
  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
- }
757
+ return [2 /*return*/, this.articleConnector.getGeneratedArtDirectly(goodId, showLoader).catch(function (messages) {
758
+ _this._eventService.errorMessage.next(messages);
759
+ return null;
760
+ })];
977
761
  });
978
762
  });
979
763
  };
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) {
764
+ ProductConnectorAdapterService.prototype.getGoodIdFromArticleNr = function (sku) {
986
765
  return __awaiter(this, void 0, void 0, function () {
987
- var deliveryPrognosis;
766
+ var response;
988
767
  return __generator(this, function (_a) {
989
768
  switch (_a.label) {
990
- case 0: return [4 /*yield*/, this.getSelectorDeliveryDate()];
769
+ case 0: return [4 /*yield*/, this.articleConnector.getGoodIdFromArticleNr(sku)];
991
770
  case 1:
992
- deliveryPrognosis = _a.sent();
993
- if (!deliveryPrognosis || !deliveryPrognosis.returnValue) {
994
- return [2 /*return*/, this.getDeliveryDate2(goodId)];
771
+ response = _a.sent();
772
+ if (response && response.validationResult && response.validationResult.success) {
773
+ return [2 /*return*/, response.resultObject];
995
774
  }
996
- return [2 /*return*/, deliveryPrognosis];
775
+ else {
776
+ return [2 /*return*/, null];
777
+ }
778
+ return [2 /*return*/];
997
779
  }
998
780
  });
999
781
  });
1000
782
  };
1001
- ProductConnectorAdapterService.prototype.getSelectorDeliveryDate = function () {
783
+ ProductConnectorAdapterService.prototype.getArticleFullObject = function (goodId, showLoader) {
784
+ if (showLoader === void 0) { showLoader = true; }
1002
785
  return __awaiter(this, void 0, void 0, function () {
1003
786
  var response;
1004
787
  return __generator(this, function (_a) {
1005
788
  switch (_a.label) {
1006
- case 0: return [4 /*yield*/, this.articleConnector.getSelectorDeliveryDate()];
789
+ case 0: return [4 /*yield*/, this.articleConnector.getArticleFullObject(goodId, showLoader)];
1007
790
  case 1:
1008
791
  response = _a.sent();
1009
792
  if (response && response.validationResult && response.validationResult.success) {
1010
- return [2 /*return*/, this._boFactory.makeWithRawBackendData(deliveryPrognosis.DeliveryPrognosis, response.resultObject)];
793
+ return [2 /*return*/, this._boFactory.makeWithRawBackendData(articleFullObject.ArticleFullObject, response.resultObject)];
1011
794
  }
1012
795
  else {
1013
796
  return [2 /*return*/, null];
@@ -1017,16 +800,16 @@
1017
800
  });
1018
801
  });
1019
802
  };
1020
- ProductConnectorAdapterService.prototype.getArtStockStatus = function (goodId) {
803
+ ProductConnectorAdapterService.prototype.getSuperArticle = function (id, branch) {
1021
804
  return __awaiter(this, void 0, void 0, function () {
1022
805
  var response;
1023
806
  return __generator(this, function (_a) {
1024
807
  switch (_a.label) {
1025
- case 0: return [4 /*yield*/, this.articleConnector.getArtStockStatus(goodId)];
808
+ case 0: return [4 /*yield*/, this.articleConnector.getSuperArticleQuickSel(id, branch)];
1026
809
  case 1:
1027
810
  response = _a.sent();
1028
811
  if (response && response.validationResult && response.validationResult.success) {
1029
- return [2 /*return*/, response.resultObject];
812
+ return [2 /*return*/, this._boFactory.makeWithRawBackendData(superArticle.SuperArticle, response.resultObject)];
1030
813
  }
1031
814
  else {
1032
815
  return [2 /*return*/, null];
@@ -1036,16 +819,17 @@
1036
819
  });
1037
820
  });
1038
821
  };
1039
- ProductConnectorAdapterService.prototype.getDeliveryDate2 = function (goodId) {
822
+ ProductConnectorAdapterService.prototype.getDocumentContent = function (docId, thumbnail) {
823
+ if (thumbnail === void 0) { thumbnail = true; }
1040
824
  return __awaiter(this, void 0, void 0, function () {
1041
825
  var response;
1042
826
  return __generator(this, function (_a) {
1043
827
  switch (_a.label) {
1044
- case 0: return [4 /*yield*/, this.articleConnector.getDeliveryDate2(goodId)];
828
+ case 0: return [4 /*yield*/, this.articleConnector.getDocumentContent(docId, thumbnail)];
1045
829
  case 1:
1046
830
  response = _a.sent();
1047
831
  if (response && response.validationResult && response.validationResult.success) {
1048
- return [2 /*return*/, this._boFactory.makeWithRawBackendData(deliveryPrognosis.DeliveryPrognosis, response.resultObject)];
832
+ return [2 /*return*/, this._boFactory.makeWithRawBackendData(documentContent.DocumentContent, response.resultObject)];
1049
833
  }
1050
834
  else {
1051
835
  return [2 /*return*/, null];
@@ -1055,151 +839,367 @@
1055
839
  });
1056
840
  });
1057
841
  };
1058
- ProductConnectorAdapterService.prototype.getJsonConfiguredArticles = function (configuratorStatistics) {
842
+ ProductConnectorAdapterService.prototype.addWebSessionTransactionLine = function (transactionUuid, sku, quantity) {
1059
843
  return __awaiter(this, void 0, void 0, function () {
1060
- var response;
844
+ var response, infoResponse;
1061
845
  return __generator(this, function (_a) {
1062
846
  switch (_a.label) {
1063
- case 0: return [4 /*yield*/, this.articleConnector.getJsonConfiguredArticles(configuratorStatistics)];
847
+ case 0: return [4 /*yield*/, this.transactionConnector.addWebSessionTransactionLine(transactionUuid, sku, quantity)];
1064
848
  case 1:
1065
849
  response = _a.sent();
1066
850
  if (response && response.validationResult && response.validationResult.success) {
1067
- return [2 /*return*/, response.resultObject];
851
+ infoResponse = this._boFactory.makeWithRawBackendData(transactionInfoResponse_bo.TransactionInfoResponse, response.resultObject);
852
+ return [2 /*return*/, infoResponse.transactionInfo.uuid];
853
+ }
854
+ return [2 /*return*/, ""];
855
+ }
856
+ });
857
+ });
858
+ };
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) {
872
+ return __awaiter(this, void 0, void 0, function () {
873
+ var response, e_1;
874
+ return __generator(this, function (_a) {
875
+ switch (_a.label) {
876
+ case 0:
877
+ _a.trys.push([0, 2, , 3]);
878
+ return [4 /*yield*/, fetch(filePath)];
879
+ case 1:
880
+ response = _a.sent();
881
+ if (!response.ok) {
882
+ return [2 /*return*/, null];
1068
883
  }
1069
884
  else {
1070
- return [2 /*return*/, ''];
885
+ return [2 /*return*/, response.json()];
1071
886
  }
1072
- 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*/];
1073
893
  }
1074
894
  });
1075
895
  });
1076
896
  };
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; }
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) {
1080
1045
  return __awaiter(this, void 0, void 0, function () {
1081
- var _this = this;
1046
+ var dictionary;
1082
1047
  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
- })];
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
+ }
1054
+ }
1055
+ return [2 /*return*/];
1087
1056
  });
1088
1057
  });
1089
1058
  };
1090
- ProductConnectorAdapterService.prototype.getGeneratedArtDirectly = function (goodId, showLoader) {
1091
- return __awaiter(this, void 0, void 0, function () {
1092
- var _this = this;
1093
- 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
- })];
1098
- });
1099
- });
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;
1100
1087
  };
1101
- ProductConnectorAdapterService.prototype.getGoodIdFromArticleNr = function (sku) {
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; }
1102
1119
  return __awaiter(this, void 0, void 0, function () {
1103
- var response;
1120
+ var jsonSettings;
1104
1121
  return __generator(this, function (_a) {
1105
1122
  switch (_a.label) {
1106
- case 0: return [4 /*yield*/, this.articleConnector.getGoodIdFromArticleNr(sku)];
1123
+ case 0:
1124
+ if (!(typeof settings === 'undefined')) return [3 /*break*/, 2];
1125
+ return [4 /*yield*/, this._jsonUtilsService.readJsonFile('product-settings.json')];
1107
1126
  case 1:
1108
- response = _a.sent();
1109
- if (response && response.validationResult && response.validationResult.success) {
1110
- return [2 /*return*/, 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
+ }
1111
1134
  }
1112
- else {
1113
- 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();
1114
1141
  }
1115
- return [2 /*return*/];
1142
+ _a.label = 3;
1143
+ case 3: return [2 /*return*/];
1116
1144
  }
1117
1145
  });
1118
1146
  });
1119
1147
  };
1120
- ProductConnectorAdapterService.prototype.getArticleFullObject = function (goodId, showLoader) {
1121
- if (showLoader === void 0) { showLoader = true; }
1148
+ ProductSettingsService.prototype.createSettingsFromObject = function (obj) {
1122
1149
  return __awaiter(this, void 0, void 0, function () {
1123
- var response;
1150
+ var ownOptions, ownRenderParameters;
1124
1151
  return __generator(this, function (_a) {
1125
- switch (_a.label) {
1126
- case 0: return [4 /*yield*/, this.articleConnector.getArticleFullObject(goodId, showLoader)];
1127
- 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)];
1131
- }
1132
- else {
1133
- return [2 /*return*/, null];
1134
- }
1135
- return [2 /*return*/];
1152
+ if (!this.settings) {
1153
+ this.settings = new ProductSettings();
1136
1154
  }
1137
- });
1138
- });
1139
- };
1140
- ProductConnectorAdapterService.prototype.getSuperArticle = function (id, branch) {
1141
- return __awaiter(this, void 0, void 0, function () {
1142
- var response;
1143
- 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*/];
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);
1155
1160
  }
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*/];
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.
@@ -1342,8 +1342,51 @@
1342
1342
  { type: ProductSettingsService }
1343
1343
  ]; };
1344
1344
 
1345
+ var RootStorageObject = /** @class */ (function () {
1346
+ function RootStorageObject() {
1347
+ }
1348
+ return RootStorageObject;
1349
+ }());
1350
+ var LocalStorageService = /** @class */ (function () {
1351
+ function LocalStorageService() {
1352
+ this.storage = localStorage;
1353
+ this._appRoot = "web-order";
1354
+ this._storageObj = new RootStorageObject();
1355
+ this._initLocalStorageObj();
1356
+ }
1357
+ LocalStorageService.prototype.save = function () {
1358
+ this.storage.setItem(this._appRoot, JSON.stringify(this._storageObj));
1359
+ };
1360
+ LocalStorageService.prototype.clear = function () {
1361
+ this.storage.clear();
1362
+ };
1363
+ Object.defineProperty(LocalStorageService.prototype, "id", {
1364
+ get: function () {
1365
+ return this._storageObj ? this._storageObj.id : "";
1366
+ },
1367
+ set: function (id) {
1368
+ this._storageObj.id = id;
1369
+ this.save();
1370
+ },
1371
+ enumerable: false,
1372
+ configurable: true
1373
+ });
1374
+ LocalStorageService.prototype._initLocalStorageObj = function () {
1375
+ this._storageObj = JSON.parse(this.storage.getItem(this._appRoot)) || this._storageObj;
1376
+ this.save();
1377
+ };
1378
+ return LocalStorageService;
1379
+ }());
1380
+ LocalStorageService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalStorageService_Factory() { return new LocalStorageService(); }, token: LocalStorageService, providedIn: "root" });
1381
+ LocalStorageService.decorators = [
1382
+ { type: i0.Injectable, args: [{
1383
+ providedIn: 'root'
1384
+ },] }
1385
+ ];
1386
+ LocalStorageService.ctorParameters = function () { return []; };
1387
+
1345
1388
  var IoneProductComponent = /** @class */ (function () {
1346
- function IoneProductComponent(_appEventService, _settingsService) {
1389
+ function IoneProductComponent(_appEventService, _settingsService, _productConnectorService, _localStorageService) {
1347
1390
  var _this = this;
1348
1391
  // this.sku = 'CF-HILL';
1349
1392
  // this.sku = 'CF-ALMADA';
@@ -1362,8 +1405,11 @@
1362
1405
  // this.sku = "1000612725";
1363
1406
  this._appEventService = _appEventService;
1364
1407
  this._settingsService = _settingsService;
1408
+ this._productConnectorService = _productConnectorService;
1409
+ this._localStorageService = _localStorageService;
1365
1410
  this.enableRenderCarousel = false;
1366
1411
  this.handleAddArticleInternally = true;
1412
+ this.handleAddToCartInternally = false;
1367
1413
  this.onAddToCart = new i0.EventEmitter();
1368
1414
  this.forceRenderImage = new i0.EventEmitter();
1369
1415
  this.getRenderForRenderCarousel = new i0.EventEmitter();
@@ -1426,9 +1472,41 @@
1426
1472
  };
1427
1473
  IoneProductComponent.prototype._handleAddToCart = function (data) {
1428
1474
  return __awaiter(this, void 0, void 0, function () {
1475
+ var article, transactionId, transactionId;
1429
1476
  return __generator(this, function (_a) {
1430
- this.onAddToCart.emit(data);
1431
- return [2 /*return*/];
1477
+ switch (_a.label) {
1478
+ case 0:
1479
+ if (!this.handleAddToCartInternally) return [3 /*break*/, 7];
1480
+ if (!(data && data.article)) return [3 /*break*/, 6];
1481
+ if (!(typeof data.article === 'string')) return [3 /*break*/, 3];
1482
+ article = JSON.parse(data.article);
1483
+ if (!(article.selectorData && article.selectorData.compositions)) return [3 /*break*/, 2];
1484
+ return [4 /*yield*/, this._productConnectorService.addWebSessionTransactionLine(this._localStorageService.id, article.selectorData.compositions[0].compositionArticleNo, data.quantity)];
1485
+ case 1:
1486
+ transactionId = _a.sent();
1487
+ if (transactionId) {
1488
+ this._localStorageService.id = transactionId;
1489
+ }
1490
+ _a.label = 2;
1491
+ case 2: return [3 /*break*/, 5];
1492
+ case 3:
1493
+ if (!data.article.hasOwnProperty('articleNr')) return [3 /*break*/, 5];
1494
+ return [4 /*yield*/, this._productConnectorService.addWebSessionTransactionLine(this._localStorageService.id, data.article['articleNr'], data.quantity)];
1495
+ case 4:
1496
+ transactionId = _a.sent();
1497
+ if (transactionId) {
1498
+ this._localStorageService.id = transactionId;
1499
+ }
1500
+ _a.label = 5;
1501
+ case 5:
1502
+ this.onAddToCart.next(data);
1503
+ _a.label = 6;
1504
+ case 6: return [3 /*break*/, 8];
1505
+ case 7:
1506
+ this.onAddToCart.emit(data);
1507
+ _a.label = 8;
1508
+ case 8: return [2 /*return*/];
1509
+ }
1432
1510
  });
1433
1511
  });
1434
1512
  };
@@ -1453,7 +1531,9 @@
1453
1531
  ];
1454
1532
  IoneProductComponent.ctorParameters = function () { return [
1455
1533
  { type: ProductEventService },
1456
- { type: ProductSettingsService }
1534
+ { type: ProductSettingsService },
1535
+ { type: ProductConnectorService },
1536
+ { type: LocalStorageService }
1457
1537
  ]; };
1458
1538
  IoneProductComponent.propDecorators = {
1459
1539
  sku: [{ type: i0.Input }],
@@ -1462,6 +1542,7 @@
1462
1542
  enableRenderCarousel: [{ type: i0.Input }],
1463
1543
  settings: [{ type: i0.Input }],
1464
1544
  handleAddArticleInternally: [{ type: i0.Input }],
1545
+ handleAddToCartInternally: [{ type: i0.Input }],
1465
1546
  onAddToCart: [{ type: i0.Output }],
1466
1547
  forceRenderImage: [{ type: i0.Output }],
1467
1548
  getRenderForRenderCarousel: [{ type: i0.Output }],
@@ -4106,6 +4187,7 @@
4106
4187
  exports["ɵbp"] = ProductHdModule;
4107
4188
  exports["ɵbq"] = ProductHdComponent;
4108
4189
  exports["ɵbr"] = ProductScriptLoaderService;
4190
+ exports["ɵbs"] = LocalStorageService;
4109
4191
  exports["ɵc"] = PipeModule;
4110
4192
  exports["ɵd"] = LocalizePipe;
4111
4193
  exports["ɵe"] = DictionaryService;