@colijnit/catalog 12.1.41 → 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 +102 -50
  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 +8 -2
  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 +70 -44
  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 +3 -1
  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.41";
34
- this.publishDate = "4-8-2023 13:39:38";
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();
@@ -2559,6 +2586,9 @@
2559
2586
  if (_this._settingsService.settings.catalogParameters) {
2560
2587
  _this.searchRequest = _this._settingsService.settings.catalogParameters;
2561
2588
  }
2589
+ }
2590
+ }), this._catalogConnectorAdapterService.controllerInitialized.subscribe(function (initialized) {
2591
+ if (initialized) {
2562
2592
  if (_this._settingsService.settings.options.searchOnStart) {
2563
2593
  _this.searchArticles();
2564
2594
  }
@@ -2660,6 +2690,7 @@
2660
2690
  CatalogSearchService.ctorParameters = function () { return [
2661
2691
  { type: CatalogFilterService },
2662
2692
  { type: CatalogConnectorService },
2693
+ { type: CatalogConnectorAdapterService },
2663
2694
  { type: CatalogSettingsService },
2664
2695
  { type: CatalogOptionsService }
2665
2696
  ]; };
@@ -2863,12 +2894,6 @@
2863
2894
  });
2864
2895
  });
2865
2896
  };
2866
- CatalogService.prototype.addWebSessionTransactionLine = function (sku, quantity) {
2867
- this.connectorAdapter.addWebSessionTransactionLine(sku, quantity);
2868
- };
2869
- CatalogService.prototype.getWebTransaction = function () {
2870
- this.connectorAdapter.getWebTransaction();
2871
- };
2872
2897
  CatalogService.prototype.reset = function () {
2873
2898
  this.showCatOrTurnoverGroupArticles = false;
2874
2899
  this.showExternalSource = false;
@@ -3062,10 +3087,10 @@
3062
3087
  ]; };
3063
3088
 
3064
3089
  var CatalogFilterComponent = /** @class */ (function () {
3065
- function CatalogFilterComponent(iconCache, optionsService, changeDetector, _catalogConnectorService, _adapterService, searchService) {
3090
+ function CatalogFilterComponent(iconCache, _settingsService, changeDetector, _catalogConnectorService, _adapterService, searchService) {
3066
3091
  var _this = this;
3067
3092
  this.iconCache = iconCache;
3068
- this.optionsService = optionsService;
3093
+ this._settingsService = _settingsService;
3069
3094
  this.changeDetector = changeDetector;
3070
3095
  this._catalogConnectorService = _catalogConnectorService;
3071
3096
  this._adapterService = _adapterService;
@@ -3079,7 +3104,6 @@
3079
3104
  'Inkoop',
3080
3105
  'Logistiek'
3081
3106
  ];
3082
- this.collapsed = false;
3083
3107
  this._subs = [];
3084
3108
  this._subs.push(this._adapterService.controllerInitialized.subscribe(function (initialized) {
3085
3109
  if (initialized) {
@@ -3092,10 +3116,6 @@
3092
3116
  };
3093
3117
  CatalogFilterComponent.prototype.ngOnInit = function () {
3094
3118
  // because our <co-checkbox-select> components will output a selectionStringChange on their init, which effectively changes this.filters
3095
- this.collapsed = this.optionsService.collapseFilterByDefault;
3096
- if (window.innerWidth <= 950) {
3097
- this.collapsed = true;
3098
- }
3099
3119
  //this.initializePriceFilterMinMax();
3100
3120
  this.detectChanges();
3101
3121
  };
@@ -3145,7 +3165,7 @@
3145
3165
  ];
3146
3166
  CatalogFilterComponent.ctorParameters = function () { return [
3147
3167
  { type: IconCacheService },
3148
- { type: CatalogOptionsService },
3168
+ { type: CatalogSettingsService },
3149
3169
  { type: i0.ChangeDetectorRef },
3150
3170
  { type: CatalogConnectorService },
3151
3171
  { type: CatalogConnectorAdapterService },
@@ -3157,8 +3177,7 @@
3157
3177
  purchaseFilter: [{ type: i0.ViewChild, args: ['purchaseFilter', { read: i0.ElementRef },] }],
3158
3178
  logisticsFilter: [{ type: i0.ViewChild, args: ['logisticsFilter', { read: i0.ElementRef },] }],
3159
3179
  showResetFilter: [{ type: i0.Input }],
3160
- showClass: [{ type: i0.HostBinding, args: ['class.co-catalog-filter',] }],
3161
- collapsed: [{ type: i0.HostBinding, args: ['class.collapsed',] }]
3180
+ showClass: [{ type: i0.HostBinding, args: ['class.co-catalog-filter',] }]
3162
3181
  };
3163
3182
 
3164
3183
  var CatalogFilterCategoriesComponent = /** @class */ (function () {
@@ -4076,15 +4095,12 @@
4076
4095
  Object.defineProperty(CatalogSearchComponent.prototype, "settings", {
4077
4096
  set: function (value) {
4078
4097
  if (value) {
4079
- var settings = void 0;
4080
4098
  if (typeof value === 'string') {
4081
- settings = JSON.parse(value);
4099
+ this._settings = JSON.parse(value);
4082
4100
  }
4083
4101
  else {
4084
- settings = value;
4102
+ this._settings = value;
4085
4103
  }
4086
- this._settingsService.createSettingsFromObject(settings);
4087
- this._catalogService.init(this._settingsService.settings);
4088
4104
  }
4089
4105
  },
4090
4106
  enumerable: false,
@@ -4094,18 +4110,29 @@
4094
4110
  return true;
4095
4111
  };
4096
4112
  CatalogSearchComponent.prototype.ngOnInit = function () {
4097
- var _this = this;
4098
- this._subs.push(this._catalogEventService.addArticleButtonClick.subscribe(function (json) {
4099
- _this.onAddArticleButtonClick.emit(json);
4100
- }), this._catalogEventService.arButtonClick.subscribe(function (article) {
4101
- _this.onArButtonClick.emit(article);
4102
- }), this._catalogEventService.articleClick.subscribe(function (article) {
4103
- _this.onArticleClick.emit(article);
4104
- }), this._catalogEventService.lookAtArticleButtonClick.subscribe(function (article) {
4105
- _this.onLookAtArticleButtonClick.emit(article);
4106
- }), this._catalogEventService.stockDetailsClick.subscribe(function (article) {
4107
- _this.onStockDetailsClick.emit(article);
4108
- }));
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
+ });
4109
4136
  };
4110
4137
  CatalogSearchComponent.prototype.ngOnDestroy = function () {
4111
4138
  this._subs.forEach(function (s) { return s.unsubscribe(); });
@@ -4352,7 +4379,7 @@
4352
4379
  };
4353
4380
  ArticleBaseComponent.prototype.handleAddArticleButtonClick = function (event) {
4354
4381
  return __awaiter(this, void 0, void 0, function () {
4355
- var json;
4382
+ var json, articleTreeData, i, good, subArticle;
4356
4383
  return __generator(this, function (_a) {
4357
4384
  switch (_a.label) {
4358
4385
  case 0:
@@ -4360,6 +4387,31 @@
4360
4387
  return [4 /*yield*/, this._getJSONFromArticleObject(this.article)];
4361
4388
  case 1:
4362
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:
4363
4415
  this._appEventService.addArticleButtonClick.next(json);
4364
4416
  this.onAddArticleButtonClick.emit(json);
4365
4417
  return [2 /*return*/];