@veloceapps/api 8.0.0-98 → 9.0.0-0

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 (40) hide show
  1. package/esm2020/index.mjs +5 -3
  2. package/esm2020/lib/api.module.mjs +9 -3
  3. package/esm2020/lib/services/account-api.service.mjs +8 -1
  4. package/esm2020/lib/services/configuration-api.service.mjs +23 -4
  5. package/esm2020/lib/services/configuration-processors-api.service.mjs +1 -1
  6. package/esm2020/lib/services/document-templates-api.service.mjs +5 -3
  7. package/esm2020/lib/services/flow-state-api.mjs +142 -0
  8. package/esm2020/lib/services/flows-api.service.mjs +7 -2
  9. package/esm2020/lib/services/org-info-api.service.mjs +45 -10
  10. package/esm2020/lib/services/procedures-api.service.mjs +7 -1
  11. package/esm2020/lib/services/quote-api.service.mjs +18 -2
  12. package/esm2020/lib/services/salesforce-api.service.mjs +3 -3
  13. package/esm2020/lib/services/sandbox-manager-api.service.mjs +94 -0
  14. package/esm2020/lib/services/scripts-api.service.mjs +6 -3
  15. package/esm2020/lib/services/stateful-configuration-api.mjs +1 -1
  16. package/esm2020/lib/services/ui-templates-api.service.mjs +6 -1
  17. package/esm2020/lib/types/index.mjs +2 -1
  18. package/esm2020/lib/types/org-info.types.mjs +1 -1
  19. package/esm2020/lib/types/quote.types.mjs +2 -0
  20. package/esm2020/lib/utils/canvas.utils.mjs +33 -0
  21. package/fesm2015/veloceapps-api.mjs +471 -126
  22. package/fesm2015/veloceapps-api.mjs.map +1 -1
  23. package/fesm2020/veloceapps-api.mjs +484 -126
  24. package/fesm2020/veloceapps-api.mjs.map +1 -1
  25. package/index.d.ts +4 -2
  26. package/lib/services/account-api.service.d.ts +2 -1
  27. package/lib/services/flow-state-api.d.ts +84 -0
  28. package/lib/services/flows-api.service.d.ts +1 -1
  29. package/lib/services/org-info-api.service.d.ts +13 -7
  30. package/lib/services/procedures-api.service.d.ts +1 -0
  31. package/lib/services/quote-api.service.d.ts +13 -6
  32. package/lib/services/sandbox-manager-api.service.d.ts +24 -0
  33. package/lib/services/scripts-api.service.d.ts +1 -1
  34. package/lib/services/stateful-configuration-api.d.ts +2 -2
  35. package/lib/services/ui-templates-api.service.d.ts +1 -0
  36. package/lib/types/index.d.ts +1 -0
  37. package/lib/types/org-info.types.d.ts +19 -0
  38. package/lib/types/quote.types.d.ts +8 -0
  39. package/lib/utils/canvas.utils.d.ts +18 -0
  40. package/package.json +2 -2
@@ -3,13 +3,13 @@ import { HttpParams, HttpHeaders, HttpErrorResponse, HttpClientModule } from '@a
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, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, toLatestFlow, isDefined, Operator, ModelTranslatorUtils, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
7
- import { noop, throwError, of, zip, forkJoin, map as map$1, catchError as catchError$1, switchMap as switchMap$1 } from 'rxjs';
6
+ import { uiDefinitionFromDTO, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, toLatestFlow, isDefined, Operator, isApexError, isCanvasError, ModelTranslatorUtils, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
7
+ import { noop, throwError, of, zip, forkJoin, map as map$1, from, catchError as catchError$1, switchMap as switchMap$1 } from 'rxjs';
8
8
  import { map, catchError, tap, switchMap, defaultIfEmpty } from 'rxjs/operators';
9
- import * as i2 from 'primeng/api';
9
+ import * as i1$2 from 'primeng/api';
10
10
  import { CurrencyPipe } from '@angular/common';
11
11
  import * as _ from 'lodash';
12
- import { omit } from 'lodash';
12
+ import { isArray, omit } from 'lodash';
13
13
  import moment from 'moment';
14
14
  import { __rest } from 'tslib';
15
15
 
@@ -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
  }
@@ -409,10 +412,26 @@ class ConfigurationApiService {
409
412
  var _a, _b, _c;
410
413
  const type = runtimeModel.components.get(lineItem.type);
411
414
  const portDomains = Object.assign({}, lineItem.portDomains);
415
+ // loop through ports to look for 'None' type domain computations
412
416
  for (const port of (_a = type === null || type === void 0 ? void 0 : type.ports) !== null && _a !== void 0 ? _a : []) {
413
- const portDomain = portDomains[port.name];
414
- if (((_b = portDomain === null || portDomain === void 0 ? void 0 : portDomain.properties) === null || _b === void 0 ? void 0 : _b['domainComputation']) === ('None')) {
415
- 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
+ };
416
435
  }
417
436
  }
418
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 });
@@ -424,6 +443,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
424
443
  type: Injectable
425
444
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
426
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
+
427
481
  class ConfigurationSettingsDTO {
428
482
  static fromDTO(dto, key) {
429
483
  return {
@@ -493,11 +547,11 @@ class ConfigurationSettingsApiService {
493
547
  return this.httpService.api(Object.assign({ method: 'get', url: '/cache/evict/' + name }, options));
494
548
  }
495
549
  }
496
- ConfigurationSettingsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService, deps: [{ token: i1.BaseHttpService }, { token: i2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
550
+ ConfigurationSettingsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService, deps: [{ token: i1.BaseHttpService }, { token: i1$2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
497
551
  ConfigurationSettingsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService });
498
552
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService, decorators: [{
499
553
  type: Injectable
500
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i2.MessageService }]; } });
554
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i1$2.MessageService }]; } });
501
555
 
502
556
  class ContextApiService {
503
557
  constructor(httpService) {
@@ -683,8 +737,8 @@ class SalesforceApiService {
683
737
  }
684
738
  apexGetRequest(path, params, options) {
685
739
  // this line is needed because HttpParams instance from Integration behaves wrong in studio instance of Angular
686
- // const httpParams = new HttpParams({ fromString: params.toString() });
687
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/apex${path}`, params }, options));
740
+ const httpParams = new HttpParams({ fromString: params.toString() });
741
+ return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/apex${path}`, params: httpParams }, options));
688
742
  }
689
743
  apexPostRequest(path, body, options) {
690
744
  return this.httpService.api(Object.assign({ method: 'post', body, url: `${this.SERVICE_URL}/apex${path}` }, options));
@@ -717,7 +771,7 @@ class DocumentTemplatesApiService {
717
771
  this.http = http;
718
772
  this.DOCGEN_TAG = 'docgen';
719
773
  this.SERVICE_URL = '/templates';
720
- this.DOC_GEN_URL_FALLBACK = 'https://dev-dp1.velocpq.com/docgen';
774
+ this.DOC_GEN_URL_FALLBACK = `${window.VELO_API}/docgen`;
721
775
  this.mapSfQueryResult = (limit) => map((records) => {
722
776
  if (!records.length) {
723
777
  return { _result: 'No Records Found' };
@@ -855,11 +909,13 @@ class DocumentTemplatesApiService {
855
909
  generateDocument(template, object, params = {}) {
856
910
  const documentData$ = this.generateDocumentData(template, object, Object.assign(Object.assign({}, params), { shouldPreventDownload: true }));
857
911
  return zip(this.getTemplateFile(template.id), documentData$, this.resolveAttachments$(template)).pipe(switchMap(([templateFile, data, attachments]) => {
858
- var _a, _b, _c, _d, _e, _f;
912
+ var _a, _b, _c, _d, _e, _f, _g, _h;
859
913
  const document = DocxTemplater.generate(templateFile, data);
860
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 : {};
861
- const documentName = properties['Name'] || template.name;
862
- 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;
863
919
  if (documentFormat === 'DOCX') {
864
920
  this.fileDownloadService.processDownload(document, documentName);
865
921
  return of(document);
@@ -1054,13 +1110,157 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1054
1110
  type: Injectable
1055
1111
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1056
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
+
1057
1252
  class FlowsApiService {
1058
1253
  constructor(configurationSettingsApiService) {
1059
1254
  this.configurationSettingsApiService = configurationSettingsApiService;
1060
1255
  this.flowsKey = 'flows';
1061
1256
  }
1062
1257
  getFlow(id) {
1063
- 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
+ }));
1064
1264
  }
1065
1265
  fetchFlows() {
1066
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)));
@@ -1236,22 +1436,85 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1236
1436
  type: Injectable
1237
1437
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1238
1438
 
1439
+ /**
1440
+ * Parses the response from Canvas and checks for errors.
1441
+ * - If an error is found, publishes an error message and returns the failover value.
1442
+ * - If no error is found, returns the parsed response.
1443
+ *
1444
+ * Note! The API call first goes to APEX before reaching the Canvas, so errors can originate from either APEX or Canvas.
1445
+ *
1446
+ * @param {string} response - The JSON string response from the Canvas call.
1447
+ * @param {T} failover - The value to return in case of error.
1448
+ * @returns {T | K} The parsed response or the failover value.
1449
+ *
1450
+ * @template T The expected type of the parsed response.
1451
+ * @template K The type of the failover value.
1452
+ *
1453
+ * @remarks If there's an Apex error, the response data can be an array.
1454
+ * In such cases, the function extracts the first element of the array.
1455
+ */
1456
+ const handleCanvasResponse = (response, failover, errorPublisher) => {
1457
+ const parsed = JSON.parse(response);
1458
+ const errorCandidate = isArray(parsed) ? parsed[0] : parsed;
1459
+ if (isApexError(errorCandidate)) {
1460
+ errorPublisher(errorCandidate.message);
1461
+ return failover;
1462
+ }
1463
+ if (isCanvasError(errorCandidate)) {
1464
+ errorPublisher(errorCandidate.error);
1465
+ return failover;
1466
+ }
1467
+ return parsed;
1468
+ };
1469
+
1239
1470
  class OrgInfoApiService {
1240
- constructor(http) {
1241
- var _a;
1242
- this.http = http;
1243
- this.CANVAS_URL_FALLBACK = 'https://canvas.velocpq.com';
1244
- this.hostUrl = (_a = window.VELO_CANVAS_API) !== null && _a !== void 0 ? _a : this.CANVAS_URL_FALLBACK;
1471
+ constructor(messageService) {
1472
+ this.messageService = messageService;
1473
+ /**
1474
+ * Shows an error message using the message service.
1475
+ *
1476
+ * @param {string} message - the error message to be published.
1477
+ */
1478
+ this.publishErrorMessage = (message) => {
1479
+ this.messageService.add({ severity: 'error', summary: message, sticky: true });
1480
+ };
1481
+ }
1482
+ getOrgInfo$() {
1483
+ try {
1484
+ return window.doCanvasCall && window.ORGANIZATION_ID
1485
+ ? from(window.doCanvasCall(`org-info/${window.ORGANIZATION_ID}`, null)).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
1486
+ : of(undefined);
1487
+ }
1488
+ catch (_a) {
1489
+ return of(undefined);
1490
+ }
1245
1491
  }
1246
- getOrgInfo$(organizationId) {
1247
- return this.http.get(`${this.hostUrl}/org-info/${organizationId}`);
1492
+ getAvailableVersionsInfo$() {
1493
+ try {
1494
+ return window.doCanvasCall && window.ORGANIZATION_ID
1495
+ ? from(window.doCanvasCall('versions/available', 'include_all=true')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
1496
+ : of(undefined);
1497
+ }
1498
+ catch (_a) {
1499
+ return of(undefined);
1500
+ }
1501
+ }
1502
+ upgradeVersion$(targetVersion) {
1503
+ try {
1504
+ return window.doCanvasCall && window.ORGANIZATION_ID
1505
+ ? from(window.doCanvasCall('versions/upgrade', `target_version=${targetVersion}`)).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
1506
+ : of(undefined);
1507
+ }
1508
+ catch (_a) {
1509
+ return of(undefined);
1510
+ }
1248
1511
  }
1249
1512
  }
1250
- 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 });
1513
+ OrgInfoApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, deps: [{ token: i1$2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
1251
1514
  OrgInfoApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService });
1252
1515
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, decorators: [{
1253
1516
  type: Injectable
1254
- }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
1517
+ }], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
1255
1518
 
1256
1519
  class PicklistsApiService {
1257
1520
  constructor(baseHttpService) {
@@ -1288,6 +1551,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1288
1551
  type: Injectable
1289
1552
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1290
1553
 
1554
+ class PortalsApiService {
1555
+ constructor(baseHttpService) {
1556
+ this.baseHttpService = baseHttpService;
1557
+ this.serviceUrl = '/admin/portal';
1558
+ this.getPortals$ = (skip = 1, name = '') => {
1559
+ let params = new HttpParams();
1560
+ params = params.append('count', (PortalsApiService.MAX_RESULTS * skip).toString());
1561
+ params = params.append('skip', '0');
1562
+ params = params.append('name', name);
1563
+ return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
1564
+ };
1565
+ this.searchPortals$ = (skip = 0, expression) => {
1566
+ let params = new HttpParams();
1567
+ params = params.set('skip', '' + skip);
1568
+ params = params.set('count', '' + PortalsApiService.MAX_RESULTS);
1569
+ return this.baseHttpService.api({
1570
+ method: 'post',
1571
+ url: `${this.serviceUrl}/search`,
1572
+ params,
1573
+ body: expression || {},
1574
+ });
1575
+ };
1576
+ this.removePortal$ = (id) => {
1577
+ return this.baseHttpService.api({
1578
+ url: `${this.serviceUrl}/${id}`,
1579
+ method: 'delete',
1580
+ });
1581
+ };
1582
+ this.restore$ = (id) => {
1583
+ return this.baseHttpService.api({
1584
+ method: 'patch',
1585
+ url: `${this.serviceUrl}/${id}/restore`,
1586
+ });
1587
+ };
1588
+ this.duplicatePortal$ = (cloneRequest) => {
1589
+ return this.baseHttpService.api({
1590
+ url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
1591
+ method: 'post',
1592
+ body: cloneRequest,
1593
+ });
1594
+ };
1595
+ this.getPortal$ = (id) => {
1596
+ return this.baseHttpService.api({
1597
+ url: `${this.serviceUrl}/${id}`,
1598
+ });
1599
+ };
1600
+ }
1601
+ createNewPortal$(body) {
1602
+ return this.baseHttpService.api({
1603
+ url: `${this.serviceUrl}`,
1604
+ method: 'post',
1605
+ body,
1606
+ });
1607
+ }
1608
+ updatePortal$(portal, settings) {
1609
+ return this.baseHttpService.api({
1610
+ url: `${this.serviceUrl}/${portal.id}`,
1611
+ method: 'put',
1612
+ body: Object.assign(Object.assign({}, portal), { settings: JSON.stringify(settings) }),
1613
+ });
1614
+ }
1615
+ }
1616
+ PortalsApiService.MAX_RESULTS = 60;
1617
+ PortalsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1618
+ PortalsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService });
1619
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, decorators: [{
1620
+ type: Injectable
1621
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1622
+
1291
1623
  class PriceApiService {
1292
1624
  constructor(httpService) {
1293
1625
  this.httpService = httpService;
@@ -1435,6 +1767,12 @@ class ProceduresApiService {
1435
1767
  body,
1436
1768
  });
1437
1769
  }
1770
+ fetchDefaultPricingSteps$() {
1771
+ return this.baseHttpService.api({
1772
+ url: `${this.ADMIN_SERVICE_URL}/pricing-steps`,
1773
+ method: 'get',
1774
+ });
1775
+ }
1438
1776
  }
1439
1777
  ProceduresApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1440
1778
  ProceduresApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService });
@@ -1889,7 +2227,9 @@ class QuoteApiService {
1889
2227
  this.httpService = httpService;
1890
2228
  this.SERVICE_URL = '/quotes';
1891
2229
  }
1892
- // request quoteId | accountId | opportunityId | orderId
2230
+ /**
2231
+ * @deprecated Use getQuoteState instead
2232
+ */
1893
2233
  getQuoteDraft(objectId, params, errorHandler) {
1894
2234
  return this.httpService.api({
1895
2235
  method: 'get',
@@ -1898,6 +2238,15 @@ class QuoteApiService {
1898
2238
  errorHandler,
1899
2239
  });
1900
2240
  }
2241
+ /**
2242
+ * Comparing to deprecated `getQuoteDraft` this endpoint doesn't include orders and assets
2243
+ * @param objectId quoteId | accountId | opportunityId | orderId
2244
+ * @param params Query params
2245
+ * @param options Request options
2246
+ */
2247
+ getQuoteState(objectId, params, options) {
2248
+ return this.httpService.api(Object.assign({ method: 'get', url: `/v2${this.SERVICE_URL}/${objectId}`, params }, options));
2249
+ }
1901
2250
  upsertQuote(request, options) {
1902
2251
  return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}`, body: request }, options));
1903
2252
  }
@@ -2253,11 +2602,13 @@ class ScriptsApiService {
2253
2602
  });
2254
2603
  };
2255
2604
  this.cloneScript$ = (cloneRequest) => {
2256
- return this.baseHttpService.api({
2605
+ return this.baseHttpService
2606
+ .api({
2257
2607
  url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
2258
2608
  method: 'post',
2259
2609
  body: cloneRequest,
2260
- });
2610
+ })
2611
+ .pipe(map(response => response.clonedRecordId));
2261
2612
  };
2262
2613
  this.removeScript$ = (id) => {
2263
2614
  return this.baseHttpService.api({
@@ -2656,6 +3007,11 @@ class UITemplatesApiService {
2656
3007
  this.fetchComponentAttachmentFile$(templateId, component.id, 'json'),
2657
3008
  ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
2658
3009
  };
3010
+ this.fetchComponentsAttachments$ = (templateId) => {
3011
+ return this.fetchComponents$(templateId).pipe(switchMap$1(components => {
3012
+ return forkJoin(components.map(component => this.fetchComponentAttachments$(templateId, component)));
3013
+ }));
3014
+ };
2659
3015
  this.fetchComponentAttachmentFile$ = (templateId, componentId, attachmentType) => {
2660
3016
  return this.baseHttpService
2661
3017
  .api({
@@ -2797,109 +3153,94 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2797
3153
  type: Injectable
2798
3154
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2799
3155
 
2800
- class PortalsApiService {
2801
- constructor(baseHttpService) {
2802
- this.baseHttpService = baseHttpService;
2803
- this.serviceUrl = '/admin/portal';
2804
- this.getPortals$ = (skip = 1, name = '') => {
2805
- let params = new HttpParams();
2806
- params = params.append('count', (PortalsApiService.MAX_RESULTS * skip).toString());
2807
- params = params.append('skip', '0');
2808
- params = params.append('name', name);
2809
- return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
2810
- };
2811
- this.searchPortals$ = (skip = 0, expression) => {
2812
- let params = new HttpParams();
2813
- params = params.set('skip', '' + skip);
2814
- params = params.set('count', '' + PortalsApiService.MAX_RESULTS);
2815
- return this.baseHttpService.api({
2816
- method: 'post',
2817
- url: `${this.serviceUrl}/search`,
2818
- params,
2819
- body: expression || {},
2820
- });
2821
- };
2822
- this.removePortal$ = (id) => {
2823
- return this.baseHttpService.api({
2824
- url: `${this.serviceUrl}/${id}`,
2825
- method: 'delete',
2826
- });
2827
- };
2828
- this.restore$ = (id) => {
2829
- return this.baseHttpService.api({
2830
- method: 'patch',
2831
- url: `${this.serviceUrl}/${id}/restore`,
2832
- });
2833
- };
2834
- this.duplicatePortal$ = (cloneRequest) => {
2835
- return this.baseHttpService.api({
2836
- url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
2837
- method: 'post',
2838
- body: cloneRequest,
2839
- });
2840
- };
2841
- this.getPortal$ = (id) => {
2842
- return this.baseHttpService.api({
2843
- url: `${this.serviceUrl}/${id}`,
2844
- });
2845
- };
3156
+ class SandboxManagerApiService {
3157
+ constructor(messageService) {
3158
+ this.messageService = messageService;
3159
+ /**
3160
+ * Shows an error message using the message service.
3161
+ *
3162
+ * @param {string} message - the error message to be published.
3163
+ */
3164
+ this.publishErrorMessage = (message) => {
3165
+ this.messageService.add({ severity: 'error', summary: message, sticky: true });
3166
+ };
3167
+ }
3168
+ getSalesforceOrganizations$() {
3169
+ try {
3170
+ return window.doSandboxCall
3171
+ ? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError$1(() => of([])))
3172
+ : of([]);
3173
+ }
3174
+ catch (_a) {
3175
+ return of([]);
3176
+ }
2846
3177
  }
2847
- createNewPortal$(body) {
2848
- return this.baseHttpService.api({
2849
- url: `${this.serviceUrl}`,
2850
- method: 'post',
2851
- body,
2852
- });
3178
+ getAvailableSalesforceOrganizationSizes$() {
3179
+ try {
3180
+ return window.doSandboxCall
3181
+ ? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError$1(() => of({})))
3182
+ : of({});
3183
+ }
3184
+ catch (_a) {
3185
+ return of({});
3186
+ }
2853
3187
  }
2854
- updatePortal$(portal, settings) {
2855
- return this.baseHttpService.api({
2856
- url: `${this.serviceUrl}/${portal.id}`,
2857
- method: 'put',
2858
- body: Object.assign(Object.assign({}, portal), { settings: JSON.stringify(settings) }),
2859
- });
3188
+ createSalesforceOrganization$(payload) {
3189
+ try {
3190
+ return window.doSandboxCall
3191
+ ? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3192
+ : of(undefined);
3193
+ }
3194
+ catch (err) {
3195
+ return of(undefined);
3196
+ }
2860
3197
  }
2861
- }
2862
- PortalsApiService.MAX_RESULTS = 60;
2863
- PortalsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2864
- PortalsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService });
2865
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, decorators: [{
2866
- type: Injectable
2867
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2868
-
2869
- class ConfigurationProcessorsApiService {
2870
- constructor(baseHttpService) {
2871
- this.baseHttpService = baseHttpService;
2872
- this.serviceUrl = '/configuration/processors/owners';
2873
- this.fetchConfigurationProcessors$ = (ownerId) => {
2874
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${ownerId}` });
2875
- };
2876
- this.createConfigurationProcessors$ = (configurationProcessor) => {
2877
- return this.baseHttpService.api({
2878
- method: 'post',
2879
- url: `${this.serviceUrl}/${configurationProcessor.ownerId}`,
2880
- body: configurationProcessor,
2881
- });
2882
- };
2883
- this.updateConfigurationProcessors$ = (configurationProcessor) => {
2884
- return this.baseHttpService.api({
2885
- method: 'put',
2886
- url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
2887
- body: configurationProcessor,
2888
- });
2889
- };
2890
- this.deleteConfigurationProcessors$ = (configurationProcessor) => {
2891
- return this.baseHttpService.api({
2892
- method: 'delete',
2893
- url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
2894
- });
2895
- };
3198
+ updateSalesforceOrganization$(payload) {
3199
+ try {
3200
+ return window.doSandboxCall
3201
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3202
+ : of(undefined);
3203
+ }
3204
+ catch (_a) {
3205
+ return of(undefined);
3206
+ }
3207
+ }
3208
+ deleteSalesforceOrganization$(payload) {
3209
+ try {
3210
+ return window.doSandboxCall
3211
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}`, '', 'DELETE')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3212
+ : of(undefined);
3213
+ }
3214
+ catch (_a) {
3215
+ return of(undefined);
3216
+ }
3217
+ }
3218
+ activateSalesforceOrganization$(payload) {
3219
+ try {
3220
+ return window.doSandboxCall
3221
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}/activate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3222
+ : of(undefined);
3223
+ }
3224
+ catch (_a) {
3225
+ return of(undefined);
3226
+ }
3227
+ }
3228
+ deactivateSalesforceOrganization$(payload) {
3229
+ try {
3230
+ return window.doSandboxCall
3231
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}/deactivate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
3232
+ : of(undefined);
3233
+ }
3234
+ catch (_a) {
3235
+ return of(undefined);
3236
+ }
2896
3237
  }
2897
3238
  }
2898
- ConfigurationProcessorsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2899
- ConfigurationProcessorsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService });
2900
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, decorators: [{
3239
+ SandboxManagerApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, deps: [{ token: i1$2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
3240
+ SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
3241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
2901
3242
  type: Injectable
2902
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3243
+ }], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
2903
3244
 
2904
3245
  class ApiModule {
2905
3246
  }
@@ -2946,6 +3287,8 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
2946
3287
  ContractedPriceApiService,
2947
3288
  PortalsApiService,
2948
3289
  ConfigurationProcessorsApiService,
3290
+ FlowStateApiService,
3291
+ SandboxManagerApiService,
2949
3292
  ], imports: [HttpClientModule] });
2950
3293
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, decorators: [{
2951
3294
  type: NgModule,
@@ -2992,6 +3335,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2992
3335
  ContractedPriceApiService,
2993
3336
  PortalsApiService,
2994
3337
  ConfigurationProcessorsApiService,
3338
+ FlowStateApiService,
3339
+ SandboxManagerApiService,
2995
3340
  ],
2996
3341
  }]
2997
3342
  }] });
@@ -3000,5 +3345,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3000
3345
  * Generated bundle index. Do not edit.
3001
3346
  */
3002
3347
 
3003
- export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationProcessorsApiService, ConfigurationSettingsApiService, ContextApiService, ContractedPriceApiService, DeltaApiService, DocumentAttachmentApiService, DocumentTemplatesApiService, EndpointsApiService, FlowsApiService, GuidedSellingApiService, GuidedSellingsAdminApiService, OffersApiService, OrgInfoApiService, PicklistsApiService, PortalsApiService, PriceApiService, ProceduresApiService, ProductApiService, ProductModelApiService, PromotionsApiService, QuoteApiService, RampApiService, RebateProgramApiService, RebateTypeApiService, RuleGroupsApiService, RulesApiService, SalesforceApiService, ScriptsApiService, ShoppingCartSettingsApiService, StatefulConfigurationApiService, UIDefinitionsApiService, UITemplatesApiService, VeloceAuthService, VeloceObjectsApiService };
3348
+ 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 };
3004
3349
  //# sourceMappingURL=veloceapps-api.mjs.map