@veloceapps/api 7.0.2-41 → 7.0.2-43

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.
@@ -3,8 +3,8 @@ import { HttpParams, HttpErrorResponse, HttpClientModule } from '@angular/common
3
3
  import * as i0 from '@angular/core';
4
4
  import { Injectable, NgModule } from '@angular/core';
5
5
  import * as i1 from '@veloceapps/core';
6
- import { ModelTranslatorUtils, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, Operator, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, BaseHttpService, XrayService } from '@veloceapps/core';
7
- import { throwError, of, zip, forkJoin, map as map$1, noop, catchError as catchError$1, switchMap as switchMap$1 } from 'rxjs';
6
+ import { uiDefinitionFromDTO, isLegacyUIDefinition, ModelTranslatorUtils, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, Operator, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, BaseHttpService, XrayService } from '@veloceapps/core';
7
+ import { noop, throwError, of, zip, forkJoin, map as map$1, catchError as catchError$1, switchMap as switchMap$1 } from 'rxjs';
8
8
  import { map, catchError, tap, switchMap, defaultIfEmpty } from 'rxjs/operators';
9
9
  import * as i2 from 'primeng/api';
10
10
  import { CurrencyPipe } from '@angular/common';
@@ -240,6 +240,32 @@ class CatalogAdminApiService {
240
240
  });
241
241
  };
242
242
  }
243
+ attachImage$(catalogId, categoryId, file) {
244
+ const data = new FormData();
245
+ data.append('image', file);
246
+ return this.baseHttpService.upload({
247
+ method: 'post',
248
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
249
+ body: data,
250
+ });
251
+ }
252
+ removeImage$(catalogId, categoryId) {
253
+ return this.baseHttpService.api({
254
+ method: 'delete',
255
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
256
+ });
257
+ }
258
+ fetchImage$(catalogId, categoryId) {
259
+ return this.baseHttpService.api({
260
+ url: this.getImageUrl(catalogId, categoryId),
261
+ method: 'get',
262
+ responseType: 'blob',
263
+ errorHandler: noop,
264
+ });
265
+ }
266
+ getImageUrl(catalogId, categoryId) {
267
+ return `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`;
268
+ }
243
269
  }
244
270
  CatalogAdminApiService.MAX_RESULTS = 60;
245
271
  CatalogAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CatalogAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -366,11 +392,16 @@ class ConfigurationApiService {
366
392
  url: `${this.SERVICE_URL}/${productId}/model` + ((offeringId && `/${offeringId}`) || ''),
367
393
  })
368
394
  .pipe(map(runtimeData => {
369
- runtimeData.uiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
370
- runtimeData.uiDefinitions.forEach(uiDefinition => {
371
- ModelTranslatorUtils.toLocalUIDefinition(uiDefinition);
372
- });
373
- return runtimeData;
395
+ return {
396
+ ...runtimeData,
397
+ uiDefinitions: runtimeData.uiDefinitions.map(dto => {
398
+ const uiDefinitionContainer = uiDefinitionFromDTO(dto);
399
+ if (isLegacyUIDefinition(uiDefinitionContainer.source)) {
400
+ ModelTranslatorUtils.toLocalUIDefinition(uiDefinitionContainer.source);
401
+ }
402
+ return uiDefinitionContainer;
403
+ }),
404
+ };
374
405
  }));
375
406
  }
376
407
  getRuntimeDataByModelId(modelId) {
@@ -1669,6 +1700,11 @@ class ProductModelApiService {
1669
1700
  return linkedModels;
1670
1701
  }));
1671
1702
  }
1703
+ /**
1704
+ *
1705
+ * @deprecated
1706
+ * Will be removed in next major release
1707
+ */
1672
1708
  load(id, version) {
1673
1709
  return forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(map(([model, linkedModels]) => {
1674
1710
  const container = new ProductModelsContainer(model, linkedModels ?? []);