@colijnit/catalog 255.1.8 → 255.1.9

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.
@@ -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 = "255.1.8";
34
- this.publishDate = "16-9-2024 17:31:10";
33
+ this.symVer = "255.1.9";
34
+ this.publishDate = "17-9-2024 14:24:41";
35
35
  }
36
36
  return Version;
37
37
  }());
@@ -5867,55 +5867,52 @@
5867
5867
  };
5868
5868
  CatalogExternalSourceComponent.prototype.fetchAndCombineThreeDimerseData = function (hash) {
5869
5869
  return __awaiter(this, void 0, void 0, function () {
5870
- var customerName, configurationUrl, priceDataUrl, apiResponses, configurationResponse, priceDataResponse, configurationData_1, priceData_1, resultObject, error_1;
5870
+ var customerName, configurationUrl, priceDataUrl, configurationData_1, priceData_1;
5871
+ var _this = this;
5871
5872
  return __generator(this, function (_a) {
5872
- switch (_a.label) {
5873
- case 0:
5874
- customerName = 'Linteloo';
5875
- configurationUrl = this._externalSource.domain + '/configurationData/' + hash;
5876
- console.log('configurationUrl');
5877
- priceDataUrl = this._externalSource.domain + '/rules/api/' + customerName.toLowerCase() + '/' + hash;
5878
- console.log('priceDataUrl');
5879
- _a.label = 1;
5880
- case 1:
5881
- _a.trys.push([1, 3, , 4]);
5882
- return [4 /*yield*/, Promise.all([
5883
- this.fetchJsonFile(configurationUrl),
5884
- this.fetchJsonFile(priceDataUrl)
5885
- ])];
5886
- case 2:
5887
- apiResponses = _a.sent();
5888
- configurationResponse = apiResponses[0];
5889
- priceDataResponse = apiResponses[1];
5890
- if (configurationResponse && configurationResponse.ok) {
5891
- configurationResponse.json().then(function (result) {
5873
+ customerName = 'Linteloo';
5874
+ configurationUrl = this._externalSource.domain + '/configurationData/' + hash;
5875
+ console.log('configurationUrl');
5876
+ priceDataUrl = this._externalSource.domain + '/rules/api/' + customerName.toLowerCase() + '/' + hash;
5877
+ console.log('priceDataUrl');
5878
+ try {
5879
+ //first fetch the configuration data
5880
+ this.fetchJsonFile(configurationUrl).then(function (configResponse) {
5881
+ if (configResponse && configResponse.ok) {
5882
+ configResponse.json().then(function (result) {
5892
5883
  console.log(result);
5893
5884
  configurationData_1 = result;
5885
+ //if we have config data, fetch price data
5886
+ _this.fetchJsonFile(priceDataUrl).then(function (priceResponse) {
5887
+ if (priceResponse && priceResponse.ok) {
5888
+ priceResponse.json().then(function (result) {
5889
+ console.log(result);
5890
+ priceData_1 = result;
5891
+ //If we have config and price data. Create the necessary data object and pass it along.
5892
+ var resultObject = {};
5893
+ resultObject['configuratie-data'] = configurationData_1;
5894
+ resultObject['prijs-data'] = priceData_1;
5895
+ console.log(resultObject);
5896
+ _this.iFrameFeedbackReceived.emit(JSON.stringify(resultObject));
5897
+ }).catch(function (e) {
5898
+ //If there is no price data something has gone wrong. No further action should be taken besides showing any errors.
5899
+ console.log(e);
5900
+ priceData_1 = {};
5901
+ });
5902
+ }
5903
+ });
5894
5904
  }).catch(function (e) {
5905
+ //If there is no config data something has gone wrong. No further action should be taken besides showing any errors.
5895
5906
  console.log(e);
5896
5907
  configurationData_1 = {};
5897
5908
  });
5898
5909
  }
5899
- if (priceDataResponse && priceDataResponse.ok) {
5900
- priceDataResponse.json().then(function (result) {
5901
- console.log(result);
5902
- priceData_1 = result;
5903
- }).catch(function (e) {
5904
- console.log(e);
5905
- priceData_1 = {};
5906
- });
5907
- }
5908
- resultObject = {};
5909
- resultObject['configuratie-data'] = configurationData_1;
5910
- resultObject['prijs-data'] = priceData_1;
5911
- this.iFrameFeedbackReceived.emit(JSON.stringify(resultObject));
5912
- return [3 /*break*/, 4];
5913
- case 3:
5914
- error_1 = _a.sent();
5915
- console.error('Error fetching data:', error_1);
5916
- return [3 /*break*/, 4];
5917
- case 4: return [2 /*return*/];
5910
+ });
5918
5911
  }
5912
+ catch (error) {
5913
+ console.error('Error fetching data:', error);
5914
+ }
5915
+ return [2 /*return*/];
5919
5916
  });
5920
5917
  });
5921
5918
  };