@colijnit/product 256.1.0 → 256.1.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 * as i0 from '@angular/core';
2
- import { Injectable, Directive, Output, EventEmitter, Component, ViewEncapsulation, ChangeDetectorRef, Input, Renderer2, ViewChild, ElementRef, Pipe, NgModule, HostListener, HostBinding, SecurityContext, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+ import { Injectable, Directive, EventEmitter, Component, ViewEncapsulation, ChangeDetectorRef, Input, Output, Renderer2, ViewChild, ElementRef, Pipe, NgModule, HostListener, HostBinding, SecurityContext, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
3
  import { __awaiter } from 'tslib';
4
4
  import { Subject, BehaviorSubject } from 'rxjs';
5
5
  import { Options } from '@colijnit/ioneconnector/build/model/options';
@@ -30,8 +30,8 @@ class Version {
30
30
  constructor() {
31
31
  this.name = "@colijnit/product";
32
32
  this.description = "Product detail page project for iOne";
33
- this.symVer = "256.1.0";
34
- this.publishDate = "10/15/2024, 10:47:35 AM";
33
+ this.symVer = "256.1.1";
34
+ this.publishDate = "31-10-2024 18:01:50";
35
35
  }
36
36
  }
37
37
 
@@ -104,10 +104,33 @@ class ProductSettings {
104
104
  }
105
105
  }
106
106
 
107
+ class ProductEventService {
108
+ constructor() {
109
+ this.onAddToCart = new Subject();
110
+ this.onAlternativeClick = new Subject();
111
+ this.onAddToQuote = new Subject();
112
+ this.onForceRenderImage = new Subject();
113
+ this.onArticleReceived = new Subject();
114
+ this.onSelectionsReceived = new Subject();
115
+ this.onImageReceived = new Subject();
116
+ this.onRenderStarted = new Subject();
117
+ this.onRenderImageReceived = new Subject();
118
+ this.onDraftRenderImageReceived = new Subject();
119
+ this.onArticleInfoReceived = new Subject();
120
+ this.onUpdateProductInfoTab = new Subject();
121
+ this.errorMessage = new Subject();
122
+ }
123
+ }
124
+ ProductEventService.decorators = [
125
+ { type: Directive },
126
+ { type: Injectable }
127
+ ];
128
+
107
129
  // 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.
108
130
  // Only to be used by the IOneControllerService.
109
131
  class ProductConnectorAdapterService {
110
- constructor() {
132
+ constructor(_eventService) {
133
+ this._eventService = _eventService;
111
134
  this.showLoader = new Subject();
112
135
  this._boFactory = new BusinessObjectFactory();
113
136
  }
@@ -198,7 +221,10 @@ class ProductConnectorAdapterService {
198
221
  }
199
222
  getJsonArticleFlatTree(goodId, goodType, quantity, externalSource = false, showLoader = true, instanceId, configuratorStatistics) {
200
223
  return __awaiter(this, void 0, void 0, function* () {
201
- return this.articleConnector.getJsonArticleFlatTree(goodId, goodType, quantity, externalSource, showLoader, instanceId, configuratorStatistics);
224
+ return this.articleConnector.getJsonArticleFlatTree(goodId, goodType, quantity, externalSource, showLoader, instanceId, configuratorStatistics).catch((messages) => {
225
+ this._eventService.errorMessage.next(messages);
226
+ return null;
227
+ });
202
228
  });
203
229
  }
204
230
  getGoodIdFromArticleNr(sku) {
@@ -259,7 +285,9 @@ class ProductConnectorAdapterService {
259
285
  ProductConnectorAdapterService.decorators = [
260
286
  { type: Injectable }
261
287
  ];
262
- ProductConnectorAdapterService.ctorParameters = () => [];
288
+ ProductConnectorAdapterService.ctorParameters = () => [
289
+ { type: ProductEventService }
290
+ ];
263
291
 
264
292
  var LanguageCode;
265
293
  (function (LanguageCode) {
@@ -599,33 +627,6 @@ ProductConnectorService.ctorParameters = () => [
599
627
  { type: ProductSettingsService }
600
628
  ];
601
629
 
602
- class ProductEventService {
603
- constructor() {
604
- this.onAddToCart = new Subject();
605
- this.onAlternativeClick = new Subject();
606
- this.onAddToQuote = new Subject();
607
- this.onForceRenderImage = new Subject();
608
- this.onArticleReceived = new Subject();
609
- this.onSelectionsReceived = new Subject();
610
- this.onImageReceived = new Subject();
611
- this.onRenderStarted = new Subject();
612
- this.onRenderImageReceived = new Subject();
613
- this.onDraftRenderImageReceived = new Subject();
614
- this.onArticleInfoReceived = new Subject();
615
- this.onUpdateProductInfoTab = new Subject();
616
- }
617
- }
618
- ProductEventService.decorators = [
619
- { type: Directive },
620
- { type: Injectable }
621
- ];
622
- ProductEventService.propDecorators = {
623
- onAddToCart: [{ type: Output }],
624
- onAlternativeClick: [{ type: Output }],
625
- onAddToQuote: [{ type: Output }],
626
- onForceRenderImage: [{ type: Output }]
627
- };
628
-
629
630
  class IoneProductComponent {
630
631
  constructor(_dictionary, _jsonUtils, _ione, _changeDetector, _appEventService, _settingsService) {
631
632
  // this.sku = 'CF-HILL';
@@ -1177,7 +1178,7 @@ class ImageCarouselComponent {
1177
1178
  }
1178
1179
  set images(value) {
1179
1180
  if (value && value.length > 0) {
1180
- this._images = value;
1181
+ this._images = this._filterValidImages(value);
1181
1182
  this._loadImages();
1182
1183
  this._changeDetector.detectChanges();
1183
1184
  }
@@ -1236,6 +1237,15 @@ class ImageCarouselComponent {
1236
1237
  }
1237
1238
  return this._domSanitizer.bypassSecurityTrustUrl(source);
1238
1239
  }
1240
+ _filterValidImages(value) {
1241
+ if (!value) {
1242
+ return [];
1243
+ }
1244
+ return value.filter(doc => {
1245
+ const pattern = /\.(jpg|jpeg|png|gif|bmp|tiff|webp)$/i;
1246
+ return pattern.test(doc.fileName) || !!doc.filePath;
1247
+ });
1248
+ }
1239
1249
  _loadImages() {
1240
1250
  if (this._images) {
1241
1251
  this._images.forEach((i) => {
@@ -1595,14 +1605,22 @@ class ProductAddtocartComponent {
1595
1605
  return __awaiter(this, void 0, void 0, function* () {
1596
1606
  if (this.createFrozenArticle) {
1597
1607
  if (this.article.goodType === 'B') {
1598
- this._appEventService.onAddToCart.next({
1599
- article: yield this._getJSONFromArticleObject({ article: this.article, quantity: quantity }),
1600
- quantity: quantity
1601
- });
1608
+ const article = yield this._getJSONFromArticleObject({ article: this.article, quantity: quantity });
1609
+ if (article) {
1610
+ this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
1611
+ }
1602
1612
  }
1603
1613
  else {
1604
- const article = this._ioneControllerService.convertArticleFullObjectToArticleExtended(this.article);
1605
- this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
1614
+ let article;
1615
+ if (!!this.externalSource) {
1616
+ article = yield this._getJSONFromArticleObject({ article: this.article, quantity: quantity });
1617
+ }
1618
+ else {
1619
+ article = this._ioneControllerService.convertArticleFullObjectToArticleExtended(this.article);
1620
+ }
1621
+ if (article) {
1622
+ this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
1623
+ }
1606
1624
  }
1607
1625
  }
1608
1626
  else {
@@ -2489,7 +2507,10 @@ IoneProductModule.decorators = [
2489
2507
  IoneProductComponent
2490
2508
  ],
2491
2509
  providers: [
2492
- ProductSettingsService
2510
+ ProductSettingsService,
2511
+ ProductConnectorService,
2512
+ ProductEventService,
2513
+ ProductConnectorAdapterService
2493
2514
  ]
2494
2515
  },] }
2495
2516
  ];
@@ -2589,7 +2610,6 @@ ProductExternalSourceComponent.decorators = [
2589
2610
  </ng-container>
2590
2611
  `,
2591
2612
  providers: [
2592
- ProductEventService,
2593
2613
  ProductSettingsService,
2594
2614
  ProductConnectorAdapterService,
2595
2615
  ProductConnectorService