@veloceapps/api 8.0.0-18 → 8.0.0-181

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 (51) hide show
  1. package/esm2020/index.mjs +10 -4
  2. package/esm2020/lib/api.module.mjs +22 -4
  3. package/esm2020/lib/services/auth.service.mjs +22 -0
  4. package/esm2020/lib/services/configuration-api.service.mjs +45 -12
  5. package/esm2020/lib/services/configuration-processors-api.service.mjs +38 -0
  6. package/esm2020/lib/services/contracted-price-api.service.mjs +45 -0
  7. package/esm2020/lib/services/document-templates-api.service.mjs +6 -4
  8. package/esm2020/lib/services/flow-state-api.mjs +142 -0
  9. package/esm2020/lib/services/flows-api.service.mjs +9 -5
  10. package/esm2020/lib/services/portals-api.service.mjs +76 -0
  11. package/esm2020/lib/services/procedures-api.service.mjs +7 -1
  12. package/esm2020/lib/services/quote-api.service.mjs +1 -1
  13. package/esm2020/lib/services/rebate-program-api.service.mjs +1 -1
  14. package/esm2020/lib/services/rules-api.service.mjs +11 -2
  15. package/esm2020/lib/services/salesforce-api.service.mjs +4 -2
  16. package/esm2020/lib/services/sandbox-manager-api.service.mjs +67 -0
  17. package/esm2020/lib/services/scripts-api.service.mjs +6 -3
  18. package/esm2020/lib/services/stateful-configuration-api.mjs +1 -1
  19. package/esm2020/lib/services/ui-templates-api.service.mjs +6 -1
  20. package/esm2020/lib/services/veloce-objects-api.service.mjs +11 -1
  21. package/esm2020/lib/types/auth.types.mjs +2 -0
  22. package/esm2020/lib/types/index.mjs +3 -1
  23. package/esm2020/lib/types/quote.types.mjs +2 -0
  24. package/esm2020/lib/types/stateful-configuration.types.mjs +1 -1
  25. package/fesm2015/veloceapps-api.mjs +673 -229
  26. package/fesm2015/veloceapps-api.mjs.map +1 -1
  27. package/fesm2020/veloceapps-api.mjs +674 -222
  28. package/fesm2020/veloceapps-api.mjs.map +1 -1
  29. package/index.d.ts +9 -3
  30. package/lib/services/auth.service.d.ts +11 -0
  31. package/lib/services/configuration-api.service.d.ts +5 -0
  32. package/lib/services/configuration-processors-api.service.d.ts +14 -0
  33. package/lib/services/contracted-price-api.service.d.ts +16 -0
  34. package/lib/services/flow-state-api.d.ts +84 -0
  35. package/lib/services/flows-api.service.d.ts +1 -1
  36. package/lib/services/portals-api.service.d.ts +20 -0
  37. package/lib/services/procedures-api.service.d.ts +1 -0
  38. package/lib/services/quote-api.service.d.ts +3 -6
  39. package/lib/services/rebate-program-api.service.d.ts +1 -1
  40. package/lib/services/rules-api.service.d.ts +1 -0
  41. package/lib/services/salesforce-api.service.d.ts +1 -1
  42. package/lib/services/sandbox-manager-api.service.d.ts +22 -0
  43. package/lib/services/scripts-api.service.d.ts +1 -1
  44. package/lib/services/stateful-configuration-api.d.ts +2 -2
  45. package/lib/services/ui-templates-api.service.d.ts +1 -0
  46. package/lib/services/veloce-objects-api.service.d.ts +2 -1
  47. package/lib/types/auth.types.d.ts +4 -0
  48. package/lib/types/index.d.ts +2 -0
  49. package/lib/types/quote.types.d.ts +8 -0
  50. package/lib/types/stateful-configuration.types.d.ts +1 -1
  51. 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';
@@ -59,6 +59,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
59
59
  type: Injectable
60
60
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
61
61
 
62
+ class VeloceAuthService {
63
+ constructor(http) {
64
+ this.http = http;
65
+ }
66
+ auth$(instanceUrl, accessToken) {
67
+ const headers = new HttpHeaders({
68
+ 'Content-Type': 'application/json',
69
+ Authorization: `Bearer ${accessToken}`,
70
+ });
71
+ return this.http.get(`${instanceUrl}/services/apexrest/VELOCPQ/veloce-auth`, { headers });
72
+ }
73
+ }
74
+ 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 });
75
+ VeloceAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VeloceAuthService });
76
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VeloceAuthService, decorators: [{
77
+ type: Injectable
78
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
79
+
62
80
  class CatalogAdminApiService {
63
81
  constructor(baseHttpService) {
64
82
  this.baseHttpService = baseHttpService;
@@ -354,6 +372,23 @@ class ConfigurationApiService {
354
372
  }
355
373
  }));
356
374
  }
375
+ customConfigurePrice({ url, configurationRequest, runtimeModel, }) {
376
+ return this.httpService
377
+ .api({
378
+ method: 'post',
379
+ url,
380
+ body: configurationRequest,
381
+ errorHandler: e => throwError(e),
382
+ })
383
+ .pipe(map(configurePrice => {
384
+ if (runtimeModel) {
385
+ return Object.assign(Object.assign({}, configurePrice), { lineItem: this.updatePortDomains(configurePrice.lineItem, runtimeModel) });
386
+ }
387
+ else {
388
+ return configurePrice;
389
+ }
390
+ }));
391
+ }
357
392
  getRuntimeDataByProductId(productId, offeringId) {
358
393
  return this.httpService
359
394
  .api({
@@ -361,13 +396,7 @@ class ConfigurationApiService {
361
396
  url: `${this.SERVICE_URL}/${productId}/model` + ((offeringId && `/${offeringId}`) || ''),
362
397
  })
363
398
  .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
- }) });
399
+ return Object.assign(Object.assign({}, runtimeData), { uiDefinitions: runtimeData.uiDefinitions.map(dto => uiDefinitionFromDTO(dto)) });
371
400
  }));
372
401
  }
373
402
  getRuntimeDataByModelId(modelId) {
@@ -380,10 +409,26 @@ class ConfigurationApiService {
380
409
  var _a, _b, _c;
381
410
  const type = runtimeModel.components.get(lineItem.type);
382
411
  const portDomains = Object.assign({}, lineItem.portDomains);
412
+ // loop through ports to look for 'None' type domain computations
383
413
  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;
414
+ const { name: portName, type: typeName, min, max, domainTypes, properties } = port;
415
+ const portDomain = portDomains[portName];
416
+ if (portDomain) {
417
+ // there's a 'None' type domain computation
418
+ if (((_b = portDomain.properties) === null || _b === void 0 ? void 0 : _b['domainComputation']) === ('None')) {
419
+ portDomain.domainTypes = domainTypes;
420
+ }
421
+ }
422
+ else {
423
+ // there's no port domain so consider that as 'None' type domain computation
424
+ portDomains[portName] = {
425
+ name: portName,
426
+ type: typeName,
427
+ minCard: Number(min),
428
+ maxCard: Number(max),
429
+ domainTypes: domainTypes,
430
+ properties: Object.assign(Object.assign({}, properties), { domainComputation: 'None' }),
431
+ };
387
432
  }
388
433
  }
389
434
  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 +440,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
395
440
  type: Injectable
396
441
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
397
442
 
443
+ class ConfigurationProcessorsApiService {
444
+ constructor(baseHttpService) {
445
+ this.baseHttpService = baseHttpService;
446
+ this.serviceUrl = '/configuration/processors/owners';
447
+ this.fetchConfigurationProcessors$ = (ownerId) => {
448
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${ownerId}` });
449
+ };
450
+ this.createConfigurationProcessors$ = (configurationProcessor) => {
451
+ return this.baseHttpService.api({
452
+ method: 'post',
453
+ url: `${this.serviceUrl}/${configurationProcessor.ownerId}`,
454
+ body: configurationProcessor,
455
+ });
456
+ };
457
+ this.updateConfigurationProcessors$ = (configurationProcessor) => {
458
+ return this.baseHttpService.api({
459
+ method: 'put',
460
+ url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
461
+ body: configurationProcessor,
462
+ });
463
+ };
464
+ this.deleteConfigurationProcessors$ = (configurationProcessor) => {
465
+ return this.baseHttpService.api({
466
+ method: 'delete',
467
+ url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
468
+ });
469
+ };
470
+ }
471
+ }
472
+ ConfigurationProcessorsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
473
+ ConfigurationProcessorsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService });
474
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, decorators: [{
475
+ type: Injectable
476
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
477
+
398
478
  class ConfigurationSettingsDTO {
399
479
  static fromDTO(dto, key) {
400
480
  return {
@@ -492,6 +572,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
492
572
  type: Injectable
493
573
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
494
574
 
575
+ class ContractedPriceApiService {
576
+ constructor(baseHttpService) {
577
+ this.baseHttpService = baseHttpService;
578
+ this.serviceUrl = '/admin/contracted-price';
579
+ this.fetchContractedPrices$ = () => {
580
+ return this.baseHttpService.api({ url: `${this.serviceUrl}` });
581
+ };
582
+ this.fetchContractedPrice$ = (id) => {
583
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
584
+ };
585
+ this.createContractedPrice$ = (data) => {
586
+ return this.baseHttpService.api({
587
+ url: `${this.serviceUrl}`,
588
+ method: 'put',
589
+ body: data,
590
+ });
591
+ };
592
+ this.updateContractedPrice$ = (data) => {
593
+ return this.baseHttpService.api({
594
+ url: `${this.serviceUrl}/${data.id}`,
595
+ method: 'put',
596
+ body: data,
597
+ });
598
+ };
599
+ this.searchContractedPrices$ = (searchParams, expression) => {
600
+ const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
601
+ return this.baseHttpService.api({
602
+ method: 'post',
603
+ url: `${this.serviceUrl}/search`,
604
+ params,
605
+ body: expression || {},
606
+ });
607
+ };
608
+ }
609
+ }
610
+ ContractedPriceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContractedPriceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
611
+ ContractedPriceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContractedPriceApiService });
612
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContractedPriceApiService, decorators: [{
613
+ type: Injectable
614
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
615
+
495
616
  class DeltaApiService {
496
617
  constructor(httpService) {
497
618
  this.httpService = httpService;
@@ -612,7 +733,9 @@ class SalesforceApiService {
612
733
  return this.httpService.api(Object.assign({ method: 'post', url: methodUrl, body: fields }, options));
613
734
  }
614
735
  apexGetRequest(path, params, options) {
615
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/apex${path}`, params }, options));
736
+ // this line is needed because HttpParams instance from Integration behaves wrong in studio instance of Angular
737
+ const httpParams = new HttpParams({ fromString: params.toString() });
738
+ return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/apex${path}`, params: httpParams }, options));
616
739
  }
617
740
  apexPostRequest(path, body, options) {
618
741
  return this.httpService.api(Object.assign({ method: 'post', body, url: `${this.SERVICE_URL}/apex${path}` }, options));
@@ -645,7 +768,7 @@ class DocumentTemplatesApiService {
645
768
  this.http = http;
646
769
  this.DOCGEN_TAG = 'docgen';
647
770
  this.SERVICE_URL = '/templates';
648
- this.DOC_GEN_URL_FALLBACK = 'https://dev-dp1.velocpq.com/docgen';
771
+ this.DOC_GEN_URL_FALLBACK = `${window.VELO_API}/docgen`;
649
772
  this.mapSfQueryResult = (limit) => map((records) => {
650
773
  if (!records.length) {
651
774
  return { _result: 'No Records Found' };
@@ -783,11 +906,13 @@ class DocumentTemplatesApiService {
783
906
  generateDocument(template, object, params = {}) {
784
907
  const documentData$ = this.generateDocumentData(template, object, Object.assign(Object.assign({}, params), { shouldPreventDownload: true }));
785
908
  return zip(this.getTemplateFile(template.id), documentData$, this.resolveAttachments$(template)).pipe(switchMap(([templateFile, data, attachments]) => {
786
- var _a, _b, _c, _d, _e, _f;
909
+ var _a, _b, _c, _d, _e, _f, _g, _h;
787
910
  const document = DocxTemplater.generate(templateFile, data);
788
911
  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;
912
+ 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) ||
913
+ properties['Name'] ||
914
+ template.name;
915
+ 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
916
  if (documentFormat === 'DOCX') {
792
917
  this.fileDownloadService.processDownload(document, documentName);
793
918
  return of(document);
@@ -884,11 +1009,11 @@ class DocumentTemplatesApiService {
884
1009
  return forkJoin(attachmentIds.map(id => this.documentAttachmentService.getAttachmentFile(id, true)));
885
1010
  }
886
1011
  queryObject({ objectName, resultObjectName, fields, statement }, { properties }) {
887
- var _a;
1012
+ var _a, _b;
888
1013
  const patternLimit = /(\s*limit\s\d*)/i;
889
1014
  let limit = 1;
890
1015
  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();
1016
+ 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
1017
  if (limitStr) {
893
1018
  limit = Number.parseInt(limitStr, 10);
894
1019
  }
@@ -901,11 +1026,11 @@ class DocumentTemplatesApiService {
901
1026
  return this.salesforceApiService.query(searchRequest, objectName).pipe(this.mapSfQueryResult(limit), map(value => ({ [resultObjectName]: value })));
902
1027
  }
903
1028
  }
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 });
1029
+ 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
1030
  DocumentTemplatesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentTemplatesApiService });
906
1031
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentTemplatesApiService, decorators: [{
907
1032
  type: Injectable
908
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: SalesforceApiService }, { type: i1.FileDownloadService }, { type: DocumentAttachmentApiService }, { type: i4.HttpClient }]; } });
1033
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: SalesforceApiService }, { type: i1.FileDownloadService }, { type: DocumentAttachmentApiService }, { type: i1$1.HttpClient }]; } });
909
1034
 
910
1035
  class EndpointsApiService {
911
1036
  constructor(baseHttpService) {
@@ -982,18 +1107,160 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
982
1107
  type: Injectable
983
1108
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
984
1109
 
1110
+ class FlowStateApiService {
1111
+ constructor(httpService) {
1112
+ this.httpService = httpService;
1113
+ this.SERVICE_URL = '/configuration/states';
1114
+ }
1115
+ /**
1116
+ * Initialize flow state
1117
+ * @param request Request
1118
+ * @returns Flow initialization response, which contains session ID and result of selectors
1119
+ */
1120
+ init(request) {
1121
+ return this.httpService.api({
1122
+ method: 'post',
1123
+ url: `${this.SERVICE_URL}/quote/start`,
1124
+ body: request,
1125
+ });
1126
+ }
1127
+ /**
1128
+ * Get existing state by ID
1129
+ * @param id ID
1130
+ * @returns Flow State
1131
+ */
1132
+ get(id) {
1133
+ return this.httpService.api({
1134
+ url: `${this.SERVICE_URL}/${id}`,
1135
+ });
1136
+ }
1137
+ /**
1138
+ * Execute actions/selectors
1139
+ * @param id State ID
1140
+ * @param request Request
1141
+ * @returns Execute result
1142
+ */
1143
+ execute(id, request) {
1144
+ return this.httpService.api({
1145
+ method: 'post',
1146
+ url: `${this.SERVICE_URL}/quote/${id}/execute`,
1147
+ body: request,
1148
+ });
1149
+ }
1150
+ /**
1151
+ * Save Quote in the state
1152
+ * @param id State ID
1153
+ */
1154
+ save(id) {
1155
+ return this.httpService.api({
1156
+ method: 'post',
1157
+ url: `${this.SERVICE_URL}/quote/${id}/save`,
1158
+ });
1159
+ }
1160
+ /**
1161
+ * Submit Quote in the state
1162
+ * @param id State ID
1163
+ */
1164
+ submit(id) {
1165
+ return this.httpService.api({
1166
+ method: 'post',
1167
+ url: `${this.SERVICE_URL}/quote/${id}/submit`,
1168
+ });
1169
+ }
1170
+ /**
1171
+ * Close Flow state
1172
+ * @param id State ID
1173
+ */
1174
+ cancel(id) {
1175
+ return this.httpService.api({
1176
+ method: 'post',
1177
+ url: `${this.SERVICE_URL}/quote/${id}/cancel`,
1178
+ });
1179
+ }
1180
+ /**
1181
+ * Initialize stateful configuration
1182
+ * @param stateId string
1183
+ * @param request Request
1184
+ * @returns Flow initialization response, which contains session ID and result of selectors
1185
+ */
1186
+ newConfiguration(stateId, request) {
1187
+ return this.httpService.api({
1188
+ method: 'post',
1189
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/new`,
1190
+ body: request,
1191
+ });
1192
+ }
1193
+ /**
1194
+ * Start stateful configuration
1195
+ * @param stateId string
1196
+ * @param request Request
1197
+ * @returns Flow initialization response, which contains session ID and result of selectors
1198
+ */
1199
+ startConfiguration(stateId, request) {
1200
+ return this.httpService.api({
1201
+ method: 'post',
1202
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/start`,
1203
+ body: request,
1204
+ });
1205
+ }
1206
+ /**
1207
+ * Execute stateful configuration
1208
+ * @param stateId string
1209
+ * @param configurationId string
1210
+ * @param request Request
1211
+ * @returns Flow initialization response, which contains session ID and result of selectors
1212
+ */
1213
+ executeConfiguration(stateId, configurationId, request) {
1214
+ return this.httpService.api({
1215
+ method: 'post',
1216
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/execute`,
1217
+ body: request,
1218
+ });
1219
+ }
1220
+ /**
1221
+ * Save stateful configuration
1222
+ * @param stateId string
1223
+ * @param configurationId string
1224
+ */
1225
+ saveConfiguration(stateId, configurationId) {
1226
+ return this.httpService.api({
1227
+ method: 'post',
1228
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/save`,
1229
+ });
1230
+ }
1231
+ /**
1232
+ * Cancel stateful configuration
1233
+ * @param stateId string
1234
+ * @param configurationId string
1235
+ */
1236
+ cancelConfiguration(stateId, configurationId) {
1237
+ return this.httpService.api({
1238
+ method: 'post',
1239
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/cancel`,
1240
+ });
1241
+ }
1242
+ }
1243
+ FlowStateApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1244
+ FlowStateApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService });
1245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService, decorators: [{
1246
+ type: Injectable
1247
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1248
+
985
1249
  class FlowsApiService {
986
1250
  constructor(configurationSettingsApiService) {
987
1251
  this.configurationSettingsApiService = configurationSettingsApiService;
988
1252
  this.flowsKey = 'flows';
989
1253
  }
990
1254
  getFlow(id) {
991
- return this.fetchFlows().pipe(map(flows => flows.find(flow => flow.id == id)));
1255
+ return this.fetchFlows().pipe(map(flows => flows.find(flow => flow.id == id)), map(flow => {
1256
+ if (!flow) {
1257
+ throw new Error(`Flow with flowId=${id} is not defined`);
1258
+ }
1259
+ return flow;
1260
+ }));
992
1261
  }
993
1262
  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) : [])));
1263
+ 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
1264
  }
998
1265
  }
999
1266
  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 +1444,11 @@ class OrgInfoApiService {
1177
1444
  return this.http.get(`${this.hostUrl}/org-info/${organizationId}`);
1178
1445
  }
1179
1446
  }
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 });
1447
+ 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
1448
  OrgInfoApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService });
1182
1449
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, decorators: [{
1183
1450
  type: Injectable
1184
- }], ctorParameters: function () { return [{ type: i4.HttpClient }]; } });
1451
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
1185
1452
 
1186
1453
  class PicklistsApiService {
1187
1454
  constructor(baseHttpService) {
@@ -1218,6 +1485,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1218
1485
  type: Injectable
1219
1486
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1220
1487
 
1488
+ class PortalsApiService {
1489
+ constructor(baseHttpService) {
1490
+ this.baseHttpService = baseHttpService;
1491
+ this.serviceUrl = '/admin/portal';
1492
+ this.getPortals$ = (skip = 1, name = '') => {
1493
+ let params = new HttpParams();
1494
+ params = params.append('count', (PortalsApiService.MAX_RESULTS * skip).toString());
1495
+ params = params.append('skip', '0');
1496
+ params = params.append('name', name);
1497
+ return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
1498
+ };
1499
+ this.searchPortals$ = (skip = 0, expression) => {
1500
+ let params = new HttpParams();
1501
+ params = params.set('skip', '' + skip);
1502
+ params = params.set('count', '' + PortalsApiService.MAX_RESULTS);
1503
+ return this.baseHttpService.api({
1504
+ method: 'post',
1505
+ url: `${this.serviceUrl}/search`,
1506
+ params,
1507
+ body: expression || {},
1508
+ });
1509
+ };
1510
+ this.removePortal$ = (id) => {
1511
+ return this.baseHttpService.api({
1512
+ url: `${this.serviceUrl}/${id}`,
1513
+ method: 'delete',
1514
+ });
1515
+ };
1516
+ this.restore$ = (id) => {
1517
+ return this.baseHttpService.api({
1518
+ method: 'patch',
1519
+ url: `${this.serviceUrl}/${id}/restore`,
1520
+ });
1521
+ };
1522
+ this.duplicatePortal$ = (cloneRequest) => {
1523
+ return this.baseHttpService.api({
1524
+ url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
1525
+ method: 'post',
1526
+ body: cloneRequest,
1527
+ });
1528
+ };
1529
+ this.getPortal$ = (id) => {
1530
+ return this.baseHttpService.api({
1531
+ url: `${this.serviceUrl}/${id}`,
1532
+ });
1533
+ };
1534
+ }
1535
+ createNewPortal$(body) {
1536
+ return this.baseHttpService.api({
1537
+ url: `${this.serviceUrl}`,
1538
+ method: 'post',
1539
+ body,
1540
+ });
1541
+ }
1542
+ updatePortal$(portal, settings) {
1543
+ return this.baseHttpService.api({
1544
+ url: `${this.serviceUrl}/${portal.id}`,
1545
+ method: 'put',
1546
+ body: Object.assign(Object.assign({}, portal), { settings: JSON.stringify(settings) }),
1547
+ });
1548
+ }
1549
+ }
1550
+ PortalsApiService.MAX_RESULTS = 60;
1551
+ PortalsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1552
+ PortalsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService });
1553
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, decorators: [{
1554
+ type: Injectable
1555
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1556
+
1221
1557
  class PriceApiService {
1222
1558
  constructor(httpService) {
1223
1559
  this.httpService = httpService;
@@ -1365,6 +1701,12 @@ class ProceduresApiService {
1365
1701
  body,
1366
1702
  });
1367
1703
  }
1704
+ fetchDefaultPricingSteps$() {
1705
+ return this.baseHttpService.api({
1706
+ url: `${this.ADMIN_SERVICE_URL}/pricing-steps`,
1707
+ method: 'get',
1708
+ });
1709
+ }
1368
1710
  }
1369
1711
  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
1712
  ProceduresApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService });
@@ -1751,30 +2093,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1751
2093
  type: Injectable
1752
2094
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1753
2095
 
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);
2096
+ class PromotionsApiService {
2097
+ constructor(baseHttpService) {
2098
+ this.baseHttpService = baseHttpService;
2099
+ this.serviceUrl = '/admin/promotion';
2100
+ this.fetchAll$ = () => {
2101
+ return this.baseHttpService.api({ url: this.serviceUrl });
2102
+ };
2103
+ this.fetchOne$ = (id) => {
2104
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2105
+ };
2106
+ this.remove$ = (id) => {
2107
+ return this.baseHttpService.api({
2108
+ url: `${this.serviceUrl}/${id}`,
2109
+ method: 'delete',
2110
+ });
2111
+ };
2112
+ this.restore$ = (id) => {
2113
+ return this.baseHttpService.api({
2114
+ method: 'patch',
2115
+ url: `${this.serviceUrl}/${id}/restore`,
2116
+ });
2117
+ };
2118
+ this.duplicate$ = (body) => {
2119
+ return this.baseHttpService
2120
+ .api({
2121
+ url: `${this.serviceUrl}/${body.id}/clone`,
2122
+ method: 'post',
2123
+ body,
2124
+ })
2125
+ .pipe(map$1(response => response.clonedRecordId));
2126
+ };
2127
+ }
2128
+ search$(expression, skip, count) {
2129
+ let params = new HttpParams();
2130
+ if (typeof skip === 'number') {
2131
+ params = params.set('skip', '' + skip);
2132
+ }
2133
+ if (typeof count === 'number') {
2134
+ params = params.set('count', '' + count);
2135
+ }
2136
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2137
+ }
2138
+ create$(body) {
2139
+ return this.baseHttpService.api({
2140
+ url: `${this.serviceUrl}`,
2141
+ method: 'post',
2142
+ body,
2143
+ });
2144
+ }
2145
+ update$(body) {
2146
+ return this.baseHttpService.api({
2147
+ url: `${this.serviceUrl}/${body.id}`,
2148
+ method: 'put',
2149
+ body,
2150
+ });
2151
+ }
2152
+ }
2153
+ PromotionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2154
+ PromotionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService });
2155
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService, decorators: [{
2156
+ type: Injectable
2157
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2158
+
2159
+ class QuoteApiService {
2160
+ constructor(httpService) {
2161
+ this.httpService = httpService;
2162
+ this.SERVICE_URL = '/quotes';
2163
+ }
2164
+ // request quoteId | accountId | opportunityId | orderId
2165
+ getQuoteDraft(objectId, params, errorHandler) {
2166
+ return this.httpService.api({
2167
+ method: 'get',
2168
+ url: `${this.SERVICE_URL}/${objectId}`,
2169
+ params,
2170
+ errorHandler,
2171
+ });
2172
+ }
2173
+ upsertQuote(request, options) {
2174
+ return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}`, body: request }, options));
2175
+ }
2176
+ submitQuote(request, options) {
2177
+ return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}/submit`, body: request }, options));
2178
+ }
2179
+ attachDocument(id, documentName, data) {
2180
+ const formData = new FormData();
2181
+ const blob = new Blob([data]);
2182
+ formData.append('file', blob, documentName);
1778
2183
  return this.httpService.upload({
1779
2184
  url: `${this.SERVICE_URL}/${id}/attach-document`,
1780
2185
  responseType: 'arraybuffer',
@@ -1807,6 +2212,132 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1807
2212
  type: Injectable
1808
2213
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1809
2214
 
2215
+ class RebateProgramApiService {
2216
+ constructor(baseHttpService) {
2217
+ this.baseHttpService = baseHttpService;
2218
+ this.serviceUrl = '/admin/rebate-program';
2219
+ this.fetchAll$ = () => {
2220
+ return this.baseHttpService.api({ url: this.serviceUrl });
2221
+ };
2222
+ this.fetchOne$ = (id) => {
2223
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2224
+ };
2225
+ this.remove$ = (id) => {
2226
+ return this.baseHttpService.api({
2227
+ url: `${this.serviceUrl}/${id}`,
2228
+ method: 'delete',
2229
+ });
2230
+ };
2231
+ this.restore$ = (id) => {
2232
+ return this.baseHttpService.api({
2233
+ method: 'patch',
2234
+ url: `${this.serviceUrl}/${id}/restore`,
2235
+ });
2236
+ };
2237
+ this.duplicate$ = (body) => {
2238
+ return this.baseHttpService
2239
+ .api({
2240
+ url: `${this.serviceUrl}/${body.id}/clone`,
2241
+ method: 'post',
2242
+ body,
2243
+ })
2244
+ .pipe(map$1(response => response.clonedRecordId));
2245
+ };
2246
+ }
2247
+ search$(expression, skip, count) {
2248
+ let params = new HttpParams();
2249
+ if (typeof skip === 'number') {
2250
+ params = params.set('skip', '' + skip);
2251
+ }
2252
+ if (typeof count === 'number') {
2253
+ params = params.set('count', '' + count);
2254
+ }
2255
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2256
+ }
2257
+ create$(body) {
2258
+ return this.baseHttpService.api({
2259
+ url: `${this.serviceUrl}`,
2260
+ method: 'post',
2261
+ body,
2262
+ });
2263
+ }
2264
+ update$(body) {
2265
+ return this.baseHttpService.api({
2266
+ url: `${this.serviceUrl}/${body.id}`,
2267
+ method: 'put',
2268
+ body,
2269
+ });
2270
+ }
2271
+ }
2272
+ RebateProgramApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2273
+ RebateProgramApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService });
2274
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService, decorators: [{
2275
+ type: Injectable
2276
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2277
+
2278
+ class RebateTypeApiService {
2279
+ constructor(baseHttpService) {
2280
+ this.baseHttpService = baseHttpService;
2281
+ this.serviceUrl = '/admin/rebate-type';
2282
+ this.fetchAll$ = () => {
2283
+ return this.baseHttpService.api({ url: this.serviceUrl });
2284
+ };
2285
+ this.fetchOne$ = (id) => {
2286
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2287
+ };
2288
+ this.remove$ = (id) => {
2289
+ return this.baseHttpService.api({
2290
+ url: `${this.serviceUrl}/${id}`,
2291
+ method: 'delete',
2292
+ });
2293
+ };
2294
+ this.restore$ = (id) => {
2295
+ return this.baseHttpService.api({
2296
+ method: 'patch',
2297
+ url: `${this.serviceUrl}/${id}/restore`,
2298
+ });
2299
+ };
2300
+ this.duplicate$ = (body) => {
2301
+ return this.baseHttpService
2302
+ .api({
2303
+ url: `${this.serviceUrl}/${body.id}/clone`,
2304
+ method: 'post',
2305
+ body,
2306
+ })
2307
+ .pipe(map$1(response => response.clonedRecordId));
2308
+ };
2309
+ }
2310
+ search$(expression, skip, count) {
2311
+ let params = new HttpParams();
2312
+ if (typeof skip === 'number') {
2313
+ params = params.set('skip', '' + skip);
2314
+ }
2315
+ if (typeof count === 'number') {
2316
+ params = params.set('count', '' + count);
2317
+ }
2318
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2319
+ }
2320
+ create$(body) {
2321
+ return this.baseHttpService.api({
2322
+ url: `${this.serviceUrl}`,
2323
+ method: 'post',
2324
+ body,
2325
+ });
2326
+ }
2327
+ update$(body) {
2328
+ return this.baseHttpService.api({
2329
+ url: `${this.serviceUrl}/${body.id}`,
2330
+ method: 'put',
2331
+ body,
2332
+ });
2333
+ }
2334
+ }
2335
+ RebateTypeApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2336
+ RebateTypeApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService });
2337
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService, decorators: [{
2338
+ type: Injectable
2339
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2340
+
1810
2341
  class RuleGroupsApiService {
1811
2342
  constructor(baseHttpService) {
1812
2343
  this.baseHttpService = baseHttpService;
@@ -1929,13 +2460,22 @@ class RulesApiService {
1929
2460
  });
1930
2461
  }
1931
2462
  execute$(body) {
1932
- const url = body.rule.ruleGroupType === RuleGroupTypes.eligibility ? '/rules/eligibility/execute' : '/rules/execute';
2463
+ const url = this.getExecuteRuleUrl(body.rule.ruleGroupType);
1933
2464
  return this.baseHttpService.api({
1934
2465
  url,
1935
2466
  method: 'post',
1936
2467
  body,
1937
2468
  });
1938
2469
  }
2470
+ getExecuteRuleUrl(ruleGroupType) {
2471
+ if (ruleGroupType === RuleGroupTypes.eligibility) {
2472
+ return '/rules/eligibility/execute';
2473
+ }
2474
+ if (ruleGroupType === RuleGroupTypes.catalog) {
2475
+ return '/rules/catalog/execute';
2476
+ }
2477
+ return '/rules/execute';
2478
+ }
1939
2479
  }
1940
2480
  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
2481
  RulesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService });
@@ -1985,11 +2525,13 @@ class ScriptsApiService {
1985
2525
  });
1986
2526
  };
1987
2527
  this.cloneScript$ = (cloneRequest) => {
1988
- return this.baseHttpService.api({
2528
+ return this.baseHttpService
2529
+ .api({
1989
2530
  url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
1990
2531
  method: 'post',
1991
2532
  body: cloneRequest,
1992
- });
2533
+ })
2534
+ .pipe(map(response => response.clonedRecordId));
1993
2535
  };
1994
2536
  this.removeScript$ = (id) => {
1995
2537
  return this.baseHttpService.api({
@@ -2388,6 +2930,11 @@ class UITemplatesApiService {
2388
2930
  this.fetchComponentAttachmentFile$(templateId, component.id, 'json'),
2389
2931
  ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
2390
2932
  };
2933
+ this.fetchComponentsAttachments$ = (templateId) => {
2934
+ return this.fetchComponents$(templateId).pipe(switchMap$1(components => {
2935
+ return forkJoin(components.map(component => this.fetchComponentAttachments$(templateId, component)));
2936
+ }));
2937
+ };
2391
2938
  this.fetchComponentAttachmentFile$ = (templateId, componentId, attachmentType) => {
2392
2939
  return this.baseHttpService
2393
2940
  .api({
@@ -2476,6 +3023,15 @@ class VeloceObjectsApiService {
2476
3023
  url: `${this.serviceUrl}/${id}`,
2477
3024
  });
2478
3025
  };
3026
+ this.duplicateObject$ = (body) => {
3027
+ return this.baseHttpService
3028
+ .api({
3029
+ method: 'post',
3030
+ url: `${this.serviceUrl}/${body.id}/clone`,
3031
+ body,
3032
+ })
3033
+ .pipe(map(response => response.clonedRecordId));
3034
+ };
2479
3035
  this.restoreObject$ = (id) => {
2480
3036
  return this.baseHttpService.api({
2481
3037
  method: 'patch',
@@ -2520,194 +3076,70 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2520
3076
  type: Injectable
2521
3077
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2522
3078
 
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,
3079
+ class SandboxManagerApiService {
3080
+ constructor(http) {
3081
+ var _a, _b, _c;
3082
+ this.http = http;
3083
+ this.TOKEN_HEADER = (_b = `signed_request=${encodeURIComponent((_a = window.SANDBOX_TOKEN) !== null && _a !== void 0 ? _a : '')}`) !== null && _b !== void 0 ? _b : '';
3084
+ this.SANDBOX_URL_FALLBACK = 'https://sandbox-manager.velocecpq.com';
3085
+ this.hostUrl = `${(_c = window.VELO_SANDBOX_API) !== null && _c !== void 0 ? _c : this.SANDBOX_URL_FALLBACK}/clients`;
3086
+ }
3087
+ getSalesforceOrganizations$() {
3088
+ return this.http.get(`${this.hostUrl}/${window.VELO_CLIENT}/orgs`, {
3089
+ headers: {
3090
+ 'Veloce-Token': this.TOKEN_HEADER,
3091
+ },
2570
3092
  });
2571
3093
  }
2572
- update$(body) {
2573
- return this.baseHttpService.api({
2574
- url: `${this.serviceUrl}/${body.id}`,
2575
- method: 'put',
2576
- body,
3094
+ getAvailableSalesforceOrganizationSizes$() {
3095
+ return this.http.get(`${this.hostUrl}/${window.VELO_CLIENT}/available-sizes`, {
3096
+ headers: {
3097
+ 'Veloce-Token': this.TOKEN_HEADER,
3098
+ },
2577
3099
  });
2578
3100
  }
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,
3101
+ createSalesforceOrganization$(payload) {
3102
+ return this.http.post(`${this.hostUrl}/${window.VELO_CLIENT}/orgs`, payload, {
3103
+ headers: {
3104
+ 'Veloce-Token': this.TOKEN_HEADER,
3105
+ },
2633
3106
  });
2634
3107
  }
2635
- update$(body) {
2636
- return this.baseHttpService.api({
2637
- url: `${this.serviceUrl}/${body.id}`,
2638
- method: 'put',
2639
- body,
3108
+ updateSalesforceOrganization$(payload) {
3109
+ return this.http.post(`${this.hostUrl}/${window.VELO_CLIENT}/orgs/${payload.orgId}`, payload, {
3110
+ headers: {
3111
+ 'Veloce-Token': this.TOKEN_HEADER,
3112
+ },
2640
3113
  });
2641
3114
  }
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 });
3115
+ deleteSalesforceOrganization$(payload) {
3116
+ return this.http.delete(`${this.hostUrl}/${window.VELO_CLIENT}/orgs/${payload.orgId}`, {
3117
+ headers: {
3118
+ 'Veloce-Token': this.TOKEN_HEADER,
3119
+ },
3120
+ });
2690
3121
  }
2691
- create$(body) {
2692
- return this.baseHttpService.api({
2693
- url: `${this.serviceUrl}`,
2694
- method: 'post',
2695
- body,
3122
+ activateSalesforceOrganization$(payload) {
3123
+ return this.http.post(`${this.hostUrl}/${window.VELO_CLIENT}/orgs/${payload.orgId}/activate`, {}, {
3124
+ headers: {
3125
+ 'Veloce-Token': this.TOKEN_HEADER,
3126
+ },
2696
3127
  });
2697
3128
  }
2698
- update$(body) {
2699
- return this.baseHttpService.api({
2700
- url: `${this.serviceUrl}/${body.id}`,
2701
- method: 'put',
2702
- body,
3129
+ deactivateSalesforceOrganization$(payload) {
3130
+ return this.http.post(`${this.hostUrl}/${window.VELO_CLIENT}/orgs/${payload.orgId}/deactivate`, {}, {
3131
+ headers: {
3132
+ 'Veloce-Token': this.TOKEN_HEADER,
3133
+ },
2703
3134
  });
2704
3135
  }
2705
3136
  }
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: [{
3137
+ SandboxManagerApiService.MAX_RESULTS = 60;
3138
+ SandboxManagerApiServicefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
3139
+ SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
3140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
2709
3141
  type: Injectable
2710
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3142
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
2711
3143
 
2712
3144
  class ApiModule {
2713
3145
  }
@@ -2750,6 +3182,12 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
2750
3182
  RebateProgramApiService,
2751
3183
  RebateTypeApiService,
2752
3184
  PromotionsApiService,
3185
+ VeloceAuthService,
3186
+ ContractedPriceApiService,
3187
+ PortalsApiService,
3188
+ ConfigurationProcessorsApiService,
3189
+ FlowStateApiService,
3190
+ SandboxManagerApiService,
2753
3191
  ], imports: [HttpClientModule] });
2754
3192
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, decorators: [{
2755
3193
  type: NgModule,
@@ -2792,6 +3230,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2792
3230
  RebateProgramApiService,
2793
3231
  RebateTypeApiService,
2794
3232
  PromotionsApiService,
3233
+ VeloceAuthService,
3234
+ ContractedPriceApiService,
3235
+ PortalsApiService,
3236
+ ConfigurationProcessorsApiService,
3237
+ FlowStateApiService,
3238
+ SandboxManagerApiService,
2795
3239
  ],
2796
3240
  }]
2797
3241
  }] });
@@ -2800,5 +3244,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2800
3244
  * Generated bundle index. Do not edit.
2801
3245
  */
2802
3246
 
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 };
3247
+ 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
3248
  //# sourceMappingURL=veloceapps-api.mjs.map