@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.
@@ -34,6 +34,7 @@ export declare class ImageCarouselComponent implements OnInit, OnDestroy {
34
34
  handleThumbClick(index: number): void;
35
35
  onForceRenderImage(): void;
36
36
  getImageSrc(image: CoDocument | CustomEvent): SafeUrl;
37
+ private _filterValidImages;
37
38
  private _loadImages;
38
39
  private _scrollCarouselToIndex;
39
40
  }
@@ -9,12 +9,14 @@ import { DeliveryPrognosis } from '@colijnit/articleapi/build/model/delivery-pro
9
9
  import { DocumentContent } from '@colijnit/articleapi/build/model/document-content';
10
10
  import { Transaction } from '@colijnit/transactionapi/build/transaction';
11
11
  import { ArticleListObjectExtended } from '@colijnit/articleapi/build/model/article-list-object-extended.bo';
12
+ import { ProductEventService } from './product-event.service';
12
13
  export declare class ProductConnectorAdapterService implements OnDestroy {
14
+ private _eventService;
13
15
  readonly showLoader: Subject<boolean>;
14
16
  articleConnector?: Articles;
15
17
  transactionConnector: Transaction;
16
18
  private _boFactory;
17
- constructor();
19
+ constructor(_eventService: ProductEventService);
18
20
  ngOnDestroy(): void;
19
21
  initConnector(options: Options): Promise<void>;
20
22
  setInstance(instanceId: string): void;
@@ -3,6 +3,7 @@ import { ArticleListObject } from '@colijnit/articleapi/build/model/article-list
3
3
  import { Selection } from '@colijnit/articleapi/build/model/selection';
4
4
  import { ArticleQuickSel } from '@colijnit/articleapi/build/model/article-quick-sel';
5
5
  import { ArticleListObjectExtended } from '@colijnit/articleapi/build/model/article-list-object-extended.bo';
6
+ import { ValidationMessage } from '@colijnit/ioneconnector/build/model/validation-message';
6
7
  export declare class ProductEventService {
7
8
  onAddToCart: Subject<{
8
9
  article: string | ArticleListObjectExtended;
@@ -19,4 +20,5 @@ export declare class ProductEventService {
19
20
  onDraftRenderImageReceived: Subject<string>;
20
21
  onArticleInfoReceived: Subject<string>;
21
22
  onUpdateProductInfoTab: Subject<number>;
23
+ errorMessage: Subject<ValidationMessage[]>;
22
24
  }
@@ -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 = "256.1.0";
35
- this.publishDate = "10/15/2024, 10:47:35 AM";
34
+ this.symVer = "256.1.1";
35
+ this.publishDate = "31-10-2024 18:01:50";
36
36
  }
37
37
  return Version;
38
38
  }());
@@ -598,10 +598,34 @@
598
598
  return ProductSettings;
599
599
  }());
600
600
 
601
+ var ProductEventService = /** @class */ (function () {
602
+ function ProductEventService() {
603
+ this.onAddToCart = new rxjs.Subject();
604
+ this.onAlternativeClick = new rxjs.Subject();
605
+ this.onAddToQuote = new rxjs.Subject();
606
+ this.onForceRenderImage = new rxjs.Subject();
607
+ this.onArticleReceived = new rxjs.Subject();
608
+ this.onSelectionsReceived = new rxjs.Subject();
609
+ this.onImageReceived = new rxjs.Subject();
610
+ this.onRenderStarted = new rxjs.Subject();
611
+ this.onRenderImageReceived = new rxjs.Subject();
612
+ this.onDraftRenderImageReceived = new rxjs.Subject();
613
+ this.onArticleInfoReceived = new rxjs.Subject();
614
+ this.onUpdateProductInfoTab = new rxjs.Subject();
615
+ this.errorMessage = new rxjs.Subject();
616
+ }
617
+ return ProductEventService;
618
+ }());
619
+ ProductEventService.decorators = [
620
+ { type: i0.Directive },
621
+ { type: i0.Injectable }
622
+ ];
623
+
601
624
  // 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.
602
625
  // Only to be used by the IOneControllerService.
603
626
  var ProductConnectorAdapterService = /** @class */ (function () {
604
- function ProductConnectorAdapterService() {
627
+ function ProductConnectorAdapterService(_eventService) {
628
+ this._eventService = _eventService;
605
629
  this.showLoader = new rxjs.Subject();
606
630
  this._boFactory = new businessObjectFactory.BusinessObjectFactory();
607
631
  }
@@ -750,8 +774,12 @@
750
774
  if (externalSource === void 0) { externalSource = false; }
751
775
  if (showLoader === void 0) { showLoader = true; }
752
776
  return __awaiter(this, void 0, void 0, function () {
777
+ var _this = this;
753
778
  return __generator(this, function (_a) {
754
- return [2 /*return*/, this.articleConnector.getJsonArticleFlatTree(goodId, goodType, quantity, externalSource, showLoader, instanceId, configuratorStatistics)];
779
+ return [2 /*return*/, this.articleConnector.getJsonArticleFlatTree(goodId, goodType, quantity, externalSource, showLoader, instanceId, configuratorStatistics).catch(function (messages) {
780
+ _this._eventService.errorMessage.next(messages);
781
+ return null;
782
+ })];
755
783
  });
756
784
  });
757
785
  };
@@ -854,7 +882,9 @@
854
882
  ProductConnectorAdapterService.decorators = [
855
883
  { type: i0.Injectable }
856
884
  ];
857
- ProductConnectorAdapterService.ctorParameters = function () { return []; };
885
+ ProductConnectorAdapterService.ctorParameters = function () { return [
886
+ { type: ProductEventService }
887
+ ]; };
858
888
 
859
889
  var LanguageCode;
860
890
  (function (LanguageCode) {
@@ -1256,34 +1286,6 @@
1256
1286
  { type: ProductSettingsService }
1257
1287
  ]; };
1258
1288
 
1259
- var ProductEventService = /** @class */ (function () {
1260
- function ProductEventService() {
1261
- this.onAddToCart = new rxjs.Subject();
1262
- this.onAlternativeClick = new rxjs.Subject();
1263
- this.onAddToQuote = new rxjs.Subject();
1264
- this.onForceRenderImage = new rxjs.Subject();
1265
- this.onArticleReceived = new rxjs.Subject();
1266
- this.onSelectionsReceived = new rxjs.Subject();
1267
- this.onImageReceived = new rxjs.Subject();
1268
- this.onRenderStarted = new rxjs.Subject();
1269
- this.onRenderImageReceived = new rxjs.Subject();
1270
- this.onDraftRenderImageReceived = new rxjs.Subject();
1271
- this.onArticleInfoReceived = new rxjs.Subject();
1272
- this.onUpdateProductInfoTab = new rxjs.Subject();
1273
- }
1274
- return ProductEventService;
1275
- }());
1276
- ProductEventService.decorators = [
1277
- { type: i0.Directive },
1278
- { type: i0.Injectable }
1279
- ];
1280
- ProductEventService.propDecorators = {
1281
- onAddToCart: [{ type: i0.Output }],
1282
- onAlternativeClick: [{ type: i0.Output }],
1283
- onAddToQuote: [{ type: i0.Output }],
1284
- onForceRenderImage: [{ type: i0.Output }]
1285
- };
1286
-
1287
1289
  var IoneProductComponent = /** @class */ (function () {
1288
1290
  function IoneProductComponent(_dictionary, _jsonUtils, _ione, _changeDetector, _appEventService, _settingsService) {
1289
1291
  var _this = this;
@@ -1885,7 +1887,7 @@
1885
1887
  },
1886
1888
  set: function (value) {
1887
1889
  if (value && value.length > 0) {
1888
- this._images = value;
1890
+ this._images = this._filterValidImages(value);
1889
1891
  this._loadImages();
1890
1892
  this._changeDetector.detectChanges();
1891
1893
  }
@@ -1949,6 +1951,15 @@
1949
1951
  }
1950
1952
  return this._domSanitizer.bypassSecurityTrustUrl(source);
1951
1953
  };
1954
+ ImageCarouselComponent.prototype._filterValidImages = function (value) {
1955
+ if (!value) {
1956
+ return [];
1957
+ }
1958
+ return value.filter(function (doc) {
1959
+ var pattern = /\.(jpg|jpeg|png|gif|bmp|tiff|webp)$/i;
1960
+ return pattern.test(doc.fileName) || !!doc.filePath;
1961
+ });
1962
+ };
1952
1963
  ImageCarouselComponent.prototype._loadImages = function () {
1953
1964
  var _this = this;
1954
1965
  if (this._images) {
@@ -2291,30 +2302,40 @@
2291
2302
  };
2292
2303
  ProductAddtocartComponent.prototype.handleAddToCartClick = function (quantity) {
2293
2304
  return __awaiter(this, void 0, void 0, function () {
2294
- var _a, _b, _c, article, article;
2295
- return __generator(this, function (_d) {
2296
- switch (_d.label) {
2305
+ var article, article, article;
2306
+ return __generator(this, function (_a) {
2307
+ switch (_a.label) {
2297
2308
  case 0:
2298
- if (!this.createFrozenArticle) return [3 /*break*/, 4];
2309
+ if (!this.createFrozenArticle) return [3 /*break*/, 7];
2299
2310
  if (!(this.article.goodType === 'B')) return [3 /*break*/, 2];
2300
- _b = (_a = this._appEventService.onAddToCart).next;
2301
- _c = {};
2302
2311
  return [4 /*yield*/, this._getJSONFromArticleObject({ article: this.article, quantity: quantity })];
2303
2312
  case 1:
2304
- _b.apply(_a, [(_c.article = _d.sent(),
2305
- _c.quantity = quantity,
2306
- _c)]);
2307
- return [3 /*break*/, 3];
2313
+ article = _a.sent();
2314
+ if (article) {
2315
+ this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
2316
+ }
2317
+ return [3 /*break*/, 6];
2308
2318
  case 2:
2309
- article = this._ioneControllerService.convertArticleFullObjectToArticleExtended(this.article);
2310
- this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
2311
- _d.label = 3;
2312
- case 3: return [3 /*break*/, 5];
2319
+ article = void 0;
2320
+ if (!!!this.externalSource) return [3 /*break*/, 4];
2321
+ return [4 /*yield*/, this._getJSONFromArticleObject({ article: this.article, quantity: quantity })];
2322
+ case 3:
2323
+ article = _a.sent();
2324
+ return [3 /*break*/, 5];
2313
2325
  case 4:
2326
+ article = this._ioneControllerService.convertArticleFullObjectToArticleExtended(this.article);
2327
+ _a.label = 5;
2328
+ case 5:
2329
+ if (article) {
2330
+ this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
2331
+ }
2332
+ _a.label = 6;
2333
+ case 6: return [3 /*break*/, 8];
2334
+ case 7:
2314
2335
  article = this._ioneControllerService.convertArticleFullObjectToArticleExtended(this.article);
2315
2336
  this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
2316
- _d.label = 5;
2317
- case 5: return [2 /*return*/];
2337
+ _a.label = 8;
2338
+ case 8: return [2 /*return*/];
2318
2339
  }
2319
2340
  });
2320
2341
  });
@@ -3214,7 +3235,10 @@
3214
3235
  IoneProductComponent
3215
3236
  ],
3216
3237
  providers: [
3217
- ProductSettingsService
3238
+ ProductSettingsService,
3239
+ ProductConnectorService,
3240
+ ProductEventService,
3241
+ ProductConnectorAdapterService
3218
3242
  ]
3219
3243
  },] }
3220
3244
  ];
@@ -3316,7 +3340,6 @@
3316
3340
  selector: 'co-product-external-source',
3317
3341
  template: "\n <ng-container *ngIf=\"loaded\">\n <ng-container *ngIf=\"showProduct\">\n <app-product-page\n [sku]=\"sku\"\n [settings]=\"externalSettings\"\n [externalSource]=\"externalSource\"\n ></app-product-page>\n </ng-container>\n <ng-container *ngIf=\"!showProduct\">\n <iframe width=\"100%\" height=\"100%\" [src]=\"safeUrl\" frameborder=\"0\" allowfullscreen></iframe>\n </ng-container>\n </ng-container>\n ",
3318
3342
  providers: [
3319
- ProductEventService,
3320
3343
  ProductSettingsService,
3321
3344
  ProductConnectorAdapterService,
3322
3345
  ProductConnectorService