@colijnit/catalog 12.1.40 → 12.1.42

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.
Files changed (27) hide show
  1. package/bundles/colijnit-catalog.umd.js +116 -67
  2. package/bundles/colijnit-catalog.umd.js.map +1 -1
  3. package/colijnit-catalog.metadata.json +1 -1
  4. package/esm2015/lib/catalog-version.js +3 -3
  5. package/esm2015/lib/component/base/article-base.component.js +19 -1
  6. package/esm2015/lib/component/catalog-filter/catalog-filter.component.js +6 -12
  7. package/esm2015/lib/component/catalog-search/catalog-search.component.js +19 -17
  8. package/esm2015/lib/model/settings-options.js +1 -2
  9. package/esm2015/lib/model/settings.js +2 -1
  10. package/esm2015/lib/service/catalog-connector-adapter.service.js +6 -4
  11. package/esm2015/lib/service/catalog-connector.service.js +11 -1
  12. package/esm2015/lib/service/catalog-options.service.js +1 -4
  13. package/esm2015/lib/service/catalog-search.service.js +21 -18
  14. package/esm2015/lib/service/catalog-settings.service.js +8 -3
  15. package/esm2015/lib/service/catalog.service.js +1 -7
  16. package/fesm2015/colijnit-catalog.js +83 -60
  17. package/fesm2015/colijnit-catalog.js.map +1 -1
  18. package/lib/component/catalog-filter/catalog-filter.component.d.ts +3 -4
  19. package/lib/component/catalog-search/catalog-search.component.d.ts +2 -1
  20. package/lib/model/settings-options.d.ts +0 -1
  21. package/lib/model/settings.d.ts +1 -0
  22. package/lib/service/catalog-connector-adapter.service.d.ts +3 -2
  23. package/lib/service/catalog-connector.service.d.ts +3 -1
  24. package/lib/service/catalog-options.service.d.ts +0 -1
  25. package/lib/service/catalog-search.service.d.ts +5 -4
  26. package/lib/service/catalog.service.d.ts +0 -2
  27. package/package.json +6 -6
@@ -30,8 +30,8 @@
30
30
  function Version() {
31
31
  this.name = "@colijnit/catalog";
32
32
  this.description = "iOne Catalog module based on Angular 12";
33
- this.symVer = "12.1.40";
34
- this.publishDate = "1-8-2023 18:53:26";
33
+ this.symVer = "12.1.42";
34
+ this.publishDate = "4-9-2023 09:00:11";
35
35
  }
36
36
  return Version;
37
37
  }());
@@ -433,7 +433,6 @@
433
433
  this.showARButton = false;
434
434
  this.maxItemsPerPage = 20;
435
435
  this.addArticleButtonText = 'ADD TO CART';
436
- this.collapseFilterByDefault = false;
437
436
  this.sortTurnoverGroupsByAlphabet = true;
438
437
  this.searchOnStart = false;
439
438
  this.showFilter = false;
@@ -447,6 +446,7 @@
447
446
  function CatalogSettings() {
448
447
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
449
448
  _this.type = "V";
449
+ _this.createWebOrder = true;
450
450
  _this.options = new SettingsOptions();
451
451
  _this.useLoginEncryption = true;
452
452
  return _this;
@@ -645,13 +645,19 @@
645
645
  };
646
646
  CatalogSettingsService.prototype.createSettingsFromObject = function (obj) {
647
647
  return __awaiter(this, void 0, void 0, function () {
648
+ var ownOptions, ownCatalogParameters;
648
649
  return __generator(this, function (_a) {
649
650
  if (!this.settings) {
650
651
  this.settings = new CatalogSettings();
651
652
  }
652
- this.settings = Object.assign(this.settings, obj);
653
+ ownOptions = Object.assign({}, this.settings.options);
654
+ ownCatalogParameters = Object.assign({}, this.settings.catalogParameters);
655
+ this.settings = Object.assign({}, this.settings, obj);
656
+ if (obj.catalogParameters) {
657
+ this.settings.catalogParameters = Object.assign({}, ownCatalogParameters, obj.catalogParameters);
658
+ }
653
659
  if (obj.options) {
654
- this.settings.options = Object.assign(new SettingsOptions(), obj.options);
660
+ this.settings.options = Object.assign({}, ownOptions, obj.options);
655
661
  }
656
662
  this.settingsFinished();
657
663
  return [2 /*return*/];
@@ -1408,11 +1414,23 @@
1408
1414
  });
1409
1415
  };
1410
1416
  CatalogConnectorAdapterService.prototype.addWebSessionTransactionLine = function (sku, quantity) {
1411
- this.transactionConnector.addWebSessionTransactionLine(sku, quantity);
1417
+ return __awaiter(this, void 0, void 0, function () {
1418
+ return __generator(this, function (_a) {
1419
+ switch (_a.label) {
1420
+ case 0: return [4 /*yield*/, this.transactionConnector.addWebSessionTransactionLine(sku, quantity)];
1421
+ case 1: return [2 /*return*/, _a.sent()];
1422
+ }
1423
+ });
1424
+ });
1412
1425
  };
1413
1426
  CatalogConnectorAdapterService.prototype.getWebTransaction = function () {
1414
- this.transactionConnector.getWebSessionSalesOrder().then(function (response) {
1415
- console.log(response);
1427
+ return __awaiter(this, void 0, void 0, function () {
1428
+ return __generator(this, function (_a) {
1429
+ switch (_a.label) {
1430
+ case 0: return [4 /*yield*/, this.transactionConnector.getWebSessionSalesOrder()];
1431
+ case 1: return [2 /*return*/, _a.sent()];
1432
+ }
1433
+ });
1416
1434
  });
1417
1435
  };
1418
1436
  CatalogConnectorAdapterService.prototype.getJsonArticleFlatTree = function (goodId, goodType, quantity, showLoader, instanceId, configuratorStatistics) {
@@ -2121,6 +2139,21 @@
2121
2139
  if (instanceId === void 0) { instanceId = undefined; }
2122
2140
  return this._adapterService.getJsonArticleFlatTree(goodId, goodType, quantity, showLoader, undefined, configuratorStatistics);
2123
2141
  };
2142
+ CatalogConnectorService.prototype.addWebSessionTransactionLine = function (sku, quantity) {
2143
+ return __awaiter(this, void 0, void 0, function () {
2144
+ return __generator(this, function (_a) {
2145
+ switch (_a.label) {
2146
+ case 0: return [4 /*yield*/, this._adapterService.addWebSessionTransactionLine(sku, quantity)];
2147
+ case 1: return [2 /*return*/, _a.sent()];
2148
+ }
2149
+ });
2150
+ });
2151
+ };
2152
+ CatalogConnectorService.prototype.getWebTransaction = function () {
2153
+ this._adapterService.getWebTransaction().then(function (response) {
2154
+ console.log(response);
2155
+ });
2156
+ };
2124
2157
  return CatalogConnectorService;
2125
2158
  }());
2126
2159
  CatalogConnectorService.decorators = [
@@ -2170,13 +2203,6 @@
2170
2203
  enumerable: false,
2171
2204
  configurable: true
2172
2205
  });
2173
- Object.defineProperty(CatalogOptionsService.prototype, "collapseFilterByDefault", {
2174
- get: function () {
2175
- return this._settingsService.settings.options.collapseFilterByDefault;
2176
- },
2177
- enumerable: false,
2178
- configurable: true
2179
- });
2180
2206
  Object.defineProperty(CatalogOptionsService.prototype, "showPriceFilter", {
2181
2207
  get: function () {
2182
2208
  return this._settingsService.settings.options.showPriceFilter;
@@ -2542,10 +2568,11 @@
2542
2568
  ]; };
2543
2569
 
2544
2570
  var CatalogSearchService = /** @class */ (function () {
2545
- function CatalogSearchService(_filterService, _catalogConnectorService, _settingsService, _optionService) {
2571
+ function CatalogSearchService(_filterService, _catalogConnectorService, _catalogConnectorAdapterService, _settingsService, _optionService) {
2546
2572
  var _this = this;
2547
2573
  this._filterService = _filterService;
2548
2574
  this._catalogConnectorService = _catalogConnectorService;
2575
+ this._catalogConnectorAdapterService = _catalogConnectorAdapterService;
2549
2576
  this._settingsService = _settingsService;
2550
2577
  this._optionService = _optionService;
2551
2578
  this.searchRequest = new articleExtendedRequest.ArticleExtendedRequest();
@@ -2553,13 +2580,15 @@
2553
2580
  this.articles = [];
2554
2581
  this.articlesPerPage = 20;
2555
2582
  this._currentPage = 1;
2556
- this._filterText = [];
2557
2583
  this._subs = [];
2558
2584
  this._subs.push(this._optionService.parametersSet.subscribe(function (isSet) {
2559
2585
  if (isSet) {
2560
2586
  if (_this._settingsService.settings.catalogParameters) {
2561
2587
  _this.searchRequest = _this._settingsService.settings.catalogParameters;
2562
2588
  }
2589
+ }
2590
+ }), this._catalogConnectorAdapterService.controllerInitialized.subscribe(function (initialized) {
2591
+ if (initialized) {
2563
2592
  if (_this._settingsService.settings.options.searchOnStart) {
2564
2593
  _this.searchArticles();
2565
2594
  }
@@ -2596,7 +2625,7 @@
2596
2625
  },
2597
2626
  set: function (value) {
2598
2627
  this._currentPage = value;
2599
- this.searchArticles();
2628
+ this.searchArticles(false);
2600
2629
  },
2601
2630
  enumerable: false,
2602
2631
  configurable: true
@@ -2604,18 +2633,23 @@
2604
2633
  CatalogSearchService.prototype.ngOnDestroy = function () {
2605
2634
  this._subs.forEach(function (s) { return s.unsubscribe(); });
2606
2635
  };
2607
- CatalogSearchService.prototype.searchArticles = function (getFilters) {
2636
+ CatalogSearchService.prototype.searchArticles = function (resetPaging) {
2608
2637
  var _this = this;
2609
- if (getFilters === void 0) { getFilters = true; }
2610
- var lowerBound = ((this.currentPage - 1) * this.articlesPerPage) + 1;
2638
+ if (resetPaging === void 0) { resetPaging = true; }
2639
+ var lowerBound;
2640
+ if (!resetPaging) {
2641
+ lowerBound = ((this.currentPage - 1) * this.articlesPerPage) + 1;
2642
+ }
2643
+ else {
2644
+ this._currentPage = 1;
2645
+ lowerBound = 1;
2646
+ }
2611
2647
  this.searchRequest.paging = new pagingParameters.PagingParameters(lowerBound, lowerBound + this.articlesPerPage - 1, this.articlesPerPage);
2612
2648
  this._catalogConnectorService.getArticlesForCatalog(this.searchRequest).then(function (result) {
2613
2649
  var _a, _b;
2614
2650
  _this.articles = (_a = result.articles) !== null && _a !== void 0 ? _a : [];
2615
2651
  _this.resultCount = (_b = result.count) !== null && _b !== void 0 ? _b : undefined;
2616
- //if (this._settingsService.settings.options.showFilter && getFilters) {
2617
2652
  _this._filterService.getFilters(_this.searchRequest);
2618
- //}
2619
2653
  });
2620
2654
  };
2621
2655
  CatalogSearchService.prototype.resetFilters = function (search) {
@@ -2626,16 +2660,6 @@
2626
2660
  this.searchArticles();
2627
2661
  }
2628
2662
  };
2629
- CatalogSearchService.prototype._resetRequest = function () {
2630
- this.searchRequest = new articleExtendedRequest.ArticleExtendedRequest();
2631
- };
2632
- // public get fullscreen(): boolean {
2633
- // return this.activeSearchViewMode === SearchViewMode.FullScreen;
2634
- // }
2635
- //
2636
- // public get collapsed(): boolean {
2637
- // return this.activeSearchBarViewMode === SearchbarViewMode.Collapsed;
2638
- // }
2639
2663
  CatalogSearchService.prototype.toggleFilter = function () {
2640
2664
  this.showFilterSidebar = !this.showFilterSidebar;
2641
2665
  };
@@ -2650,6 +2674,9 @@
2650
2674
  _this.showFilterSidebar = true;
2651
2675
  }, 10);
2652
2676
  };
2677
+ CatalogSearchService.prototype._resetRequest = function () {
2678
+ this.searchRequest = new articleExtendedRequest.ArticleExtendedRequest();
2679
+ };
2653
2680
  CatalogSearchService.prototype._setRequestParametersAndProps = function (category, turnoverGroup, searchText) {
2654
2681
  this.searchRequest.category = category;
2655
2682
  this.searchRequest.turnoverGroup = turnoverGroup;
@@ -2663,6 +2690,7 @@
2663
2690
  CatalogSearchService.ctorParameters = function () { return [
2664
2691
  { type: CatalogFilterService },
2665
2692
  { type: CatalogConnectorService },
2693
+ { type: CatalogConnectorAdapterService },
2666
2694
  { type: CatalogSettingsService },
2667
2695
  { type: CatalogOptionsService }
2668
2696
  ]; };
@@ -2866,12 +2894,6 @@
2866
2894
  });
2867
2895
  });
2868
2896
  };
2869
- CatalogService.prototype.addWebSessionTransactionLine = function (sku, quantity) {
2870
- this.connectorAdapter.addWebSessionTransactionLine(sku, quantity);
2871
- };
2872
- CatalogService.prototype.getWebTransaction = function () {
2873
- this.connectorAdapter.getWebTransaction();
2874
- };
2875
2897
  CatalogService.prototype.reset = function () {
2876
2898
  this.showCatOrTurnoverGroupArticles = false;
2877
2899
  this.showExternalSource = false;
@@ -3065,10 +3087,10 @@
3065
3087
  ]; };
3066
3088
 
3067
3089
  var CatalogFilterComponent = /** @class */ (function () {
3068
- function CatalogFilterComponent(iconCache, optionsService, changeDetector, _catalogConnectorService, _adapterService, searchService) {
3090
+ function CatalogFilterComponent(iconCache, _settingsService, changeDetector, _catalogConnectorService, _adapterService, searchService) {
3069
3091
  var _this = this;
3070
3092
  this.iconCache = iconCache;
3071
- this.optionsService = optionsService;
3093
+ this._settingsService = _settingsService;
3072
3094
  this.changeDetector = changeDetector;
3073
3095
  this._catalogConnectorService = _catalogConnectorService;
3074
3096
  this._adapterService = _adapterService;
@@ -3082,7 +3104,6 @@
3082
3104
  'Inkoop',
3083
3105
  'Logistiek'
3084
3106
  ];
3085
- this.collapsed = false;
3086
3107
  this._subs = [];
3087
3108
  this._subs.push(this._adapterService.controllerInitialized.subscribe(function (initialized) {
3088
3109
  if (initialized) {
@@ -3095,10 +3116,6 @@
3095
3116
  };
3096
3117
  CatalogFilterComponent.prototype.ngOnInit = function () {
3097
3118
  // because our <co-checkbox-select> components will output a selectionStringChange on their init, which effectively changes this.filters
3098
- this.collapsed = this.optionsService.collapseFilterByDefault;
3099
- if (window.innerWidth <= 950) {
3100
- this.collapsed = true;
3101
- }
3102
3119
  //this.initializePriceFilterMinMax();
3103
3120
  this.detectChanges();
3104
3121
  };
@@ -3148,7 +3165,7 @@
3148
3165
  ];
3149
3166
  CatalogFilterComponent.ctorParameters = function () { return [
3150
3167
  { type: IconCacheService },
3151
- { type: CatalogOptionsService },
3168
+ { type: CatalogSettingsService },
3152
3169
  { type: i0.ChangeDetectorRef },
3153
3170
  { type: CatalogConnectorService },
3154
3171
  { type: CatalogConnectorAdapterService },
@@ -3160,8 +3177,7 @@
3160
3177
  purchaseFilter: [{ type: i0.ViewChild, args: ['purchaseFilter', { read: i0.ElementRef },] }],
3161
3178
  logisticsFilter: [{ type: i0.ViewChild, args: ['logisticsFilter', { read: i0.ElementRef },] }],
3162
3179
  showResetFilter: [{ type: i0.Input }],
3163
- showClass: [{ type: i0.HostBinding, args: ['class.co-catalog-filter',] }],
3164
- collapsed: [{ type: i0.HostBinding, args: ['class.collapsed',] }]
3180
+ showClass: [{ type: i0.HostBinding, args: ['class.co-catalog-filter',] }]
3165
3181
  };
3166
3182
 
3167
3183
  var CatalogFilterCategoriesComponent = /** @class */ (function () {
@@ -4079,15 +4095,12 @@
4079
4095
  Object.defineProperty(CatalogSearchComponent.prototype, "settings", {
4080
4096
  set: function (value) {
4081
4097
  if (value) {
4082
- var settings = void 0;
4083
4098
  if (typeof value === 'string') {
4084
- settings = JSON.parse(value);
4099
+ this._settings = JSON.parse(value);
4085
4100
  }
4086
4101
  else {
4087
- settings = value;
4102
+ this._settings = value;
4088
4103
  }
4089
- this._settingsService.createSettingsFromObject(settings);
4090
- this._catalogService.init(this._settingsService.settings);
4091
4104
  }
4092
4105
  },
4093
4106
  enumerable: false,
@@ -4097,18 +4110,29 @@
4097
4110
  return true;
4098
4111
  };
4099
4112
  CatalogSearchComponent.prototype.ngOnInit = function () {
4100
- var _this = this;
4101
- this._subs.push(this._catalogEventService.addArticleButtonClick.subscribe(function (json) {
4102
- _this.onAddArticleButtonClick.emit(json);
4103
- }), this._catalogEventService.arButtonClick.subscribe(function (article) {
4104
- _this.onArButtonClick.emit(article);
4105
- }), this._catalogEventService.articleClick.subscribe(function (article) {
4106
- _this.onArticleClick.emit(article);
4107
- }), this._catalogEventService.lookAtArticleButtonClick.subscribe(function (article) {
4108
- _this.onLookAtArticleButtonClick.emit(article);
4109
- }), this._catalogEventService.stockDetailsClick.subscribe(function (article) {
4110
- _this.onStockDetailsClick.emit(article);
4111
- }));
4113
+ return __awaiter(this, void 0, void 0, function () {
4114
+ var _this = this;
4115
+ return __generator(this, function (_a) {
4116
+ switch (_a.label) {
4117
+ case 0: return [4 /*yield*/, this._settingsService.initializeSettings()];
4118
+ case 1:
4119
+ _a.sent();
4120
+ this._catalogService.init(this._settings);
4121
+ this._subs.push(this._catalogEventService.addArticleButtonClick.subscribe(function (json) {
4122
+ _this.onAddArticleButtonClick.emit(json);
4123
+ }), this._catalogEventService.arButtonClick.subscribe(function (article) {
4124
+ _this.onArButtonClick.emit(article);
4125
+ }), this._catalogEventService.articleClick.subscribe(function (article) {
4126
+ _this.onArticleClick.emit(article);
4127
+ }), this._catalogEventService.lookAtArticleButtonClick.subscribe(function (article) {
4128
+ _this.onLookAtArticleButtonClick.emit(article);
4129
+ }), this._catalogEventService.stockDetailsClick.subscribe(function (article) {
4130
+ _this.onStockDetailsClick.emit(article);
4131
+ }));
4132
+ return [2 /*return*/];
4133
+ }
4134
+ });
4135
+ });
4112
4136
  };
4113
4137
  CatalogSearchComponent.prototype.ngOnDestroy = function () {
4114
4138
  this._subs.forEach(function (s) { return s.unsubscribe(); });
@@ -4355,7 +4379,7 @@
4355
4379
  };
4356
4380
  ArticleBaseComponent.prototype.handleAddArticleButtonClick = function (event) {
4357
4381
  return __awaiter(this, void 0, void 0, function () {
4358
- var json;
4382
+ var json, articleTreeData, i, good, subArticle;
4359
4383
  return __generator(this, function (_a) {
4360
4384
  switch (_a.label) {
4361
4385
  case 0:
@@ -4363,6 +4387,31 @@
4363
4387
  return [4 /*yield*/, this._getJSONFromArticleObject(this.article)];
4364
4388
  case 1:
4365
4389
  json = _a.sent();
4390
+ if (!this._settingsService.settings.createWebOrder) return [3 /*break*/, 8];
4391
+ if (!json) return [3 /*break*/, 8];
4392
+ articleTreeData = JSON.parse(json);
4393
+ if (!(articleTreeData.articleTree && articleTreeData.articleTree.article)) return [3 /*break*/, 8];
4394
+ if (!(articleTreeData.articleTree.compositeGoods && Array.isArray(articleTreeData.articleTree.compositeGoods) &&
4395
+ articleTreeData.articleTree.compositeGoods.length > 0 && articleTreeData.articleTree.subArticles && Array.isArray(articleTreeData.articleTree.subArticles))) return [3 /*break*/, 6];
4396
+ i = 0;
4397
+ _a.label = 2;
4398
+ case 2:
4399
+ if (!(i < articleTreeData.articleTree.compositeGoods.length - 1)) return [3 /*break*/, 5];
4400
+ good = articleTreeData.articleTree.compositeGoods[i];
4401
+ subArticle = articleTreeData.articleTree.subArticles[i];
4402
+ return [4 /*yield*/, this._iOne.addWebSessionTransactionLine(subArticle.articleNumber, good.quantity)];
4403
+ case 3:
4404
+ _a.sent();
4405
+ _a.label = 4;
4406
+ case 4:
4407
+ i++;
4408
+ return [3 /*break*/, 2];
4409
+ case 5: return [3 /*break*/, 8];
4410
+ case 6: return [4 /*yield*/, this._iOne.addWebSessionTransactionLine(articleTreeData.articleTree.article.articleNumber, 1)];
4411
+ case 7:
4412
+ _a.sent();
4413
+ _a.label = 8;
4414
+ case 8:
4366
4415
  this._appEventService.addArticleButtonClick.next(json);
4367
4416
  this.onAddArticleButtonClick.emit(json);
4368
4417
  return [2 /*return*/];