@colijnit/catalog 255.1.7 → 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.7";
34
- this.publishDate = "4-9-2024 12:05:35";
33
+ this.symVer = "255.1.9";
34
+ this.publishDate = "17-9-2024 14:24:41";
35
35
  }
36
36
  return Version;
37
37
  }());
@@ -5852,14 +5852,79 @@
5852
5852
  }
5853
5853
  };
5854
5854
  CatalogExternalSourceComponent.prototype.receiveMessage = function (event) {
5855
- //if(event.origin === this.externalSource.url) {
5856
- if (typeof event.data === 'string') {
5857
- this.iFrameFeedbackReceived.emit(event.data);
5858
- }
5855
+ if (this._externalSource.type !== '3DIMERCE')
5856
+ if (typeof event.data === 'string') {
5857
+ this.iFrameFeedbackReceived.emit(event.data);
5858
+ }
5859
+ else {
5860
+ this.iFrameFeedbackReceived.emit(JSON.stringify(event.data));
5861
+ }
5859
5862
  else {
5860
- this.iFrameFeedbackReceived.emit(JSON.stringify(event.data));
5863
+ if (typeof event.data && event.data['hash'] !== undefined) {
5864
+ this.fetchAndCombineThreeDimerseData(event.data['hash']);
5865
+ }
5861
5866
  }
5862
- //}
5867
+ };
5868
+ CatalogExternalSourceComponent.prototype.fetchAndCombineThreeDimerseData = function (hash) {
5869
+ return __awaiter(this, void 0, void 0, function () {
5870
+ var customerName, configurationUrl, priceDataUrl, configurationData_1, priceData_1;
5871
+ var _this = this;
5872
+ return __generator(this, function (_a) {
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) {
5883
+ console.log(result);
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
+ });
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.
5906
+ console.log(e);
5907
+ configurationData_1 = {};
5908
+ });
5909
+ }
5910
+ });
5911
+ }
5912
+ catch (error) {
5913
+ console.error('Error fetching data:', error);
5914
+ }
5915
+ return [2 /*return*/];
5916
+ });
5917
+ });
5918
+ };
5919
+ CatalogExternalSourceComponent.prototype.fetchJsonFile = function (url) {
5920
+ return __awaiter(this, void 0, void 0, function () {
5921
+ return __generator(this, function (_a) {
5922
+ switch (_a.label) {
5923
+ case 0: return [4 /*yield*/, fetch(url)];
5924
+ case 1: return [2 /*return*/, _a.sent()];
5925
+ }
5926
+ });
5927
+ });
5863
5928
  };
5864
5929
  CatalogExternalSourceComponent.prototype.iframeLoaded = function (event) {
5865
5930
  if (this.username && this.password) {
@@ -5905,7 +5970,7 @@
5905
5970
  this.showCatalog = true;
5906
5971
  return [3 /*break*/, 3];
5907
5972
  case 2:
5908
- if (this._externalSource.type !== externalCatalogTypes_enum.ExternalCatalogTypes.Webshop) {
5973
+ if (this._externalSource.type !== externalCatalogTypes_enum.ExternalCatalogTypes.Webshop && this._externalSource.type !== externalCatalogTypes_enum.ExternalCatalogTypes.ThreeDimerse) {
5909
5974
  this.externalUrl = this._externalCatalogStartupInfo.apiUrl;
5910
5975
  if (this._externalSource.type === externalCatalogTypes_enum.ExternalCatalogTypes.Vadain) {
5911
5976
  this.username = this._externalCatalogStartupInfo.username;