@colijnit/catalog 259.1.0 → 259.1.2

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.
@@ -37,9 +37,9 @@ import { DateField } from '@colijnit/ioneconnector/build/factory/decorators/date
37
37
  import { ObjectConfiguration } from '@colijnit/ioneconnector/build/model/object-configuration';
38
38
  import { CategoryType } from '@colijnit/articleapi/build/model/category-type.bo';
39
39
  import { CategoryDesign } from '@colijnit/articleapi/build/model/category-design.bo';
40
+ import { ImageContent } from '@colijnit/mainapi/build/model/image-content.bo';
40
41
  import { ObjectUtils } from '@colijnit/ioneconnector/build/utils/object-utils';
41
42
  import { AvaliableCatalogs } from '@colijnit/articleapi/build/model/catalogs-available.bo';
42
- import { FileUtils } from '@colijnit/ioneconnector/build/utils/file-utils';
43
43
  import { FilterViewmodel, FilterItemViewmodel, BaseModuleScreenConfigService, BaseModuleService, SCREEN_CONFIG_ADAPTER_COMPONENT_INTERFACE_NAME, ScreenConfigurationModule, FilterItemMode, FilterItemModule, InputTextModule, ButtonModule, IconModule, InputDatePickerModule, IconCollapseHandleModule, CoDialogModule, ListOfValuesModule, CheckmarkOverlayModule, ImageModule, OverlayModule, OverlayService, InputSearchModule, InputCheckboxModule as InputCheckboxModule$1, PaginationBarModule, SimpleGridModule } from '@colijnit/corecomponents_v12';
44
44
  import { PagingParameters } from '@colijnit/ioneconnector/build/model/paging-parameters';
45
45
  import { trigger, state, style, transition, animate } from '@angular/animations';
@@ -57,8 +57,8 @@ class Version {
57
57
  constructor() {
58
58
  this.name = "@colijnit/catalog";
59
59
  this.description = "iOne Catalog module based on Angular 12";
60
- this.symVer = "259.1.0";
61
- this.publishDate = "7/9/2025, 9:55:45 AM";
60
+ this.symVer = "259.1.2";
61
+ this.publishDate = "16-7-2025 11:57:03";
62
62
  }
63
63
  }
64
64
 
@@ -454,7 +454,7 @@ class CatalogConnectorAdapterService {
454
454
  if (response) {
455
455
  return response.catalogSettings;
456
456
  }
457
- return "";
457
+ return '';
458
458
  });
459
459
  }
460
460
  getArticlesForCatalog(params, showLoader = true) {
@@ -1189,7 +1189,7 @@ class CatalogConnectorAdapterService {
1189
1189
  const infoResponse = this._boFactory.makeWithRawBackendData(TransactionInfoResponse, response.resultObject);
1190
1190
  return infoResponse.transactionInfo.uuid;
1191
1191
  }
1192
- return "";
1192
+ return '';
1193
1193
  });
1194
1194
  }
1195
1195
  getJsonArticleFlatTree(goodId, goodType, quantity, externalSource = false, showLoader = true, instanceId = undefined, configuratorStatistics) {
@@ -1216,6 +1216,21 @@ class CatalogConnectorAdapterService {
1216
1216
  onShowLoaderChange(showLoader) {
1217
1217
  this._shouldShowLoader = showLoader;
1218
1218
  }
1219
+ getGeneratedArtDirectly(goodId, showLoader) {
1220
+ return __awaiter(this, void 0, void 0, function* () {
1221
+ return this.connector.getGeneratedArtDirectly(goodId, showLoader).catch((messages) => {
1222
+ return null;
1223
+ });
1224
+ });
1225
+ }
1226
+ getImageForCoDocument(document, thumb) {
1227
+ return __awaiter(this, void 0, void 0, function* () {
1228
+ const response = yield this.mainConnector.getImageForCoDocument(document, thumb);
1229
+ if (response && response.validationResult && response.validationResult.success) {
1230
+ return this._boFactory.makeWithRawBackendData(ImageContent, response.resultObject);
1231
+ }
1232
+ });
1233
+ }
1219
1234
  }
1220
1235
  CatalogConnectorAdapterService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CatalogConnectorAdapterService_Factory() { return new CatalogConnectorAdapterService(i0.ɵɵinject(CatalogRootService), i0.ɵɵinject(CatalogExternalSourcesService)); }, token: CatalogConnectorAdapterService, providedIn: "root" });
1221
1236
  CatalogConnectorAdapterService.decorators = [
@@ -1895,6 +1910,14 @@ class CatalogConnectorService {
1895
1910
  return yield this._adapterService.addWebSessionTransactionLine(transactionUuid, sku, quantity);
1896
1911
  });
1897
1912
  }
1913
+ getGeneratedArtDirectly(goodId, showLoader = true) {
1914
+ return this._adapterService.getGeneratedArtDirectly(goodId, showLoader);
1915
+ }
1916
+ getImageForCoDocument(document, thumb = false) {
1917
+ return __awaiter(this, void 0, void 0, function* () {
1918
+ return this._adapterService.getImageForCoDocument(document, thumb);
1919
+ });
1920
+ }
1898
1921
  }
1899
1922
  CatalogConnectorService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CatalogConnectorService_Factory() { return new CatalogConnectorService(i0.ɵɵinject(CatalogConnectorAdapterService), i0.ɵɵinject(CatalogSelectSingleCacheService), i0.ɵɵinject(CatalogSelectMultipleCacheService), i0.ɵɵinject(CatalogSelectMultipleParameterizedCacheService), i0.ɵɵinject(CatalogSelectSingleParameterizedCacheService)); }, token: CatalogConnectorService, providedIn: "root" });
1900
1923
  CatalogConnectorService.decorators = [
@@ -2004,104 +2027,68 @@ class CatalogImageService {
2004
2027
  this._turnoverGroupImages = new Map();
2005
2028
  }
2006
2029
  getExternalSourceImage(catalogDef) {
2007
- if (this._externalSourceImages.has(catalogDef.externalSourceId)) {
2008
- catalogDef.imageData = this._externalSourceImages.get(catalogDef.externalSourceId);
2009
- }
2010
- else {
2011
- if (catalogDef.image) {
2012
- if (catalogDef.image.documentBody) { // if there's a body, use it
2013
- const imageData = FileUtils.DocumentBodyToDataUri(catalogDef.image.documentBody, catalogDef.image.mimeType);
2014
- this._externalSourceImages.set(catalogDef.externalSourceId, imageData);
2015
- catalogDef.imageData = imageData;
2016
- }
2017
- else if (catalogDef.image.filePath) { // else check if there's a filePath
2018
- this._externalSourceImages.set(catalogDef.externalSourceId, catalogDef.image.filePath);
2019
- catalogDef.imageData = catalogDef.image.filePath;
2020
- }
2021
- else { // else get image content based on documentid
2022
- this._iOneController.getDocumentContent(catalogDef.image.documentId).then((content) => {
2023
- const imageData = FileUtils.DocumentBodyToDataUri(content, catalogDef.image.mimeType || catalogDef.image.mimeTypeInternal);
2024
- this._externalSourceImages.set(catalogDef.externalSourceId, imageData);
2025
- catalogDef.imageData = imageData;
2026
- });
2030
+ return __awaiter(this, void 0, void 0, function* () {
2031
+ if (this._externalSourceImages.has(catalogDef.externalSourceId)) {
2032
+ catalogDef.imageData = this._externalSourceImages.get(catalogDef.externalSourceId);
2033
+ }
2034
+ else {
2035
+ if (catalogDef.image) {
2036
+ const imageContent = yield this._iOneController.getImageForCoDocument(catalogDef.image, false);
2037
+ if (imageContent) {
2038
+ this._externalSourceImages.set(catalogDef.externalSourceId, imageContent.image);
2039
+ catalogDef.imageData = imageContent.image;
2040
+ }
2027
2041
  }
2028
2042
  }
2029
- }
2043
+ });
2030
2044
  }
2031
2045
  getCategoryImage(category) {
2032
- if (this._categoryImages.has(category.category)) {
2033
- category.imageData = this._categoryImages.get(category.category);
2034
- }
2035
- else {
2036
- if (category.image) {
2037
- if (category.image.documentBody) { // if there's a body, use it
2038
- const imageData = FileUtils.DocumentBodyToDataUri(category.image.documentBody, category.image.mimeType);
2039
- this._categoryImages.set(category.category, imageData);
2040
- category.imageData = imageData;
2041
- }
2042
- else if (category.image.filePath) { // else check if there's a filePath
2043
- this._categoryImages.set(category.category, category.image.filePath);
2044
- category.imageData = category.image.filePath;
2045
- }
2046
- else { // else get image content based on documentid
2047
- this._iOneController.getDocumentContent(category.image.documentId, false).then((content) => {
2048
- const imageData = FileUtils.DocumentBodyToDataUri(content, category.image.mimeType || category.image.mimeTypeInternal);
2049
- this._categoryImages.set(category.category, imageData);
2050
- category.imageData = imageData;
2051
- });
2046
+ return __awaiter(this, void 0, void 0, function* () {
2047
+ if (this._categoryImages.has(category.category)) {
2048
+ category.imageData = this._categoryImages.get(category.category);
2049
+ }
2050
+ else {
2051
+ if (category.image) {
2052
+ const imageContent = yield this._iOneController.getImageForCoDocument(category.image, false);
2053
+ if (imageContent) {
2054
+ this._categoryImages.set(category.category, imageContent.image);
2055
+ category.imageData = imageContent.image;
2056
+ }
2052
2057
  }
2053
2058
  }
2054
- }
2059
+ });
2055
2060
  }
2056
2061
  getTurnoverGroupImage(turnoverGroup) {
2057
- if (this._turnoverGroupImages.has(turnoverGroup.turnovergroupNr)) {
2058
- turnoverGroup.imageData = this._turnoverGroupImages.get(turnoverGroup.turnovergroupNr);
2059
- }
2060
- else {
2061
- if (turnoverGroup.image) {
2062
- if (turnoverGroup.image.documentBody) { // if there's a body, use it
2063
- const imageData = FileUtils.DocumentBodyToDataUri(turnoverGroup.image.documentBody, turnoverGroup.image.mimeType);
2064
- this._turnoverGroupImages.set(turnoverGroup.turnovergroupNr, imageData);
2065
- turnoverGroup.imageData = imageData;
2066
- }
2067
- else if (turnoverGroup.image.filePath) { // else check if there's a filePath
2068
- this._turnoverGroupImages.set(turnoverGroup.turnovergroupNr, turnoverGroup.image.filePath);
2069
- turnoverGroup.imageData = turnoverGroup.image.filePath;
2070
- }
2071
- else { // else get image content based on documentid
2072
- this._iOneController.getDocumentContent(turnoverGroup.image.documentId).then((content) => {
2073
- const imageData = FileUtils.DocumentBodyToDataUri(content, turnoverGroup.image.mimeType || turnoverGroup.image.mimeTypeInternal);
2074
- this._turnoverGroupImages.set(turnoverGroup.turnovergroupNr, imageData);
2075
- turnoverGroup.imageData = imageData;
2076
- });
2062
+ return __awaiter(this, void 0, void 0, function* () {
2063
+ if (this._turnoverGroupImages.has(turnoverGroup.turnovergroupNr)) {
2064
+ turnoverGroup.imageData = this._turnoverGroupImages.get(turnoverGroup.turnovergroupNr);
2065
+ }
2066
+ else {
2067
+ if (turnoverGroup.image) {
2068
+ const imageContent = yield this._iOneController.getImageForCoDocument(turnoverGroup.image, false);
2069
+ if (imageContent) {
2070
+ this._turnoverGroupImages.set(turnoverGroup.turnovergroupNr, imageContent.image);
2071
+ turnoverGroup.imageData = imageContent.image;
2072
+ }
2077
2073
  }
2078
2074
  }
2079
- }
2075
+ });
2080
2076
  }
2081
2077
  getArticleImage(article) {
2082
- if (this._articleImages.has(article.goodId)) {
2083
- article.imageData = this._articleImages.get(article.goodId);
2084
- }
2085
- else {
2086
- if (article.image) {
2087
- if (article.image.documentBody) { // if there's a body, use it
2088
- const imageData = FileUtils.DocumentBodyToDataUri(article.image.documentBody, article.image.mimeType);
2089
- this._articleImages.set(article.goodId, imageData);
2090
- article.imageData = imageData;
2091
- }
2092
- else if (article.image.filePath) { // else check if there's a filePath
2093
- this._articleImages.set(article.goodId, article.image.filePath);
2094
- article.imageData = article.image.filePath;
2095
- }
2096
- else { // else get image content based on documentid
2097
- this._iOneController.getDocumentContent(article.image.documentId).then((content) => {
2098
- const imageData = FileUtils.DocumentBodyToDataUri(content, article.image.mimeType || article.image.mimeTypeInternal);
2099
- this._articleImages.set(article.goodId, imageData);
2100
- article.imageData = imageData;
2101
- });
2078
+ return __awaiter(this, void 0, void 0, function* () {
2079
+ if (this._articleImages.has(article.goodId)) {
2080
+ article.imageData = this._articleImages.get(article.goodId);
2081
+ }
2082
+ else {
2083
+ if (article.image) {
2084
+ const imageContent = yield this._iOneController.getImageForCoDocument(article.image, false);
2085
+ if (imageContent) {
2086
+ this._articleImages.set(article.goodId, imageContent.image);
2087
+ article.imageData = imageContent.image;
2088
+ }
2102
2089
  }
2103
2090
  }
2104
- }
2091
+ });
2105
2092
  }
2106
2093
  }
2107
2094
  CatalogImageService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CatalogImageService_Factory() { return new CatalogImageService(i0.ɵɵinject(CatalogConnectorService)); }, token: CatalogImageService, providedIn: "root" });
@@ -5346,9 +5333,25 @@ class ArticleBaseComponent {
5346
5333
  return __awaiter(this, void 0, void 0, function* () {
5347
5334
  event.stopPropagation();
5348
5335
  if (this.createFrozenArticle) {
5349
- const json = yield this._getJSONFromArticleObject(this.article, !!this.externalSource, isRetour);
5350
- this._appEventService.addArticleButtonClick.next(json);
5351
- this.onAddArticleButtonClick.emit(json);
5336
+ if (this.article.isConfigurable) {
5337
+ const json = yield this._getJSONFromArticleObject(this.article, !!this.externalSource, isRetour);
5338
+ this._appEventService.addArticleButtonClick.next(json);
5339
+ this.onAddArticleButtonClick.emit(json);
5340
+ }
5341
+ else {
5342
+ const generatedGoodId = yield this._getGeneratedArtDirectly(this.article.goodId);
5343
+ if (generatedGoodId) {
5344
+ const params = new ArticleExtendedRequest();
5345
+ params.goodId = generatedGoodId;
5346
+ const searchArticles = yield this._iOne.getArticlesForCatalog(params, true);
5347
+ // We should have a single result here
5348
+ if (searchArticles && searchArticles.articles.length > 0) {
5349
+ const article = searchArticles.articles[0];
5350
+ this._appEventService.addArticleButtonClick.next(article);
5351
+ this.onAddArticleButtonClick.emit(article);
5352
+ }
5353
+ }
5354
+ }
5352
5355
  }
5353
5356
  else {
5354
5357
  this._appEventService.addArticleButtonClick.next(this.article);
@@ -5443,6 +5446,11 @@ class ArticleBaseComponent {
5443
5446
  + ' ' + this._dictionaryService.get('DAYS', false);
5444
5447
  }
5445
5448
  }
5449
+ _getGeneratedArtDirectly(goodId) {
5450
+ return __awaiter(this, void 0, void 0, function* () {
5451
+ return yield this._iOne.getGeneratedArtDirectly(goodId, true);
5452
+ });
5453
+ }
5446
5454
  }
5447
5455
  ArticleBaseComponent.decorators = [
5448
5456
  { type: Directive }