@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, __decorate } 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 @@ class Version {
24
24
  constructor() {
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
  }
31
31
 
@@ -627,13 +627,16 @@ let IoneProductComponent = class IoneProductComponent {
627
627
  this.onArticleReceived = new EventEmitter();
628
628
  this.onSelectionsReceived = new EventEmitter();
629
629
  this.onAddToQuote = new EventEmitter();
630
+ this.settingsLoaded = false;
630
631
  this._subs = [];
631
632
  // this.sku = "70000107";
632
633
  this._subs.push(
633
634
  // this._dictionary.dictionaryLoaded.subscribe(d => this.upAndLoaded = true),
634
635
  this._appEventService.onAddToCart.subscribe((json) => {
635
636
  this._handleAddToCart(json);
636
- }), this._appEventService.onAddToQuote.subscribe(json => this.onAddToQuote.emit(json)), this._appEventService.onAlternativeClick.subscribe(article => this.onAlternativeClick.emit(article)), this._appEventService.onArticleInfoReceived.subscribe(info => this._handleAnswerInfoReceived(info)), this._appEventService.onArticleReceived.subscribe(article => this.onArticleReceived.emit(article)), this._appEventService.onSelectionsReceived.subscribe(selections => this.onSelectionsReceived.emit(selections)));
637
+ }), this._appEventService.onAddToQuote.subscribe(json => this.onAddToQuote.emit(json)), this._appEventService.onAlternativeClick.subscribe(article => this.onAlternativeClick.emit(article)), this._appEventService.onArticleInfoReceived.subscribe(info => this._handleAnswerInfoReceived(info)), this._appEventService.onArticleReceived.subscribe(article => this.onArticleReceived.emit(article)), this._appEventService.onSelectionsReceived.subscribe(selections => this.onSelectionsReceived.emit(selections)), this._settingsService.settingsLoaded.subscribe(loaded => {
638
+ this.settingsLoaded = loaded;
639
+ }));
637
640
  }
638
641
  set settings(value) {
639
642
  if (value) {
@@ -651,6 +654,11 @@ let IoneProductComponent = class IoneProductComponent {
651
654
  get settings() {
652
655
  return this._settings;
653
656
  }
657
+ ngOnInit() {
658
+ return __awaiter(this, void 0, void 0, function* () {
659
+ yield this._settingsService.initializeSettings();
660
+ });
661
+ }
654
662
  ngOnChanges(changes) {
655
663
  this._changeDetector.detectChanges();
656
664
  }
@@ -667,11 +675,16 @@ let IoneProductComponent = class IoneProductComponent {
667
675
  const articleTreeData = JSON.parse(json);
668
676
  if (articleTreeData.articleTree && articleTreeData.articleTree.article) {
669
677
  if (articleTreeData.articleTree.compositeGoods && Array.isArray(articleTreeData.articleTree.compositeGoods) &&
670
- articleTreeData.articleTree.compositeGoods.length > 0 && articleTreeData.articleTree.subArticles && Array.isArray(articleTreeData.articleTree.subArticles)) {
671
- for (let i = 0; i < articleTreeData.articleTree.compositeGoods.length - 1; i++) {
672
- const good = articleTreeData.articleTree.compositeGoods[i];
673
- const subArticle = articleTreeData.articleTree.subArticles[i];
674
- yield this._ione.addWebSessionTransactionLine(subArticle.articleNumber, good.quantity);
678
+ articleTreeData.articleTree.compositeGoods.length > 0 &&
679
+ articleTreeData.articleTree.subArticles && Array.isArray(articleTreeData.articleTree.subArticles)) {
680
+ const compositeGoods = articleTreeData.articleTree.compositeGoods;
681
+ compositeGoods.sort((a, b) => a.versionNumber < b.versionNumber ? -1 : 1);
682
+ for (let i = 0; i < compositeGoods.length; i++) {
683
+ const good = compositeGoods[i];
684
+ const subArticle = articleTreeData.articleTree.subArticles.find(s => s.goodId === good.memberGoodId);
685
+ if (subArticle) {
686
+ yield this._ione.addWebSessionTransactionLine(subArticle.articleNumber, good.quantity);
687
+ }
675
688
  }
676
689
  }
677
690
  else {
@@ -723,7 +736,8 @@ IoneProductComponent = __decorate([
723
736
  Component({
724
737
  selector: 'app-ione-product',
725
738
  template: `
726
- <app-product-page [sku]="sku"
739
+ <app-product-page *ngIf="settingsLoaded"
740
+ [sku]="sku"
727
741
  ></app-product-page>
728
742
  `,
729
743
  providers: [
@@ -737,26 +751,6 @@ IoneProductComponent = __decorate([
737
751
  })
738
752
  ], IoneProductComponent);
739
753
 
740
- let ProductInitializerService = class ProductInitializerService {
741
- constructor(_settingsService) {
742
- this._settingsService = _settingsService;
743
- }
744
- initializeApp() {
745
- return __awaiter(this, void 0, void 0, function* () {
746
- return this._settingsService.initializeSettings();
747
- });
748
- }
749
- };
750
- ProductInitializerService.ctorParameters = () => [
751
- { type: ProductSettingsService }
752
- ];
753
- ProductInitializerService.ɵprov = ɵɵdefineInjectable({ factory: function ProductInitializerService_Factory() { return new ProductInitializerService(ɵɵinject(ProductSettingsService)); }, token: ProductInitializerService, providedIn: "root" });
754
- ProductInitializerService = __decorate([
755
- Injectable({
756
- providedIn: 'root',
757
- })
758
- ], ProductInitializerService);
759
-
760
754
  let ProductExternalSourceComponent = class ProductExternalSourceComponent {
761
755
  constructor(_sanitizer, _productConnectorService, _appEventService) {
762
756
  this._sanitizer = _sanitizer;
@@ -2155,10 +2149,6 @@ ProductExternalSourceModule = __decorate([
2155
2149
  })
2156
2150
  ], ProductExternalSourceModule);
2157
2151
 
2158
- function initializeApp(context) {
2159
- const x = () => context.initializeApp();
2160
- return x;
2161
- }
2162
2152
  let IoneProductModule = class IoneProductModule {
2163
2153
  };
2164
2154
  IoneProductModule = __decorate([
@@ -2175,14 +2165,7 @@ IoneProductModule = __decorate([
2175
2165
  entryComponents: [
2176
2166
  IoneProductComponent
2177
2167
  ],
2178
- providers: [
2179
- {
2180
- provide: APP_INITIALIZER,
2181
- useFactory: initializeApp,
2182
- deps: [ProductInitializerService],
2183
- multi: true
2184
- }
2185
- ],
2168
+ providers: [],
2186
2169
  exports: [IoneProductComponent],
2187
2170
  bootstrap: [
2188
2171
  IoneProductComponent
@@ -2194,5 +2177,5 @@ IoneProductModule = __decorate([
2194
2177
  * Generated bundle index. Do not edit.
2195
2178
  */
2196
2179
 
2197
- 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 };
2180
+ 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 };
2198
2181
  //# sourceMappingURL=colijnit-product.js.map