@veloceapps/api 8.0.0-19 → 8.0.0-190

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.
Files changed (55) hide show
  1. package/esm2020/index.mjs +10 -4
  2. package/esm2020/lib/api.module.mjs +22 -4
  3. package/esm2020/lib/services/account-api.service.mjs +8 -1
  4. package/esm2020/lib/services/auth.service.mjs +22 -0
  5. package/esm2020/lib/services/configuration-api.service.mjs +45 -12
  6. package/esm2020/lib/services/configuration-processors-api.service.mjs +38 -0
  7. package/esm2020/lib/services/contracted-price-api.service.mjs +45 -0
  8. package/esm2020/lib/services/document-templates-api.service.mjs +6 -4
  9. package/esm2020/lib/services/flow-state-api.mjs +142 -0
  10. package/esm2020/lib/services/flows-api.service.mjs +9 -5
  11. package/esm2020/lib/services/portals-api.service.mjs +76 -0
  12. package/esm2020/lib/services/procedures-api.service.mjs +7 -1
  13. package/esm2020/lib/services/quote-api.service.mjs +18 -2
  14. package/esm2020/lib/services/rebate-program-api.service.mjs +1 -1
  15. package/esm2020/lib/services/rules-api.service.mjs +11 -2
  16. package/esm2020/lib/services/salesforce-api.service.mjs +4 -2
  17. package/esm2020/lib/services/sandbox-manager-api.service.mjs +67 -0
  18. package/esm2020/lib/services/scripts-api.service.mjs +6 -3
  19. package/esm2020/lib/services/stateful-configuration-api.mjs +1 -1
  20. package/esm2020/lib/services/ui-templates-api.service.mjs +6 -1
  21. package/esm2020/lib/services/veloce-objects-api.service.mjs +11 -1
  22. package/esm2020/lib/types/auth.types.mjs +2 -0
  23. package/esm2020/lib/types/index.mjs +3 -1
  24. package/esm2020/lib/types/org-info.types.mjs +1 -1
  25. package/esm2020/lib/types/quote.types.mjs +2 -0
  26. package/esm2020/lib/types/stateful-configuration.types.mjs +1 -1
  27. package/fesm2015/veloceapps-api.mjs +687 -229
  28. package/fesm2015/veloceapps-api.mjs.map +1 -1
  29. package/fesm2020/veloceapps-api.mjs +693 -218
  30. package/fesm2020/veloceapps-api.mjs.map +1 -1
  31. package/index.d.ts +9 -3
  32. package/lib/services/account-api.service.d.ts +2 -1
  33. package/lib/services/auth.service.d.ts +11 -0
  34. package/lib/services/configuration-api.service.d.ts +5 -0
  35. package/lib/services/configuration-processors-api.service.d.ts +14 -0
  36. package/lib/services/contracted-price-api.service.d.ts +16 -0
  37. package/lib/services/flow-state-api.d.ts +84 -0
  38. package/lib/services/flows-api.service.d.ts +1 -1
  39. package/lib/services/portals-api.service.d.ts +20 -0
  40. package/lib/services/procedures-api.service.d.ts +1 -0
  41. package/lib/services/quote-api.service.d.ts +13 -6
  42. package/lib/services/rebate-program-api.service.d.ts +1 -1
  43. package/lib/services/rules-api.service.d.ts +1 -0
  44. package/lib/services/salesforce-api.service.d.ts +1 -1
  45. package/lib/services/sandbox-manager-api.service.d.ts +22 -0
  46. package/lib/services/scripts-api.service.d.ts +1 -1
  47. package/lib/services/stateful-configuration-api.d.ts +2 -2
  48. package/lib/services/ui-templates-api.service.d.ts +1 -0
  49. package/lib/services/veloce-objects-api.service.d.ts +2 -1
  50. package/lib/types/auth.types.d.ts +4 -0
  51. package/lib/types/index.d.ts +2 -0
  52. package/lib/types/org-info.types.d.ts +1 -0
  53. package/lib/types/quote.types.d.ts +8 -0
  54. package/lib/types/stateful-configuration.types.d.ts +1 -1
  55. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
- import * as i4 from '@angular/common/http';
2
- import { HttpParams, HttpErrorResponse, HttpClientModule } from '@angular/common/http';
1
+ import * as i1$1 from '@angular/common/http';
2
+ import { HttpParams, HttpHeaders, HttpErrorResponse, HttpClientModule } from '@angular/common/http';
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, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
6
+ import { uiDefinitionFromDTO, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, toLatestFlow, isDefined, Operator, ModelTranslatorUtils, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
7
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';
@@ -28,6 +28,9 @@ class AccountApiService {
28
28
  getAccount$(id, options) {
29
29
  return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${id}` }, options));
30
30
  }
31
+ getAssetsState(accountId, options) {
32
+ return this.httpService.api(Object.assign({ method: 'get', url: `/v2${this.SERVICE_URL}/${accountId}/assets` }, options));
33
+ }
31
34
  getAssets(accountId, options) {
32
35
  return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${accountId}/assets` }, options));
33
36
  }
@@ -59,6 +62,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
59
62
  type: Injectable
60
63
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
61
64
 
65
+ class VeloceAuthService {
66
+ constructor(http) {
67
+ this.http = http;
68
+ }
69
+ auth$(instanceUrl, accessToken) {
70
+ const headers = new HttpHeaders({
71
+ 'Content-Type': 'application/json',
72
+ Authorization: `Bearer ${accessToken}`,
73
+ });
74
+ return this.http.get(`${instanceUrl}/services/apexrest/VELOCPQ/veloce-auth`, { headers });
75
+ }
76
+ }
77
+ VeloceAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VeloceAuthService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
78
+ VeloceAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VeloceAuthService });
79
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VeloceAuthService, decorators: [{
80
+ type: Injectable
81
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
82
+
62
83
  class CatalogAdminApiService {
63
84
  constructor(baseHttpService) {
64
85
  this.baseHttpService = baseHttpService;
@@ -354,6 +375,23 @@ class ConfigurationApiService {
354
375
  }
355
376
  }));
356
377
  }
378
+ customConfigurePrice({ url, configurationRequest, runtimeModel, }) {
379
+ return this.httpService
380
+ .api({
381
+ method: 'post',
382
+ url,
383
+ body: configurationRequest,
384
+ errorHandler: e => throwError(e),
385
+ })
386
+ .pipe(map(configurePrice => {
387
+ if (runtimeModel) {
388
+ return Object.assign(Object.assign({}, configurePrice), { lineItem: this.updatePortDomains(configurePrice.lineItem, runtimeModel) });
389
+ }
390
+ else {
391
+ return configurePrice;
392
+ }
393
+ }));
394
+ }
357
395
  getRuntimeDataByProductId(productId, offeringId) {
358
396
  return this.httpService
359
397
  .api({
@@ -361,13 +399,7 @@ class ConfigurationApiService {
361
399
  url: `${this.SERVICE_URL}/${productId}/model` + ((offeringId && `/${offeringId}`) || ''),
362
400
  })
363
401
  .pipe(map(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
- }) });
402
+ return Object.assign(Object.assign({}, runtimeData), { uiDefinitions: runtimeData.uiDefinitions.map(dto => uiDefinitionFromDTO(dto)) });
371
403
  }));
372
404
  }
373
405
  getRuntimeDataByModelId(modelId) {
@@ -380,10 +412,26 @@ class ConfigurationApiService {
380
412
  var _a, _b, _c;
381
413
  const type = runtimeModel.components.get(lineItem.type);
382
414
  const portDomains = Object.assign({}, lineItem.portDomains);
415
+ // loop through ports to look for 'None' type domain computations
383
416
  for (const port of (_a = type === null || type === void 0 ? void 0 : type.ports) !== null && _a !== void 0 ? _a : []) {
384
- const portDomain = portDomains[port.name];
385
- if (((_b = portDomain === null || portDomain === void 0 ? void 0 : portDomain.properties) === null || _b === void 0 ? void 0 : _b['domainComputation']) === 'false') {
386
- portDomain.domainTypes = port.domainTypes;
417
+ const { name: portName, type: typeName, min, max, domainTypes, properties } = port;
418
+ const portDomain = portDomains[portName];
419
+ if (portDomain) {
420
+ // there's a 'None' type domain computation
421
+ if (((_b = portDomain.properties) === null || _b === void 0 ? void 0 : _b['domainComputation']) === ('None')) {
422
+ portDomain.domainTypes = domainTypes;
423
+ }
424
+ }
425
+ else {
426
+ // there's no port domain so consider that as 'None' type domain computation
427
+ portDomains[portName] = {
428
+ name: portName,
429
+ type: typeName,
430
+ minCard: Number(min),
431
+ maxCard: Number(max),
432
+ domainTypes: domainTypes,
433
+ properties: Object.assign(Object.assign({}, properties), { domainComputation: 'None' }),
434
+ };
387
435
  }
388
436
  }
389
437
  return Object.assign(Object.assign({}, lineItem), { lineItems: (_c = lineItem.lineItems) === null || _c === void 0 ? void 0 : _c.map(i => this.updatePortDomains(i, runtimeModel)), portDomains });
@@ -395,6 +443,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
395
443
  type: Injectable
396
444
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
397
445
 
446
+ class ConfigurationProcessorsApiService {
447
+ constructor(baseHttpService) {
448
+ this.baseHttpService = baseHttpService;
449
+ this.serviceUrl = '/configuration/processors/owners';
450
+ this.fetchConfigurationProcessors$ = (ownerId) => {
451
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${ownerId}` });
452
+ };
453
+ this.createConfigurationProcessors$ = (configurationProcessor) => {
454
+ return this.baseHttpService.api({
455
+ method: 'post',
456
+ url: `${this.serviceUrl}/${configurationProcessor.ownerId}`,
457
+ body: configurationProcessor,
458
+ });
459
+ };
460
+ this.updateConfigurationProcessors$ = (configurationProcessor) => {
461
+ return this.baseHttpService.api({
462
+ method: 'put',
463
+ url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
464
+ body: configurationProcessor,
465
+ });
466
+ };
467
+ this.deleteConfigurationProcessors$ = (configurationProcessor) => {
468
+ return this.baseHttpService.api({
469
+ method: 'delete',
470
+ url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
471
+ });
472
+ };
473
+ }
474
+ }
475
+ ConfigurationProcessorsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
476
+ ConfigurationProcessorsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService });
477
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, decorators: [{
478
+ type: Injectable
479
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
480
+
398
481
  class ConfigurationSettingsDTO {
399
482
  static fromDTO(dto, key) {
400
483
  return {
@@ -492,6 +575,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
492
575
  type: Injectable
493
576
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
494
577
 
578
+ class ContractedPriceApiService {
579
+ constructor(baseHttpService) {
580
+ this.baseHttpService = baseHttpService;
581
+ this.serviceUrl = '/admin/contracted-price';
582
+ this.fetchContractedPrices$ = () => {
583
+ return this.baseHttpService.api({ url: `${this.serviceUrl}` });
584
+ };
585
+ this.fetchContractedPrice$ = (id) => {
586
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
587
+ };
588
+ this.createContractedPrice$ = (data) => {
589
+ return this.baseHttpService.api({
590
+ url: `${this.serviceUrl}`,
591
+ method: 'put',
592
+ body: data,
593
+ });
594
+ };
595
+ this.updateContractedPrice$ = (data) => {
596
+ return this.baseHttpService.api({
597
+ url: `${this.serviceUrl}/${data.id}`,
598
+ method: 'put',
599
+ body: data,
600
+ });
601
+ };
602
+ this.searchContractedPrices$ = (searchParams, expression) => {
603
+ const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
604
+ return this.baseHttpService.api({
605
+ method: 'post',
606
+ url: `${this.serviceUrl}/search`,
607
+ params,
608
+ body: expression || {},
609
+ });
610
+ };
611
+ }
612
+ }
613
+ ContractedPriceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContractedPriceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
614
+ ContractedPriceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContractedPriceApiService });
615
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContractedPriceApiService, decorators: [{
616
+ type: Injectable
617
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
618
+
495
619
  class DeltaApiService {
496
620
  constructor(httpService) {
497
621
  this.httpService = httpService;
@@ -612,7 +736,9 @@ class SalesforceApiService {
612
736
  return this.httpService.api(Object.assign({ method: 'post', url: methodUrl, body: fields }, options));
613
737
  }
614
738
  apexGetRequest(path, params, options) {
615
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/apex${path}`, params }, options));
739
+ // this line is needed because HttpParams instance from Integration behaves wrong in studio instance of Angular
740
+ const httpParams = new HttpParams({ fromString: params.toString() });
741
+ return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/apex${path}`, params: httpParams }, options));
616
742
  }
617
743
  apexPostRequest(path, body, options) {
618
744
  return this.httpService.api(Object.assign({ method: 'post', body, url: `${this.SERVICE_URL}/apex${path}` }, options));
@@ -645,7 +771,7 @@ class DocumentTemplatesApiService {
645
771
  this.http = http;
646
772
  this.DOCGEN_TAG = 'docgen';
647
773
  this.SERVICE_URL = '/templates';
648
- this.DOC_GEN_URL_FALLBACK = 'https://dev-dp1.velocpq.com/docgen';
774
+ this.DOC_GEN_URL_FALLBACK = `${window.VELO_API}/docgen`;
649
775
  this.mapSfQueryResult = (limit) => map((records) => {
650
776
  if (!records.length) {
651
777
  return { _result: 'No Records Found' };
@@ -783,11 +909,13 @@ class DocumentTemplatesApiService {
783
909
  generateDocument(template, object, params = {}) {
784
910
  const documentData$ = this.generateDocumentData(template, object, Object.assign(Object.assign({}, params), { shouldPreventDownload: true }));
785
911
  return zip(this.getTemplateFile(template.id), documentData$, this.resolveAttachments$(template)).pipe(switchMap(([templateFile, data, attachments]) => {
786
- var _a, _b, _c, _d, _e, _f;
912
+ var _a, _b, _c, _d, _e, _f, _g, _h;
787
913
  const document = DocxTemplater.generate(templateFile, data);
788
914
  const properties = (_c = (_b = (_a = object === null || object === void 0 ? void 0 : object.context) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : object === null || object === void 0 ? void 0 : object.properties) !== null && _c !== void 0 ? _c : {};
789
- const documentName = properties['Name'] || template.name;
790
- const documentFormat = (_d = params.documentFormat) !== null && _d !== void 0 ? _d : (_f = (_e = template.properties) === null || _e === void 0 ? void 0 : _e.find(p => p.name === 'documentFormat')) === null || _f === void 0 ? void 0 : _f.value;
915
+ const documentName = ((_e = (_d = template.properties) === null || _d === void 0 ? void 0 : _d.find(({ name }) => name === 'documentName')) === null || _e === void 0 ? void 0 : _e.value) ||
916
+ properties['Name'] ||
917
+ template.name;
918
+ const documentFormat = (_f = params.documentFormat) !== null && _f !== void 0 ? _f : (_h = (_g = template.properties) === null || _g === void 0 ? void 0 : _g.find(p => p.name === 'documentFormat')) === null || _h === void 0 ? void 0 : _h.value;
791
919
  if (documentFormat === 'DOCX') {
792
920
  this.fileDownloadService.processDownload(document, documentName);
793
921
  return of(document);
@@ -884,11 +1012,11 @@ class DocumentTemplatesApiService {
884
1012
  return forkJoin(attachmentIds.map(id => this.documentAttachmentService.getAttachmentFile(id, true)));
885
1013
  }
886
1014
  queryObject({ objectName, resultObjectName, fields, statement }, { properties }) {
887
- var _a;
1015
+ var _a, _b;
888
1016
  const patternLimit = /(\s*limit\s\d*)/i;
889
1017
  let limit = 1;
890
1018
  if (statement && patternLimit.test(statement)) {
891
- const limitStr = (_a = statement === null || statement === void 0 ? void 0 : statement.match(patternLimit)) === null || _a === void 0 ? void 0 : _a[1].trim().substring(5).trim();
1019
+ const limitStr = (_b = (_a = statement === null || statement === void 0 ? void 0 : statement.match(patternLimit)) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.trim().substring(5).trim();
892
1020
  if (limitStr) {
893
1021
  limit = Number.parseInt(limitStr, 10);
894
1022
  }
@@ -901,11 +1029,11 @@ class DocumentTemplatesApiService {
901
1029
  return this.salesforceApiService.query(searchRequest, objectName).pipe(this.mapSfQueryResult(limit), map(value => ({ [resultObjectName]: value })));
902
1030
  }
903
1031
  }
904
- DocumentTemplatesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentTemplatesApiService, deps: [{ token: i1.BaseHttpService }, { token: SalesforceApiService }, { token: i1.FileDownloadService }, { token: DocumentAttachmentApiService }, { token: i4.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1032
+ DocumentTemplatesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentTemplatesApiService, deps: [{ token: i1.BaseHttpService }, { token: SalesforceApiService }, { token: i1.FileDownloadService }, { token: DocumentAttachmentApiService }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
905
1033
  DocumentTemplatesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentTemplatesApiService });
906
1034
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentTemplatesApiService, decorators: [{
907
1035
  type: Injectable
908
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: SalesforceApiService }, { type: i1.FileDownloadService }, { type: DocumentAttachmentApiService }, { type: i4.HttpClient }]; } });
1036
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: SalesforceApiService }, { type: i1.FileDownloadService }, { type: DocumentAttachmentApiService }, { type: i1$1.HttpClient }]; } });
909
1037
 
910
1038
  class EndpointsApiService {
911
1039
  constructor(baseHttpService) {
@@ -982,18 +1110,160 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
982
1110
  type: Injectable
983
1111
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
984
1112
 
1113
+ class FlowStateApiService {
1114
+ constructor(httpService) {
1115
+ this.httpService = httpService;
1116
+ this.SERVICE_URL = '/configuration/states';
1117
+ }
1118
+ /**
1119
+ * Initialize flow state
1120
+ * @param request Request
1121
+ * @returns Flow initialization response, which contains session ID and result of selectors
1122
+ */
1123
+ init(request) {
1124
+ return this.httpService.api({
1125
+ method: 'post',
1126
+ url: `${this.SERVICE_URL}/quote/start`,
1127
+ body: request,
1128
+ });
1129
+ }
1130
+ /**
1131
+ * Get existing state by ID
1132
+ * @param id ID
1133
+ * @returns Flow State
1134
+ */
1135
+ get(id) {
1136
+ return this.httpService.api({
1137
+ url: `${this.SERVICE_URL}/${id}`,
1138
+ });
1139
+ }
1140
+ /**
1141
+ * Execute actions/selectors
1142
+ * @param id State ID
1143
+ * @param request Request
1144
+ * @returns Execute result
1145
+ */
1146
+ execute(id, request) {
1147
+ return this.httpService.api({
1148
+ method: 'post',
1149
+ url: `${this.SERVICE_URL}/quote/${id}/execute`,
1150
+ body: request,
1151
+ });
1152
+ }
1153
+ /**
1154
+ * Save Quote in the state
1155
+ * @param id State ID
1156
+ */
1157
+ save(id) {
1158
+ return this.httpService.api({
1159
+ method: 'post',
1160
+ url: `${this.SERVICE_URL}/quote/${id}/save`,
1161
+ });
1162
+ }
1163
+ /**
1164
+ * Submit Quote in the state
1165
+ * @param id State ID
1166
+ */
1167
+ submit(id) {
1168
+ return this.httpService.api({
1169
+ method: 'post',
1170
+ url: `${this.SERVICE_URL}/quote/${id}/submit`,
1171
+ });
1172
+ }
1173
+ /**
1174
+ * Close Flow state
1175
+ * @param id State ID
1176
+ */
1177
+ cancel(id) {
1178
+ return this.httpService.api({
1179
+ method: 'post',
1180
+ url: `${this.SERVICE_URL}/quote/${id}/cancel`,
1181
+ });
1182
+ }
1183
+ /**
1184
+ * Initialize stateful configuration
1185
+ * @param stateId string
1186
+ * @param request Request
1187
+ * @returns Flow initialization response, which contains session ID and result of selectors
1188
+ */
1189
+ newConfiguration(stateId, request) {
1190
+ return this.httpService.api({
1191
+ method: 'post',
1192
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/new`,
1193
+ body: request,
1194
+ });
1195
+ }
1196
+ /**
1197
+ * Start stateful configuration
1198
+ * @param stateId string
1199
+ * @param request Request
1200
+ * @returns Flow initialization response, which contains session ID and result of selectors
1201
+ */
1202
+ startConfiguration(stateId, request) {
1203
+ return this.httpService.api({
1204
+ method: 'post',
1205
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/start`,
1206
+ body: request,
1207
+ });
1208
+ }
1209
+ /**
1210
+ * Execute stateful configuration
1211
+ * @param stateId string
1212
+ * @param configurationId string
1213
+ * @param request Request
1214
+ * @returns Flow initialization response, which contains session ID and result of selectors
1215
+ */
1216
+ executeConfiguration(stateId, configurationId, request) {
1217
+ return this.httpService.api({
1218
+ method: 'post',
1219
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/execute`,
1220
+ body: request,
1221
+ });
1222
+ }
1223
+ /**
1224
+ * Save stateful configuration
1225
+ * @param stateId string
1226
+ * @param configurationId string
1227
+ */
1228
+ saveConfiguration(stateId, configurationId) {
1229
+ return this.httpService.api({
1230
+ method: 'post',
1231
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/save`,
1232
+ });
1233
+ }
1234
+ /**
1235
+ * Cancel stateful configuration
1236
+ * @param stateId string
1237
+ * @param configurationId string
1238
+ */
1239
+ cancelConfiguration(stateId, configurationId) {
1240
+ return this.httpService.api({
1241
+ method: 'post',
1242
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/cancel`,
1243
+ });
1244
+ }
1245
+ }
1246
+ FlowStateApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1247
+ FlowStateApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService });
1248
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService, decorators: [{
1249
+ type: Injectable
1250
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1251
+
985
1252
  class FlowsApiService {
986
1253
  constructor(configurationSettingsApiService) {
987
1254
  this.configurationSettingsApiService = configurationSettingsApiService;
988
1255
  this.flowsKey = 'flows';
989
1256
  }
990
1257
  getFlow(id) {
991
- return this.fetchFlows().pipe(map(flows => flows.find(flow => flow.id == id)));
1258
+ return this.fetchFlows().pipe(map(flows => flows.find(flow => flow.id == id)), map(flow => {
1259
+ if (!flow) {
1260
+ throw new Error(`Flow with flowId=${id} is not defined`);
1261
+ }
1262
+ return flow;
1263
+ }));
992
1264
  }
993
1265
  fetchFlows() {
994
- return this.configurationSettingsApiService
995
- .fetchSetting(this.flowsKey)
996
- .pipe(map((flow) => ((flow === null || flow === void 0 ? void 0 : flow.value) ? JSON.parse(flow.value) : [])));
1266
+ return this.configurationSettingsApiService.fetchSetting(this.flowsKey).pipe(map((setting) => ((setting === null || setting === void 0 ? void 0 : setting.value) ? JSON.parse(setting.value) : [])), map(anyFlows => anyFlows.map(toLatestFlow).filter(isDefined)));
997
1267
  }
998
1268
  }
999
1269
  FlowsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowsApiService, deps: [{ token: ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -1177,11 +1447,11 @@ class OrgInfoApiService {
1177
1447
  return this.http.get(`${this.hostUrl}/org-info/${organizationId}`);
1178
1448
  }
1179
1449
  }
1180
- OrgInfoApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, deps: [{ token: i4.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1450
+ OrgInfoApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1181
1451
  OrgInfoApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService });
1182
1452
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, decorators: [{
1183
1453
  type: Injectable
1184
- }], ctorParameters: function () { return [{ type: i4.HttpClient }]; } });
1454
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
1185
1455
 
1186
1456
  class PicklistsApiService {
1187
1457
  constructor(baseHttpService) {
@@ -1218,6 +1488,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1218
1488
  type: Injectable
1219
1489
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1220
1490
 
1491
+ class PortalsApiService {
1492
+ constructor(baseHttpService) {
1493
+ this.baseHttpService = baseHttpService;
1494
+ this.serviceUrl = '/admin/portal';
1495
+ this.getPortals$ = (skip = 1, name = '') => {
1496
+ let params = new HttpParams();
1497
+ params = params.append('count', (PortalsApiService.MAX_RESULTS * skip).toString());
1498
+ params = params.append('skip', '0');
1499
+ params = params.append('name', name);
1500
+ return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
1501
+ };
1502
+ this.searchPortals$ = (skip = 0, expression) => {
1503
+ let params = new HttpParams();
1504
+ params = params.set('skip', '' + skip);
1505
+ params = params.set('count', '' + PortalsApiService.MAX_RESULTS);
1506
+ return this.baseHttpService.api({
1507
+ method: 'post',
1508
+ url: `${this.serviceUrl}/search`,
1509
+ params,
1510
+ body: expression || {},
1511
+ });
1512
+ };
1513
+ this.removePortal$ = (id) => {
1514
+ return this.baseHttpService.api({
1515
+ url: `${this.serviceUrl}/${id}`,
1516
+ method: 'delete',
1517
+ });
1518
+ };
1519
+ this.restore$ = (id) => {
1520
+ return this.baseHttpService.api({
1521
+ method: 'patch',
1522
+ url: `${this.serviceUrl}/${id}/restore`,
1523
+ });
1524
+ };
1525
+ this.duplicatePortal$ = (cloneRequest) => {
1526
+ return this.baseHttpService.api({
1527
+ url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
1528
+ method: 'post',
1529
+ body: cloneRequest,
1530
+ });
1531
+ };
1532
+ this.getPortal$ = (id) => {
1533
+ return this.baseHttpService.api({
1534
+ url: `${this.serviceUrl}/${id}`,
1535
+ });
1536
+ };
1537
+ }
1538
+ createNewPortal$(body) {
1539
+ return this.baseHttpService.api({
1540
+ url: `${this.serviceUrl}`,
1541
+ method: 'post',
1542
+ body,
1543
+ });
1544
+ }
1545
+ updatePortal$(portal, settings) {
1546
+ return this.baseHttpService.api({
1547
+ url: `${this.serviceUrl}/${portal.id}`,
1548
+ method: 'put',
1549
+ body: Object.assign(Object.assign({}, portal), { settings: JSON.stringify(settings) }),
1550
+ });
1551
+ }
1552
+ }
1553
+ PortalsApiService.MAX_RESULTS = 60;
1554
+ PortalsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1555
+ PortalsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService });
1556
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, decorators: [{
1557
+ type: Injectable
1558
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1559
+
1221
1560
  class PriceApiService {
1222
1561
  constructor(httpService) {
1223
1562
  this.httpService = httpService;
@@ -1365,6 +1704,12 @@ class ProceduresApiService {
1365
1704
  body,
1366
1705
  });
1367
1706
  }
1707
+ fetchDefaultPricingSteps$() {
1708
+ return this.baseHttpService.api({
1709
+ url: `${this.ADMIN_SERVICE_URL}/pricing-steps`,
1710
+ method: 'get',
1711
+ });
1712
+ }
1368
1713
  }
1369
1714
  ProceduresApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1370
1715
  ProceduresApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService });
@@ -1751,30 +2096,104 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1751
2096
  type: Injectable
1752
2097
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1753
2098
 
1754
- class QuoteApiService {
1755
- constructor(httpService) {
1756
- this.httpService = httpService;
1757
- this.SERVICE_URL = '/quotes';
1758
- }
1759
- // request quoteId | accountId | opportunityId | orderId
1760
- getQuoteDraft(objectId, params, errorHandler) {
1761
- return this.httpService.api({
1762
- method: 'get',
1763
- url: `${this.SERVICE_URL}/${objectId}`,
1764
- params,
1765
- errorHandler,
1766
- });
1767
- }
1768
- upsertQuote(request, options) {
1769
- return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}`, body: request }, options));
1770
- }
1771
- submitQuote(request, options) {
1772
- return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}/submit`, body: request }, options));
1773
- }
1774
- attachDocument(id, documentName, data) {
1775
- const formData = new FormData();
1776
- const blob = new Blob([data]);
1777
- formData.append('file', blob, documentName);
2099
+ class PromotionsApiService {
2100
+ constructor(baseHttpService) {
2101
+ this.baseHttpService = baseHttpService;
2102
+ this.serviceUrl = '/admin/promotion';
2103
+ this.fetchAll$ = () => {
2104
+ return this.baseHttpService.api({ url: this.serviceUrl });
2105
+ };
2106
+ this.fetchOne$ = (id) => {
2107
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2108
+ };
2109
+ this.remove$ = (id) => {
2110
+ return this.baseHttpService.api({
2111
+ url: `${this.serviceUrl}/${id}`,
2112
+ method: 'delete',
2113
+ });
2114
+ };
2115
+ this.restore$ = (id) => {
2116
+ return this.baseHttpService.api({
2117
+ method: 'patch',
2118
+ url: `${this.serviceUrl}/${id}/restore`,
2119
+ });
2120
+ };
2121
+ this.duplicate$ = (body) => {
2122
+ return this.baseHttpService
2123
+ .api({
2124
+ url: `${this.serviceUrl}/${body.id}/clone`,
2125
+ method: 'post',
2126
+ body,
2127
+ })
2128
+ .pipe(map$1(response => response.clonedRecordId));
2129
+ };
2130
+ }
2131
+ search$(expression, skip, count) {
2132
+ let params = new HttpParams();
2133
+ if (typeof skip === 'number') {
2134
+ params = params.set('skip', '' + skip);
2135
+ }
2136
+ if (typeof count === 'number') {
2137
+ params = params.set('count', '' + count);
2138
+ }
2139
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2140
+ }
2141
+ create$(body) {
2142
+ return this.baseHttpService.api({
2143
+ url: `${this.serviceUrl}`,
2144
+ method: 'post',
2145
+ body,
2146
+ });
2147
+ }
2148
+ update$(body) {
2149
+ return this.baseHttpService.api({
2150
+ url: `${this.serviceUrl}/${body.id}`,
2151
+ method: 'put',
2152
+ body,
2153
+ });
2154
+ }
2155
+ }
2156
+ PromotionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2157
+ PromotionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService });
2158
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService, decorators: [{
2159
+ type: Injectable
2160
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2161
+
2162
+ class QuoteApiService {
2163
+ constructor(httpService) {
2164
+ this.httpService = httpService;
2165
+ this.SERVICE_URL = '/quotes';
2166
+ }
2167
+ /**
2168
+ * @deprecated Use getQuoteState instead
2169
+ */
2170
+ getQuoteDraft(objectId, params, errorHandler) {
2171
+ return this.httpService.api({
2172
+ method: 'get',
2173
+ url: `${this.SERVICE_URL}/${objectId}`,
2174
+ params,
2175
+ errorHandler,
2176
+ });
2177
+ }
2178
+ /**
2179
+ * Comparing to deprecated `getQuoteDraft` this endpoint doesn't include orders and assets
2180
+ * @param objectId quoteId | accountId | opportunityId | orderId
2181
+ * @param params Query params
2182
+ * @param options Request options
2183
+ */
2184
+ getQuoteState(objectId, params, options) {
2185
+ return this.httpService.api(Object.assign({ method: 'get', url: `/v2${this.SERVICE_URL}/${objectId}`, params }, options));
2186
+ }
2187
+ upsertQuote(request, options) {
2188
+ return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}`, body: request }, options));
2189
+ }
2190
+ submitQuote(request, options) {
2191
+ return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}/submit`, body: request }, options));
2192
+ }
2193
+ attachDocument(id, documentName, data) {
2194
+ const formData = new FormData();
2195
+ const blob = new Blob([data]);
2196
+ formData.append('file', blob, documentName);
1778
2197
  return this.httpService.upload({
1779
2198
  url: `${this.SERVICE_URL}/${id}/attach-document`,
1780
2199
  responseType: 'arraybuffer',
@@ -1807,6 +2226,132 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1807
2226
  type: Injectable
1808
2227
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1809
2228
 
2229
+ class RebateProgramApiService {
2230
+ constructor(baseHttpService) {
2231
+ this.baseHttpService = baseHttpService;
2232
+ this.serviceUrl = '/admin/rebate-program';
2233
+ this.fetchAll$ = () => {
2234
+ return this.baseHttpService.api({ url: this.serviceUrl });
2235
+ };
2236
+ this.fetchOne$ = (id) => {
2237
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2238
+ };
2239
+ this.remove$ = (id) => {
2240
+ return this.baseHttpService.api({
2241
+ url: `${this.serviceUrl}/${id}`,
2242
+ method: 'delete',
2243
+ });
2244
+ };
2245
+ this.restore$ = (id) => {
2246
+ return this.baseHttpService.api({
2247
+ method: 'patch',
2248
+ url: `${this.serviceUrl}/${id}/restore`,
2249
+ });
2250
+ };
2251
+ this.duplicate$ = (body) => {
2252
+ return this.baseHttpService
2253
+ .api({
2254
+ url: `${this.serviceUrl}/${body.id}/clone`,
2255
+ method: 'post',
2256
+ body,
2257
+ })
2258
+ .pipe(map$1(response => response.clonedRecordId));
2259
+ };
2260
+ }
2261
+ search$(expression, skip, count) {
2262
+ let params = new HttpParams();
2263
+ if (typeof skip === 'number') {
2264
+ params = params.set('skip', '' + skip);
2265
+ }
2266
+ if (typeof count === 'number') {
2267
+ params = params.set('count', '' + count);
2268
+ }
2269
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2270
+ }
2271
+ create$(body) {
2272
+ return this.baseHttpService.api({
2273
+ url: `${this.serviceUrl}`,
2274
+ method: 'post',
2275
+ body,
2276
+ });
2277
+ }
2278
+ update$(body) {
2279
+ return this.baseHttpService.api({
2280
+ url: `${this.serviceUrl}/${body.id}`,
2281
+ method: 'put',
2282
+ body,
2283
+ });
2284
+ }
2285
+ }
2286
+ RebateProgramApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2287
+ RebateProgramApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService });
2288
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService, decorators: [{
2289
+ type: Injectable
2290
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2291
+
2292
+ class RebateTypeApiService {
2293
+ constructor(baseHttpService) {
2294
+ this.baseHttpService = baseHttpService;
2295
+ this.serviceUrl = '/admin/rebate-type';
2296
+ this.fetchAll$ = () => {
2297
+ return this.baseHttpService.api({ url: this.serviceUrl });
2298
+ };
2299
+ this.fetchOne$ = (id) => {
2300
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2301
+ };
2302
+ this.remove$ = (id) => {
2303
+ return this.baseHttpService.api({
2304
+ url: `${this.serviceUrl}/${id}`,
2305
+ method: 'delete',
2306
+ });
2307
+ };
2308
+ this.restore$ = (id) => {
2309
+ return this.baseHttpService.api({
2310
+ method: 'patch',
2311
+ url: `${this.serviceUrl}/${id}/restore`,
2312
+ });
2313
+ };
2314
+ this.duplicate$ = (body) => {
2315
+ return this.baseHttpService
2316
+ .api({
2317
+ url: `${this.serviceUrl}/${body.id}/clone`,
2318
+ method: 'post',
2319
+ body,
2320
+ })
2321
+ .pipe(map$1(response => response.clonedRecordId));
2322
+ };
2323
+ }
2324
+ search$(expression, skip, count) {
2325
+ let params = new HttpParams();
2326
+ if (typeof skip === 'number') {
2327
+ params = params.set('skip', '' + skip);
2328
+ }
2329
+ if (typeof count === 'number') {
2330
+ params = params.set('count', '' + count);
2331
+ }
2332
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2333
+ }
2334
+ create$(body) {
2335
+ return this.baseHttpService.api({
2336
+ url: `${this.serviceUrl}`,
2337
+ method: 'post',
2338
+ body,
2339
+ });
2340
+ }
2341
+ update$(body) {
2342
+ return this.baseHttpService.api({
2343
+ url: `${this.serviceUrl}/${body.id}`,
2344
+ method: 'put',
2345
+ body,
2346
+ });
2347
+ }
2348
+ }
2349
+ RebateTypeApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2350
+ RebateTypeApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService });
2351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService, decorators: [{
2352
+ type: Injectable
2353
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2354
+
1810
2355
  class RuleGroupsApiService {
1811
2356
  constructor(baseHttpService) {
1812
2357
  this.baseHttpService = baseHttpService;
@@ -1929,13 +2474,22 @@ class RulesApiService {
1929
2474
  });
1930
2475
  }
1931
2476
  execute$(body) {
1932
- const url = body.rule.ruleGroupType === RuleGroupTypes.eligibility ? '/rules/eligibility/execute' : '/rules/execute';
2477
+ const url = this.getExecuteRuleUrl(body.rule.ruleGroupType);
1933
2478
  return this.baseHttpService.api({
1934
2479
  url,
1935
2480
  method: 'post',
1936
2481
  body,
1937
2482
  });
1938
2483
  }
2484
+ getExecuteRuleUrl(ruleGroupType) {
2485
+ if (ruleGroupType === RuleGroupTypes.eligibility) {
2486
+ return '/rules/eligibility/execute';
2487
+ }
2488
+ if (ruleGroupType === RuleGroupTypes.catalog) {
2489
+ return '/rules/catalog/execute';
2490
+ }
2491
+ return '/rules/execute';
2492
+ }
1939
2493
  }
1940
2494
  RulesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1941
2495
  RulesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService });
@@ -1985,11 +2539,13 @@ class ScriptsApiService {
1985
2539
  });
1986
2540
  };
1987
2541
  this.cloneScript$ = (cloneRequest) => {
1988
- return this.baseHttpService.api({
2542
+ return this.baseHttpService
2543
+ .api({
1989
2544
  url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
1990
2545
  method: 'post',
1991
2546
  body: cloneRequest,
1992
- });
2547
+ })
2548
+ .pipe(map(response => response.clonedRecordId));
1993
2549
  };
1994
2550
  this.removeScript$ = (id) => {
1995
2551
  return this.baseHttpService.api({
@@ -2388,6 +2944,11 @@ class UITemplatesApiService {
2388
2944
  this.fetchComponentAttachmentFile$(templateId, component.id, 'json'),
2389
2945
  ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
2390
2946
  };
2947
+ this.fetchComponentsAttachments$ = (templateId) => {
2948
+ return this.fetchComponents$(templateId).pipe(switchMap$1(components => {
2949
+ return forkJoin(components.map(component => this.fetchComponentAttachments$(templateId, component)));
2950
+ }));
2951
+ };
2391
2952
  this.fetchComponentAttachmentFile$ = (templateId, componentId, attachmentType) => {
2392
2953
  return this.baseHttpService
2393
2954
  .api({
@@ -2476,6 +3037,15 @@ class VeloceObjectsApiService {
2476
3037
  url: `${this.serviceUrl}/${id}`,
2477
3038
  });
2478
3039
  };
3040
+ this.duplicateObject$ = (body) => {
3041
+ return this.baseHttpService
3042
+ .api({
3043
+ method: 'post',
3044
+ url: `${this.serviceUrl}/${body.id}/clone`,
3045
+ body,
3046
+ })
3047
+ .pipe(map(response => response.clonedRecordId));
3048
+ };
2479
3049
  this.restoreObject$ = (id) => {
2480
3050
  return this.baseHttpService.api({
2481
3051
  method: 'patch',
@@ -2520,194 +3090,70 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2520
3090
  type: Injectable
2521
3091
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2522
3092
 
2523
- class RebateProgramApiService {
2524
- constructor(baseHttpService) {
2525
- this.baseHttpService = baseHttpService;
2526
- this.serviceUrl = '/admin/rebate-program';
2527
- this.fetchAll$ = () => {
2528
- return this.baseHttpService.api({ url: this.serviceUrl });
2529
- };
2530
- this.fetchOne$ = (id) => {
2531
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2532
- };
2533
- this.remove$ = (id) => {
2534
- return this.baseHttpService.api({
2535
- url: `${this.serviceUrl}/${id}`,
2536
- method: 'delete',
2537
- });
2538
- };
2539
- this.restore$ = (id) => {
2540
- return this.baseHttpService.api({
2541
- method: 'patch',
2542
- url: `${this.serviceUrl}/${id}/restore`,
2543
- });
2544
- };
2545
- this.duplicate$ = (body) => {
2546
- return this.baseHttpService
2547
- .api({
2548
- url: `${this.serviceUrl}/${body.id}/clone`,
2549
- method: 'post',
2550
- body,
2551
- })
2552
- .pipe(map$1(response => response.clonedRecordId));
2553
- };
2554
- }
2555
- search$(expression, skip, count) {
2556
- let params = new HttpParams();
2557
- if (typeof skip === 'number') {
2558
- params = params.set('skip', '' + skip);
2559
- }
2560
- if (typeof count === 'number') {
2561
- params = params.set('count', '' + count);
2562
- }
2563
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2564
- }
2565
- create$(body) {
2566
- return this.baseHttpService.api({
2567
- url: `${this.serviceUrl}`,
2568
- method: 'post',
2569
- body,
3093
+ class SandboxManagerApiService {
3094
+ constructor(http) {
3095
+ var _a, _b, _c;
3096
+ this.http = http;
3097
+ this.TOKEN_HEADER = (_b = `signed_request=${encodeURIComponent((_a = window.SANDBOX_TOKEN) !== null && _a !== void 0 ? _a : '')}`) !== null && _b !== void 0 ? _b : '';
3098
+ this.SANDBOX_URL_FALLBACK = 'https://sandbox-manager.velocecpq.com';
3099
+ this.hostUrl = `${(_c = window.VELO_SANDBOX_API) !== null && _c !== void 0 ? _c : this.SANDBOX_URL_FALLBACK}/clients`;
3100
+ }
3101
+ getSalesforceOrganizations$() {
3102
+ return this.http.get(`${this.hostUrl}/${window.VELO_CLIENT}/orgs`, {
3103
+ headers: {
3104
+ 'Veloce-Token': this.TOKEN_HEADER,
3105
+ },
2570
3106
  });
2571
3107
  }
2572
- update$(body) {
2573
- return this.baseHttpService.api({
2574
- url: `${this.serviceUrl}/${body.id}`,
2575
- method: 'put',
2576
- body,
3108
+ getAvailableSalesforceOrganizationSizes$() {
3109
+ return this.http.get(`${this.hostUrl}/${window.VELO_CLIENT}/available-sizes`, {
3110
+ headers: {
3111
+ 'Veloce-Token': this.TOKEN_HEADER,
3112
+ },
2577
3113
  });
2578
3114
  }
2579
- }
2580
- RebateProgramApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2581
- RebateProgramApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService });
2582
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService, decorators: [{
2583
- type: Injectable
2584
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2585
-
2586
- class RebateTypeApiService {
2587
- constructor(baseHttpService) {
2588
- this.baseHttpService = baseHttpService;
2589
- this.serviceUrl = '/admin/rebate-type';
2590
- this.fetchAll$ = () => {
2591
- return this.baseHttpService.api({ url: this.serviceUrl });
2592
- };
2593
- this.fetchOne$ = (id) => {
2594
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2595
- };
2596
- this.remove$ = (id) => {
2597
- return this.baseHttpService.api({
2598
- url: `${this.serviceUrl}/${id}`,
2599
- method: 'delete',
2600
- });
2601
- };
2602
- this.restore$ = (id) => {
2603
- return this.baseHttpService.api({
2604
- method: 'patch',
2605
- url: `${this.serviceUrl}/${id}/restore`,
2606
- });
2607
- };
2608
- this.duplicate$ = (body) => {
2609
- return this.baseHttpService
2610
- .api({
2611
- url: `${this.serviceUrl}/${body.id}/clone`,
2612
- method: 'post',
2613
- body,
2614
- })
2615
- .pipe(map$1(response => response.clonedRecordId));
2616
- };
2617
- }
2618
- search$(expression, skip, count) {
2619
- let params = new HttpParams();
2620
- if (typeof skip === 'number') {
2621
- params = params.set('skip', '' + skip);
2622
- }
2623
- if (typeof count === 'number') {
2624
- params = params.set('count', '' + count);
2625
- }
2626
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2627
- }
2628
- create$(body) {
2629
- return this.baseHttpService.api({
2630
- url: `${this.serviceUrl}`,
2631
- method: 'post',
2632
- body,
3115
+ createSalesforceOrganization$(payload) {
3116
+ return this.http.post(`${this.hostUrl}/${window.VELO_CLIENT}/orgs`, payload, {
3117
+ headers: {
3118
+ 'Veloce-Token': this.TOKEN_HEADER,
3119
+ },
2633
3120
  });
2634
3121
  }
2635
- update$(body) {
2636
- return this.baseHttpService.api({
2637
- url: `${this.serviceUrl}/${body.id}`,
2638
- method: 'put',
2639
- body,
3122
+ updateSalesforceOrganization$(payload) {
3123
+ return this.http.post(`${this.hostUrl}/${window.VELO_CLIENT}/orgs/${payload.orgId}`, payload, {
3124
+ headers: {
3125
+ 'Veloce-Token': this.TOKEN_HEADER,
3126
+ },
2640
3127
  });
2641
3128
  }
2642
- }
2643
- RebateTypeApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2644
- RebateTypeApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService });
2645
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService, decorators: [{
2646
- type: Injectable
2647
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2648
-
2649
- class PromotionsApiService {
2650
- constructor(baseHttpService) {
2651
- this.baseHttpService = baseHttpService;
2652
- this.serviceUrl = '/admin/promotion';
2653
- this.fetchAll$ = () => {
2654
- return this.baseHttpService.api({ url: this.serviceUrl });
2655
- };
2656
- this.fetchOne$ = (id) => {
2657
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2658
- };
2659
- this.remove$ = (id) => {
2660
- return this.baseHttpService.api({
2661
- url: `${this.serviceUrl}/${id}`,
2662
- method: 'delete',
2663
- });
2664
- };
2665
- this.restore$ = (id) => {
2666
- return this.baseHttpService.api({
2667
- method: 'patch',
2668
- url: `${this.serviceUrl}/${id}/restore`,
2669
- });
2670
- };
2671
- this.duplicate$ = (body) => {
2672
- return this.baseHttpService
2673
- .api({
2674
- url: `${this.serviceUrl}/${body.id}/clone`,
2675
- method: 'post',
2676
- body,
2677
- })
2678
- .pipe(map$1(response => response.clonedRecordId));
2679
- };
2680
- }
2681
- search$(expression, skip, count) {
2682
- let params = new HttpParams();
2683
- if (typeof skip === 'number') {
2684
- params = params.set('skip', '' + skip);
2685
- }
2686
- if (typeof count === 'number') {
2687
- params = params.set('count', '' + count);
2688
- }
2689
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
3129
+ deleteSalesforceOrganization$(payload) {
3130
+ return this.http.delete(`${this.hostUrl}/${window.VELO_CLIENT}/orgs/${payload.orgId}`, {
3131
+ headers: {
3132
+ 'Veloce-Token': this.TOKEN_HEADER,
3133
+ },
3134
+ });
2690
3135
  }
2691
- create$(body) {
2692
- return this.baseHttpService.api({
2693
- url: `${this.serviceUrl}`,
2694
- method: 'post',
2695
- body,
3136
+ activateSalesforceOrganization$(payload) {
3137
+ return this.http.post(`${this.hostUrl}/${window.VELO_CLIENT}/orgs/${payload.orgId}/activate`, {}, {
3138
+ headers: {
3139
+ 'Veloce-Token': this.TOKEN_HEADER,
3140
+ },
2696
3141
  });
2697
3142
  }
2698
- update$(body) {
2699
- return this.baseHttpService.api({
2700
- url: `${this.serviceUrl}/${body.id}`,
2701
- method: 'put',
2702
- body,
3143
+ deactivateSalesforceOrganization$(payload) {
3144
+ return this.http.post(`${this.hostUrl}/${window.VELO_CLIENT}/orgs/${payload.orgId}/deactivate`, {}, {
3145
+ headers: {
3146
+ 'Veloce-Token': this.TOKEN_HEADER,
3147
+ },
2703
3148
  });
2704
3149
  }
2705
3150
  }
2706
- PromotionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2707
- PromotionsApiServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService });
2708
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService, decorators: [{
3151
+ SandboxManagerApiService.MAX_RESULTS = 60;
3152
+ SandboxManagerApiServicefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
3153
+ SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
3154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
2709
3155
  type: Injectable
2710
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3156
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
2711
3157
 
2712
3158
  class ApiModule {
2713
3159
  }
@@ -2750,6 +3196,12 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
2750
3196
  RebateProgramApiService,
2751
3197
  RebateTypeApiService,
2752
3198
  PromotionsApiService,
3199
+ VeloceAuthService,
3200
+ ContractedPriceApiService,
3201
+ PortalsApiService,
3202
+ ConfigurationProcessorsApiService,
3203
+ FlowStateApiService,
3204
+ SandboxManagerApiService,
2753
3205
  ], imports: [HttpClientModule] });
2754
3206
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, decorators: [{
2755
3207
  type: NgModule,
@@ -2792,6 +3244,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2792
3244
  RebateProgramApiService,
2793
3245
  RebateTypeApiService,
2794
3246
  PromotionsApiService,
3247
+ VeloceAuthService,
3248
+ ContractedPriceApiService,
3249
+ PortalsApiService,
3250
+ ConfigurationProcessorsApiService,
3251
+ FlowStateApiService,
3252
+ SandboxManagerApiService,
2795
3253
  ],
2796
3254
  }]
2797
3255
  }] });
@@ -2800,5 +3258,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2800
3258
  * Generated bundle index. Do not edit.
2801
3259
  */
2802
3260
 
2803
- export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationSettingsApiService, ContextApiService, DeltaApiService, DocumentAttachmentApiService, DocumentTemplatesApiService, EndpointsApiService, FlowsApiService, GuidedSellingApiService, GuidedSellingsAdminApiService, OffersApiService, OrgInfoApiService, PicklistsApiService, PriceApiService, ProceduresApiService, ProductApiService, ProductModelApiService, PromotionsApiService, QuoteApiService, RampApiService, RebateProgramApiService, RebateTypeApiService, RuleGroupsApiService, RulesApiService, SalesforceApiService, ScriptsApiService, ShoppingCartSettingsApiService, StatefulConfigurationApiService, UIDefinitionsApiService, UITemplatesApiService, VeloceObjectsApiService };
3261
+ export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationProcessorsApiService, ConfigurationSettingsApiService, ContextApiService, ContractedPriceApiService, DeltaApiService, DocumentAttachmentApiService, DocumentTemplatesApiService, EndpointsApiService, FlowStateApiService, FlowsApiService, GuidedSellingApiService, GuidedSellingsAdminApiService, OffersApiService, OrgInfoApiService, PicklistsApiService, PortalsApiService, PriceApiService, ProceduresApiService, ProductApiService, ProductModelApiService, PromotionsApiService, QuoteApiService, RampApiService, RebateProgramApiService, RebateTypeApiService, RuleGroupsApiService, RulesApiService, SalesforceApiService, SandboxManagerApiService, ScriptsApiService, ShoppingCartSettingsApiService, StatefulConfigurationApiService, UIDefinitionsApiService, UITemplatesApiService, VeloceAuthService, VeloceObjectsApiService };
2804
3262
  //# sourceMappingURL=veloceapps-api.mjs.map