@veloceapps/api 7.0.2-42 → 7.0.2-44

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 { uiDefinitionFromDTO, isLegacyUIDefinition, 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 });
@@ -2107,6 +2134,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2107
2134
  type: Injectable
2108
2135
  }], ctorParameters: function () { return [{ type: ConfigurationSettingsApiService }]; } });
2109
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
+
2110
2206
  const fromUIComponentStoryDTO = (dto, attachments) => {
2111
2207
  return {
2112
2208
  id: dto.id,
@@ -2430,6 +2526,7 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
2430
2526
  EndpointsApiService,
2431
2527
  OrgInfoApiService,
2432
2528
  OffersApiService,
2529
+ UIDefinitionsApiService,
2433
2530
  ], imports: [HttpClientModule] });
2434
2531
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ApiModule, decorators: [{
2435
2532
  type: NgModule,
@@ -2466,6 +2563,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2466
2563
  EndpointsApiService,
2467
2564
  OrgInfoApiService,
2468
2565
  OffersApiService,
2566
+ UIDefinitionsApiService,
2469
2567
  ],
2470
2568
  }]
2471
2569
  }] });
@@ -2474,5 +2572,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2474
2572
  * Generated bundle index. Do not edit.
2475
2573
  */
2476
2574
 
2477
- 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 };
2478
2576
  //# sourceMappingURL=veloceapps-api.mjs.map