@veloceapps/api 7.0.2-5 → 7.0.2-50

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,12 +3,13 @@ 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, uiDefinitionToDTO, 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';
11
11
  import * as _ from 'lodash';
12
+ import { omit } from 'lodash';
12
13
  import moment from 'moment';
13
14
  import { __rest } from 'tslib';
14
15
 
@@ -211,6 +212,32 @@ class CatalogAdminApiService {
211
212
  });
212
213
  };
213
214
  }
215
+ attachImage$(catalogId, categoryId, file) {
216
+ const data = new FormData();
217
+ data.append('image', file);
218
+ return this.baseHttpService.upload({
219
+ method: 'post',
220
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
221
+ body: data,
222
+ });
223
+ }
224
+ removeImage$(catalogId, categoryId) {
225
+ return this.baseHttpService.api({
226
+ method: 'delete',
227
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
228
+ });
229
+ }
230
+ fetchImage$(catalogId, categoryId) {
231
+ return this.baseHttpService.api({
232
+ url: this.getImageUrl(catalogId, categoryId),
233
+ method: 'get',
234
+ responseType: 'blob',
235
+ errorHandler: noop,
236
+ });
237
+ }
238
+ getImageUrl(catalogId, categoryId) {
239
+ return `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`;
240
+ }
214
241
  }
215
242
  CatalogAdminApiService.MAX_RESULTS = 60;
216
243
  CatalogAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CatalogAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -334,11 +361,13 @@ class ConfigurationApiService {
334
361
  url: `${this.SERVICE_URL}/${productId}/model` + ((offeringId && `/${offeringId}`) || ''),
335
362
  })
336
363
  .pipe(map(runtimeData => {
337
- runtimeData.uiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
338
- runtimeData.uiDefinitions.forEach(uiDefinition => {
339
- ModelTranslatorUtils.toLocalUIDefinition(uiDefinition);
340
- });
341
- return runtimeData;
364
+ return Object.assign(Object.assign({}, runtimeData), { uiDefinitions: runtimeData.uiDefinitions.map(dto => {
365
+ const uiDefinitionContainer = uiDefinitionFromDTO(dto);
366
+ if (isLegacyUIDefinition(uiDefinitionContainer.source)) {
367
+ ModelTranslatorUtils.toLocalUIDefinition(uiDefinitionContainer.source);
368
+ }
369
+ return uiDefinitionContainer;
370
+ }) });
342
371
  }));
343
372
  }
344
373
  getRuntimeDataByModelId(modelId) {
@@ -1289,6 +1318,13 @@ class ProceduresApiService {
1289
1318
  body,
1290
1319
  });
1291
1320
  }
1321
+ catalogExecute$(body) {
1322
+ return this.baseHttpService.api({
1323
+ url: `${this.SERVICE_URL}/catalog/execute`,
1324
+ method: 'post',
1325
+ body,
1326
+ });
1327
+ }
1292
1328
  /**
1293
1329
  * Run active procedure against QuoteDraft
1294
1330
  * @param body
@@ -1557,6 +1593,11 @@ class ProductModelApiService {
1557
1593
  return linkedModels;
1558
1594
  }));
1559
1595
  }
1596
+ /**
1597
+ *
1598
+ * @deprecated
1599
+ * Will be removed in next major release
1600
+ */
1560
1601
  load(id, version) {
1561
1602
  return forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(map(([model, linkedModels]) => {
1562
1603
  const container = new ProductModelsContainer(model, linkedModels !== null && linkedModels !== void 0 ? linkedModels : []);
@@ -1965,6 +2006,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
1965
2006
  type: Injectable
1966
2007
  }], ctorParameters: function () { return [{ type: ConfigurationSettingsApiService }]; } });
1967
2008
 
2009
+ class UIDefinitionsApiService {
2010
+ constructor(baseHttpService) {
2011
+ this.baseHttpService = baseHttpService;
2012
+ }
2013
+ fetch$(modelId, version) {
2014
+ const serviceUrl = this.getServiceUrl(modelId);
2015
+ let params = new HttpParams();
2016
+ if (version != null) {
2017
+ params = params.set('modelVersion', version);
2018
+ }
2019
+ return this.baseHttpService
2020
+ .api({
2021
+ method: 'get',
2022
+ url: serviceUrl,
2023
+ params: params,
2024
+ })
2025
+ .pipe(map$1(containers => containers.map(uiDefinitionFromDTO)));
2026
+ }
2027
+ create$(modelId, uiDefinitionContainer) {
2028
+ const serviceUrl = this.getServiceUrl(modelId);
2029
+ const dto = Object.assign(Object.assign({}, omit(uiDefinitionContainer, 'source')), { sourceBlob: JSON.stringify(uiDefinitionContainer.source) });
2030
+ return this.baseHttpService
2031
+ .api({
2032
+ method: 'post',
2033
+ url: serviceUrl,
2034
+ body: dto,
2035
+ })
2036
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2037
+ }
2038
+ get$(modelId, uiDefinitionId) {
2039
+ const serviceUrl = this.getServiceUrl(modelId);
2040
+ return this.baseHttpService
2041
+ .api({
2042
+ method: 'get',
2043
+ url: `${serviceUrl}/${uiDefinitionId}`,
2044
+ })
2045
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2046
+ }
2047
+ update$(uiDefinitionContainer) {
2048
+ const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
2049
+ const dto = uiDefinitionToDTO(uiDefinitionContainer);
2050
+ return this.baseHttpService
2051
+ .api({
2052
+ method: 'put',
2053
+ url: `${serviceUrl}/${uiDefinitionContainer.id}`,
2054
+ body: dto,
2055
+ })
2056
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2057
+ }
2058
+ delete$(uiDefinitionContainer) {
2059
+ const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
2060
+ return this.baseHttpService.api({
2061
+ method: 'delete',
2062
+ url: `${serviceUrl}/${uiDefinitionContainer.id}`,
2063
+ });
2064
+ }
2065
+ getServiceUrl(modelId) {
2066
+ return `/models/${modelId}/uidefinitions`;
2067
+ }
2068
+ }
2069
+ UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2070
+ UIDefinitionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService });
2071
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService, decorators: [{
2072
+ type: Injectable
2073
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2074
+
1968
2075
  const fromUIComponentStoryDTO = (dto, attachments) => {
1969
2076
  return {
1970
2077
  id: dto.id,
@@ -2288,6 +2395,7 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
2288
2395
  EndpointsApiService,
2289
2396
  OrgInfoApiService,
2290
2397
  OffersApiService,
2398
+ UIDefinitionsApiService,
2291
2399
  ], imports: [HttpClientModule] });
2292
2400
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ApiModule, decorators: [{
2293
2401
  type: NgModule,
@@ -2324,6 +2432,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2324
2432
  EndpointsApiService,
2325
2433
  OrgInfoApiService,
2326
2434
  OffersApiService,
2435
+ UIDefinitionsApiService,
2327
2436
  ],
2328
2437
  }]
2329
2438
  }] });
@@ -2332,5 +2441,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2332
2441
  * Generated bundle index. Do not edit.
2333
2442
  */
2334
2443
 
2335
- export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationSettingsApiService, ContextApiService, DeltaApiService, DocumentAttachmentApiService, DocumentTemplatesApiService, EndpointsApiService, FlowsApiService, GuidedSellingApiService, GuidedSellingsAdminApiService, OffersApiService, OrgInfoApiService, PicklistsApiService, PriceApiService, ProceduresApiService, ProductApiService, ProductModelApiService, QuoteApiService, RampApiService, RuleGroupsApiService, RulesApiService, SalesforceApiService, ScriptsApiService, ShoppingCartSettingsApiService, UITemplatesApiService };
2444
+ export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationSettingsApiService, ContextApiService, DeltaApiService, DocumentAttachmentApiService, DocumentTemplatesApiService, EndpointsApiService, FlowsApiService, GuidedSellingApiService, GuidedSellingsAdminApiService, OffersApiService, OrgInfoApiService, PicklistsApiService, PriceApiService, ProceduresApiService, ProductApiService, ProductModelApiService, QuoteApiService, RampApiService, RuleGroupsApiService, RulesApiService, SalesforceApiService, ScriptsApiService, ShoppingCartSettingsApiService, UIDefinitionsApiService, UITemplatesApiService };
2336
2445
  //# sourceMappingURL=veloceapps-api.mjs.map