@colijnit/product 2.9.0 → 2.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { __awaiter, __generator, __decorate, __spread } from 'tslib';
2
- import { ɵɵdefineInjectable, Injectable, ɵɵinject, Output, Directive, EventEmitter, ChangeDetectorRef, Input, Component, ViewEncapsulation, HostBinding, Renderer2, ViewChild, ElementRef, HostListener, Pipe, NgModule, SecurityContext, CUSTOM_ELEMENTS_SCHEMA, APP_INITIALIZER } from '@angular/core';
2
+ import { ɵɵdefineInjectable, Injectable, ɵɵinject, Output, Directive, EventEmitter, ChangeDetectorRef, Input, Component, ViewEncapsulation, HostBinding, Renderer2, ViewChild, ElementRef, HostListener, Pipe, NgModule, SecurityContext, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
3
  import { Subject, BehaviorSubject } from 'rxjs';
4
4
  import { Options } from '@colijnit/ioneconnector/build/model/options';
5
5
  import { ArticleFullObject } from '@colijnit/articleapi/build/model/article-full-object';
@@ -24,8 +24,8 @@ var Version = /** @class */ (function () {
24
24
  function Version() {
25
25
  this.name = "@colijnit/product";
26
26
  this.description = "Product detail page project for iOne";
27
- this.symVer = "2.9.0";
28
- this.publishDate = "7-9-2023 15:18:44";
27
+ this.symVer = "2.9.1";
28
+ this.publishDate = "14-9-2023 16:32:35";
29
29
  }
30
30
  return Version;
31
31
  }());
@@ -800,13 +800,16 @@ var IoneProductComponent = /** @class */ (function () {
800
800
  this.onArticleReceived = new EventEmitter();
801
801
  this.onSelectionsReceived = new EventEmitter();
802
802
  this.onAddToQuote = new EventEmitter();
803
+ this.settingsLoaded = false;
803
804
  this._subs = [];
804
805
  // this.sku = "70000107";
805
806
  this._subs.push(
806
807
  // this._dictionary.dictionaryLoaded.subscribe(d => this.upAndLoaded = true),
807
808
  this._appEventService.onAddToCart.subscribe(function (json) {
808
809
  _this._handleAddToCart(json);
809
- }), this._appEventService.onAddToQuote.subscribe(function (json) { return _this.onAddToQuote.emit(json); }), this._appEventService.onAlternativeClick.subscribe(function (article) { return _this.onAlternativeClick.emit(article); }), this._appEventService.onArticleInfoReceived.subscribe(function (info) { return _this._handleAnswerInfoReceived(info); }), this._appEventService.onArticleReceived.subscribe(function (article) { return _this.onArticleReceived.emit(article); }), this._appEventService.onSelectionsReceived.subscribe(function (selections) { return _this.onSelectionsReceived.emit(selections); }));
810
+ }), this._appEventService.onAddToQuote.subscribe(function (json) { return _this.onAddToQuote.emit(json); }), this._appEventService.onAlternativeClick.subscribe(function (article) { return _this.onAlternativeClick.emit(article); }), this._appEventService.onArticleInfoReceived.subscribe(function (info) { return _this._handleAnswerInfoReceived(info); }), this._appEventService.onArticleReceived.subscribe(function (article) { return _this.onArticleReceived.emit(article); }), this._appEventService.onSelectionsReceived.subscribe(function (selections) { return _this.onSelectionsReceived.emit(selections); }), this._settingsService.settingsLoaded.subscribe(function (loaded) {
811
+ _this.settingsLoaded = loaded;
812
+ }));
810
813
  }
811
814
  Object.defineProperty(IoneProductComponent.prototype, "settings", {
812
815
  get: function () {
@@ -828,6 +831,18 @@ var IoneProductComponent = /** @class */ (function () {
828
831
  enumerable: true,
829
832
  configurable: true
830
833
  });
834
+ IoneProductComponent.prototype.ngOnInit = function () {
835
+ return __awaiter(this, void 0, void 0, function () {
836
+ return __generator(this, function (_a) {
837
+ switch (_a.label) {
838
+ case 0: return [4 /*yield*/, this._settingsService.initializeSettings()];
839
+ case 1:
840
+ _a.sent();
841
+ return [2 /*return*/];
842
+ }
843
+ });
844
+ });
845
+ };
831
846
  IoneProductComponent.prototype.ngOnChanges = function (changes) {
832
847
  this._changeDetector.detectChanges();
833
848
  };
@@ -839,7 +854,7 @@ var IoneProductComponent = /** @class */ (function () {
839
854
  };
840
855
  IoneProductComponent.prototype._handleAddToCart = function (json) {
841
856
  return __awaiter(this, void 0, void 0, function () {
842
- var articleTreeData, i, good, subArticle;
857
+ var articleTreeData, compositeGoods, _loop_1, this_1, i;
843
858
  return __generator(this, function (_a) {
844
859
  switch (_a.label) {
845
860
  case 0:
@@ -848,14 +863,32 @@ var IoneProductComponent = /** @class */ (function () {
848
863
  articleTreeData = JSON.parse(json);
849
864
  if (!(articleTreeData.articleTree && articleTreeData.articleTree.article)) return [3 /*break*/, 7];
850
865
  if (!(articleTreeData.articleTree.compositeGoods && Array.isArray(articleTreeData.articleTree.compositeGoods) &&
851
- articleTreeData.articleTree.compositeGoods.length > 0 && articleTreeData.articleTree.subArticles && Array.isArray(articleTreeData.articleTree.subArticles))) return [3 /*break*/, 5];
866
+ articleTreeData.articleTree.compositeGoods.length > 0 &&
867
+ articleTreeData.articleTree.subArticles && Array.isArray(articleTreeData.articleTree.subArticles))) return [3 /*break*/, 5];
868
+ compositeGoods = articleTreeData.articleTree.compositeGoods;
869
+ compositeGoods.sort(function (a, b) { return a.versionNumber < b.versionNumber ? -1 : 1; });
870
+ _loop_1 = function (i) {
871
+ var good, subArticle;
872
+ return __generator(this, function (_a) {
873
+ switch (_a.label) {
874
+ case 0:
875
+ good = compositeGoods[i];
876
+ subArticle = articleTreeData.articleTree.subArticles.find(function (s) { return s.goodId === good.memberGoodId; });
877
+ if (!subArticle) return [3 /*break*/, 2];
878
+ return [4 /*yield*/, this_1._ione.addWebSessionTransactionLine(subArticle.articleNumber, good.quantity)];
879
+ case 1:
880
+ _a.sent();
881
+ _a.label = 2;
882
+ case 2: return [2 /*return*/];
883
+ }
884
+ });
885
+ };
886
+ this_1 = this;
852
887
  i = 0;
853
888
  _a.label = 1;
854
889
  case 1:
855
- if (!(i < articleTreeData.articleTree.compositeGoods.length - 1)) return [3 /*break*/, 4];
856
- good = articleTreeData.articleTree.compositeGoods[i];
857
- subArticle = articleTreeData.articleTree.subArticles[i];
858
- return [4 /*yield*/, this._ione.addWebSessionTransactionLine(subArticle.articleNumber, good.quantity)];
890
+ if (!(i < compositeGoods.length)) return [3 /*break*/, 4];
891
+ return [5 /*yield**/, _loop_1(i)];
859
892
  case 2:
860
893
  _a.sent();
861
894
  _a.label = 3;
@@ -912,7 +945,7 @@ var IoneProductComponent = /** @class */ (function () {
912
945
  IoneProductComponent = __decorate([
913
946
  Component({
914
947
  selector: 'app-ione-product',
915
- template: "\n <app-product-page [sku]=\"sku\"\n ></app-product-page>\n ",
948
+ template: "\n <app-product-page *ngIf=\"settingsLoaded\"\n [sku]=\"sku\"\n ></app-product-page>\n ",
916
949
  providers: [
917
950
  ProductEventService,
918
951
  ProductSettingsService,
@@ -926,29 +959,6 @@ var IoneProductComponent = /** @class */ (function () {
926
959
  return IoneProductComponent;
927
960
  }());
928
961
 
929
- var ProductInitializerService = /** @class */ (function () {
930
- function ProductInitializerService(_settingsService) {
931
- this._settingsService = _settingsService;
932
- }
933
- ProductInitializerService.prototype.initializeApp = function () {
934
- return __awaiter(this, void 0, void 0, function () {
935
- return __generator(this, function (_a) {
936
- return [2 /*return*/, this._settingsService.initializeSettings()];
937
- });
938
- });
939
- };
940
- ProductInitializerService.ctorParameters = function () { return [
941
- { type: ProductSettingsService }
942
- ]; };
943
- ProductInitializerService.ɵprov = ɵɵdefineInjectable({ factory: function ProductInitializerService_Factory() { return new ProductInitializerService(ɵɵinject(ProductSettingsService)); }, token: ProductInitializerService, providedIn: "root" });
944
- ProductInitializerService = __decorate([
945
- Injectable({
946
- providedIn: 'root',
947
- })
948
- ], ProductInitializerService);
949
- return ProductInitializerService;
950
- }());
951
-
952
962
  var ProductExternalSourceComponent = /** @class */ (function () {
953
963
  function ProductExternalSourceComponent(_sanitizer, _productConnectorService, _appEventService) {
954
964
  this._sanitizer = _sanitizer;
@@ -2536,10 +2546,6 @@ var ProductExternalSourceModule = /** @class */ (function () {
2536
2546
  return ProductExternalSourceModule;
2537
2547
  }());
2538
2548
 
2539
- function initializeApp(context) {
2540
- var x = function () { return context.initializeApp(); };
2541
- return x;
2542
- }
2543
2549
  var IoneProductModule = /** @class */ (function () {
2544
2550
  function IoneProductModule() {
2545
2551
  }
@@ -2557,14 +2563,7 @@ var IoneProductModule = /** @class */ (function () {
2557
2563
  entryComponents: [
2558
2564
  IoneProductComponent
2559
2565
  ],
2560
- providers: [
2561
- {
2562
- provide: APP_INITIALIZER,
2563
- useFactory: initializeApp,
2564
- deps: [ProductInitializerService],
2565
- multi: true
2566
- }
2567
- ],
2566
+ providers: [],
2568
2567
  exports: [IoneProductComponent],
2569
2568
  bootstrap: [
2570
2569
  IoneProductComponent
@@ -2578,5 +2577,5 @@ var IoneProductModule = /** @class */ (function () {
2578
2577
  * Generated bundle index. Do not edit.
2579
2578
  */
2580
2579
 
2581
- export { IoneProductModule, ProductExternalSourceComponent, ProductExternalSourceModule, Version, initializeApp, ProductPageModule as ɵa, PipeModule as ɵb, ProductSymbolsComponent as ɵba, IoneProductComponent as ɵbb, ProductInitializerService as ɵbc, LocalizePipe as ɵc, DictionaryService as ɵd, JsonUtilsService as ɵe, ProductPageComponent as ɵf, ProductConnectorService as ɵg, ProductConnectorAdapterService as ɵh, ProductSettingsService as ɵi, IconCacheService as ɵj, ProductEventService as ɵk, ProductSelectorTypeComponent as ɵl, ImageCarouselComponent as ɵm, ProductDescriptionComponent as ɵn, ProductAdditionalDescriptionComponent as ɵo, ProductPriceComponent as ɵp, ProductAddtocartComponent as ɵq, ProductRelatedComponent as ɵr, ProductStockComponent as ɵs, ProductDeliveryComponent as ɵt, ProductInfoTabsComponent as ɵu, ProductDocumentsComponent as ɵv, HeaderComponent as ɵw, ProductInfoComponent as ɵx, ProductAdditionalInfoComponent as ɵy, ProductPropertiesComponent as ɵz };
2580
+ export { IoneProductModule, ProductExternalSourceComponent, ProductExternalSourceModule, Version, ProductPageModule as ɵa, PipeModule as ɵb, ProductSymbolsComponent as ɵba, IoneProductComponent as ɵbb, LocalizePipe as ɵc, DictionaryService as ɵd, JsonUtilsService as ɵe, ProductPageComponent as ɵf, ProductConnectorService as ɵg, ProductConnectorAdapterService as ɵh, ProductSettingsService as ɵi, IconCacheService as ɵj, ProductEventService as ɵk, ProductSelectorTypeComponent as ɵl, ImageCarouselComponent as ɵm, ProductDescriptionComponent as ɵn, ProductAdditionalDescriptionComponent as ɵo, ProductPriceComponent as ɵp, ProductAddtocartComponent as ɵq, ProductRelatedComponent as ɵr, ProductStockComponent as ɵs, ProductDeliveryComponent as ɵt, ProductInfoTabsComponent as ɵu, ProductDocumentsComponent as ɵv, HeaderComponent as ɵw, ProductInfoComponent as ɵx, ProductAdditionalInfoComponent as ɵy, ProductPropertiesComponent as ɵz };
2582
2581
  //# sourceMappingURL=colijnit-product.js.map