@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
 
14
15
  class AccountApiService {
@@ -240,6 +241,32 @@ class CatalogAdminApiService {
240
241
  });
241
242
  };
242
243
  }
244
+ attachImage$(catalogId, categoryId, file) {
245
+ const data = new FormData();
246
+ data.append('image', file);
247
+ return this.baseHttpService.upload({
248
+ method: 'post',
249
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
250
+ body: data,
251
+ });
252
+ }
253
+ removeImage$(catalogId, categoryId) {
254
+ return this.baseHttpService.api({
255
+ method: 'delete',
256
+ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
257
+ });
258
+ }
259
+ fetchImage$(catalogId, categoryId) {
260
+ return this.baseHttpService.api({
261
+ url: this.getImageUrl(catalogId, categoryId),
262
+ method: 'get',
263
+ responseType: 'blob',
264
+ errorHandler: noop,
265
+ });
266
+ }
267
+ getImageUrl(catalogId, categoryId) {
268
+ return `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`;
269
+ }
243
270
  }
244
271
  CatalogAdminApiService.MAX_RESULTS = 60;
245
272
  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 +393,16 @@ class ConfigurationApiService {
366
393
  url: `${this.SERVICE_URL}/${productId}/model` + ((offeringId && `/${offeringId}`) || ''),
367
394
  })
368
395
  .pipe(map(runtimeData => {
369
- runtimeData.uiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
370
- runtimeData.uiDefinitions.forEach(uiDefinition => {
371
- ModelTranslatorUtils.toLocalUIDefinition(uiDefinition);
372
- });
373
- return runtimeData;
396
+ return {
397
+ ...runtimeData,
398
+ uiDefinitions: runtimeData.uiDefinitions.map(dto => {
399
+ const uiDefinitionContainer = uiDefinitionFromDTO(dto);
400
+ if (isLegacyUIDefinition(uiDefinitionContainer.source)) {
401
+ ModelTranslatorUtils.toLocalUIDefinition(uiDefinitionContainer.source);
402
+ }
403
+ return uiDefinitionContainer;
404
+ }),
405
+ };
374
406
  }));
375
407
  }
376
408
  getRuntimeDataByModelId(modelId) {
@@ -1394,6 +1426,13 @@ class ProceduresApiService {
1394
1426
  body,
1395
1427
  });
1396
1428
  }
1429
+ catalogExecute$(body) {
1430
+ return this.baseHttpService.api({
1431
+ url: `${this.SERVICE_URL}/catalog/execute`,
1432
+ method: 'post',
1433
+ body,
1434
+ });
1435
+ }
1397
1436
  /**
1398
1437
  * Run active procedure against QuoteDraft
1399
1438
  * @param body
@@ -1662,6 +1701,11 @@ class ProductModelApiService {
1662
1701
  return linkedModels;
1663
1702
  }));
1664
1703
  }
1704
+ /**
1705
+ *
1706
+ * @deprecated
1707
+ * Will be removed in next major release
1708
+ */
1665
1709
  load(id, version) {
1666
1710
  return forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(map(([model, linkedModels]) => {
1667
1711
  const container = new ProductModelsContainer(model, linkedModels ?? []);
@@ -2090,6 +2134,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2090
2134
  type: Injectable
2091
2135
  }], ctorParameters: function () { return [{ type: ConfigurationSettingsApiService }]; } });
2092
2136
 
2137
+ class UIDefinitionsApiService {
2138
+ constructor(baseHttpService) {
2139
+ this.baseHttpService = baseHttpService;
2140
+ }
2141
+ fetch$(modelId, version) {
2142
+ const serviceUrl = this.getServiceUrl(modelId);
2143
+ let params = new HttpParams();
2144
+ if (version != null) {
2145
+ params = params.set('modelVersion', version);
2146
+ }
2147
+ return this.baseHttpService
2148
+ .api({
2149
+ method: 'get',
2150
+ url: serviceUrl,
2151
+ params: params,
2152
+ })
2153
+ .pipe(map$1(containers => containers.map(uiDefinitionFromDTO)));
2154
+ }
2155
+ create$(modelId, uiDefinitionContainer) {
2156
+ const serviceUrl = this.getServiceUrl(modelId);
2157
+ const dto = {
2158
+ ...omit(uiDefinitionContainer, 'source'),
2159
+ sourceBlob: JSON.stringify(uiDefinitionContainer.source),
2160
+ };
2161
+ return this.baseHttpService
2162
+ .api({
2163
+ method: 'post',
2164
+ url: serviceUrl,
2165
+ body: dto,
2166
+ })
2167
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2168
+ }
2169
+ get$(modelId, uiDefinitionId) {
2170
+ const serviceUrl = this.getServiceUrl(modelId);
2171
+ return this.baseHttpService
2172
+ .api({
2173
+ method: 'get',
2174
+ url: `${serviceUrl}/${uiDefinitionId}`,
2175
+ })
2176
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2177
+ }
2178
+ update$(uiDefinitionContainer) {
2179
+ const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
2180
+ const dto = uiDefinitionToDTO(uiDefinitionContainer);
2181
+ return this.baseHttpService
2182
+ .api({
2183
+ method: 'put',
2184
+ url: `${serviceUrl}/${uiDefinitionContainer.id}`,
2185
+ body: dto,
2186
+ })
2187
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
2188
+ }
2189
+ delete$(uiDefinitionContainer) {
2190
+ const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
2191
+ return this.baseHttpService.api({
2192
+ method: 'delete',
2193
+ url: `${serviceUrl}/${uiDefinitionContainer.id}`,
2194
+ });
2195
+ }
2196
+ getServiceUrl(modelId) {
2197
+ return `/models/${modelId}/uidefinitions`;
2198
+ }
2199
+ }
2200
+ UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2201
+ UIDefinitionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService });
2202
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: UIDefinitionsApiService, decorators: [{
2203
+ type: Injectable
2204
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2205
+
2093
2206
  const fromUIComponentStoryDTO = (dto, attachments) => {
2094
2207
  return {
2095
2208
  id: dto.id,
@@ -2413,6 +2526,7 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
2413
2526
  EndpointsApiService,
2414
2527
  OrgInfoApiService,
2415
2528
  OffersApiService,
2529
+ UIDefinitionsApiService,
2416
2530
  ], imports: [HttpClientModule] });
2417
2531
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ApiModule, decorators: [{
2418
2532
  type: NgModule,
@@ -2449,6 +2563,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2449
2563
  EndpointsApiService,
2450
2564
  OrgInfoApiService,
2451
2565
  OffersApiService,
2566
+ UIDefinitionsApiService,
2452
2567
  ],
2453
2568
  }]
2454
2569
  }] });
@@ -2457,5 +2572,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2457
2572
  * Generated bundle index. Do not edit.
2458
2573
  */
2459
2574
 
2460
- 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 };
2575
+ 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 };
2461
2576
  //# sourceMappingURL=veloceapps-api.mjs.map